diff --git a/src/project/shandong10086/AppVillager/add.vue b/src/project/shandong10086/AppVillager/add.vue index 241610d..3bc01fe 100644 --- a/src/project/shandong10086/AppVillager/add.vue +++ b/src/project/shandong10086/AppVillager/add.vue @@ -66,12 +66,7 @@ export default { ...mapState(['user']), }, onLoad() { - this.$dict.load('villagerCircleTopic').then(() => { - // var value = wx.getStorageSync('lat_lng') - // this.forms.lat = value.latitude - // this.forms.lng = value.longitude - // this.forms.gpsDesc = value.name - }) + this.$dict.load('villagerCircleTopic') }, onShow() { uni.setNavigationBarTitle({ @@ -80,10 +75,11 @@ export default { }, methods: { submit() { - if (this.flag) return + if(this.flag) return this.$refs.uForm.validate((valid) => { if (valid) { + if (!this.forms.topicValue) { return this.$u.toast('请选择话题类型') } @@ -104,8 +100,8 @@ export default { }) } - this.$instance - .post(`/app/appvillagercircleinfo/addOrUpdate`, { + this.flag = true + this.$instance.post(`/app/appvillagercircleinfo/addOrUpdate`, { topic: this.forms.topic, content: this.forms.content, pictures: imgs || [], @@ -115,22 +111,17 @@ export default { lat: this.forms.lat, lng: this.forms.lng, id: this.id, - }) - .then((res) => { - if (res.code == 0) { + }).then((res) => { + if (res?.code == 0) { + this.flag = false + this.$u.toast('提交成功') - // uni.clearStorageSync() uni.$emit('updateList') - this.flag = true setTimeout(() => { uni.navigateBack() }, 600) } }) - .catch(() => { - this.flag = false - this.$u.toast('提交失败') - }) } }) },