2021-12-17 11:55:28 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<div class="add">
|
|
|
|
|
|
<div class="header-description">
|
|
|
|
|
|
<u-form :model="forms" ref="uForm" label-width="auto" :border-bottom="false">
|
|
|
|
|
|
<u-form-item label="标题" prop="title" required :border-bottom="false" class="titles" label-position="top">
|
|
|
|
|
|
<u-input v-model="forms.title" placeholder="请输入标题(30字以内)" type="textarea" auto-height height="60" maxlength="30" />
|
|
|
|
|
|
</u-form-item>
|
|
|
|
|
|
|
|
|
|
|
|
<u-form-item label="活动详情" prop="content" required :border-bottom="false" label-position="top" class="contents">
|
|
|
|
|
|
<u-input v-model="forms.content" placeholder="请输入活动详情(500字以内)" type="textarea" auto-height height="100" maxlength="500" />
|
|
|
|
|
|
</u-form-item>
|
|
|
|
|
|
|
|
|
|
|
|
<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="9"></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">
|
|
|
|
|
|
<u-input v-model="forms.fanwe" 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="nums" required :border-bottom="false">
|
|
|
|
|
|
<u-input v-model="forms.nums" type="number" placeholder="如不限制人数,填写0" />
|
|
|
|
|
|
</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-picker mode="time" :params="params" v-model="showStartTime" @confirm="confirm"></u-picker>
|
|
|
|
|
|
</u-form-item>
|
|
|
|
|
|
|
|
|
|
|
|
<u-form-item label="结束时间" prop="endTime" required :border-bottom="false" right-icon="arrow-right">
|
|
|
|
|
|
<u-input v-model="forms.endTime" placeholder="请选择结束时间" @click="showEndTime = true" />
|
|
|
|
|
|
|
|
|
|
|
|
<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>
|
|
|
|
|
|
|
|
|
|
|
|
<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>
|
|
|
|
|
|
|
|
|
|
|
|
<u-form-item label="联系方式" prop="phone" required :border-bottom="false">
|
|
|
|
|
|
<u-input v-model="forms.phone" placeholder="请输入联系方式" maxlength="16" />
|
|
|
|
|
|
</u-form-item>
|
|
|
|
|
|
</u-form>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="btn" @click="submit">保存</div>
|
|
|
|
|
|
|
|
|
|
|
|
<AiBack></AiBack>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
import { mapState } from 'vuex'
|
|
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
|
name: 'Add',
|
|
|
|
|
|
components: {},
|
|
|
|
|
|
props: {},
|
|
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
|
|
|
|
|
id: '',
|
|
|
|
|
|
forms: {
|
|
|
|
|
|
title: '',
|
|
|
|
|
|
content: '',
|
|
|
|
|
|
fileIds: [],
|
|
|
|
|
|
status: '',
|
|
|
|
|
|
statusValue: '',
|
|
|
|
|
|
|
|
|
|
|
|
fanwe: '',
|
|
|
|
|
|
nums: '',
|
|
|
|
|
|
startTime: '',
|
|
|
|
|
|
endTime: '',
|
|
|
|
|
|
|
|
|
|
|
|
deadTime: '',
|
|
|
|
|
|
areaNmae: '',
|
|
|
|
|
|
people: '',
|
|
|
|
|
|
phone: '',
|
|
|
|
|
|
},
|
|
|
|
|
|
showStstus: false,
|
|
|
|
|
|
showStartTime: false,
|
|
|
|
|
|
showEndTime: false,
|
|
|
|
|
|
showDeadTime: false,
|
|
|
|
|
|
flag: false,
|
|
|
|
|
|
params: {
|
|
|
|
|
|
year: true,
|
|
|
|
|
|
month: true,
|
|
|
|
|
|
day: true,
|
|
|
|
|
|
hour: true,
|
|
|
|
|
|
minute: true,
|
|
|
|
|
|
second: true,
|
|
|
|
|
|
timestamp: true,
|
|
|
|
|
|
},
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
computed: { ...mapState(['user']) },
|
|
|
|
|
|
onLoad(o) {
|
|
|
|
|
|
console.log(o)
|
|
|
|
|
|
this.id = o.id
|
|
|
|
|
|
this.$dict.load('realityStatus').then(() => {
|
|
|
|
|
|
// this.getDetail()
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
mounted() {},
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
// getDetail() {
|
|
|
|
|
|
// 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 || '[]')
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// })
|
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
|
|
|
|
submit() {
|
|
|
|
|
|
if (this.flag) return
|
|
|
|
|
|
|
|
|
|
|
|
this.$refs.uForm.validate((valid) => {
|
|
|
|
|
|
if (valid) {
|
|
|
|
|
|
if (!this.forms.title) {
|
|
|
|
|
|
return this.$u.toast('请输入标题')
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!this.forms.content) {
|
|
|
|
|
|
return this.$u.toast('请输入活动详情')
|
|
|
|
|
|
}
|
|
|
|
|
|
if (this.forms.fileIds.length == 0) {
|
2021-12-20 16:12:47 +08:00
|
|
|
|
return this.$u.toast('请选择活动封面图')
|
2021-12-17 11:55:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
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) {
|
|
|
|
|
|
return this.$u.toast('请选择开始时间')
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!this.forms.endTime) {
|
|
|
|
|
|
return this.$u.toast('请选择结束时间')
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!this.forms.deadTime) {
|
|
|
|
|
|
return this.$u.toast('请选择报名截止时间')
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!this.forms.areaNmae) {
|
|
|
|
|
|
return this.$u.toast('请输入活动地点')
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!this.forms.people) {
|
|
|
|
|
|
return this.$u.toast('请输入联系人')
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!this.forms.phone) {
|
|
|
|
|
|
return this.$u.toast('请输入联系方式')
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const imgs = []
|
|
|
|
|
|
if (this.forms.fileIds) {
|
|
|
|
|
|
this.forms.fileIds.map((e) => {
|
|
|
|
|
|
imgs.push({ url: e.url, id: e.id })
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.flag = true
|
|
|
|
|
|
this.$http
|
|
|
|
|
|
.post(`/app/appvisitvondolence/addOrUpdate`, {
|
|
|
|
|
|
title: this.forms.title,
|
|
|
|
|
|
content: this.forms.content,
|
|
|
|
|
|
// images: JSON.stringify(imgs) || [],
|
|
|
|
|
|
images: imgs || [],
|
|
|
|
|
|
|
|
|
|
|
|
status: this.forms.statusValue ? this.forms.statusValue : this.forms.status,
|
|
|
|
|
|
fanwe: this.forms.fanwe,
|
|
|
|
|
|
nums: this.forms.fanumsnwe,
|
|
|
|
|
|
|
|
|
|
|
|
startTime: this.forms.startTime,
|
|
|
|
|
|
endTime: this.forms.endTime,
|
|
|
|
|
|
deadTime: this.forms.deadTime,
|
|
|
|
|
|
areaNmae: this.forms.areaNmae,
|
|
|
|
|
|
|
|
|
|
|
|
people: this.forms.people,
|
|
|
|
|
|
phone: this.forms.phone,
|
|
|
|
|
|
id: this.id,
|
|
|
|
|
|
})
|
|
|
|
|
|
.then((res) => {
|
|
|
|
|
|
if (res.code == 0) {
|
|
|
|
|
|
this.$u.toast('发布成功')
|
|
|
|
|
|
this.flag = false
|
|
|
|
|
|
uni.navigateTo({ url: `./AppActive` })
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.$u.toast('失败')
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
selectStatus(e) {
|
|
|
|
|
|
this.forms.status = e[0].label
|
|
|
|
|
|
this.forms.statusValue = e[0].value
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
|
.add {
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
padding-bottom: 112px;
|
|
|
|
|
|
|
|
|
|
|
|
.header-description {
|
|
|
|
|
|
::v-deep .u-form {
|
|
|
|
|
|
.u-form-item {
|
|
|
|
|
|
padding: 0 45px !important;
|
|
|
|
|
|
.u-form-item__body {
|
|
|
|
|
|
.u-form-item--right__content__slot {
|
|
|
|
|
|
padding-bottom: 0;
|
|
|
|
|
|
.u-input {
|
|
|
|
|
|
text-align: right !important;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.u-form-item:last-child {
|
|
|
|
|
|
margin-bottom: 40px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.titles,
|
|
|
|
|
|
.contents,
|
|
|
|
|
|
.areaNmaes {
|
|
|
|
|
|
.u-form-item__body {
|
|
|
|
|
|
.u-form-item--right__content__slot {
|
|
|
|
|
|
.u-input {
|
|
|
|
|
|
text-align: left !important;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.avatars,
|
|
|
|
|
|
.areaNmaes,
|
|
|
|
|
|
.contents {
|
|
|
|
|
|
padding-bottom: 20px !important;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.avatars {
|
|
|
|
|
|
.u-form-item__body {
|
|
|
|
|
|
.default {
|
|
|
|
|
|
width: 160px;
|
|
|
|
|
|
height: 160px;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.line {
|
|
|
|
|
|
height: 16px;
|
|
|
|
|
|
background: #f3f6f9;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.btn {
|
|
|
|
|
|
position: fixed;
|
|
|
|
|
|
bottom: 0;
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 112px;
|
|
|
|
|
|
line-height: 112px;
|
|
|
|
|
|
background: #1365dd;
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
font-size: 32px;
|
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
|
color: #ffffff;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|