From 055b32843291a22d73cd896d8655869cfb98ab9e Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 7 Jul 2026 11:42:36 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E6=9B=B4=E6=96=B0=E6=96=B0=E5=9C=B0?= =?UTF-8?q?=E5=9B=BE=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/store/useWeAppAuthStore.ts | 48 +++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/src/common/store/useWeAppAuthStore.ts b/src/common/store/useWeAppAuthStore.ts index 6f251a4..610f585 100644 --- a/src/common/store/useWeAppAuthStore.ts +++ b/src/common/store/useWeAppAuthStore.ts @@ -177,6 +177,54 @@ uni.getLocation({ }) } + +const getShowApiAddress = () => { + // ShowAPI(易源数据) 逆地理编码 + const SHOWAPI_APP_KEY = 'C59885FE214644168eB4197eFe9a48b9' + return new Promise<{ formatted_address: string }>((resolve, reject) => { + uni.getLocation({ + type: 'wgs84', + altitude: true, + isHighAccuracy: true, + success(res) { + console.log(res, '经纬度') + const url = `https://route.showapi.com/238-3?appKey=${SHOWAPI_APP_KEY}&lng=${res.longitude}&lat=${res.latitude}&from=5` + uni.request({ + url: url, + method: 'GET', + success(res: any) { + console.log(res, 'address') + data.value.current_city = res?.data?.showapi_res_body?.addressComponent || {} + }, + fail(res) { + resolve({ formatted_address: '拒绝定位' }) + console.error('获取地址失败:', res) + uni.showModal({ + title: '提示', + content: '请先允许定位!', + success: function (res) { + if (res.confirm) { + uni.openSetting() + console.log('用户点击确定') + } else if (res.cancel) { + console.log('用户点击取消') + } + } + }) + } + }) + }, + fail(e) { + console.log('拒绝定位', e) + } + }) + }) +} + + + + + return { loading, hasError,