index.vue 9.8 KB

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