This commit is contained in:
花有清香月有阴
2022-01-07 15:58:20 +08:00
parent 5859f1c8c9
commit 07da160ab8

View File

@@ -11,7 +11,7 @@
</u-form-item>
<u-form-item label="发布地区" prop="areaId" required :border-bottom="false" right-icon="arrow-right" class="addresss">
<AiAreaPicker v-model="form.areaId" :areaId="user.areaId" @select="areaSelect" style="color: #666"></AiAreaPicker>
<AiAreaPicker v-model="form.areaId" :areaId="user.areaId" :name.sync="form.areaName" @select="areaSelect" style="color: #666"></AiAreaPicker>
</u-form-item>
<u-form-item label="议事截止时间" prop="discussDeadline" required :border-bottom="false" right-icon="arrow-right">
@@ -39,7 +39,7 @@
<img src="./img/22.png" alt="" />
<div class="rightopts">
<u-input v-model="content" placeholder="选项" maxlength="20" :clearable="false" />
<u-input v-model="content" placeholder="选项" maxlength="200" :clearable="false" />
</div>
</div>
</div>
@@ -53,7 +53,7 @@
<img src="./img/22.png" alt="" />
<div class="rightopts">
<u-input v-model="content" placeholder="选项" :clearable="false" maxlength="20" />
<u-input v-model="content" placeholder="选项" :clearable="false" maxlength="200" />
</div>
</div>
@@ -94,7 +94,11 @@ export default {
data() {
return {
id: '',
form: { type: 0 },
form: {
type: 0,
areaId: '',
areaName: '',
},
flag: false,
showStartTime: false,
showEndTime: false,
@@ -111,6 +115,7 @@ export default {
checked: true,
list: [],
content: '',
keys: ['A', 'B', 'C', 'D', 'E', 'F', 'G'],
}
},
computed: { ...mapState(['user']) },
@@ -147,22 +152,40 @@ 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)
}
if (this.opts == 1) {
var lists = []
this.list.map((item, index) => {
item.content == item, item.item == this.keys[index]
lists.push({
content: item,
item: this.keys[index],
})
})
console.log(lists)
}
var params = {
...this.form,
// voteItems: this.list,
voteItems: lists,
anonymous: this.checked == true ? 1 : 0,
createUserId: this.user.id,
createUserName: this.user.name,
images: JSON.stringify(this.form.images),
voteType: this.opts,
}
this.$http.post(`/app/appvillagediscuss/addOrUpdate`, params).then((res) => {
if (res.code == 0) {
uni.$emit('update')
this.$u.toast('发布成功')
this.flag = true
setTimeout(() => {
uni.navigateBack({})
}, 600)
}
})
},
addOpts() {