diff --git a/common/js/mixins.js b/common/js/mixins.js
index d270d6b..af031e0 100644
--- a/common/js/mixins.js
+++ b/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() {
diff --git a/common/js/qqLatLng.js b/common/js/qqLatLng.js
new file mode 100644
index 0000000..5bf0930
--- /dev/null
+++ b/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-拒绝 3、4、5-已授权
+ * */
+ });
+ KJTencentLocation.requestLocationAuthorization((res) => {
+ console.log("requestLocationAuthorization:" + JSON.stringify(res));
+ /**
+ * status - 权限状态 0-还没决定 1-受限制 2-拒绝 3、4、5-已授权
+ * */
+ });
+ 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)
+ });
+ })
+}
+
diff --git a/components/UserTab/UserTab.vue b/components/UserTab/UserTab.vue
index 867f822..d4d5a25 100644
--- a/components/UserTab/UserTab.vue
+++ b/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")
+ }
+ ]
}
}
}
diff --git a/config/api.js b/config/api.js
index 28fcb03..e6a44b1 100644
--- a/config/api.js
+++ b/config/api.js
@@ -1,4 +1,7 @@
-
var http = uni.$u.http
// 隐私政策
export const getAgreement = (params, config = {}) => http.get('app/student-record/getAgreement', {params}, config)
// 验证码登录
export const loginPwd = (data) => http.post('system/auth/login', data, { custom: { noToken: true , 'Tenant-Id': data['Tenant-Id']}})
// 获取个人信息
export const getUserInfo = (data) => http.post('member/user/get', {header: {'contentType': 1}})
// 退出登录
export const logOut = (data={}) => http.post('member/auth/logout', data, { custom: { noToken: true }})
// 驾校列表分页
export const schoolPage = (params) => http.get('business/school/page', {params: params})
// 获得租户分页
export const tenantPage = (params) => http.get('system/tenant/pages', {params: params, custom: { noToken: true }})
// 实操预约记录分页
export const bookingMasterPage = (params) => http.get('business/booking/master/pageadmin', {params: params, header: {'contentType': 3} })
// 实操预约详情
export const bookingMasterDetail = (params) => http.get('business/booking/master/getadmin', {params: params, header: {'contentType': 3} })
// 获得我的排课详情
export const scheduleClassGetById = (params) => http.get('business/booking/schedule-class/getById', {params: params, })
// 获得我的排课详情预约记录
export const getBookingDetailByClassId = (params) => http.get('business/booking/master/getBookingDetailByClassId', {params: params, })
// 获得排课
export const scheduleClassGet = (params) => http.get('business/booking/schedule-class/getadmin', {params: params, })
// 发布排课计划
export const scheduleClassCreate = (data) => http.post('business/booking/schedule-class/create', data)
// 根据时间段发布排课计划
export const scheduleClassCreateByTime = (data) => http.post('business/booking/schedule-class/createByTime', data)
// 获取排课日期范围
export const getClassDateLimit = (params) => http.get('business/booking/global-config/getClassDateLimitadmin', {params} ,)
// 获取排课时间段范围
export const getClassTimeLimt = (params) => http.get('business/booking/global-config/getClassTimeLimt', {params} ,)
// 创建排课模板
export const getClassCreate = (data) => http.post('business/booking/schedule-template/create', data ,)
// 排课模板分页
export const scheduleTemplatePage = (params) => http.get('business/booking/schedule-template/page', {params} ,)
// 更新排课模版
export const scheduleTemplateUpdate = (data) => http.put('business/booking/schedule-template/update', data ,)
// 获取排课模版
export const scheduleTemplateGet = (params) => http.get('business/booking/schedule-template/get', {params} ,)
// 训练场地
export const trainingSiteList = (params) => http.get('business/training-site/list', {params} ,)
// 获得考场模拟预约记录分页
export const examSimulationPages = (params) => http.get('business/exam-simulation-record/pageadmin', {params} ,)
// 已报名学员
export const studentRecordPage = (params) => http.get('app/student-record/page', {params} ,)
// 驾校班型
export const schoolClass = (params) => http.get('business/school-class/getSchoolByClass', {params} ,)
// 获得学员档案记录
export const studentDetail = (params) => http.get('business/coach/getStudent', {params} ,)
// 获得教练车信息分页
export const carPage = (params) => http.get('business/car/page', {params} ,)
// 驾校场地分页
export const sitePage = (params) => http.get('business/training-site/page', {params} ,)
// 驾校教练分页
export const coachPage = (params) => http.get('business/coach/pageadmin', {params})
// 驾校教练详情
export const coachDetail = (params) => http.get('business/coach/getadmin', {params})
// 教练评价列表分页
export const coachCommentPage = (params) => http.get('business/appcomplain/pageCoachComment', {params})
// 获得教练员评价条数
export const pageCoachCommentTotal = (params) => http.get('business/appcomplain/pageCoachCommentTotal', {params})
// 获得驾校评价
export const schoolCommentPage = (params) => http.get('business/school-comment/page', {params})
// 获取驾校评价条数
export const commentPagetotal = (params) => http.get('business/school-comment/pagetotal', { params })
// 修改用户密码
export const updatePassword = (data) => http.put('system/user/profile/update-password', data)
// 获得考场分页
export const simulationPage = (params) => http.get('business/booking/simulation-record/pageadmin', {params})
// 获得考场列分页
export const businessSitePage = (params) => http.get('business/site/page', {params})
// 教练绑定教练车
export const coachBinding = (data) => http.post('business/coach/binding', data)
// 取消绑定教练车
export const coachUnbinding = (data) => http.put('business/coach/unbinding', data)
// 获得考场车辆管理分页
export const siteCarPage = (params) => http.get('business/site-car/page', {params})
// 我的学员(累计学员、今日新增学员、等)
export const studentOwner = (params) => http.get('app/student-record/owner', {params})
// 获得学员档案记录列表
export const studentList = (params) => http.get('app/student-record/pageadmin', {params})
// 绑定教练
export const studentBindCoach = (data) => http.post('app/student-record/bindCoach', data)
// 教练二维码生成
export const getQR = (data) => http.post('business/coach/sign/getQR', data)
// 获取学习中的学员
export const signStudentList = (data) => http.post('business/coach/sign/studentList', data)
// 切换学员计时
export const changeStudent = (data) => http.post('business/coach/sign/changeStudent', data)
// 发送验证码
export const getLoginCode = (data) => http.post('member/auth/send-sms-code', data, { custom: { noToken: true, catch: true,}})
// 驾校教练使用手机 + 验证码登录
export const coachSmsLogin = (data) => http.post('member/auth/coach_sms-login', data, { custom: { noToken: true, catch: true,}})
+
var http = uni.$u.http
// 隐私政策
export const getAgreement = (params, config = {}) => http.get('app/student-record/getAgreement', {params}, config)
// 验证码登录
export const loginPwd = (data) => http.post('system/auth/login', data, { custom: { noToken: true , 'Tenant-Id': data['Tenant-Id']}})
// 获取个人信息
export const getUserInfo = (data) => http.post('member/user/get', {header: {'contentType': 1}})
// 退出登录
export const logOut = (data={}) => http.post('member/auth/logout', data, { custom: { noToken: true }})
// 驾校列表分页
export const schoolPage = (params) => http.get('business/school/page', {params: params})
// 获得租户分页
export const tenantPage = (params) => http.get('system/tenant/pages', {params: params, custom: { noToken: true }})
// 实操预约记录分页
export const bookingMasterPage = (params) => http.get('business/booking/master/pageadmin', {params: params, header: {'contentType': 3} })
// 实操预约详情
export const bookingMasterDetail = (params) => http.get('business/booking/master/getadmin', {params: params, header: {'contentType': 3} })
// 获得我的排课详情
export const scheduleClassGetById = (params) => http.get('business/booking/schedule-class/getById', {params: params, })
// 获得我的排课详情预约记录
export const getBookingDetailByClassId = (params) => http.get('business/booking/master/getBookingDetailByClassId', {params: params, })
// 获得排课
export const scheduleClassGet = (params) => http.get('business/booking/schedule-class/getadmin', {params: params, })
// 发布排课计划
export const scheduleClassCreate = (data) => http.post('business/booking/schedule-class/create', data)
// 根据时间段发布排课计划
export const scheduleClassCreateByTime = (data) => http.post('business/booking/schedule-class/createByTime', data)
// 获取排课日期范围
export const getClassDateLimit = (params) => http.get('business/booking/global-config/getClassDateLimitadmin', {params} ,)
// 获取排课时间段范围
export const getClassTimeLimt = (params) => http.get('business/booking/global-config/getClassTimeLimt', {params} ,)
// 创建排课模板
export const getClassCreate = (data) => http.post('business/booking/schedule-template/create', data ,)
// 排课模板分页
export const scheduleTemplatePage = (params) => http.get('business/booking/schedule-template/page', {params} ,)
// 更新排课模版
export const scheduleTemplateUpdate = (data) => http.put('business/booking/schedule-template/update', data ,)
// 获取排课模版
export const scheduleTemplateGet = (params) => http.get('business/booking/schedule-template/get', {params} ,)
// 训练场地
export const trainingSiteList = (params) => http.get('business/training-site/list', {params} ,)
// 获得考场模拟预约记录分页
export const examSimulationPages = (params) => http.get('business/exam-simulation-record/pageadmin', {params} ,)
// 已报名学员
export const studentRecordPage = (params) => http.get('app/student-record/page', {params} ,)
// 驾校班型
export const schoolClass = (params) => http.get('business/school-class/getSchoolByClass', {params} ,)
// 获得学员档案记录
export const studentDetail = (params) => http.get('business/coach/getStudent', {params} ,)
// 获得教练车信息分页
export const carPage = (params) => http.get('business/car/page', {params} ,)
// 驾校场地分页
export const sitePage = (params) => http.get('business/training-site/page', {params} ,)
// 驾校教练分页
export const coachPage = (params) => http.get('business/coach/pageadmin', {params})
// 驾校教练详情
export const coachDetail = (params) => http.get('business/coach/getadmin', {params})
// 教练评价列表分页
export const coachCommentPage = (params) => http.get('business/appcomplain/pageCoachComment', {params})
// 获得教练员评价条数
export const pageCoachCommentTotal = (params) => http.get('business/appcomplain/pageCoachCommentTotal', {params})
// 获得驾校评价
export const schoolCommentPage = (params) => http.get('business/school-comment/page', {params})
// 获取驾校评价条数
export const commentPagetotal = (params) => http.get('business/school-comment/pagetotal', { params })
// 修改用户密码
export const updatePassword = (data) => http.put('system/user/profile/update-password', data)
// 获得考场分页
export const simulationPage = (params) => http.get('business/booking/simulation-record/pageadmin', {params})
// 获得考场列分页
export const businessSitePage = (params) => http.get('business/site/page', {params})
// 教练绑定教练车
export const coachBinding = (data) => http.post('business/coach/binding', data)
// 取消绑定教练车
export const coachUnbinding = (data) => http.put('business/coach/unbinding', data)
// 获得考场车辆管理分页
export const siteCarPage = (params) => http.get('business/site-car/page', {params})
// 我的学员(累计学员、今日新增学员、等)
export const studentOwner = (params) => http.get('app/student-record/owner', {params})
// 获得学员档案记录列表
export const studentList = (params) => http.get('app/student-record/pageadmin', {params})
+// 科目一的学员
+export const studentClassHour = (data) => http.post('business/coach/student_class_hour', data)
+// 绑定教练
export const studentBindCoach = (data) => http.post('app/student-record/bindCoach', data)
// 教练二维码生成
export const getQR = (data) => http.post('business/coach/sign/getQR', data)
// 获取学习中的学员
export const signStudentList = (data) => http.post('business/coach/sign/studentList', data)
// 切换学员计时
export const changeStudent = (data) => http.post('business/coach/sign/changeStudent', data)
// 发送验证码
export const getLoginCode = (data) => http.post('member/auth/send-sms-code', data, { custom: { noToken: true, catch: true,}})
// 驾校教练使用手机 + 验证码登录
export const coachSmsLogin = (data) => http.post('member/auth/coach_sms-login', data, { custom: { noToken: true, catch: true,}})
// 录入签名
export const addSign = (data) => http.post('business/coach/addSign', data)
// 获得学员动态
diff --git a/manifest.json b/manifest.json
index 9457e40..809dc6d 100644
--- a/manifest.json
+++ b/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" : {
diff --git a/pages.json b/pages.json
index 8e8a0d9..fffa098 100644
--- a/pages.json
+++ b/pages.json
@@ -278,6 +278,15 @@
}
},
{
+ "path": "scanCode/scanCodeSubjiect1",
+ "style": {
+ "navigationBarTitleText": "扫码二维码",
+ "navigationStyle": "custom",
+ "enablePullDownRefresh": false,
+ "backgroundTextStyle": "dark"
+ }
+ },
+ {
"path": "scanCode/scanCodeSchool",
"style": {
"navigationBarTitleText": "驾校二维码",
diff --git a/pages/login/login.vue b/pages/login/login.vue
index fde8f84..f278e00 100644
--- a/pages/login/login.vue
+++ b/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 {
diff --git a/pages/tabbar/mine/index.vue b/pages/tabbar/mine/index.vue
index 89baed1..82d9767 100644
--- a/pages/tabbar/mine/index.vue
+++ b/pages/tabbar/mine/index.vue
@@ -17,7 +17,11 @@
-
+
+
+
@@ -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'},
diff --git a/pages/tabbar/student/comp/subject1Student.vue b/pages/tabbar/student/comp/subject1Student.vue
new file mode 100644
index 0000000..2b98eed
--- /dev/null
+++ b/pages/tabbar/student/comp/subject1Student.vue
@@ -0,0 +1,83 @@
+
+
+ 张小雨 18267103167
+
+
+
+ 120
+ 分钟
+
+ 已完成学时
+
+
+
+ 120
+ 分钟
+
+ 应完成学时
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/tabbar/student/index.vue b/pages/tabbar/student/index.vue
index be0fb20..b27645b 100644
--- a/pages/tabbar/student/index.vue
+++ b/pages/tabbar/student/index.vue
@@ -35,7 +35,10 @@
+
+
+
我的学员
@@ -80,11 +83,13 @@
-
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/userCenter/schoolSite/schoolSite.vue b/pages/userCenter/schoolSite/schoolSite.vue
index d68c50a..c49d45a 100644
--- a/pages/userCenter/schoolSite/schoolSite.vue
+++ b/pages/userCenter/schoolSite/schoolSite.vue
@@ -20,7 +20,7 @@
{{item.address}}
- 使用状态:正常 停用
+ 使用状态:正常 停用
diff --git a/store/modules/user.js b/store/modules/user.js
index eba9579..9123442 100644
--- a/store/modules/user.js
+++ b/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