You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
165 lines
4.1 KiB
165 lines
4.1 KiB
2 years ago
|
// subpages/searchResult/pages/punchCard/punchCard.js
|
||
|
import api from "../../../../utils/api"
|
||
|
const QQMapWX = require('../../../../utils/qqmap-wx-jssdk')
|
||
|
|
||
|
var timerId= null;
|
||
|
Page({
|
||
|
|
||
|
/**
|
||
|
* 页面的初始数据
|
||
|
*/
|
||
|
data: {
|
||
|
form:{
|
||
|
name:"",
|
||
|
birthday:"",
|
||
|
mobile:"",
|
||
|
gridName:"",
|
||
|
homeName:"",
|
||
|
genderName:"",
|
||
|
},
|
||
|
resiId:"",
|
||
|
punchFlag:null,
|
||
|
currentTime:''
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面加载
|
||
|
*/
|
||
|
onLoad(options) {
|
||
|
console.log(options);
|
||
|
this.updateTime();
|
||
|
timerId = setInterval(this.updateTime, 1000);
|
||
|
console.log(timerId);
|
||
|
if(options.resiId){
|
||
|
this.setData({
|
||
|
resiId:options.resiId
|
||
|
})
|
||
|
console.log(this.data.resiId);
|
||
|
this.getResiDetail()
|
||
|
}
|
||
|
this.data.qqMapWX = new QQMapWX({
|
||
|
key: 'CMJBZ-4DECI-JXGGN-5B4WU-QLV2H-B5BEJ'
|
||
|
})
|
||
|
this.reverseLocation()
|
||
|
},
|
||
|
updateTime() {
|
||
|
let date = new Date();
|
||
|
let hours = date.getHours().toString().padStart(2, '0');
|
||
|
let minutes = date.getMinutes().toString().padStart(2, '0');
|
||
|
let seconds = date.getSeconds().toString().padStart(2, '0');
|
||
|
this.setData({
|
||
|
currentTime: `${hours}:${minutes}:${seconds}`
|
||
|
});
|
||
|
},
|
||
|
getResiDetail: async function() {
|
||
|
try {
|
||
|
let res = await api.getResiDetail(this.data.resiId);
|
||
|
const {birthday,mobile,name,houseInfo,genderName} = res.data;
|
||
|
this.setData({
|
||
|
'form.name':name,
|
||
|
'form.birthday':birthday,
|
||
|
'form.mobile':mobile,
|
||
|
'form.gridName' :houseInfo.gridName,
|
||
|
'form.homeName' :houseInfo.homeName,
|
||
|
'form.genderName' :genderName,
|
||
|
});
|
||
|
console.log(this.data.form);
|
||
|
} catch(err) {
|
||
|
console.log(err);
|
||
|
}
|
||
|
},
|
||
|
handlePunch(){
|
||
|
this.setData({
|
||
|
punchFlag:!this.data.punchFlag,
|
||
|
animationClass:'animate'
|
||
|
})
|
||
|
console.log(this.data.animationClass);
|
||
|
setTimeout(() => {
|
||
|
this.setData({ animationClass: '' });
|
||
|
}, 1500);
|
||
|
},
|
||
|
toAddResi(){
|
||
|
wx.navigateTo({
|
||
|
url: `/subpages/addResi/pages/addResi/addResi?type=edit&resiId=${this.data.resiId}`,
|
||
|
})
|
||
|
},
|
||
|
toEvent(){
|
||
|
let obj ={
|
||
|
resiId : this.data.resiId,
|
||
|
resiMobile : this.data.form.mobile,
|
||
|
resiName:this.data.form.name
|
||
|
}
|
||
|
wx.setStorageSync('resiDetail',obj)
|
||
|
wx.navigateTo({
|
||
|
url: '/subpages/demandCheck/pages/dissatisfied/demandCheck/demandCheck',
|
||
|
})
|
||
|
},
|
||
|
reverseLocation() {
|
||
|
const _this = this
|
||
|
this.data.qqMapWX.reverseGeocoder({
|
||
|
success(res) {
|
||
|
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,
|
||
|
})
|
||
|
},
|
||
|
fail(err) {
|
||
|
console.debug(err)
|
||
|
}
|
||
|
})
|
||
|
},
|
||
|
/**
|
||
|
* 生命周期函数--监听页面初次渲染完成
|
||
|
*/
|
||
|
onReady() {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面显示
|
||
|
*/
|
||
|
onShow() {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面隐藏
|
||
|
*/
|
||
|
onHide() {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面卸载
|
||
|
*/
|
||
|
onUnload() {
|
||
|
if (timerId) {
|
||
|
clearInterval(timerId);
|
||
|
timerId = null;
|
||
|
}
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||
|
*/
|
||
|
onPullDownRefresh() {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 页面上拉触底事件的处理函数
|
||
|
*/
|
||
|
onReachBottom() {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 用户点击右上角分享
|
||
|
*/
|
||
|
onShareAppMessage() {
|
||
|
|
||
|
}
|
||
|
})
|