From 07da160ab82963316681936e3b8615d285c4efcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8A=B1=E6=9C=89=E6=B8=85=E9=A6=99=E6=9C=88=E6=9C=89?= =?UTF-8?q?=E9=98=B4?= <185154740@qq.com> Date: Fri, 7 Jan 2022 15:58:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=95=E7=A5=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apps/AppVillageDiscuss/Add.vue | 61 ++++++++++++++++++++---------- 1 file changed, 42 insertions(+), 19 deletions(-) diff --git a/src/apps/AppVillageDiscuss/Add.vue b/src/apps/AppVillageDiscuss/Add.vue index 48c34ef2..23a7d04d 100644 --- a/src/apps/AppVillageDiscuss/Add.vue +++ b/src/apps/AppVillageDiscuss/Add.vue @@ -11,7 +11,7 @@ - + @@ -39,7 +39,7 @@
- +
@@ -53,7 +53,7 @@
- +
@@ -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() {