index.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. <script setup>
  2. import Container from "../../components/Container/Container.vue";
  3. import LDialer from "../../uni_modules/lime-dialer/components/l-dialer/l-dialer.vue";
  4. import Modal from "../../components/Modal/Modal.vue";
  5. import { ref } from "vue";
  6. import { request } from "../../utils/request";
  7. import { onShow } from "@dcloudio/uni-app";
  8. const prizeList = ref([
  9. {
  10. id: "coupon88",
  11. name: "8.8折",
  12. img: "https://img11.360buyimg.com/pop/jfs/t1/175718/35/12595/5477/60b660c6Eb850717b/a1cfe750dcdb5b78.png",
  13. },
  14. {
  15. id: "coupon900",
  16. name: "900",
  17. img: "https://img11.360buyimg.com/pop/jfs/t1/190845/9/6092/4489/60b65fe8Ebb8f8284/955da889f6d1c13e.png",
  18. },
  19. ]);
  20. const data = ref([
  21. {
  22. name: "一",
  23. },
  24. {
  25. name: "二",
  26. },
  27. {
  28. name: "三",
  29. },
  30. {
  31. name: "四",
  32. isEnd: true,
  33. },
  34. ]);
  35. const dialer = ref(null);
  36. const onClick = async () => {
  37. if (lottery.value == 0) {
  38. uni.showToast({
  39. title: "暂无抽奖次数",
  40. icon: "none",
  41. });
  42. return;
  43. }
  44. const reward = await request(
  45. "api/question_bank/question_reception/lottery_sign_in/get_reward"
  46. );
  47. dialer.value.run(reward.data.reward_index);
  48. };
  49. const lottery = ref(0);
  50. const day = ref(0);
  51. const onDone = (_, origin) => {
  52. uni.showModal({
  53. title: "恭喜你获得",
  54. content: origin.name,
  55. });
  56. };
  57. const getList = async () => {
  58. const getlottery = await request(
  59. "api/question_bank/question_reception/lottery_usable/detail"
  60. );
  61. lottery.value = getlottery.data.number;
  62. const getData = await request(
  63. "api/question_bank/question_reception/lottery_sign_in/list"
  64. );
  65. prizeList.value = getData.data.reward_list.map((item) => {
  66. if (item.status) {
  67. day.value++;
  68. }
  69. return {
  70. ...item,
  71. name: item.reward_name,
  72. };
  73. });
  74. };
  75. const showModal = ref({
  76. show: false,
  77. });
  78. const qiandao = async () => {
  79. const res = await request(
  80. "api/question_bank/question_reception/check_in/set_user_record",
  81. {
  82. activity_id: 1,
  83. }
  84. );
  85. if (res.code === "error") return;
  86. if (day.value === data.value.length) {
  87. const reward = await request(
  88. "api/question_bank/question_reception/lottery_sign_in/get_reward"
  89. );
  90. showModal.value = {
  91. show: true,
  92. ...reward.data,
  93. };
  94. }
  95. };
  96. onShow(getList);
  97. </script>
  98. <template>
  99. <Container title="签到打卡" themeColor="#fff">
  100. <template #bg>
  101. <img
  102. src="https://openwork-oss.oss-cn-shenzhen.aliyuncs.com/uploads/question/2025/06/Au9JYRsneh9TmtnDw0ya2xctIvItn4SvpKgUl5Kh.png"
  103. width="750rpx"
  104. height="2059rpx"
  105. style="width: 750rpx; height: 2059rpx"
  106. alt=""
  107. />
  108. </template>
  109. <div class="items">
  110. <div class="gifs">
  111. <div
  112. v-for="item in data"
  113. class="gif-item"
  114. :style="{
  115. width: item.isEnd ? '100%' : '180rpx',
  116. }"
  117. :key="item.name"
  118. >
  119. <div class="mask" v-if="item.status">
  120. <img
  121. src="https://openwork-oss.oss-cn-shenzhen.aliyuncs.com/uploads/question/2025/06/L3NICP0cpYtUe4RFI5s1vyYTFCYmjjbqfc5L8LiJ.png"
  122. style="width: 118rpx; height: 118rpx"
  123. alt=""
  124. />
  125. </div>
  126. <template v-if="!item.isEnd">
  127. <div class="name">第{{ item.name }}天</div>
  128. <img
  129. style="
  130. width: 118rpx;
  131. height: 117.81rpx;
  132. background-size: 100% 100%;
  133. "
  134. src="https://openwork-oss.oss-cn-shenzhen.aliyuncs.com/uploads/question/2025/06/lfczc5uWYEfK4XP4GtlTRlmCtFHVapryiR7AgWLE.png"
  135. alt=""
  136. />
  137. </template>
  138. <template v-else>
  139. <div class="name">第{{ item.name }}天</div>
  140. <div style="display: flex; align-items: center">
  141. <span class="text-error">神秘</span>
  142. <img
  143. src="https://openwork-oss.oss-cn-shenzhen.aliyuncs.com/uploads/question/2025/06/7Is5IMCcauPZYS5MZJjKEThHaHAPFllI2pPf0AKI.png"
  144. style="width: 130rpx; height: 137rpx"
  145. alt=""
  146. />
  147. <span class="text-error">大奖</span>
  148. </div>
  149. </template>
  150. </div>
  151. </div>
  152. <div class="button b" @click="qiandao">参与打卡签到</div>
  153. <span class="text-t9 text-12"
  154. >需完成每日一练/完成一次题库练习<span class="text-warning"
  155. >并分享</span
  156. ></span
  157. >
  158. </div>
  159. <div class="dialer">
  160. <l-dialer
  161. :prizeList="prizeList"
  162. @click="onClick"
  163. @done="onDone"
  164. ref="dialer"
  165. size="230"
  166. />
  167. <img
  168. @click="onClick"
  169. class="btn"
  170. src="https://openwork-oss.oss-cn-shenzhen.aliyuncs.com/uploads/question/2025/06/tpWgvlnwA5G7A3PYZ4Op535n1M1uiYrNbftl7B4m.png"
  171. alt=""
  172. />
  173. <div style="color: #fff">剩余 {{ lottery }} 次</div>
  174. </div>
  175. </Container>
  176. <Modal v-model:open="showModal.show">
  177. <template #custom>
  178. <div class="css">
  179. <div class="bac">
  180. <img
  181. class="header"
  182. src="https://openwork-oss.oss-cn-shenzhen.aliyuncs.com/uploads/question/2025/06/qXKNJDt0XxL1f1VBzaQaavmGuAdyVBSopAt3xmq9.png"
  183. alt=""
  184. />
  185. <div class="middle">
  186. <img class="img" v-if="showModal.img" :src="showModal.img" alt="" />
  187. <div>{{ showModal.name }}</div>
  188. </div>
  189. <div class="t">开心收下</div>
  190. </div>
  191. <img @click="showModal = { show: false }" src="https://openwork-oss.oss-cn-shenzhen.aliyuncs.com/uploads/question/2025/06/v9DO9q0OYMwZ58Cb5YHO3z7ceXXEMx5Jf59bPT2w.png" class="close"></img>
  192. </div>
  193. </template>
  194. </Modal>
  195. </template>
  196. <style lang="scss" scoped>
  197. .b {
  198. background: linear-gradient(90deg, #ff8f18 0%, #fe6002 100%);
  199. border-radius: 200rpx 200rpx 200rpx 200rpx;
  200. margin: 32rpx 0 10rpx;
  201. }
  202. .bac {
  203. background: url(https://openwork-oss.oss-cn-shenzhen.aliyuncs.com/uploads/question/2025/06/2z6PwP2ooQkSOXVeydIewjpVvL0h0hgDD2srfUqK.png);
  204. background-size: 100% 100%;
  205. display: flex;
  206. align-items: center;
  207. justify-content: space-between;
  208. flex-direction: column;
  209. width: 548rpx;
  210. height: 658rpx;
  211. box-sizing: border-box;
  212. padding: 40rpx 0 56rpx;
  213. .middle {
  214. display: flex;
  215. align-items: center;
  216. flex-direction: column;
  217. gap: 9rpx;
  218. .img {
  219. width: 208rpx;
  220. height: 208rpx;
  221. background-size: 100% 100%;
  222. }
  223. }
  224. .header {
  225. width: 400rpx;
  226. height: 88rpx;
  227. background-size: 100% 100%;
  228. }
  229. .t {
  230. width: 272rpx;
  231. height: 77rpx;
  232. font-weight: 500;
  233. font-size: 32rpx;
  234. color: #ffffff;
  235. background: linear-gradient(180deg, #ff211a 0%, #ffb883 100%);
  236. box-shadow: inset 0rpx -2rpx 1rpx 0rpx #fff6b6,
  237. inset 0rpx 4rpx 6rpx 0rpx rgba(255, 255, 255, 0.6);
  238. border-radius: 50rpx;
  239. display: flex;
  240. align-items: center;
  241. justify-content: center;
  242. }
  243. }
  244. .css {
  245. display: flex;
  246. flex-direction: column;
  247. gap: 32rpx;
  248. align-items: center;
  249. .close {
  250. width: 48rpx;
  251. height: 48rpx;
  252. }
  253. }
  254. .items {
  255. background: url(https://openwork-oss.oss-cn-shenzhen.aliyuncs.com/uploads/question/2025/06/9rtXotBySN0yiKmoyT0d41QPox63L3F8Gpdvyt00.png)
  256. no-repeat;
  257. background-size: 100% 100%;
  258. width: 654rpx;
  259. height: 740rpx;
  260. margin: 165rpx auto 60rpx;
  261. padding: 23rpx 33rpx;
  262. box-sizing: border-box;
  263. display: flex;
  264. flex-direction: column;
  265. justify-content: flex-end;
  266. align-items: center;
  267. .gifs {
  268. display: flex;
  269. flex-wrap: wrap;
  270. gap: 25rpx;
  271. width: 100%;
  272. .gif-item {
  273. background: #ffeedd;
  274. border-radius: 16rpx;
  275. height: 194rpx;
  276. font-weight: bold;
  277. font-size: 28rpx;
  278. color: #e9782b;
  279. display: flex;
  280. flex-direction: column;
  281. justify-content: center;
  282. align-items: center;
  283. position: relative;
  284. .mask {
  285. width: 100%;
  286. height: 100%;
  287. display: flex;
  288. align-items: center;
  289. justify-content: center;
  290. background-color: rgba($color: #000000, $alpha: 0.4);
  291. position: absolute;
  292. border-radius: 16rpx;
  293. }
  294. }
  295. .end {
  296. grid-column-start: 3;
  297. }
  298. }
  299. }
  300. .dialer {
  301. background-size: 100% 100%;
  302. width: 534rpx;
  303. height: 758rpx;
  304. margin: 0 auto;
  305. display: flex;
  306. flex-direction: column;
  307. align-items: center;
  308. box-sizing: border-box;
  309. background: url(https://openwork-oss.oss-cn-shenzhen.aliyuncs.com/uploads/question/2025/06/JDNYxtJNVLcDvwyAxDRvx0SOmL2Eca42zJRNko2v.png)
  310. no-repeat;
  311. background-size: 100% 100%;
  312. padding-top: 34rpx;
  313. .btn {
  314. margin: 106rpx 0 0;
  315. width: 300rpx;
  316. height: 103rpx;
  317. }
  318. }
  319. </style>