| | |
| | | <view class="btn1"> |
| | | <view class="btn0"> |
| | | <view class="btn"> |
| | | <view class="btn-title">打卡</view> |
| | | <view class="btn-title" @click="goClock()">打卡</view> |
| | | <view class="btn-time">{{nowTime}}</view> |
| | | </view> |
| | | </view> |
| | |
| | | data() { |
| | | return { |
| | | urls: '', |
| | | nowTime:'' |
| | | nowTime:'', |
| | | name:'', |
| | | jd:'', |
| | | wd:'', |
| | | address:'' |
| | | } |
| | | }, |
| | | mounted() { |
| | |
| | | }, 1000); |
| | | }, |
| | | onLoad: function(options) { |
| | | //获取个人信息 |
| | | this.getOneselfInFo(); |
| | | //long 转换为字符串 |
| | | var code = JSON.stringify(this.$store.state.puserID.toString()); |
| | | this.urls = "http://s16s652780.51mypc.cn/xcxjingqingmap_clock_sign_in/xcxmap.html?snumber="+code; |
| | |
| | | methods: { |
| | | //获取当前位置信息 |
| | | getNowPosition(){ |
| | | var that = this; |
| | | uni.getLocation({ |
| | | type: 'wgs84', |
| | | geocode:'true', |
| | | success: function (res) { |
| | | debugger; |
| | | // debugger; |
| | | console.log('当前位置:' + res); |
| | | console.log('当前位置的经度:' + res.longitude); |
| | | console.log('当前位置的纬度:' + res.latitude); |
| | | that.jd = res.longitude; |
| | | that.wd = res.latitude; |
| | | } |
| | | }); |
| | | }, |
| | | //返回上一页 |
| | | goBack() { |
| | | uni.navigateBack({}) |
| | | }, |
| | | |
| | | //获取个人信息 |
| | | getOneselfInFo() { |
| | | var that = this; |
| | | //保安信息查询 |
| | | uni.request({ |
| | | url:'http://s16s652780.51mypc.cn/api/blade-user/details?id='+this.$store.state.puserID, |
| | | method:'POST', |
| | | success(resdata) { |
| | | that.name = resdata.data.data.realName; |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | //去打卡 |
| | | goClock() { |
| | | var that = this; |
| | | axios({ |
| | | method: "POST", |
| | | url: this.$store.state.piAPI + `/attendance/AppSave`, |
| | | params: { |
| | | number: this.$store.state.puserID, |
| | | name: this.name, |
| | | clockTime: this.getNowTime(1), |
| | | jd: this.jd, |
| | | wd: this.wd, |
| | | address: this.address |
| | | }, |
| | | }).then((resdata) => { |
| | | //不在考勤范围内 |
| | | if (resdata.data.code == 400) { |
| | | layui.use('layer', function() { |
| | | var layer = layui.layer; |
| | | layer.msg('打卡失败,不在考勤范围', { |
| | | icon: 0 |
| | | }); |
| | | }); |
| | | } |
| | | //打卡成功 |
| | | if (resdata.data.code == 200) { |
| | | layui.use('layer', function() { |
| | | var layer = layui.layer; |
| | | layer.msg('打卡成功!', { |
| | | icon: 1 |
| | | }); |
| | | }); |
| | | } |
| | | |
| | | }); |
| | | }, |
| | | |
| | | //获取当前时间 |
| | |
| | | flex-direction: row; |
| | | align-items: center; |
| | | // background-color:#0078A8; |
| | | width: 100%; |
| | | width: 92%; |
| | | margin: 0 auto; |
| | | height: 50px; |
| | | margin-top: 20px; |
| | | |
| | |
| | | |
| | | image { |
| | | // background-color: #00BFFF; |
| | | margin-left: 1rem; |
| | | width: 1.6rem; |
| | | height: 1.6rem; |
| | | } |