diff --git a/pages/index/index.vue b/pages/index/index.vue index d2bc8f7..314b293 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -189,7 +189,7 @@ lon: this.myLonLat.lng, lat: this.myLonLat.lat }, '/api/Merchants/guideClockLocate').then(res => { - if(res.code == 200) { + if(res.code == 1) { this.punchSuccess = true clearInterval(this.timeInterval); // 打卡成功后清除时间定时器 let timer = setInterval(() => { @@ -223,13 +223,12 @@ lng: gcj02Lng, lat: gcj02Lat } - console.log(gcj02Lat, gcj02Lng) // 初始化是否可打卡为 false this.isCanPunch = false; // 遍历每个打卡点 for (let i = 0; i < this.userPunch.clock_address.length; i++) { const item = this.userPunch.clock_address[i]; - const distance = this.calculateDistance(item.latitude, item.longitude, gcj02Lat, gcj02Lng); + const distance = this.calculateDistance(item.lat, item.lon, gcj02Lat, gcj02Lng); console.log(`与打卡点 ${item.title} 的距离:`, distance); if (distance <= item.range) { this.isCanPunch = true; diff --git a/pages/login/login.vue b/pages/login/login.vue index e095611..c8c55d2 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -67,17 +67,21 @@ }, login() { this.Post(this.form,'/api/Merchants/login_member').then(res => { - this.$store.commit('changeUserInfo', res.data) - if (this.$store.state.user.toPath.includes('user/user')) { - uni.switchTab({ - url: this.$store.state.user.toPath - }) - } else { - // uni.navigateBack({}) - // this.goBack() - uni.switchTab({ - url: '/pages/index/index' - }) + if(res.code == 1) { + this.$store.commit('changeUserInfo', res.data) + if (this.$store.state.user.toPath.includes('user/user')) { + uni.switchTab({ + url: this.$store.state.user.toPath + }) + } else { + // uni.navigateBack({}) + // this.goBack() + uni.switchTab({ + url: '/pages/index/index' + }) + } + }else { + this.getCodeImg() } }) }, diff --git a/static/js/CommonFunction.js b/static/js/CommonFunction.js index e37fbf1..bdc460c 100644 --- a/static/js/CommonFunction.js +++ b/static/js/CommonFunction.js @@ -173,7 +173,6 @@ Vue.prototype.encryptPhone = (phone) => { // 计算两个经纬度间的距离 Vue.prototype.calculateDistance = (lat1, lon1, lat2, lon2) => { - console.log(lat1, lon1, lat2, lon2) const R = 6371e3; // 地球半径,单位:米 const φ1 = lat1 * (Math.PI / 180); const φ2 = lat2 * (Math.PI / 180); diff --git a/unpackage/dist/build/web/index.html b/unpackage/dist/build/web/index.html index d691acb..2b374ed 100644 --- a/unpackage/dist/build/web/index.html +++ b/unpackage/dist/build/web/index.html @@ -1,2 +1,2 @@