|
...
|
...
|
@@ -47,6 +47,7 @@ Page({ |
|
|
|
* 生命周期函数--监听页面加载
|
|
|
|
*/
|
|
|
|
hasOnLoad:false,
|
|
|
|
hasGetLocation:false,
|
|
|
|
onLoad: async function (options) {
|
|
|
|
this.hasOnLoad=true;
|
|
|
|
// this.qqmapsdk=new QQMapWX({
|
|
...
|
...
|
@@ -89,7 +90,7 @@ Page({ |
|
|
|
this.getClassNameFlag=true;
|
|
|
|
//this.getPos();
|
|
|
|
if(this.data.hasSuggestion) return;
|
|
|
|
if(!this.hasOnLoad) return;
|
|
|
|
if(!this.hasOnLoad && this.hasGetLocation) return;
|
|
|
|
this.hasOnLoad=false;
|
|
|
|
//导航栏自适应
|
|
|
|
let systemInfo = wx.getSystemInfoSync();
|
|
...
|
...
|
@@ -154,6 +155,7 @@ Page({ |
|
|
|
getPos(systemInfo){
|
|
|
|
this._getPos().then(res => {
|
|
|
|
console.log('wx.getLocation.then', res);
|
|
|
|
this.hasGetLocation=true;
|
|
|
|
let map = this.data.map;
|
|
|
|
map.latitude = res.latitude;
|
|
|
|
map.longitude = res.longitude;
|
|
...
|
...
|
@@ -176,8 +178,11 @@ Page({ |
|
|
|
},
|
|
|
|
})
|
|
|
|
}).catch((e) => {
|
|
|
|
this.hasGetLocation=false;
|
|
|
|
console.log('wx.getLocation.catch', e);
|
|
|
|
if ('getLocation:fail auth deny' == e.errMsg || 'getLocation:fail:auth denied' == e.errMsg) {
|
|
|
|
if ('getLocation:fail auth deny' == e.errMsg
|
|
|
|
|| 'getLocation:fail:auth denied' == e.errMsg
|
|
|
|
|| 'getLocation:fail authorize no response' == e.errMsg) {
|
|
|
|
this.selectComponent('#showModal').options({
|
|
|
|
header: '定位失败',
|
|
|
|
body: '需要地理位置授权'
|
|
...
|
...
|
@@ -342,7 +347,7 @@ Page({ |
|
|
|
let map = this.mapData;
|
|
|
|
//console.log('getMarkers',map.region);
|
|
|
|
if(!this.hasInRegion()) {
|
|
|
|
console.log('FAIL:::',this.user,map)
|
|
|
|
//console.log('FAIL:::',this.user,map)
|
|
|
|
return setTimeout(()=>{
|
|
|
|
this.getMarkers();
|
|
|
|
},300)
|
...
|
...
|
|