From f35621881efb08d3c3c4db01dec359f5234fd3ac Mon Sep 17 00:00:00 2001 From: = <=> Date: Wed, 27 May 2026 10:42:23 +0800 Subject: [PATCH] commit --- .../zhghh5/activity/culture/signUp.html | 61 +++++++++++++++++-- 1 file changed, 57 insertions(+), 4 deletions(-) diff --git a/src/main/resources/views/platform/zhghh5/activity/culture/signUp.html b/src/main/resources/views/platform/zhghh5/activity/culture/signUp.html index 1bb6ba37..66824f04 100644 --- a/src/main/resources/views/platform/zhghh5/activity/culture/signUp.html +++ b/src/main/resources/views/platform/zhghh5/activity/culture/signUp.html @@ -114,6 +114,10 @@ layout("/layouts/platform_h5.html"){ height: 100%; } + .footer .van-count-down { + color: #ffffff; + } + .form-create-h5 { background-color: #ffffff; margin-top: 10px; @@ -330,6 +334,12 @@ layout("/layouts/platform_h5.html"){ @@ -373,7 +383,9 @@ layout("/layouts/platform_h5.html"){ //表格用户 teamUsers: [], //是否报名 - isSignUp: false + isSignUp: false, + nowTime: new Date().getTime(), + countdownTimer: null } }, @@ -392,16 +404,51 @@ layout("/layouts/platform_h5.html"){ //是否在活动报名时间内 inApplyTime() { if (this.viewData) { - const now = new Date().getTime() const start = this.$moment(this.viewData.applyStartTime).valueOf() const end = this.$moment(this.viewData.applyEndTime).valueOf() - return now >= start && now <= end + return this.nowTime >= start && this.nowTime <= end + } + return false + }, + //报名未开始时显示倒计时,避免底部操作区空白 + signUpNotStarted() { + if (this.viewData && this.viewData.applyStartTime) { + return this.nowTime < this.$moment(this.viewData.applyStartTime).valueOf() + } + return false + }, + applyStartCountdownTime() { + if (this.viewData && this.viewData.applyStartTime) { + const start = this.$moment(this.viewData.applyStartTime).valueOf() + return Math.max(start - this.nowTime, 0) + } + return 0 + }, + activityEnded() { + if (this.viewData && this.viewData.endTime) { + return this.$moment(this.viewData.endTime).valueOf() < this.nowTime } return false } }, methods: { + //统一刷新当前时间,保证报名开始或结束时按钮状态能自动切换 + refreshNowTime() { + this.$set(this, "nowTime", new Date().getTime()) + }, + startCountdownTimer() { + this.stopCountdownTimer() + this.$set(this, "countdownTimer", setInterval(() => { + this.refreshNowTime() + }, 1000)) + }, + stopCountdownTimer() { + if (this.countdownTimer) { + clearInterval(this.countdownTimer) + this.$set(this, "countdownTimer", null) + } + }, init() { if (this.id) { this.$axios.post("/platform/activity/culture/infoManage/activityInfo", {id: this.id}).then((res) => { @@ -768,6 +815,12 @@ layout("/layouts/platform_h5.html"){ }, created() { this.init() + }, + mounted() { + this.startCountdownTimer() + }, + beforeDestroy() { + this.stopCountdownTimer() } })