227 lines
5.2 KiB
JavaScript
227 lines
5.2 KiB
JavaScript
// pages/signUpEntrance/signUpEntrance.js
|
|
import MeetingApi from '../../assets/js/http/meetingApi'
|
|
import {
|
|
initFileList,
|
|
previewFile,
|
|
getFileInfo
|
|
} from '../../assets/js/preview'
|
|
import {
|
|
baseUrl,
|
|
URL_CONFIG
|
|
} from '../../assets/js/project.config.js'
|
|
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
// 会议详情信息
|
|
meetingDetailIngfo: {},
|
|
// 会议类型
|
|
meetingType: '',
|
|
// 标协会议类型 1标准宣贯 2学习培训
|
|
tbMeetingType: '',
|
|
// 会议通知文件资料数组
|
|
meetingFilesList: [],
|
|
// 缴费二维码的图片路径
|
|
payOrCode: '',
|
|
// 标协会议酒店信息
|
|
hotelContactsList: [],
|
|
// 当前会议是否超出时间
|
|
isMoreBool: false,
|
|
// 标协会议问题征集数据
|
|
questionList: []
|
|
},
|
|
compareCurrentTime(time) {
|
|
let date = new Date()
|
|
let compareTime = new Date(time)
|
|
if (date.getTime() > compareTime.getTime()) {
|
|
return true
|
|
} else {
|
|
return false
|
|
}
|
|
},
|
|
// 获取会议详情
|
|
queryMeetingDetail(id) {
|
|
const that = this
|
|
MeetingApi.meetingDetail({
|
|
id
|
|
}).then(res => {
|
|
if (res.success) {
|
|
that.setData({
|
|
meetingDetailIngfo: res.result,
|
|
meetingType: that.generateMeetingType(res.result.meetingType),
|
|
payOrCode: baseUrl + URL_CONFIG + 'sys/common/download/' + res.result.paymentQrCode,
|
|
tbMeetingType: that.generateTbMeetingType(res.result.tbMeetingType),
|
|
hotelContactsList: res.result.hotelContactsList,
|
|
questionList: res.result.questionList || []
|
|
})
|
|
console.log(that.data.hotelContactsList);
|
|
initFileList(res.result.meetingFiles).then(res => {
|
|
that.setData({
|
|
meetingFilesList: res,
|
|
})
|
|
})
|
|
// 判断当前会议是否超出时间
|
|
let flag = that.compareCurrentTime(res.result.registerDeadline)
|
|
if (flag) {
|
|
wx.showToast({
|
|
title: '当前会议超出报名时间,不可报名',
|
|
icon: 'none',
|
|
duration: 4000
|
|
})
|
|
that.setData({
|
|
isMoreBool: false
|
|
})
|
|
} else {
|
|
that.setData({
|
|
isMoreBool: true
|
|
})
|
|
}
|
|
|
|
}
|
|
}).catch(err => {
|
|
wx.showToast({
|
|
title: '加载失败',
|
|
icon: 'none'
|
|
})
|
|
})
|
|
},
|
|
// 报名
|
|
signUp() {
|
|
// 超出报名时间 提示
|
|
let flag = this.compareCurrentTime(this.data.meetingDetailIngfo.registerDeadline)
|
|
if (flag) {
|
|
wx.showToast({
|
|
title: '当前会议超出报名时间,不可报名',
|
|
icon: 'none',
|
|
duration: 2000
|
|
})
|
|
return
|
|
}
|
|
const that = this
|
|
// 企业列表与参会人列表调用的是无权限接口
|
|
wx.setStorage({
|
|
key: 'nolimit',
|
|
data: true
|
|
})
|
|
// 不同的会议通跳转不同的会议页面
|
|
let meetingType = this.data.meetingDetailIngfo.meetingType
|
|
wx.setStorage({
|
|
key: 'currentMeetingInfo',
|
|
data: that.data.meetingDetailIngfo
|
|
})
|
|
if (meetingType !== '3') {
|
|
wx.navigateTo({
|
|
url: `../signUpPage/signUpPage?meetingId=${this.data.meetingDetailIngfo.id}&nolimit=nolimit`,
|
|
})
|
|
} else {
|
|
wx.navigateTo({
|
|
url: `../signUpPageGuoji/signUpPageGuoji?meetingId=${this.data.meetingDetailIngfo.id}&nolimit=nolimit`,
|
|
})
|
|
}
|
|
},
|
|
// 会议类型
|
|
generateMeetingType(meetingType) {
|
|
switch (meetingType) {
|
|
case "1":
|
|
return "工作组会议"
|
|
case "2":
|
|
return "标协会议"
|
|
case "3":
|
|
return "国际研讨会议"
|
|
case "4":
|
|
return "其他会议"
|
|
case "5":
|
|
return "分标委会议"
|
|
case "6":
|
|
return "理事会会议"
|
|
}
|
|
},
|
|
// 标协会议类型
|
|
generateTbMeetingType(type) {
|
|
switch (type) {
|
|
case "1":
|
|
return "标准宣贯"
|
|
case "2":
|
|
return "学习培训"
|
|
case "3":
|
|
return "信息交流会"
|
|
}
|
|
},
|
|
// 预览文件
|
|
preview(e) {
|
|
const fileObj = e.currentTarget.dataset.file;
|
|
previewFile(fileObj.id, fileObj.name)
|
|
},
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
wx.setStorage({
|
|
key: 'companyDisabled',
|
|
data: false
|
|
})
|
|
let url = decodeURIComponent(options.q)
|
|
let meetingId = url.split('=')[1]
|
|
// todo 开发直接测试
|
|
// meetingId = '1681696011549757442' // 其他会议
|
|
meetingId = '1681693843581128706' // 国际研讨会
|
|
this.queryMeetingDetail(meetingId)
|
|
|
|
// this.queryMeetingDetail("1479397531946348545")
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function () {
|
|
wx.removeStorage({
|
|
key: 'selectedCompany',
|
|
})
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage: function () {
|
|
|
|
}
|
|
})
|