完成Salon小程序合规整改
This commit is contained in:
@@ -220,7 +220,7 @@
|
||||
<a-form-item label="账号" name="account">
|
||||
<a-input
|
||||
v-model:value="formState.account"
|
||||
placeholder="请输入账号"
|
||||
:placeholder="isEdit && isMaskedSensitiveValue(currentUser?.account) ? '已设置账号,留空保持不变' : '请输入账号'"
|
||||
@input="handleAccountInput"
|
||||
/>
|
||||
</a-form-item>
|
||||
@@ -230,7 +230,7 @@
|
||||
<a-form-item label="手机号" name="phone">
|
||||
<a-input
|
||||
v-model:value="formState.phone"
|
||||
placeholder="请输入手机号"
|
||||
:placeholder="isEdit && isMaskedSensitiveValue(currentUser?.phone) ? '已设置手机号,留空保持不变' : '请输入手机号'"
|
||||
:maxlength="11"
|
||||
inputmode="numeric"
|
||||
autocomplete="off"
|
||||
@@ -964,6 +964,8 @@ const validatePhoneUniqueness = async (value: string) => {
|
||||
}
|
||||
}
|
||||
|
||||
const isMaskedSensitiveValue = (value?: string | null) => /^1[3-9]\d\*{4}\d{4}$/.test(String(value || '').trim())
|
||||
|
||||
const validateOptionalPasswordStrength = (value?: string) => {
|
||||
const password = value?.trim()
|
||||
if (!password) {
|
||||
@@ -1089,14 +1091,21 @@ const handleClearVipDraft = (showMessage = true) => {
|
||||
*/
|
||||
const formRules = {
|
||||
account: [
|
||||
{ required: true, message: '请输入账号', trigger: 'blur' },
|
||||
{ pattern: ACCOUNT_REGEX, message: ACCOUNT_RULE_MESSAGE, trigger: 'blur' }
|
||||
{
|
||||
validator: (_rule: unknown, value: string) => {
|
||||
if (isEdit.value && !value?.trim()) return Promise.resolve()
|
||||
if (!value?.trim()) return Promise.reject('请输入账号')
|
||||
if (!ACCOUNT_REGEX.test(value.trim())) return Promise.reject(ACCOUNT_RULE_MESSAGE)
|
||||
return Promise.resolve()
|
||||
},
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
nickname: [{ required: true, message: '请输入昵称', trigger: 'blur' }],
|
||||
phone: [
|
||||
{ required: true, message: '请输入手机号', trigger: 'blur' },
|
||||
{
|
||||
validator: async (_rule: unknown, value: string) => {
|
||||
if (isEdit.value && !value?.trim()) return Promise.resolve()
|
||||
await validatePhoneUniqueness(value)
|
||||
return Promise.resolve()
|
||||
},
|
||||
@@ -1480,10 +1489,10 @@ const showEditModal = (record: any) => {
|
||||
isEdit.value = true
|
||||
currentUser.value = record
|
||||
Object.assign(formState, {
|
||||
account: record.account,
|
||||
account: isMaskedSensitiveValue(record.account) ? '' : record.account,
|
||||
nickname: record.nickname,
|
||||
phone: record.phone || record.contactPhone || '',
|
||||
contactPhone: record.phone || record.contactPhone || '',
|
||||
phone: isMaskedSensitiveValue(record.phone || record.contactPhone) ? '' : (record.phone || record.contactPhone || ''),
|
||||
contactPhone: isMaskedSensitiveValue(record.phone || record.contactPhone) ? '' : (record.phone || record.contactPhone || ''),
|
||||
birthday: record.birthday || '',
|
||||
wechatId: record.wechatId || '',
|
||||
wechatQrCode: record.wechatQrCode || '',
|
||||
@@ -1492,6 +1501,11 @@ const showEditModal = (record: any) => {
|
||||
shopIds: resolveEditableShopIds(record)
|
||||
})
|
||||
restoreDraft()
|
||||
if (isMaskedSensitiveValue(formState.account)) formState.account = ''
|
||||
if (isMaskedSensitiveValue(formState.phone)) {
|
||||
formState.phone = ''
|
||||
formState.contactPhone = ''
|
||||
}
|
||||
modalVisible.value = true
|
||||
}
|
||||
|
||||
@@ -1584,6 +1598,12 @@ const handleModalOk = async () => {
|
||||
...(formState.password.trim() ? { password: formState.password.trim() } : {})
|
||||
}
|
||||
|
||||
if (isEdit.value && !formState.account.trim()) delete requestData.account
|
||||
if (isEdit.value && !primaryPhone) {
|
||||
delete requestData.phone
|
||||
delete requestData.contactPhone
|
||||
}
|
||||
|
||||
if (isEdit.value && currentUserType.value !== 4) {
|
||||
delete requestData.shopIds
|
||||
delete requestData.shopId
|
||||
|
||||
Reference in New Issue
Block a user