|
|
@ -19,7 +19,10 @@ Page({ |
|
|
|
}, |
|
|
|
resiId:"", |
|
|
|
punchFlag:null, |
|
|
|
currentTime:'' |
|
|
|
currentTime:'', |
|
|
|
address:'', |
|
|
|
longitude:'', |
|
|
|
latitude:'', |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
@ -75,12 +78,28 @@ Page({ |
|
|
|
}) |
|
|
|
setTimeout(() => { |
|
|
|
this.setData({ animationClass: '' }); |
|
|
|
wx.showToast({ |
|
|
|
title: '打卡成功', |
|
|
|
icon:'none' |
|
|
|
}) |
|
|
|
this.clockRecords() |
|
|
|
|
|
|
|
}, 1500); |
|
|
|
}, |
|
|
|
clockRecords(){ |
|
|
|
let currentDate = new Date().toISOString().split('T')[0]; // 会得到形如 "2023-09-27" 的日期
|
|
|
|
let obj = { |
|
|
|
resiId:this.data.resiId, |
|
|
|
clockTime: currentDate + " " + this.data.currentTime, |
|
|
|
clockAddress: this.data.address, |
|
|
|
longitude:this.data.longitude , |
|
|
|
latitude:this.data.latitude |
|
|
|
} |
|
|
|
api.clockRecords(obj).then(res=>{ |
|
|
|
wx.showToast({ |
|
|
|
title: this.data.punchFlag?'打卡成功':'更新成功', |
|
|
|
icon:'none' |
|
|
|
}) |
|
|
|
}).catch(err=>{ |
|
|
|
console.log(err); |
|
|
|
}) |
|
|
|
}, |
|
|
|
toAddResi(){ |
|
|
|
wx.navigateTo({ |
|
|
|
url: `/subpages/addResi/pages/addResi/addResi?type=edit&resiId=${this.data.resiId}`, |
|
|
@ -110,9 +129,9 @@ Page({ |
|
|
|
console.log(res); |
|
|
|
_this.setData({ |
|
|
|
addressContent:res.result.address, |
|
|
|
// 'fmData.address': res.result.address,
|
|
|
|
// 'fmData.longitude':res.result.location.lng,
|
|
|
|
// 'fmData.latitude':res.result.location.lat,
|
|
|
|
address: res.result.address, |
|
|
|
longitude:res.result.location.lng, |
|
|
|
latitude:res.result.location.lat, |
|
|
|
}) |
|
|
|
}, |
|
|
|
fail(err) { |
|
|
|