|
@@ -47,6 +47,7 @@ Page({ |
|
@@ -47,6 +47,7 @@ Page({ |
|
47
|
* 生命周期函数--监听页面加载
|
47
|
* 生命周期函数--监听页面加载
|
|
48
|
*/
|
48
|
*/
|
|
49
|
hasOnLoad:false,
|
49
|
hasOnLoad:false,
|
|
|
|
50
|
+ hasGetLocation:false,
|
|
50
|
onLoad: async function (options) {
|
51
|
onLoad: async function (options) {
|
|
51
|
this.hasOnLoad=true;
|
52
|
this.hasOnLoad=true;
|
|
52
|
// this.qqmapsdk=new QQMapWX({
|
53
|
// this.qqmapsdk=new QQMapWX({
|
|
@@ -89,7 +90,7 @@ Page({ |
|
@@ -89,7 +90,7 @@ Page({ |
|
89
|
this.getClassNameFlag=true;
|
90
|
this.getClassNameFlag=true;
|
|
90
|
//this.getPos();
|
91
|
//this.getPos();
|
|
91
|
if(this.data.hasSuggestion) return;
|
92
|
if(this.data.hasSuggestion) return;
|
|
92
|
- if(!this.hasOnLoad) return;
|
93
|
+ if(!this.hasOnLoad && this.hasGetLocation) return;
|
|
93
|
this.hasOnLoad=false;
|
94
|
this.hasOnLoad=false;
|
|
94
|
//导航栏自适应
|
95
|
//导航栏自适应
|
|
95
|
let systemInfo = wx.getSystemInfoSync();
|
96
|
let systemInfo = wx.getSystemInfoSync();
|
|
@@ -154,6 +155,7 @@ Page({ |
|
@@ -154,6 +155,7 @@ Page({ |
|
154
|
getPos(systemInfo){
|
155
|
getPos(systemInfo){
|
|
155
|
this._getPos().then(res => {
|
156
|
this._getPos().then(res => {
|
|
156
|
console.log('wx.getLocation.then', res);
|
157
|
console.log('wx.getLocation.then', res);
|
|
|
|
158
|
+ this.hasGetLocation=true;
|
|
157
|
let map = this.data.map;
|
159
|
let map = this.data.map;
|
|
158
|
map.latitude = res.latitude;
|
160
|
map.latitude = res.latitude;
|
|
159
|
map.longitude = res.longitude;
|
161
|
map.longitude = res.longitude;
|
|
@@ -176,8 +178,11 @@ Page({ |
|
@@ -176,8 +178,11 @@ Page({ |
|
176
|
},
|
178
|
},
|
|
177
|
})
|
179
|
})
|
|
178
|
}).catch((e) => {
|
180
|
}).catch((e) => {
|
|
|
|
181
|
+ this.hasGetLocation=false;
|
|
179
|
console.log('wx.getLocation.catch', e);
|
182
|
console.log('wx.getLocation.catch', e);
|
|
180
|
- if ('getLocation:fail auth deny' == e.errMsg || 'getLocation:fail:auth denied' == e.errMsg) {
|
183
|
+ if ('getLocation:fail auth deny' == e.errMsg
|
|
|
|
184
|
+ || 'getLocation:fail:auth denied' == e.errMsg
|
|
|
|
185
|
+ || 'getLocation:fail authorize no response' == e.errMsg) {
|
|
181
|
this.selectComponent('#showModal').options({
|
186
|
this.selectComponent('#showModal').options({
|
|
182
|
header: '定位失败',
|
187
|
header: '定位失败',
|
|
183
|
body: '需要地理位置授权'
|
188
|
body: '需要地理位置授权'
|
|
@@ -342,7 +347,7 @@ Page({ |
|
@@ -342,7 +347,7 @@ Page({ |
|
342
|
let map = this.mapData;
|
347
|
let map = this.mapData;
|
|
343
|
//console.log('getMarkers',map.region);
|
348
|
//console.log('getMarkers',map.region);
|
|
344
|
if(!this.hasInRegion()) {
|
349
|
if(!this.hasInRegion()) {
|
|
345
|
- console.log('FAIL:::',this.user,map)
|
350
|
+ //console.log('FAIL:::',this.user,map)
|
|
346
|
return setTimeout(()=>{
|
351
|
return setTimeout(()=>{
|
|
347
|
this.getMarkers();
|
352
|
this.getMarkers();
|
|
348
|
},300)
|
353
|
},300)
|