You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
3.2 KiB
Vue

<template>
<view>
<button type="default" @tap="getDistance"></button>
<view>{{title}}</view>
<text>{{name}}</text>
</view>
</template>
<script>
export default {
data() {
return {
name:"我的名字",
key:'7IYBZ-RTIK3-62G3M-Y3Y7C-SCR6S-J6BDC',
bzText:{time:"",address:"",img:"",remarks:""},
type:"",
r : 80, //半径
Timer:[{time:"09:00",},{time:"18:00"}], //上下班时间
isAm:false, //上班是否打卡
isPm:false, //下班是否打卡
amSign:{time:"",address:"",remarks:"",img:""}, //上午打卡信息
pmSign:{time:"",address:"",remarks:"",img:""}, //下午打卡信息
clickNum:0, //点击重新获取位置信息次数
is:null, //是否正常打卡(外勤打卡)
isSign:false, //是否打卡
time:formateDate(new Date(),'h:min:s'), //当前时分秒
date:formateDate(new Date(),'Y-M-D'),
latitude: "", //当前经度
longitude: "", //当前维度
address:"我的位置", //
wqInfo:null,
allSign:[], //所有打卡信息
signInfo:{mode:"", latitude:"",longitude:"",address:"",time:"",remarks:""}, //打卡信息 (模式,经纬度,地址,时间)
covers: [
// 公司点信息
{id:0,callout:{content:"*****科技有限公司",color:"red",display:"ALWAYS",},latitude:37.788338,longitude:113.269629,iconPath: '../../../static/img/location.png'},
],
circles:[
// 公司圆信息(latitude:39.9085,longitude:116.39747 );
{latitude:37.788338,longitude:113.269629 ,radius:80,strokeWidth:1,fillColor:"#7fff0099"},
]
}
},
onPullDownRefresh: function() {
setTimeout(function() {
uni.stopPullDownRefresh();
uni.redirectTo({
url: 'pages/myHome/clocking-in/clocking-in',
});
uni.showToast({
title: '刷新成功',
icon: 'success',
duration: 2000
});
}, 500);
},
onLoad() {
},
onShow:function(){
// this.getDistance()
},
methods: {
getLocation(){
var that = this;
if(this.clickNum !== 0){
uni.showLoading({title:"获取中...",mask:true})
}
if(this.clickNum >= 3){
uni.showToast({title:"请稍后尝试!",icon:"none",mask:true});
return ;
}
this.clickNum++;
uni.getLocation({
type: 'gcj02', //返回可以用于uni.openLocation的经纬度
success(res) {
console.log(res);
uni.hideLoading();
that.latitude = res.latitude;
that.longitude = res.longitude;
// console.log(res.latitude,"---",res.longitude)
that.covers[1] = {id:1,latitude:res.latitude,longitude : res.longitude,iconPath: '../../static/location.png'}
var s = pointInsideCircle([that.latitude,that.longitude],[that.circles[0].latitude,that.circles[0].longitude],that.r/100000);
that.is = s;
that.signInfo.latitude = res.latitude;
that.signInfo.longitude = res.longitude;
that.signInfo.mode = s ? "正常打卡" : "外勤打卡";
that.getAdd()
},
fail(err){
uni.hideLoading();
that.address = "请检查位置信息!"
uni.showToast({title:"请检查位置信息状态!",icon:"none", mask:true,duration:3000})
}
});
},
}
}
</script>
<style>
</style>