This commit is contained in:
shijingjing
2022-08-25 17:24:33 +08:00
parent 9894cecb74
commit aaf2b8b475

View File

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