Parcourir la source

招聘会状态文字修改

Xiao_123 il y a 1 jour
Parent
commit
aced0ef754
1 fichiers modifiés avec 18 ajouts et 1 suppressions
  1. 18 1
      pages/index/jobFair.vue

+ 18 - 1
pages/index/jobFair.vue

@@ -12,7 +12,7 @@
               <view class="ss-m-t-20 ss-m-b-10">
                 活动状态:
                 <span class="font-weight-bold" :style="{'color': val.status === '0' ? '#00b760' : '#ff5252'}">
-                  {{ val.status === '0' ? '进行中' : '已结束' }}
+                  {{ val.status === '0' ? checkActivityTime(val.startTime, val.endTime) ? '筹备中' : '进行中' : '已结束' }}
                 </span>
               </view>
               <view>活动时间:{{ timesTampChange(val.startTime, 'Y-M-D') }}至{{ timesTampChange(val.endTime, 'Y-M-D') }}</view>
@@ -86,6 +86,23 @@ const getList = async () => {
   }
 }
 
+function checkActivityTime(startTimeStamp) {
+  const now = new Date()
+  const currentTime = now.getTime()
+ 
+  const startDate = new Date(startTimeStamp)
+  const startOfDay = new Date(
+    startDate.getFullYear(),
+    startDate.getMonth(),
+    startDate.getDate(),
+    0, 0, 0, 0
+  )
+  const adjustedStartTime = startOfDay.getTime()
+ 
+  // 判断时间关系
+  if (currentTime < adjustedStartTime) return true // 活动未开始
+}
+
 // 加载更多
 const loadingMore = () => {
   if (more.value === 'noMore') return