Commit 8fff2eb0 authored by shilei's avatar shilei

fix: 登录验证、面包屑去除市

parent 77f8fa50
......@@ -200,7 +200,7 @@ const breadcrumbs = computed(() => {
searchParams: {},
},
{
name: getName(provinceName),
name: getName(provinceName).replace('市', ''),
searchParams: { provinceName },
},
{
......
......@@ -20,6 +20,7 @@
type="number"
maxlength="11"
placeholder="请输入手机号"
@blur="verify('phone')"
></ElInput>
</div>
<div class="form-item flex justify-between">
......@@ -64,6 +65,7 @@
type="number"
maxlength="11"
placeholder="请输入手机号"
@blur="verify('phone')"
/>
</div>
<div class="form-item flex" ref="passWord">
......@@ -72,6 +74,7 @@
type="password"
show-password
placeholder="请输入密码"
@blur="verify('password')"
></ElInput>
</div>
</div>
......@@ -106,6 +109,7 @@
type="number"
maxlength="11"
placeholder="请输入手机号"
@blur="verify('phone')"
></ElInput>
</div>
<div class="form-item flex justify-between">
......@@ -126,6 +130,7 @@
type="password"
show-password
placeholder="请输入密码(最少6位)"
@blur="verify('password')"
></ElInput>
</div>
</div>
......@@ -156,6 +161,7 @@
maxlength="11"
type="number"
placeholder="请输入手机号"
@blur="verify('phone')"
></ElInput>
</div>
<div class="form-item flex justify-between">
......@@ -176,6 +182,7 @@
type="password"
show-password
placeholder="请输入密码(最少6位)"
@blur="verify('password')"
></ElInput>
</div>
</div>
......@@ -255,23 +262,33 @@ const request = (url: any) => {
});
requestFn = r.request;
};
const verify = () => {
const verify = (type: string = 'all') => {
const regex = /^1[3-9]\d{9}$/;
if (!regex.test(phoneNum.value?.toString() || '')) {
proxy.$refs.phoneInput.style.borderColor = '#c0322b';
errorMsg.value = '请输入有效的手机号码';
return false;
} else {
proxy.$refs.phoneInput.style.borderColor = 'rgba(0, 0, 0, 0.15)';
}
// const
if (modalType.value !== 'loginByPhone') {
if(!/^.{6,20}$/.test(password.value?.toString() || '')) {
proxy.$refs.passWord.style.borderColor = '#c0322b';
errorMsg.value = '请输入6-20位有效密码';
if (type === 'phone' || type === 'all') {
if (!regex.test(phoneNum.value?.toString() || '')) {
proxy.$refs.phoneInput.style.borderColor = '#c0322b';
errorMsg.value = '请输入有效的手机号码';
return false;
} else {
proxy.$refs.passWord.style.borderColor = 'rgba(0, 0, 0, 0.15)';
if (errorMsg.value === '请输入有效的手机号码') {
errorMsg.value = null;
}
proxy.$refs.phoneInput.style.borderColor = 'rgba(0, 0, 0, 0.15)';
}
}
// const
if (type === 'password' || type === 'all') {
if (modalType.value !== 'loginByPhone') {
if(!/^.{6,20}$/.test(password.value?.toString() || '')) {
proxy.$refs.passWord.style.borderColor = '#c0322b';
errorMsg.value = '请输入6-20位有效密码';
return false;
} else {
if (errorMsg.value === '请输入6-20位有效密码') {
errorMsg.value = null;
}
proxy.$refs.passWord.style.borderColor = 'rgba(0, 0, 0, 0.15)';
}
}
}
return true;
......@@ -282,7 +299,7 @@ const verify = () => {
const login = debounce(
async () => {
errorMsg.value = null;
if (!verify()) {
if (!verify('all')) {
return;
}
const url: string =
......@@ -315,7 +332,7 @@ const login = debounce(
const sendMessage = debounce(
async () => {
errorMsg.value = null;
if (!verify() || interval.value !== 0) {
if (!verify('all') || interval.value !== 0) {
return;
}
const sendType: any = {
......@@ -354,7 +371,7 @@ const sendMessage = debounce(
*/
const resetPassWord = async () => {
errorMsg.value = null;
if (!verify()) {
if (!verify('all')) {
return;
}
request(RequestUrl.forget);
......@@ -376,7 +393,7 @@ const resetPassWord = async () => {
*/
const register = async () => {
errorMsg.value = null;
if (!verify()) {
if (!verify('all')) {
return;
}
if (!agree.value.length) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment