调整定位权限丢失小程序无法运行问题
This commit is contained in:
@@ -325,11 +325,19 @@ Page({
|
||||
});
|
||||
},
|
||||
fail: function(res) {
|
||||
console.log(res);
|
||||
that.setData({
|
||||
latitude: 31.2336800000,
|
||||
longitude: 121.4715700000,
|
||||
})
|
||||
that.getData({
|
||||
latitude: that.data.latitude,
|
||||
longitude: that.data.longitude,
|
||||
zoom: 1
|
||||
});
|
||||
if (res.errMsg == 'getLocation:fail auth deny' || res.errMsg == 'getLocation:fail:auth denied') {
|
||||
that.setData({
|
||||
isShowAuth: true
|
||||
})
|
||||
// that.setData({
|
||||
// isShowAuth: true
|
||||
// })
|
||||
}
|
||||
},
|
||||
})
|
||||
@@ -480,15 +488,44 @@ Page({
|
||||
})
|
||||
},
|
||||
|
||||
// 回到开始
|
||||
// 由原来的回到开始改为定位
|
||||
goFrist() {
|
||||
let list = [{
|
||||
longitude: this.data.longitude,
|
||||
latitude: this.data.latitude
|
||||
}];
|
||||
// this.data.includePoints
|
||||
let that = this;
|
||||
wx.getLocation({
|
||||
type: 'gcj02',
|
||||
success: function(res) {
|
||||
that.setData({
|
||||
latitude: res.latitude,
|
||||
longitude: res.longitude,
|
||||
})
|
||||
that.getData({
|
||||
latitude: res.latitude,
|
||||
longitude: res.longitude,
|
||||
zoom: 1
|
||||
});
|
||||
let list = [{
|
||||
longitude: this.data.longitude,
|
||||
latitude: this.data.latitude
|
||||
}];
|
||||
// this.data.includePoints
|
||||
this.setData({
|
||||
includePoints: list
|
||||
})
|
||||
},
|
||||
fail: function(res) {
|
||||
console.log(res.errMsg)
|
||||
if (res.errMsg == 'getLocation:fail auth deny' || res.errMsg == 'getLocation:fail:auth denied') {
|
||||
that.setData({
|
||||
isShowAuth: true
|
||||
})
|
||||
}
|
||||
},
|
||||
})
|
||||
},
|
||||
onCancel(e){
|
||||
console.log(e)
|
||||
this.setData({
|
||||
includePoints: list
|
||||
isShowAuth: false
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
@@ -112,4 +112,4 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<confirm-dialog title="{{'提示'}}" message="{{'需要获取使用地理位置权限'}}" bindopensetting="setAuthSuccess" wx:if="{{isShowAuth}}" isAuth="{{true}}" show-cancel="{{false}}"></confirm-dialog>
|
||||
<confirm-dialog title="{{'提示'}}" message="{{'需要获取使用地理位置权限'}}" bindopensetting="setAuthSuccess" wx:if="{{isShowAuth}}" isAuth="{{true}}" show-cancel="{{true}}" bind:cancelselect="onCancel"></confirm-dialog>
|
||||
|
||||
Reference in New Issue
Block a user