榆山
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.
 
 

164 lines
3.0 KiB

import {
getHouseInfo
} from '../../utils/api.js'
Page({
/**
* 页面的初始数据
*/
data: {
familyInfo:null,
showQr: true,
memberList:[],
roomCode:null,
},
/**
* 生命周期函数--监听页面加载
*/
async onLoad(options) {
wx.showLoading({
title: "加载中",
mask: true,
});
this.setData({
roomCode : options.roomCode.toString()
})
// this.setData({
// roomCode:'3702110100420037200006'
// })
wx.setStorage({
key: 'roomCode',
data: this.data.roomCode
})
await this.getInfo(this.data.roomCode)
wx.hideLoading()
},
/**
* 生命周期函数--监听页面显示
*/
async onShow() {
wx.showLoading({
title: "加载中",
mask: true,
});
let roomCode = wx.getStorageSync('roomCode')
this.setData({
roomCode : roomCode
})
await this.getInfo(this.data.roomCode)
wx.hideLoading()
},
// 获取房屋信息
async getInfo(code){
const res = await getHouseInfo({roomCode:code})
if(res.msg === 'success' && res.code === 0){
this.setData({
'familyInfo':res.data,
'roomCode':res.data.members
})
}
},
// 跳转新增页面
handleTo(){
wx.navigateTo({
url: '/subpages/family/pages/familyInfo/familyInfo?pageType=add&id='+ this.data.familyInfo.id
})
},
// 跳转查看页面
toFamilyInfo(e){
wx.navigateTo({
url: '/subpages/family/pages/familyInfo/familyInfo?pageType=look&idCard='+ e.currentTarget.dataset.id
})
},
// 取消编辑
cancel() {
this.setData({
showQr: true,
});
},
// 点击保存二维码
comfirmSave() {
wx.downloadFile({
url: this.data.familyInfo.maUrl,
success: function (res) {
let imageFilePath = res.tempFilePath;
wx.saveImageToPhotosAlbum({
filePath: imageFilePath,
success: function (data) {
wx.showToast({
title: '保存成功',
icon: 'none',
duration: 1500
});
},
fail: function (res) {
wx.showToast({
title: '保存失败',
icon: 'none',
duration: 1500
})
}
})
},
fail: (err) => {
wx.showToast({
title: '下载失败',
icon: 'none',
duration: 1500
})
}
})
},
handlePreview() {
if (!this.data.familyInfo.maUrl) return;
this.setData({
showQr: false,
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})