小程序修改代码

This commit is contained in:
2025-08-10 11:43:30 +08:00
parent d5e4f0d7eb
commit f17226cc97
5 changed files with 25 additions and 13 deletions

View File

@ -10,12 +10,14 @@ Page({
nickName: "",
userAvatar: "",
phoneNumber: "",
globalImgUrl
globalImgUrl,
role: '',
},
gotoResetPwd() {
const { role } = this.data;
wx.navigateTo({
url: '/pages/personCenter/resetPwd/resetPwd',
url: `/pages/personCenter/resetPwd/resetPwd?role=${ role }`,
})
},
@ -64,12 +66,14 @@ Page({
Authorization: token
},
success: res => {
console.log('用户信息---->',res.data.data);
if (res.data.code === 1) {
this.setData({
nickName: res.data.data.nickName,
userAvatar: res.data.data.userAvatar,
phoneNumber: res.data.data.phoneNumber,
userAccount: res.data.data.userAccount
userAccount: res.data.data.userAccount,
role:res.data.data.userRole,
})
}
},

View File

@ -13,11 +13,12 @@ Page({
count: 60,
password: '', // 第一次输入的密码
currentPwd: '', // 再次确认密码
verificationCode: '' // 验证码
verificationCode: '', // 验证码
role: '',
},
resetPwd() {
const { phone, verificationCode, password, currentPwd } = this.data;
const { phone, verificationCode, password, currentPwd, role } = this.data;
if( !formatPassword(password,currentPwd) ) {
return;
}
@ -32,7 +33,8 @@ Page({
verificationCode: verificationCode,
userPassword: password,
userConfirmPassword: currentPwd,
sourceToken: wx.getStorageSync('token')
sourceToken: wx.getStorageSync('token'),
userRole: role,
},
success: res => {
console.log('修改密码--->',res);
@ -111,6 +113,10 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad(options) {
console.log('---->',options);
this.setData({
role: options.role
})
// 获取用户信息 —— 用于渲染手机号
wx.request({
url: baseUrl + '/userInfo/get/jwt',