From 206b0809243e4f7f076c583d9de3b9a9c9f1ca22 Mon Sep 17 00:00:00 2001 From: mk <2403457699@qq.com> Date: Mon, 15 Jul 2024 13:39:33 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A4=BE=E5=8C=BA=E6=B4=BB=E5=8A=A8=E5=88=97?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/activity/index.vue | 10 +++++++++- src/views/home/index.vue | 9 ++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/views/activity/index.vue b/src/views/activity/index.vue index 15a12de..8b4332c 100644 --- a/src/views/activity/index.vue +++ b/src/views/activity/index.vue @@ -15,7 +15,7 @@ }}/{{ item.participants }}人 {{ recordFlag(item) ? '已报名' : '报名' }} + :disabled="disabledRecord(item)">{{ recordFlag(item) ? '已报名' : '报名' }} @@ -84,6 +84,14 @@ export default { return item.recordList.findIndex(itemC => itemC.mobile === this.$store.state.app.userInfo.mobile) != -1 } }, + disabledRecord() { + return (item) => { + if (!item.cutOffTime) return false + let flag = new Date(item.cutOffTime.replace(/-/g, '/')).getTime() < Date.now() || item.currentParticipants >= item.participants; + return flag || false + } + }, + }, watch: {}, } diff --git a/src/views/home/index.vue b/src/views/home/index.vue index 71d5505..40200ef 100644 --- a/src/views/home/index.vue +++ b/src/views/home/index.vue @@ -68,7 +68,7 @@ class="font-size14">{{ item.participants }}人 {{recordFlag(item)?'已报名':'报名'}} + :disabled="disabledRecord(item)">{{recordFlag(item)?'已报名':'报名'}} @@ -347,6 +347,13 @@ export default { return item.recordList.findIndex(itemC=>itemC.mobile === this.$store.state.app.userInfo.mobile) != -1 } }, + disabledRecord() { + return (item) => { + if (!item.cutOffTime) return false + let flag = new Date(item.cutOffTime.replace(/-/g, '/')).getTime() < Date.now() || item.currentParticipants >= item.participants; + return flag || false + } + }, }, watch: {}, }