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() {