...
|
...
|
@@ -12,6 +12,9 @@ Page({ |
|
|
longitude: '',
|
|
|
time: '',
|
|
|
my_address: '',
|
|
|
timeInterval:{},
|
|
|
isshowCIty:''
|
|
|
|
|
|
},
|
|
|
|
|
|
onLoad: function (options) {
|
...
|
...
|
@@ -30,7 +33,7 @@ Page({ |
|
|
onShow: function () {
|
|
|
let that = this;
|
|
|
that.getList();
|
|
|
that.getaddredss()
|
|
|
// that.getaddredss()
|
|
|
// 获取经纬度
|
|
|
wx.getLocation({
|
|
|
success: function (res) {
|
...
|
...
|
@@ -61,10 +64,13 @@ Page({ |
|
|
})
|
|
|
|
|
|
// 获取时间点
|
|
|
var time = util.formathour(new Date());
|
|
|
this.setData({
|
|
|
time: time
|
|
|
this.data.timeInterval = setInterval(()=>{
|
|
|
var time = util.formathour(new Date());
|
|
|
that.setData({
|
|
|
time: time
|
|
|
})
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
},
|
...
|
...
|
@@ -112,8 +118,11 @@ Page({ |
|
|
app.post(url, d, head).then((res) => {
|
|
|
console.log(res)
|
|
|
wx.showToast({
|
|
|
title: '打卡成功',
|
|
|
title: '上岗打卡成功',
|
|
|
})
|
|
|
setTimeout(()=>{
|
|
|
that.getList()
|
|
|
},1200)
|
|
|
|
|
|
}).catch((err) => {
|
|
|
|
...
|
...
|
@@ -123,7 +132,7 @@ Page({ |
|
|
|
|
|
// 下岗打卡
|
|
|
getEnd() {
|
|
|
|
|
|
|
|
|
let that = this;
|
|
|
let url = '/index/second/endClock';
|
|
|
let head = {
|
...
|
...
|
@@ -131,6 +140,9 @@ Page({ |
|
|
}
|
|
|
let d = {
|
|
|
id: that.data.id,
|
|
|
long: that.data.latitude,
|
|
|
lat: that.data.longitude
|
|
|
|
|
|
|
|
|
|
|
|
}
|
...
|
...
|
@@ -138,8 +150,11 @@ Page({ |
|
|
app.post(url, d, head).then((res) => {
|
|
|
console.log(res)
|
|
|
wx.showToast({
|
|
|
title: '打卡成功',
|
|
|
title: '下岗打卡成功',
|
|
|
})
|
|
|
setTimeout(()=>{
|
|
|
that.getList()
|
|
|
},1200)
|
|
|
|
|
|
}).catch((err) => {
|
|
|
|
...
|
...
|
@@ -147,26 +162,26 @@ Page({ |
|
|
|
|
|
},
|
|
|
// 获取当前地址
|
|
|
getaddredss() {
|
|
|
// getaddredss() {
|
|
|
|
|
|
let that = this;
|
|
|
let url = '/index/second/clockInfo';
|
|
|
let head = {
|
|
|
'XX-Token': wx.getStorageSync('token')
|
|
|
}
|
|
|
let d = {
|
|
|
id: that.data.id
|
|
|
// let that = this;
|
|
|
// let url = '/index/second/clockInfo';
|
|
|
// let head = {
|
|
|
// 'XX-Token': wx.getStorageSync('token')
|
|
|
// }
|
|
|
// let d = {
|
|
|
// id: that.data.id
|
|
|
|
|
|
}
|
|
|
app.post(url, d, head).then((res) => {
|
|
|
that.setData({
|
|
|
adddress: res
|
|
|
})
|
|
|
// }
|
|
|
// app.post(url, d, head).then((res) => {
|
|
|
// that.setData({
|
|
|
// adddress: res
|
|
|
// })
|
|
|
|
|
|
}).catch((err) => {
|
|
|
// }).catch((err) => {
|
|
|
|
|
|
})
|
|
|
},
|
|
|
// })
|
|
|
// },
|
|
|
|
|
|
|
|
|
// 提示
|
...
|
...
|
@@ -177,7 +192,7 @@ Page({ |
|
|
},
|
|
|
|
|
|
onHide: function () {
|
|
|
|
|
|
clearInterval(this.data.timeInterval)
|
|
|
},
|
|
|
|
|
|
/**
|
...
|
...
|
|