登录逻辑修改,扫码签到逻辑完善
This commit is contained in:
+49
-24
@@ -1,5 +1,6 @@
|
||||
// pages/mine/mine.js
|
||||
import UserApi from '../../assets/js/http/userApi'
|
||||
import http from '../../assets/js/http/http'
|
||||
Page({
|
||||
|
||||
/**
|
||||
@@ -7,8 +8,9 @@ Page({
|
||||
*/
|
||||
data: {
|
||||
userId: '',
|
||||
name: '昵称',
|
||||
phone: ''
|
||||
name: '',
|
||||
phone: '未知手机号',
|
||||
rsaPublicKey: '',
|
||||
},
|
||||
// 个人信息
|
||||
mineInfo(){
|
||||
@@ -24,22 +26,34 @@ Page({
|
||||
},
|
||||
// 扫码签到
|
||||
scanCode(){
|
||||
wx.scanCode({
|
||||
onlyFromCamera: false,
|
||||
scanType: [],
|
||||
success: (result) => {
|
||||
console.log(result)
|
||||
},
|
||||
fail: (res) => {
|
||||
console.log(result)
|
||||
},
|
||||
complete: (res) => {
|
||||
console.log(result)
|
||||
},
|
||||
})
|
||||
// wx.navigateTo({
|
||||
// url: '../scanSign/scanSign',
|
||||
// wx.scanCode({
|
||||
// onlyFromCamera: false,
|
||||
// scanType: [],
|
||||
// success: (result) => {
|
||||
// console.log(result)
|
||||
// },
|
||||
// fail: (res) => {
|
||||
// console.log(result)
|
||||
// },
|
||||
// complete: (res) => {
|
||||
// console.log(result)
|
||||
// },
|
||||
// })
|
||||
// 成功扫码的回调 1448213074467938306,1448107789464113154
|
||||
UserApi.scanCode({meetingId: '1448213074467938306'}).then(res=>{
|
||||
if(res.success){
|
||||
let result = JSON.stringify(res.result)
|
||||
wx.navigateTo({
|
||||
url: `../scanSign/scanSign?signed=1&meeting=${result}`,
|
||||
})
|
||||
}else{
|
||||
let result = JSON.stringify(res.result)
|
||||
// 未查到报名信息
|
||||
wx.navigateTo({
|
||||
url: `../scanSign/scanSign?signed=0&meeting=${result}`,
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 我的资料
|
||||
mineData(){
|
||||
@@ -53,6 +67,12 @@ Page({
|
||||
url: '../mineContract/mineContract',
|
||||
})
|
||||
},
|
||||
// 去登录
|
||||
goLogin(){
|
||||
wx.navigateTo({
|
||||
url: '../login/login',
|
||||
})
|
||||
},
|
||||
// 退出登录
|
||||
logout(){
|
||||
wx.showModal({
|
||||
@@ -82,17 +102,22 @@ Page({
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
let userInfo = wx.getStorageSync('userInfo')
|
||||
this.setData({
|
||||
name: userInfo.name,
|
||||
phone: userInfo.phone.substr(0, 3) + '-' + userInfo.phone.substr(3, 4) + '-' + userInfo.phone.substr(7, 4)
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
let userInfo = wx.getStorageSync('userInfo')
|
||||
let token = wx.getStorageSync('X-Access-Token')
|
||||
this.setData({
|
||||
token
|
||||
})
|
||||
if(userInfo){
|
||||
this.setData({
|
||||
name: userInfo.name,
|
||||
phone: userInfo.phone.substr(0, 3) + '-' + userInfo.phone.substr(3, 4) + '-' + userInfo.phone.substr(7, 4)
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user