H5-ThreeDoorder/unpackage/dist/build/web/static/js/lociton.js

61 lines
1.6 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

let Detectionlocations = class Detectionlocation{
SystemInfo = '';
/**
* @获取设备GPS是否开启
*/
GetSystemInfoGps(){
this['SystemInfo'] = uni.getSystemInfoSync();
console.log(this['SystemInfo'],this['SystemInfo']['locationEnabled'],'检查设备是否开启GPS');
let self = this;
if (!this['SystemInfo']['locationEnabled']){
console.log('未开启GPS')
uni.showModal({
title: "温馨提示",
content: "亲我们未获得您的位置信息授权请确认手机GPS是否开启",
confirmText: '我已开启',
showCancel: false,
success(res) {
if (res.confirm == true) {
// 点击已开启之后检测系统定位是否真正开启
self.GetSystemInfoGps();
}
}
})
}else{
console.log('已未开启GPS')
this.WXlocationAuthorized();
}
}
/**
* @微信是否开启定位权限
*/
WXlocationAuthorized(){
console.log('检查微信应用是否开启定位权限');
if(!this['SystemInfo']['locationAuthorized']){
console.log('微信应用未开启定位权限');
uni.showModal({
title: "温馨提示",
content: "您的微信应用未开启定位权限,请开启后再试",
confirmText: '好的',
showCancel: false,
success(res) {
if (res.confirm == true) {
console.log(self,'未开启')
// 点击已开启之后检测系统定位是否真正开启
self.WXlocationAuthorized();
}
}
})
}else{
console.log('微信应用已开启定位权限');
}
}
}
export default Detectionlocations;