修改手机号登录

This commit is contained in:
jsy_zjg 2025-01-10 19:35:45 +08:00
parent d2720f8aa6
commit 59ec870bcf
2 changed files with 32 additions and 24 deletions

View File

@ -83,7 +83,10 @@
rsaDecrypt
} from "@/utils/rsa"
import config from '@/config.js'
import { getCodePhone,phoneLogin } from "@/api/login";
import {
getCodePhone,
phoneLogin
} from "@/api/login";
const loginForm = ref({
loginName: "admin",
password: "admin123",
@ -199,7 +202,7 @@
title: "正在获取验证码...",
mask: true
})
getCodePhone(loginForm.value.phone).then(res =>{
getCodePhone(loginForm.value.phone).then(res => {
plugin.modal.closeLoading()
if (res.smsResponse) {
plugin.modal.showToast("短信已发送")
@ -208,7 +211,7 @@
setCodeTimer();
}
});
};
//
function checkTelephone(telephone) {
@ -258,29 +261,31 @@
password: loginObj.password
}
}
store
.dispatch(loginAPI.url, loginAPI.data)
.then(res => {
loginSuccess()
})
.catch(error => {
uni.showToast({
title: error,
icon: "error"
})
})
.finally(() => {})
} else {
loginObj.mobilePhone = loginObj.phone;
console.log(loginObj)
phoneLogin(loginObj.mobilePhone,loginObj.code,loginObj.uuid).then(res=>{
})
loginAPI = {
url: "phoneLogin",
data: {
mobilePhone: loginObj.phone,
uuid: loginObj.uuid,
code:loginObj.code
}
}
}
if (!loginAPI) {
return;
}
store
.dispatch(loginAPI.url, loginAPI.data)
.then(res => {
loginSuccess()
})
.catch(error => {
uni.showToast({
title: error,
icon: "error"
})
})
.finally(() => {})
}
//

View File

@ -95,11 +95,14 @@ const user = {
phoneLogin({
commit
}, data) {
const mobilePhone = data.mobilePhone;
const code = data.code;
const uuid = data.uuid;
return new Promise((resolve, reject) => {
phoneLogin(data)
phoneLogin(mobilePhone,code, uuid)
.then(res => {
setToken(res.token)
commit("SET_TOKEN", res.token)
setToken(res.data.access_token)
commit("SET_TOKEN", res.data.access_token)
resolve(res)
})
.catch(error => {