unknown
4 months ago
15 changed files with 314 additions and 40 deletions
-
8App.vue
-
2androidPrivacy.json
-
92common/js/location.js
-
6common/js/mixins.js
-
103common/js/permission.js.js
-
2config/request.js
-
8config/site.config.js
-
12manifest.json
-
8pages.json
-
5pages/indexEntry/enroll/signContract/signContract.vue
-
2pages/indexEntry/signIn/signAndOut/signAndOut.vue
-
16pages/mineEntry/personaInfo/AccountCance.vue
-
14pages/mineEntry/personaInfo/personaInfo.vue
-
42pages/tabbar/index/index.vue
-
34store/modules/user.js
@ -0,0 +1,92 @@ |
|||
import permision from '@/common/js/permission.js' |
|||
|
|||
export async function getLocation(cb) { |
|||
// #ifdef APP-PLUS
|
|||
let status = await checkPermission(); |
|||
if (status !== 1) { |
|||
return status; |
|||
} |
|||
// #endif
|
|||
|
|||
|
|||
|
|||
uni.showModal({ |
|||
content: '为了您更好的给您推荐附近的驾校数据,需要获取位置信息,app想要获取您的位权限', |
|||
confirmText: "确定", |
|||
success: function(res) { |
|||
if (res.confirm) { |
|||
doGetLocation(cb); |
|||
} else if (res.cancel) { |
|||
console.log('用户点击取消'); |
|||
} |
|||
} |
|||
}); |
|||
|
|||
|
|||
} |
|||
|
|||
/** |
|||
* 获取当前位置信息 |
|||
*/ |
|||
export const doGetLocation = (cb) => { |
|||
uni.getLocation({ |
|||
success: (res) => { |
|||
|
|||
console.log('当前位置:', res.longitude, res.latitude); |
|||
if (typeof cb == 'function') cb && typeof cb == 'function' && cb(status) |
|||
}, |
|||
fail: (err) => { |
|||
if (err.errMsg.indexOf("auth deny") >= 0) { |
|||
uni.showToast({ |
|||
title: "访问位置被拒绝", |
|||
icon: 'none' |
|||
}) |
|||
} else { |
|||
uni.showToast({ |
|||
title: err.errMsg, |
|||
icon: 'none' |
|||
}) |
|||
} |
|||
} |
|||
}) |
|||
} |
|||
|
|||
/** |
|||
* 检测定位权限 |
|||
*/ |
|||
async function checkPermission() { |
|||
let status = permision.isIOS ? await permision.requestIOS('location') : |
|||
await permision.requestAndroid('android.permission.ACCESS_FINE_LOCATION'); |
|||
|
|||
if (status === null || status === 1) { |
|||
status = 1; |
|||
} else if (status === 2) { |
|||
uni.showModal({ |
|||
content: "系统定位已关闭", |
|||
showCancel: false, |
|||
success: function(res) {} |
|||
}) |
|||
} else if (status.code) { |
|||
uni.showModal({ |
|||
content: status.message |
|||
}) |
|||
} else { |
|||
uni.showModal({ |
|||
content: "为了您更好的体验App蓝牙功能,需要获取位置信息,请点击设置开启定位权限", |
|||
confirmText: "设置", |
|||
success: function(res) { |
|||
if (res.confirm) { |
|||
permision.gotoAppSetting(); |
|||
} |
|||
} |
|||
}) |
|||
} |
|||
|
|||
return status; |
|||
} |
|||
|
|||
|
|||
const location = { |
|||
getLocation |
|||
} |
|||
export default location; |
@ -0,0 +1,103 @@ |
|||
|
|||
|
|||
/// null = 未请求,1 = 已允许,0 = 拒绝|受限, 2 = 系统未开启
|
|||
|
|||
var isIOS |
|||
|
|||
function location() { |
|||
var result = 0; |
|||
var cllocationManger = plus.ios.import("CLLocationManager"); |
|||
var enable = cllocationManger.locationServicesEnabled(); |
|||
var status = cllocationManger.authorizationStatus(); |
|||
if (!enable) { |
|||
result = 2; |
|||
} else if (status === 0) { |
|||
result = null; |
|||
} else if (status === 3 || status === 4) { |
|||
result = 1; |
|||
} else { |
|||
result = 0; |
|||
} |
|||
plus.ios.deleteObject(cllocationManger); |
|||
return result; |
|||
} |
|||
|
|||
function requestIOS(permissionID) { |
|||
return new Promise((resolve, reject) => { |
|||
switch (permissionID) { |
|||
case "location": |
|||
resolve(location()); |
|||
break; |
|||
default: |
|||
resolve(0); |
|||
break; |
|||
} |
|||
}); |
|||
} |
|||
|
|||
function requestAndroid(permissionID) { |
|||
return new Promise((resolve, reject) => { |
|||
plus.android.requestPermissions( |
|||
[permissionID], |
|||
function(resultObj) { |
|||
var result = 0; |
|||
for (var i = 0; i < resultObj.granted.length; i++) { |
|||
var grantedPermission = resultObj.granted[i]; |
|||
console.log('已获取的权限:'); |
|||
result = 1 |
|||
} |
|||
for (var i = 0; i < resultObj.deniedPresent.length; i++) { |
|||
var deniedPresentPermission = resultObj.deniedPresent[i]; |
|||
console.log('拒绝本次申请的权限:'); |
|||
result = 0 |
|||
} |
|||
for (var i = 0; i < resultObj.deniedAlways.length; i++) { |
|||
var deniedAlwaysPermission = resultObj.deniedAlways[i]; |
|||
console.log('永久拒绝申请的权限:'); |
|||
result = -1 |
|||
} |
|||
resolve(result); |
|||
}, |
|||
function(error) { |
|||
resolve({ |
|||
code: error.code, |
|||
message: error.message |
|||
}); |
|||
} |
|||
); |
|||
}); |
|||
} |
|||
|
|||
function gotoAppPermissionSetting() { |
|||
if (permission.isIOS) { |
|||
var UIApplication = plus.ios.import("UIApplication"); |
|||
var application2 = UIApplication.sharedApplication(); |
|||
var NSURL2 = plus.ios.import("NSURL"); |
|||
var setting2 = NSURL2.URLWithString("app-settings:"); |
|||
application2.openURL(setting2); |
|||
plus.ios.deleteObject(setting2); |
|||
plus.ios.deleteObject(NSURL2); |
|||
plus.ios.deleteObject(application2); |
|||
} else { |
|||
var Intent = plus.android.importClass("android.content.Intent"); |
|||
var Settings = plus.android.importClass("android.provider.Settings"); |
|||
var Uri = plus.android.importClass("android.net.Uri"); |
|||
var mainActivity = plus.android.runtimeMainActivity(); |
|||
var intent = new Intent(); |
|||
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); |
|||
var uri = Uri.fromParts("package", mainActivity.getPackageName(), null); |
|||
intent.setData(uri); |
|||
mainActivity.startActivity(intent); |
|||
} |
|||
} |
|||
|
|||
const permission = { |
|||
get isIOS(){ |
|||
return typeof isIOS === 'boolean' ? isIOS : (isIOS = uni.getSystemInfoSync().platform === 'ios') |
|||
}, |
|||
requestIOS: requestIOS, |
|||
requestAndroid: requestAndroid, |
|||
gotoAppSetting: gotoAppPermissionSetting |
|||
} |
|||
|
|||
export default permission |
@ -0,0 +1,16 @@ |
|||
<template> |
|||
<view class="main"> |
|||
账号注销后无法恢复 您的账号注销后 各项信息将被清空且无法恢复,请谨慎使用此功能,注销申请,请发送至邮箱helijun@jaxc.cn,我们将在收到您的申请后,尽快处理。 |
|||
</view> |
|||
</template> |
|||
|
|||
|
|||
|
|||
<style scoped lang="scss"> |
|||
.main { |
|||
font-size: 26rpx; |
|||
color: #333; |
|||
padding: 32rpx 32rpx; |
|||
line-height: 30px; |
|||
} |
|||
</style> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue