Explorar o código

fix:签到添加 当状态为4的时候,比当前小为未开始,比当前大 则为已结束

xyh hai 4 meses
pai
achega
c104e9b147
Modificáronse 1 ficheiros con 15 adicións e 3 borrados
  1. 15 3
      src/points/components/sign-in/sign-in.vue

+ 15 - 3
src/points/components/sign-in/sign-in.vue

@@ -16,7 +16,7 @@
         @click="handleSign(day, index)"
       >
         <view class="sign-day-circle" :class="getSignCircleClass(day)">
-          <ImageItem src="/static/points/Signed.png" v-if="day.status == '1'"/>
+          <ImageItem src="/static/points/Signed.png" v-if="day.status == '1' || day.status == '4'"/>
           <ImageItem src="/static/points/notSigned.png" v-else/>
           <text class="sign-day-number" v-if="[0,2].includes(day.status)">+{{ day.points }}</text>
         </view>
@@ -53,13 +53,25 @@ export default {
   methods: {
     getSignCircleClass(day) {
       return {
-        'signed-circle': day.status == '1',
-        'select-circle': day.status == '2'
+        'signed-circle': day.status == '1' || day.status == '4',
+        'select-circle': day.status == '2',
       }
     },
     getSignText(day) {
       if (day.status == '1') return '已签到'
       if (day.status == '3') return '未签到'
+      if (day.status == '4') {
+        const currentDate = new Date();
+        const dayDate = new Date(day.date);
+        // 比较日期,忽略时间部分
+        const currentDateOnly = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate());
+        const dayDateOnly = new Date(dayDate.getFullYear(), dayDate.getMonth(), dayDate.getDate());
+        if (dayDateOnly < currentDateOnly) {
+          return '未开始';
+        } else {
+          return '已结束';
+        }
+      }
       return day.date
     },
     //0:未签, 1:已签, 2:今天未签到 , 3:断签,4:已过期