This commit is contained in:
花有清香月有阴
2021-12-23 11:54:21 +08:00
parent 407b9cd463
commit 8497f0238a
4 changed files with 82 additions and 250 deletions

View File

@@ -12,30 +12,20 @@
<div class="line"></div>
<u-form-item label="活动封面图" prop="fileIds" required :border-bottom="false" class="avatars" label-position="top">
<AiUploader :def.sync="forms.fileIds" multiple placeholder="上传图片" :limit="1"></AiUploader>
<u-form-item label="活动封面图" prop="url" required :border-bottom="false" class="avatars" label-position="top">
<AiUploader :def.sync="forms.url" multiple placeholder="上传图片" :limit="1"></AiUploader>
</u-form-item>
<div class="line"></div>
<u-form-item label="活动类型" prop="status" required :border-bottom="false" right-icon="arrow-right">
<u-input v-model="forms.status" disabled placeholder="请选择活动类型" @click="showStstus = true" />
<u-select v-model="showStstus" :list="$dict.getDict('realityStatus')" value-name="dictValue" label-name="dictName" @confirm="selectStatus"></u-select>
</u-form-item>
<u-form-item label="报名范围" prop="fanwe" required :border-bottom="false" right-icon="arrow-right">
<AiAreaPicker v-model="forms.areaId" :areaId="areaIdProps" @select="areaSelect" style="color: #333"></AiAreaPicker>
</u-form-item>
<u-form-item label="活动名额" prop="nums" required :border-bottom="false">
<u-input v-model="forms.nums" type="number" placeholder="如不限制人数填写0" />
<u-form-item label="报名范围" prop="areaId" required :border-bottom="false" right-icon="arrow-right">
<AiAreaPicker v-model="forms.areaId" :areaId="areaId" @select="areaSelect" style="color: #333"></AiAreaPicker>
</u-form-item>
<div class="line"></div>
<u-form-item label="开始时间" prop="startTime" required :border-bottom="false" right-icon="arrow-right">
<u-input v-model="forms.startTime" placeholder="请选择开始时间" @click="showStartTime = true" />
<u-form-item label="开始时间" prop="beginTime" required :border-bottom="false" right-icon="arrow-right">
<u-input v-model="forms.beginTime" placeholder="请选择开始时间" @click="showStartTime = true" />
<u-picker mode="time" :params="params" v-model="showStartTime" @confirm="confirm"></u-picker>
</u-form-item>
@@ -46,24 +36,18 @@
<u-picker mode="time" :params="params" v-model="showEndTime" @confirm="confirm"></u-picker>
</u-form-item>
<u-form-item label="报名截止时间" prop="deadTime" required :border-bottom="false" right-icon="arrow-right">
<u-input v-model="forms.deadTime" placeholder="请选择报名截止时间" @click="showDeadTime = true" />
<u-picker mode="time" :params="params" v-model="showDeadTime" @confirm="confirm"></u-picker>
</u-form-item>
<u-form-item label="活动地点" prop="areaNmae" required :border-bottom="false" label-position="top" class="areaNmaes">
<u-input v-model="forms.areaNmae" placeholder="请输入活动地点" type="textarea" auto-height height="70" />
<u-form-item label="活动地点" prop="address" required :border-bottom="false" label-position="top" class="areaNmaes">
<u-input v-model="forms.address" placeholder="请输入活动地点" type="textarea" auto-height height="70" />
</u-form-item>
<div class="line"></div>
<u-form-item label="联系人" prop="people" required :border-bottom="false">
<u-input v-model="forms.people" placeholder="请输入联系人" maxlength="30" />
<u-form-item label="联系人" prop="contactPerson" required :border-bottom="false">
<u-input v-model="forms.contactPerson" placeholder="请输入联系人" maxlength="30" />
</u-form-item>
<u-form-item label="联系方式" prop="phone" required :border-bottom="false">
<u-input v-model="forms.phone" placeholder="请输入联系方式" maxlength="16" />
<u-form-item label="联系方式" prop="contactPhone" required :border-bottom="false">
<u-input v-model="forms.contactPhone" placeholder="请输入联系方式" maxlength="16" />
</u-form-item>
</u-form>
</div>
@@ -87,32 +71,28 @@ export default {
forms: {
title: '',
content: '',
fileIds: [],
status: '',
statusValue: '',
url: [],
areaId: '',
fanwe: '',
nums: '',
startTime: '',
beginTime: '',
endTime: '',
address: '',
contactPerson: '',
deadTime: '',
areaNmae: '',
people: '',
phone: '',
contactPhone: '',
},
showStstus: false,
showStartTime: false,
showEndTime: false,
showDeadTime: false,
flag: false,
areaId: '',
params: {
year: true,
month: true,
day: true,
hour: true,
minute: true,
second: true,
second: false,
timestamp: true,
},
}
@@ -120,9 +100,11 @@ export default {
computed: { ...mapState(['user']) },
onLoad(o) {
console.log(o)
this.id = o.id
this.id = o.id ? o.id : ''
this.$dict.load('realityStatus').then(() => {
// this.getDetail()
this.areaId = this.user.areaId
this.forms.areaId = this.user.areaId
})
},
@@ -132,11 +114,7 @@ export default {
// this.$http.post(`/app/appvisitvondolence/queryDetailById?id=${this.id}`).then((res) => {
// if (res?.data) {
// this.forms = res.data
// this.forms.statusValue = res.data.status
// this.forms.status = this.$dict.getLabel('realityStatus', res.data.status)
// if (res.data.images) {
// this.forms.images = JSON.parse(res.data.images || '[]')
// }
//
// }
// })
// },
@@ -152,40 +130,28 @@ export default {
if (!this.forms.content) {
return this.$u.toast('请输入活动详情')
}
if (this.forms.fileIds.length == 0) {
if (this.forms.url.length == 0) {
return this.$u.toast('请选择活动封面图')
}
if (!this.forms.status) {
return this.$u.toast('请选择活动类型')
}
if (!this.forms.fanwe) {
return this.$u.toast('请选择报名范围')
}
if (!this.forms.nums) {
return this.$u.toast('请输入活动名额')
}
if (!this.forms.startTime) {
if (!this.forms.beginTime) {
return this.$u.toast('请选择开始时间')
}
if (!this.forms.endTime) {
return this.$u.toast('请选择结束时间')
}
if (!this.forms.deadTime) {
return this.$u.toast('请选择报名截止时间')
}
if (!this.forms.areaNmae) {
if (!this.forms.address) {
return this.$u.toast('请输入活动地点')
}
if (!this.forms.people) {
if (!this.forms.contactPerson) {
return this.$u.toast('请输入联系人')
}
if (!this.forms.phone) {
if (!this.forms.contactPhone) {
return this.$u.toast('请输入联系方式')
}
const imgs = []
if (this.forms.fileIds) {
this.forms.fileIds.map((e) => {
if (this.forms.url) {
this.forms.url.map((e) => {
imgs.push({ url: e.url, id: e.id })
})
}
@@ -195,20 +161,15 @@ export default {
.post(`/app/appvillageactivityinfo/addOrUpdate`, {
title: this.forms.title,
content: this.forms.content,
images: JSON.stringify(imgs) || [],
// images: imgs || [],
url: JSON.stringify(imgs) || [],
areaId: this.forms.areaId,
status: this.forms.statusValue ? this.forms.statusValue : this.forms.status,
fanwe: this.forms.fanwe,
nums: this.forms.fanumsnwe,
startTime: this.forms.startTime,
beginTime: this.forms.beginTime,
endTime: this.forms.endTime,
deadTime: this.forms.deadTime,
areaNmae: this.forms.areaNmae,
address: this.forms.address,
contactPerson: this.forms.contactPerson,
people: this.forms.people,
phone: this.forms.phone,
contactPhone: this.forms.contactPhone,
id: this.id,
})
.then((res) => {
@@ -226,22 +187,22 @@ export default {
confirm(e) {
if (this.showStartTime == true) {
console.log(1, e.year + '-' + e.month + '-' + e.day + ' ' + e.hour + ':' + e.minute + ':' + e.second)
this.forms.startTime = e.year + '-' + e.month + '-' + e.day + ' ' + e.hour + ':' + e.minute + ':' + e.second
console.log(1, e.year + '-' + e.month + '-' + e.day + ' ' + e.hour + ':' + e.minute + ':' + '00')
this.forms.beginTime = e.year + '-' + e.month + '-' + e.day + ' ' + e.hour + ':' + e.minute + ':' + '00'
}
if (this.showEndTime == true) {
console.log(2, e.year + '-' + e.month + '-' + e.day + ' ' + e.hour + ':' + e.minute + ':' + e.second)
this.forms.endTime = e.year + '-' + e.month + '-' + e.day + ' ' + e.hour + ':' + e.minute + ':' + e.second
}
if (this.showDeadTime == true) {
console.log(3, e.year + '-' + e.month + '-' + e.day + ' ' + e.hour + ':' + e.minute + ':' + e.second)
this.forms.deadTime = e.year + '-' + e.month + '-' + e.day + ' ' + e.hour + ':' + e.minute + ':' + e.second
console.log(2, e.year + '-' + e.month + '-' + e.day + ' ' + e.hour + ':' + e.minute + ':' + '00')
this.forms.endTime = e.year + '-' + e.month + '-' + e.day + ' ' + e.hour + ':' + e.minute + ':' + '00'
}
},
selectStatus(e) {
this.forms.status = e[0].label
this.forms.statusValue = e[0].value
areaSelect(e) {
if (e.type == 5) {
this.forms.areaId = e.id
}
if (e.type == 4) {
this.forms.areaId = e.id
}
},
},
}

View File

@@ -96,6 +96,7 @@ export default {
this.datas.map((item) => {
if (item.url) {
item.url = JSON.parse(item.url || '[]')
console.log(item.url)
}
return item
})

View File

@@ -2,7 +2,7 @@
<div class="page">
<div class="header-content">
<div class="header-top">
<img :src="detail.url" alt="" />
<img :src="detail.url[0].url" alt="" />
</div>
<div class="header-middle">
@@ -10,7 +10,7 @@
<div class="header-middle-bottom">
<div class="left">
<div class="left-btn" :class="'status' + detail.status">{{ $dict.getLabel('newActivityStatus', detail.status) }}</div>
<div class="left-btn" :class="'status' + detail.status">{{ $dict.getLabel('villageActivityStatus', detail.status) }}</div>
</div>
<div class="right">
<img :src="detail.avatar" alt="" />
@@ -20,7 +20,7 @@
<div class="cards">
<div class="cards-left">活动时间</div>
<div class="cards-right">{{ detail.beginTime }}-{{ detail.endTime }}</div>
<div class="cards-right">{{ detail.beginTime && detail.beginTime.substring(0, detail.beginTime.length - 2) }}</div>
</div>
<div class="cards">
@@ -54,7 +54,7 @@
<div class="content-trends" v-if="current == 1">
<div class="details" v-if="activeList.length > 0">
<div class="card" v-for="(item, index) in activeList" :key="index" @click="toDetail(item.id)">
<div class="card" v-for="(item, index) in activeList" :key="index">
<div class="card-nav">
<div class="avatar">
<img :src="item.avatar" alt="" style="width: 100%; height: 100%" v-if="item.avatar" />
@@ -103,47 +103,9 @@
</div>
</div>
<!-- <div class="addicon" @click="toPublicPage()">
<u-icon name="plus" color="#1365DD" size="50"></u-icon>
</div>
<div class="btn" v-if="detail.status == 0 && detail.createUserId == user.partyId">
<div class="edit" @click="editActive">编辑</div>
<div class="public" style="background: #3671ee" @click="changeStatus(1, '是否发布?')">发布活动</div>
</div>
<div class="btn" v-if="detail.realNum < detail.total && detail.status == 1 && detail.myReport == 0">
<div class="edit" @click="callPhone(detail.contactPhone)">电话咨询</div>
<div class="public" style="background: #3671ee" @click="changeStatus(2, '是否报名?')">立即报名</div>
</div>
<div class="btn" v-if="detail.status == 1 && detail.myReport == 0 && detail.total == 0">
<div class="edit" @click="callPhone(detail.contactPhone)">电话咨询</div>
<div class="public" style="background: #3671ee" @click="changeStatus(2, '是否报名?')">立即报名</div>
</div>
<div class="btn" v-if="detail.status == 1 && detail.myReport == 1">
<div class="edit" @click="callPhone(detail.contactPhone)">电话咨询</div>
<div class="public" style="background: #3671ee" @click="changeStatus(3, '是否取消报名?取消报名无法重新报名!')">取消报名</div>
</div>
<div class="btn" v-if="detail.realNum == detail.total && detail.status == 1 && detail.status == 1 && detail.total != 0">
<div class="max">已满员</div>
</div> -->
<!-- <div class="btn" v-if="detail.myReport == 1 && detail.status == 2">
<div class="edit" @click="callPhone(detail.contactPhone)">联系负责人</div>
<div class="public" style="background: #ffd8df; color: #ff4466" v-if="detail.allow1 == 0">未签到</div>
<div class="public" style="background: #3671ee; color: #ffffff" v-if="detail.allow1 == 1" @click="sign(0)">签到</div>
<div class="public" style="background: #cbead9; color: #20bc65" v-if="detail.allow1 == 2">已签到</div>
</div> -->
<!-- <div class="btn" v-if="detail.status == 5">
<div class="edit" @click="callPhone(detail.contactPhone)">联系负责人</div>
<div class="public" style="background: #cbead9; color: #20bc65" v-if="detail.allow2 == 1" @click="sign(1)">离场签到</div>
<div class="public" style="background: #cbead9; color: #20bc65" v-if="detail.allow2 == 2">已离场签到</div>
<div class="public" style="background: #ffd8df; color: #ff4466" v-if="detail.allow2 == 0">未离场签到</div>
</div> -->
<AiFixedBtn>
<div class="addBtn iconfont iconfont-iconfangda" @tap.stop="toAdd()" />
</AiFixedBtn>
</div>
</template>
@@ -173,18 +135,25 @@ export default {
}
},
onLoad(option) {
console.log(option)
this.id = option.id
this.$dict.load(['newActivityStatus']).then(() => {
this.$dict.load(['villageActivityStatus']).then(() => {
this.getDetail()
})
},
methods: {
getDetail() {
this.$http.post(`/app/appactivityinfo/queryDetailById?id=${this.id}&partyId=${this.user.partyId}`).then((res) => {
this.$http.post(`/app/appvillageactivityinfo/queryDetailById?id=${this.id}`).then((res) => {
if (res?.data) {
res.data.beginTime = res.data.beginTime.substring(0, 16)
res.data.endTime = res.data.endTime.substring(0, 16)
// res.data.beginTime = res.data.beginTime.substring(0, 16)
// res.data.endTime = res.data.endTime.substring(0, 16)
this.detail = res.data
if (this.detail) {
if (this.detail.url) {
this.detail.url = JSON.parse(res.data.url || '[]')
console.log(this.detail.url)
}
}
this.getActiveList()
}
})
@@ -193,19 +162,18 @@ export default {
getActiveList() {
this.$http.post(`/app/apppostinfo/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
}
// 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
// }
}
})
},
@@ -214,104 +182,6 @@ export default {
this.current = index
},
toPublicPage() {
uni.navigateTo({
url: `./AddPosts?id=${this.id}`,
})
},
editActive() {
uni.navigateTo({ url: `./Add?id=${this.id}` })
},
changeStatus(status, text) {
uni.showModal({
title: '提示',
content: `${text}`,
confirmText: '确定',
success: (e) => {
if (status == 1) {
//发布
this.changeStatusConfirm(status)
}
if (status == 2) {
//报名
this.report()
}
if (status == 3) {
//取消报名
this.cancelReport()
}
},
})
},
cancelReport() {
this.$instance
.post(`/app/appactivityuser/removeReport`, {
activityId: this.id,
partyId: this.user.partyId,
})
.then((res) => {
if (res.code == 0) {
this.$toast('提交成功')
this.getDetail()
}
})
},
changeStatusConfirm(status) {
this.$instance
.post(`/app/appactivityinfo/changeStatus`, {
id: this.id,
status: status,
})
.then((res) => {
if (res.code == 0) {
this.$toast('提交成功')
this.getDetail()
}
})
},
callPhone(phone) {
uni.makePhoneCall({ phoneNumber: phone })
},
report() {
this.$instance
.post(`/app/appactivityuser/report`, {
activityId: this.id,
partyId: this.user.partyId,
name: this.user.realName,
orgId: this.user.partyOrgId,
orgName: this.user.partyOrgName,
phone: this.user.phone,
communityId: this.user.communityId,
})
.then((res) => {
if (res.code == 0) {
this.$toast('报名成功')
this.getDetail()
}
})
},
toSignUser() {
var isAdmin = this.detail.createUserId == this.user.partyId ? 1 : 0
uni.navigateTo({ url: `./SignUser?id=${this.id}&isAdmin=${isAdmin}&status=${this.detail.status}` })
},
sign(status) {
//status 0开始签到 1离场签到
this.$instance
.post(`/app/appactivityuser/sign`, {
activityId: this.id,
partyId: this.user.partyId,
})
.then((res) => {
if (res.code == 0) {
this.$toast(status == 1 ? '离场签到成功' : '签到成功')
this.getDetail()
}
})
},
toDetail(id) {
this.linkTo(`./detail?id=${id}`)
},
previewImage(images, img) {
uni.previewImage({
urls: images.map((v) => v.url),

View File

@@ -200,8 +200,8 @@ export default {
},
watch: {},
onLoad(o) {
if (o.index) {
this.indexBar = o.index
if (o.tabIndex) {
this.indexBar = o.tabIndex
}
this.getEchart1()
this.getEchart2()