我的页面,首页来款项目

This commit is contained in:
姚亚男
2021-10-12 18:17:26 +08:00
parent 32e229fec3
commit 491caf06a3
41 changed files with 756 additions and 412 deletions
+21 -56
View File
@@ -6,16 +6,18 @@ Page({
* 页面的初始数据
*/
data: {
newPassword: '',
verifyPassword: '',
password: '', // token
newPassword: '', // 密码
verifyPassword: '', // 确认密码
rsaPublicKey: '',
flag: false
},
bindBlurInput(e){
},
// 登录
formSubmit(e) {
const that = this
if(!e.detail.value.newPassword){
this.data.flag = false
wx.showToast({
@@ -68,6 +70,7 @@ Page({
}
if (this.data.flag) {
let params = {
password: this.data.password,
newPassword: encrypt(this.data.rsaPublicKey, e.detail.value.newPassword),
verifyPassword: encrypt(this.data.rsaPublicKey, e.detail.value.verifyPassword),
rsaPublicKey: this.data.rsaPublicKey
@@ -76,7 +79,11 @@ Page({
UserApi.setPassword(params).then(res => {
if (res.success) {
// 成功设置密码,跳转首页
wx.navigateTo({
wx.setStorage({
key: 'X-Access-Token',
data: that.data.password
})
wx.switchTab({
url: '../home/home',
})
} else {
@@ -90,19 +97,6 @@ Page({
// 登录失败
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
@@ -115,45 +109,16 @@ Page({
that.setData({
rsaPublicKey: res.data
})
},
fail: function(){
// 缓存中没有登录过默认app.json的登录页
}
})
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
wx.getStorage({
key: 'token-temp',
success (res) {
that.setData({
password: res.data
})
console.log(that.data.password)
}
})
}
})
})