【bug】 bug修改 微信扫描二维码签到登录后跳转的问题
This commit is contained in:
@@ -54,4 +54,28 @@ export function isLogin(callback) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 微信扫描二维码的签到 检验是否登录
|
||||||
|
* @param successCallback 确定登录后的回调
|
||||||
|
* @param meetingId 失败后 需要将meetingId 存入缓存 为了下次登录后跳转 签到页面 接口获取信息用
|
||||||
|
*/
|
||||||
|
export function isLoginSignIn(successCallback,meetingId) {
|
||||||
|
wx.getStorage({
|
||||||
|
key: 'X-Access-Token',
|
||||||
|
success(res) {
|
||||||
|
successCallback()
|
||||||
|
},
|
||||||
|
fail() {
|
||||||
|
// 设置是否是签到的登录
|
||||||
|
wx.setStorage({
|
||||||
|
key:"isSignLogin",
|
||||||
|
data:meetingId
|
||||||
|
})
|
||||||
|
wx.navigateTo({
|
||||||
|
url: '../login/login',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
@@ -52,25 +52,37 @@ Page({
|
|||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 邮编
|
|
||||||
if (formData.postalCode === '') {
|
// 银行账号
|
||||||
|
if (formData.bankAccount === '') {
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
title: '请输入邮编',
|
title: '请输入银行账号',
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
duration: 800
|
duration: 800
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.data.flag){
|
// 开户行
|
||||||
|
if (formData.openingBank === '') {
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
title: '信息输入有误',
|
title: '请输入开户行',
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
duration: 800
|
duration: 800
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// if(this.data.flag){
|
||||||
|
// wx.showToast({
|
||||||
|
// title: '信息输入有误',
|
||||||
|
// icon: 'none',
|
||||||
|
// duration: 800
|
||||||
|
// })
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
|
||||||
const that = this
|
const that = this
|
||||||
let pages = getCurrentPages()
|
let pages = getCurrentPages()
|
||||||
let prevPage = pages[pages.length - 3];
|
let prevPage = pages[pages.length - 3];
|
||||||
|
|||||||
@@ -40,21 +40,22 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="wx-form-item">
|
<view class="wx-form-item">
|
||||||
<view class="wx-form-label validate">邮编:</view>
|
<view class="wx-form-label">邮政编码:</view>
|
||||||
<view class="wx-form-value">
|
<view class="wx-form-value">
|
||||||
<input name="postalCode" placeholder="请输入邮编" maxlength="6" type="number" bindblur="validatePostCode" data-message='请输入邮编' data-errmsg='请输入正确的邮编' />
|
<!-- bindblur="validatePostCode" data-message='请输入邮编' data-errmsg='请输入正确的邮编'-->
|
||||||
|
<input name="postalCode" placeholder="请输入邮政编码:" maxlength="6" type="number" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="wx-form-item">
|
<view class="wx-form-item">
|
||||||
<view class="wx-form-label">银行账号:</view>
|
<view class="wx-form-label validate">银行账号:</view>
|
||||||
<view class="wx-form-value">
|
<view class="wx-form-value">
|
||||||
<input name="bankAccount" placeholder="请输入银行账号" maxlength="50" type="number" />
|
<input name="bankAccount" placeholder="请输入银行账号" maxlength="50" type="number" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="wx-form-item">
|
<view class="wx-form-item">
|
||||||
<view class="wx-form-label">开户行:</view>
|
<view class="wx-form-label validate">开户行:</view>
|
||||||
<view class="wx-form-value">
|
<view class="wx-form-value">
|
||||||
<input name="openingBank" placeholder="请输入开户行" maxlength="50" />
|
<input name="openingBank" placeholder="请输入开户行" maxlength="50" />
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
+81
-42
@@ -1,8 +1,14 @@
|
|||||||
// pages/mine/mine.js
|
// pages/mine/mine.js
|
||||||
import UserApi from '../../assets/js/http/userApi'
|
import UserApi from '../../assets/js/http/userApi'
|
||||||
import { encrypt } from '../../assets/js/jsencrypt/rsa'
|
import {
|
||||||
import { wxBind } from '../../assets/js/common'
|
encrypt
|
||||||
import {appletName} from "../../assets/js/project.config"
|
} from '../../assets/js/jsencrypt/rsa'
|
||||||
|
import {
|
||||||
|
wxBind
|
||||||
|
} from '../../assets/js/common'
|
||||||
|
import {
|
||||||
|
appletName
|
||||||
|
} from "../../assets/js/project.config"
|
||||||
var countdown = 60; // 倒计时秒数
|
var countdown = 60; // 倒计时秒数
|
||||||
Page({
|
Page({
|
||||||
data: {
|
data: {
|
||||||
@@ -12,7 +18,7 @@ Page({
|
|||||||
openId: '',
|
openId: '',
|
||||||
count: 60,
|
count: 60,
|
||||||
userInfoTemp: '',
|
userInfoTemp: '',
|
||||||
appletName:appletName,
|
appletName: appletName,
|
||||||
rsaPublicKey: '',
|
rsaPublicKey: '',
|
||||||
showGetCaptcha: true,
|
showGetCaptcha: true,
|
||||||
authorize: false // 默认没有微信授权
|
authorize: false // 默认没有微信授权
|
||||||
@@ -63,7 +69,7 @@ Page({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 倒计时
|
// 倒计时
|
||||||
countDown(){
|
countDown() {
|
||||||
if (countdown === 0) {
|
if (countdown === 0) {
|
||||||
this.setData({
|
this.setData({
|
||||||
showGetCaptcha: true
|
showGetCaptcha: true
|
||||||
@@ -85,12 +91,12 @@ Page({
|
|||||||
// 倒计时 end
|
// 倒计时 end
|
||||||
},
|
},
|
||||||
// 手机号密码登录页
|
// 手机号密码登录页
|
||||||
phonePassword(){
|
phonePassword() {
|
||||||
wx.navigateTo({
|
wx.navigateTo({
|
||||||
url: '../phonePassword/phonePassword',
|
url: '../phonePassword/phonePassword',
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
goBack(){
|
goBack() {
|
||||||
wx.navigateBack()
|
wx.navigateBack()
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -101,24 +107,24 @@ Page({
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 微信登录
|
// 微信登录
|
||||||
wxLogin(){
|
wxLogin() {
|
||||||
const that = this
|
const that = this
|
||||||
wx.getStorage({
|
wx.getStorage({
|
||||||
key: 'authorize',
|
key: 'authorize',
|
||||||
success(result){
|
success(result) {
|
||||||
// 做过查看微信用户信息
|
// 做过查看微信用户信息
|
||||||
if(result.data){ // 做过用户信息获取
|
if (result.data) { // 做过用户信息获取
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
title: '登录中...',
|
title: '登录中...',
|
||||||
icon: 'loading'
|
icon: 'loading'
|
||||||
})
|
})
|
||||||
wxBind((res)=>{
|
wxBind((res) => {
|
||||||
let params = {
|
let params = {
|
||||||
openId: encrypt(that.data.rsaPublicKey,res.result.openid),
|
openId: encrypt(that.data.rsaPublicKey, res.result.openid),
|
||||||
rsaPublicKey: that.data.rsaPublicKey
|
rsaPublicKey: that.data.rsaPublicKey
|
||||||
}
|
}
|
||||||
UserApi.wxLogin(params).then(res=>{
|
UserApi.wxLogin(params).then(res => {
|
||||||
if(res.success) {// 已经用手机号登录过,此时用微信快捷登录时,把微信的个人信息存进缓存(微信信息在缓存的userInfoTemp)
|
if (res.success) { // 已经用手机号登录过,此时用微信快捷登录时,把微信的个人信息存进缓存(微信信息在缓存的userInfoTemp)
|
||||||
wx.setStorageSync('userInfo', res.result.userInfo)
|
wx.setStorageSync('userInfo', res.result.userInfo)
|
||||||
wx.setStorage({
|
wx.setStorage({
|
||||||
key: 'X-Access-Token',
|
key: 'X-Access-Token',
|
||||||
@@ -129,10 +135,26 @@ Page({
|
|||||||
key: 'avatarUrl',
|
key: 'avatarUrl',
|
||||||
data: result.avatarUrl
|
data: result.avatarUrl
|
||||||
})
|
})
|
||||||
wx.switchTab({
|
// 判断是否是微信扫描二维码签到 的登录 如果是 需要跳转到签到页面
|
||||||
url: '../home/home',
|
wx.getStorage({
|
||||||
|
key: 'isSignLogin',
|
||||||
|
success(res) {
|
||||||
|
console.log(res.data)
|
||||||
|
if (res.data) {
|
||||||
|
wx.navigateTo({
|
||||||
|
url: `../scanSign/scanSign?isLoginSignIn=${res.data}`,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail() {
|
||||||
|
console.log('fail');
|
||||||
|
// 跳转首页
|
||||||
|
wx.switchTab({
|
||||||
|
url: '../home/home',
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}else{ // 首次登录不能直接用微信快捷登录
|
} else { // 首次登录不能直接用微信快捷登录
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
title: '暂无授权手机号',
|
title: '暂无授权手机号',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
@@ -140,18 +162,18 @@ Page({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}else{
|
} else {
|
||||||
that.getUserInfo()
|
that.getUserInfo()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fail(err){
|
fail(err) {
|
||||||
// 没有做过查看微信用户信息
|
// 没有做过查看微信用户信息
|
||||||
that.getUserInfo()
|
that.getUserInfo()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 获取用户信息,微信登录
|
// 获取用户信息,微信登录
|
||||||
getUserInfo(){
|
getUserInfo() {
|
||||||
const that = this
|
const that = this
|
||||||
wx.showModal({
|
wx.showModal({
|
||||||
title: '温馨提示',
|
title: '温馨提示',
|
||||||
@@ -160,7 +182,7 @@ Page({
|
|||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
wx.getUserProfile({
|
wx.getUserProfile({
|
||||||
desc: '获取你的昵称、头像、地区及性别',
|
desc: '获取你的昵称、头像、地区及性别',
|
||||||
success(result){
|
success(result) {
|
||||||
let userInfoTemp = JSON.parse(result.rawData)
|
let userInfoTemp = JSON.parse(result.rawData)
|
||||||
wx.setStorage({
|
wx.setStorage({
|
||||||
key: 'userInfoTemp',
|
key: 'userInfoTemp',
|
||||||
@@ -173,14 +195,14 @@ Page({
|
|||||||
title: '登录中...',
|
title: '登录中...',
|
||||||
icon: 'loading'
|
icon: 'loading'
|
||||||
})
|
})
|
||||||
wxBind((res)=>{
|
wxBind((res) => {
|
||||||
let params = {
|
let params = {
|
||||||
openId: encrypt(that.data.rsaPublicKey,res.result.openid),
|
openId: encrypt(that.data.rsaPublicKey, res.result.openid),
|
||||||
rsaPublicKey: that.data.rsaPublicKey
|
rsaPublicKey: that.data.rsaPublicKey
|
||||||
}
|
}
|
||||||
console.log(params.openId,'params.openiD');
|
console.log(params.openId, 'params.openiD');
|
||||||
UserApi.wxLogin(params).then(res=>{
|
UserApi.wxLogin(params).then(res => {
|
||||||
if(res.success) {// 已经用手机号登录过,此时用微信快捷登录时,把微信的个人信息存进缓存(微信信息在缓存的userInfoTemp)
|
if (res.success) { // 已经用手机号登录过,此时用微信快捷登录时,把微信的个人信息存进缓存(微信信息在缓存的userInfoTemp)
|
||||||
wx.setStorageSync('userInfo', res.result.userInfo)
|
wx.setStorageSync('userInfo', res.result.userInfo)
|
||||||
wx.setStorage({
|
wx.setStorage({
|
||||||
key: 'X-Access-Token',
|
key: 'X-Access-Token',
|
||||||
@@ -191,7 +213,7 @@ Page({
|
|||||||
})
|
})
|
||||||
wx.setStorageSync('authorize', true) // 设置有过微信授权
|
wx.setStorageSync('authorize', true) // 设置有过微信授权
|
||||||
wx.setStorageSync('avatarUrl', that.data.userInfoTemp.avatarUrl)
|
wx.setStorageSync('avatarUrl', that.data.userInfoTemp.avatarUrl)
|
||||||
}else{ // 首次登录不能直接用微信快捷登录
|
} else { // 首次登录不能直接用微信快捷登录
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
title: '暂无授权手机号',
|
title: '暂无授权手机号',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
@@ -200,7 +222,7 @@ Page({
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
fail(err){
|
fail(err) {
|
||||||
wx.setStorageSync('authorize', false)
|
wx.setStorageSync('authorize', false)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -223,7 +245,7 @@ Page({
|
|||||||
}
|
}
|
||||||
if (e.detail.value.phone && e.detail.value.captcha) {
|
if (e.detail.value.phone && e.detail.value.captcha) {
|
||||||
let params = {
|
let params = {
|
||||||
username: encrypt(this.data.rsaPublicKey,e.detail.value.phone), // 手机号加密
|
username: encrypt(this.data.rsaPublicKey, e.detail.value.phone), // 手机号加密
|
||||||
captcha: e.detail.value.captcha,
|
captcha: e.detail.value.captcha,
|
||||||
rsaPublicKey: this.data.rsaPublicKey
|
rsaPublicKey: this.data.rsaPublicKey
|
||||||
}
|
}
|
||||||
@@ -231,7 +253,7 @@ Page({
|
|||||||
UserApi.codeLogin(params).then(res => {
|
UserApi.codeLogin(params).then(res => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
// 第一次登录系统,需要设置密码
|
// 第一次登录系统,需要设置密码
|
||||||
if(res.message === "updatePassword") {
|
if (res.message === "updatePassword") {
|
||||||
// 存临时token
|
// 存临时token
|
||||||
wx.setStorage({
|
wx.setStorage({
|
||||||
key: 'token-temp',
|
key: 'token-temp',
|
||||||
@@ -242,7 +264,7 @@ Page({
|
|||||||
wx.navigateTo({
|
wx.navigateTo({
|
||||||
url: `../setPassword/setPassword?userInfo=${userInfo}`,
|
url: `../setPassword/setPassword?userInfo=${userInfo}`,
|
||||||
})
|
})
|
||||||
}else{
|
} else {
|
||||||
// 存token和userInfo
|
// 存token和userInfo
|
||||||
wx.setStorage({
|
wx.setStorage({
|
||||||
key: 'X-Access-Token',
|
key: 'X-Access-Token',
|
||||||
@@ -254,10 +276,27 @@ Page({
|
|||||||
})
|
})
|
||||||
// 绑定微信
|
// 绑定微信
|
||||||
this.wxBindPhone()
|
this.wxBindPhone()
|
||||||
// 跳转首页
|
// 判断是否是微信扫描二维码签到 的登录 如果是 需要跳转到签到页面
|
||||||
wx.switchTab({
|
wx.getStorage({
|
||||||
url: '../home/home',
|
key: 'isSignLogin',
|
||||||
|
success(res) {
|
||||||
|
console.log(res.data)
|
||||||
|
if (res.data) {
|
||||||
|
wx.navigateTo({
|
||||||
|
url: `../scanSign/scanSign?isLoginSignIn=${res.data}`,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail() {
|
||||||
|
console.log('fail');
|
||||||
|
// 跳转首页
|
||||||
|
wx.switchTab({
|
||||||
|
url: '../home/home',
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
@@ -277,21 +316,21 @@ Page({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 忘记密码
|
// 忘记密码
|
||||||
updateInfo(){
|
updateInfo() {
|
||||||
wx.navigateTo({
|
wx.navigateTo({
|
||||||
url: '../forgetPassword/forgetPassword',
|
url: '../forgetPassword/forgetPassword',
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 绑定微信
|
// 绑定微信
|
||||||
wxBindPhone(){
|
wxBindPhone() {
|
||||||
const that = this
|
const that = this
|
||||||
wxBind((res)=>{
|
wxBind((res) => {
|
||||||
let params = {
|
let params = {
|
||||||
openId: encrypt(that.data.rsaPublicKey,res.result.openid),
|
openId: encrypt(that.data.rsaPublicKey, res.result.openid),
|
||||||
rsaPublicKey: that.data.rsaPublicKey
|
rsaPublicKey: that.data.rsaPublicKey
|
||||||
}
|
}
|
||||||
// 需要判断是否绑定过微信,再进行绑定请求
|
// 需要判断是否绑定过微信,再进行绑定请求
|
||||||
UserApi.wxBind(params).then(res=>{})
|
UserApi.wxBind(params).then(res => {})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// onLoad(){
|
// onLoad(){
|
||||||
@@ -312,7 +351,7 @@ Page({
|
|||||||
const that = this
|
const that = this
|
||||||
wx.getStorage({
|
wx.getStorage({
|
||||||
key: 'userInfoTemp',
|
key: 'userInfoTemp',
|
||||||
success(res){
|
success(res) {
|
||||||
that.setData({
|
that.setData({
|
||||||
userInfoTemp: res.data
|
userInfoTemp: res.data
|
||||||
})
|
})
|
||||||
@@ -327,7 +366,7 @@ Page({
|
|||||||
key: 'rsaPublicKey',
|
key: 'rsaPublicKey',
|
||||||
data: res.result
|
data: res.result
|
||||||
})
|
})
|
||||||
}else{
|
} else {
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
title: res.message,
|
title: res.message,
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
@@ -342,4 +381,4 @@ Page({
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
<view class="list-item" wx:for="{{meetingList}}" bindtap="meetingDetail" data-meetinginfo="{{item}}" wx:key="item">
|
<view class="list-item" wx:for="{{meetingList}}" bindtap="meetingDetail" data-meetinginfo="{{item}}" wx:key="item">
|
||||||
<view class="title">
|
<view class="title">
|
||||||
<text>{{item.meetingName}}</text>
|
<text>{{item.meetingName}}</text>
|
||||||
<text>{{item.startTime}}</text>
|
<text style="min-width:100px">{{item.startTime}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="content-text">
|
<view class="content-text">
|
||||||
<image mode="aspectFill" src="../../assets/images/personnel.png"></image>
|
<image mode="aspectFill" src="../../assets/images/personnel.png"></image>
|
||||||
|
|||||||
@@ -529,9 +529,9 @@
|
|||||||
<text>签到时间</text>
|
<text>签到时间</text>
|
||||||
<text>{{singInPersonInfo.checkInTime}}</text>
|
<text>{{singInPersonInfo.checkInTime}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view style='width:100%;height:120px'>
|
<view style='width:100%;height:120px;display:flex;padding-right:30rpx;box-sizing:border-box'>
|
||||||
<text>签到信息</text>
|
<text>签到信息</text>
|
||||||
<image style='margin-right:30px' class="back-img" src="{{signImgSrc}}"></image>
|
<image class="back-img" src="{{signImgSrc}}"></image>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 签到信息end -->
|
<!-- 签到信息end -->
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
// pages/meeting/meeting.js
|
// pages/meeting/meeting.js
|
||||||
import UserApi from '../../assets/js/http/userApi'
|
import UserApi from '../../assets/js/http/userApi'
|
||||||
import { encrypt } from '../../assets/js/jsencrypt/rsa'
|
import {
|
||||||
import { wxBind } from '../../assets/js/common'
|
encrypt
|
||||||
|
} from '../../assets/js/jsencrypt/rsa'
|
||||||
|
import {
|
||||||
|
wxBind
|
||||||
|
} from '../../assets/js/common'
|
||||||
|
|
||||||
Page({
|
Page({
|
||||||
|
|
||||||
@@ -21,18 +25,20 @@ Page({
|
|||||||
rsaPublicKey: '', // 公钥
|
rsaPublicKey: '', // 公钥
|
||||||
flag: false
|
flag: false
|
||||||
},
|
},
|
||||||
showPassword(){
|
showPassword() {
|
||||||
this.setData({
|
this.setData({
|
||||||
show: !this.data.show
|
show: !this.data.show
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
goBack(){
|
goBack() {
|
||||||
wx.navigateBack()
|
wx.navigateBack()
|
||||||
},
|
},
|
||||||
// 改变验证码
|
// 改变验证码
|
||||||
handleChangeCheckCode() {
|
handleChangeCheckCode() {
|
||||||
this.data.currdatetime = new Date().getTime()
|
this.data.currdatetime = new Date().getTime()
|
||||||
UserApi.sendImage({time: this.data.currdatetime}).then(res=>{
|
UserApi.sendImage({
|
||||||
|
time: this.data.currdatetime
|
||||||
|
}).then(res => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
this.setData({
|
this.setData({
|
||||||
"form.randCodeImage": res.result,
|
"form.randCodeImage": res.result,
|
||||||
@@ -49,7 +55,7 @@ Page({
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
clearrepeatval(){
|
clearrepeatval() {
|
||||||
this.data.vals = []
|
this.data.vals = []
|
||||||
this.setData({
|
this.setData({
|
||||||
password: ''
|
password: ''
|
||||||
@@ -61,22 +67,22 @@ Page({
|
|||||||
const vals = this.data.vals
|
const vals = this.data.vals
|
||||||
// 获取当前输入的值
|
// 获取当前输入的值
|
||||||
const currentval = e.detail.value.replace(/\s+/g, "")
|
const currentval = e.detail.value.replace(/\s+/g, "")
|
||||||
if(currentval){ // 如果值存在追加到vals中
|
if (currentval) { // 如果值存在追加到vals中
|
||||||
vals.push(currentval)
|
vals.push(currentval)
|
||||||
}
|
}
|
||||||
if(vals.length == 1 ){
|
if (vals.length == 1) {
|
||||||
const v = vals[vals.length-1].length
|
const v = vals[vals.length - 1].length
|
||||||
if(v > 1){ // 如果第一个的长度就大于1 说明是粘贴过来的
|
if (v > 1) { // 如果第一个的长度就大于1 说明是粘贴过来的
|
||||||
this.clearrepeatval()
|
this.clearrepeatval()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(vals.length > 1){
|
if (vals.length > 1) {
|
||||||
// 如果值数组大于1 就获取最后一个值长度和倒数第二个值长度
|
// 如果值数组大于1 就获取最后一个值长度和倒数第二个值长度
|
||||||
// 比较值长度差如果大于1 则粘贴的
|
// 比较值长度差如果大于1 则粘贴的
|
||||||
const lastv = vals[vals.length-1].length // 获取最后一个值的长度
|
const lastv = vals[vals.length - 1].length // 获取最后一个值的长度
|
||||||
const secondv = vals[vals.length-2].length // 获取倒数第二个值得长度
|
const secondv = vals[vals.length - 2].length // 获取倒数第二个值得长度
|
||||||
const dis = lastv - secondv
|
const dis = lastv - secondv
|
||||||
if(dis>1){
|
if (dis > 1) {
|
||||||
this.clearrepeatval()
|
this.clearrepeatval()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -85,7 +91,7 @@ Page({
|
|||||||
},
|
},
|
||||||
// 提交
|
// 提交
|
||||||
formSubmit(e) {
|
formSubmit(e) {
|
||||||
if(!e.detail.value.phone){
|
if (!e.detail.value.phone) {
|
||||||
this.data.flag = false
|
this.data.flag = false
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
title: '请输入手机号',
|
title: '请输入手机号',
|
||||||
@@ -95,7 +101,7 @@ Page({
|
|||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
let pattern = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/
|
let pattern = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/
|
||||||
if(!pattern.test(e.detail.value.phone)){
|
if (!pattern.test(e.detail.value.phone)) {
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
title: '请输入正确的手机号!',
|
title: '请输入正确的手机号!',
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
@@ -107,7 +113,7 @@ Page({
|
|||||||
this.data.flag = true
|
this.data.flag = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!e.detail.value.password){
|
if (!e.detail.value.password) {
|
||||||
this.data.flag = false
|
this.data.flag = false
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
title: '请输入密码',
|
title: '请输入密码',
|
||||||
@@ -118,7 +124,7 @@ Page({
|
|||||||
} else {
|
} else {
|
||||||
this.data.flag = true
|
this.data.flag = true
|
||||||
}
|
}
|
||||||
if(!e.detail.value.captcha){
|
if (!e.detail.value.captcha) {
|
||||||
this.data.flag = false
|
this.data.flag = false
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
title: '请输入验证码',
|
title: '请输入验证码',
|
||||||
@@ -126,7 +132,7 @@ Page({
|
|||||||
duration: 2000
|
duration: 2000
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}else{
|
} else {
|
||||||
this.data.flag = true
|
this.data.flag = true
|
||||||
}
|
}
|
||||||
console.log('form发生了submit事件,携带数据为:', e.detail.value)
|
console.log('form发生了submit事件,携带数据为:', e.detail.value)
|
||||||
@@ -137,10 +143,10 @@ Page({
|
|||||||
captcha: e.detail.value.captcha,
|
captcha: e.detail.value.captcha,
|
||||||
rsaPublicKey: this.data.rsaPublicKey,
|
rsaPublicKey: this.data.rsaPublicKey,
|
||||||
}
|
}
|
||||||
if(this.data.flag){
|
if (this.data.flag) {
|
||||||
UserApi.passWordLogin(params).then(res => {
|
UserApi.passWordLogin(params).then(res => {
|
||||||
if(res.success){
|
if (res.success) {
|
||||||
if(res.message == '请先用手机号登录'){
|
if (res.message == '请先用手机号登录') {
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
title: '首次登录请用验证码方式登录',
|
title: '首次登录请用验证码方式登录',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
@@ -149,7 +155,7 @@ Page({
|
|||||||
wx.navigateBack()
|
wx.navigateBack()
|
||||||
}, 2000);
|
}, 2000);
|
||||||
return
|
return
|
||||||
}else{
|
} else {
|
||||||
// 绑定微信
|
// 绑定微信
|
||||||
this.wxBindPhone()
|
this.wxBindPhone()
|
||||||
// 存token和userInfo
|
// 存token和userInfo
|
||||||
@@ -161,12 +167,27 @@ Page({
|
|||||||
key: 'userInfo',
|
key: 'userInfo',
|
||||||
data: res.result.userInfo
|
data: res.result.userInfo
|
||||||
})
|
})
|
||||||
// 跳转首页
|
// 判断是否是微信扫描二维码签到 的登录 如果是 需要跳转到签到页面
|
||||||
wx.switchTab({
|
wx.getStorage({
|
||||||
url: '../home/home',
|
key: 'isSignLogin',
|
||||||
|
success(res) {
|
||||||
|
console.log(res.data)
|
||||||
|
if (res.data) {
|
||||||
|
wx.navigateTo({
|
||||||
|
url: `../scanSign/scanSign?isLoginSignIn=${res.data}`,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail() {
|
||||||
|
console.log('fail');
|
||||||
|
// 跳转首页
|
||||||
|
wx.switchTab({
|
||||||
|
url: '../home/home',
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
title: res.message,
|
title: res.message,
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
@@ -175,7 +196,7 @@ Page({
|
|||||||
this.handleChangeCheckCode()
|
this.handleChangeCheckCode()
|
||||||
}, 2000);
|
}, 2000);
|
||||||
}
|
}
|
||||||
}).catch(err=>{
|
}).catch(err => {
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
title: err.message,
|
title: err.message,
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
@@ -185,23 +206,23 @@ Page({
|
|||||||
},
|
},
|
||||||
|
|
||||||
// 绑定微信
|
// 绑定微信
|
||||||
wxBindPhone(){
|
wxBindPhone() {
|
||||||
const that = this
|
const that = this
|
||||||
// 获取openid进行手机号和微信的绑定
|
// 获取openid进行手机号和微信的绑定
|
||||||
wxBind((res)=>{
|
wxBind((res) => {
|
||||||
let params = {
|
let params = {
|
||||||
openId: encrypt(that.data.rsaPublicKey, res.result.openid),
|
openId: encrypt(that.data.rsaPublicKey, res.result.openid),
|
||||||
rsaPublicKey: that.data.rsaPublicKey
|
rsaPublicKey: that.data.rsaPublicKey
|
||||||
}
|
}
|
||||||
// 需要判断是否绑定过微信,再进行绑定请求
|
// 需要判断是否绑定过微信,再进行绑定请求
|
||||||
UserApi.wxBind(params).then(res=>{})
|
UserApi.wxBind(params).then(res => {})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面加载
|
* 生命周期函数--监听页面加载
|
||||||
*/
|
*/
|
||||||
onLoad: function (options) {
|
onLoad: function (options) {
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -219,14 +240,14 @@ Page({
|
|||||||
const that = this
|
const that = this
|
||||||
wx.getStorage({
|
wx.getStorage({
|
||||||
key: 'rsaPublicKey',
|
key: 'rsaPublicKey',
|
||||||
success (res) {
|
success(res) {
|
||||||
that.setData({
|
that.setData({
|
||||||
rsaPublicKey: res.data
|
rsaPublicKey: res.data
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
fail: function(){
|
fail: function () {
|
||||||
// 缓存中没有登录过默认app.json的登录页
|
// 缓存中没有登录过默认app.json的登录页
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -127,7 +127,7 @@ Page({
|
|||||||
})
|
})
|
||||||
MeetingApi.meetingList({
|
MeetingApi.meetingList({
|
||||||
workingGroupProjectId: this.data.id,
|
workingGroupProjectId: this.data.id,
|
||||||
column: 'pm.createTime',
|
column: 'createTime',
|
||||||
order: 'desc'
|
order: 'desc'
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
|
|||||||
+53
-13
@@ -1,7 +1,8 @@
|
|||||||
import UserApi from '../../assets/js/http/userApi'
|
import UserApi from '../../assets/js/http/userApi'
|
||||||
import {baseUrl, URL_CONFIG} from '../../assets/js/project.config.js'
|
import {baseUrl, URL_CONFIG} from '../../assets/js/project.config.js'
|
||||||
import {
|
import {
|
||||||
isLogin
|
isLogin,
|
||||||
|
isLoginSignIn
|
||||||
} from '../../assets/js/common'
|
} from '../../assets/js/common'
|
||||||
Page({
|
Page({
|
||||||
|
|
||||||
@@ -80,10 +81,10 @@ Page({
|
|||||||
|
|
||||||
// 微信扫码 判断是否登录
|
// 微信扫码 判断是否登录
|
||||||
if(options.q) {
|
if(options.q) {
|
||||||
|
let url = decodeURIComponent(options.q)
|
||||||
|
let meetingId = url.split('=')[1]
|
||||||
// 登录过的就直接签到 否则跳转登录页
|
// 登录过的就直接签到 否则跳转登录页
|
||||||
isLogin( () => {
|
isLoginSignIn( () => {
|
||||||
let url = decodeURIComponent(options.q)
|
|
||||||
let meetingId = url.split('=')[1]
|
|
||||||
// 通过会议id 获取签到信息
|
// 通过会议id 获取签到信息
|
||||||
UserApi.scanCode({
|
UserApi.scanCode({
|
||||||
meetingId
|
meetingId
|
||||||
@@ -115,7 +116,8 @@ Page({
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}).catch(err => {})
|
}).catch(err => {})
|
||||||
})
|
},meetingId)
|
||||||
|
|
||||||
}
|
}
|
||||||
// 这里是会议详情的跳转签到
|
// 这里是会议详情的跳转签到
|
||||||
if(options.type === 'meetingDetail'){
|
if(options.type === 'meetingDetail'){
|
||||||
@@ -123,10 +125,10 @@ Page({
|
|||||||
UserApi.scanCode({
|
UserApi.scanCode({
|
||||||
meetingId
|
meetingId
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
wx.showToast({
|
// wx.showToast({
|
||||||
title: '获取签到信息...',
|
// title: '获取签到信息...',
|
||||||
icon: 'loading'
|
// icon: 'loading'
|
||||||
})
|
// })
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
that.setData({
|
that.setData({
|
||||||
form:res.result
|
form:res.result
|
||||||
@@ -148,10 +150,10 @@ Page({
|
|||||||
that.setData({
|
that.setData({
|
||||||
form:res.result
|
form:res.result
|
||||||
})
|
})
|
||||||
wx.showToast({
|
// wx.showToast({
|
||||||
title: '未查到报名信息...',
|
// title: '未查到报名信息...',
|
||||||
icon: 'loading'
|
// icon: 'loading'
|
||||||
})
|
// })
|
||||||
// 未查到报名信息
|
// 未查到报名信息
|
||||||
that.setData({
|
that.setData({
|
||||||
isSigned: 0,
|
isSigned: 0,
|
||||||
@@ -178,6 +180,44 @@ Page({
|
|||||||
form
|
form
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
// 这里是微信扫描失败 重新登录后 跳转签到页面执行的逻辑 isLoginSignIn是会议id
|
||||||
|
if(options.isLoginSignIn){
|
||||||
|
//请出缓存中的 isLoginSignIn 防止下次登录出现问题
|
||||||
|
wx.removeStorage({
|
||||||
|
key: 'isLoginSignIn',
|
||||||
|
})
|
||||||
|
let meetingId = options.isLoginSignIn
|
||||||
|
UserApi.scanCode({
|
||||||
|
meetingId
|
||||||
|
}).then(res => {
|
||||||
|
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
|
||||||
|
})
|
||||||
|
// 未查到报名信息
|
||||||
|
that.setData({
|
||||||
|
isSigned: 0,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}).catch(err => {})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user