unknown 5 months ago
parent
commit
8159a4a23e
  1. 8
      App.vue
  2. 2
      androidPrivacy.json
  3. 92
      common/js/location.js
  4. 6
      common/js/mixins.js
  5. 103
      common/js/permission.js.js
  6. 2
      config/request.js
  7. 8
      config/site.config.js
  8. 12
      manifest.json
  9. 8
      pages.json
  10. 5
      pages/indexEntry/enroll/signContract/signContract.vue
  11. 2
      pages/indexEntry/signIn/signAndOut/signAndOut.vue
  12. 16
      pages/mineEntry/personaInfo/AccountCance.vue
  13. 14
      pages/mineEntry/personaInfo/personaInfo.vue
  14. 42
      pages/tabbar/index/index.vue
  15. 34
      store/modules/user.js

8
App.vue

@ -1,7 +1,11 @@
<script>
// import location from '@/common/js/location.js'
export default {
onLaunch: function() {
this.getLocationAuthority()
// location.getLocation(()=>{
// this.$store.dispatch('getCity')
// });
// this.getLocationAuthority()
},
onShow: function() {
console.log('App Show')
@ -15,7 +19,7 @@
uni.getLocation({
type: 'wgs84',
success: function(res) {
_this.$store.dispatch('getUserInfo')
_this.$store.dispatch('getCity')
},
fail: function(err) {
console.log('为什么失败了')

2
androidPrivacy.json

@ -2,7 +2,7 @@
"version" : "1",
"prompt" : "template",
"title" : "服务协议和隐私政策",
"message" : "  请你务必审慎阅读、充分理解“服务协议”和“隐私政策”各条款,包括但不限于:为了更好的向你提供服务,我们需要收集你的设备标识、操作日志等信息用于分析、优化应用性能。<br/>  你可阅读<a href=\"\">《服务协议》</a>和<a href=\"\">《隐私政策》</a>了解详细信息。如果你同意,请点击下面按钮开始接受我们的服务。",
"message" : "  请你务必审慎阅读、充分理解“服务协议”和“隐私政策”各条款,包括但不限于:为了更好的向你提供服务,我们需要收集你的设备标识、操作日志等信息用于分析、优化应用性能。<br/>  你可阅读<a href=\"http://www.lyjppt.com/htmls/yhxy.html\">《服务协议》</a>和<a href=\"http://www.lyjppt.com/htmls/yszc.html\">《隐私政策》</a>了解详细信息。如果你同意,请点击下面按钮开始接受我们的服务。",
"buttonAccept" : "同意并接受",
"buttonRefuse" : "暂不同意",
"hrefLoader" : "system",

92
common/js/location.js

@ -0,0 +1,92 @@
import permision from '@/common/js/permission.js'
export async function getLocation(cb) {
// #ifdef APP-PLUS
let status = await checkPermission();
if (status !== 1) {
return status;
}
// #endif
uni.showModal({
content: '为了您更好的给您推荐附近的驾校数据,需要获取位置信息,app想要获取您的位权限',
confirmText: "确定",
success: function(res) {
if (res.confirm) {
doGetLocation(cb);
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
}
/**
* 获取当前位置信息
*/
export const doGetLocation = (cb) => {
uni.getLocation({
success: (res) => {
console.log('当前位置:', res.longitude, res.latitude);
if (typeof cb == 'function') cb && typeof cb == 'function' && cb(status)
},
fail: (err) => {
if (err.errMsg.indexOf("auth deny") >= 0) {
uni.showToast({
title: "访问位置被拒绝",
icon: 'none'
})
} else {
uni.showToast({
title: err.errMsg,
icon: 'none'
})
}
}
})
}
/**
* 检测定位权限
*/
async function checkPermission() {
let status = permision.isIOS ? await permision.requestIOS('location') :
await permision.requestAndroid('android.permission.ACCESS_FINE_LOCATION');
if (status === null || status === 1) {
status = 1;
} else if (status === 2) {
uni.showModal({
content: "系统定位已关闭",
showCancel: false,
success: function(res) {}
})
} else if (status.code) {
uni.showModal({
content: status.message
})
} else {
uni.showModal({
content: "为了您更好的体验App蓝牙功能,需要获取位置信息,请点击设置开启定位权限",
confirmText: "设置",
success: function(res) {
if (res.confirm) {
permision.gotoAppSetting();
}
}
})
}
return status;
}
const location = {
getLocation
}
export default location;

6
common/js/mixins.js

@ -27,9 +27,9 @@ export default {
if(token) {
this.$store.dispatch('getUserInfo')
}
if(!this.vuex_cityInfo.lat) {
this.$store.dispatch('getCity')
}
// if(!this.vuex_cityInfo.lat) {
// this.$store.dispatch('getCity')
// }
},
}

103
common/js/permission.js.js

@ -0,0 +1,103 @@
/// null = 未请求,1 = 已允许,0 = 拒绝|受限, 2 = 系统未开启
var isIOS
function location() {
var result = 0;
var cllocationManger = plus.ios.import("CLLocationManager");
var enable = cllocationManger.locationServicesEnabled();
var status = cllocationManger.authorizationStatus();
if (!enable) {
result = 2;
} else if (status === 0) {
result = null;
} else if (status === 3 || status === 4) {
result = 1;
} else {
result = 0;
}
plus.ios.deleteObject(cllocationManger);
return result;
}
function requestIOS(permissionID) {
return new Promise((resolve, reject) => {
switch (permissionID) {
case "location":
resolve(location());
break;
default:
resolve(0);
break;
}
});
}
function requestAndroid(permissionID) {
return new Promise((resolve, reject) => {
plus.android.requestPermissions(
[permissionID],
function(resultObj) {
var result = 0;
for (var i = 0; i < resultObj.granted.length; i++) {
var grantedPermission = resultObj.granted[i];
console.log('已获取的权限:');
result = 1
}
for (var i = 0; i < resultObj.deniedPresent.length; i++) {
var deniedPresentPermission = resultObj.deniedPresent[i];
console.log('拒绝本次申请的权限:');
result = 0
}
for (var i = 0; i < resultObj.deniedAlways.length; i++) {
var deniedAlwaysPermission = resultObj.deniedAlways[i];
console.log('永久拒绝申请的权限:');
result = -1
}
resolve(result);
},
function(error) {
resolve({
code: error.code,
message: error.message
});
}
);
});
}
function gotoAppPermissionSetting() {
if (permission.isIOS) {
var UIApplication = plus.ios.import("UIApplication");
var application2 = UIApplication.sharedApplication();
var NSURL2 = plus.ios.import("NSURL");
var setting2 = NSURL2.URLWithString("app-settings:");
application2.openURL(setting2);
plus.ios.deleteObject(setting2);
plus.ios.deleteObject(NSURL2);
plus.ios.deleteObject(application2);
} else {
var Intent = plus.android.importClass("android.content.Intent");
var Settings = plus.android.importClass("android.provider.Settings");
var Uri = plus.android.importClass("android.net.Uri");
var mainActivity = plus.android.runtimeMainActivity();
var intent = new Intent();
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
var uri = Uri.fromParts("package", mainActivity.getPackageName(), null);
intent.setData(uri);
mainActivity.startActivity(intent);
}
}
const permission = {
get isIOS(){
return typeof isIOS === 'boolean' ? isIOS : (isIOS = uni.getSystemInfoSync().platform === 'ios')
},
requestIOS: requestIOS,
requestAndroid: requestAndroid,
gotoAppSetting: gotoAppPermissionSetting
}
export default permission

2
config/request.js

@ -66,7 +66,7 @@ module.exports = (vm) => {
if(data.code==401) {
console.log('报401的接口')
console.log(response.config.url)
return uni.$u.debounce(vm.$store.commit('goLogin'), 800)
return uni.$u.debounce(vm.$store.commit('goLogin'), 1500)
}
// 自定义参数

8
config/site.config.js

@ -2,18 +2,18 @@ const VUE_APP_PLATFORM = process.env.VUE_APP_PLATFORM;
// localIp = false
module.exports = {
H5_API: VUE_APP_PLATFORM === 'h5' ? '/api' : '',//h5代理
WX_API: VUE_APP_PLATFORM === 'h5' ? '/' : 'http://123.6.232.54:8099/',//非代理地址 不要忘记加/
WX_API: VUE_APP_PLATFORM === 'h5' ? '/' : 'http://123.6.232.1:8099/',//非代理地址 不要忘记加/
website: 'http://192.168.1.37',
httpPrefix: 'app-api/',
imgUrl: 'https://jiangxijiakao-1.oss-cn-hangzhou.aliyuncs.com/defaultImages/app/bigImg/',
// 支付测试地址
preUrl: 'https://u8wbs.zyebank.cn/cem_ysb_u6/index.html',
// preUrl: 'https://u8wbs.zyebank.cn/cem_ysb_u6/index.html',
// const preUrl = 'https://u8wbs.zyebank.cn/cem_ysb_u8/index.html'
// 生产地址
// preUrl: 'https://zmcht.zybank.com.cn/cem_ysb/index.html',
preUrl: 'https://zmcht.zybank.com.cn/cem_ysb/index.html',
};
// http://123.6.232.54:8099/测试地址
// http://123.6.232.1:8099/测试地址
// http://192.168.1.43:8318/本地地址
//http://www.lyjppt.com/正式地址

12
manifest.json

@ -2,8 +2,8 @@
"name" : "洛阳学车",
"appid" : "__UNI__3347C6E",
"description" : "",
"versionName" : "1.3.2",
"versionCode" : 132,
"versionName" : "1.3.7",
"versionCode" : 137,
"transformPx" : false,
/* 5+App */
"app-plus" : {
@ -37,14 +37,14 @@
"<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>",
// "<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_BACKGROUND_LOCATION\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
// "<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.CALL_PHONE\"/>",
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
// "<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
"<uses-permission android:name=\"android.permission.INTERNET\"/>",
@ -227,7 +227,7 @@
"proxy" : {
"/api" : {
// "target" : "http://192.168.1.43:8318/",
"target" : "http://123.6.232.54:8099/",
"target" : "http://123.6.232.1:8099/",
"changeOrigin" : true,
"secure" : true,
"pathRewrite" : {

8
pages.json

@ -390,6 +390,14 @@
}
},
{
"path": "personaInfo/AccountCance",
"style": {
"navigationBarTitleText": "注销账户",
"enablePullDownRefresh": false,
"backgroundTextStyle": "dark"
}
},
{
"path": "myForecastName/myForecastName",
"style": {
"navigationBarTitleText": "我的报名",

5
pages/indexEntry/enroll/signContract/signContract.vue

@ -113,6 +113,11 @@
}
}else {
this.$u.toast('签约状态没返回')
setTimeout(()=>{
uni.navigateTo({
url: '/pages/mineEntry/myForecastName/myForecastName'
})
}, 2000)
}
}
}

2
pages/indexEntry/signIn/signAndOut/signAndOut.vue

@ -92,7 +92,7 @@
methods: {
//
async vailStudentInfoFn() {
// await this.$store.dispatch('getCity')
await this.$store.dispatch('getCity')
if(!this.vuex_cityInfo.lat) return
let schoolCoach = this.$store.state.school.schoolCoach
this.params = {

16
pages/mineEntry/personaInfo/AccountCance.vue

@ -0,0 +1,16 @@
<template>
<view class="main">
账号注销后无法恢复 您的账号注销后 各项信息将被清空且无法恢复请谨慎使用此功能注销申请请发送至邮箱helijun@jaxc.cn我们将在收到您的申请后尽快处理
</view>
</template>
<style scoped lang="scss">
.main {
font-size: 26rpx;
color: #333;
padding: 32rpx 32rpx;
line-height: 30px;
}
</style>

14
pages/mineEntry/personaInfo/personaInfo.vue

@ -66,6 +66,7 @@
</view>
<view class="footerBtn">
<view class="btnBg" @click="logOutFn">退出登录</view>
<view class="AccountCancellation" @click="AccountCanceFn">注销账号</view>
</view>
</view>
</template>
@ -84,6 +85,9 @@
})
},
methods: {
AccountCanceFn() {
this.$goPage('/pages/mineEntry/personaInfo/AccountCance')
},
logOutFn() {
let _this = this
uni.showModal({
@ -181,4 +185,14 @@
line-height: 72rpx;
margin: 88rpx auto;
}
.AccountCancellation {
border: 1px solid #d1d1d1;;
border-radius: 8rpx;
border-color: linear-gradient(180deg, #3593FB 0%, #53D3E5 100%);
line-height: 72rpx;
color: #999;
text-align: center;
font-size: 28rpx;
margin-top: 30rpx;
}
</style>

42
pages/tabbar/index/index.vue

@ -4,7 +4,10 @@
<view class="TopCon pad" >
<!-- 地址 -->
<view class="adrsCon">
<view class="adr">{{ vuex_cityInfo.city }} </view>
<view class="adr" v-if="vuex_cityInfo.city">{{ vuex_cityInfo.city }} </view>
<view class="adr" v-else @click="getLatLngFn" style="display: flex;align-items: center;">
<text>获取定位信息</text> <image src="@/static/images/icon/down.png" mode="" style="width: 18rpx;height: 18rpx;margin-left: 6rpx;"></image>
</view>
<!-- <view class="adrsIcon">
<image src="@/static/images/icon/down.png" mode=""></image>
</view> -->
@ -133,6 +136,7 @@
import informaItem from './comp/informaItem'
import coachItem from './comp/coachItem'
import { scanCodeFn } from '@/config/utils.js'
import location from '@/common/js/location.js'
export default {
components: { schoolItem, informaItem, coachItem },
data() {
@ -194,10 +198,24 @@
this.initApi()
},
onShow() {
if(!this.vuex_cityInfo.lat) {
this.$store.dispatch('getCity')
}
let _this = this
// if(!this.vuex_cityInfo.lat) {
// location.getLocation(()=>{
// _this.$store.dispatch('getCity')
// uni.showModal({
// content: 'app',
// confirmText: "",
// success: function(res) {
// if (res.confirm) {
// _this.$store.dispatch('getCity')
// } else if (res.cancel) {
// console.log('');
// }
// }
// });
// });
// }
let token = this.$store.state.user.vuex_loginInfo.accessToken
if(token) {
this.$store.dispatch('getUserInfo')
@ -212,6 +230,10 @@
},
methods: {
async getLatLngFn() {
await this.$store.dispatch('getCity')
this.recommendSchoolList()
},
//
bannerClick(item) {
let link = item.jumpPath
@ -237,10 +259,10 @@
},
//
async recommendSchoolList() {
if(!this.vuex_cityInfo.lat) {
await this.$store.dispatch('getCity')
}
const {data: res} = await recommendSchoolList({pageNo:1,pageSize: 3, lat: this.vuex_cityInfo.lat||'', lng: this.vuex_cityInfo.lng||''})
// if(!this.vuex_cityInfo.lat) {
// await this.$store.dispatch('getCity')
// }
const {data: res} = await recommendSchoolList({pageNo:1,pageSize: 3, lat: this.vuex_cityInfo.lat||'34.682945', lng: this.vuex_cityInfo.lng||'112.477298'})
this.recommendSchool = res
console.log(res)
},
@ -346,7 +368,7 @@
.adrsCon {
display: flex;
align-items: center;
width: 180rpx;
// width: 180rpx;
height: 88rpx;
.adrsIcon {
width: 17rpx;

34
store/modules/user.js

@ -5,6 +5,7 @@ import { requestSingleFreshLocation } from '@/common/js/qqLatLng.js'
let apiOk =true
let refreshTokenFn = null
let timer = null
const user = {
@ -41,11 +42,13 @@ const user = {
if(page!= url) {
console.log('当前页面')
console.log(page)
setTimeout(()=>{
if(timer) clearTimeout(timer)
timer = setTimeout(()=>{
uni.navigateTo({
url: url+'?redirect='+ page
})
},500)
timer = null
},1000)
}
},
@ -170,23 +173,30 @@ function gaoDeFn(longitude,latitude,commit,resolve, reject,) {
}
function getCityInfo(resolve, reject, commit) {
try{
requestSingleFreshLocation().then(res=>{
let result = res.location
if(result.latitude===0) {
console.log('gogogo来了吗?')
console.log('gogogo来了吗没有获取到经纬度?')
// openGps()
// uni.getLocation({
// // type: 'wgs84',
// type: 'gcj02',
// success: function(res) {
// console.log('只为弹出权限当前位置的经度:' + res.longitude);
// // console.log('当前位置的纬度:' + res);
// },
// })
uni.getLocation({
// type: 'wgs84',
type: 'gcj02',
success: function(res) {
console.log('只为弹出权限当前位置的经度:' + res.longitude);
// console.log('当前位置的纬度:' + res);
getCityInfo(resolve, reject, commit)
},
fail() {
uni.showToast({
title: '您的定位权限已关闭,请手动开启定位权限',
icon: 'none'
})
}
})
}else {
console.log('腾讯云经纬度')
console.log(result)

Loading…
Cancel
Save