Browse Source

理科教练

master
unknown 3 weeks ago
parent
commit
2ffed539e4
  1. 2
      common/js/mixins.js
  2. 107
      common/js/qqLatLng.js
  3. 15
      components/UserTab/UserTab.vue
  4. 5
      config/api.js
  5. 28
      manifest.json
  6. 9
      pages.json
  7. 6
      pages/login/login.vue
  8. 21
      pages/tabbar/mine/index.vue
  9. 83
      pages/tabbar/student/comp/subject1Student.vue
  10. 42
      pages/tabbar/student/index.vue
  11. 137
      pages/userCenter/scanCode/scanCodeSubjiect1.vue
  12. 2
      pages/userCenter/schoolSite/schoolSite.vue
  13. 183
      store/modules/user.js

2
common/js/mixins.js

@ -11,7 +11,7 @@ export default {
vuex_coachId: state=>state.user.vuex_userInfo.coachId||'',
vuex_schoolId: state=>state.user.vuex_userInfo.schoolId||'',
vuex_loginInfo: state=>state.user.vuex_loginInfo,
vuex_cityInfo: state=> state.user.vuex_cityInfo,
}),
},
data() {

107
common/js/qqLatLng.js

@ -0,0 +1,107 @@
var KJTencentLocation = uni.requireNativePlugin("KJ-TencentLocation");
var kic = {
"apiKey": "JTOBZ-KLLKQ-S325W-25JZC-JLHEV-WNF5J", //ios才有效,andorid的在App原生插件配置里设置BPMBZ-VSKE3-MC23F-O3KZO-AZGI7-PXFJI
"deviceID": "oaid" //andorid必须设置,默认使用oaid,ios无需设置
}
// 获取系统信息
const systemInfo = uni.getSystemInfoSync();
if (systemInfo.platform === 'ios') { // 如果是 iOS 平台
KJTencentLocation.setUserAgreePrivacy({"isAgree": true});
KJTencentLocation.getLocationAuthorizationStatus((res) => {
console.log("getLocationAuthorizationStatus:" + JSON.stringify(res));
/**
* status - 权限状态 0-还没决定 1-受限制 2-拒绝 345-已授权
* */
});
KJTencentLocation.requestLocationAuthorization((res) => {
console.log("requestLocationAuthorization:" + JSON.stringify(res));
/**
* status - 权限状态 0-还没决定 1-受限制 2-拒绝 345-已授权
* */
});
delete kic.deviceID
}
KJTencentLocation.init(kic);
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 //是否允许开启反作弊检查
}
KJTencentLocation.setLocationManagerInfo(dic)
export function requestSingleFreshLocation() {
return new Promise((resolve, reject) => {
console.log(KJTencentLocation.requestSingleFreshLocation)
KJTencentLocation.requestSingleFreshLocation((res) => {
console.log(res)
if (systemInfo.platform === 'ios') { // 如果是 iOS 平台
if (res.location.fakeCode != 0) {
uni.$u.toast('请关闭虚拟定位')
let obj = {
location: {
latitude: '',
longitude: '',
city: '虚拟定位'
}
}
resolve(obj)
}
}
// if(res.location.latitude==0) {
// uni.showModal({
// title: 'app想要获取您的定位权限',
// content: '为了能够获取精确的数据,请去手机设置里手动开启app定位权限',
// showCancel: false,
// confirmText: '知道了,关闭弹窗',
// success: function (res) {
// if (res.confirm) {
// console.log('用户点击确定');
// } else if (res.cancel) {
// console.log('用户点击取消');
// }
// }
// });
// }
resolve(res)
});
})
}

15
components/UserTab/UserTab.vue

