|
@@ -9,6 +9,12 @@
|
|
|
<view v-for="val in items" :key="val.id" @tap="handleToJobFairEnterprises(val)" class="list-item defaultBgc default-border">
|
|
|
<image v-if="val?.previewImg" class="ss-m-t-10" :src="val.previewImg" mode="widthFix" style="width: 100%; height: auto; border-radius: 6px;"></image>
|
|
|
<view class="ss-m-t-20 MiSans-Normal">活动主题:{{ val.title }}</view>
|
|
|
+ <view class="ss-m-t-20 MiSans-Normal">
|
|
|
+ 活动状态:
|
|
|
+ <text class="font-weight-bold" :class="[`color-${checkActivityTime(val.startTime, val.endTime)?.color}`]">
|
|
|
+ {{ checkActivityTime(val.startTime, val.endTime)?.desc }}
|
|
|
+ </text>
|
|
|
+ </view>
|
|
|
<view class="ss-m-t-20 MiSans-Normal">活动时间:{{ timesTampChange(val.startTime, 'Y-M-D') }}至{{ timesTampChange(val.endTime, 'Y-M-D') }}</view>
|
|
|
<button class="ss-m-t-20 ss-m-b-10 MiSans-Medium" style="background-color: #00B760; color: #fff;" type="primary">查看详情</button>
|
|
|
</view>
|
|
@@ -80,11 +86,64 @@ const loadingMore = () => {
|
|
|
getList()
|
|
|
}
|
|
|
|
|
|
+function checkActivityTime(startTimeStamp, endTimeStamp) {
|
|
|
+ // 获取当前时间
|
|
|
+ const now = new Date()
|
|
|
+ const currentTime = now.getTime()
|
|
|
+
|
|
|
+ // 处理开始时间:设置为当天的 00:00:00
|
|
|
+ const startDate = new Date(startTimeStamp)
|
|
|
+ const startOfDay = new Date(
|
|
|
+ startDate.getFullYear(),
|
|
|
+ startDate.getMonth(),
|
|
|
+ startDate.getDate(),
|
|
|
+ 0, 0, 0, 0
|
|
|
+ )
|
|
|
+ const adjustedStartTime = startOfDay.getTime()
|
|
|
+
|
|
|
+ // 处理结束时间:设置为当天的 23:59:59
|
|
|
+ const endDate = new Date(endTimeStamp)
|
|
|
+ const endOfDay = new Date(
|
|
|
+ endDate.getFullYear(),
|
|
|
+ endDate.getMonth(),
|
|
|
+ endDate.getDate(),
|
|
|
+ 23, 59, 59, 999
|
|
|
+ )
|
|
|
+ const adjustedEndTime = endOfDay.getTime()
|
|
|
+
|
|
|
+ // 判断时间关系
|
|
|
+ if (currentTime < adjustedStartTime) {
|
|
|
+ return {
|
|
|
+ canJoin: false,
|
|
|
+ desc: '待开始',
|
|
|
+ message: '该招聘会尚未开始,无法查看详情',
|
|
|
+ color: 'warning'
|
|
|
+ }
|
|
|
+ } else if (currentTime > adjustedEndTime) {
|
|
|
+ return {
|
|
|
+ canJoin: false,
|
|
|
+ desc: '已结束',
|
|
|
+ message: '该招聘会已结束,无法查看详情',
|
|
|
+ color: 'error'
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return {
|
|
|
+ canJoin: true,
|
|
|
+ color: 'primary',
|
|
|
+ desc: '进行中'
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
//招聘会
|
|
|
const handleToJobFairEnterprises = (val) => {
|
|
|
if (!val?.id) {
|
|
|
- uni.showToast({ title: '进去招聘会失败!', icon: 'none' })
|
|
|
+ uni.showToast({ title: '暂无详情!', icon: 'none' })
|
|
|
}
|
|
|
+ const obj = checkActivityTime(val.startTime, val.endTime)
|
|
|
+ // 不可参加的,弹出提示语
|
|
|
+ if (!obj.canJoin) return uni.showToast({ title: obj.message, icon: 'none', duration: 2000 })
|
|
|
+
|
|
|
let url = `/pagesB/jobFair/${Number(val?.category) ? 'positionClassification': 'enterprisesClassification'}?jobFairId=${val.id}`
|
|
|
uni.navigateTo({url})
|
|
|
}
|