修复注册登录输入框限制等bug
This commit is contained in:
@@ -61,7 +61,7 @@
|
|||||||
|
|
||||||
<view class="info-item">
|
<view class="info-item">
|
||||||
<view class="info-label">活动名额</view>
|
<view class="info-label">活动名额</view>
|
||||||
<view class="info-value">{{activityConent.quota}}人</view>
|
<view class="info-value">{{ activityConent.quota == 0 ? '无限名额' : activityConent.quota + '人' }}</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="info-item">
|
<view class="info-item">
|
||||||
|
|||||||
@@ -40,9 +40,9 @@
|
|||||||
<view class="input-icon">
|
<view class="input-icon">
|
||||||
<image src="https://wuyeadmin.bugtc.com/images/login/phone.png" mode="" style="height: 100%;width: 100%;"></image>
|
<image src="https://wuyeadmin.bugtc.com/images/login/phone.png" mode="" style="height: 100%;width: 100%;"></image>
|
||||||
</view>
|
</view>
|
||||||
<uni-easyinput class="input-content" type="text" v-model="account"
|
<input class="native-input" type="text" v-model="account"
|
||||||
placeholder="请输入帐号" :inputBorder="false" maxlength="20" :placeholderStyle="placeholderStyle">
|
placeholder="请输入帐号" maxlength="20" :placeholderStyle="placeholderStyle"
|
||||||
</uni-easyinput>
|
auto-capitalize="off" auto-correct="off" />
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 密码输入框 -->
|
<!-- 密码输入框 -->
|
||||||
@@ -50,9 +50,9 @@
|
|||||||
<view class="input-icon">
|
<view class="input-icon">
|
||||||
<image src="https://wuyeadmin.bugtc.com/images/login/password.png" mode="" style="height: 100%;width: 100%;"></image>
|
<image src="https://wuyeadmin.bugtc.com/images/login/password.png" mode="" style="height: 100%;width: 100%;"></image>
|
||||||
</view>
|
</view>
|
||||||
<uni-easyinput class="input-content" type="password" v-model="password"
|
<input class="native-input" type="password" v-model="password"
|
||||||
placeholder="请输入密码" :inputBorder="false" maxlength="16" :placeholderStyle="placeholderStyle">
|
placeholder="请输入密码" maxlength="16" :placeholderStyle="placeholderStyle"
|
||||||
</uni-easyinput>
|
auto-capitalize="off" auto-correct="off" />
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -341,6 +341,15 @@ onUnmounted(() => {
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 原生输入框(账号/密码区分大小写) */
|
||||||
|
.native-input {
|
||||||
|
flex: 1;
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #333;
|
||||||
|
height: 88rpx;
|
||||||
|
line-height: 88rpx;
|
||||||
|
}
|
||||||
|
|
||||||
/* 深度覆盖 uni-easyinput 内部默认样式 */
|
/* 深度覆盖 uni-easyinput 内部默认样式 */
|
||||||
.input-content :deep(.uni-easyinput__content) {
|
.input-content :deep(.uni-easyinput__content) {
|
||||||
height: 100% !important;
|
height: 100% !important;
|
||||||
|
|||||||
@@ -128,13 +128,13 @@
|
|||||||
agreeAgreement.value;
|
agreeAgreement.value;
|
||||||
});
|
});
|
||||||
|
|
||||||
// 实时校验密码格式(输入空格或特殊符号立即提示)
|
// 实时校验密码格式(禁止颜文字/emoji/特殊符号,只允许中文、字母、数字)
|
||||||
watch(password, (val) => {
|
watch(password, (val) => {
|
||||||
if (!val) { passwordError.value = ''; return }
|
if (!val) { passwordError.value = ''; return }
|
||||||
if (val.length < 6 || val.length > 16) {
|
if (val.length < 6 || val.length > 16) {
|
||||||
passwordError.value = '密码需 6-16 位'
|
passwordError.value = '密码需 6-16 位'
|
||||||
} else if (/[^a-zA-Z0-9]/.test(val)) {
|
} else if (/[^一-龥a-zA-Z0-9]/.test(val)) {
|
||||||
passwordError.value = '密码格式错误'
|
passwordError.value = '密码不能包含特殊符号或表情'
|
||||||
} else {
|
} else {
|
||||||
passwordError.value = ''
|
passwordError.value = ''
|
||||||
}
|
}
|
||||||
@@ -149,7 +149,7 @@
|
|||||||
agreeAgreement.value = !agreeAgreement.value;
|
agreeAgreement.value = !agreeAgreement.value;
|
||||||
};
|
};
|
||||||
|
|
||||||
// 账号失焦校验
|
// 账号失焦校验(禁止颜文字/emoji/特殊符号,只允许中文、字母、数字)
|
||||||
const validateAccount = () => {
|
const validateAccount = () => {
|
||||||
const val = account.value
|
const val = account.value
|
||||||
if (!val) { accountError.value = ''; return }
|
if (!val) { accountError.value = ''; return }
|
||||||
@@ -157,6 +157,8 @@
|
|||||||
accountError.value = '账号不能包含空格'
|
accountError.value = '账号不能包含空格'
|
||||||
} else if (val.length < 4 || val.length > 20) {
|
} else if (val.length < 4 || val.length > 20) {
|
||||||
accountError.value = '账号需 4-20 位'
|
accountError.value = '账号需 4-20 位'
|
||||||
|
} else if (/[^一-龥a-zA-Z0-9]/.test(val)) {
|
||||||
|
accountError.value = '账号不能包含特殊符号或表情'
|
||||||
} else {
|
} else {
|
||||||
accountError.value = ''
|
accountError.value = ''
|
||||||
}
|
}
|
||||||
@@ -167,14 +169,14 @@
|
|||||||
accountError.value = ''
|
accountError.value = ''
|
||||||
};
|
};
|
||||||
|
|
||||||
// 密码失焦校验
|
// 密码失焦校验(禁止颜文字/emoji/特殊符号,只允许中文、字母、数字)
|
||||||
const validatePassword = () => {
|
const validatePassword = () => {
|
||||||
const val = password.value
|
const val = password.value
|
||||||
if (!val) { passwordError.value = ''; return }
|
if (!val) { passwordError.value = ''; return }
|
||||||
if (val.length < 6 || val.length > 16) {
|
if (val.length < 6 || val.length > 16) {
|
||||||
passwordError.value = '密码需 6-16 位'
|
passwordError.value = '密码需 6-16 位'
|
||||||
} else if (/[^a-zA-Z0-9]/.test(val)) {
|
} else if (/[^一-龥a-zA-Z0-9]/.test(val)) {
|
||||||
passwordError.value = '密码格式错误'
|
passwordError.value = '密码不能包含特殊符号或表情'
|
||||||
} else {
|
} else {
|
||||||
passwordError.value = ''
|
passwordError.value = ''
|
||||||
}
|
}
|
||||||
@@ -286,7 +288,11 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (/\s/.test(account.value)) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
if (!password.value) {
|
if (!password.value) {
|
||||||
@@ -301,8 +307,8 @@
|
|||||||
uni.showToast({ title: '密码不能超过 16 位', icon: 'none' });
|
uni.showToast({ title: '密码不能超过 16 位', icon: 'none' });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (/[^a-zA-Z0-9]/.test(password.value)) {
|
if (/[^一-龥a-zA-Z0-9]/.test(password.value)) {
|
||||||
uni.showToast({ title: '密码格式错误', icon: 'none' });
|
uni.showToast({ title: '密码不能包含特殊符号或表情', icon: 'none' });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!agreeAgreement.value) {
|
if (!agreeAgreement.value) {
|
||||||
|
|||||||
@@ -410,9 +410,7 @@ const submitForm = async () => {
|
|||||||
projectId.value = ''
|
projectId.value = ''
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
uni.navigateTo({
|
uni.navigateBack({ delta: 1 })
|
||||||
url:'/pageSubPack/online-repair/onlineRepair'
|
|
||||||
})
|
|
||||||
}, 1500)
|
}, 1500)
|
||||||
} else {
|
} else {
|
||||||
submitting.value = false
|
submitting.value = false
|
||||||
|
|||||||
@@ -222,9 +222,8 @@ const submitForm = async () => {
|
|||||||
// const tempProjectId = projectId.value
|
// const tempProjectId = projectId.value
|
||||||
form.value = { title: '', desc: '', phone: '', images: [] }
|
form.value = { title: '', desc: '', phone: '', images: [] }
|
||||||
repairProject.value = ''
|
repairProject.value = ''
|
||||||
// uni.navigateBack({ delta: 2 })
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
uni.navigateTo({ url: '/pageSubPack/online-repair/onlineRepair' })
|
uni.navigateBack({ delta: 1 })
|
||||||
}, 1500)
|
}, 1500)
|
||||||
} else {
|
} else {
|
||||||
submitting.value = false
|
submitting.value = false
|
||||||
|
|||||||
@@ -100,8 +100,8 @@
|
|||||||
const onItemClick = (item) => {
|
const onItemClick = (item) => {
|
||||||
if (!requireLogin()) return
|
if (!requireLogin()) return
|
||||||
const cachedVillageId = uni.getStorageSync('currentVillageId')
|
const cachedVillageId = uni.getStorageSync('currentVillageId')
|
||||||
// 设置不需要绑定小区
|
// 设置和我的房屋不需要绑定小区(我的房屋用于首次绑定)
|
||||||
if (item.title !== '设置') {
|
if (item.title !== '设置' && item.title !== '我的房屋') {
|
||||||
if (!cachedVillageId || cachedVillageId === '0' || cachedVillageId === 0) {
|
if (!cachedVillageId || cachedVillageId === '0' || cachedVillageId === 0) {
|
||||||
uni.showToast({ title: '未绑定小区,没有权限', icon: 'none', duration: 2000 })
|
uni.showToast({ title: '未绑定小区,没有权限', icon: 'none', duration: 2000 })
|
||||||
return
|
return
|
||||||
@@ -110,9 +110,7 @@
|
|||||||
if (item.title == '我的房屋') {
|
if (item.title == '我的房屋') {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pageSubPack/my/myHouseIndex',
|
url: '/pageSubPack/my/myHouseIndex',
|
||||||
success: res => {},
|
|
||||||
fail: () => {},
|
|
||||||
complete: () => {}
|
|
||||||
});
|
});
|
||||||
} else if (item.title == '住户管理') {
|
} else if (item.title == '住户管理') {
|
||||||
// uni.navigateTo({
|
// uni.navigateTo({
|
||||||
@@ -124,16 +122,12 @@
|
|||||||
} else if (item.title == '我的车位') {
|
} else if (item.title == '我的车位') {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pageSubPack/my/myParkingSpaceIndex',
|
url: '/pageSubPack/my/myParkingSpaceIndex',
|
||||||
success: res => {},
|
|
||||||
fail: () => {},
|
|
||||||
complete: () => {}
|
|
||||||
});
|
});
|
||||||
} else if (item.title == '我的车辆') {
|
} else if (item.title == '我的车辆') {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pageSubPack/my/myCarIndex',
|
url: '/pageSubPack/my/myCarIndex',
|
||||||
success: res => {},
|
|
||||||
fail: () => {},
|
|
||||||
complete: () => {}
|
|
||||||
});
|
});
|
||||||
} else if (item.title == '设置') {
|
} else if (item.title == '设置') {
|
||||||
goSetting()
|
goSetting()
|
||||||
|
|||||||
Reference in New Issue
Block a user