Pārlūkot izejas kodu

h5 考勤打卡修改

黑龙江艺术高中职
yxq pirms 4 mēnešiem
vecāks
revīzija
fa95917274
4 mainītis faili ar 164 papildinājumiem un 47 dzēšanām
  1. +21
    -4
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/common/mixins.js
  2. +13
    -7
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/common/wxFn.js
  3. +65
    -18
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/AttendanceCard/list.vue
  4. +65
    -18
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/AttendanceCardTeacher/list.vue

+ 21
- 4
Learun.Framework.Ultimate V7/LearunApp-2.2.0/common/mixins.js Parādīt failu

@@ -778,10 +778,27 @@ export default {
return this.$store.state.pageParam
},
//获取百度地图ak
// //获取百度地图ak 两个ak交替使用
// GET_AK() {
// let ak = ['mI6EMQ4uCYscEQ2DbnG8nMAhsm1OUwwT','pSWqIQSAPzG5KPcq2d57zH6bYd9cZzGJ']
// let current = this.GET_STORAGE('baiduAK')
// if(!current){
// let ri = Math.floor(Math.random()*2);
// current = ak[ri]
// }else{
// if(current == ak[0]){
// current = ak[1]
// }else{
// current = ak[0]
// }
// }
// this.SET_STORAGE('baiduAK',current)
// return current
// },
//高德地图ak 两个ak交替使用
GET_AK() {
let ak = ['mI6EMQ4uCYscEQ2DbnG8nMAhsm1OUwwT','mI6EMQ4uCYscEQ2DbnG8nMAhsm1OUwwT']
let current = this.GET_STORAGE('baiduAK')
let ak = ['b07d0a74e059a6f132ede93ff3826515','b07d0a74e059a6f132ede93ff3826515']
let current = this.GET_STORAGE('gaodeAK')
if(!current){
let ri = Math.floor(Math.random()*2);
current = ak[ri]
@@ -792,7 +809,7 @@ export default {
current = ak[0]
}
}
this.SET_STORAGE('baiduAK',current)
this.SET_STORAGE('gaodeAK',current)
return current
}
},


+ 13
- 7
Learun.Framework.Ultimate V7/LearunApp-2.2.0/common/wxFn.js Parādīt failu

