登录逻辑修改,扫码签到逻辑完善

This commit is contained in:
姚亚男
2021-10-14 20:04:19 +08:00
parent 2f3f9aba1d
commit 7895fc5191
26 changed files with 864 additions and 172 deletions
+11 -11
View File
@@ -5,17 +5,17 @@ App({
const logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
wx.setStorageSync('logs', logs)
wx.getStorage({
key: 'X-Access-Token',
success: (res) =>{// 缓存中登录过,直接进小程序
wx.switchTab({
url: 'pages/home/home',
})
},
fail: function(){
// 缓存中没有登录过默认app.json的登录页
}
})
// wx.getStorage({
// key: 'X-Access-Token',
// success: (res) =>{// 缓存中登录过,直接进小程序
// wx.switchTab({
// url: 'pages/home/home',
// })
// },
// fail: function(){
// // 缓存中没有登录过默认app.json的登录页
// }
// })
// 登录
wx.login({
success: res => {
+1 -1
View File
@@ -1,7 +1,7 @@
{
"pages":[
"pages/login/login",
"pages/home/home",
"pages/login/login",
"pages/mine/mine",
"pages/index/index",
"pages/logs/logs",
+3 -3
View File
@@ -46,9 +46,9 @@ const http = (method, url, data, header= headerDefault) => {
duration: 1500,
mask: true
});
wx.navigateTo({
url: '/pages/login/login',
})
// wx.navigateTo({
// url: '/pages/login/login',
// })
console.error("登录失效3");
}
},
+14 -4
View File
@@ -18,14 +18,24 @@ const UserApi = {
getRSAPublicKey: (params) => http.get(`${URL_CONFIG}sys/getRSAPublicKey`, params),
// 发送短信验证码
sendCode: (params) => http.get(`${URL_CONFIG}company/sendVerificationCode`, params),
// 短信登录
// 手机短信登录
codeLogin: (params) => http.post(`${URL_CONFIG}company/smsLogin`, params),
// 账号密码登录
passWordLogin: (params) => http.post(`${URL_CONFIG}company/login`, params),
// 微信登录
wxLogin: (params) => http.post(`${URL_CONFIG}company/WCLogin`, params),
// 微信绑定
wxBind: (params) => http.post(`${URL_CONFIG}company/bindWeXin`, params),
// 设置密码
setPassword: (params) => http.post(`${URL_CONFIG}company/changePasswordWithToken`, params),
// 修改密码
updatePassword: (params) => http.post(`${URL_CONFIG}company/changePassword`, params),
// 扫码签到
scanCode: (params) => http.post(`${URL_CONFIG}company/changePassword`, params),
updatePassword: (params) => http.post(`${URL_CONFIG}company/verificationChangePassword`, params),
// 图片验证码
sendImage: (params) => http.get(`${URL_CONFIG}sys/randomImage/${params.time}`, params),
// 确认签到
scanSure: (params) => http.post(`${URL_CONFIG}meeting/payMeetingSituation/signIn`, params),
// 签到的扫码
scanCode: (params) => http.get(`${URL_CONFIG}meeting/payMeetingSituation/getSignInPage`, params),
// 退出
logout: (params) => http.post(`${URL_CONFIG}sys/logout`, params),
// 个人信息
+229
View File
@@ -0,0 +1,229 @@
// pages/mine/mine.js
import UserApi from '../../assets/js/http/userApi'
import { encrypt } from '../../assets/js/jsencrypt/rsa'
var countdown = 60; // 倒计时秒数
Page({
data: {
phone: '',
captcha: '',
password: '',
confirmPassword: '',
count: 60,
rsaPublicKey: '',
showGetCaptcha: true
},
bindInputPhone(e) {
this.setData({
phone: e.detail.value
})
},
// 获取验证码
getVerCode() {
countdown = 60
if (/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/.test(this.data.phone)) {
UserApi.sendCode({
phone: this.data.phone,
codeType: 1
}).then(res => {
// 获取成功,倒计时 start
if (res.success) {
this.countDown()
wx.showToast({
title: '发送成功',
icon: 'none',
duration: 2000
})
} else {
wx.showToast({
title: res.message,
icon: 'none',
duration: 2000
})
}
})
} else {
wx.showToast({
title: '请输入正确的手机号',
icon: 'none',
duration: 2000
})
}
},
// 倒计时
countDown(){
if (countdown === 0) {
this.setData({
showGetCaptcha: true
})
countdown = 60;
return;
} else {
this.setData({
showGetCaptcha: false
})
countdown--;
this.setData({
count: countdown
})
}
setTimeout(() => {
this.countDown()
}, 1000)
// 倒计时 end
},
// 确认
formSubmit(e) {
if(!e.detail.value.phone){
this.data.flag = false
wx.showToast({
title: '请输入手机号',
icon: 'none'
})
return
} 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}$/
if(!pattern.test(e.detail.value.phone)){
wx.showToast({
title: '请输入正确的手机号!',
icon: 'none'
})
this.data.flag = false
return
} else {
this.data.flag = true
}
}
if(!e.detail.value.verifyCode){
this.data.flag = false
wx.showToast({
title: '请输入验证码',
icon: 'none'
})
return
} else {
this.data.flag = true
}
if(!e.detail.value.password){
this.data.flag = false
wx.showToast({
title: '请输入新密码',
icon: 'none'
})
return
} else {
let pattern = /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+`\-={}:";'<>?,.\/]).{8,}$/
if(!pattern.test(e.detail.value.password)){
wx.showToast({
title: '新密码由8位数字、大小写字母和特殊符号组成!!',
icon: 'none'
})
this.data.flag = false
return
} else {
this.data.flag = true
}
}
if(!e.detail.value.verifyPassword){
this.data.flag = false
wx.showToast({
title: '请输入确认新密码',
icon: 'none'
})
return
} else {
let pattern = /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+`\-={}:";'<>?,.\/]).{8,}$/
if(!pattern.test(e.detail.value.verifyPassword)){
wx.showToast({
title: '确认新密码由8位数字、大小写字母和特殊符号组成!!',
icon: 'none'
})
this.data.flag = false
return
} else {
this.data.flag = true
}
}
if(e.detail.value.password === e.detail.value.verifyPassword) {
this.data.flag = true
} else {
this.data.flag = false
wx.showToast({
title: '密码不一致',
icon: 'none'
})
return
}
let params = {
phone: encrypt(this.data.rsaPublicKey,e.detail.value.phone), // 手机号加密
password: encrypt(this.data.rsaPublicKey, e.detail.value.password), // 新密码加密
verifyPassword: encrypt(this.data.rsaPublicKey, e.detail.value.verifyPassword), // 确认新密码加密
verifyCode: e.detail.value.verifyCode,
rsaPublicKey: this.data.rsaPublicKey
}
// 修改密码
UserApi.updatePassword(params).then(res => {
if (res.success) {
// 跳转登录页
wx.redirectTo({
url: '../login/login',
})
} else {
wx.showToast({
title: res.message,
icon: 'none',
duration: 2000
})
}
})
},
// 绑定微信
wxBind(){
const that = this
// 获取openid进行手机号和微信的绑定
wx.login({
success (res) {
if (res.code) {
//发起网络请求
wx.request({
url: 'https://api.weixin.qq.com/sns/jscode2session',
data: {
appid: 'wx24914e866df035fb',
secret: '0d2830f26f57722716249f2b2236f409',
js_code: res.code,
grant_type: 'authorization_code'
},
success (res) { // 成功拿到openId
// 微信和该账号绑定
let params = {
openId: res.openId,
rsaPublicKey: that.data.rsaPublicKey
}
UserApi.wxBind(params).then(res=>{})
}
})
} else {
console.log('授权失败!' + res.errMsg)
}
}
})
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
UserApi.getRSAPublicKey().then(res => {
if (res.success) {
this.setData({
rsaPublicKey: res.result
})
wx.setStorage({
key: 'rsaPublicKey',
data: res.result
})
}
})
}
})
+3
View File
@@ -0,0 +1,3 @@
{
"usingComponents": {}
}
+33
View File
@@ -0,0 +1,33 @@
<view class="container-box">
<form bindsubmit="formSubmit" class="form-box">
<view class="form-item">
<view class="text-label">手机号</view>
<view class="text-value">
<input name="phone" bindinput="bindInputPhone" value="{{phone}}" placeholder="请输入手机号" />
</view>
</view>
<view class="form-item">
<view class="text-label">验证码</view>
<view class="text-value">
<input name="verifyCode" value="{{verifyCode}}" placeholder="请输入验证码" />
</view>
<view wx:if="{{showGetCaptcha}}" class="captcha" bindtap="getVerCode">获取验证码</view>
<view wx:else="{{showGetCaptcha}}" class="captcha count">{{count}}</view>
</view>
<view class="form-item">
<view class="text-label">新密码</view>
<view class="text-value">
<input name="password" value="{{password}}" placeholder="请输入新密码" />
</view>
</view>
<view class="form-item">
<view class="text-label">确认密码</view>
<view class="text-value">
<input name="verifyPassword" value="{{verifyPassword}}" placeholder="请输入确认密码" />
</view>
</view>
<view class="btn-area">
<button type="primary" formType="submit">确定</button>
</view>
</form>
</view>
+8
View File
@@ -0,0 +1,8 @@
page {
overflow-x: hidden;
width: 100%;
color: #333;
}
.form-box{
transform: translateY(50%);
}
+13 -13
View File
@@ -18,11 +18,11 @@ Page({
})
},
onLoad() {
if (wx.getUserProfile) {
this.setData({
canIUseGetUserProfile: true
})
}
// if (wx.getUserProfile) {
// this.setData({
// canIUseGetUserProfile: true
// })
// }
},
getUserProfile(e) {
// 推荐使用wx.getUserProfile获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认,开发者妥善保管用户快速填写的头像昵称,避免重复弹窗
@@ -37,12 +37,12 @@ Page({
}
})
},
getUserInfo(e) {
// 不推荐使用getUserInfo获取用户信息,预计自2021年4月13日起,getUserInfo将不再弹出弹窗,并直接返回匿名的用户个人信息
console.log(e)
this.setData({
userInfo: e.detail.userInfo,
hasUserInfo: true
})
}
// getUserInfo(e) {
// // 不推荐使用getUserInfo获取用户信息,预计自2021年4月13日起,getUserInfo将不再弹出弹窗,并直接返回匿名的用户个人信息
// console.log(e)
// this.setData({
// userInfo: e.detail.userInfo,
// hasUserInfo: true
// })
// }
})
+76 -34
View File
@@ -6,6 +6,7 @@ Page({
data: {
phone: '',
captcha: '',
openId: '',
count: 60,
rsaPublicKey: '',
showGetCaptcha: true
@@ -21,13 +22,14 @@ Page({
countdown = 60
if (/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/.test(this.data.phone)) {
UserApi.sendCode({
phone: this.data.phone
phone: this.data.phone,
codeType: 1
}).then(res => {
// 获取成功,倒计时 start
if (res.success) {
this.countDown()
wx.showToast({
title: res.message,
title: '发送成功',
icon: 'none',
duration: 2000
})
@@ -69,6 +71,35 @@ Page({
}, 1000)
// 倒计时 end
},
// 手机号密码登录页
phonePassword(){
wx.navigateTo({
url: '../phonePassword/phonePassword',
})
},
// 微信登录
wxLogin(){
let params = {
openId: this.data.openid,
rsaPublicKey: this.data.rsaPublicKey
}
UserApi.wxLogin(params).then(res=>{
if(res.success) {// 已经用手机号登录过,此时用微信快捷登录时,把微信的个人信息存进缓存(微信信息在缓存的userInfoTemp)
wx.getStorage({
key: 'userInfoTemp',
success(result){
console.log(result)
}
})
}else{ // 首次登录不能直接用微信快捷登录
wx.showToast({
title: '暂未授权手机号',
duration: 2000,
icon: "none",
})
}
})
},
// 登录
formSubmit(e) {
if (e.detail.value.phone && e.detail.value.captcha) {
@@ -80,16 +111,16 @@ Page({
// 请求短信登录start
UserApi.codeLogin(params).then(res => {
if (res.success) {
// 存临时token和userInfo
wx.setStorage({
key: 'token-temp',
data: res.result.token
})
wx.setStorage({
key: 'userInfo',
data: res.result.userInfo
})
if(res.message === "updatePassword") {
// 存临时token
wx.setStorage({
key: 'token-temp',
data: res.result.token
})
// 跳转设置密码页
wx.navigateTo({
url: '../setPassword/setPassword',
@@ -100,6 +131,8 @@ Page({
key: 'X-Access-Token',
data: res.result.token
})
// 绑定微信
this.wxBind()
// 跳转首页
wx.switchTab({
url: '../home/home',
@@ -122,21 +155,44 @@ Page({
})
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
// 忘记密码
updateInfo(){
wx.navigateTo({
url: '../forgetPassword/forgetPassword',
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
// 绑定微信
wxBind(){
const that = this
// 获取openid进行手机号和微信的绑定
wx.login({
success (res) {
if (res.code) {
//发起网络请求
wx.request({
url: 'https://api.weixin.qq.com/sns/jscode2session',
data: {
appid: 'wx24914e866df035fb',
secret: '0d2830f26f57722716249f2b2236f409',
js_code: res.code,
grant_type: 'authorization_code'
},
success (res) { // 成功拿到openId
// 微信和该账号绑定
let params = {
openId: res.openId,
rsaPublicKey: that.data.rsaPublicKey
}
UserApi.wxBind(params).then(res=>{})
}
})
} else {
console.log('授权失败!' + res.errMsg)
}
}
})
},
/**
* 生命周期函数--监听页面显示
*/
@@ -152,19 +208,5 @@ Page({
})
}
})
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
}
})
+7 -1
View File
@@ -17,6 +17,12 @@
<view class="btn-area">
<button type="primary" formType="submit">登录</button>
</view>
<!-- <view bindtap="forget" class="forget">忘记密码?</view> -->
<view bindtap="forget" class="forget">
<text bindtap="phonePassword">手机密码登录</text>
<text bindtap="updateInfo">忘记密码?</text>
</view>
<view class="weixin">
<image src="../../assets/images/wx.png" bindtap="wxLogin"></image>
</view>
</form>
</view>
+16 -4
View File
@@ -4,11 +4,23 @@ page {
color: #333;
}
.form-box{
transform: translateY(100%);
transform: translateY(50%);
}
/* .forget{
.forget{
color: #999;
font-size: 14px;
text-align: right;
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 20px;
} */
}
.weixin{
width: 100%;
display: flex;
justify-content: center;
margin-top: 70px;
}
.weixin image{
width: 50px;
height: 50px;
}
+49 -24
View File
@@ -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)
})
}
}
})
+10 -2
View File
@@ -7,7 +7,8 @@
<view class="avator">
<image src="../../assets/images/tx.png"></image>
<view class="info">
<text>{{name}}</text>
<text wx:if="{{!name}}" bindtap="goLogin">未登录</text>
<text wx:if="{{name}}">{{name}}</text>
<text>{{phone}}</text>
</view>
</view>
@@ -30,6 +31,13 @@
</view>
<image src="../../assets/images/more.png"></image>
</view>
<view class="list-item" bindtap="upDateInfo">
<view class="item-title">
<image src="../../assets/images/xgmm.png"></image>
<text>解除绑定</text>
</view>
<image src="../../assets/images/more.png"></image>
</view>
<view class="list-item" bindtap="scanCode">
<view class="item-title">
<image src="../../assets/images/sign.png"></image>
@@ -54,6 +62,6 @@
</view>
</view>
<view class="logout">
<text bindtap="logout">退出登录</text>
<text bindtap="logout" wx:if="{{token}}">退出登录</text>
</view>
</view>
+201
View File
@@ -0,0 +1,201 @@
// pages/meeting/meeting.js
import UserApi from '../../assets/js/http/userApi'
import { encrypt } from '../../assets/js/jsencrypt/rsa'
// var countdown = 60; // 倒计时秒数
Page({
/**
* 页面的初始数据
*/
data: {
form: {
currdatetime: '',
requestCodeSuccess: true,
randCodeImage: '', // 验证码
rsaPublicKey: '', // 公钥
},
flag: false
},
back(){
wx.navigateBack({
delta: 1
})
},
// 改变验证码
handleChangeCheckCode() {
this.data.currdatetime = new Date().getTime()
UserApi.sendImage({time: this.data.currdatetime}).then(res=>{
if (res.success) {
this.setData({
"form.randCodeImage": res.result,
"form.requestCodeSuccess": true
})
} else {
this.setData({
"form.requestCodeSuccess": false
})
}
}).catch(() => {
this.setData({
"form.requestCodeSuccess": false
})
})
},
// 提交
formSubmit(e) {
if(!e.detail.value.phone){
this.data.flag = false
wx.showToast({
title: '请输入手机号',
icon: 'none'
})
return
} 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}$/
if(!pattern.test(e.detail.value.phone)){
wx.showToast({
title: '请输入正确的手机号!',
icon: 'none'
})
this.data.flag = false
return
} else {
this.data.flag = true
}
}
if(!e.detail.value.password){
this.data.flag = false
wx.showToast({
title: '请输入密码',
icon: 'none'
})
return
} else {
let pattern = /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+`\-={}:";'<>?,.\/]).{8,}$/
if(!pattern.test(e.detail.value.password)){
wx.showToast({
title: '密码由8位数字、大小写字母和特殊符号组成!!',
icon: 'none'
})
this.data.flag = false
return
} else {
this.data.flag = true
}
}
if(!e.detail.value.captcha){
this.data.flag = false
wx.showToast({
title: '请输入验证码',
icon: 'none'
})
return
}else{
this.data.flag = true
}
console.log('form发生了submit事件,携带数据为:', e.detail.value)
// const time = new Date().getTime()
let params = {
username: encrypt(this.data.rsaPublicKey, e.detail.value.phone),
password: encrypt(this.data.rsaPublicKey, e.detail.value.password),
checkKey: this.data.currdatetime,
captcha: e.detail.value.captcha,
rsaPublicKey: this.data.rsaPublicKey,
}
if(this.data.flag){
UserApi.passWordLogin(params).then(res => {
if(res.success){
// 微信绑定
this.wxBind()
// 存token和userInfo
wx.setStorage({
key: 'X-Access-Token',
data: res.result.token
})
wx.setStorage({
key: 'userInfo',
data: res.result.userInfo
})
// 跳转首页
wx.switchTab({
url: '../home/home',
})
}else{
wx.showToast({
title: res.message,
duration: 2000
})
this.handleChangeCheckCode()
}
}).catch(err => {
wx.hideToast()
})
}
},
// 绑定微信
wxBind(){
// 获取openid进行手机号和微信的绑定
wx.login({
success (res) {
if (res.code) {
//发起网络请求
wx.request({
url: 'https://api.weixin.qq.com/sns/jscode2session',
data: {
appid: 'wx24914e866df035fb',
secret: '0d2830f26f57722716249f2b2236f409',
js_code: res.code,
grant_type: 'authorization_code'
},
success (res) { // 成功拿到openId
// 微信和该账号绑定
// 微信和该账号绑定
let params = {
openId: res.openId,
rsaPublicKey: that.data.rsaPublicKey
}
UserApi.wxBind(params).then(res=>{})
}
})
} else {
console.log('授权失败!' + res.errMsg)
}
}
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.handleChangeCheckCode()
const that = this
wx.getStorage({
key: 'rsaPublicKey',
success (res) {
that.setData({
rsaPublicKey: res.data
})
},
fail: function(){
// 缓存中没有登录过默认app.json的登录页
}
})
}
})
+4
View File
@@ -0,0 +1,4 @@
{
"navigationBarTitleText": "修改密码",
"usingComponents": {}
}
+33
View File
@@ -0,0 +1,33 @@
<!--pages/meeting/meeting.wxml-->
<view>
<form bindsubmit="formSubmit" class="form-box">
<view class="form-item">
<view class="text-label">手机号</view>
<view class="text-value">
<input name="phone" value="{{phone}}" placeholder="请输入手机号" />
</view>
</view>
<view class="form-item">
<view class="text-label">密码</view>
<view class="text-value">
<input name="password" value="{{password}}" type="password" placeholder="请输入密码" />
</view>
</view>
<view class="form-item">
<view class="text-label">验证码</view>
<view class="text-value">
<input name="captcha" placeholder="请输入验证码" value="{{captcha}}" />
</view>
<view class="captcha" wx:if="{{form.requestCodeSuccess}}">
<image src="{{form.randCodeImage}}" mode="aspectFill"></image>
</view>
<view class="captcha count" wx:if="{{!form.requestCodeSuccess}}" bindtap="handleChangeCheckCode">重新获取</view>
</view>
<view class="btn-area">
<button type="primary" formType="submit">登录</button>
</view>
<view bindtap="forget" class="forget">
<text bindtap="back">手机验证码登录</text>
</view>
</form>
</view>
+30
View File
@@ -0,0 +1,30 @@
/* pages/meeting/meeting.wxss */
.form-box{
transform: translateY(110pt);
}
.text-label {
width: 60px !important;
}
.forget{
color: #999;
font-size: 14px;
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 20px;
}
.captcha{
padding: 0 !important;
background-color: #fff !important;
}
.count{
background-color: #f5f5f5 !important;
color: #999 !important;
}
.captcha image{
display: block;
width: 100%;
height: 90%;
border-radius: 5px;
}
+10 -3
View File
@@ -7,7 +7,8 @@ Page({
*/
data: {
form: {},
noticeFileList: [] // 通知文件
projectFileList: [], // 项目资料文件
notifyFileList: [] // 通知文件
},
// 预览
preview(e){
@@ -22,10 +23,16 @@ Page({
this.setData({
form: res.result
})
// 获取通知文件list
// 获取项目资料文件list
initFileList(this.data.form.files).then(res => {
this.setData({
noticeFileList:res
projectFileList: res
})
})
// 获取通知文件list
initFileList(this.data.form.chargeNoticeId).then(res => {
this.setData({
notifyFileList: res
})
})
})
+35 -13
View File
@@ -49,20 +49,41 @@
<view wx:if="{{form.chargeWay === 2}}">
<text>合同</text>
<!-- 跳转到合同详情 -->
<text class="color-green" bindtap="contractDetail">{{form.contractNo}}</text>
<text class="color-green" bindtap="contractDetail">{{form.contractNum}}</text>
</view>
<!-- 付款方式为收费通知才有 -->
<view wx:if="{{form.chargeWay === 3}}">
<text>收费通知号</text>
<text>{{form.chargeNoticeNo}}</text>
</view>
<!-- 付款方式为收费通知才有 -->
<view wx:if="{{form.chargeWay === 3}}" style="height: auto !important;">
<text>通知文件</text>
<view class="info-file">
<text class='color-green' data-file="{{item}}" wx:for="{{noticeFileList}}" wx:key='item'
<view class="info-file" wx:if="{{notifyFileList && notifyFileList.length}}">
<text class='color-green' data-file="{{item}}" wx:for="{{notifyFileList}}" wx:key='item'
bindtap="preview">{{item.name}}</text>
</view>
<text wx:if="{{noticeFileList.length == 0}}">无</text>
</view>
<view style="height: auto !important;">
<text>项目资料</text>
<view class="info-file" wx:if="{{projectFileList && projectFileList.length}}">
<text class='color-green' data-file="{{item}}" wx:for="{{projectFileList}}" wx:key='item'
bindtap="preview">{{item.name}}</text>
</view>
<text wx:if="{{projectFileList.length == 0}}">无</text>
</view>
</view>
<view class="basic-info" style="margin-top: 10px;">
<view class="title">
<text>会议信息</text>
</view>
<view style="padding: 0 15px;" wx:for="{{form.paymentRecord}}" wx:key="item">
<view class="meeting-info">
<text>hi一</text>
<text style="color: #069F99;">查看详情</text>
</view>
<text wx:if="{{form.paymentRecord.length == 0}}">暂无会议记录!</text>
</view>
</view>
<view class="basic-info" style="margin-top: 10px;">
@@ -70,18 +91,19 @@
<text>到账信息</text>
</view>
<view style="padding: 0 15px;" wx:for="{{form.paymentRecord}}" wx:key="item">
<text>{{item.paymentDate}}到账{{item.amountReceived}}元</text>
<text wx:if="{{form.paymentRecord && form.paymentRecord.length}}">{{item.paymentDate}}到账{{item.amountReceived}}元</text>
<text wx:if="{{form.paymentRecord.length == 0}}">暂无到账记录!</text>
</view>
</view>
<view class="basic-info" style="margin-top: 10px;">
<view class="title">
<text>开票邮寄信息</text>
</view>
<view wx:for="{{form.mailBill}}" wx:key='item' class="way-box">
<view class="title">
<text>开票邮寄信息</text>
</view>
<view class="way">
<image wx:if='{{item.sendMethod === 2}}' src="../../assets/images/sf.png"></image>
<image wx:if='{{item.sendMethod === 1}}' src="../../assets/images/ems.png"></image>
<text>{{item.sendMethod_dictText}}</text>
<text>{{item.sendMethod_dictText ? item.sendMethod_dictText : '未邮寄'}}</text>
</view>
<view class="way-info">
<view class="way-left">
@@ -91,17 +113,17 @@
<text>开票时间:{{item.billDate}}</text>
</view>
</view>
<text class="way-right">开票号{{item.billNo}}</text>
<text class="way-right">开票号{{item.billNo}}</text>
</view>
<view class="way-info">
<view class="way-left">
<text class="way-left-text blue">邮</text>
<view class="way-center">
<text>邮寄人:{{item.createBy}}</text>
<text>邮寄时间:{{item.sendDate}}</text>
<text>邮寄人:{{item.contactName}}</text>
<text>邮寄时间:{{item.sendDate ? item.sendDate : '无'}}</text>
</view>
</view>
<text class="way-right">快递号:{{item.postNo}}</text>
<text class="way-right">快递号:{{item.postNo ? item.postNo : '无'}}</text>
</view>
<view class="look-progress">
<text>金额:{{item.invoiceAmount}}元</text>
+8
View File
@@ -137,6 +137,14 @@ page{
align-items: flex-end !important;
height: auto !important;
}
.meeting-info{
width: 100%;
height: auto !important;
display: flex;
justify-content: space-between !important;
align-items: center;
padding: 0 !important;
}
.basic-info .way{
padding: 0 15px;
display: flex;
+30 -47
View File
@@ -5,8 +5,8 @@ Page({
* 页面的初始数据
*/
data: {
isSigned: false, // 默认未报名
meetingId: '', // 会议id
form: {},
isSigned: 0, // 默认未报名
fileId: '', // 图片id
src: null // 签名之后,保存签名的图片地址
},
@@ -18,19 +18,43 @@ Page({
},
// 确定签到
sureSign(){
let params = {
fileId: this.data.fileId,
meetingId: this.data.form.meetingId
}
UserApi.scanSure(params).then(res=>{
if(res.success){
this.setData({
isSigned: !this.data.isSigned
})
}else{
wx.showToast({
title: res.message,
icon: "none",
duration: 2000
})
}
})
},
// 去报名
goSignUp(){
wx.navigateTo({
url: 'url',
url: `../signUpPage/signUpPage?id=${meetingId}`,
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
console.log(options)
this.setData({
isSigned: options.signed
})
let form = JSON.parse(options.meeting)
console.log(form)
this.setData({
form
})
},
/**
@@ -44,47 +68,6 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function () {
let params = {
fileId: this.data.fileId,
meetingId: this.data.meetingId
}
// UserApi.scanCode(params).then(res=>{
// })
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
+11 -7
View File
@@ -1,35 +1,39 @@
<view class="basic-info">
<view>
<text>会议名称</text>
<text>会议名称会议名称</text>
<text>{{form.meetingName}}</text>
</view>
<view>
<text>会议类型</text>
<text>arff4ds8a3s6651</text>
<text wx:if="{{form.meetingType == 1}}">工作组会议</text>
<text wx:if="{{form.meetingType == 2}}">标协会议</text>
<text wx:if="{{form.meetingType == 3}}">国际研讨会</text>
<text wx:if="{{form.meetingType == 4}}">其他会议</text>
<text wx:if="{{form.meetingType == 5}}">分标委会议</text>
</view>
<view>
<text>召开时间</text>
<text>找找</text>
<text>{{form.startTime}}</text>
</view>
<!-- 已报名信息显示的内容start -->
<view wx:if="{{isSigned}}">
<text>参会单位</text>
<text>张三张三张三张三张三张三张三张三张三张三张三张三张三</text>
<text>{{form.companyName}}</text>
</view>
<view wx:if="{{isSigned}}">
<text>参会人</text>
<text>500元</text>
<text>{{form.companyContactName}}</text>
</view>
<view wx:if="{{isSigned}}">
<text>是否签到</text>
<text>500元</text>
<text>{{form.checkIn_dictText}}</text>
</view>
<view wx:if="{{isSigned}}">
<text>手动签到</text>
<text style="color: #069F99;" bindtap="scanSign">签到</text>
</view>
</view>
<view class="imageBox" hidden="{{isSigned ? false : true}}">
<view class="imageBox" wx:if="{{src}}">
<image src="{{src}}" ></image>
</view>
<view class="scanSign" wx:if="{{isSigned}}">
+27 -1
View File
@@ -86,6 +86,8 @@ Page({
wx.switchTab({
url: '../home/home',
})
// 绑定微信
this.wxBind()
} else {
wx.showToast({
title: '登录失败',
@@ -94,10 +96,34 @@ Page({
})
}
})
// 登录失败
}
},
// 绑定微信
wxBind(){
// 获取openid进行手机号和微信的绑定
wx.login({
success (res) {
if (res.code) {
//发起网络请求
wx.request({
url: 'https://api.weixin.qq.com/sns/jscode2session',
data: {
appid: 'wx24914e866df035fb',
secret: '0d2830f26f57722716249f2b2236f409',
js_code: res.code,
grant_type: 'authorization_code'
},
success (res) { // 成功拿到openId
// 微信和该账号绑定
}
})
} else {
console.log('授权失败!' + res.errMsg)
}
}
})
},
/**
* 生命周期函数--监听页面显示
*/
+2 -1
View File
@@ -67,7 +67,8 @@ Page({
let prevPage = pages[pages.length - 2];
//将数值信息赋值给上一页面id变量
prevPage.setData({
fileId: data.result.id
fileId: data.result.id,
src: res.tempFilePath
});
wx.navigateBack({
delta: 1,
-3
View File
@@ -9,8 +9,5 @@
<button size="" type="primary" bindtap="sign1ok">完成签字</button>
<button size="" type="warn" bindtap="reSign1">重新签字</button>
</view>
<view class="imageBox" hidden="{{src?false:true}}">
<image src="{{src}}" ></image>
</view>
</view>
</view>