运营活动

This commit is contained in:
liuye
2023-01-29 13:55:41 +08:00
parent 7c2a1c32e5
commit 675656ff3e
6 changed files with 114 additions and 103 deletions

View File

@@ -17,7 +17,7 @@ instance.interceptors.request.use(config => {
config.url = config.url.replace(/(app|auth|admin)\//, "api/")
} else if (!/^App/.test(module) && module) {
config.baseURL = `/${module}`
if (['xaxc', 'qxn'].includes(module)) {
if (['xaxc', 'qxn', 'yyhd'].includes(module)) {
config.url = config.url.replace(/(app|auth|admin)\//, "api/")
}
} else config.baseURL = "/lan"

View File

@@ -92,6 +92,13 @@
"pathRewrite": {
"^/qxn": "/"
}
},
"/yyhd": {
"target": "http://192.168.1.87:22001/",
"changeOrigin": true,
"pathRewrite": {
"^/yyhd": "/"
}
}
}
},

View File

@@ -80,6 +80,8 @@ export default {
} else if (/\/project\/beta\//.test(libPath)) {
corpId = 'ww2a667717a70164f1'
module = 'wangge'
}else if (/\/project\/activeAnalysis\//.test(libPath)) {
module = 'yyhd'
}
this.setModule(module)
return Promise.resolve({corpId, module})

View File

@@ -2,45 +2,68 @@
<div class="ActiveCalendar">
<div class="calendar">
<div class="month-item">
<div class="title">2023-01</div>
<div class="title" @click="show=true">{{ym}}<u-icon name="arrow-down" color="#666" size="24" style="margin-left: 4px"></u-icon></div>
<div class="day-list">
<div class="week-item">
<!-- <div class="week-item">
<div v-for="(item, index) in weekList" :key="index">{{item}}</div>
</div>
<div class="day-item" v-for="(item, index) in 31" :key="index">
<div>{{item}}</div>
<u-icon name="checkbox-mark" color="#5297FF"></u-icon>
</div>
</div>
</div>
<div class="month-item">
<div class="title">2023-02</div>
<div class="day-list">
<div class="week-item">
<div v-for="(item, index) in weekList" :key="index">{{item}}</div>
</div>
<div class="day-item" v-for="(item, index) in 28" :key="index">
<div>{{item}}</div>
<u-icon name="checkbox-mark" color="#5297FF"></u-icon>
</div> -->
<div class="day-item" v-for="(item, index) in dayList" :key="index">
<div>{{item.day}}</div>
<u-icon name="checkbox-mark" color="#5297FF" v-if="item.status == '使用' || item.status == '打开并活跃'"></u-icon>
<u-icon name="close" color="#ff4466" v-else></u-icon>
</div>
</div>
</div>
</div>
<u-picker v-model="show" mode="time" :params="params" @confirm="confirm" @cancel="show=false"></u-picker>
</div>
</template>
<script>
import { mapState } from 'vuex'
export default {
data() {
return {
weekList: ['一', '二', '三', '四', '五', '六', '日']
show: false,
params: {
year: true,
month: true,
day: false,
hour: false,
minute: false,
second: false
},
ym: '',
dayList: []
}
},
computed: {
...mapState(['user']),
},
created() {
const date = new Date();
let year = date.getFullYear()
let monNum = date.getMonth() + 1
let month = monNum < 10 ? `0${monNum}` : monNum
this.ym = `${year}-${month}`
this.getList()
},
methods: {
getList() {
// this.$http.post(`/app/wxuseruselog/listForWX?wxUserId=LiuYe&ym=${this.ym}`).then(res => {
this.$http.post(`/app/wxuseruselog/listForWX?wxUserId=${this.user.phone}&ym=${this.ym}`).then(res => {
if (res.code == 0) {
res.data.map((item) => {
item.day = item.ymd.substring(8, 10)
})
this.dayList = res.data
}
})
},
confirm(e) {
this.ym = `${e.year}-${e.month}`
this.getList()
}
},
onShow() {
document.title = '活动日历'

View File

@@ -1,6 +1,6 @@
<template>
<div class="AppActive">
<u-tabs :list="tabList" :is-scroll="false" :current="currentTabs" height="96" bg-color="#3975C6" inactive-color="#fff" active-color="#fff" @change="change"></u-tabs>
<!-- <u-tabs :list="tabList" :is-scroll="false" :current="currentTabs" height="96" bg-color="#3975C6" inactive-color="#fff" active-color="#fff" @change="change"></u-tabs> -->
<div class="dataTop">
<div class="dataLeft">活动列表</div>
@@ -13,13 +13,13 @@
</div>
<template v-if="datas.length > 0">
<AiCard v-for="(item, i) in datas" :key="i" @click.native="toDetail(item, 1)">
<AiCard v-for="(item, i) in datas" :key="i" @click.native="toDetail(item)">
<template #custom>
<div class="left">
<div class="titles">{{ item.title }}</div>
<div class="nums">
<span class="specialColor">{{ item.realNum }}</span>
<span class="specialColor">{{ item.signUpCount }}</span>
<span>已报名</span>
</div>
@@ -32,9 +32,9 @@
<div class="areaName" v-if="item.areaName || item.address">{{ item.areaName }}{{ item.address }}</div>
</div>
<img :src="items.url" alt="" v-for="(items, index) in JSON.parse(item.url || '[]')" :key="index" @click.stop="previewImage(JSON.parse(item.url || '[]'), item.url[0].url)" />
<!-- <img :src="items.url" alt="" v-for="(items, index) in JSON.parse(item.url || '[]')" :key="index" @click.stop="previewImage(JSON.parse(item.url || '[]'), item.url[0].url)" />
<div class="hints" :style="{ background: item.status == 0 ? '#000000' : item.status == 1 ? '#42D784' : '#E4E4E4' }">{{ $dict.getLabel('villageActivityStatus', item.status) }}</div>
<div class="hints" :style="{ background: item.status == 0 ? '#000000' : item.status == 1 ? '#42D784' : '#E4E4E4' }">{{ $dict.getLabel('villageActivityStatus', item.status) }}</div> -->
</template>
</AiCard>
</template>
@@ -82,12 +82,12 @@ export default {
},
methods: {
getList() {
this.$http.post('/app/appvillageactivityinfo/listUp', null, {
this.$http.post('/app/appactivityinfo/listForWX', null, {
params: {
size: this.size,
current: this.current,
createUserId: this.currentTabs == 1 ? this.user.id : '',
areaId: this.user.areaId,
// createUserId: this.currentTabs == 1 ? this.user.id : '',
// areaId: this.user.areaId,
},
}).then((res) => {
if (res.code == 0) {
@@ -112,7 +112,7 @@ export default {
},
toDetail(item) {
uni.navigateTo({ url: `./Detail?id=${item.id}&createUserId=${item.createUserId}` })
uni.navigateTo({ url: `./Detail?id=${item.id}` })
},
previewImage(images, img) {

View File

@@ -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'})