修改手机号登录

This commit is contained in:
jsy_zjg 2025-01-10 15:01:21 +08:00
parent c3718310ce
commit 7497401f5e
2 changed files with 18 additions and 48 deletions

View File

@ -20,7 +20,7 @@ export function login(username, password, code, uuid) {
//获取手机号验证码
export function getCodePhone(data) {
return request({
url: '/sms/' + data,
url: '/auth/sms/' + data,
method: 'get'
})
}
@ -28,7 +28,10 @@ export function getCodePhone(data) {
//手机号登录
export function phoneLogin(data) {
return request({
url: '/login/user/app/mobile',
url: '/auth/loginPhone',
headers: {
isToken: false
},
method: 'post',
data: data
})

View File

@ -30,7 +30,6 @@
<view v-else>
<view class="input-item flex align-center">
<u-icon name="phone-fill" size="48rpx" color="#39ac4f"></u-icon>
<!-- <view class="iconfont phone-fill icon"></view> -->
<input v-model="loginForm.phone" class="input" type="text" placeholder="请输入手机号" maxlength="11" />
</view>
<view class="login-code">
@ -43,8 +42,6 @@
</view>
</view>
<view class="tip-text">请在验证码有效期内登录过期请重新获取</view>
<!-- <view class="tip-text">请在</view>
<view class="tip-text red-tip">验证码已过期请重新获取</view> -->
</view>
<!-- 登录按钮 -->
<view class="action-btn">
@ -76,6 +73,7 @@
watch,
computed
} from "vue";
import plugin from "@/plugins"
import {
onLoad,
} from "@dcloudio/uni-app"
@ -85,7 +83,7 @@
rsaDecrypt
} from "@/utils/rsa"
import config from '@/config.js'
import { getCodePhone } from "@/api/login";
const loginForm = ref({
loginName: "admin",
password: "admin123",
@ -197,51 +195,20 @@
return
}
codeBtnDisabled.value = true;
uni.showLoading({
title: "正在获取验证码...",
mask: true
})
// setTimeout(() => {
// uni.hideLoading();
// setCodeTimer();
// }, 3000)
store
.dispatch("onGetCodePhone", loginForm.value.phone)
.then(res => {
uni.hideLoading();
if (res.smsResponse) {
plugin.modal.showToast("短信已发送")
tipText.value = true
countingDown.value = true
loginForm.value.uuid = res.uuid
seconds.value = 60
timer = setInterval(() => {
seconds.value--
tips.value = `${seconds.value}s`
if (seconds.value <= 0) {
tipText.value = false
if (!loginForm.value.code) {
tipText2.value = true
}
tips.value = "重新获取"
countingDown.value = false
seconds.value = 60
clearInterval(timer)
timer = null
}
}, 1000)
} else {
plugin.modal.msgError(res.msg)
}
})
.catch(error => {
plugin.modal.msgError("短信发送失败," + error)
})
.finally(() => {
plugin.modal.closeLoading()
})
getCodePhone(loginForm.value.phone).then(res =>{
plugin.modal.closeLoading()
if (res.smsResponse) {
plugin.modal.showToast("短信已发送")
loginForm.value.uuid = res.uuid
codeBtnTimer.value = 60
setCodeTimer();
}
});
};
//
function checkTelephone(telephone) {
@ -292,7 +259,7 @@
}
}
} else {
loginObj.loginName = loginObj.phone;
loginObj.mobilePhone = loginObj.phone;
loginAPI = {
url: "phoneLogin",
data: loginObj