【修改】 微信扫码签到

This commit is contained in:
fengachen
2021-11-30 18:27:18 +08:00
parent b5f47b652e
commit ae7a2bbc6c
3 changed files with 65 additions and 17 deletions
+1 -1
View File
@@ -46,7 +46,7 @@ Page({
onlyFromCamera: false,
scanType: [],
success: (result) => {
if (result.result.indexOf("scanSign") > -1) { // 证明是签到二维码
if (result.result.indexOf("scansign") > -1) { // 证明是签到二维码
let meetingId = result.result.split("=")[1] // 会议Id
// let meetingId = result.result // 会议Id
// 成功扫码的回调
+2 -1
View File
@@ -65,7 +65,8 @@ Page({
onlyFromCamera: false,
scanType: [],
success: (result) => {
if (result.result.indexOf("scanSign") > -1) { // 证明是签到二维码
console.log(result,'saoma result');
if (result.result.indexOf("scansign") > -1) { // 证明是签到二维码
let meetingId = result.result.split("=")[1] // 会议Id
// let meetingId = result.result // 会议Id
// 成功扫码的回调
+62 -15
View File
@@ -1,5 +1,8 @@
import UserApi from '../../assets/js/http/userApi'
import {baseUrl, URL_CONFIG} from '../../assets/js/project.config.js'
import {
isLogin
} from '../../assets/js/common'
Page({
/**
@@ -65,28 +68,72 @@ Page({
wx.navigateTo({
url: `../signUpPageGuoji/signUpPageGuoji?meetingId=${this.data.form.meetingId}`,
})
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
let meeting = JSON.parse(options.meeting)
let src
if(meeting.checkFile){ // 签到名回显
src = baseUrl + URL_CONFIG + 'sys/common/download/' + meeting.checkFile
}else{
src = ''
// 这里是 微信扫码进入的逻辑
// 微信扫码 判断是否登录
if(options.q) {
// 登录过的就直接签到 否则跳转登录页
isLogin( () => {
let url = decodeURIComponent(options.q)
let meetingId = url.split('=')[1]
// 通过会议id 获取签到信息
UserApi.scanCode({
meetingId
}).then(res => {
if (res.success) {
this.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 {
// 未查到报名信息
this.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
})
}
this.setData({
isSigned: options.signed,
src
})
let form = JSON.parse(options.meeting)
this.setData({
form
})
},
/**