diff --git a/teamwork/pages/team/activity-detail.vue b/teamwork/pages/team/activity-detail.vue index c59ca7cdfea936a7ed8626c6484e82535dd62b7d..6f8a7f2e5f5f8f4da9f62fbd04a519420c47986c 100644 --- a/teamwork/pages/team/activity-detail.vue +++ b/teamwork/pages/team/activity-detail.vue @@ -1,3 +1,4 @@ + @@ -52,16 +58,18 @@ export default { data() { return { - userId: '644a643a0c801ca878983559', - icon: '/static/icon/1.png', - activityId: '64508598819ce8deee7ed255', - name: '不会取名字', - production: '111111111111111111111111111111111111111111', - object: '0', + signStatus: '报名', + userId: '', + icon: '', + activityId: '', + name: '', + production: '', + object: '', + alreadyObject: '', startDate: '2023-05-03 19:00', endDate: '2023-05-03 19:00', - place: '风雨操场', - contact: '1612737522@qq.com' + place: '', + contact: '' } }, methods: { @@ -72,31 +80,59 @@ animationDuration: 300 }) }, - async apply() { - await uniCloud.callFunction({ - name: 'fe-team-applyActivity', - data: { - userId: this.userId, - activityId: this.activityId - } - }) - .then(res => { - console.log(res) - this.applyCode = res.result.code - console.log(res.result.message) - console.log(this.applyCode) - }) - await this.showTT(); + async apply(opt) { + if (opt == '报名') { + await uniCloud.callFunction({ + name: 'fe-team-applyActivity', + data: { + userId: this.userId, + activityId: this.activityId + } + }) + .then(res => { + console.log(res) + this.applyCode = res.result.code + console.log(res.result.message) + console.log(this.applyCode) + }) + await this.showTT(); + } else if (opt == '取消报名') { + await uniCloud.callFunction({ + name: 'fe-team-leaveActivity', + data: { + userId: this.userId, + activityId: this.activityId + } + }) + .then(res => { + console.log(res) + this.applyCode = res.result.code + console.log(res.result.message) + console.log(this.applyCode) + }) + await this.showTT(); + } else if (opt == '报名已停止') { + + } }, + Refresh() { + // 刷新当前页面 + var pages = getCurrentPages(); //获取所有页面的数组对象 + var currPage = pages[pages.length - 1]; //当前页面 + uni.reLaunch({ + url: currPage.$page.fullPath + }) + }, showTT() { if (this.applyCode == 200) { uni.showToast({ title: '报名成功' }); + this.Refresh() } else { uni.showToast({ - title: '您已报名,请勿重复报名', + title: '失败', icon: 'none' }); } @@ -105,10 +141,13 @@ onLoad(option) { this.userId = getApp().globalData.userId this.activityId = option.activityId + console.log(this.activityId) console.log(option.activityId) + console.log(this.userId) uniCloud.callFunction({ name: 'fe-team-activityDetail', data: { + userId: this.userId, activityId: this.activityId } }) @@ -119,10 +158,14 @@ this.startDate = res.result.data.startDate this.endDate = res.result.data.endDate this.object = res.result.data.participants + this.alreadyObject = res.result.data.enrollment this.place = res.result.data.place this.contact = res.result.data.contact this.icon = res.result.data.icon - }) + this.signStatus = res.result.qualification + }).catch((err => { + console.log(err) + })) } } diff --git a/teamwork/pages/team/main.vue b/teamwork/pages/team/main.vue index c1a3308aa02505ae8ae798c354884cdea258e4d0..d6bb14f0c33776a76eb8c0df1a588dc0bd925f2e 100644 --- a/teamwork/pages/team/main.vue +++ b/teamwork/pages/team/main.vue @@ -183,8 +183,8 @@ } }, - dialogConfirm() { - uniCloud.callFunction({ + async dialogConfirm() { + await uniCloud.callFunction({ name: 'fe-team-leaveTeam', data: { userId: this.userId @@ -193,6 +193,7 @@ .then(res => { if (res.result.code == 200) { this.join = false + console.log(res.result.code,'res.result.code') console.log(this.join) uni.showToast({ title: '退出成功' @@ -204,7 +205,7 @@ }); } }) - this.$refs['popupDialog1'].close(); + await this.$refs['popupDialog1'].close(); }, dialogClose() { this.$refs.popupDialog1.close();