修复注册登录输入框限制等bug

This commit is contained in:
zhouyanli
2026-08-03 17:39:27 +08:00
parent 015ed25400
commit 5c8671a91e
6 changed files with 39 additions and 33 deletions

View File

@@ -61,7 +61,7 @@
<view class="info-item">
<view class="info-label">活动名额</view>
<view class="info-value">{{activityConent.quota}}</view>
<view class="info-value">{{ activityConent.quota == 0 ? '无限名额' : activityConent.quota + '人' }}</view>
</view>
<view class="info-item">

View File

@@ -40,9 +40,9 @@
<view class="input-icon">
<image src="https://wuyeadmin.bugtc.com/images/login/phone.png" mode="" style="height: 100%;width: 100%;"></image>
</view>
<uni-easyinput class="input-content" type="text" v-model="account"
placeholder="请输入帐号" :inputBorder="false" maxlength="20" :placeholderStyle="placeholderStyle">
</uni-easyinput>
<input class="native-input" type="text" v-model="account"
placeholder="请输入帐号" maxlength="20" :placeholderStyle="placeholderStyle"
auto-capitalize="off" auto-correct="off" />
</view>
<!-- 密码输入框 -->
@@ -50,9 +50,9 @@
<view class="input-icon">
<image src="https://wuyeadmin.bugtc.com/images/login/password.png" mode="" style="height: 100%;width: 100%;"></image>
</view>
<uni-easyinput class="input-content" type="password" v-model="password"
placeholder="请输入密码" :inputBorder="false" maxlength="16" :placeholderStyle="placeholderStyle">
</uni-easyinput>
<input class="native-input" type="password" v-model="password"
placeholder="请输入密码" maxlength="16" :placeholderStyle="placeholderStyle"
auto-capitalize="off" auto-correct="off" />
</view>
</template>
@@ -341,6 +341,15 @@ onUnmounted(() => {
height: 100%;
}
/* 原生输入框(账号/密码区分大小写) */
.native-input {
flex: 1;
font-size: 32rpx;
color: #333;
height: 88rpx;
line-height: 88rpx;
}
/* 深度覆盖 uni-easyinput 内部默认样式 */
.input-content :deep(.uni-easyinput__content) {
height: 100% !important;

View File

@@ -128,13 +128,13 @@
agreeAgreement.value;
});
// 实时校验密码格式(输入空格或特殊符号立即提示
// 实时校验密码格式(禁止颜文字/emoji/特殊符号,只允许中文、字母、数字
watch(password, (val) => {
if (!val) { passwordError.value = ''; return }
if (val.length < 6 || val.length > 16) {
passwordError.value = '密码需 6-16 位'
} else if (/[^a-zA-Z0-9]/.test(val)) {
passwordError.value = '密码格式错误'
} else if (/[^一-龥a-zA-Z0-9]/.test(val)) {
passwordError.value = '密码不能包含特殊符号或表情'
} else {
passwordError.value = ''
}
@@ -149,7 +149,7 @@
agreeAgreement.value = !agreeAgreement.value;
};
// 账号失焦校验
// 账号失焦校验(禁止颜文字/emoji/特殊符号,只允许中文、字母、数字)
const validateAccount = () => {
const val = account.value
if (!val) { accountError.value = ''; return }
@@ -157,6 +157,8 @@
accountError.value = '账号不能包含空格'
} else if (val.length < 4 || val.length > 20) {
accountError.value = '账号需 4-20 位'
} else if (/[^一-龥a-zA-Z0-9]/.test(val)) {
accountError.value = '账号不能包含特殊符号或表情'
} else {
accountError.value = ''
}
@@ -167,14 +169,14 @@
accountError.value = ''
};
// 密码失焦校验
// 密码失焦校验(禁止颜文字/emoji/特殊符号,只允许中文、字母、数字)
const validatePassword = () => {
const val = password.value
if (!val) { passwordError.value = ''; return }
if (val.length < 6 || val.length > 16) {
passwordError.value = '密码需 6-16 位'
} else if (/[^a-zA-Z0-9]/.test(val)) {
passwordError.value = '密码格式错误'
} else if (/[^一-龥a-zA-Z0-9]/.test(val)) {
passwordError.value = '密码不能包含特殊符号或表情'
} else {
passwordError.value = ''
}
@@ -286,7 +288,11 @@
return;
}
if (/\s/.test(account.value)) {
uni.showToast({ title: '账号格式不对,不允许注册', icon: 'none' });
uni.showToast({ title: '账号不能包含空格', icon: 'none' });
return;
}
if (/[^一-龥a-zA-Z0-9]/.test(account.value)) {
uni.showToast({ title: '账号不能包含特殊符号或表情', icon: 'none' });
return;
}
if (!password.value) {
@@ -301,8 +307,8 @@
uni.showToast({ title: '密码不能超过 16 位', icon: 'none' });
return;
}
if (/[^a-zA-Z0-9]/.test(password.value)) {
uni.showToast({ title: '密码格式错误', icon: 'none' });
if (/[^一-龥a-zA-Z0-9]/.test(password.value)) {
uni.showToast({ title: '密码不能包含特殊符号或表情', icon: 'none' });
return;
}
if (!agreeAgreement.value) {

View File

@@ -410,9 +410,7 @@ const submitForm = async () => {
projectId.value = ''
setTimeout(() => {
uni.navigateTo({
url:'/pageSubPack/online-repair/onlineRepair'
})
uni.navigateBack({ delta: 1 })
}, 1500)
} else {
submitting.value = false

View File

@@ -222,9 +222,8 @@ const submitForm = async () => {
// const tempProjectId = projectId.value
form.value = { title: '', desc: '', phone: '', images: [] }
repairProject.value = ''
// uni.navigateBack({ delta: 2 })
setTimeout(() => {
uni.navigateTo({ url: '/pageSubPack/online-repair/onlineRepair' })
uni.navigateBack({ delta: 1 })
}, 1500)
} else {
submitting.value = false