checkinPopup.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <template>
  2. <up-popup :show="showPopup" mode="center" @close="closeCheckPopup" bgColor="transparent" overlayOpacity="0.8">
  3. <view class="check-popup">
  4. <view class="title">
  5. <image class="left-image image" :src="`${config.BASIC_IMG}img/treePage/two-star.png`" alt="" />
  6. <text>恭喜你,登录成功</text>
  7. <image class="right-image image" :src="`${config.BASIC_IMG}img/treePage/two-star.png`" alt="" />
  8. </view>
  9. <view class="check-wrap">
  10. <!-- First row with 3 items -->
  11. <view class="check-row">
  12. <view v-for="(item, index) in firstRowItems" :key="index"
  13. :class="['check-day', { active: runningDays == index + 1 },{gary:runningDays > index + 1}]">
  14. <view class="leaf-wrap">
  15. <image class="leaf"
  16. :src="`${config.BASIC_IMG}img/treePage/${runningDays == index + 1 ? 'white-leaf' : runningDays > index + 1 ?'gary-leaf':'leaf-icon'}.png`"
  17. alt="leaf icon" />
  18. <text>x{{ item.energy }}</text>
  19. </view>
  20. <view v-if="runningDays > index + 1"><text>已领取</text></view>
  21. <view v-else><text v-if="runningDays == index + 1">累计</text>{{ item.days }}天</view>
  22. </view>
  23. </view>
  24. <!-- Second row with 4 items -->
  25. <view class="check-row">
  26. <view v-for="(item, index) in secondRowItems" :key="index"
  27. :class="['check-day', { active: runningDays == index + 4 },{gary:runningDays > index + 4}]">
  28. <view class="leaf-wrap">
  29. <image class="leaf"
  30. :src="`${config.BASIC_IMG}img/treePage/${runningDays == index + 4 ? 'white-leaf' : runningDays > index + 4 ?'gary-leaf':'leaf-icon'}.png`"
  31. alt="leaf icon" />
  32. <text>x{{ item.energy }}</text>
  33. </view>
  34. <view v-if="runningDays > index + 4"><text>已领取</text></view>
  35. <view v-else><text v-if="runningDays == index + 4">累计</text>{{ item.days }}天</view>
  36. </view>
  37. </view>
  38. </view>
  39. <view class="button" @click="showPopup = false">开心收下</view>
  40. <view class="close">
  41. <up-icon name="close-circle-fill" size="30" @click="showPopup = false"
  42. color="rgba(255, 255, 255, 0.7)"></up-icon>
  43. </view>
  44. </view>
  45. </up-popup>
  46. </template>
  47. <script setup>
  48. import config from "@/api/config.js"
  49. import TREE from '@/api/tree.js'
  50. import {
  51. onMounted,
  52. ref,
  53. } from "vue";
  54. const firstRowItems = ref([]);
  55. const secondRowItems = ref([]);
  56. const showPopup = ref(false);
  57. const getRules = () => {
  58. TREE.ruleList().then((res) => {
  59. firstRowItems.value = res.data.slice(0, 3);
  60. secondRowItems.value = res.data.slice(3);
  61. });
  62. };
  63. const runningDays = ref(0)
  64. const checkIn = () => {
  65. TREE.sign().then((res) => {
  66. if (res.code === 0) {
  67. runningDays.value = res.data.runningDays
  68. getRules();
  69. showPopup.value = true;
  70. }
  71. });
  72. };
  73. onMounted(() => {
  74. checkIn();
  75. });
  76. function closeCheckPopup() {
  77. emit('closedCheckPopup');
  78. }
  79. const emit = defineEmits(['closedCheckPopup']);
  80. </script>
  81. <style lang="scss" scoped>
  82. @import "@/static/style/mixin.scss";
  83. .check-popup {
  84. width: 100%;
  85. text-align: center;
  86. .title {
  87. font-size: 56rpx;
  88. letter-spacing: 2rpx;
  89. font-family: "PangMenZhengDao";
  90. background: linear-gradient(to bottom, #FFFFFF, #FFD23C);
  91. -webkit-background-clip: text;
  92. background-clip: text;
  93. -webkit-text-fill-color: transparent;
  94. color: transparent;
  95. position: relative;
  96. .image {
  97. width: 48rpx;
  98. height: 48rpx;
  99. position: absolute;
  100. }
  101. .left-image {
  102. top: 0;
  103. left: -14rpx;
  104. }
  105. .right-image {
  106. right: -14rpx;
  107. bottom: 0;
  108. }
  109. &::before {
  110. content: '';
  111. position: absolute;
  112. width: 600rpx;
  113. height: 104rpx;
  114. bottom: -44rpx;
  115. left: -14rpx;
  116. @include ossBg("treePage/check-title-bg.png");
  117. }
  118. }
  119. .check-wrap {
  120. margin: 60rpx 0 100rpx 0;
  121. display: flex;
  122. flex-direction: column;
  123. align-items: center;
  124. min-height: 322rpx;
  125. .check-row {
  126. margin-top: 14rpx;
  127. display: flex;
  128. .check-day {
  129. width: 124rpx;
  130. box-sizing: border-box;
  131. padding: 28rpx 0;
  132. font-size: 24rpx;
  133. color: #f3b242;
  134. background: rgba(255, 255, 255, 0.32);
  135. border-radius: 10rpx;
  136. text-align: center;
  137. &.active {
  138. background-image: linear-gradient(120deg, #ffd887, #ed9e1e);
  139. color: #fff;
  140. border: 2rpx solid #fff;
  141. }
  142. &.gary {
  143. color: rgba(255, 255, 255, 0.6);
  144. }
  145. .leaf-wrap {
  146. display: flex;
  147. justify-content: center;
  148. font-size: 28rpx;
  149. align-items: baseline;
  150. .leaf {
  151. width: 50rpx;
  152. height: 46rpx;
  153. margin-bottom: 12rpx;
  154. margin-right: 6rpx;
  155. }
  156. }
  157. }
  158. .check-day+.check-day {
  159. margin-left: 10rpx;
  160. }
  161. }
  162. }
  163. .button {
  164. margin: auto;
  165. width: 312rpx;
  166. font-size: 44rpx;
  167. padding: 20rpx 0;
  168. border-radius: 50rpx;
  169. font-family: "PangMenZhengDao";
  170. color: #954600;
  171. background: linear-gradient(120deg, #ffe6b2, #ffc339);
  172. text-align: center;
  173. }
  174. .close {
  175. margin-top: 40rpx;
  176. display: flex;
  177. justify-content: center;
  178. }
  179. }
  180. </style>