소스 검색

h5 考勤打卡整体优化

黑龙江艺术高中职
yxq 4 달 전
부모
커밋
732422d713
7개의 변경된 파일233개의 추가작업 그리고 295개의 파일을 삭제
  1. +1
    -9
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/App.vue
  2. +26
    -12
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/common/wxFn.js
  3. +1
    -1
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/config.js
  4. +18
    -10
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/manifest.json
  5. +88
    -128
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/AttendanceCard/list.vue
  6. +98
    -134
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/AttendanceCardTeacher/list.vue
  7. +1
    -1
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/vue.config.js

+ 1
- 9
Learun.Framework.Ultimate V7/LearunApp-2.2.0/App.vue 파일 보기

@@ -6,20 +6,12 @@

async onLaunch(param) {
// 版本更新
var newVer = '1.0.2';
var newVer = '1.1.2';
var oldVer = localStorage.getItem('version');
    if (newVer != oldVer) {
localStorage.setItem('version', newVer);
this.JUMP_TO("/")
}
// 加载百度地图资源
let ak = this.GET_AK()
var script = document.createElement('script');
script.type = 'text/javascript';
script.src =
'https://api.map.baidu.com/api?v=1.0&type=webgl&ak=' + ak +
'&callback=' + 'initMap';
document.head.appendChild(script);
// 在App.vue文件中获取到页面到URL (初始化WXsdj)
window.localStorage.setItem('scanUrl',location.href.split('#')[0])


+ 26
- 12
Learun.Framework.Ultimate V7/LearunApp-2.2.0/common/wxFn.js 파일 보기

@@ -1,12 +1,10 @@
window.wx = null
window.wxInit = false
import wx from '@/common/js/weixin-js-sdk.js';
window.wx = wx
// 参考文档 https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/JS-SDK.html
export default {
methods: {
data(){
return {
wxInit:false
}
},
// 初始化wx
initWx(arr = ["getLocation"]) {
const promise = new Promise((resolve, reject) => {
@@ -28,15 +26,28 @@ export default {
signature: success.certificate, // 必填,签名
jsApiList: arr // 必填,需要使用的JS接口列表
});
// 公众平台测试账号本地调试使用
// console.log({nonceStr: success.noncestr,timestamp: success.timestamp,url})
// wx.config({
// debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
// appId: 'wx2aa8dcf3603f77b5', // 必填,公众号的唯一标识
// timestamp: '1719897639109', // 必填,生成签名的时间戳
// nonceStr: "202407011704072775", // 必填,生成签名的随机串
// signature: "af7666f9ed1355756b80561cf7b358fb603f7963", // 必填,签名
// jsApiList: arr // 必填,需要使用的JS接口列表
// });
wx.ready(() => {
this.wxInit = true
// this.TOAST("wx初始化成功")
window.wxInit = true
resolve(true)
})
wx.error(() => {
wx.error((error) => {
// alert(JSON.stringify(error))
this.TOAST("wx初始化失败")
resolve(false)
})
setTimeout(()=>{
resolve("wx初始化超时")
},5000)
})
})
return promise
@@ -44,9 +55,10 @@ export default {
// 获取定位
async getLocation() {
return new Promise(async (resolve) => {
if (!this.wxInit) {
if (!window.wxInit) {
let res = await this.initWx(["getLocation"])
if(!res){
if(!res||res=='wx初始化超时'){
res&&this.TOAST(res)
resolve(false)
return
}
@@ -54,6 +66,7 @@ export default {
if(!wx.getLocation){
this.TOAST("获取定位失败")
resolve(false)
return
}
wx.getLocation({
type: "gcj02", // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
@@ -68,6 +81,7 @@ export default {
})
},
fail: (error) => {
// alert(JSON.stringify(error))
this.TOAST("获取定位失败!")
resolve(false)
}
@@ -77,7 +91,7 @@ export default {
// 拍照
async chooseImage() {
return new Promise(async (resolve) => {
if (!this.wxInit) {
if (!window.wxInit) {
let res = await this.initWx(["chooseImage"])
if(!res){
resolve(false)
@@ -106,7 +120,7 @@ export default {
// 预览图片
async previewImage(url,urlArr) {
return new Promise(async (resolve) => {
if (!this.wxInit) {
if (!window.wxInit) {
let res = await this.initWx(["previewImage"])
if(!res){
resolve(false)


+ 1
- 1
Learun.Framework.Ultimate V7/LearunApp-2.2.0/config.js 파일 보기

@@ -2,7 +2,7 @@ export default {
// 登录页显示的公司名称
"company": "数字化智慧校园",
// App 版本号
"appVersion": "1.0.0",
"appVersion": "1.1.2",
// 是否允许用户注册
"enableSignUp": true,
//请求数据的接口地址;可以配置多个,开发环境下登录页会出现选择菜单供您选择


+ 18
- 10
Learun.Framework.Ultimate V7/LearunApp-2.2.0/manifest.json 파일 보기

@@ -165,16 +165,24 @@
}
},
"h5" : {
// "devServer": {
// "proxy" : {
// "/api" : {
// "target" : "http://192.168.10.58:8011/", //自己项目接口域名
// "changeOrigin" : true, //是否跨域
// // "secure" : true, // 设置支持https协议的代理
// "pathRewrite": {"^/api":""} //api路径重定向,根据具体情况调整,也可不写
// }
// }
// },
"devServer" : {
"proxy" : {
// "/api" : {
// "target" : "http://192.168.10.58:8011/", //自己项目接口域名
// "changeOrigin" : true, //是否跨域
// // "secure" : true, // 设置支持https协议的代理
// "pathRewrite": {"^/api":""} //api路径重定向,根据具体情况调整,也可不写
// },
"/baiduapi" : {
"target" : "https://api.map.baidu.com/",
"changeOrigin" : true,
"secure" : true, // 设置支持https协议的代理
"pathRewrite" : {
"^/baiduapi" : ""
} //api路径重定向,根据具体情况调整,也可不写
}
}
},
"uniStatistics" : {
"enable" : false
},


+ 88
- 128
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/AttendanceCard/list.vue 파일 보기

@@ -40,7 +40,6 @@
<img src="../../common/images/2.png" alt="" width="100%">
</view>
</view>
<view id='container'></view>
<!-- 弹层 -->
<!-- <l-modal v-model="modal" title="选择打卡类型">
<l-button @click="toAttendanceCardTeacher" color="blue" class="block" block>授课打卡</l-button>
@@ -98,6 +97,7 @@
// modal:false,
isInternalNet:false,
baiduAK:'',
}
},

@@ -108,22 +108,24 @@
methods: {
// 页面初始化
async init() {
await this.isInternalNetwork(false)
this.LOADING('加载数据中...')

// 获取随机ak
this.baiduAK = this.GET_AK()
// 开发环境使用
// this.baiduAK = '7SGoYuwTC1UjJWZ6kVuo46RJL0wdvIkF'
// 判断是否校园网
this.isInternalNetwork(false)
// 实时显示时间
this.now = this.getCurrentTime()
this.timer = setInterval(this.getCurrentTime, 1000)
//判断教师是否授课,显示弹层
// let hasLesson = await this.judgeTeacherIsHasLesson()
// this.modal = hasLesson
let res = await this.judgeIsDK()
// 获取打卡信息
this.LOADING('加载数据中...')
let res = await this.getPageInfo()
this.ready = res ? true : false
this.HIDE_LOADING()
},

// 点击 「打卡」按钮
async action(type) {
switch (type) {
@@ -140,79 +142,49 @@
return
}
this.NAV_TO(`./single_zc`, this.postData,true)
// this.LOADING()
// this.HTTP_POST('learun/adms/attendance/clockin', {}, '打卡失败').then(success => {
// this.HIDE_LOADING()
// if (!success) {
// this.TOAST('打卡失败')
// return
// }
// this.TOAST('打卡成功', 'success')
// setTimeout(this.back, 500)

// })
return

default:
break
}
},
//获取打卡信息
async judgeIsDK() {
//获取打卡页面信息
async getPageInfo() {
// 获取打卡时间范围等信息
// 签到状态(1正常打卡,2迟到打卡,3早退打卡,4外勤打卡,5不在考勤时间范围)
let success = await this.HTTP_GET('learun/adms/attendance/IsAttendance', {}, '判断当前时间是否可以打卡失败')
if (!success) {
return false
}
this.info = success.data
this.imgsrc = dk;
// if ([1].includes(this.info.AttendanceType)) {
// this.imgsrc=dk;
// } else if ([2,3].includes(this.info.AttendanceType)) {
// this.imgsrc=dkyellow;
// }else {
// this.imgsrc=dkred;
// }
// 保存原打卡状态
this.resInfo = {
AttendanceType:this.info.AttendanceType,
AttendanceTypeString:this.info.AttendanceTypeString,
}
// 不在打卡时间范围 停止定位加载
if ([5].includes(this.info.AttendanceType)) return true
// 获取到定位前默认为外勤打卡
this.$set(this.info, 'AttendanceType', 4)
this.$set(this.info, 'AttendanceTypeString', '外勤打卡')
this.$set(this.postData, 'AIsOut', 1)
// 获取定位,不是外勤时候改变状态
// if (!window.BMapGL) await this.loadJScript()
if(!window.BMapGL || !BMapGL.Map){
this.TOAST('获取定位资源失败!')
return false
}
this.map = new BMapGL.Map('container');
await this.isFieldPersonnel()
// 更新定位信息
await this.updatePageInfo()
// 获取定位信息失败,终止定时
if(!this.postData.ClockPlace){
return true
}
// 获取定位信息成功,开始定时
this.timer1 = setInterval(async ()=>{
if(this.isGetingLocal)return
if(!this.postData.ClockPlace){
clearInterval(this.timer1)
}
this.isGetingLocal = true
await this.isFieldPersonnel()
// console.log(this.postData)
await this.updatePageInfo()
this.isGetingLocal = false
},3000)
return true
},
//返回
back() {
this.NAV_BACK()
},
//获取当前时间
getCurrentTime() {
let nowDate = new Date();
@@ -221,46 +193,20 @@
let ss = nowDate.getSeconds() < 10 ? '0' + nowDate.getSeconds() : nowDate.getSeconds();
this.now = hh + ':' + mf + ':' + ss;
},
// 判断是否外勤打卡
async isFieldPersonnel() {
let point = new BMapGL.Point(this.info.GPSLon, this.info.GPSLat)
await this.getDistance(point)
},
//异步加载地图
loadJScript() {
return new Promise((resolve, reject) => {
let ak = this.GET_AK()
window.initMap = function() {
resolve()
}
setTimeout(()=>{
resolve()
},8000)
var script = document.createElement('script');
script.type = 'text/javascript';
script.src =
'https://api.map.baidu.com/api?v=1.0&type=webgl&ak=' + ak +
'&callback=' + 'initMap';
script.onerror = reject;
script.id = 'baiduScript'
document.head.appendChild(script);
})
},
// 计算距离打卡点的距离
// 签到状态(1正常打卡,2迟到打卡,3早退打卡,4外勤打卡,5不在考勤时间范围)
async getDistance(myP1) {
// new BMapGL.Point(116.404, 39.915)
// 更新定位信息
async updatePageInfo() {
// 学校打卡范围中心坐标
let myP1 = {lat:this.info.GPSLat,lng:this.info.GPSLon}
// 获取当前定位
let myP2 = await this.local();
if (!myP2) {
// this.TOAST('获取定位失败!')
this.$set(this.info, 'AttendanceType', 4)
this.$set(this.info, 'AttendanceTypeString', '外勤打卡')
this.$set(this.postData, 'AIsOut', 1)
return
}
let distance = this.map.getDistance(myP1, myP2).toFixed(2)
// alert('距离'+ distance)
// console.log('距离', distance, '打卡坐标:', myP1, '当前坐标:', myP2)
// 计算距离更新状态
let distance = this.calculateDistance(myP1.lat,myP1.lng,myP2.lat,myP2.lng)*1000
if (Number(distance) > Number(this.info.GPSRange)) {
this.$set(this.info, 'AttendanceType', 4)
this.$set(this.info, 'AttendanceTypeString', '外勤打卡')
@@ -271,46 +217,73 @@
this.$set(this.postData, 'AIsOut', 0)
}
},
// 计算距离
calculateDistance(lat1, lng1, lat2, lng2) {
// 地球半径
var R = 6371; // 单位为公里
// 将角度转为弧度
lat1 = lat1 * Math.PI / 180;
lng1 = lng1 * Math.PI / 180;
lat2 = lat2 * Math.PI / 180;
lng2 = lng2 * Math.PI / 180;
// 经纬度差值
var dLat = lat2 - lat1;
var dLng = lng2 - lng1;
// Haversine公式
var a = Math.pow(Math.sin(dLat / 2), 2) + Math.cos(lat1) * Math.cos(lat2) * Math.pow(Math.sin(dLng / 2), 2);
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
var distance = R * c;
return distance;
},
// 获取当前位置
local() {
return new Promise(async (resolve) => {
let res = await this.getLocation()
// 开发环境使用
// let res = {
// lng: 112.57205562051,
// lat: 37.742374280962
// lng: 112.55343965851368,
// lat: 37.80263075215858
// }
// let res = {
// lng: 112.55983599999995,
// lat: 37.80894902218693
// }
// 瑞鼎国际中心:
// 腾讯系/国测局/火星/gcj02:37.80263075215858,112.55343965851368
// 百度系/bd09ll:37.80894902218693,112.55983599999995
if (!res) {
this.$set(this.postData, 'ALon', '')
this.$set(this.postData, 'ALat', '')
this.$set(this.postData, 'ClockPlace', '')
resolve(false)
return
}
new BMapGL.Convertor().translate([res], 3, 5, data => {
if (data&&data.status == 0) {
// alert(data.points[0].lng + '' + data.points[0].lat)
this.$set(this.postData, 'ALon', data.points[0].lng)
this.$set(this.postData, 'ALat', data.points[0].lat)
let geoc = new BMapGL.Geocoder();
geoc.getLocation(data.points[0], (rs) => {
let addComp = rs.addressComponents;
let address =
addComp.province +
addComp.city +
addComp.district +
addComp.street +
addComp.streetNumber
this.$set(this.postData, 'ClockPlace', address)
resolve(data.points[0])
});
} else {
this.$set(this.postData, 'ALon', '')
this.$set(this.postData, 'ALat', '')
this.$set(this.postData, 'ClockPlace', '')
this.TOAST('定位获取失败!')
resolve(false)
}

let host = location.origin
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",
})
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', '')
// this.TOAST('定位获取失败!')
resolve(false)
}
});
},
//判断教师是否授课
@@ -319,14 +292,14 @@
return success.data;
},
//跳转进入教师授课打卡页面
toAttendanceCardTeacher() {
this.JUMP_TO('/pages/AttendanceCardTeacher/list', {},true)
},
// toAttendanceCardTeacher() {
// this.JUMP_TO('/pages/AttendanceCardTeacher/list', {},true)
// },
// 判断是否学校网络
isInternalNetwork(TOAST=true){
this.LOADING('加载数据中...')
TOAST&&this.LOADING('加载数据中...')
return this.requestBase("https://mp.weixin.qq.com/intp/getuserclientip").then(res=>{
this.HIDE_LOADING()
TOAST&&this.HIDE_LOADING()
let res_ = res[1]
let client_ip_start = '1.190.222.'
let arr = []
@@ -344,19 +317,6 @@
},
},
destroyed() {
// let scirpt = document.getElementById('baiduScript')
// if(scirpt){
// scirpt.remove()
// }
// let scirpt1 = document.querySelectorAll('body script')
// if(scirpt1){
// scirpt1.forEach(e=>{
// if(e.src.includes('https://api.map.baidu.com')){
// e.remove()
// }
// })
// }
// window.BMapGL = null
clearInterval(this.timer)
clearInterval(this.timer1)
}


+ 98
- 134
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/AttendanceCardTeacher/list.vue 파일 보기

@@ -50,7 +50,6 @@
<img src="../../common/images/2.png" alt="" width="100%">
</view>
</view>
<view id='container'></view>
</view>

</template>
@@ -102,6 +101,7 @@
isGetingLocal:false,
isInternalNet:false,
baiduAK:'',
}
},

@@ -112,17 +112,21 @@
methods: {
// 页面初始化
async init() {
// 获取随机ak
this.baiduAK = this.GET_AK()
// 开发环境使用
// this.baiduAK = '7SGoYuwTC1UjJWZ6kVuo46RJL0wdvIkF'
// 判断是否校园网
this.isInternalNetwork(false)
this.LOADING('加载数据中...')

// 实时显示时间
this.now = this.getCurrentTime()
this.timer = setInterval(this.getCurrentTime, 1000)
let res = await this.judgeIsDK()

// 获取打卡信息
this.LOADING('加载数据中...')
let res = await this.getPageInfo()
this.ready = res ? true : false
this.HIDE_LOADING()
},

// 点击 「打卡」按钮
async action(type) {
switch (type) {
@@ -143,26 +147,14 @@
return
}
this.NAV_TO(`./single_zc`, this.postData,true)
// this.LOADING()
// this.HTTP_POST('learun/adms/attendance/clockinTeacher', {}, '打卡失败').then(success => {
// this.HIDE_LOADING()
// if (!success) {
// this.TOAST('打卡失败')
// return
// }
// this.TOAST('打卡成功', 'success')
// setTimeout(this.back, 500)

// })
return

default:
break
}
},
//获取打卡信息
async judgeIsDK() {
//获取打卡页面信息
async getPageInfo() {
// 获取打卡时间范围等信息
// 签到状态(1正常打卡,2迟到打卡,3早退打卡,4外勤打卡,5不在考勤时间范围)
let success = await this.HTTP_GET('learun/adms/attendance/IsAttendanceTeacher', {}, '判断当前时间是否可以打卡失败')
if (!success) {
return false
@@ -174,47 +166,35 @@
ALTId:this.info.ALTId||undefined,
ALTOEId:this.info.ALTOEId||undefined
}
// if ([1].includes(this.info.AttendanceType)) {
// this.imgsrc=dk;
// } else if ([2,3].includes(this.info.AttendanceType)) {
// this.imgsrc=dkyellow;
// }else {
// this.imgsrc=dkred;
// }
// 保存原打卡状态
this.resInfo = {
AttendanceType:this.info.AttendanceType,
AttendanceTypeString:this.info.AttendanceTypeString,
}
if (![5].includes(this.info.AttendanceType)) {
this.$set(this.info, 'AttendanceType', 4)
this.$set(this.info, 'AttendanceTypeString', '外勤打卡')
this.$set(this.postData, 'AIsOut', 1)
// 获取定位,不是外勤时候改变状态
if (!window.BMapGL) await this.loadJScript()
this.map = new BMapGL.Map('container');
await this.isFieldPersonnel()
// 不在打卡时间范围 停止定位加载
if ([5].includes(this.info.AttendanceType)) return true
// 获取到定位前默认为外勤打卡
this.$set(this.info, 'AttendanceType', 4)
this.$set(this.info, 'AttendanceTypeString', '外勤打卡')
this.$set(this.postData, 'AIsOut', 1)
// 更新定位信息
await this.updatePageInfo()
// 获取定位信息失败,终止定时
if(!this.postData.ClockPlace){
return true
}
// 获取定位信息成功,开始定时
this.timer1 = setInterval(async ()=>{
if(this.isGetingLocal)return
if(!this.postData.ClockPlace){
return true
clearInterval(this.timer1)
}
this.timer1 = setInterval(async ()=>{
if(this.isGetingLocal)return
if(!this.postData.ClockPlace){
clearInterval(this.timer1)
}
this.isGetingLocal = true
await this.isFieldPersonnel()
// console.log(this.postData)
this.isGetingLocal = false
},3000)
}
this.isGetingLocal = true
await this.updatePageInfo()
this.isGetingLocal = false
},3000)
return true
},
//返回
back() {
this.NAV_BACK()
},
//获取当前时间
getCurrentTime() {
let nowDate = new Date();
@@ -223,46 +203,20 @@
let ss = nowDate.getSeconds() < 10 ? '0' + nowDate.getSeconds() : nowDate.getSeconds();
this.now = hh + ':' + mf + ':' + ss;
},
// 判断是否外勤打卡
async isFieldPersonnel() {
let point = new BMapGL.Point(this.info.GPSLon, this.info.GPSLat)
await this.getDistance(point)
},
//异步加载地图
loadJScript() {
return new Promise((resolve, reject) => {
let ak = this.GET_AK()
window.initMap = function() {
resolve(BMapGL)
}
setTimeout(()=>{
resolve()
},8000)
var script = document.createElement('script');
script.type = 'text/javascript';
script.src =
'https://api.map.baidu.com/api?v=1.0&type=webgl&ak=' + ak +
'&callback=' + 'initMap';
script.onerror = reject;
script.id = 'baiduScript'
document.head.appendChild(script);
})
},
// 计算距离打卡点的距离
// 签到状态(1正常打卡,2迟到打卡,3早退打卡,4外勤打卡,5不在考勤时间范围)
async getDistance(myP1) {
// new BMapGL.Point(116.404, 39.915)
// 更新定位信息
async updatePageInfo() {
// 学校打卡范围中心坐标
let myP1 = {lat:this.info.GPSLat,lng:this.info.GPSLon}
// 获取当前定位
let myP2 = await this.local();
if (!myP2) {
// this.TOAST('获取定位失败!')
this.$set(this.info, 'AttendanceType', 4)
this.$set(this.info, 'AttendanceTypeString', '外勤打卡')
this.$set(this.postData, 'AIsOut', 1)
return
}
let distance = this.map.getDistance(myP1, myP2).toFixed(2)
// alert('距离'+ distance)
// console.log('距离', distance, '打卡坐标:', myP1, '当前坐标:', myP2)
// 计算距离更新状态
let distance = this.calculateDistance(myP1.lat,myP1.lng,myP2.lat,myP2.lng)*1000
if (Number(distance) > Number(this.info.GPSRange)) {
this.$set(this.info, 'AttendanceType', 4)
this.$set(this.info, 'AttendanceTypeString', '外勤打卡')
@@ -273,57 +227,80 @@
this.$set(this.postData, 'AIsOut', 0)
}
},
// 计算距离
calculateDistance(lat1, lng1, lat2, lng2) {
// 地球半径
var R = 6371; // 单位为公里
// 将角度转为弧度
lat1 = lat1 * Math.PI / 180;
lng1 = lng1 * Math.PI / 180;
lat2 = lat2 * Math.PI / 180;
lng2 = lng2 * Math.PI / 180;
// 经纬度差值
var dLat = lat2 - lat1;
var dLng = lng2 - lng1;
// Haversine公式
var a = Math.pow(Math.sin(dLat / 2), 2) + Math.cos(lat1) * Math.cos(lat2) * Math.pow(Math.sin(dLng / 2), 2);
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
var distance = R * c;
return distance;
},
// 获取当前位置
local() {
return new Promise(async (resolve) => {
let res = await this.getLocation()
let res = await this.getLocation()
// 开发环境使用
// let res = {
// lng: 112.57205562051,
// lat: 37.742374280962
// lng: 112.55343965851368,
// lat: 37.80263075215858
// }
// let res = {
// lng: 112.55981419,
// lat: 37.80890166
// let res = {
// lng: 112.55983599999995,
// lat: 37.80894902218693
// }
// 瑞鼎国际中心:
// 腾讯系/国测局/火星/gcj02:37.80263075215858,112.55343965851368
// 百度系/bd09ll:37.80894902218693,112.55983599999995
if (!res) {
this.$set(this.postData, 'ALon', '')
this.$set(this.postData, 'ALat', '')
this.$set(this.postData, 'ClockPlace', '')
resolve(false)
return
}
new BMapGL.Convertor().translate([res], 3, 5, data => {
if (data.status == 0) {
// alert(data.points[0].lng + '' + data.points[0].lat)
this.$set(this.postData, 'ALon', data.points[0].lng)
this.$set(this.postData, 'ALat', data.points[0].lat)
let geoc = new BMapGL.Geocoder();
geoc.getLocation(data.points[0], (rs) => {
let addComp = rs.addressComponents;
let address =
addComp.province +
addComp.city +
addComp.district +
addComp.street +
addComp.streetNumber
this.$set(this.postData, 'ClockPlace', address)
resolve(data.points[0])
});
} else {
this.$set(this.postData, 'ALon', '')
this.$set(this.postData, 'ALat', '')
this.$set(this.postData, 'ClockPlace', '')
this.TOAST('获取定位失败!')
resolve(false)
}

let host = location.origin
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",
})
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', '')
this.TOAST('定位获取失败!')
resolve(false)
}
});
},
// 判断是否学校网络
isInternalNetwork(TOAST=true){
this.LOADING()
this.requestBase("https://mp.weixin.qq.com/intp/getuserclientip").then(res=>{
this.HIDE_LOADING()
TOAST&&this.LOADING('加载数据中...')
return this.requestBase("https://mp.weixin.qq.com/intp/getuserclientip").then(res=>{
TOAST&&this.HIDE_LOADING()
let res_ = res[1]
let client_ip_start = '1.190.222.'
let arr = []
@@ -341,19 +318,6 @@
},
},
destroyed() {
let scirpt = document.getElementById('baiduScript')
if(scirpt){
scirpt.remove()
}
let scirpt1 = document.querySelectorAll('body script')
if(scirpt1){
scirpt1.forEach(e=>{
if(e.src.includes('https://api.map.baidu.com')){
e.remove()
}
})
}
window.BMapGL = null
clearInterval(this.timer)
clearInterval(this.timer1)
}


+ 1
- 1
Learun.Framework.Ultimate V7/LearunApp-2.2.0/vue.config.js 파일 보기

@@ -14,7 +14,7 @@ module.exports = {
disableHostCheck: true
},
output: { // 输出重构 打包编译后的 文件目录 文件名称 【模块名称.时间戳】
filename: `${filePath}[name]${Timestamp}.js?v=1.0.2`,
filename: `${filePath}[name]${Timestamp}.js?v=1.1.2`,
chunkFilename: `${filePath}[name]${Timestamp}.js`
},
}


불러오는 중...
취소
저장