Files
UNION_HUTB/target/classes/views/mobile/activity/unionActivity/singleReg.html
T
2026-09-09 09:14:28 +08:00

176 lines
6.4 KiB
HTML

<!--#
layout("/mobile/platform.html"){
#-->
<style>
.activity_img_back {
background-repeat: no-repeat;
background-size: cover;
/*height: 200px;*/
width: 100%;
}
</style>
<div id="app" v-cloak>
<van-nav-bar title="个人报名" left-arrow placeholder fixed
@click-left="history.back()"></van-nav-bar>
<!--#include("/mobile/activity/unionActivity/common/activityInfo.html"){}#-->
<div style="margin: 20px 20px 10px 20px"
v-if="moment(o.applyStartTime).valueOf() < moment().valueOf() && moment().valueOf() < moment(o.applyEndTime).valueOf()">
<van-button v-if="!isRegister && !isRegisterFull" @click="doSave()"
style="border-radius: 10px" block
type="info"
:color="themeColor">
立即报名
</van-button>
<van-button v-else-if="!isRegister && isRegisterFull" @click="doSave()"
style="border-radius: 10px" block
disabled
type="info"
:color="themeColor">
名额已满
</van-button>
<van-button v-else-if="isRegister && moment().valueOf() < moment(o.applyEndTime).valueOf()"
@click="doCancel"
:disabled="isSign"
style="border-radius: 10px" block type="info"
color="red">
取消报名
</van-button>
</div>
<div style="margin: 20px 20px 10px 20px"
v-if="isRegister && moment().valueOf() < moment(o.endTime).valueOf() && moment().valueOf() > moment(o.startTime).valueOf()&&o.needSign">
<van-button
:disabled="moment().valueOf() > moment(o.endTime).valueOf() || moment().valueOf() < moment(o.startTime).valueOf() || isSign"
@click="doSign()" style="border-radius: 10px" block type="info"
:color="themeColor">
{{isSign?'签到成功':'立即签到'}}
</van-button>
</div>
</div>
<script>
<!--#include("/mobile/activity/unionActivity/common/initMap.js"){}#-->
</script>
<script>
const vue = new Vue({
el: '#app',
mixins: [mobileMixins, self_mixin],
data() {
return {
activityId: '',
o: {},
tagCloseable: true,
isRegister: false,
isSign: false
}
},
methods: {
async isRegisterForMe() {
const resp = await $.get('/mobile/activity/unionActivity/isRegisterForMe', {activityId: this.activityId})
if (resp.code === 0) {
this.isRegister = resp.data
}
},
async doSave() {
let message = ''
if (this.o.needSign) {
message = '报名后若未参加,将有可能影响到其它活动的报名,同时活动开启了现场签到!'
}
const confirm = await this.$dialog.confirm({
title: '提示',
message: '您确认要报名吗?' + message,
})
if (confirm === 'confirm') {
const loading = this.$toast.loading({
message: '报名中...',
forbidClick: true,
overlay: true,
duration: 2000
})
// await this.getHasRegUserNum()
const resp = await $.post('/mobile/activity/unionActivity/doSingleRegister', {activityId: this.activityId})
if (resp.code === 0) {
setTimeout(() => {
this.init()
this.$toast.success(resp.msg)
window.history.back()
}, 2000)
} else {
this.$toast.fail(resp.msg)
}
}
},
async doCancel() {
const confirm = await this.$dialog.confirm({
title: '提示',
message: '您确认要取消报名吗?',
})
const loading = this.$toast.loading({
message: '取消中...',
forbidClick: true,
overlay: true,
duration: 2000
})
if (confirm === 'confirm') {
const resp = await $.post('/mobile/activity/unionActivity/doSingleCancelRegister', {activityId: this.activityId})
if (resp.code === 0) {
setTimeout(() => {
this.init()
this.$toast.success(resp.msg)
window.history.back()
}, 2000)
} else {
this.$toast.fail(resp.msg)
}
}
},
async getSignStatus() {
const resp = await $.post('/mobile/activity/unionActivity/isSign', {activityId: this.activityId})
if (resp.code === 0) {
this.isSign = resp.data
}
},
async doSign() {
const confirm = await this.$dialog.confirm({
title: '提示',
message: '您确认要签到吗?',
})
if (confirm === 'confirm') {
const resp = await $.post('/mobile/activity/unionActivity/singleSignUp', {activityId: this.activityId})
if (resp.code === 0) {
await this.getSignStatus()
this.$toast.success(resp.msg)
}
}
},
init() {
const id = GetQueryString("id")
if (id) {
this.activityId = id
this.getActivityInfo()
this.isRegisterForMe()
this.getSignStatus()
if (moment(this.o.applyStartTime).valueOf() < moment().valueOf() && moment().valueOf() > moment(this.o.applyEndTime).valueOf()) {
this.$toast.fail("不在活动范围内")
}
}
}
},
created() {
this.init()
}
})
</script>
<!--#
}
#-->