163 lines
3.8 KiB
JavaScript
163 lines
3.8 KiB
JavaScript
import UserApi from '../../assets/js/http/userApi'
|
|
import {baseUrl, URL_CONFIG} from '../../assets/js/project.config.js'
|
|
import {
|
|
isLogin
|
|
} from '../../assets/js/common'
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
form: {},
|
|
isSigned: 1, // 是否报名
|
|
fileId: '', // 图片id
|
|
src: null // 签名之后,保存签名的图片地址
|
|
},
|
|
// 去签到页
|
|
scanSign(){
|
|
wx.navigateTo({
|
|
url: '../writtenSign/writtenSign',
|
|
})
|
|
},
|
|
// 确定签到
|
|
sureSign(){
|
|
let params = {
|
|
fileId: this.data.fileId,
|
|
meetingId: this.data.form.meetingId
|
|
}
|
|
UserApi.scanSure(params).then(res=>{
|
|
if(res.success){
|
|
this.setData({
|
|
'form.checkIn': 1
|
|
})
|
|
}else{
|
|
this.setData({
|
|
'form.checkIn': 0
|
|
})
|
|
if(res.message == '签到图片'){
|
|
wx.showToast({
|
|
title: '请手动签到',
|
|
icon: "none",
|
|
duration: 2000
|
|
})
|
|
}else{
|
|
wx.showToast({
|
|
title: res.message,
|
|
icon: "none",
|
|
duration: 2000
|
|
})
|
|
}
|
|
}
|
|
}).catch(err => {
|
|
wx.showToast({
|
|
title: '加载失败',
|
|
icon: 'none',
|
|
duration: 2000
|
|
})
|
|
})
|
|
},
|
|
// 去报名
|
|
goSignUp(){
|
|
// 国际研讨会去国际研讨会的报名
|
|
if(this.data.form.meetingType !== 3){
|
|
wx.navigateTo({
|
|
url: `../signUpPage/signUpPage?meetingId=${this.data.form.meetingId}`,
|
|
})
|
|
}else{
|
|
wx.navigateTo({
|
|
url: `../signUpPageGuoji/signUpPageGuoji?meetingId=${this.data.form.meetingId}`,
|
|
})
|
|
|
|
}
|
|
},
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
const that = this
|
|
// 这里是 微信扫码进入的逻辑
|
|
|
|
// 微信扫码 判断是否登录
|
|
if(options.q) {
|
|
// 登录过的就直接签到 否则跳转登录页
|
|
isLogin( () => {
|
|
let url = decodeURIComponent(options.q)
|
|
let meetingId = url.split('=')[1]
|
|
// 通过会议id 获取签到信息
|
|
UserApi.scanCode({
|
|
meetingId
|
|
}).then(res => {
|
|
wx.showToast({
|
|
title: '获取签到信息...',
|
|
icon: 'loading'
|
|
})
|
|
if (res.success) {
|
|
that.setData({
|
|
form:res.result
|
|
})
|
|
let src
|
|
if(res.result.checkFile){ // 签到名回显
|
|
src = baseUrl + URL_CONFIG + 'sys/common/download/' + res.result.checkFile
|
|
}else{
|
|
src = ''
|
|
}
|
|
this.setData({
|
|
isSigned: 1,
|
|
src
|
|
})
|
|
// wx.navigateTo({ // 已报名
|
|
// url: `../scanSign/scanSign?signed=1&meeting=${result}`,
|
|
// })
|
|
} else {
|
|
that.setData({
|
|
form:res.result
|
|
})
|
|
wx.showToast({
|
|
title: '未查到报名信息...',
|
|
icon: 'loading'
|
|
})
|
|
// 未查到报名信息
|
|
that.setData({
|
|
isSigned: 0,
|
|
})
|
|
}
|
|
}).catch(err => {})
|
|
})
|
|
}
|
|
|
|
// 这里是小程序内部的扫码签到
|
|
if(options.meeting){
|
|
let meeting = JSON.parse(options.meeting)
|
|
let src
|
|
if(meeting.checkFile){ // 签到名回显
|
|
src = baseUrl + URL_CONFIG + 'sys/common/download/' + meeting.checkFile
|
|
}else{
|
|
src = ''
|
|
}
|
|
this.setData({
|
|
isSigned: options.signed,
|
|
src
|
|
})
|
|
let form = JSON.parse(options.meeting)
|
|
this.setData({
|
|
form
|
|
})
|
|
}
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function () {
|
|
|
|
}
|
|
})
|