2021-12-30 21:05:45 +08:00
|
|
|
<template>
|
|
|
|
|
<div class="add">
|
|
|
|
|
<div class="header-description">
|
|
|
|
|
<u-form :model="form" ref="uForm" label-width="auto">
|
|
|
|
|
<u-form-item label="主题" prop="content" required label-position="top">
|
2022-01-07 08:50:23 +08:00
|
|
|
<u-input v-model="form.content" placeholder="请输入标题(1000字以内)" type="textarea" auto-height height="280" maxlength="1000" />
|
2021-12-30 21:05:45 +08:00
|
|
|
</u-form-item>
|
|
|
|
|
<u-form-item label="图片(最多9张)" prop="images" class="avatars" label-position="top">
|
2022-01-07 08:50:23 +08:00
|
|
|
<AiUploader :def.sync="form.images" multiple placeholder="上传图片" :limit="9" action="/admin/file/add2"></AiUploader>
|
2021-12-30 21:05:45 +08:00
|
|
|
</u-form-item>
|
|
|
|
|
<u-form-item label="议事截止时间" prop="discussDeadline" required>
|
2022-01-07 08:50:23 +08:00
|
|
|
<AiDateTime v-model="form.discussDeadline" />
|
2021-12-30 21:05:45 +08:00
|
|
|
</u-form-item>
|
|
|
|
|
<u-form-item label="公示截止时间" prop="publicityDeadline">
|
2022-01-07 08:50:23 +08:00
|
|
|
<AiDateTime v-model="form.publicityDeadline" />
|
2021-12-30 21:05:45 +08:00
|
|
|
</u-form-item>
|
|
|
|
|
<u-form-item label="议事类型" prop="type" required label-position="top">
|
2022-01-07 08:50:23 +08:00
|
|
|
<div v-for="op in $dict.getDict('discussType')" :key="op.dictValue" class="discussType" @click="form.type = op.dictValue" :class="{ current: form.type == op.dictValue }">
|
2021-12-30 21:05:45 +08:00
|
|
|
{{ op.dictName }}
|
|
|
|
|
</div>
|
|
|
|
|
</u-form-item>
|
|
|
|
|
</u-form>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="pad-b112"></div>
|
|
|
|
|
<div class="btn" @click="submit">保存</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2022-01-07 08:50:23 +08:00
|
|
|
import { mapState } from 'vuex'
|
2021-12-30 21:05:45 +08:00
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: 'Add',
|
|
|
|
|
props: {},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
id: '',
|
2022-01-07 08:50:23 +08:00
|
|
|
form: { type: 0 },
|
2021-12-30 21:05:45 +08:00
|
|
|
flag: false,
|
|
|
|
|
}
|
|
|
|
|
},
|
2022-01-07 08:50:23 +08:00
|
|
|
computed: { ...mapState(['user']) },
|
2021-12-30 21:05:45 +08:00
|
|
|
onLoad(o) {
|
|
|
|
|
if (o.id) {
|
|
|
|
|
this.id = o.id
|
|
|
|
|
this.getDetail()
|
|
|
|
|
}
|
2022-01-07 08:50:23 +08:00
|
|
|
this.$dict.load('discussType')
|
2021-12-30 21:05:45 +08:00
|
|
|
},
|
|
|
|
|
onShow() {
|
2022-01-07 08:50:23 +08:00
|
|
|
document.title = '新增议事'
|
2021-12-30 21:05:45 +08:00
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
getDetail() {
|
|
|
|
|
this.$http.post(`/app/appvillagediscuss/queryDetailById?id=${this.id}`).then((res) => {
|
|
|
|
|
if (res?.data) {
|
2022-01-07 08:50:23 +08:00
|
|
|
this.form = { ...res.data }
|
2021-12-30 21:05:45 +08:00
|
|
|
if (res.data.images) {
|
|
|
|
|
this.form.images = JSON.parse(res.data.images || '[]')
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
submit() {
|
|
|
|
|
if (this.flag) return
|
|
|
|
|
if (!this.form.content) {
|
|
|
|
|
return this.$u.toast('请输入 主题')
|
|
|
|
|
}
|
|
|
|
|
if (!this.form.discussDeadline) {
|
|
|
|
|
return this.$u.toast('请选择 议事截止时间')
|
|
|
|
|
}
|
2022-01-07 08:50:23 +08:00
|
|
|
this.$http
|
|
|
|
|
.post(`/app/appvillagediscuss/addOrUpdate`, {
|
|
|
|
|
...this.form,
|
|
|
|
|
images: JSON.stringify(this.form.images),
|
|
|
|
|
id: this.id,
|
|
|
|
|
})
|
|
|
|
|
.then((res) => {
|
|
|
|
|
if (res?.code == 0) {
|
|
|
|
|
uni.$emit('update')
|
|
|
|
|
this.$u.toast('发布成功')
|
|
|
|
|
this.flag = true
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
uni.navigateBack({})
|
|
|
|
|
}, 600)
|
|
|
|
|
}
|
|
|
|
|
})
|
2021-12-30 21:05:45 +08:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
.add {
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
|
|
|
|
.header-description {
|
|
|
|
|
::v-deep .u-form {
|
|
|
|
|
.u-form-item {
|
|
|
|
|
.u-form-item__body {
|
|
|
|
|
.u-form-item--right__content__slot {
|
|
|
|
|
padding-bottom: 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.u-form-item:last-child {
|
|
|
|
|
margin-bottom: 0;
|
|
|
|
|
padding-bottom: 20px !important;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.avatars {
|
|
|
|
|
margin: 16px 0;
|
|
|
|
|
|
|
|
|
|
.u-form-item__body {
|
|
|
|
|
.default {
|
|
|
|
|
width: 160px;
|
|
|
|
|
height: 160px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.pad-b112 {
|
|
|
|
|
padding-bottom: 224px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.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;
|
|
|
|
|
z-index: 999;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.right {
|
|
|
|
|
width: 100%;
|
|
|
|
|
text-align: right;
|
|
|
|
|
|
|
|
|
|
.right-icon {
|
|
|
|
|
margin-left: 8px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.discussType {
|
|
|
|
|
width: 320px;
|
|
|
|
|
height: 112px;
|
2022-01-07 08:50:23 +08:00
|
|
|
background: #f5f5f5;
|
2021-12-30 21:05:45 +08:00
|
|
|
border-radius: 4px;
|
|
|
|
|
font-size: 30px;
|
|
|
|
|
font-family: PingFangSC-Medium, PingFang SC;
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
color: #333333;
|
|
|
|
|
letter-spacing: 1px;
|
|
|
|
|
text-align: center;
|
|
|
|
|
line-height: 112px;
|
|
|
|
|
|
|
|
|
|
& + .discussType {
|
|
|
|
|
margin-left: 42px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&.current {
|
2022-01-07 08:50:23 +08:00
|
|
|
color: #1174fe;
|
|
|
|
|
background: #e7f1fe;
|
2021-12-30 21:05:45 +08:00
|
|
|
position: relative;
|
|
|
|
|
|
|
|
|
|
&:before {
|
|
|
|
|
position: absolute;
|
|
|
|
|
display: block;
|
2022-01-07 08:50:23 +08:00
|
|
|
content: ' ';
|
2021-12-30 21:05:45 +08:00
|
|
|
bottom: 0;
|
|
|
|
|
right: 0;
|
2022-01-07 08:50:23 +08:00
|
|
|
border: 24px solid #1576fe;
|
2021-12-30 21:05:45 +08:00
|
|
|
border-top-color: transparent;
|
|
|
|
|
border-left-color: transparent;
|
|
|
|
|
border-radius: inherit;
|
|
|
|
|
z-index: 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&:after {
|
|
|
|
|
position: absolute;
|
|
|
|
|
display: block;
|
2022-01-07 08:50:23 +08:00
|
|
|
content: '✓';
|
2021-12-30 21:05:45 +08:00
|
|
|
bottom: 0;
|
|
|
|
|
right: 0;
|
|
|
|
|
color: #fff;
|
|
|
|
|
z-index: 2;
|
|
|
|
|
line-height: normal;
|
|
|
|
|
font-weight: normal;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.color-999 {
|
|
|
|
|
color: #999;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|