gcz 4 年 前
コミット
547dbbca95
1 ファイル変更7 行追加2 行削除
  1. 7 2
      pages/attence/attence.vue

+ 7 - 2
pages/attence/attence.vue

@@ -90,6 +90,8 @@
 </template>
 
 <script>
+	var ALog = uni.requireNativePlugin("AndroidLog")
+	var location = uni.requireNativePlugin("Location")
 	export default{
 		data(){
 			return{
@@ -122,11 +124,13 @@
 		},
 		methods:{
 			getLocation(){
-				ALog.info({msg:'请求定位'})
+				ALog.info({msg:'请求定位'});
+				uni.showLoading({ title: '定位中'});
 				let that = this;
 				uni.getLocation({
 					type:"gcj02",
 					success : function (res) {
+						uni.hideLoading();
 						console.log("定位返回信息:", res)
 						// alert(res.longitude + "," + res.latitude )
 						ALog.info({msg:res})
@@ -137,7 +141,7 @@
 						var locRet = location?.distance?.(src, dst);
 						// console.log('locRet',locRet);
 						ALog.info({msg:locRet.distance})
-						if(!locRet<=that.payeeinfo.workDistance){//在打卡范围内
+						if(locRet<=that.payeeinfo.workDistance){//在打卡范围内
 							that.outPosition = false;
 							console.log('that.workType',that.workType);
 							// debugger;
@@ -184,6 +188,7 @@
 						
 					},
 					fail: function(res){
+						uni.hideLoading();
 						console.log('getLocation err',res)					
 						ALog.info({msg:'请求错误',err:res})
 					}