423 lines
10 KiB
JavaScript
423 lines
10 KiB
JavaScript
// pages/meeting/meeting.js
|
|
import {
|
|
appName
|
|
} from '../../assets/js/project.config'
|
|
import {
|
|
previewFile,
|
|
sliceFileTypeByFileName
|
|
} from '../../assets/js/preview'
|
|
|
|
import MeetingApi from '../../assets/js/http/meetingApi'
|
|
import signUpApi from '../../assets/js/http/signUp'
|
|
import UserApi from '../../assets/js/http/userApi'
|
|
import {
|
|
baseUrl,
|
|
URL_CONFIG
|
|
} from '../../assets/js/project.config.js'
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
payProveImage: '',
|
|
// 会议详情
|
|
meetingInfo: {},
|
|
// 参会人信息
|
|
singInPersonInfo: {},
|
|
// 会议通知文件资料数组
|
|
meetingFilesList: [],
|
|
// 会议资料文件数组
|
|
meetingDataList: [],
|
|
// 会议纪要文件数组
|
|
meetingJiyaoList:[],
|
|
// 演讲ppt
|
|
speechPptList: [],
|
|
// 照片
|
|
photoSrc: '',
|
|
// 缴费凭证id
|
|
imageIds: [],
|
|
// 订单后四位
|
|
ordeCode: '',
|
|
// 缴费凭证的回显
|
|
payRecordImgSrc: '',
|
|
// 收费二维码的回显
|
|
paymentQrCodeSrc:'',
|
|
// 签到图片的回显
|
|
signImgSrc: '',
|
|
userId: '',
|
|
form: {},
|
|
showSignInBtn:false, // 是否显示签到按钮
|
|
},
|
|
|
|
// 获取图片的id
|
|
getImagesId(e) {
|
|
this.setData({
|
|
imageIds: e.detail.join(',')
|
|
})
|
|
},
|
|
// 订单后四位
|
|
setOrdeCode(e) {
|
|
this.setData({
|
|
ordeCode: e.detail.value
|
|
})
|
|
},
|
|
// 上传汇款凭证
|
|
editPayRecord() {
|
|
|
|
if (this.data.imageIds.length === 0) {
|
|
wx.showToast({
|
|
title: '请上传缴费凭证',
|
|
icon: 'none'
|
|
})
|
|
return
|
|
}
|
|
if (this.data.singInPersonInfo.payMode === 2 && (this.data.ordeCode === '' || this.data.ordeCode === undefined || this.data.ordeCode === null)) {
|
|
wx.showToast({
|
|
title: '请输入缴费订单号后四位数',
|
|
icon: 'none'
|
|
})
|
|
return
|
|
} else if (this.data.singInPersonInfo.payMode === 2 && this.data.ordeCode && this.data.ordeCode.length < 4) {
|
|
// 线上缴费才去校验
|
|
wx.showToast({
|
|
title: '请输入四位缴费订单号后四位数',
|
|
icon: 'none'
|
|
})
|
|
return
|
|
}
|
|
const param = {
|
|
id: this.data.meetingInfo.situationId,
|
|
orderCode: this.data.ordeCode,
|
|
paymentRecord: this.data.imageIds
|
|
}
|
|
if (Array.isArray(this.data.imageIds)) {
|
|
param.paymentRecord = this.data.imageIds.join(',')
|
|
}
|
|
signUpApi.uploadPayRecord(param).then(res => {
|
|
console.log(res);
|
|
if (res.success) {
|
|
wx.showToast({
|
|
title: res.message,
|
|
icon: "success",
|
|
duration: 2000,
|
|
success() {
|
|
wx.navigateBack({
|
|
delta: 1,
|
|
})
|
|
}
|
|
});
|
|
|
|
} else {
|
|
wx.showToast({
|
|
title: res.message,
|
|
icon: "none",
|
|
duration: 800,
|
|
});
|
|
}
|
|
})
|
|
},
|
|
// 查看物流
|
|
lookProgress(e) {
|
|
let num = e.currentTarget.dataset.progress.postNo
|
|
wx.navigateTo({
|
|
url: `plugin://kdPlugin/index?num=${num}&appName=${appName}`,
|
|
})
|
|
},
|
|
//参会人信息
|
|
queryPeronInfo(id) {
|
|
MeetingApi.queryPersongInfoById({
|
|
id: id
|
|
}).then(res => {
|
|
if (res.success) {
|
|
this.setData({
|
|
singInPersonInfo: res.result,
|
|
ordeCode: res.result.orderCode,
|
|
})
|
|
// 演讲ppt、
|
|
if (res.result.speechPpt) {
|
|
this.initFileList(res.result.speechPpt).then(res => {
|
|
this.setData({
|
|
speechPptList: res
|
|
})
|
|
})
|
|
}
|
|
// 照片
|
|
if (res.result.photo) {
|
|
this.setData({
|
|
photoSrc: baseUrl + URL_CONFIG + 'sys/common/download/' + res.result.photo,
|
|
})
|
|
}
|
|
if (!!res.result.paymentRecord) {
|
|
this.setData({
|
|
// 这是为了不点击图片上传的bug
|
|
imageIds: res.result.paymentRecord.split(',')
|
|
})
|
|
}
|
|
// 已经审核的获取审核凭证的src
|
|
if (res.result.checkResult !== 0 && res.result.paymentRecord) {
|
|
this.setData({
|
|
payRecordImgSrc: baseUrl + URL_CONFIG + 'sys/common/download/' + res.result.paymentRecord,
|
|
})
|
|
}
|
|
console.log(this.data.payRecordImgSrc);
|
|
// 已经签到的获取签到的图片的src
|
|
if (res.result.checkIn === 1 && res.result.checkFile) {
|
|
this.setData({
|
|
signImgSrc: baseUrl + URL_CONFIG + 'sys/common/download/' + res.result.checkFile
|
|
})
|
|
console.log(this.data.signImgSrc, 'this.data.signImgSrc');
|
|
}
|
|
}
|
|
})
|
|
},
|
|
// 通过文件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
|
|
}
|
|
},
|
|
// 会议文件的预览
|
|
previewFileMeetingData(e) {
|
|
const that = this
|
|
// 只有审核通过的才可以去下载
|
|
if (this.data.singInPersonInfo.checkResult !== 1) {
|
|
wx.showToast({
|
|
title: '会议报名并审核通过后才可查看文件',
|
|
icon: 'none',
|
|
duration: 3000
|
|
})
|
|
return
|
|
}
|
|
const fileObj = e.currentTarget.dataset.file
|
|
let fileType = sliceFileTypeByFileName(fileObj.name)
|
|
// 文件类型不是docx,doc,pdf时,已邮件形式发送到参会人的邮箱
|
|
if (fileType !== 'docx' && fileType !== 'doc' && fileType !== 'pdf') {
|
|
wx.showModal({
|
|
title: '提示',
|
|
content: '将附件发送到您的邮箱',
|
|
success: function (res) {
|
|
if (res.confirm) {
|
|
//这里是点击了确定以后
|
|
let params = {
|
|
fileId: fileObj.id,
|
|
userId: that.data.userId
|
|
}
|
|
UserApi.sendEmail(params).then(res => {
|
|
if (res.success) {
|
|
wx.showToast({
|
|
title: '文件已发送到您的邮箱',
|
|
icon: 'none'
|
|
})
|
|
} else {
|
|
wx.showToast({
|
|
title: res.message,
|
|
icon: "none"
|
|
})
|
|
}
|
|
})
|
|
|
|
} else {
|
|
//这里是点击了取消以后
|
|
}
|
|
}
|
|
})
|
|
|
|
} else {
|
|
previewFile(fileObj.id, fileObj.name)
|
|
}
|
|
},
|
|
// 预览
|
|
previewFile(e) {
|
|
const fileObj = e.currentTarget.dataset.file
|
|
let fileType = sliceFileTypeByFileName(fileObj.name)
|
|
// 文件类型不是docx,doc,pdf时,已邮件形式发送到参会人的邮箱
|
|
if (fileType !== 'docx' && fileType !== 'doc' && fileType !== 'pdf') {
|
|
let params = {
|
|
fileId: fileObj.id,
|
|
userId: this.data.userId
|
|
}
|
|
UserApi.sendEmail(params).then(res => {
|
|
if (res.success) {
|
|
wx.showToast({
|
|
title: '文件已发送到您的邮箱',
|
|
icon: 'none'
|
|
})
|
|
} else {
|
|
wx.showToast({
|
|
title: res.message,
|
|
icon: "none"
|
|
})
|
|
}
|
|
})
|
|
} else {
|
|
previewFile(fileObj.id, fileObj.name)
|
|
}
|
|
},
|
|
// 去签到
|
|
toSignUp(){
|
|
let meetingId = this.data.meetingInfo.id
|
|
wx.navigateTo({
|
|
url: `../scanSign/scanSign?type=meetingDetail&meetingId=${meetingId}`,
|
|
})
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
|
|
// 获取上一个页面的会议数据
|
|
const meetingInfo = JSON.parse(options.meetingInfo)
|
|
console.log(meetingInfo);
|
|
const that = this
|
|
this.setData({
|
|
paymentQrCodeSrc:baseUrl + URL_CONFIG + 'sys/common/download/' + meetingInfo.paymentQrCode
|
|
})
|
|
MeetingApi.meetingDetail({id:meetingInfo.id}).then(res => {
|
|
if(res.success){
|
|
this.setData({
|
|
meetingInfo:res.result
|
|
})
|
|
}else{
|
|
this.setData({
|
|
meetingInfo:meetingInfo
|
|
})
|
|
}
|
|
})
|
|
// 如果会议的报名状态是待签到则显示去签到按钮 这里暂时写个5 不知道待签到的报名状态是几
|
|
if(this.data.meetingInfo.signUpStatus === 4){
|
|
this.setData({
|
|
showSignInBtn:true
|
|
})
|
|
}else{
|
|
this.setData({
|
|
showSignInBtn:false
|
|
})
|
|
}
|
|
|
|
wx.getStorage({
|
|
key: 'userInfo',
|
|
success(res) {
|
|
that.setData({
|
|
userId: res.data.id
|
|
})
|
|
}
|
|
})
|
|
UserApi.projectDetail({
|
|
id: meetingInfo.situationId
|
|
}).then(res => {
|
|
this.setData({
|
|
form: res.result
|
|
})
|
|
}).catch(err => {
|
|
wx.showToast({
|
|
title: '加载失败',
|
|
icon: 'none',
|
|
duration: 2000
|
|
})
|
|
})
|
|
//
|
|
let {
|
|
meetingFiles,
|
|
meetingData,
|
|
meetingMinute
|
|
} = meetingInfo
|
|
// 获取参会人信息
|
|
this.queryPeronInfo(meetingInfo.situationId)
|
|
// this.queryFileInfo(meetingFiles)
|
|
// 获取会议资料文件
|
|
this.initFileList(meetingData).then(res => {
|
|
that.setData({
|
|
meetingDataList: res
|
|
})
|
|
})
|
|
|
|
// 会议通知文件meetingFiles
|
|
this.initFileList(meetingFiles).then(res => {
|
|
that.setData({
|
|
meetingFilesList: res
|
|
})
|
|
})
|
|
// 会议纪要文件
|
|
this.initFileList(meetingMinute).then(res => {
|
|
that.setData({
|
|
meetingJiyaoList: res
|
|
})
|
|
})
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function () {},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage: function () {
|
|
|
|
}
|
|
})
|