Browse Source

活动详情按钮权限

feature
mk 1 year ago
parent
commit
cde41558c7
  1. 42
      src/views/activity/detail.vue

42
src/views/activity/detail.vue

@ -47,7 +47,7 @@
<template #icon> <template #icon>
<img src="@/assets/images/icons/share.png" alt="" class="img_20"> <img src="@/assets/images/icons/share.png" alt="" class="img_20">
</template> 转发</van-button> </template> 转发</van-button>
<van-button type="info" size="small" :disabled="new Date(this.info.cutOffTime.replace(/-/g, '/')).getTime() < Date.now() || this.info.currentParticipants >= this.info.participants" round @click="save" v-if="info.online === 1">立即报名</van-button> <van-button type="info" size="small" :disabled="disabledRecord(info)" round @click="save" v-if="info.online === 1">立即报名</van-button>
</div> </div>
</div> </div>
<Share :show="showShare" @closeShare="showShare = false" /> <Share :show="showShare" @closeShare="showShare = false" />
@ -124,29 +124,35 @@ export default {
this.isPast = specifiedTimestamp < currentTimestamp; this.isPast = specifiedTimestamp < currentTimestamp;
}, },
async detail(id, delId) { async detail(id, delId) {
if (delId) { const handleResponse = (res) => {
this.signUp = this.signUp.filter(item => item.id != delId)
} else {
let res = await detail(id)
if (res.code === 0) { if (res.code === 0) {
this.info = res.data; this.info = res.data;
if (res.data.recordList.length != 0) { this.info.participants = res.data.participants;
this.signUp = res.data.recordList this.info.currentParticipants = res.data.currentParticipants;
} if (res.data.recordList && res.data.recordList.length > 0) {
if (res.data.cutOffTime) { this.signUp = res.data.recordList;
this.checkIfPast() }
} if (res.data.cutOffTime) {
this.checkIfPast();
} }
}
};
if (delId) {
this.signUp = this.signUp.filter(item => item.id != delId);
} }
let res = await detail(id);
handleResponse(res);
}, },
handelAddResi() { handelAddResi() {
this.signUp.push({ name: "", mobile: "", remark: "", }) this.signUp.push({ name: "", mobile: "", remark: "", })
}, },
handelDelResi(item, index) { handelDelResi(item, index) {
if (item.id) { if (item.id) {
let than = this
communityActivityApplicationRecordDelete([item.id]).then(res => { communityActivityApplicationRecordDelete([item.id]).then(res => {
if (res.code === 0) { if (res.code === 0) {
this.detail(this.$route.query.id, item.id); than.detail(this.$route.query.id, item.id);
} }
}).catch(err => { }).catch(err => {
console.log(err); console.log(err);
@ -186,7 +192,15 @@ export default {
}, },
}, },
components: { Share, registerDialog }, components: { Share, registerDialog },
computed: {}, computed: {
disabledRecord() {
return (item) => {
if (!item.cutOffTime || item.online != 1) return true
let flag = new Date(item.cutOffTime.replace(/-/g, '/')).getTime() < Date.now() || item.currentParticipants >= item.participants || item.currentParticipants >= item.participants;
return flag || false
}
},
},
watch: {}, watch: {},
} }
</script> </script>

Loading…
Cancel
Save