unknown
9 months ago
16 changed files with 620 additions and 483 deletions
-
30manifest.json
-
8pages.json
-
2pages/indexEntry/findShcool/shcoolDetail/comp/tab3.vue
-
45pages/mineEntry/aboutUs/aboutUs.vue
-
2pages/mineEntry/myEvaluate/comp/commentItem.vue
-
10pages/mineEntry/myOrder/detail/detail.vue
-
44pages/tabbar/learnCar/comp/comp.scss
-
52pages/tabbar/learnCar/comp/subject0.vue
-
79pages/tabbar/learnCar/comp/subject1.vue
-
116pages/tabbar/learnCar/comp/subject2.vue
-
107pages/tabbar/learnCar/comp/subject3.vue
-
71pages/tabbar/learnCar/comp/subject4.vue
-
19pages/tabbar/learnCar/comp/topInfo.vue
-
204pages/tabbar/learnCar/index - 副本.vue
-
294pages/tabbar/learnCar/index.vue
-
16pages/tabbar/mine/index.vue
@ -0,0 +1,45 @@ |
|||
<template> |
|||
<view class="main"> |
|||
<view class="logo"> |
|||
<image src="@/static/images/mineIcon/minIcon (2).png" mode="widthFix"></image> |
|||
</view> |
|||
<view class="text"> |
|||
版本号: {{version}} |
|||
</view> |
|||
</view> |
|||
</template> |
|||
|
|||
<script > |
|||
export default { |
|||
data() { |
|||
return { |
|||
version: '1.0.0' |
|||
} |
|||
}, |
|||
onLoad() { |
|||
// #ifdef APP-PLUS |
|||
this.version = plus.runtime.version |
|||
// #endif |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss" scoped> |
|||
.main { |
|||
padding: 230rpx 0 0 0; |
|||
.logo { |
|||
display: flex; |
|||
justify-content: center; |
|||
image { |
|||
display: block; |
|||
width: 120rpx; |
|||
} |
|||
} |
|||
.text { |
|||
margin-top: 20rpx; |
|||
font-size: 32rpx; |
|||
color: #666; |
|||
text-align: center; |
|||
} |
|||
} |
|||
</style> |
@ -1,52 +0,0 @@ |
|||
<template> |
|||
<view class="comp"> |
|||
|
|||
<!-- 学习状态 --> |
|||
<view class="learnStatus"> |
|||
<view class="card mt20"> |
|||
<view class="flex-b" > |
|||
<view class="lab">实操预约</view> |
|||
<!-- <view class="link-arrow" @click="$goPage('/pages/carEntry/operaAppointment/operaAppointment?subject=3')"> |
|||
<view class="txt">去预约</view> |
|||
<u-icon name="arrow-right" color="#3776FF" size="16"></u-icon> |
|||
</view> --> |
|||
<view class="btn" @click.stop="$goPage('/pages/carEntry/evaluate/evaluate?subject=2&coachType=1')">去评价</view> |
|||
</view> |
|||
</view> |
|||
<view class="h1"><text class="active">学习状态</text></view> |
|||
<view class="card"> |
|||
<view class="flex-b padTb"> |
|||
<view class="lab">科目三安全文明常识成绩已通过</view> |
|||
<view class="date">2023/08/09 22:52:12</view> |
|||
</view> |
|||
<view class="flex-b bg"> |
|||
<view class="row"> |
|||
<view class="text">考试成绩:97分</view> |
|||
<!-- <view class="btn" @click="$goPage('/pages/carEntry/evaluate/evaluate?coachType=3&tit=模拟器老师&')">去评价</view> --> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<view class="card"> |
|||
<view class="flex-b padTb"> |
|||
<view class="lab">科目三安全文明常识预约成功</view> |
|||
<view class="date">2023/08/09 22:52:12</view> |
|||
</view> |
|||
<view class="bg"> |
|||
<view class="row"> |
|||
<view class="text">考试场地:某某场地</view> |
|||
</view> |
|||
<view class="row"> |
|||
<view class="text">预约时间:2023/08/23 10:00:00</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
</script> |
|||
|
|||
<style lang="scss" scoped> |
|||
@import './comp.scss'; |
|||
</style> |
@ -1,109 +1,101 @@ |
|||
<template> |
|||
<view class="comp"> |
|||
<!-- 学习内容 --> |
|||
<view class="learnCon"> |
|||
<view class="h1">学习内容</view> |
|||
<view class="card"> |
|||
<view class="flex-b"@click="$goPage('/pages/carEntry/operaAppointment/operaAppointment?subject=2')"> |
|||
<view class="lab">实操训练</view> |
|||
<view class="btn">去预约</view> |
|||
</view> |
|||
</view> |
|||
<view class="card mb0" @click="$goPage('/pages/carEntry/examineAppointment/examineAppointment')"> |
|||
<view class="flex-b"> |
|||
<view class="lab">考场模拟训练</view> |
|||
<view class="btn disable">去预约</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
|
|||
<!-- 学习状态 --> |
|||
<view class="learnStatus"> |
|||
<view class="flex-b"> |
|||
<view class="h1">学习状态</view> |
|||
<view class="more"> |
|||
<view class="txt">查看全部</view> |
|||
<view class="moreIcon"> |
|||
<u-icon name="arrow-right" color="#686B73" size="12"></u-icon> |
|||
<view class="card mt20"> |
|||
<view class="flex-b" > |
|||
<view class="lab">实操预约</view> |
|||
<view class="link-arrow" @click="$goPage('/pages/carEntry/operaAppointment/operaAppointment?subject=2')"> |
|||
<view class="txt">去预约</view> |
|||
<u-icon name="arrow-right" color="#3776FF" :size="16"></u-icon> |
|||
</view> |
|||
<!-- <view class="btn" @click.stop="$goPage('/pages/carEntry/evaluate/evaluate?subject=2&coachType=1')">去学习</view> --> |
|||
</view> |
|||
</view> |
|||
<view class="h1"><text class="active">学习状态</text></view> |
|||
<view class="card"> |
|||
<view class="flex-b"> |
|||
<view class="flex-b padTb"> |
|||
<view class="lab">科目二考试成绩已通过</view> |
|||
<view class="date">2023/08/09 22:52:12</view> |
|||
</view> |
|||
<view class="flex-b bg"> |
|||
<view class="row"> |
|||
<view class="text">考试成绩:100分</view> |
|||
<view class="btn" @click.stop="$goPage('/pages/carEntry/evaluate/evaluate?subject=2&coachType=1')">去评价</view> |
|||
<view class="text">考试成绩:97分</view> |
|||
<view class="btn" @click="$goPage('/pages/carEntry/evaluate/evaluate?subject=2&coachType=1')">去评价</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<view class="card"> |
|||
<view class="flex-b"> |
|||
<view class="flex-b padTb"> |
|||
<view class="lab">科目二考试预约成功</view> |
|||
<view class="date">2023/08/09 22:52:12</view> |
|||
</view> |
|||
<view class="bg"> |
|||
<view class="row"> |
|||
<view class="text">考试场地:某某科目二考场</view> |
|||
<view class="text">考试场地:某某场地</view> |
|||
</view> |
|||
<view class="row"> |
|||
<view class="text">考试时间:2023/08/23 10:00:00</view> |
|||
<view class="text">考试时间:2023/08/23 10:00:00 </view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<view class="card"> |
|||
<view class="flex-b"> |
|||
<view class="lab">科目二学习进度已通过</view> |
|||
<view class="date">2023/07/24 03:12:20</view> |
|||
<view class="flex-b padTb"> |
|||
<view class="lab">科目二考试预约受理中</view> |
|||
<view class="date">2023/08/09 22:52:12</view> |
|||
</view> |
|||
<view class="flex-b bg"> |
|||
<view class="bg"> |
|||
<view class="row"> |
|||
<view class="text">前往“12123”APP预约考试</view> |
|||
<view class="btn">去预约</view> |
|||
<view class="text">考试场地:某某场地</view> |
|||
</view> |
|||
<view class="row"> |
|||
<view class="text">考试时间:2023/08/23 10:00:00 </view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<view class="card"> |
|||
<view class="flex-b"> |
|||
<view class="lab">科目二模拟训练已预约</view> |
|||
<view class="date">2023/07/24 03:12:20</view> |
|||
<view class="flex-b padTb"> |
|||
<view class="lab">科目二学习进度已通过</view> |
|||
<view class="date">2023/08/09 22:52:12</view> |
|||
</view> |
|||
<view class="bg"> |
|||
<view class="row"> |
|||
<view class="text">预约科目:科目二</view> |
|||
</view> |
|||
<view class="row"> |
|||
<view class="text">预约考场:某某考场</view> |
|||
</view> |
|||
<view class="row"> |
|||
<view class="text">车辆编号:2号车(浙A99988)</view> |
|||
</view> |
|||
<view class="row"> |
|||
<view class="text">预约时间:2023/08/16 14:00</view> |
|||
</view> |
|||
<view class="row"> |
|||
<view class="text">核销时间:2023/08/16 14:00</view> |
|||
<view class="row bg"> |
|||
<view class="text">前往"12123"APP预约考试</view> |
|||
<view class="btn">去预约</view> |
|||
</view> |
|||
</view> |
|||
<view class="cancel" @click="show=true">取消预约</view> |
|||
</view> |
|||
<view class="card"> |
|||
<view class="flex-b padTb"> |
|||
<view class="lab">科目二实操训练已核销</view> |
|||
<view class="date">2023/08/09 22:52:12</view> |
|||
</view> |
|||
<view class="bg"> |
|||
<view class="row">预约场地:某某场地</view> |
|||
<view class="row">预约教练:王一宝</view> |
|||
<view class="row">预约车辆:浙A66666</view> |
|||
<view class="row">预约时间:2023/08/09 22:52:12</view> |
|||
<view class="row">核销时间:2023/08/09 22:52:12</view> |
|||
</view> |
|||
</view> |
|||
<view class="card"> |
|||
<view class="flex-b padTb"> |
|||
<view class="lab">科目二实操训练已预约</view> |
|||
<view class="date">2023/08/09 22:52:12</view> |
|||
</view> |
|||
<view class="bg"> |
|||
<view class="row">预约场地:某某场地</view> |
|||
<view class="row">预约教练:王一宝</view> |
|||
<view class="row">预约车辆:浙A66666</view> |
|||
<view class="row">预约时间:2023/08/09 22:52:12</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<u-popup :show="show" mode="center" :round="20" @> |
|||
<cancelReservation @popupBtnClick="show=false"/> |
|||
</u-popup> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
data() { |
|||
return { |
|||
show: false |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss" scoped> |
|||
|
@ -1,172 +1,78 @@ |
|||
<template> |
|||
<view class="content pageBgImg"> |
|||
|
|||
<view style="width: 100%;height: 40rpx;"></view> |
|||
<view class="pageBgImg pad"> |
|||
<view class="status_bar"></view> |
|||
<view class="title">江西驾考公共服务平台</view> |
|||
<view class="navCard"> |
|||
<view class="nav_row"> |
|||
<view class="nav " v-for="(item,index) in navData" :key="index" :class="{active: item.id==currentNav}" @click="changeNav(item.id)">{{ item.text }}</view> |
|||
</view> |
|||
<view class="time_row"> |
|||
<view class="time_item"> |
|||
<view class="lab">应完成学时</view> |
|||
<view class="num">100分钟</view> |
|||
</view> |
|||
<view class="time_item"> |
|||
<view class="lab">已完成学时</view> |
|||
<view class="num">30分钟</view> |
|||
<view class="shareTime">*与科目一学时共享</view> |
|||
</view> |
|||
</view> |
|||
<view class="subject3" v-if="currentNav==3"> |
|||
<view class="chain left"> |
|||
<image src="@/static/images/index/chain.png" mode=""></image> |
|||
</view> |
|||
<view class="chain right"> |
|||
<image src="@/static/images/index/chain.png" mode=""></image> |
|||
</view> |
|||
<view class="time_row "> |
|||
<view class="time_item"> |
|||
<view class="lab">应完成里程</view> |
|||
<view class="num">50km</view> |
|||
</view> |
|||
<view class="time_item"> |
|||
<view class="lab">已完成里程</view> |
|||
<view class="num">0km</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<view class="haveToken" v-if="studentId"> |
|||
<subject0 v-show="currentNav==0"/> |
|||
<subject1 v-show="currentNav==1"/> |
|||
<subject2 v-show="currentNav==2"/> |
|||
<subject3 v-show="currentNav==3"/> |
|||
<subject4 v-show="currentNav==4"/> |
|||
</view> |
|||
<view class="noDate" v-else> |
|||
<nodata><text>暂无数据,您还未报名</text></nodata> |
|||
</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 subject0 from './comp/subject0' |
|||
import subject1 from './comp/subject1' |
|||
import subject2 from './comp/subject2' |
|||
import subject3 from './comp/subject3' |
|||
import subject4 from './comp/subject4' |
|||
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: { subject0, subject1, subject2, subject3, subject4 }, |
|||
components: { topInfo, subject1, subject2,subject3,subject4 }, |
|||
data() { |
|||
return { |
|||
navData: [ |
|||
{text: '模拟器', id: 0}, |
|||
{text: '科目一', id: 1}, |
|||
{text: '科目二', id: 2}, |
|||
{text: '科目三', id: 3}, |
|||
{text: '科目四', id: 4}, |
|||
], |
|||
currentNav: 0 |
|||
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() { |
|||
// console.log('没发生?') |
|||
// this.$store.dispatch('checkLogin') |
|||
|
|||
}, |
|||
methods: { |
|||
changeNav(id) { |
|||
this.currentNav = id |
|||
// 切换科目 |
|||
changeSubject(val) { |
|||
console.log(val) |
|||
this.curObject = val |
|||
}, |
|||
getProviderFn() { |
|||
|
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss" scoped> |
|||
.content { |
|||
width: 100vw; |
|||
min-height: 100vh; |
|||
// background: url('../../../static/images/bigImg/topbg.png') #F6F6F6 no-repeat; |
|||
background-size: 100% 362rpx; |
|||
padding: 0 32rpx 32rpx 32rpx; |
|||
.title { |
|||
font-size: 36rpx; |
|||
font-weight: 600; |
|||
color: #fff; |
|||
padding: 10rpx 0 48rpx 0rpx; |
|||
} |
|||
.navCard { |
|||
.nav_row { |
|||
display: flex; |
|||
justify-content: space-between; |
|||
.nav { |
|||
width: 19.4%; |
|||
height: 86rpx; |
|||
background: rgba(255,255,255,0.4); |
|||
border-radius: 8rpx 8rpx 0px 0px; |
|||
font-size: 28rpx; |
|||
color: #fff; |
|||
line-height: 86rpx; |
|||
text-align: center; |
|||
&.active { |
|||
background: #FFFFFF; |
|||
color: $themC; |
|||
} |
|||
} |
|||
} |
|||
.subject3 { |
|||
padding-top: 32rpx; |
|||
position: relative; |
|||
.chain { |
|||
width: 28rpx; |
|||
height: 100rpx; |
|||
position: absolute; |
|||
top: -34rpx; |
|||
&.left { |
|||
left: 60rpx; |
|||
} |
|||
&.right { |
|||
right: 60rpx !important; |
|||
} |
|||
} |
|||
} |
|||
.time_row { |
|||
display: flex; |
|||
height: 240rpx; |
|||
padding: 32rpx; |
|||
align-items: center; |
|||
justify-content: center; |
|||
background: #fff; |
|||
border-radius: 0 0 8rpx 8rpx; |
|||
.time_item { |
|||
flex: 1; |
|||
text-align: center; |
|||
position: relative; |
|||
.lab { |
|||
font-size: 28rpx; |
|||
color: #333; |
|||
} |
|||
|
|||
.num { |
|||
font-size: 40rpx; |
|||
font-weight: 600; |
|||
color: $themC; |
|||
margin-top: 20rpx; |
|||
} |
|||
.shareTime { |
|||
font-size: 20rpx; |
|||
color: $themC; |
|||
position: absolute; |
|||
bottom: -40rpx; |
|||
left: 0; |
|||
width: 100%; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
<style scoped lang="scss"> |
|||
|
|||
} |
|||
</style> |
@ -1,57 +1,277 @@ |
|||
<template> |
|||
<view class="pageBgImg pad"> |
|||
<view class="status_bar"></view> |
|||
<view class="" style="height: 100rpx;"></view> |
|||
<topInfo></topInfo> |
|||
<subject0></subject0> |
|||
<view class="content"> |
|||
<view style="text-align: center;">------权限-------</view> |
|||
<button type="primary" @click="isProviderEnabled">GPS是否开启(android)</button> |
|||
<button type="primary" @click="gotoLocationSetting">跳转定位设置页面</button> |
|||
<button type="primary" @click="judgePermission">获取权限状态(ios)</button> |
|||
<button type="primary" @click="requestPermission">请求权限(ios)</button> |
|||
|
|||
<view style="text-align: center;">------andorid位置提供者-------</view> |
|||
<button type="primary" @click="getProviders">获取可用位置提供者(android)</button> |
|||
<button type="primary" @click="getAllProviders">获取所有位置提供者(android)</button> |
|||
<button type="primary" @click="getBestProvider">获取最佳的位置提供者(android)</button> |
|||
|
|||
<view style="text-align: center;">------定位-------</view> |
|||
<button type="primary" @click="getLastKnownLocation">获取最新位置(android)</button> |
|||
<button type="primary" @click="requestLocation">单次定位(ios)</button> |
|||
<button type="primary" @click="startUpdatingLocation">开始持续定位</button> |
|||
<view class="json">{{startUpdatingLocationJson}}</view> |
|||
<button type="primary" @click="stopUpdatingLocation">取消持续定位</button> |
|||
|
|||
<view style="text-align: center;">------正反地理编码-------</view> |
|||
<button type="primary" @click="reverseGeocode">反地理编码</button> |
|||
<view class="json">{{reverseGeocodeJson}}</view> |
|||
<button type="primary" @click="reverseGeocodeV2">反地理编码V2(andorid),不受google服务影响</button> |
|||
<view class="json">{{reverseGeocodeV2Json}}</view> |
|||
<button type="primary" @click="geocode">地理编码</button> |
|||
<view class="json">{{geocodeJson}}</view> |
|||
|
|||
<view style="text-align: center;">------以下方法andorid7.0以上才支持-------</view> |
|||
<button type="primary" @click="registerGnssStatus">注册监听卫星信息(GNSS处理后信息)</button> |
|||
<view class="json">{{registerGnssStatusJson}}</view> |
|||
<button type="primary" @click="unregisterGnssStatus">取消注册监听卫星信息</button> |
|||
<button type="primary" @click="registerGnssMeasurements">注册监听卫星信息(GNSS测量原始信息)</button> |
|||
<view class="json">{{registerGnssMeasurementsJson}}</view> |
|||
<button type="primary" @click="unregisterGnssMeasurements">取消注册监听卫星信息</button> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
import topInfo from './comp/topInfo.vue' |
|||
import subject0 from './comp/subject0.vue' |
|||
var KJGNSS = uni.requireNativePlugin("KJ-GNSS"); |
|||
export default { |
|||
components: { topInfo, subject0 }, |
|||
data() { |
|||
return { |
|||
|
|||
startUpdatingLocationJson: "", |
|||
reverseGeocodeJson: "", |
|||
reverseGeocodeV2Json: "", |
|||
geocodeJson: "", |
|||
registerGnssStatusJson: "", |
|||
registerGnssMeasurementsJson: "" |
|||
} |
|||
}, |
|||
onShow() { |
|||
this.getProviderFn() |
|||
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); |
|||
} |
|||
); |
|||
} |
|||
}, |
|||
methods: { |
|||
getProviderFn() { |
|||
// uni.getProvider({ |
|||
// serviceType: 'location', |
|||
// success(res) { |
|||
// // res.providerList包含了所有支持的定位服务类型列表 |
|||
// if (res.providerList && res.providerList[0] === 'gps') { |
|||
// // 只有GPS定位才能保证返回真实的物理位置信息 |
|||
// // startRealLocation(); |
|||
// } else { |
|||
// console.log('无法获取真实的物理位置'); |
|||
// } |
|||
// }, |
|||
// fail(err) { |
|||
// console.error('获取定位服务类型失败', err); |
|||
// } |
|||
isProviderEnabled() { |
|||
var dic = { |
|||
"provider": "gps" //位置提供者 |
|||
} |
|||
KJGNSS.isProviderEnabled(dic, (res) => { |
|||
console.log("isProviderEnabled:" + JSON.stringify(res)); |
|||
}); |
|||
}, |
|||
gotoLocationSetting() { |
|||
KJGNSS.gotoLocationSetting(); |
|||
}, |
|||
judgePermission() { |
|||
KJGNSS.judgePermission((res) => { |
|||
console.log("judgePermission:" + JSON.stringify(res)); |
|||
}); |
|||
}, |
|||
requestPermission() { |
|||
KJGNSS.requestPermission((res) => { |
|||
console.log("requestPermission:" + JSON.stringify(res)); |
|||
}); |
|||
}, |
|||
getProviders() { |
|||
var dic = { |
|||
"enabledOnly": true //表示仅获取可用的位置提供者 |
|||
} |
|||
KJGNSS.getProviders(dic, (res) => { |
|||
console.log("getProviders:" + JSON.stringify(res)); |
|||
}); |
|||
}, |
|||
getAllProviders() { |
|||
KJGNSS.getAllProviders((res) => { |
|||
console.log("getAllProviders:" + JSON.stringify(res)); |
|||
}); |
|||
}, |
|||
getBestProvider() { |
|||
var dic = { |
|||
"accuracy": 2, //表示纬度和经度的理想精度 1-精度低,误差大于500米 2-精度中等,误差在100米到500米之间 3-精度高,误差小于100米 |
|||
//"bearingAccuracy":2,//指示所需的轴承精度 |
|||
//"horizontalAccuracy":2,//指示所需的水平精度(经度和纬度) |
|||
//"speedAccuracy":2,//指示所需的速度准确度 |
|||
//"verticalAccuracy":2,//指示所需的垂直精度(高度) |
|||
"powerRequirement": 1, //对电源的需求 1-耗电低 2-耗电中等 3-耗电高 |
|||
"altitudeRequired": false, //指示提供者是否必须提供海拔信息 |
|||
"bearingRequired": false, //指示提供者是否必须提供方位信息 |
|||
"costAllowed": false, //指示提供者是否被允许产生货币成本 |
|||
"speedRequired": false, //指示提供者是否必须提供速度信 |
|||
"enabledOnly": true //表示仅获取可用的位置提供者 |
|||
} |
|||
KJGNSS.getBestProvider(dic, (res) => { |
|||
console.log("getBestProvider:" + JSON.stringify(res)); |
|||
}); |
|||
}, |
|||
getLastKnownLocation() { |
|||
var dic = { |
|||
"provider": "gps" //位置提供者 |
|||
} |
|||
// KJGNSS.getLastKnownLocation(dic, (res) => { |
|||
// console.log("getLastKnownLocation:" + JSON.stringify(res)); |
|||
// }); |
|||
let KJGNS = uni.requireNativePlugin("KJ-GNSS"); |
|||
console.log(KJGNS) |
|||
}, |
|||
requestLocation() { |
|||
var dic = { |
|||
"desiredAccuracy": 1, |
|||
"distanceFilter": 10, |
|||
"allowsBackgroundLocationUpdates": true, |
|||
"showsBackgroundLocationIndicator": true, |
|||
"pausesLocationUpdatesAutomatically": false |
|||
} |
|||
KJGNSS.requestLocation(dic, (res) => { |
|||
console.log("requestLocation:" + JSON.stringify(res)); |
|||
|
|||
uni.startGPS({ |
|||
success(res) { |
|||
console.log('已成功开始获取真实的物理位置'); |
|||
getUserPosition(); |
|||
}, |
|||
fail(err) { |
|||
console.error('开始获取真实的物理位置失败', err); |
|||
} |
|||
}); |
|||
}); |
|||
}, |
|||
startUpdatingLocation() { |
|||
var dic; |
|||
if (plus.os.name == 'Android') { |
|||
dic = { |
|||
"providers": ["gps", "network", "passive"], //位置提供者数组,优先gps |
|||
"minTime": 1000, //更新的最小时间 |
|||
"minDistance": 1 //更新的最小距离 |
|||
} |
|||
} else { |
|||
dic = { |
|||
"isSingleLocation": false, |
|||
"desiredAccuracy": "Best", //BestForNavigation(最精准) Best(最好的,米级) NearestTenMeters(十米) HundredMeters(百米) Kilometer(一公里) ThreeKilometers(三公里) |
|||
"distanceFilter": 10, //刷新距离 |
|||
"allowsBackgroundLocationUpdates": false, //是否开启后台定位,为true 需要配置manifest.json->App常用其它设置->后台运行能力 location |
|||
"showsBackgroundLocationIndicator": false, //是否显示后台定位提示(状态栏蓝色背景) |
|||
"pausesLocationUpdatesAutomatically": false //定位是否会被系统自动暂停 |
|||
} |
|||
} |
|||
KJGNSS.startUpdatingLocation(dic, (res) => { |
|||
console.log("startUpdatingLocation:" + JSON.stringify(res)); |
|||
this.startUpdatingLocationJson = JSON.stringify(res) |
|||
if (plus.os.name == 'Android') { |
|||
//返回参数说明参考:https://www.xfqiao.com/api/android-zh/android/location/Location.html |
|||
/** |
|||
* {"method":"onLocationChanged","result":{"longitude":113.281456,"time":1687341181822,"hasBearing":false,"accuracy":40,"elapsedRealtimeNanos":1239298029066278,"provider":"network", |
|||
* "hasAccuracy":true,"bearing":0,"isFromMockProvider":false,"hasSpeed":false,"latitude":23.07654,"speed":0,"hasAltitude":false,"altitude":0}} |
|||
* isFromMockProvider - 如果位置来自模拟提供者,则返回true。 |
|||
* */ |
|||
if (res.method == "onLocationChanged") { |
|||
this.reverseGeocode(res.result.latitude, res.result.longitude) |
|||
this.reverseGeocodeV2(res.result.latitude, res.result.longitude) |
|||
} |
|||
} else { |
|||
/** |
|||
* {"result":[{"course":-1,"speed":-1,"longitude":113.2814133388547,"horizontalAccuracy":43, |
|||
* "timestamp":"2023-06-21 18:01:04","latitude":23.076741614788542,"courseAccuracy":-1, |
|||
* "ellipsoidalAltitude":1.8153233528137207,"altitude":8.372057914733887,"speedAccuracy":-1}]} |
|||
* course - 航向 位置的路线(以正北度数为单位)。如果无效,则为否定。0.0-359.9度,0为正北 |
|||
* horizontalAccuracy - 水平的准确度(负数无效) |
|||
* ellipsoidalAltitude - WGS 84参考系下位置的椭球高度 |
|||
* courseAccuracy - 航向精度(以度为单位)。如果无效,则返回负数。 |
|||
* altitude - 海拔高度 可以是正(海平面以上)或负(海平面以下) |
|||
* speed - 速度 单位为m/s。如果速度无效,则为负数。 |
|||
* speedAccuracy - 速度精度 单位为m/s。如果无效,则返回-1 |
|||
* */ |
|||
var arr = res.result; |
|||
var dic = arr[arr.length - 1]; |
|||
this.reverseGeocode(dic.latitude, dic.longitude) |
|||
} |
|||
}); |
|||
}, |
|||
stopUpdatingLocation() { |
|||
KJGNSS.stopUpdatingLocation(); |
|||
}, |
|||
reverseGeocode(latitude, longitude) { |
|||
var dic = { |
|||
"latitude": latitude, |
|||
"longitude": longitude, |
|||
"maxResults": 1 //最大返回的结果,andorid才有 |
|||
} |
|||
KJGNSS.reverseGeocode(dic, (res) => { |
|||
console.log("reverseGeocode:" + JSON.stringify(res)); |
|||
this.reverseGeocodeJson = JSON.stringify(res) |
|||
var arr = res.result; |
|||
var dic = arr[arr.length - 1]; |
|||
this.geocode(dic.adminArea + dic.locality + dic.subLocality + dic.fetFeatureName); |
|||
}); |
|||
}, |
|||
reverseGeocodeV2(latitude, longitude) { |
|||
var dic = { |
|||
"latitude": latitude, |
|||
"longitude": longitude, |
|||
} |
|||
KJGNSS.reverseGeocodeV2(dic, (res) => { |
|||
console.log("reverseGeocodeV2:" + JSON.stringify(res)); |
|||
this.reverseGeocodeV2Json = JSON.stringify(res) |
|||
}); |
|||
}, |
|||
geocode(address) { |
|||
var dic = { |
|||
"address": address, |
|||
"maxResults": 1 //最大返回的结果,andorid才有 |
|||
} |
|||
KJGNSS.geocode(dic, (res) => { |
|||
console.log("geocode:" + JSON.stringify(res)); |
|||
this.geocodeJson = JSON.stringify(res) |
|||
}); |
|||
}, |
|||
registerGnssStatus() { |
|||
KJGNSS.registerGnssStatus((res) => { |
|||
console.log("registerGnssStatus:" + JSON.stringify(res)); |
|||
//返回参数说明参考:https://www.xfqiao.com/api/android-zh/android/location/GnssStatus.html |
|||
this.registerGnssStatusJson = JSON.stringify(res) |
|||
}); |
|||
}, |
|||
unregisterGnssStatus() { |
|||
KJGNSS.unregisterGnssStatus(); |
|||
}, |
|||
registerGnssMeasurements() { |
|||
KJGNSS.registerGnssMeasurements((res) => { |
|||
console.log("registerGnssMeasurements:" + JSON.stringify(res)); |
|||
//返回参数说明参考:https://www.xfqiao.com/api/android-zh/android/location/GnssMeasurementsEvent.html |
|||
this.registerGnssMeasurementsJson = JSON.stringify(res) |
|||
}); |
|||
}, |
|||
unregisterGnssMeasurements() { |
|||
KJGNSS.unregisterGnssMeasurements(); |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
<style> |
|||
button { |
|||
font-size: 15px |
|||
} |
|||
|
|||
<style scoped lang="scss"> |
|||
|
|||
.json { |
|||
word-wrap: break-word; |
|||
} |
|||
</style> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue