|
@ -1,6 +1,6 @@ |
|
|
import { httpPrefix } from '../../config/site.config.js'; |
|
|
import { httpPrefix } from '../../config/site.config.js'; |
|
|
// #ifdef APP-PLUS
|
|
|
// #ifdef APP-PLUS
|
|
|
import { requestSingleFreshLocation } from '@/common/js/qqLatLng.js' |
|
|
|
|
|
|
|
|
// import { requestSingleFreshLocation } from '@/common/js/qqLatLng.js'
|
|
|
// #endif
|
|
|
// #endif
|
|
|
|
|
|
|
|
|
let apiOk =true |
|
|
let apiOk =true |
|
@ -169,9 +169,10 @@ function gaoDeFn(longitude,latitude,commit,resolve, reject,) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function getCityInfo(resolve, reject, commit) { |
|
|
function getCityInfo(resolve, reject, commit) { |
|
|
|
|
|
|
|
|
|
|
|
// import { requestSingleFreshLocation } from '@/common/js/qqLatLng.js'
|
|
|
|
|
|
let qqLatLng = require('@/common/js/qqLatLng.js') |
|
|
try{ |
|
|
try{ |
|
|
requestSingleFreshLocation().then(res=>{ |
|
|
|
|
|
|
|
|
qqLatLng.requestSingleFreshLocation().then(res=>{ |
|
|
let result = res.location |
|
|
let result = res.location |
|
|
if(result.latitude===0) { |
|
|
if(result.latitude===0) { |
|
|
console.log('gogogo来了吗没有获取到经纬度?') |
|
|
console.log('gogogo来了吗没有获取到经纬度?') |
|
@ -226,48 +227,3 @@ function getCityInfo(resolve, reject, commit) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function openGps(){ |
|
|
|
|
|
plus.android.requestPermissions( |
|
|
|
|
|
['android.permission.ACCESS_FINE_LOCATION'], |
|
|
|
|
|
function(resultObj) { |
|
|
|
|
|
var result = 0; |
|
|
|
|
|
for (var i = 0; i < resultObj.granted.length; i++) { |
|
|
|
|
|
var grantedPermission = resultObj.granted[i]; |
|
|
|
|
|
console.log('已获取的权限:' + grantedPermission); |
|
|
|
|
|
result = 1 |
|
|
|
|
|
} |
|
|
|
|
|
for (var i = 0; i < resultObj.deniedPresent.length; i++) { |
|
|
|
|
|
var deniedPresentPermission = resultObj.deniedPresent[i]; |
|
|
|
|
|
console.log('拒绝本次申请的权限:' + deniedPresentPermission); |
|
|
|
|
|
result = 0 |
|
|
|
|
|
} |
|
|
|
|
|
for (var i = 0; i < resultObj.deniedAlways.length; i++) { |
|
|
|
|
|
var deniedAlwaysPermission = resultObj.deniedAlways[i]; |
|
|
|
|
|
console.log('永久拒绝申请的权限:' + deniedAlwaysPermission); |
|
|
|
|
|
result = -1 |
|
|
|
|
|
} |
|
|
|
|
|
// 若所需权限被拒绝,则打开APP设置界面,可以在APP设置界面打开相应权限
|
|
|
|
|
|
if (result != 1) { |
|
|
|
|
|
//如果用户第一次拒绝后,跳转到**应用**的权限页面
|
|
|
|
|
|
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); |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
function(error) { |
|
|
|
|
|
console.log('申请权限错误:' + error.code + " = " + error.message); |
|
|
|
|
|
resolve({ |
|
|
|
|
|
code: error.code, |
|
|
|
|
|
message: error.message |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|