|
...
|
...
|
@@ -4,7 +4,10 @@ Component({ |
|
|
|
* 组件的属性列表
|
|
|
|
*/
|
|
|
|
properties: {
|
|
|
|
|
|
|
|
hasFailPop:{//授权失败是否弹框
|
|
|
|
type:Boolean,
|
|
|
|
value:false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
...
|
...
|
@@ -18,6 +21,7 @@ Component({ |
|
|
|
*/
|
|
|
|
methods: {
|
|
|
|
getPosDo(timeout=3000){
|
|
|
|
//timeout=0
|
|
|
|
return new Promise(function(success,fail){
|
|
|
|
let timer1=setTimeout(()=>{
|
|
|
|
fail('timeout')
|
|
...
|
...
|
@@ -25,14 +29,14 @@ Component({ |
|
|
|
wx.getLocation({
|
|
|
|
type: 'gcj02',
|
|
|
|
success: (res) => {
|
|
|
|
getApp().location=res
|
|
|
|
getApp().location = res
|
|
|
|
success(res)
|
|
|
|
},
|
|
|
|
fail: (res) => {
|
|
|
|
fail(res)
|
|
|
|
},
|
|
|
|
complete:()=>{
|
|
|
|
if(timer1) clearTimeout(timer1)
|
|
|
|
complete: () => {
|
|
|
|
if (timer1) clearTimeout(timer1)
|
|
|
|
}
|
|
|
|
});
|
|
|
|
})
|
|
...
|
...
|
@@ -46,7 +50,7 @@ Component({ |
|
|
|
timeout=86400;
|
|
|
|
}
|
|
|
|
if(res.authSetting['scope.userLocation']===false){
|
|
|
|
if(fouce){
|
|
|
|
if(fouce || this.data.hasFailPop){
|
|
|
|
this.selectComponent('#confirm').options({
|
|
|
|
header: '定位失败',
|
|
|
|
body: '请开启定位,为您查询附近餐厅。'
|
|
...
|
...
|
@@ -73,6 +77,16 @@ Component({ |
|
|
|
});
|
|
|
|
}).catch(res=>{
|
|
|
|
console.log('getPos.catch',res)
|
|
|
|
if(this.data.hasFailPop){
|
|
|
|
if ('getLocation:fail auth deny' == res.errMsg
|
|
|
|
|| 'getLocation:fail:auth denied' == res.errMsg
|
|
|
|
|| 'getLocation:fail authorize no response' == res.errMsg) {
|
|
|
|
this.selectComponent('#confirm').options({
|
|
|
|
header: '定位失败',
|
|
|
|
body: '请开启定位,为您查询附近餐厅。'
|
|
|
|
}).show();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.triggerEvent("pos",{
|
|
|
|
latitude: '',
|
|
|
|
longitude: '',
|
...
|
...
|
|