修复了验证码bug

This commit is contained in:
2025-08-09 22:30:47 +08:00
parent f871831cbc
commit 8a085da7dc
4 changed files with 12 additions and 6 deletions

View File

@ -68,7 +68,7 @@ Page({
// 获取验证码(仅校验手机号)
getSmsCode() {
const { phone } = this.data;
const { phone, role } = this.data;
// 1. 非空校验
if (!validate(this.data, { phone: '请输入手机号' })) {
@ -83,7 +83,10 @@ Page({
wx.request({
url: baseUrl + '/userInfo/code/pwd',
method: 'POST',
data: { templateString: phone },
data: {
phoneNumber: phone,
userRole: role
},
success: (res) => {
console.log('验证码发送--->',res.data);
if (res.data.code === 1) {
@ -176,7 +179,7 @@ Page({
const token = res.data.data.token || res.data.data;
// ← 新增:将 token 存到本地缓存
wx.setStorageSync('token', token);
wx.setStorageSync('role', role)
wx.showToast({
title: '登录成功',
icon: 'success',