@ -92,6 +92,21 @@
"selectedIconPath": require("../../static/images/tabbar/wdActive.png")
}
]
}else if(this.identity=='理论教练') {
this.list = [
{
"pagePath": "/pages/tabbar/student/index",
"text": "学员",
"iconPath": require("../../static/images/tabbar/xy.png"),
"selectedIconPath": require("../../static/images/tabbar/xyActive.png")
},
{
"pagePath": "/pages/tabbar/mine/index",
"text": "我的",
"iconPath": require("../../static/images/tabbar/wd.png"),
"selectedIconPath": require("../../static/images/tabbar/wdActive.png")
}
]
}
}
}

5
config/api.js
File diff suppressed because it is too large
View File

28
manifest.json

@ -1,6 +1,6 @@
{
"name" : "洛阳学车驾校版",
"appid" : "__UNI__BD23957",
"appid" : "__UNI__3347C6E",
"description" : "",
"versionName" : "1.1.0",
"versionCode" : 110,
@ -86,6 +86,29 @@
"splashscreen" : {
"useOriginalMsgbox" : true
}
},
"nativePlugins" : {
"KJ-TencentLocation" : {
"andorid_key" : "JTOBZ-KLLKQ-S325W-25JZC-JLHEV-WNF5J",
"__plugin_info__" : {
"name" : "腾讯定位、定位反作弊、伪定位、后台定位、单次或持续定位、场景定位(双端)",
"description" : "支持获取oaid、腾讯定位、定位反作弊、伪定位、后台定位、单次或持续定位、场景定位、请试用合适再购买、请试用合适再购买、请试用合适再购买",
"platforms" : "Android,iOS",
"url" : "https://ext.dcloud.net.cn/plugin?id=12983",
"android_package_name" : "",
"ios_bundle_id" : "",
"isCloud" : true,
"bought" : 1,
"pid" : "12983",
"parameters" : {
"andorid_key" : {
"des" : "配置andoridApiKey,ios的在init方法里设置apiKey",
"key" : "TencentMapSDK",
"value" : ""
}
}
}
}
}
},
/* */
@ -125,7 +148,8 @@
"proxy" : {
"/api" : {
// "target" : "http://123.6.232.1:8099/",
"target" : "http://www.lyjppt.com/",
"target" : "http://192.168.1.106:8318",
// "target" : "http://www.lyjppt.com/",
"changeOrigin" : true,
"secure" : true,
"pathRewrite" : {

9
pages.json

@ -278,6 +278,15 @@
}
},
{
"path": "scanCode/scanCodeSubjiect1",
"style": {
"navigationBarTitleText": "扫码二维码",
"navigationStyle": "custom",
"enablePullDownRefresh": false,
"backgroundTextStyle": "dark"
}
},
{
"path": "scanCode/scanCodeSchool",
"style": {
"navigationBarTitleText": "驾校二维码",

6
pages/login/login.vue

@ -122,6 +122,12 @@
const {data: res} = await coachSmsLogin(obj)
this.$store.commit('update_vuex_loginInfo',res)
await this.$store.dispatch('getUserInfo')
res.userType = 2
if(res.userType==2) this.$store.commit('upDateIdentity', '理论教练')
uni.switchTab({
url: '/pages/tabbar/student/index'
})
return
if(res.userType==5) {
this.showRole = true
}else {

21
pages/tabbar/mine/index.vue

@ -17,7 +17,11 @@
<user-info/>
</view>
<view class="card" style="padding: 35rpx 0 0 0;">
<!-- <view class="" @click="$store.dispatch('getCity')">
我的位置{{vuex_cityInfo.city}}
</view> -->
<view class="card" style="padding: 35rpx 0 0 0;" v-if="tabData.length">
<view class="ul">
<view class="li" v-for="(item,index) in tabData" :key="index" @click="goPage(item)">
<view class="icon">
@ -45,8 +49,12 @@
}
},
onLoad() {
// this.$store.dispatch('refreshToken')
this.initMenu()
function testFn({a,b, ...c}) {
console.log(a,b,c)
}
testFn({a: '11', b: 'cc',d: '1',f: '66'})
},
onShow() {
uni.hideTabBar();
@ -68,6 +76,8 @@
this.$goPage('/pages/userCenter/scanCode/scanCodeSchool')
}else if(this.identity=='实操教练') {
this.$goPage('/pages/userCenter/scanCode/scanCode')
}else if(this.identity=='理论教练') {
this.$goPage('/pages/userCenter/scanCode/scanCodeSubjiect1')
}
},
initMenu() {
@ -92,11 +102,8 @@
{text: '学员退款', icon: require('../../../static/images/coach/ic_tuikuan.png'), id: 7, url: '/pages/userCenter/refund/refund'},
]
}else if(this.identity=='考场模拟教练') {
this.tabData = [
{text: '我的车辆', icon: require('../../../static/images/coach/ic_cheliang.png'), id: 3, url: '/pages/userCenter/myCar/myCar'},
{text: '学员评价', icon: require('../../../static/images/coach/ic_pingjia.png'), id: 5, url: '/pages/userCenter/studentComment/studentComment'},
]
}else if(this.identity=='理论教练') {
this.tabData = []
}else if(this.identity=='模拟器老师') {
this.tabData = [
{text: '学员评价', icon: require('../../../static/images/coach/ic_pingjia.png'), id: 5, url: '/pages/userCenter/studentComment/studentComment'},

83
pages/tabbar/student/comp/subject1Student.vue

@ -0,0 +1,83 @@
<template>
<view class="subject1">
<view class="name">张小雨 <text>18267103167</text></view>
<view class="row">
<view class="timeItem">
<view class="flex ">
<view class="time">120</view>
<view class="uni">分钟</view>
</view>
<view class="lab">已完成学时</view>
</view>
<view class="timeItem">
<view class="flex ">
<view class="time ">120</view>
<view class="uni">分钟</view>
</view>
<view class="lab">应完成学时</view>
</view>
</view>
</view>
</template>
<script>
</script>
<style lang="scss" scoped>
.subject1 {
border-top: 1rpx solid #EDEDED;
background-color: #fff;
border-radius: 20rpx;
padding: 30rpx;
}
.name {
font-size: 30rpx;
font-weight: 600;
color: #333;
margin-bottom: 24rpx;
text {
margin-left: 20rpx;
}
}
.row {
display: flex;
&:first-child {
border: none;
}
.timeItem {
border-left: 1px solid #EDEDED;
flex: 1;
align-items: center;
justify-content: center;
color: #999;
font-size: 24rpx;
padding: 20rpx 0;
&:first-child {
border: none;
}
.flex {
justify-content: center;
.time {
font-size: 36rpx;
color: #333;
font-weight: 700;
}
.uni {
margin-top: -6rpx;
margin-left: 4rpx;
}
}
.lab {
text-align: center;
}
}
}
</style>

42
pages/tabbar/student/index.vue

@ -35,7 +35,10 @@
<searchRow placeholder="搜索学员姓名、学员手机号" @searchFn="searchFn"></searchRow>
</view>
<!-- <topUserInfo v-if="identity=='实操教练'"/> -->
<!-- 非科目一学员 -->
<subject1Student v-if="identity=='理论教练'"/>
<view class="" v-else>
<view class="card ">
<view class="h2" v-if="identity=='实操教练'">我的学员</view>
<view class="statistics">
@ -80,11 +83,13 @@
<view class="list">
<view class="card" @click="$goPage('/pages/recordEntry/student/studentDetail/studentDetail?id='+item.id)" v-for="(item,index) in list" :key="index">
<appointItem-student :item="item"/>
<!-- <appointItem-student :item="item"/> -->
</view>
</view>
</view>
<nodata v-if="!list.length&&status=='nomore'"></nodata>
<UserTab name ='学员'></UserTab>
<!-- <u-datetime-picker
@ -112,10 +117,11 @@
<script>
import { imgUrl } from '@/config/site.config'
import { studentRecordPage, schoolClass, studentOwner, needSign } from '@/config/api.js'
import { studentRecordPage, schoolClass, studentOwner, needSign, studentClassHour } from '@/config/api.js'
// import topUserInfo from '../statistics/comp/topUserInfo.vue'
import subject1Student from './comp/subject1Student'
export default {
// components: { topUserInfo },
components: { subject1Student },
data() {
return {
imgUrl: imgUrl+'indexTopBanner.png',
@ -148,13 +154,15 @@
total: 20,
list: [],
count: {},
status: 'loading'
status: 'loading',
}
},
onShow() {
uni.hideTabBar();
if(!this.$store.state.user.vuex_loginInfo.accessToken) return
this.studentOwnerFn()
if(this.identity!='理论教练') {
this.studentOwnerFn()
}
},
onLoad() {
this.params.schoolId = this.vuex_schoolId
@ -164,13 +172,20 @@
this.minDate = parseInt( nowTime - oneMonthMilliseconds )
this.maxDate = parseInt( nowTime + oneMonthMilliseconds )
if(!this.$store.state.user.vuex_loginInfo.accessToken) return
this.studentRecordPageFn()
this.schoolClass()
this.needSignFn()
if(this.identity=='理论教练') {
this.studentRecordPageFn()
}else {
this.studentRecordPageFn()
this.schoolClass()
this.needSignFn()
}
},
onPullDownRefresh() {
this.studentRecordPageFn()
this.studentOwnerFn()
if(this.identity!='理论教练') {
this.studentRecordPageFn()
this.studentOwnerFn()
}
this.listInit()
},
methods: {
@ -245,7 +260,12 @@
if(this.params[key]) obj[key] = this.params[key]
}
// if(obj.applyDateTime) obj.applyDateTime = obj.applyDateTime + ' 00:00:00'
const {data: res} = await studentRecordPage(obj)
let apiList = studentRecordPage
if(this.identity=='理论教练') {
apiList = studentClassHour
obj.coachId = this.vuex_userInfo.coachId
}
const {data: res} = await apiList(obj)
this.params.pageNo ++
this.list.push(...res.list)
this.total = res.total

137
pages/userCenter/scanCode/scanCodeSubjiect1.vue

@ -0,0 +1,137 @@
<template>
<view class="pageBgImg">
<topNavbar title="个人二维码"></topNavbar>
<view class="pad">
<view class="tabs">
<view class="tab" v-for="(item,index) in tabArr" :key="index" :class="{active: currentType==item.id}"
@click="changeTab(item)">{{ item.text }}</view>
</view>
<view class="card">
<view class="refresh_row" @click="refresh">
<view class="text">刷新二维码</view>
<view class="icon">
<image src="@/static/images/index/ic_shuaxin.png" mode=""></image>
</view>
</view>
<view class="qcode">
<image :src="ossUrl" mode="widthFix" style="width: 500rpx;height: 500rpx;" v-if="ossUrl"></image>
<view class="txt" v-else>正在加载~</view>
</view>
</view>
<!-- <view class="card">
<user-info/>
</view> -->
</view>
</view>
</template>
<script>
import { getQR } from '@/config/api.js'
export default {
data() {
return {
timer: null,
ossUrl: '',
currentType: 4,
tabArr: [
{text: '签到码', id: 4},
{text: '签退码', id: 5},
]
}
},
onShow() {
this.refresh()
// this.test()
},
onLoad() {
this.$store.dispatch('getCity')
},
onPullDownRefresh() {
this.refresh()
},
onHide() {
console.log('清除了')
clearTimeout(this.timer)
this.timer = null
},
beforeDestroy() {
clearTimeout(this.timer)
this.timer = null
// this.refresh = null
},
methods: {
changeTab(item) {
if(item.id==this.currentType) return
this.currentType = item.id
this.refresh()
},
async refresh() {
this.ossUrl = ''
if(!this.vuex_cityInfo.lng) return this.$u.toast('没有获取到您的定位信息')
const {data: res} = await getQR({type: this.currentType, lng: this.vuex_cityInfo.lng, lat: this.vuex_cityInfo.lat})
// const {data: res} = await getQR({type: this.currentType, lng: '120.214842', lat: '30.342599'})
this.ossUrl = res.ossUrl
clearTimeout(this.timer)
if(this.currentType!=1) {
this.timer = setTimeout(()=>{
console.log('刷新了')
this.refresh()
},1000*20)
}
}
}
}
</script>
<style lang="scss" scoped>
.qcode {
width: 100%;
display: flex;
align-items: center;
justify-content: center;
padding: 20rpx 0;
height: 500rpx;
}
.card {
padding: 28rpx;
margin-bottom: 24rpx;
}
.refresh_row {
display: flex;
justify-content: flex-end;
align-items: center;
padding: 10rpx 0;
.text {
color: $themC;
font-size: 28rpx;
}
.icon {
width: 24rpx;
height: 24rpx;
margin-left: 6rpx;
}
}
.tabs {
height: 72rpx;
background: #FFFFFF;
border-radius: 16rpx;
display: flex;
line-height: 72rpx;
text-align: center;
color: #ADADAD;
margin: 24rpx 0;
.tab {
flex: 1;
text-align: center;
&.active {
background: rgba(25, 137, 250, 0.1);
border: 2rpx solid #1989FA;
color: $themC;
border-radius: 16rpx;
}
}
}
</style>

2
pages/userCenter/schoolSite/schoolSite.vue

@ -20,7 +20,7 @@
<view class="ads">{{item.address}}</view>
</view>
<view class="status_row">
使用状态<text v-if="item.siteStatus==1">正常</text> <text v-if="item.siteStatus==0" class="orange">停用</text>
使用状态<text v-if="item.siteStatus==0">正常</text> <text v-if="item.siteStatus==1" class="orange">停用</text>
</view>
</view>
</view>

183
store/modules/user.js

@ -1,10 +1,9 @@
import addApi from '../../common/sdk/qqmap-wx-jssdk.min.js'; // 引入
const user = {
state: {
identity: uni.getStorageSync('identity')?uni.getStorageSync('identity'):'实操教练',
vuex_cityInfo: uni.getStorageSync('vuex_cityInfo') ? uni.getStorageSync('vuex_cityInfo') : {city: '杭州市'},
identity: uni.getStorageSync('identity')?uni.getStorageSync('identity'):'理论教练',
vuex_cityInfo: uni.getStorageSync('vuex_cityInfo') ? uni.getStorageSync('vuex_cityInfo') : {city: ''},
vuex_userInfo: uni.getStorageSync('vuex_userInfo') ? uni.getStorageSync('vuex_userInfo') : {user:{}},
vuex_loginInfo: uni.getStorageSync('vuex_loginInfo') ? uni.getStorageSync('vuex_loginInfo') : {},
vuex_TenantId: uni.getStorageSync('vuex_TenantId') ? uni.getStorageSync('vuex_TenantId') : '',
@ -94,33 +93,22 @@ const user = {
},
getCity({commit}) {
return new Promise((resolve, reject) => {
// #ifdef APP-PLUS||H5
// #ifdef APP-PLUS
getCityInfo(resolve, reject,commit)
// #endif
// #ifdef MP-WEIXIN
uni.authorize({
scope: 'scope.userLocation',
success() {
getCityInfo(resolve, reject,commit)
},
fail: function(res4) {
uni.showModal({
title: '提示',
content: '小程序想要获取您的地里位置',
success: function(res) {
if (res.confirm) {
uni.openSetting({
success(res) {
getCityInfo(resolve, reject,commit)
}
});
} else if (res.cancel) {
console.log('用户点击取消');
}
}
})
},
})
// #ifdef H5
console.log('h5经纬度的代码')
uni.getLocation({
type: 'wgs84',
// type: 'gcj02',
success: function(res) {
console.log('当前位置的经度:' + res.longitude);
// console.log('当前位置的纬度:' + res);
gaoDeFn(res.longitude,res.latitude, commit, resolve, reject,);
}
})
// #endif
})
},
@ -128,51 +116,110 @@ const user = {
}
function getCityInfo(resolve, reject, commit) {
uni.showLoading({
title: '加载中...'
})
var qqmapKey = new qqmapWx({
key: '2BTBZ-6BQRB-ZG4UG-NOYYG-KZMH7-B4BYN'
})
uni.getLocation({
type: 'wgs84',
// type: 'gcj02',
success: function(res) {
console.log('当前位置的经度:' + res.longitude);
console.log('当前位置的纬度:' + res.latitude);
qqmapKey.reverseGeocoder({
location: {
latitude: res.latitude,
longitude: res.longitude
},
success(res2) {
// console.log('城市信息')
// console.log(res2.result)
let result = res2.result
let obj = {
latitude: res.latitude,
longitude: res.longitude,
city: result.address_component.city,
cityCode: result.ad_info.adcode,
province: result.address_component.province,
district: result.address_component.district
// import { requestSingleFreshLocation } from '@/common/js/qqLatLng.js'
let qqLatLng = require('@/common/js/qqLatLng.js')
try{
uni.showLoading({
title: '正在更新位置...'
})
qqLatLng.requestSingleFreshLocation().then(res=>{
let result = res.location
if(result.latitude===0) {
console.log('gogogo来了吗没有获取到经纬度?')
// openGps()
uni.getLocation({
// type: 'wgs84',
type: 'gcj02',
success: function(res) {
console.log('只为弹出权限当前位置的经度:' + res.longitude);
// console.log('当前位置的纬度:' + res);
getCityInfo(resolve, reject, commit)
uni.hideLoading()
},
fail() {
uni.showToast({
title: '您的定位权限已关闭,请手动开启定位权限',
icon: 'none'
})
uni.hideLoading()
}
commit('update_vuex_cityInfo', obj)
resolve(obj)
uni.hideLoading();
})
}else {
console.log('腾讯云经纬度')
console.log(result)
let obj = {
lat: result.latitude,
lng: result.longitude,
city: result.city,
// cityCode: result.code||result.cityCode,
province: result.province,
district: result.district,
}
commit('update_vuex_cityInfo', obj)
resolve(obj)
uni.hideLoading()
}
})
}catch(e){
console.log('来到这是里了吗?腾讯云经纬度了')
uni.hideLoading()
uni.getLocation({
// type: 'wgs84',
type: 'gcj02',
success: function(res) {
console.log('当前位置的经度:' + res.longitude);
// console.log('当前位置的纬度:' + res);
gaoDeFn(res.longitude,res.latitude, commit, resolve, reject,);
},
fail(e) {
console.log(e)
uni.hideLoading()
}
})
}
}
},
fail: function(res3) {
reject(res3)
uni.hideLoading();
},
})
},
fail(e) {
console.log(e)
// h5高德地图
function gaoDeFn(longitude,latitude,commit,resolve, reject,) {
uni.showLoading({
title: '正在更新位置...'
})
uni.request({
method: 'GET',
url: 'https://restapi.amap.com/v3/geocode/regeo?parameters',
data: {
key: 'a0dde4c05390e689ea2c19d8ec447f62',
location: `${longitude},${latitude}`,
output: 'JSON'
},
success: (res) => {
console.log(res) // 数据结构见下方
let result = res.data.regeocode.addressComponent
let obj = {
lat: latitude,
lng: longitude,
city: result.city,
cityCode: result.adcode,
province: result.province,
district: result.district
}
commit('update_vuex_cityInfo', obj)
console.log('h5获得的最终位置对象')
console.log(obj)
resolve(obj)
uni.hideLoading()
},
fail: res => {
reject(new Error('获取地理位置信息失败'))
uni.hideLoading()
}
})
}
export default user

Loading…
Cancel
Save