Files
income_payments_applet/pages/meetingDetailSigned/meetingDetailSigned.js
T
2021-10-12 14:55:53 +08:00

166 lines
3.3 KiB
JavaScript

// pages/meeting/meeting.js
import {previewFile} from '../../assets/js/preview'
import MeetingApi from '../../assets/js/http/meetingApi'
Page({
/**
* 页面的初始数据
*/
data: {
payProveImage: '',
// 会议详情
meetingInfo:{},
// 参会人信息
singInPersonInfo:{},
// 会议通知文件资料数组
meetingFilesList:[],
// 会议资料文件数组
meetingDataList:[]
},
// 上传缴费凭证
uploadImage(){
const that = this
wx.chooseImage({
count: 1,
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success (res) {
// tempFilePath可以作为img标签的src属性显示图片
that.setData({
payProveImage: res.tempFilePaths
})
console.log(that.data.payProveImage)
}
})
},
// 删除缴费凭证
delete(){
this.setData({
payProveImage: ''
})
},
//参会人信息
queryPeronInfo(id){
MeetingApi.queryPersongInfoById({id:id}).then(res => {
if(res.success){
this.setData({
singInPersonInfo:res.result
})
}
})
},
// 通过文件id获取文件的相关信息
getFileInfo(id) {
return new Promise(resolve => {
let result = {}
MeetingApi.queryFileInfoById({ id: id }).then(res => {
if (res.success) {
result = res.result
}
}).finally(() => {
resolve(result)
})
})
},
// 获取文件信息
async initFileList(fileIds) {
if (fileIds) {
const fileList = []
let arr = fileIds.split(',')
for (let i = 0; i < arr.length; i++) {
let fileObj = {}
fileObj = await this.getFileInfo(arr[i])
fileList.push({ id: fileObj.id, name: fileObj.fileName })
}
return fileList
}
},
// 预览
previewFile(e) {
console.log(e);
const fileObj = e.currentTarget.dataset.file
previewFile(fileObj.id,fileObj.name)
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
// 获取上一个页面的会议数据
const meetingInfo = JSON.parse(options.meetingInfo)
const that = this
this.setData({
meetingInfo:meetingInfo
})
//
let {meetingFiles,meetingData} = meetingInfo
// 获取参会人信息
this.queryPeronInfo(meetingInfo.id)
// this.queryFileInfo(meetingFiles)
// 获取会议资料文件
this.initFileList(meetingData).then(res => {
that.setData({
meetingDataList:res
})
})
// 会议通知文件
this.initFileList(meetingFiles).then(res => {
that.setData({
meetingFilesList:res
})
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})