From bb311fd7334966122ed083ea4c9d5bf94f8b4474 Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Fri, 02 Jul 2021 18:17:43 +0800
Subject: [PATCH] 我要上报页面新增
---
pages/clockSignIn/clockSignIn.vue | 71 ++++++++++++++++++++++++++++++++---
1 files changed, 64 insertions(+), 7 deletions(-)
diff --git a/pages/clockSignIn/clockSignIn.vue b/pages/clockSignIn/clockSignIn.vue
index 49db344..62975b8 100644
--- a/pages/clockSignIn/clockSignIn.vue
+++ b/pages/clockSignIn/clockSignIn.vue
@@ -24,7 +24,7 @@
<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>
@@ -47,7 +47,11 @@
data() {
return {
urls: '',
- nowTime:''
+ nowTime:'',
+ name:'',
+ jd:'',
+ wd:'',
+ address:''
}
},
mounted() {
@@ -59,6 +63,8 @@
}, 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;
@@ -66,20 +72,71 @@
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
+ });
+ });
+ }
+
+ });
},
//获取当前时间
@@ -165,7 +222,8 @@
flex-direction: row;
align-items: center;
// background-color:#0078A8;
- width: 100%;
+ width: 92%;
+ margin: 0 auto;
height: 50px;
margin-top: 20px;
@@ -176,7 +234,6 @@
image {
// background-color: #00BFFF;
- margin-left: 1rem;
width: 1.6rem;
height: 1.6rem;
}
--
Gitblit v1.9.3