运营活动
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
<template>
|
||||
<div class="page">
|
||||
<div class="header-content">
|
||||
<div class="header-top">
|
||||
<!-- <div class="header-top">
|
||||
<img :src="detail.url && detail.url[0].url" alt="" @click.stop="previewImage(detail.url, detail.url[0].url)" />
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div class="header-middle">
|
||||
<div class="img-title">{{ detail.title }}</div>
|
||||
@@ -22,20 +22,15 @@
|
||||
|
||||
<div class="cards">
|
||||
<div class="cards-left">活动时间</div>
|
||||
<div class="cards-right">{{ detail.beginTime && detail.beginTime.substring(0, detail.beginTime.length - 3) }}</div>
|
||||
<div class="cards-right">{{ detail.beginTime && detail.beginTime.substring(0, detail.beginTime.length - 3) }}至{{ detail.endTime && detail.beginTime.substring(0, detail.beginTime.length - 3) }}</div>
|
||||
</div>
|
||||
|
||||
<div class="cards">
|
||||
<div class="cards-left">活动人数</div>
|
||||
<div class="cards-right" @click="toSignUser()">
|
||||
<span style="color: #1c6bdf">{{ detail.realNum }}</span>
|
||||
<div class="cards-right">
|
||||
<span style="color: #1c6bdf">{{ detail.signUpCount }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="cards">
|
||||
<div class="cards-left">活动地点</div>
|
||||
<div class="cards-right" style="width: 75%; text-align: right">{{ detail.areaName }}{{ detail.address }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="header-bottom">
|
||||
@@ -50,10 +45,10 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <div class="add-btn">
|
||||
<div class="add-btn" v-if="!detail.mySignUP" @click="signUp">
|
||||
<div>参与活动</div>
|
||||
</div> -->
|
||||
<div class="add-btn" @click="toCalendar">
|
||||
</div>
|
||||
<div class="add-btn" v-else @click="toCalendar">
|
||||
<div>活动日历</div>
|
||||
</div>
|
||||
|
||||
@@ -62,15 +57,15 @@
|
||||
<div class="item">
|
||||
<span class="label"><span class="tips">*</span>手机号</span>
|
||||
<div class="value">
|
||||
<u-input type="tel" placeholder="请填写手机号" v-model="form.phone" input-align="right" placeholder-style="color:#999;font-size:15px;" height="42" :maxlength="11" :clearable="false" />
|
||||
<u-input type="tel" placeholder="请填写手机号" v-model="phone" input-align="right" placeholder-style="color:#999;font-size:15px;" height="42" :maxlength="11" :clearable="false" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<!-- <div class="item">
|
||||
<span class="label"><span class="tips">*</span>验证码</span>
|
||||
<div class="value">
|
||||
<u-input type="tel" placeholder="请填写验证码" v-model="form.code" input-align="right" placeholder-style="color:#999;font-size:15px;" height="42" :maxlength="6" :clearable="false" />
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
</u-modal>
|
||||
</div>
|
||||
</template>
|
||||
@@ -103,7 +98,7 @@ export default {
|
||||
timeEnd: '',
|
||||
timeNow: '',
|
||||
show: false,
|
||||
form: {phone: '', code: ''}
|
||||
phone: '',
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
@@ -115,9 +110,9 @@ export default {
|
||||
},
|
||||
onShow() {
|
||||
document.title = '活动详情'
|
||||
uni.$on('refresh', () => {
|
||||
this.getListInit()
|
||||
})
|
||||
// uni.$on('refresh', () => {
|
||||
// this.getListInit()
|
||||
// })
|
||||
|
||||
uni.$on('updateGetDetail', () => {
|
||||
this.getDetail()
|
||||
@@ -125,19 +120,11 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
getDetail() {
|
||||
this.$http.post(`/app/appvillageactivityinfo/queryDetailById?id=${this.id}`).then((res) => {
|
||||
this.$http.post(`/app/appactivityinfo/queryDetailById?id=${this.id}`).then((res) => {
|
||||
if (res?.data) {
|
||||
this.detail = res.data
|
||||
console.log('结束时间', this.detail.endTime)
|
||||
this.timeEnd = new Date(this.detail.endTime).getTime()
|
||||
console.log('过去时间戳', this.timeEnd)
|
||||
this.timeNow = new Date().getTime()
|
||||
console.log('当前时间戳', this.timeNow)
|
||||
console.log('过去时间戳加上24小时', this.timeEnd * 1 + 24 * 60 * 60 * 1000)
|
||||
|
||||
if (this.timeNow * 1 - this.timeEnd * 1 < 24 * 60 * 60 * 1000) {
|
||||
console.log('可以添加')
|
||||
}
|
||||
|
||||
if (this.detail) {
|
||||
if (this.detail.url) {
|
||||
@@ -148,58 +135,50 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
getListInit() {
|
||||
this.current = 1
|
||||
this.getActiveList()
|
||||
},
|
||||
|
||||
getActiveList() {
|
||||
this.$http.post(`/app/appvillageactivitypost/list?activityId=${this.id}`).then((res) => {
|
||||
if (res?.data) {
|
||||
this.activeList = res.data.records
|
||||
if (this.activeList) {
|
||||
let imagesList = []
|
||||
this.activeList.map((item) => {
|
||||
if (item.images) {
|
||||
item.images = JSON.parse(item.images || '[]')
|
||||
imagesList.push(item.images)
|
||||
}
|
||||
return item
|
||||
})
|
||||
this.imgList = imagesList
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
change(index) {
|
||||
this.current = index
|
||||
if (this.current == 1) {
|
||||
this.getActiveList()
|
||||
}
|
||||
},
|
||||
|
||||
toAdd() {
|
||||
uni.navigateTo({ url: `./Add?id=${this.id}&index=11` })
|
||||
},
|
||||
|
||||
AddPosts() {
|
||||
uni.navigateTo({ url: `./AddPosts?id=${this.id}` })
|
||||
},
|
||||
|
||||
previewImage(images, img) {
|
||||
uni.previewImage({
|
||||
urls: images.map((v) => v.url),
|
||||
current: img,
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
signUp() {
|
||||
if(!this.user.phone) {
|
||||
this.show = true
|
||||
}else {
|
||||
this.$http.post(`/app/appactivityinfo/signup?activityId=${this.id}`).then((res) => {
|
||||
if (res.code == 0) {
|
||||
this.$u.toast('报名成功')
|
||||
this.getDetail()
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
bindPhoneConfirm() {
|
||||
if(!this.phone) {
|
||||
return this.$u.toast('请输入手机号')
|
||||
}
|
||||
let regTel = /^1(3\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\d|9[0-35-9])\d{8}$/
|
||||
if (!regTel.test(this.phone)) {
|
||||
return this.$u.toast('请输入正确的手机号')
|
||||
}
|
||||
|
||||
this.$http.post(`/appactivityinfo/bindPhone?phone=${this.phone}`).then((res) => {
|
||||
if (res.code == 0) {
|
||||
this.getUserInfo()
|
||||
this.$u.toast('绑定成功')
|
||||
}
|
||||
})
|
||||
},
|
||||
cancel() {
|
||||
|
||||
this.phone = ''
|
||||
this.show = false
|
||||
},
|
||||
getUserInfo () {
|
||||
this.$http.post('/api/user/info').then(res => {
|
||||
if (res.code === 0) {
|
||||
this.$store.commit('setUser', res.data)
|
||||
}
|
||||
})
|
||||
},
|
||||
toCalendar() {
|
||||
uni.navigateTo({url: './ActiveCalendar'})
|
||||
|
||||
Reference in New Issue
Block a user