110 lines
3.6 KiB
HTML
110 lines
3.6 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="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>
|
|
let geolocation = null
|
|
var vue = new Vue({
|
|
el: '#app',
|
|
mixins: [mobileMixins, self_mixin],
|
|
data() {
|
|
return {
|
|
activityId: '',
|
|
o: {},
|
|
isSign: null
|
|
}
|
|
},
|
|
methods: {
|
|
async getSignStatus() {
|
|
const resp = await $.post('/mobile/activity/unionActivity/isSign', {activityId: this.activityId})
|
|
if (resp.code === 0) {
|
|
this.isSign = resp.data
|
|
}
|
|
},
|
|
async doSign() {
|
|
geolocation.getCurrentPosition(async (status, result) => {
|
|
if (status !== 'complete') {
|
|
this.$toast.fail('定位失败!')
|
|
return
|
|
}
|
|
console.log(status)
|
|
console.log(result)
|
|
const lat = result.position.lat
|
|
const lng = result.position.lng
|
|
const params = {
|
|
lat1: lat, lng1: lng, lat2: this.o.location[1], lng2: this.o.location[0]
|
|
}
|
|
const distance = this.getMapDistance(params)
|
|
console.log(distance)
|
|
console.log(this.o.rangeMeter)
|
|
if (distance > this.o.rangeMeter) {
|
|
this.$toast('距离活动打卡点还有' + distance + '米')
|
|
return
|
|
}
|
|
const confirm = await this.$dialog.confirm({
|
|
title: '提示',
|
|
message: '您确认要签到吗?',
|
|
})
|
|
const loading = this.$toast.loading({
|
|
message: '签到中...',
|
|
forbidClick: true,
|
|
overlay: true,
|
|
duration: 0
|
|
})
|
|
if (confirm === 'confirm') {
|
|
const resp = await $.post('/mobile/activity/unionActivity/singleSignUp', {activityId: this.activityId})
|
|
if (resp.code === 0) {
|
|
await this.getSignStatus()
|
|
loading.close()
|
|
this.$toast.success(resp.msg)
|
|
}
|
|
}
|
|
})
|
|
|
|
|
|
}
|
|
},
|
|
created() {
|
|
const id = GetQueryString("id")
|
|
if (id) {
|
|
this.activityId = id
|
|
this.getActivityInfo()
|
|
this.getSignStatus()
|
|
}
|
|
}
|
|
})
|
|
</script>
|
|
|
|
<!--#
|
|
}
|
|
#--> |