checkinPopup.vue 5.1 KB

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