提交 e38cc204 编写于 作者: 2 222000134

增加退出小队活动功能

上级 d37ec7d2
<!-- 取消报名的toast -->
<template>
<view class="content">
<view class="detail">
......@@ -35,6 +36,11 @@
<text class="activity-object-text">参与人数:</text>
<view class="production-detail">{{object}}</view>
</view>
<view class="activity-object">
<image class="activity-production-icon" src="/static/discover/object.png"></image>
<text class="activity-object-text">已报名人数:</text>
<view class="production-detail">{{alreadyObject}}</view>
</view>
<view class="activity-contact">
<image class="activity-production-icon" src="/static/discover/contact.png"></image>
<text class="activity-contact-text">联系方式:</text>
......@@ -42,7 +48,7 @@
</view>
</view>
<view class="btn">
<button class="loginButton" @click="apply()">报名</button>
<button class="loginButton" @click="apply(signStatus)">{{signStatus}}</button>
</view>
</view>
</template>
......@@ -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)
}))
}
}
</script>
......
......@@ -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();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册