2026-07-06 16:04:14 +08:00

2 lines
877 B
JavaScript

"use strict";const e=require("../vendor.js");exports.getShowApiAddress=function(){return new Promise((o,s)=>{e.index.getLocation({type:"wgs84",altitude:!0,isHighAccuracy:!0,success(s){console.log(s,"经纬度");const t=`https://route.showapi.com/238-3?appKey=C59885FE214644168eB4197eFe9a48b9&lng=${s.longitude}&lat=${s.latitude}&from=5`;e.index.request({url:t,method:"GET",success(e){var s,t;console.log(e,"address"),o({formatted_address:(null==(t=null==(s=null==e?void 0:e.data)?void 0:s.showapi_res_body)?void 0:t.formatted_address)||""})},fail(s){o({formatted_address:"拒绝定位"}),console.error("获取地址失败:",s),e.index.showModal({title:"提示",content:"请先允许定位!",success:function(o){o.confirm?(e.index.openSetting(),console.log("用户点击确定")):o.cancel&&console.log("用户点击取消")}})}})},fail(e){console.log("拒绝定位",e)}})})};