unknown
9 months ago
19 changed files with 11 additions and 610 deletions
-
1App.vue
-
1mp_ecard_sdk/constants/log.js
-
1mp_ecard_sdk/globalConfig.js
-
1mp_ecard_sdk/index.css
-
1mp_ecard_sdk/index/index.js
-
24mp_ecard_sdk/index/index.vue
-
1mp_ecard_sdk/main.js
-
1mp_ecard_sdk/utils/http.js
-
1mp_ecard_sdk/utils/index.js
-
1mp_ecard_sdk/utils/validate.js
-
7pages.json
-
163pages/indexEntry/NonPlatformStudentInfo/NonPlatformStudentInfo.vue
-
22pages/indexEntry/enroll/enroll.vue
-
2pages/tabbar/index/index.vue
-
303pages/tabbar/learnCar/index - 副本 (2).vue
-
78pages/tabbar/learnCar/index - 副本.vue
-
11pages/tabbar/learnCar/index.vue
-
BINstatic/images/bigImg/banner.jpg
-
BINstatic/images/bigImg/banner2.jpg
@ -1 +0,0 @@ |
|||||
const Log={version:"uni_1.0.3",SourceType:"mp_sdk_uni",getIntoIndexPage:"START_INDEX",initSdk:"INIT_SDK",getConfig:"GET_CONFIG",getConfigRetry:"GET_CONFIG_BY_RETRY",webViewResult:"WEBVIEW_RESULT",webViewError:"WEBVIEW_ERROR",navigateToEid:"NAVIGATE_TO_EID",navigateBackFromEid:"NAVIGATE_BACK_FROM_EID",navigateBackFromEidFail:"NAVIGATE_BACK_FROM_EID_FAIL",startEid:"START_EID",startEidFail:"START_EID_FAIL",eidVerifyDone:"EID_VERIFY_DONE",requestFail:"REQUEST_FAIL",requestCatch:"REQUEST_CATCH",onAppShow:"ON_APP_SHOW"};export default Log; |
|
@ -1 +0,0 @@ |
|||||
export default{normalPath:""}; |
|
@ -1 +0,0 @@ |
|||||
.auth{margin-top:128rpx;display:flex;flex-direction:column;align-items:center}.auth-logo{width:200rpx;height:200rpx}.auth-logo image{height:100%;width:100%}.title{margin-top:20rpx;font-size:36rpx;line-height:56rpx}.merchant-name{display:inline;font-weight:700}.sub-title{margin-top:8rpx;font-size:34rpx;line-height:52rpx}.button-area{margin-top:48rpx}.button-area button{width:622rpx;height:96rpx;background:#fff;border:2rpx solid #ddd;font-size:32rpx;font-weight:400;line-height:96rpx;padding:0}.redirect{margin-top:272rpx;display:flex;flex-direction:column;align-items:center}.loading{height:160rpx;width:160rpx;margin-bottom:32rpx}.loading image{height:100%;width:100%}.title{font-size:34rpx;line-height:52rpx} |
|
@ -1 +0,0 @@ |
|||||
import Log from"../constants/log.js";import{navigateToEid}from"../utils/index";export default{data(){return{token:""}},onLoad(e){var{token:e,needJumpPage:t}=e;this.token=e,uni.reportLogToEid({token:e,event:Log.getIntoIndexPage,errMsg:`进入配置首页,token:${e},needJumpPage:`+t})},methods:{handleStart(){navigateToEid(this.token)}}}; |
|
@ -1,24 +0,0 @@ |
|||||
<template> |
|
||||
<view class="auth"> |
|
||||
<view class="auth-logo"> |
|
||||
<image src="https://faceid-h5-1254418846.file.myqcloud.com/mp_verify_sdk/images/ecard/logo.png" /> |
|
||||
</view> |
|
||||
<view class="title"> |
|
||||
即将进入"eID数字身份"小程序 |
|
||||
</view> |
|
||||
<view class="button-area"> |
|
||||
<button @click='handleStart' > |
|
||||
确认进入 |
|
||||
</button> |
|
||||
</view> |
|
||||
</view> |
|
||||
</template> |
|
||||
|
|
||||
<script> |
|
||||
import index from "./index"; |
|
||||
export default index; |
|
||||
</script> |
|
||||
|
|
||||
<style> |
|
||||
@import url('../index.css'); |
|
||||
</style> |
|
@ -1 +0,0 @@ |
|||||
import validate from"./utils/validate";import Log from"./constants/log";import globalConfig from"./globalConfig";import{navigateToEid}from"./utils/index";const EIDAppID="wx0e2cb0b052a91c92";function initEid(e="https://eid.faceid.qq.com",o="release",n="https://eid-enhance.faceid.qq.com"){uni.eidBaseUrl=e,uni.eidEnvVersion=o,uni.eidBackUpUrl=n;uni.onAppShow(e=>{console.log("!!!!!!监听onshow事件",e,wx.eidTokenToCallback);var{scene:e,referrerInfo:o}=e,{appId:o,extraData:n}=o||{},{token:i,verifyDone:t}=n||{};1038===e&&o===EIDAppID&&uni.eidTokenToCallback&&(o=i||uni.eidTokenToCallback,uni.reportLogToEid({token:o,event:Log.navigateBackFromEid,errMsg:`从EID核身完成返回,核验未完成或者没有处理核验完成的函数,token:${o},verifyDone:${t},scene:`+e}),uni.eidTokenToCallback)&&uni.eidTokenToCallback===i&&t&&uni.handleEidVerifyDone&&uni.handleEidVerifyDone(n),uni.eidTokenToCallback=""});e=uni.getSystemInfoSync();const d=e["version"];uni.reportLogToEid=function(e){var{token:e="",event:o="",errCode:n="",errMsg:i="",data:t={}}=e,r=new Date;const a={Token:e,SourceType:Log.SourceType,SourceVersion:Log.version,EnvVersion:d,Timestamp:r.getTime(),Event:o,ErrorCode:"number"==typeof n?n.toString():n,ErrorMsg:i,Data:JSON.stringify(t)};console.log("开始上报日志:",a),uni.request({url:uni.eidBaseUrl+"/api/common/ReportEvent",method:"POST",data:a,success(e){console.log("上报日志完成:","payload:",a,"res:",e)}})}}function startEid(e){const{data:o,verifyDoneCallback:n}=e;if(!o||!n)return uni.reportLogToEid({token:i,event:Log.startEidFail,errMsg:"传入的参数有误"}),void uni.showModal({title:"提示",content:"传入的参数有误",showCancel:!1});const{token:i,needJumpPage:t=!1}=o;validate.isValidateToken(i)?(uni.handleEidVerifyDone=e=>{const o=e["token"];t?uni.navigateBack({success(){uni.reportLogToEid({token:o,event:Log.EidVerifyDone,errMsg:"验证完成,token:"+o}),n({token:o,verifyDone:!0})}}):(uni.reportLogToEid({token:o,event:Log.EidVerifyDone,errMsg:"验证完成,token:"+o}),n({token:o,verifyDone:!0}))},t?uni.navigateTo({url:`${globalConfig.normalPath}/mp_ecard_sdk/index/index?token=${i}&needJumpPage=`+t}):navigateToEid(i)):(uni.reportLogToEid({token:i,event:Log.startEidFail,errMsg:"传入的token有误,token:"+i}),uni.showModal({title:"提示",content:"传入的token有误",showCancel:!1}))}export{initEid,startEid}; |
|
@ -1 +0,0 @@ |
|||||
import Log from"../constants/log.js";const request=function(e,t){const{token:o="",url:a,method:r="POST",data:s,reTry:d,header:u={"Content-Type":"application/json"}}=e;try{uni.request({url:uni.eidBaseUrl+a,method:r,data:s,header:u,success(r){console.log("request success:",r),200===r.statusCode&&r.data?0==r.data.ErrorCode||0==r.data.code?t({ErrorCode:0,ErrorMsg:r.data.ErrorMsg,Data:r.data.Data||r.data.data,reTry:d}):t({ErrorCode:r.data.ErrorCode,ErrorMsg:r.data.ErrorMsg,Data:r.data.Data||r.data.data}):t({ErrorCode:-101,ErrorMsg:"请求错误,请稍后重试"})},fail(r){console.log("request error:",r),d&&d.tryCount&&0<d.tryCount?(d.tryCount--,uni.eidBaseUrl=uni.eidBackUpUrl,setTimeout(()=>{request(e,t)},d.retryDelay||0)):t({ErrorCode:-107,ErrorMsg:"request请求异常,请稍后重试"}),uni.reportLogToEid({token:o,event:Log.requestFail,errCode:"-1",errMsg:"requestFail 调用失败",data:{url:""+(uni.eidBaseUrl+a),err:r}})}})}catch(r){console.log("request error:",r),t({ErrorCode:-109,ErrorMsg:"request方法异常,请稍后重试"}),uni.reportLogToEid({token:o,event:Log.requestCatch,errCode:"-1",errMsg:"requestFail 调用失败",data:{url:""+(uni.eidBaseUrl+a),err:r}})}},$http=request;export{$http}; |
|
@ -1 +0,0 @@ |
|||||
import Log from"../constants/log";const navigateToEid=o=>{console.log("navigateToEid",uni.eidEnvVersion),uni.navigateToMiniProgram({appId:"wx0e2cb0b052a91c92",path:"pages/huiyan/index",envVersion:uni.eidEnvVersion,extraData:{useHuiyan:!0,huiyanToken:o},success(){uni.eidTokenToCallback=o},fail(e){console.log("err",e),uni.eidTokenToCallback=""},complete(e){uni.reportLogToEid({token:o,event:Log.navigateToEid,errMsg:e.errMsg})}})};export{navigateToEid}; |
|
@ -1 +0,0 @@ |
|||||
function isValidateToken(e){return/^[a-zA-Z0-9-]{36}$/.test(e)}export default{isValidateToken:isValidateToken}; |
|
@ -1,163 +0,0 @@ |
|||||
<template> |
|
||||
<view class="pageBgImg"> |
|
||||
<topNavbar title="学员信息"></topNavbar> |
|
||||
<view class="pad"> |
|
||||
<view class="card"> |
|
||||
<view class="row"> |
|
||||
<view class="lab">姓名</view> |
|
||||
<view class="value">{{form.name}}</view> |
|
||||
</view> |
|
||||
<view class="row"> |
|
||||
<view class="lab">证件号</view> |
|
||||
<view class="value">{{form.idcard}}</view> |
|
||||
</view> |
|
||||
<view class="row"> |
|
||||
<view class="lab">证件类型</view> |
|
||||
<view class="value">身份证</view> |
|
||||
</view> |
|
||||
</view> |
|
||||
|
|
||||
<view class="card"> |
|
||||
<view class="row"> |
|
||||
<view class="lab">手机号</view> |
|
||||
<view class="rightCon"> |
|
||||
<view class="val"> |
|
||||
<input v-model="form.phone" placeholder="请输入手机号" /></input> |
|
||||
</view> |
|
||||
</view> |
|
||||
</view> |
|
||||
<view class="row"> |
|
||||
<view class="lab">驾校名称</view> |
|
||||
<view class="rightCon"> |
|
||||
<view class="val"> |
|
||||
<input v-model="form.schoolName" placeholder="请输入驾校名称" /></input> |
|
||||
</view> |
|
||||
</view> |
|
||||
</view> |
|
||||
<view class="row"> |
|
||||
<view class="lab">学驾车型</view> |
|
||||
<view class="rightCon"> |
|
||||
<view class="val" @click="showType=true"> |
|
||||
<input v-model="form.trainType" placeholder="请选择" disabled="" style="pointer-events: none;"/></input> |
|
||||
</view> |
|
||||
<view class="icon" @click="showType=true"> |
|
||||
<u-icon name="arrow-right" size="14" color="#686B73" style="margin-left: 12rpx;"></u-icon> |
|
||||
</view> |
|
||||
</view> |
|
||||
</view> |
|
||||
</view> |
|
||||
|
|
||||
<view class="btnBg" @click="goNext">确认</view> |
|
||||
</view> |
|
||||
|
|
||||
<u-picker :show="showType" :columns="typeArr" @confirm="confirmType" |
|
||||
@cancel="showType=false"></u-picker> |
|
||||
|
|
||||
</view> |
|
||||
</template> |
|
||||
|
|
||||
<script> |
|
||||
import { |
|
||||
applyOnline |
|
||||
} from '@/config/api.js' |
|
||||
export default { |
|
||||
data() { |
|
||||
return { |
|
||||
form: { |
|
||||
value: 1, |
|
||||
cardType: '身份证', |
|
||||
phone: '', |
|
||||
trainType: '', |
|
||||
name: '', |
|
||||
idcard: '', |
|
||||
schoolName: '', |
|
||||
applyType: 5,//(1:普通学员,2:免费学员,3:定向学员,4:理科免费学员,5:驾校免费学员) |
|
||||
}, |
|
||||
showType: false, |
|
||||
typeArr: [ |
|
||||
['C1','C2','C3','A2','B2','A1','A3','B1','D','E','F','C4','C5','C6'] |
|
||||
], |
|
||||
} |
|
||||
// 报名进度(0:待报名,1:已选驾校,2:已实名制,3:已填写报名信息,4:已签署合同,5:待支付,6:已支付) |
|
||||
}, |
|
||||
onLoad(options) { |
|
||||
this.form.userId = this.userId |
|
||||
this.form.phone = this.vuex_userInfo.phone |
|
||||
this.form.accountId = this.vuex_userInfo.accountId |
|
||||
this.form.address = this.vuex_userInfo.address |
|
||||
this.form.name = this.vuex_userInfo.name |
|
||||
this.form.idcard = this.vuex_userInfo.idcard |
|
||||
this.form.nationality = this.vuex_userInfo.nationality || '中国' |
|
||||
this.form.cardType = this.vuex_userInfo.cardType || '1' |
|
||||
}, |
|
||||
methods: { |
|
||||
|
|
||||
confirmType(val) { |
|
||||
let item = val.value[0] |
|
||||
console.log(item) |
|
||||
this.form.trainType = item.value |
|
||||
// this.form.typeName = item.label |
|
||||
this.showType = false |
|
||||
}, |
|
||||
|
|
||||
async goNext() { |
|
||||
if(!this.form.phone) return this.$u.toast('请输入手机号') |
|
||||
if(!this.form.schoolName) return this.$u.toast('请输入驾校名称') |
|
||||
if(!this.form.trainType) return this.$u.toast('请选择学驾车型') |
|
||||
const {data: res} = await applyOnline(this.form) |
|
||||
await this.$store.dispatch('getUserInfo') |
|
||||
|
|
||||
|
|
||||
// this.$goPage('/pages/indexEntry/enroll/signContract/signContract') |
|
||||
// this.$goPage('/pages/indexEntry/enroll/uploadAvatar/uploadAvatar') |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
</script> |
|
||||
<style> |
|
||||
.input1::placeholder { |
|
||||
color: red !important; |
|
||||
} |
|
||||
</style> |
|
||||
<style lang="scss" scoped> |
|
||||
.card { |
|
||||
padding: 10rpx 46rpx 10rpx 32rpx; |
|
||||
margin-bottom: 20rpx; |
|
||||
.row { |
|
||||
height: 100rpx; |
|
||||
display: flex; |
|
||||
align-items: center; |
|
||||
|
|
||||
.lab { |
|
||||
width: 152rpx; |
|
||||
} |
|
||||
|
|
||||
.rightCon { |
|
||||
flex: 1; |
|
||||
width: 0; |
|
||||
display: flex; |
|
||||
|
|
||||
.val { |
|
||||
flex: 1; |
|
||||
width: 0; |
|
||||
|
|
||||
input { |
|
||||
font-size: 28rpx; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
.icon { |
|
||||
width: 30rpx; |
|
||||
height: 30rpx; |
|
||||
|
|
||||
u-icon {} |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
.btnBg { |
|
||||
width: 396rpx; |
|
||||
margin: 100rpx auto 0 auto; |
|
||||
} |
|
||||
</style> |
|
@ -1,303 +0,0 @@ |
|||||
<template> |
|
||||
<view class="content"> |
|
||||
<button type="primary" @click="setUserAgreePrivacy">设置是否同意隐私政策</button> |
|
||||
<button type="primary" @click="getLocationAuthorizationStatus">获取定位权限状态(ios)</button> |
|
||||
<button type="primary" @click="requestLocationAuthorization">请求定位权限(ios)</button> |
|
||||
<button type="primary" @click="init">初始化</button> |
|
||||
<button type="primary" @click="setLocationManagerInfo">设置定位管理信息</button> |
|
||||
<button type="primary" @click="getLocationManagerInfo">获取定位管理信息</button> |
|
||||
<view class="json">{{getLocationManagerInfo_json}}</view> |
|
||||
|
|
||||
<button type="primary" @click="startDrEngine">启动DR引擎</button> |
|
||||
<button type="primary" @click="terminateDrEngine">停止DR引擎</button> |
|
||||
<button type="primary" @click="getDrPosition">传出DR计算出的实时位置</button> |
|
||||
<view class="json">{{getDrPosition_json}}</view> |
|
||||
|
|
||||
<button type="primary" @click="requestSingleFreshLocation">单次定位66</button> |
|
||||
<button type="primary" @click="getLocationfn">uniapp定位</button> |
|
||||
|
|
||||
<view class="json">{{requestSingleFreshLocation_json}}</view> |
|
||||
<button type="primary" @click="removeSingleFreshLocation">取消单次定位</button> |
|
||||
|
|
||||
<button type="primary" @click="requestLocationUpdates">持续定位</button> |
|
||||
<view class="json">{{requestLocationUpdates_json}}</view> |
|
||||
<button type="primary" @click="removeUpdates">停止持续定位</button> |
|
||||
|
|
||||
<button type="primary" @click="getLastKnownLocation">获取最近一次的位置(android)</button> |
|
||||
<view class="json">{{getLastKnownLocation_json}}</view> |
|
||||
<button type="primary" @click="requestLocationWithScene">场景定位(android)</button> |
|
||||
<view class="json">{{requestLocationWithScene_json}}</view> |
|
||||
<button type="primary" @click="stopLocationWithScene">停止场景定位(android)</button> |
|
||||
<button type="primary" @click="enableForegroundLocation">开启后台定位(android)</button> |
|
||||
<button type="primary" @click="disableForegroundLocation">关闭后台定位(android)</button> |
|
||||
<button type="primary" @click="isSupportGps">是否支持GPS定位(android)</button> |
|
||||
</view> |
|
||||
</template> |
|
||||
|
|
||||
<script> |
|
||||
var KJTencentLocation = uni.requireNativePlugin("KJ-TencentLocation"); |
|
||||
/** |
|
||||
* location json字段说明: |
|
||||
* location - 定位到的相关信息 |
|
||||
* ios: |
|
||||
* fakeCode - 当前位置的作弊码 OK(正常) Coordinate(坐标是否被hook校验) Speed(速度合法性校验) Crc(循环冗余校验) Motion(运动状态和定位点校验) |
|
||||
* MotionData(传感器数据校验) MotionType(系统的运动状态和传感器识别的运动状态校验) FirstCallbackSpeed(系统首次定位回调速度校验) |
|
||||
* Simulation(模拟位置校验) LocationAge(系统当前时间与Location的时间校验) LocationSame(系统一直回调同一个点校验) |
|
||||
* drProvider - 定位结果来源 -2(错误,可能未开启dr) -1(定位结果来源未知) 0(定位结果来源融合的结果) 1(定位结果来源GPS) 2(定位结果来源网络) |
|
||||
* indoorLocationType - 室内定位类型,0表示普通定位结果,1表示蓝牙室内定位结果 |
|
||||
* areaStat - 当前位置的行政区划, 0-表示中国大陆、港、澳, 1-表示其他 |
|
||||
* horizontalAccuracy - 水平的准确度(负数无效) |
|
||||
* verticalAccuracy - 垂直的准确度(负数无效) |
|
||||
* course - 航向 、路径 取值为:0.0 ~ 359.9 真北方向表示:0.0 |
|
||||
* speed - 移动速度, 单位为m/s (米/秒), 仅当位置来自GPS时可能有效. |
|
||||
* |
|
||||
* andorid: 过多信息:https://mapapi.qq.com/sdk/locationSDK/Android/doc/index.html |
|
||||
* sourceProvider - 当前位置的细分来源. fake - 作弊 wifi cell-Cell基站 network gps |
|
||||
* fakeReason - 获取作弊码,可以官网工单进行咨询,sourceProvider返回fake,该方法返回判断其作弊的原因 |
|
||||
* fakeProbability - 获取作弊可能性,范围0~1 |
|
||||
* provider - 来源 |
|
||||
* isMockGps - 使用GPS定位时,判断该GPS位置点是否为Mock数据, 1为是,0为否,-1为无法判断,当且仅当Provider来源是GPS时有效! |
|
||||
* areaStat - 0-表示国内(中国大陆), 1-表示国外 |
|
||||
* bearing - 当前位置方向, 单位为度, 仅当位置来自GPS时可能有效. 0, 如果无法得到方向 |
|
||||
* GPSRssi - GPS信号强度,仅当provider为gps时可用 |
|
||||
* poiList - 当前位置周围的 POI |
|
||||
* altitude - 海拔高度 单位为m(米), 仅当位置来自GPS时可能有效. |
|
||||
* speed - 移动速度, 单位为m/s (米/秒), 仅当位置来自GPS时可能有效. |
|
||||
* accuracy - 当前位置的精度. 通常精度为, GPS:<20米,WiFi:30-180米,基站:150-800米. |
|
||||
* */ |
|
||||
export default { |
|
||||
data() { |
|
||||
return { |
|
||||
getLocationManagerInfo_json: null, |
|
||||
getDrPosition_json: null, |
|
||||
getLastKnownLocation_json: null, |
|
||||
requestSingleFreshLocation_json: null, |
|
||||
requestLocationUpdates_json: null, |
|
||||
requestLocationWithScene_json: null |
|
||||
} |
|
||||
}, |
|
||||
onLoad() { |
|
||||
// #ifdef APP-PLUS |
|
||||
if (plus.os.name == 'Android') { |
|
||||
plus.android.requestPermissions( |
|
||||
['android.permission.ACCESS_COARSE_LOCATION', |
|
||||
"android.permission.ACCESS_FINE_LOCATION", |
|
||||
"android.permission.ACCESS_BACKGROUND_LOCATION", |
|
||||
"android.permission.READ_PHONE_STATE", |
|
||||
"android.permission.WRITE_EXTERNAL_STORAGE", |
|
||||
], |
|
||||
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 |
|
||||
} |
|
||||
}, |
|
||||
function(error) { |
|
||||
console.log('申请权限错误:' + error.code + " = " + error.message); |
|
||||
} |
|
||||
); |
|
||||
} else { |
|
||||
this.requestLocationAuthorization() |
|
||||
} |
|
||||
// #endif |
|
||||
}, |
|
||||
methods: { |
|
||||
getLocationfn() { |
|
||||
uni.getLocation({ |
|
||||
type: 'gcj02', |
|
||||
success: function (res) { |
|
||||
console.log('当前位置的经度:' + res.longitude); |
|
||||
console.log('当前位置的纬度:' + res.latitude); |
|
||||
} |
|
||||
}); |
|
||||
|
|
||||
}, |
|
||||
setUserAgreePrivacy() { |
|
||||
var dic = { |
|
||||
"isAgree": true |
|
||||
} |
|
||||
KJTencentLocation.setUserAgreePrivacy(dic); |
|
||||
}, |
|
||||
getLocationAuthorizationStatus() { |
|
||||
KJTencentLocation.getLocationAuthorizationStatus((res) => { |
|
||||
console.log("getLocationAuthorizationStatus:" + JSON.stringify(res)); |
|
||||
/** |
|
||||
* status - 权限状态 0-还没决定 1-受限制 2-拒绝 3、4、5-已授权 |
|
||||
* */ |
|
||||
}); |
|
||||
}, |
|
||||
requestLocationAuthorization() { |
|
||||
KJTencentLocation.requestLocationAuthorization((res) => { |
|
||||
console.log("requestLocationAuthorization:" + JSON.stringify(res)); |
|
||||
/** |
|
||||
* status - 权限状态 0-还没决定 1-受限制 2-拒绝 3、4、5-已授权 |
|
||||
* */ |
|
||||
}); |
|
||||
}, |
|
||||
init() { |
|
||||
var dic = { |
|
||||
"apiKey": "BPMBZ-VSKE3-MC23F-O3KZO-AZGI7-PXFJI" //ios才有效,andorid的在App原生插件配置里设置 |
|
||||
//"deviceID": "xxx", //andorid必须设置,默认使用oaid,ios无需设置 |
|
||||
} |
|
||||
KJTencentLocation.init(dic); |
|
||||
}, |
|
||||
setLocationManagerInfo() { |
|
||||
var dic = { |
|
||||
"coordinateType": "gcj02", //设置坐标系 GCJ02(火星坐标,即国测局坐标) WGS84(地球坐标,注:如果是海外,无论设置的是火星坐标还是地球坐标,返回的都是地球坐标) |
|
||||
"requestLevel": 4, //请求等级 0(包含经纬度) 1(包含经纬度, 位置名称, 位置地址) 3(包含经纬度,位置所处的中国大陆行政区划) 4(包含经纬度,位置所处的中国大陆行政区划及周边POI列表) |
|
||||
/**以下andorid有效**/ |
|
||||
"mockEnable": false, //是否允许mockGps数据 设置为true后将不对mockGps进行过滤,是否允许应用对GPS进行模拟 |
|
||||
"systemCacheEnable": false, //是否允许在定位失败情况下返回系统缓存位置 |
|
||||
//"deviceID":"xxx", //设备id |
|
||||
"userAgreePrivacy": true, //设置用户是否同意隐私协议政策 |
|
||||
"allowCache": true, //是否允许使用缓存 |
|
||||
"allowDirection": true, //是否允许使用设备传感器获取方向 |
|
||||
"allowGPS": true, //是否允许使用GPS进行定位 |
|
||||
"gnssSource": 20, //设置优先卫星定位信号来源 改设置仅对连续定位生效,20(GPS) 21(北斗) |
|
||||
"gpsFirst": false, //首次定位是否等待卫星定位结果,默认为false 当设置为true时,首次定位会等待卫星定位结果,默认等待时间为30s,超时将返回网络定位结果 |
|
||||
"gpsFirstTimeOut": 10000, //卫星定位优先时,等待卫星定位结果对的超时时间,单位: ms, 最多等待60s. |
|
||||
"indoorLocationMode": true, //启动室内定位 |
|
||||
"interval": 5000, //定位周期(位置监听器回调周期), 单位为 ms (毫秒). |
|
||||
"locMode": 10, //定位模式 10(高精度定位模式,将同时使用网络定位和卫星定位,优先返回精度高的定位) 11(仅网络定位模式,将不启动gps定位,只使用网络定位,可以减少耗电量,但定位精度有所降低) 12(仅GPS定位模式) |
|
||||
// "phoneNumber": "111", |
|
||||
// "qq": "xxx", |
|
||||
// "smallAppKey": "xxx", //设置分渠道的key编码号,例如小程序里面区分业务. |
|
||||
/**以下ios有效**/ |
|
||||
"distanceFilter": 0, //设置定位的最小更新距离 |
|
||||
"desiredAccuracy": "best", //设置定位精度 bestForNavigation best nearestTenMeters hundredMeters kilometer threeKilometers |
|
||||
"pausesLocationUpdatesAutomatically": false, //定设置位是否会被系统自动暂停 |
|
||||
"allowsBackgroundLocationUpdates": true, //设置是否允许后台定位 为true 需要配置manifest.json->App常用其它设置->后台运行能力 location |
|
||||
"activityType": 1, //设置用户的活动类型 1(未知的出行活动类型) 2(位置管理器专门为出行活动为汽车的时候导航) 3(位置管理器专门为步行、跑步、骑自行车等健身时,提供导航) 4(位置管理器专门为其他类型的大型交通工具导航,而不是汽车导航) |
|
||||
//"headingFilter": 10, //设置当朝向改变时,每隔多少度调用一次 |
|
||||
"headingOrientation": 0, //设置设备当前的朝向 0(未知) 1(竖屏) 2(竖屏正方向,颠倒) 3(屏左方向,主按钮在右侧) 4(横屏右方向,主按钮在左侧) 5(设备正面朝上) 6(设备正面朝下) |
|
||||
"poiUpdateInterval": 10, //指定POI的更新间隔 单位秒 |
|
||||
"enableAntiMockLocation": true //是否允许开启反作弊检查 |
|
||||
} |
|
||||
console.log(dic) |
|
||||
KJTencentLocation.setLocationManagerInfo(dic) |
|
||||
}, |
|
||||
getLocationManagerInfo() { |
|
||||
KJTencentLocation.getLocationManagerInfo((res) => { |
|
||||
console.log(res) |
|
||||
console.log("getLocationManagerInfo:" + JSON.stringify(res)); |
|
||||
this.getLocationManagerInfo_json = JSON.stringify(res); |
|
||||
/** |
|
||||
* 返回json字段说明: |
|
||||
* andorid:{"oaid":"df08a06a100674e3","userAgreePrivacy":true,"version":"7.5.2.official_1", |
|
||||
* "isDrSupport":true,"coordinateType":"GCJ02","build":"230511"} |
|
||||
* |
|
||||
* ios:{"coordinateType":"GCJ02","isDrSupport":false,"userAgreePrivacy":false,"accuracyAuthorization":0,"version":"4.1.1"} |
|
||||
* |
|
||||
* */ |
|
||||
}); |
|
||||
}, |
|
||||
startDrEngine() { |
|
||||
var dic = { |
|
||||
"type": "Bike" //Bike(骑行) Walk(步行) |
|
||||
} |
|
||||
KJTencentLocation.startDrEngine(dic, (res) => { |
|
||||
console.log("startDrEngine:" + JSON.stringify(res)); |
|
||||
/** |
|
||||
* code - 0(成功) -1(传感器有缺失或没有GPS芯片) -2(已经启动) -3(传感器启动失败) -4(GPS启动失败) -5(没有位置权限) -6(未设置用或未同意隐私) -7(lib加载失败) |
|
||||
* */ |
|
||||
}); |
|
||||
}, |
|
||||
getDrPosition() { |
|
||||
KJTencentLocation.getDrPosition((res) => { |
|
||||
console.log("getDrPosition:" + JSON.stringify(res)); |
|
||||
this.getDrPosition_json = JSON.stringify(res); |
|
||||
}); |
|
||||
}, |
|
||||
terminateDrEngine() { |
|
||||
KJTencentLocation.terminateDrEngine(); |
|
||||
}, |
|
||||
getLastKnownLocation() { |
|
||||
console.log('获取最近一次定位') |
|
||||
console.log(KJTencentLocation.getLastKnownLocation) |
|
||||
KJTencentLocation.getLastKnownLocation((res) => { |
|
||||
console.log("getLastKnownLocation:" + JSON.stringify(res)); |
|
||||
this.getLastKnownLocation_json = JSON.stringify(res); |
|
||||
}); |
|
||||
}, |
|
||||
requestSingleFreshLocation() { |
|
||||
console.log('单次定位11') |
|
||||
console.log(KJTencentLocation.requestSingleFreshLocation) |
|
||||
KJTencentLocation.requestSingleFreshLocation((res) => { |
|
||||
console.log(res) |
|
||||
console.log('单次定位') |
|
||||
// this.requestSingleFreshLocation_json = JSON.stringify(res); |
|
||||
// console.log("requestSingleFreshLocation:" + JSON.stringify(res)); |
|
||||
}); |
|
||||
}, |
|
||||
removeSingleFreshLocation() { |
|
||||
KJTencentLocation.removeSingleFreshLocation(); |
|
||||
}, |
|
||||
requestLocationUpdates() { |
|
||||
KJTencentLocation.requestLocationUpdates((res) => { |
|
||||
console.log("requestLocationUpdates:" + JSON.stringify(res)); |
|
||||
this.requestLocationUpdates_json = JSON.stringify(res); |
|
||||
|
|
||||
}); |
|
||||
}, |
|
||||
removeUpdates() { |
|
||||
KJTencentLocation.removeUpdates(); |
|
||||
}, |
|
||||
requestLocationWithScene() { |
|
||||
/** |
|
||||
* Scenario - 目标场景 10(签到场景,单次定位,第一次会优先返回精度较高的结果,定位速度可能会延迟1~3S) |
|
||||
* 11(运动场景,高精度连续定位,适用于步行或骑行定位,第一次会优先返回精度较高的结果,定位可能会延迟3~5s) |
|
||||
* 12(出行场景,高精度连续定位,适用于室外出行场景,优先使用卫星定位结果,卫星定位成功之后网络定位不再返回,卫星信号断开之后一段时间才会返回网络结果,超时时间为8s) |
|
||||
* */ |
|
||||
var dic = { |
|
||||
"Scenario": 11 |
|
||||
} |
|
||||
KJTencentLocation.requestLocationWithScene(dic, (res) => { |
|
||||
console.log("requestLocationWithScene:" + JSON.stringify(res)); |
|
||||
this.requestLocationWithScene_json = JSON.stringify(res); |
|
||||
}); |
|
||||
}, |
|
||||
stopLocationWithScene() { |
|
||||
var dic = { |
|
||||
"Scenario": 11 |
|
||||
} |
|
||||
KJTencentLocation.stopLocationWithScene(dic); |
|
||||
}, |
|
||||
enableForegroundLocation() { |
|
||||
var dic = { |
|
||||
"notificationID": 1, |
|
||||
"contentTitle": "KJ-TencentLocation", |
|
||||
"contentText": "正在后台运行" |
|
||||
} |
|
||||
KJTencentLocation.enableForegroundLocation(dic); |
|
||||
}, |
|
||||
disableForegroundLocation() { |
|
||||
var dic = { |
|
||||
"isRemoveNotification": true |
|
||||
} |
|
||||
KJTencentLocation.disableForegroundLocation(dic); |
|
||||
}, |
|
||||
isSupportGps() { |
|
||||
KJTencentLocation.isSupportGps( (res) => { |
|
||||
console.log("isSupportGps:" + JSON.stringify(res)); |
|
||||
}); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
</script> |
|
||||
<style> |
|
||||
.json { |
|
||||
word-wrap: break-word; |
|
||||
} |
|
||||
</style> |
|
@ -1,78 +0,0 @@ |
|||||
<template> |
|
||||
<view class="pageBgImg pad"> |
|
||||
<view class="status_bar"></view> |
|
||||
<view class="" style="height: 100rpx;"></view> |
|
||||
<topInfo :carType="curObject.name" @changeSubject="changeSubject"></topInfo> |
|
||||
<subject1 v-if="curObject.id==1"></subject1> |
|
||||
<subject2 v-if="curObject.id==2"></subject2> |
|
||||
<subject3 v-if="curObject.id==3"></subject3> |
|
||||
<subject4 v-if="curObject.id==4"></subject4> |
|
||||
</view> |
|
||||
</template> |
|
||||
|
|
||||
<script> |
|
||||
import topInfo from './comp/topInfo.vue' |
|
||||
import subject1 from './comp/subject1.vue' |
|
||||
import subject2 from './comp/subject2.vue' |
|
||||
import subject3 from './comp/subject3.vue' |
|
||||
import subject4 from './comp/subject4.vue' |
|
||||
var KJGNSS = uni.requireNativePlugin("KJ-GNSS"); |
|
||||
export default { |
|
||||
components: { topInfo, subject1, subject2,subject3,subject4 }, |
|
||||
data() { |
|
||||
return { |
|
||||
curObject: { |
|
||||
name: '科目一', |
|
||||
id: 1 |
|
||||
} |
|
||||
} |
|
||||
}, |
|
||||
onLoad() { |
|
||||
if (plus.os.name == 'Android') { |
|
||||
plus.android.requestPermissions( |
|
||||
['android.permission.ACCESS_FINE_LOCATION', |
|
||||
'android.permission.ACCESS_COARSE_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 |
|
||||
} |
|
||||
}, |
|
||||
function(error) { |
|
||||
console.log('申请权限错误:' + error.code + " = " + error.message); |
|
||||
} |
|
||||
); |
|
||||
} |
|
||||
}, |
|
||||
onShow() { |
|
||||
|
|
||||
}, |
|
||||
methods: { |
|
||||
// 切换科目 |
|
||||
changeSubject(val) { |
|
||||
console.log(val) |
|
||||
this.curObject = val |
|
||||
}, |
|
||||
getProviderFn() { |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
</script> |
|
||||
|
|
||||
<style scoped lang="scss"> |
|
||||
|
|
||||
</style> |
|
Before Width: 900 | Height: 439 | Size: 134 KiB |
Before Width: 912 | Height: 480 | Size: 81 KiB |
Write
Preview
Loading…
Cancel
Save
Reference in new issue