小程序修改代码

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

@ -13,9 +13,9 @@
</swiper> </swiper>
</view> </view>
<view class="flex-row equal-division"> <view class="flex-row equal-division">
<view class="flex-col items-center group_2 group_1" bind:tap="gotoCourseList" data-type="{{ '考' }}"> <view class="flex-col items-center group_2 group_1" bind:tap="gotoCourseList" data-type="{{ '考' }}">
<image class="image_3" src="./image/kgky.png" /> <image class="image_3" src="./image/kgky.png" />
<text class="font text_1 mt-12">考</text> <text class="font text_1 mt-12">考</text>
</view> </view>
<view class="flex-col items-center group_2 group_3" bind:tap="gotoCourseList" data-type="{{ '考公' }}"> <view class="flex-col items-center group_2 group_3" bind:tap="gotoCourseList" data-type="{{ '考公' }}">
<image class="image_3" src="./image/zmt.png" /> <image class="image_3" src="./image/zmt.png" />

View File

@ -125,8 +125,7 @@ Page({
verificationCode: code, verificationCode: code,
userPassword: newPwd, userPassword: newPwd,
userConfirmPassword: confirmPwd, userConfirmPassword: confirmPwd,
sourceToken: null, userRole: role
role: role
}, },
success: res => { success: res => {
if (res.data.code === 1) { if (res.data.code === 1) {

View File

@ -68,7 +68,7 @@ Page({
// 获取验证码(仅校验手机号) // 获取验证码(仅校验手机号)
getSmsCode() { getSmsCode() {
const { phone } = this.data; const { phone, role } = this.data;
// 1. 非空校验 // 1. 非空校验
if (!validate(this.data, { phone: '请输入手机号' })) { if (!validate(this.data, { phone: '请输入手机号' })) {
@ -83,7 +83,10 @@ Page({
wx.request({ wx.request({
url: baseUrl + '/userInfo/code/pwd', url: baseUrl + '/userInfo/code/pwd',
method: 'POST', method: 'POST',
data: { templateString: phone }, data: {
phoneNumber: phone,
userRole: role
},
success: (res) => { success: (res) => {
console.log('验证码发送--->',res.data); console.log('验证码发送--->',res.data);
if (res.data.code === 1) { if (res.data.code === 1) {
@ -163,7 +166,7 @@ Page({
: baseUrl + '/userInfo/mini/vcd/login'; : baseUrl + '/userInfo/mini/vcd/login';
const payload = loginType === 'password' const payload = loginType === 'password'
? { phoneNumber: phone, userPassword: credential, userRole: role } ? { phoneNumber: phone, userPassword: credential, userRole: role }
: { phoneNumber: phone, verificationCode: credential }; : { phoneNumber: phone, verificationCode: credential, userRole: role };
wx.request({ wx.request({
url, url,

View File

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