功能:统一账号输入校验并调整首页轮播图
This commit is contained in:
@@ -111,7 +111,11 @@
|
||||
:wrapper-col="{ span: 16 }"
|
||||
>
|
||||
<a-form-item label="账号" name="account">
|
||||
<a-input v-model:value="formState.account" placeholder="请输入账号" />
|
||||
<a-input
|
||||
v-model:value="formState.account"
|
||||
placeholder="请输入账号"
|
||||
@input="handleAccountInput"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="昵称" name="nickname">
|
||||
<a-input v-model:value="formState.nickname" placeholder="请输入昵称" />
|
||||
@@ -360,6 +364,7 @@ import { message, Modal } from 'ant-design-vue'
|
||||
import type { FormInstance } from 'ant-design-vue'
|
||||
import { PlusOutlined } from '@ant-design/icons-vue'
|
||||
import { DEFAULT_AVATAR } from '@/constants'
|
||||
import { ACCOUNT_REGEX, ACCOUNT_RULE_MESSAGE, sanitizeAccountInput } from '@/utils/account'
|
||||
import {
|
||||
adminShopApi,
|
||||
adminUserApi,
|
||||
@@ -427,6 +432,13 @@ const formState = reactive({
|
||||
shopIds: [] as string[]
|
||||
})
|
||||
|
||||
const handleAccountInput = () => {
|
||||
const normalized = sanitizeAccountInput(formState.account)
|
||||
if (normalized !== formState.account) {
|
||||
formState.account = normalized
|
||||
}
|
||||
}
|
||||
|
||||
const balanceForm = reactive<AdminUserBalanceChangeRequest>({
|
||||
changeScene: 'RECHARGE',
|
||||
amount: undefined as unknown as number,
|
||||
@@ -441,7 +453,10 @@ const vipForm = reactive<AdminUserVipOverrideRequest>({
|
||||
})
|
||||
|
||||
const formRules = {
|
||||
account: [{ required: true, message: '请输入账号', trigger: 'blur' }],
|
||||
account: [
|
||||
{ required: true, message: '请输入账号', trigger: 'blur' },
|
||||
{ pattern: ACCOUNT_REGEX, message: ACCOUNT_RULE_MESSAGE, trigger: 'blur' }
|
||||
],
|
||||
nickname: [{ required: true, message: '请输入昵称', trigger: 'blur' }],
|
||||
phone: [
|
||||
{ required: true, message: '请输入手机号', trigger: 'blur' },
|
||||
|
||||
Reference in New Issue
Block a user