checkinPopup.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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. } else {
  71. closeCheckPopup()
  72. }
  73. });
  74. };
  75. onMounted(() => {
  76. checkIn();
  77. });
  78. function closeCheckPopup() {
  79. emit('closedCheckPopup');
  80. }
  81. const emit = defineEmits(['closedCheckPopup']);
  82. </script>
  83. <style lang="scss" scoped>
  84. @import "@/static/style/mixin.scss";
  85. .check-popup {
  86. width: 100%;
  87. text-align: center;
  88. .title {
  89. font-size: 56rpx;
  90. letter-spacing: 2rpx;
  91. font-family: "PangMenZhengDao";
  92. background: linear-gradient(to bottom, #FFFFFF, #FFD23C);
  93. -webkit-background-clip: text;
  94. background-clip: text;
  95. -webkit-text-fill-color: transparent;
  96. color: transparent;
  97. position: relative;
  98. .image {
  99. width: 48rpx;
  100. height: 48rpx;
  101. position: absolute;
  102. }
  103. .left-image {
  104. top: 0;
  105. left: 84rpx;
  106. }
  107. .right-image {
  108. right: 84rpx;
  109. bottom: 0;
  110. }
  111. &::before {
  112. content: '';
  113. position: absolute;
  114. width: 600rpx;
  115. height: 104rpx;
  116. bottom: -44rpx;
  117. left: 84rpx;
  118. @include ossBg("treePage/check-title-bg.png");
  119. }
  120. }
  121. .check-wrap {
  122. margin: 60rpx 0 100rpx 0;
  123. display: flex;
  124. flex-direction: column;
  125. align-items: center;
  126. min-height: 322rpx;
  127. .check-row {
  128. margin-top: 14rpx;
  129. display: flex;
  130. .check-day {
  131. width: 124rpx;
  132. box-sizing: border-box;
  133. padding: 28rpx 0;
  134. font-size: 24rpx;
  135. color: #f3b242;
  136. background: rgba(255, 255, 255, 0.32);
  137. border-radius: 10rpx;
  138. text-align: center;
  139. &.active {
  140. background-image: linear-gradient(120deg, #ffd887, #ed9e1e);
  141. color: #fff;
  142. border: 2rpx solid #fff;
  143. }
  144. &.gary {
  145. color: rgba(255, 255, 255, 0.6);
  146. }
  147. .leaf-wrap {
  148. display: flex;
  149. justify-content: center;
  150. font-size: 28rpx;
  151. align-items: baseline;
  152. .leaf {
  153. width: 50rpx;
  154. height: 46rpx;
  155. margin-bottom: 12rpx;
  156. margin-right: 6rpx;
  157. }
  158. }
  159. }
  160. .check-day+.check-day {
  161. margin-left: 10rpx;
  162. }
  163. }
  164. }
  165. .button {
  166. margin: auto;
  167. width: 312rpx;
  168. font-size: 44rpx;
  169. padding: 20rpx 0;
  170. border-radius: 50rpx;
  171. font-family: "PangMenZhengDao";
  172. color: #954600;
  173. background: linear-gradient(120deg, #ffe6b2, #ffc339);
  174. text-align: center;
  175. }
  176. .close {
  177. margin-top: 40rpx;
  178. display: flex;
  179. justify-content: center;
  180. }
  181. }
  182. </style>