diff --git a/src/project/biaopin/AppGridReview/Add.vue b/src/project/biaopin/AppGridReview/Add.vue index d4c1380e..e64890e1 100644 --- a/src/project/biaopin/AppGridReview/Add.vue +++ b/src/project/biaopin/AppGridReview/Add.vue @@ -64,12 +64,10 @@ export default { this.forms.girdId = this.user.girdId this.forms.girdMemberId = this.user.girdMemberId this.$dict.load('wyGirdNewsType') - // this.forms.lng = '114.305000' - // this.forms.lat = '30.592800' - this.getLocation() + setTimeout(() => this.getLocation(), 500) }, methods: { - ...mapActions(['injectJWeixin', 'agentSign']), + ...mapActions(['injectSDK', 'agentSign']), submit() { if (this.flag) return if (!this.forms.content) { @@ -95,7 +93,8 @@ export default { this.forms.typeName = e[0].label }, getLocation() { - this.injectJWeixin("getLocation").then(() => { + uni.showLoading({title: "获取位置中..."}) + this.injectSDK("getLocation").then(() => new Promise((resolve, reject) => { const {wx} = window wx.getLocation({ type: 'wgs84', @@ -108,15 +107,16 @@ export default { } }).then(res => { if (res?.code == 0) { - this.forms.address = res.data.result.address + return this.$set(this.forms, 'address', res.data.result.address) } - }) + }).finally(resolve) }, error: err => { console.log("获取位置失败:", err) + reject("获取位置失败") } }) - }) + })).finally(() => this.$hideLoading()) }, }, }