我的页面

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
+39 -77
View File
@@ -1,8 +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'
var countdown = 60; // 倒计时秒数
Page({
@@ -21,11 +19,16 @@ Page({
},
showGetCaptcha: true
},
bindInputPhone(e) {
this.setData({
"form.phone": e.detail.value
})
},
// 获取验证码
getVerCode() {
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)) {
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.form.phone)) {
UserApi.sendCode({
phone: this.data.phone
phone: this.data.form.phone
}).then(res => {
// 获取成功,倒计时 start
if (res.success) {
@@ -121,50 +124,33 @@ Page({
return
}
console.log('form发生了submit事件,携带数据为:', e.detail.value)
// 新建JSEncrypt对象
let encrypt = new JSEncrypt()
encrypt.setPublicKey(this.data.rsaPublicKey) // 公钥加密
let params = {
phone: encrypt.encrypt(e.detail.value.phone),
phone: encrypt(this.data.rsaPublicKey, e.detail.value.phone),
newPassword: encrypt(this.data.rsaPublicKey, e.detail.value.newPassword),
verifyPassword: encrypt(this.data.rsaPublicKey, e.detail.value.verifyPassword),
verifyCode: e.detail.value.verifyCode,
newPassword: encrypt.encrypt(e.detail.value.newPassword),
verifyPassword: encrypt.encrypt(e.detail.value.verifyPassword)
rsaPublicKey: this.data.rsaPublicKey,
}
console.log(params)
if(this.data.flag){
UserApi.updatePassword(params).then(res => {
console.log(res)
if(res.success){
wx.showToast({
title: res.result,
})
wx.navigateBack()
}
}).catch(err => {
wx.hideToast()
})
}
UserApi.updatePassword(params).then(res => {
console.log(res)
wx.hideToast()
}).catch(err => {
wx.hideToast()
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
// 性别处理
if (this.data.form.gender === '1') {
this.data.sexArr[0].checked = "true"
this.setData({
sexArr: this.data.sexArr,
})
console.log(this.data.sexArr)
}
if (this.data.form.gender === '2') {
this.data.sexArr[1].checked = "true"
this.setData({
sexArr: this.data.sexArr,
})
console.log(2)
}
let params = {
id: wx.getStorage('id') // 用户id
}
UserApi.mineInfo(params).then(res => {
console.log(res)
wx.hideToast()
}).catch(err => {
wx.hideToast()
})
},
/**
@@ -178,41 +164,17 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
const that = this
wx.getStorage({
key: 'rsaPublicKey',
success (res) {
that.setData({
rsaPublicKey: res.data
})
},
fail: function(){
// 缓存中没有登录过默认app.json的登录页
}
})
}
})
+1 -1
View File
@@ -4,7 +4,7 @@
<view class="form-item">
<view class="text-label">手机号</view>
<view class="text-value">
<input name="phone" value="{{phone}}" placeholder="请输入手机号" />
<input name="phone" bindinput="bindInputPhone" value="{{phone}}" placeholder="请输入手机号" />
</view>
</view>
<view class="form-item">