index.vue 9.8 KB

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