diff --git a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/common/wxFn.js b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/common/wxFn.js index e04c7e77a..35be97152 100644 --- a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/common/wxFn.js +++ b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/common/wxFn.js @@ -57,7 +57,7 @@ export default { } wx.getLocation({ type: "gcj02", // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02' - success: function(res) { + success: (res) => { var latitude = res.latitude; // 纬度,浮点数,范围为90 ~ -90 var longitude = res.longitude; // 经度,浮点数,范围为180 ~ -180。 var speed = res.speed; // 速度,以米/每秒计 @@ -67,7 +67,7 @@ export default { lng:longitude }) }, - fail: function(error) { + fail: (error) => { this.TOAST("获取定位失败!") resolve(false) } diff --git a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/AttendanceCard/list.vue b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/AttendanceCard/list.vue index d793e5d1b..5a85b4a54 100644 --- a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/AttendanceCard/list.vue +++ b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/AttendanceCard/list.vue @@ -108,7 +108,7 @@ methods: { // 页面初始化 async init() { - this.isInternalNetwork(false) + await this.isInternalNetwork(false) this.LOADING('加载数据中...') this.now = this.getCurrentTime() @@ -178,33 +178,35 @@ 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() - if(!window.BMapGL || !BMapGL.Map){ - this.TOAST('获取定位资源失败!') - return false - } - 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) + // 获取定位,不是外勤时候改变状态 + // if (!window.BMapGL) await this.loadJScript() + if(!window.BMapGL || !BMapGL.Map){ + this.TOAST('获取定位资源失败!') + return false + } + this.map = new BMapGL.Map('container'); + + await this.isFieldPersonnel() + 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.isFieldPersonnel() + // console.log(this.postData) + this.isGetingLocal = false + },3000) + return true }, //返回 @@ -284,7 +286,7 @@ resolve(false) } new BMapGL.Convertor().translate([res], 3, 5, data => { - if (data.status == 0) { + 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) @@ -304,7 +306,7 @@ this.$set(this.postData, 'ALon', '') this.$set(this.postData, 'ALat', '') this.$set(this.postData, 'ClockPlace', '') - this.TOAST('获取定位失败!') + this.TOAST('定位获取失败!') resolve(false) } @@ -322,8 +324,8 @@ }, // 判断是否学校网络 isInternalNetwork(TOAST=true){ - this.LOADING() - this.requestBase("https://mp.weixin.qq.com/intp/getuserclientip").then(res=>{ + this.LOADING('加载数据中...') + return this.requestBase("https://mp.weixin.qq.com/intp/getuserclientip").then(res=>{ this.HIDE_LOADING() let res_ = res[1] let client_ip_start = '1.190.222.'