登录,设置密码,修改密码,我的,首页,会议列表(接口逻辑已写,差加密文件的完善,代联调)

This commit is contained in:
姚亚男
2021-09-30 16:13:12 +08:00
parent d46f96d263
commit 8a2500b5a5
75 changed files with 1532 additions and 58 deletions
+161
View File
@@ -0,0 +1,161 @@
// pages/meeting/meeting.js
import UserApi from '../../assets/js/http/userApi'
import {JSEncrypt} from '../../assets/js/jsencrypt/jsencrypt'
Page({
/**
* 页面的初始数据
*/
data: {
newPassword: '',
verifyPassword: '',
rsaPublicKey: '',
flag: false
},
bindBlurInput(e){
},
// 登录
formSubmit(e) {
if(!e.detail.value.newPassword){
this.data.flag = false
wx.showToast({
title: '请输入密码',
icon: 'none'
})
return
} else {
let pattern = /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+`\-={}:";'<>?,.\/]).{8,}$/
if(!pattern.test(e.detail.value.newPassword)){
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.newPassword === e.detail.value.verifyPassword) {
this.data.flag = true
} else {
this.data.flag = false
wx.showToast({
title: '密码不一致',
icon: 'none'
})
return
}
if (this.data.flag) {
wx.showLoading({
title: '正在登录...',
icon: 'loading'
})
// 新建JSEncrypt对象
let encrypt = new JSEncrypt()
encrypt.setPublicKey(this.data.rsaPublicKey) // 公钥加密
let params = {
newPassword: encrypt.encrypt(e.detail.value.newPassword),
verifyPassword: encrypt.encrypt(e.detail.value.verifyPassword),
rsaPublicKey: this.data.rsaPublicKey
}
console.log('form发生了submit事件,携带数据为:', e.detail.value)
// 请求短信登录start
UserApi.setPassword(params).then(res => {
console.log(res)
if (res.success) {
wx.hideLoading()
} else {
wx.hideLoading()
wx.showToast({
title: '登录失败',
icon: 'error',
duration: 2000
})
}
})
// 登录失败
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
UserApi.getRSAPublicKey().then(res => {
if (res.success) {
this.setData({
rsaPublicKey: res.result
})
}
})
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
+4
View File
@@ -0,0 +1,4 @@
{
"navigationBarTitleText": "设置密码",
"usingComponents": {}
}
+21
View File
@@ -0,0 +1,21 @@
<!--pages/meeting/meeting.wxml-->
<view class="container-box">
<text class="set-password">初次登录请设置密码</text>
<form bindsubmit="formSubmit" class="form-box">
<view class="form-item">
<view class="text-label">密码</view>
<view class="text-value">
<input name="newPassword" bindblur="bindBlurInput" value="{{newPassword}}" placeholder="请输入密码" />
</view>
</view>
<view class="form-item">
<view class="text-label">确认密码</view>
<view class="text-value">
<input name="verifyPassword" bindblur="bindBlurInput" value="{{verifyPassword}}" placeholder="请确认密码" />
</view>
</view>
<view class="btn-area">
<button type="primary" formType="submit">登录</button>
</view>
</form>
</view>
+18
View File
@@ -0,0 +1,18 @@
/* pages/meeting/meeting.wxss */
page {
overflow: hidden;
width: 100%;
color: #333;
}
.form-box{
transform: translateY(100%);
}
.set-password{
display: block;
font-size: 16px;
color: #333;
width: 100%;
text-align: center;
margin-bottom: 20px;
letter-spacing: 0.5px;
}