From 9bc3e453c017a2dea70f11862ced0f3ee92703cc Mon Sep 17 00:00:00 2001 From: liuye Date: Tue, 21 May 2024 15:49:34 +0800 Subject: [PATCH] areaId --- .../AppResidentAssistant.vue | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/project/baidu/AppResidentAssistant/AppResidentAssistant.vue b/src/project/baidu/AppResidentAssistant/AppResidentAssistant.vue index 9b00673..1ae6657 100644 --- a/src/project/baidu/AppResidentAssistant/AppResidentAssistant.vue +++ b/src/project/baidu/AppResidentAssistant/AppResidentAssistant.vue @@ -80,7 +80,8 @@ export default { // } ], current: 1, - pages: 2 + pages: 2, + areaId: '' } }, computed: { @@ -92,6 +93,21 @@ export default { this.upLoad(res.tempFilePath) }); this.getHistoryList() + uni.getLocation({ + type: 'wgs84', // 返回可以用于uni.openLocation的经纬度,默认为wgs84的gps坐标 + success : (res) => { + let location = `${res.latitude}, ${res.longitude}` + console.log(location) + this.$instance.post(`/admin/area/reverseGeocoding?location=${location}`).then(res => { + if(res.code == 0) { + this.areaId = res.data.result.addressComponent.adcode + '000000' + } + }) + }, + fail: (error) => { + console.log('获取位置失败:', error); + } + }); }, onPullDownRefresh() { if(this.current > this.pages) { @@ -169,7 +185,7 @@ export default { }, sendMsg() { this.$loading() - this.$instance.post("/app/appaigccopilotinfo/add", {content: this.content, appType: 0}).then(res => { + this.$instance.post("/app/appaigccopilotinfo/add", {content: this.content, appType: 0, areaId: this.areaId}).then(res => { if(res.code == 0) { this.content = '' this.messageList.push(res.data[0])