我的页面

This commit is contained in:
姚亚男
2021-10-11 16:49:22 +08:00
parent e4e2740c0b
commit 224833685d
28 changed files with 216 additions and 5738 deletions
+17 -19
View File
@@ -1,6 +1,6 @@
// pages/meeting/meeting.js
import UserApi from '../../assets/js/http/userApi'
import {JSEncrypt} from '../../assets/js/jsencrypt/jsencrypt'
import { encrypt } from '../../assets/js/jsencrypt/rsa'
Page({
/**
* 页面的初始数据
@@ -67,26 +67,19 @@ Page({
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),
newPassword: encrypt(this.data.rsaPublicKey, e.detail.value.newPassword),
verifyPassword: encrypt(this.data.rsaPublicKey, 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()
// 成功设置密码,跳转首页
wx.navigateTo({
url: '../home/home',
})
} else {
wx.hideLoading()
wx.showToast({
title: '登录失败',
icon: 'error',
@@ -108,18 +101,23 @@ Page({
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
UserApi.getRSAPublicKey().then(res => {
if (res.success) {
this.setData({
rsaPublicKey: res.result
const that = this
wx.getStorage({
key: 'rsaPublicKey',
success (res) {
that.setData({
rsaPublicKey: res.data
})
},
fail: function(){
// 缓存中没有登录过默认app.json的登录页
}
})
},