<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                2022-05-02 近期在使用人人商城進行二開時,使用的是自己編寫通過js調用微信授權獲取用戶經緯度,計算出附近一定距離內的商家位置并進行排序。但是距離一直不精確,偏差還很大,經過幾次折騰還是使用人人商城系統的高德地圖和百度地圖的授權獲取位置 但是這里有一個小坑,需要留意,這里是完整的框架自帶授權獲取經緯度 /*高德地圖定位*/ // var map = new AMap.Map('amap-container'); // window.modal = modal; // map.plugin('AMap.Geolocation', function () { // var geolocation = new AMap.Geolocation({ // enableHighAccuracy: true,//是否使用高精度定位,默認:true // timeout: 5000, //超過10秒后停止定位,默認:5s // maximumAge: 0, //定位結果緩存0毫秒,默認:0(10min) // }); // map.addControl(geolocation); // geolocation.getCurrentPosition(function (status, result) { // if (status == 'complete') { // modal.setCookie('lat', result.position.lat, 0.1); // modal.setCookie('lng', result.position.lng, 0.1); // modal.location.lat = result.position.lat; // modal.location.lng = result.position.lng; // // modal.initMerch() // modal.initTabbar(); // } else { // /*FoxUI.toast.show("位置獲取失敗!"+result.message); // return*/ // /*百度地圖定位*/ // var geoLocation = new BMap.Geolocation(); // window.modal = modal; // geoLocation.getCurrentPosition(function (result) { // if (this.getStatus() == BMAP_STATUS_SUCCESS) { // modal.setCookie('lat', result.point.lat, 0.1); // modal.setCookie('lng', result.point.lng, 0.1); // modal.location.lat = result.point.lat; // modal.location.lng = result.point.lng; // // modal.initMerch() // modal.initTabbar(); // } else { // FoxUI.toast.show("位置獲取失敗!"); // return // } // }, {enableHighAccuracy: true}); // } // }); // }); 如果直接使用那么你獲取到的經緯度還是有很大的偏差需要你去手動處理,框架原生的判斷在你兩個script繼承地圖插件中都獲取或者配置KEY的情況下,是走不到百度地圖的授權這的,需要留意這一塊。 我的解決辦法:直接將百度地圖的定位授權提出來,只使用這一個, var geoLocation = new BMap.Geolocation(); window.modal = modal; geoLocation.getCurrentPosition(function (result) { if (this.getStatus() == BMAP_STATUS_SUCCESS) { modal.setCookie('lat', result.point.lat, 0.1); modal.setCookie('lng', result.point.lng, 0.1); modal.location.lat = result.point.lat; modal.location.lng = result.point.lng; // modal.initMerch() modal.initTabbar(); if (location.href.indexOf("#") == -1) { location.href = location.href + "#"; location.reload(); } } else { FoxUI.toast.show("位置獲取失敗!"); return } }, {enableHighAccuracy: true}); 在你后臺邏輯編寫上獲取距離上就會相對的比,高德地圖和直接調用微信的授權獲取的經緯度要精確得多,位置偏差相對再能接受范圍內。 然后計算距離目前網上很多直接使用的地球弧度啊這些,挺好用的,你動態獲取的話速度賊慢(怕是:已經實際操作過)所以就用弧度吧。 這里只是一些對于人人商城定位授權的一些見解,有什么不足和有疑問的地方感謝大家提出寶貴意見。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看