unknown
3 weeks ago
13 changed files with 549 additions and 91 deletions
-
2common/js/mixins.js
-
107common/js/qqLatLng.js
-
15components/UserTab/UserTab.vue
-
5config/api.js
-
28manifest.json
-
9pages.json
-
6pages/login/login.vue
-
21pages/tabbar/mine/index.vue
-
83pages/tabbar/student/comp/subject1Student.vue
-
30pages/tabbar/student/index.vue
-
137pages/userCenter/scanCode/scanCodeSubjiect1.vue
-
2pages/userCenter/schoolSite/schoolSite.vue
-
155store/modules/user.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) |
||||
|
}); |
||||
|
}) |
||||
|
} |
||||
|
|
5
config/api.js
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -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> |
@ -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> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue