调整定位权限丢失小程序无法运行问题
This commit is contained in:
@@ -325,11 +325,19 @@ Page({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
fail: function(res) {
|
fail: function(res) {
|
||||||
console.log(res);
|
|
||||||
if (res.errMsg == 'getLocation:fail auth deny' || res.errMsg == 'getLocation:fail:auth denied') {
|
|
||||||
that.setData({
|
that.setData({
|
||||||
isShowAuth: true
|
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
|
||||||
|
// })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@@ -480,8 +488,21 @@ Page({
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
// 回到开始
|
// 由原来的回到开始改为定位
|
||||||
goFrist() {
|
goFrist() {
|
||||||
|
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 = [{
|
let list = [{
|
||||||
longitude: this.data.longitude,
|
longitude: this.data.longitude,
|
||||||
latitude: this.data.latitude
|
latitude: this.data.latitude
|
||||||
@@ -490,6 +511,22 @@ Page({
|
|||||||
this.setData({
|
this.setData({
|
||||||
includePoints: list
|
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({
|
||||||
|
isShowAuth: false
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -112,4 +112,4 @@
|
|||||||
</view>
|
</view>
|
||||||
</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>
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ Page({
|
|||||||
this.setData({
|
this.setData({
|
||||||
state: options.state
|
state: options.state
|
||||||
})
|
})
|
||||||
this.getLocation();
|
this.getData();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -144,35 +144,6 @@ Page({
|
|||||||
isShowNewplot: true
|
isShowNewplot: true
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
|
||||||
|
|
||||||
// 活动当前坐标
|
|
||||||
getLocation() {
|
|
||||||
let that = this;
|
|
||||||
wx.getLocation({
|
|
||||||
type: 'gcj02',
|
|
||||||
success: function(res) {
|
|
||||||
latitude = res.latitude;
|
|
||||||
longitude = res.longitude;
|
|
||||||
that.getData()
|
|
||||||
},
|
|
||||||
fail: function(res) {
|
|
||||||
if (res.errMsg == 'getLocation:fail auth deny' || res.errMsg == 'getLocation:fail:auth denied') {
|
|
||||||
that.setData({
|
|
||||||
isShowAuth: true
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
},
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
// 获取授权
|
|
||||||
setAuthSuccess(e) {
|
|
||||||
if (e.detail.authSetting['scope.userLocation']) {
|
|
||||||
this.getLocation();
|
|
||||||
this.setData({
|
|
||||||
isShowAuth: false
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
@@ -34,8 +34,6 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<confirm-dialog title="{{'提示'}}" message="{{'需要获取使用地理位置权限'}}" bindopensetting="setAuthSuccess" wx:if="{{isShowAuth}}" isAuth="{{true}}" show-cancel="{{false}}"></confirm-dialog>
|
|
||||||
|
|
||||||
<view class='newplot' wx:if="{{isShowNewplot && venues.length == 0}}">
|
<view class='newplot' wx:if="{{isShowNewplot && venues.length == 0}}">
|
||||||
<image src='../../images/noContent.png'></image>
|
<image src='../../images/noContent.png'></image>
|
||||||
<text>暂无运动场馆 ~</text>
|
<text>暂无运动场馆 ~</text>
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
{
|
{
|
||||||
"description": "项目配置文件。",
|
"description": "项目配置文件。",
|
||||||
"packOptions": {
|
"packOptions": {
|
||||||
"ignore": []
|
"ignore": [],
|
||||||
|
"include": []
|
||||||
},
|
},
|
||||||
"setting": {
|
"setting": {
|
||||||
"urlCheck": false,
|
"urlCheck": false,
|
||||||
@@ -42,22 +43,11 @@
|
|||||||
"libVersion": "2.17.0",
|
"libVersion": "2.17.0",
|
||||||
"appid": "wx73eb8a9ed10a029d",
|
"appid": "wx73eb8a9ed10a029d",
|
||||||
"projectname": "%E6%99%BA%E6%85%A7%E4%BA%91%E9%A6%86",
|
"projectname": "%E6%99%BA%E6%85%A7%E4%BA%91%E9%A6%86",
|
||||||
"isGameTourist": false,
|
|
||||||
"simulatorType": "wechat",
|
"simulatorType": "wechat",
|
||||||
"simulatorPluginLibVersion": {},
|
"simulatorPluginLibVersion": {},
|
||||||
"condition": {
|
"condition": {},
|
||||||
"search": {
|
"editorSetting": {
|
||||||
"list": []
|
"tabIndent": "insertSpaces",
|
||||||
},
|
"tabSize": 2
|
||||||
"conversation": {
|
|
||||||
"list": []
|
|
||||||
},
|
|
||||||
"game": {
|
|
||||||
"currentL": -1,
|
|
||||||
"list": []
|
|
||||||
},
|
|
||||||
"miniprogram": {
|
|
||||||
"list": []
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user