优化登录提示语,优化request错误返回提示语

This commit is contained in:
zhouyanli
2026-05-12 17:33:46 +08:00
parent f2f5c5e050
commit fa017d657f
8 changed files with 119 additions and 39 deletions

View File

@@ -74,7 +74,7 @@
<!-- 立即注册按钮 -->
<button class="register-btn" :disabled="!canRegister" @click="handleRegister">
<button class="register-btn" @click="handleRegister">
立即注册
</button>
@@ -191,7 +191,46 @@
// 处理注册逻辑
const handleRegister = () => {
if (!canRegister.value) return;
if (!phoneNumber.value) {
uni.showToast({ title: '请输入手机号', icon: 'none' });
return;
}
if (!/^1[3-9]\d{9}$/.test(phoneNumber.value)) {
uni.showToast({ title: '请输入正确的手机号', icon: 'none' });
return;
}
if (!verifyCode.value) {
uni.showToast({ title: '请输入验证码', icon: 'none' });
return;
}
if (!/^\d{6}$/.test(verifyCode.value)) {
uni.showToast({ title: '验证码为 6 位数字', icon: 'none' });
return;
}
if (!account.value) {
uni.showToast({ title: '请输入账号', icon: 'none' });
return;
}
if (account.value.length < 4 || account.value.length > 20) {
uni.showToast({ title: '账号长度需为 4-20 位', icon: 'none' });
return;
}
if (!password.value) {
uni.showToast({ title: '请输入密码', icon: 'none' });
return;
}
if (password.value.length < 6) {
uni.showToast({ title: '密码至少输入 6 位', icon: 'none' });
return;
}
if (password.value.length > 16) {
uni.showToast({ title: '密码不能超过 16 位', icon: 'none' });
return;
}
if (!agreeAgreement.value) {
uni.showToast({ title: '请勾选协议', icon: 'none' });
return;
}
uni.showLoading({
title: '注册中...',
mask: true