This commit is contained in:
花有清香月有阴
2022-01-07 08:50:23 +08:00
parent 7e6f22ee19
commit a3b7536fba
2 changed files with 83 additions and 91 deletions

View File

@@ -3,22 +3,19 @@
<div class="header-description">
<u-form :model="form" ref="uForm" label-width="auto">
<u-form-item label="主题" prop="content" required label-position="top">
<u-input v-model="form.content" placeholder="请输入标题(1000字以内)" type="textarea" auto-height height="280"
maxlength="1000"/>
<u-input v-model="form.content" placeholder="请输入标题(1000字以内)" type="textarea" auto-height height="280" maxlength="1000" />
</u-form-item>
<u-form-item label="图片(最多9张)" prop="images" class="avatars" label-position="top">
<AiUploader :def.sync="form.images" multiple placeholder="上传图片" :limit="9"
action="/admin/file/add2"></AiUploader>
<AiUploader :def.sync="form.images" multiple placeholder="上传图片" :limit="9" action="/admin/file/add2"></AiUploader>
</u-form-item>
<u-form-item label="议事截止时间" prop="discussDeadline" required>
<AiDateTime v-model="form.discussDeadline"/>
<AiDateTime v-model="form.discussDeadline" />
</u-form-item>
<u-form-item label="公示截止时间" prop="publicityDeadline">
<AiDateTime v-model="form.publicityDeadline"/>
<AiDateTime v-model="form.publicityDeadline" />
</u-form-item>
<u-form-item label="议事类型" prop="type" required label-position="top">
<div v-for="op in $dict.getDict('discussType')" :key="op.dictValue" class="discussType"
@click="form.type=op.dictValue" :class="{current:form.type==op.dictValue}">
<div v-for="op in $dict.getDict('discussType')" :key="op.dictValue" class="discussType" @click="form.type = op.dictValue" :class="{ current: form.type == op.dictValue }">
{{ op.dictName }}
</div>
</u-form-item>
@@ -30,7 +27,7 @@
</template>
<script>
import {mapState} from 'vuex'
import { mapState } from 'vuex'
export default {
name: 'Add',
@@ -38,26 +35,26 @@ export default {
data() {
return {
id: '',
form: {type: 0},
form: { type: 0 },
flag: false,
}
},
computed: {...mapState(['user'])},
computed: { ...mapState(['user']) },
onLoad(o) {
if (o.id) {
this.id = o.id
this.getDetail()
}
this.$dict.load("discussType")
this.$dict.load('discussType')
},
onShow() {
document.title = "新增议事"
document.title = '新增议事'
},
methods: {
getDetail() {
this.$http.post(`/app/appvillagediscuss/queryDetailById?id=${this.id}`).then((res) => {
if (res?.data) {
this.form = {...res.data}
this.form = { ...res.data }
if (res.data.images) {
this.form.images = JSON.parse(res.data.images || '[]')
}
@@ -72,20 +69,22 @@ export default {
if (!this.form.discussDeadline) {
return this.$u.toast('请选择 议事截止时间')
}
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)
}
})
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)
}
})
},
},
}
@@ -153,7 +152,7 @@ export default {
.discussType {
width: 320px;
height: 112px;
background: #F5F5F5;
background: #f5f5f5;
border-radius: 4px;
font-size: 30px;
font-family: PingFangSC-Medium, PingFang SC;
@@ -168,17 +167,17 @@ export default {
}
&.current {
color: #1174FE;
background: #E7F1FE;
color: #1174fe;
background: #e7f1fe;
position: relative;
&:before {
position: absolute;
display: block;
content: " ";
content: ' ';
bottom: 0;
right: 0;
border: 24px solid #1576FE;
border: 24px solid #1576fe;
border-top-color: transparent;
border-left-color: transparent;
border-radius: inherit;
@@ -188,7 +187,7 @@ export default {
&:after {
position: absolute;
display: block;
content: "✓";
content: '✓';
bottom: 0;
right: 0;
color: #fff;