@@ -2,6 +2,7 @@ window.wx = null
window.wxInit = false
import wx from '@/common/js/weixin-js-sdk.js';
window.wx = wx
window.wxInitTimer = null
// 参考文档 https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/JS-SDK.html
export default {
methods: {
@@ -14,6 +15,11 @@ export default {
.getItem('scanUrl')
this.HTTP_GET("weixinapi/getweixinwebaccess_token?url=" + encodeURIComponent(url)).then((
success) => {
wxInitTimer&&clearTimeout(wxInitTimer)
// 7200秒微信success_token过期
wxInitTimer = setTimeout(()=>{
window.wxInit = false
},7100000)
if (!success) {
resolve(false)
return
@@ -31,10 +37,10 @@ export default {
// wx.config({
// debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
// appId: 'wx2aa8dcf3603f77b5', // 必填,公众号的唯一标识
// timestamp: '1719897639109', // 必填,生成签名的时间戳
// nonceStr: "202407011704072775", // 必填,生成签名的随机串
// signature: "af7666f9ed1355756b80561cf7b358fb603f7963", // 必填,签名
// jsApiList: arr // 必填,需要使用的JS接口列表
// timestamp: '1720409094676', // 必填,生成签名的时间戳
// nonceStr: "202407012704072781", // 必填,生成签名的随机串
// signature: "c3b31f8ab918d0a6259b47761b64ad025d48cc4b", // 必填,签名
// jsApiList: ['getLocation','chooseImage','previewImage'] // 必填,需要使用的JS接口列表
// });
wx.ready(() => {
window.wxInit = true
@@ -56,7 +62,7 @@ export default {
async getLocation() {
return new Promise(async (resolve) => {
if (!window.wxInit) {
let res = await this.initWx(["getLocation"])
let res = await this.initWx()
if(!res||res=='wx初始化超时'){
res&&this.TOAST(res)
resolve(false)
@@ -92,7 +98,7 @@ export default {
async chooseImage() {
return new Promise(async (resolve) => {
if (!window.wxInit) {
let res = await this.initWx(["chooseImage"])
let res = await this.initWx()
if(!res){
resolve(false)
return
@@ -121,7 +127,7 @@ export default {
async previewImage(url,urlArr) {
return new Promise(async (resolve) => {
if (!window.wxInit) {
let res = await this.initWx(["previewImage"])
let res = await this.initWx()
if(!res){
resolve(false)
return


+ 65
- 18
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/AttendanceCard/list.vue Parādīt failu

@@ -91,17 +91,24 @@
ready: false,
timer: '',
timer1:'',
timer2:'',
map: null,
postData: {},
isGetingLocal:false,
// modal:false,
isInternalNet:false,
baiduAK:'',
mapAk:'',
}
},

async onLoad() {
this.timer2 = setTimeout(()=>{
this.TOAST('打卡超时!请重新进入页面')
setTimeout(()=>{
this.TAB_TO('/pages/home')
},1000)
},60000)
await this.init()
},

@@ -109,9 +116,10 @@
// 页面初始化
async init() {
// 获取随机ak
this.baiduAK = this.GET_AK()
this.mapAk = this.GET_AK()
// 开发环境使用
// this.baiduAK = '7SGoYuwTC1UjJWZ6kVuo46RJL0wdvIkF'
// this.mapAk = '7SGoYuwTC1UjJWZ6kVuo46RJL0wdvIkF'//百度
// this.mapAk = '4d0970ac800ac9346dc4f1ac49a7b73e'//高德
// 判断是否校园网
this.isInternalNetwork(false)
// 实时显示时间
@@ -253,7 +261,7 @@
// lat: 37.80894902218693
// }
// 瑞鼎国际中心:
// 腾讯系/国测局/火星/gcj02:37.80263075215858,112.55343965851368
// 腾讯系/国测局/火星/高德/gcj02:37.80263075215858,112.55343965851368
// 百度系/bd09ll:37.80894902218693,112.55983599999995
if (!res) {
this.$set(this.postData, 'ALon', '')
@@ -262,26 +270,50 @@
resolve(false)
return
}
let host = location.origin
// // 百度地图
// let host = location.origin
// let data = await uni.request({
// url: host+"/baiduapi/reverse_geocoding/v3/?ak="
// +this.mapAk
// +"&output=json&coordtype=gcj02ll"
// +"&location=" + res.lat+ "," + res.lng
// +"&ret_coordtype=bd09ll",
// })
// if(data&&data[1]&&data[1].data&&data[1].data.status == 0){
// let result = data[1].data.result
// this.$set(this.postData, 'ALon', result.location.lng)
// this.$set(this.postData, 'ALat', result.location.lat)
// let address = result.formatted_address
// this.$set(this.postData, 'ClockPlace', address)
// resolve(result.location)
// }else {
// this.$set(this.postData, 'ALon', '')
// this.$set(this.postData, 'ALat', '')
// this.$set(this.postData, 'ClockPlace', '')
// let toast = data&&data[1]&&data[1].data&&data[1].data.message?data[1].data.message:'定位转换失败!'
// this.TOAST(toast)
// resolve(false)
// }
// 高德->百度
let bd09 = this.gcj2bdString(`${res.lng},${res.lat}`)
// 高德地图
let data = await uni.request({
url: host+"/baiduapi/reverse_geocoding/v3/?ak="
+this.baiduAK
+"&output=json&coordtype=gcj02ll"
+"&location=" + res.lat+ "," + res.lng
+"&ret_coordtype=bd09ll",
url: `https://restapi.amap.com/v3/geocode/regeo?key=${this.mapAk}&location=${res.lng},${res.lat}`,
})
if(data&&data[1]&&data[1].data&&data[1].data.status == 0){
let result = data[1].data.result
this.$set(this.postData, 'ALon', result.location.lng)
this.$set(this.postData, 'ALat', result.location.lat)
if(data&&data[1]&&data[1].data&&data[1].data.status == 1){
let result = data[1].data.regeocode
this.$set(this.postData, 'ALon', bd09.lng)
this.$set(this.postData, 'ALat', bd09.lat)
let address = result.formatted_address
this.$set(this.postData, 'ClockPlace', address)
resolve(result.location)
resolve(bd09)
}else {
this.$set(this.postData, 'ALon', '')
this.$set(this.postData, 'ALat', '')
this.$set(this.postData, 'ClockPlace', '')
let toast = data&&data[1]&&data[1].data&&data[1].data.message?data[1].data.message:'定位转换失败!'
let toast = data&&data[1]&&data[1].data&&data[1].data.info?data[1].data.info:'定位转换失败!'
this.TOAST(toast)
resolve(false)
}
@@ -316,10 +348,24 @@
}
})
},
// 高德gcj02->百度bd09ll
gcj2bdString(value, mapType='BAIDU') {
if (mapType == "BAIDU") {
var x_pi = 3.14159265358979324 * 3000.0 / 180.0;
var ll = value.split(",");
var x = ll[0], y = ll[1];
var z = Math.sqrt(x * x + y * y) + 0.00002 * Math.sin(y * x_pi);
var theta = Math.atan2(y, x) + 0.000003 * Math.cos(x * x_pi);
return {lng:z * Math.cos(theta) + 0.0065,lat:z * Math.sin(theta) + 0.006};
} else if (mapType == "GAODE") {
return value;
}
},
},
destroyed() {
clearInterval(this.timer)
clearInterval(this.timer1)
this.timer&&clearInterval(this.timer)
this.timer1&&clearInterval(this.timer1)
this.timer2&&clearInterval(this.timer2)
}
}
</script>
@@ -346,6 +392,7 @@
text-align: center;
color: #333;
margin-top: 8px;
padding: 0 12px;
}
.rules {


+ 65
- 18
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/AttendanceCardTeacher/list.vue Parādīt failu

@@ -96,16 +96,23 @@
ready: false,
timer: '',
timer1:'',
timer2:'',
map: null,
postData: {},
isGetingLocal:false,
isInternalNet:false,
baiduAK:'',
mapAk:'',
}
},

async onLoad() {
this.timer2 = setTimeout(()=>{
this.TOAST('打卡超时!请重新进入页面')
setTimeout(()=>{
this.TAB_TO('/pages/home')
},1000)
},60000)
await this.init()
},

@@ -113,9 +120,10 @@
// 页面初始化
async init() {
// 获取随机ak
this.baiduAK = this.GET_AK()
this.mapAk = this.GET_AK()
// 开发环境使用
// this.baiduAK = '7SGoYuwTC1UjJWZ6kVuo46RJL0wdvIkF'
// this.mapAk = '7SGoYuwTC1UjJWZ6kVuo46RJL0wdvIkF'//百度
// this.mapAk = '4d0970ac800ac9346dc4f1ac49a7b73e'//高德
// 判断是否校园网
this.isInternalNetwork(false)
// 实时显示时间
@@ -263,7 +271,7 @@
// lat: 37.80894902218693
// }
// 瑞鼎国际中心:
// 腾讯系/国测局/火星/gcj02:37.80263075215858,112.55343965851368
// 腾讯系/国测局/火星/高德/gcj02:37.80263075215858,112.55343965851368
// 百度系/bd09ll:37.80894902218693,112.55983599999995
if (!res) {
this.$set(this.postData, 'ALon', '')
@@ -272,26 +280,50 @@
resolve(false)
return
}
let host = location.origin
// // 百度地图
// let host = location.origin
// let data = await uni.request({
// url: host+"/baiduapi/reverse_geocoding/v3/?ak="
// +this.mapAk
// +"&output=json&coordtype=gcj02ll"
// +"&location=" + res.lat+ "," + res.lng
// +"&ret_coordtype=bd09ll",
// })
// if(data&&data[1]&&data[1].data&&data[1].data.status == 0){
// let result = data[1].data.result
// this.$set(this.postData, 'ALon', result.location.lng)
// this.$set(this.postData, 'ALat', result.location.lat)
// let address = result.formatted_address
// this.$set(this.postData, 'ClockPlace', address)
// resolve(result.location)
// }else {
// this.$set(this.postData, 'ALon', '')
// this.$set(this.postData, 'ALat', '')
// this.$set(this.postData, 'ClockPlace', '')
// let toast = data&&data[1]&&data[1].data&&data[1].data.message?data[1].data.message:'定位转换失败!'
// this.TOAST(toast)
// resolve(false)
// }
// 高德->百度
let bd09 = this.gcj2bdString(`${res.lng},${res.lat}`)
// 高德地图
let data = await uni.request({
url: host+"/baiduapi/reverse_geocoding/v3/?ak="
+this.baiduAK
+"&output=json&coordtype=gcj02ll"
+"&location=" + res.lat+ "," + res.lng
+"&ret_coordtype=bd09ll",
url: `https://restapi.amap.com/v3/geocode/regeo?key=${this.mapAk}&location=${res.lng},${res.lat}`,
})
if(data&&data[1]&&data[1].data&&data[1].data.status == 0){
let result = data[1].data.result
this.$set(this.postData, 'ALon', result.location.lng)
this.$set(this.postData, 'ALat', result.location.lat)
if(data&&data[1]&&data[1].data&&data[1].data.status == 1){
let result = data[1].data.regeocode
this.$set(this.postData, 'ALon', bd09.lng)
this.$set(this.postData, 'ALat', bd09.lat)
let address = result.formatted_address
this.$set(this.postData, 'ClockPlace', address)
resolve(result.location)
resolve(bd09)
}else {
this.$set(this.postData, 'ALon', '')
this.$set(this.postData, 'ALat', '')
this.$set(this.postData, 'ClockPlace', '')
let toast = data&&data[1]&&data[1].data&&data[1].data.message?data[1].data.message:'定位转换失败!'
let toast = data&&data[1]&&data[1].data&&data[1].data.info?data[1].data.info:'定位转换失败!'
this.TOAST(toast)
resolve(false)
}
@@ -317,10 +349,24 @@
}
})
},
// 高德gcj02->百度bd09ll
gcj2bdString(value, mapType='BAIDU') {
if (mapType == "BAIDU") {
var x_pi = 3.14159265358979324 * 3000.0 / 180.0;
var ll = value.split(",");
var x = ll[0], y = ll[1];
var z = Math.sqrt(x * x + y * y) + 0.00002 * Math.sin(y * x_pi);
var theta = Math.atan2(y, x) + 0.000003 * Math.cos(x * x_pi);
return {lng:z * Math.cos(theta) + 0.0065,lat:z * Math.sin(theta) + 0.006};
} else if (mapType == "GAODE") {
return value;
}
},
},
destroyed() {
clearInterval(this.timer)
clearInterval(this.timer1)
this.timer&&clearInterval(this.timer)
this.timer1&&clearInterval(this.timer1)
this.timer2&&clearInterval(this.timer2)
}
}
</script>
@@ -347,6 +393,7 @@
text-align: center;
color: #333;
margin-top: 8px;
padding: 0 12px;
}

.rules {


Notiek ielāde…
Atcelt
Saglabāt