diff --git a/src/views/activity/index.vue b/src/views/activity/index.vue index 0bd5956..b70c22d 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) ? '已报名' : '报名' }} @@ -85,6 +85,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: {}, }