Xiao_123 преди 2 седмици
родител
ревизия
e7f1461390
променени са 1 файла, в които са добавени 18 реда и са изтрити 1 реда
  1. 18 1
      src/views/recruit/enterprise/jobFair/index.vue

+ 18 - 1
src/views/recruit/enterprise/jobFair/index.vue

@@ -8,7 +8,7 @@
           <div>
             活动状态:
             <span class="font-weight-bold" :style="{'color': k.status === '0' ? 'var(--v-primary-base)' : 'var(--v-error-base)'}">
-              {{ k.status === '0' ? '进行中' : '已结束' }}
+              {{ k.status === '0' ? checkActivityTime(k.startTime, k.endTime) ? '筹备中' : '进行中' : '已结束' }}
             </span>
           </div>
           <div>活动时间:{{ timesTampChange(k.startTime, 'Y-M-D') }}至{{ timesTampChange(k.endTime, 'Y-M-D') }}</div>
@@ -109,6 +109,23 @@ const handleChangePage = (val) => {
   getList()
 }
 
+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 timer = ref(null)
 const showDialog = ref(false)