|
@@ -19,12 +19,44 @@ const getTenantPackageOptions = async () => {
|
|
}
|
|
}
|
|
getTenantPackageOptions()
|
|
getTenantPackageOptions()
|
|
|
|
|
|
|
|
+const validateName = (rule: any, value: any, callback: any) => {
|
|
|
|
+ const reg = /^[a-zA-Z0-9]{4,30}$/
|
|
|
|
+ if (value === '') {
|
|
|
|
+ callback(new Error('请输入用户名称'))
|
|
|
|
+ } else {
|
|
|
|
+ console.log(reg.test(rule), 'reg.test(rule)')
|
|
|
|
+ if (!reg.test(value)) {
|
|
|
|
+ callback(new Error('用户名称由 数字、字母 组成'))
|
|
|
|
+ } else {
|
|
|
|
+ callback()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+const validateMobile = (rule: any, value: any, callback: any) => {
|
|
|
|
+ const reg = /^1(3[0-9]|4[01456879]|5[0-35-9]|6[2567]|7[0-8]|8[0-9]|9[0-35-9])\d{8}$/
|
|
|
|
+ if (value === '') {
|
|
|
|
+ callback(new Error('请输入联系手机'))
|
|
|
|
+ } else {
|
|
|
|
+ if (!reg.test(value)) {
|
|
|
|
+ callback(new Error('请输入正确的手机号'))
|
|
|
|
+ } else {
|
|
|
|
+ callback()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
// 表单校验
|
|
// 表单校验
|
|
export const rules = reactive({
|
|
export const rules = reactive({
|
|
name: [required],
|
|
name: [required],
|
|
packageId: [required],
|
|
packageId: [required],
|
|
contactName: [required],
|
|
contactName: [required],
|
|
- contactMobile: [required],
|
|
|
|
|
|
+ contactMobile: [
|
|
|
|
+ required,
|
|
|
|
+ {
|
|
|
|
+ validator: validateMobile,
|
|
|
|
+ trigger: 'blur'
|
|
|
|
+ }
|
|
|
|
+ ],
|
|
accountCount: [required],
|
|
accountCount: [required],
|
|
expireTime: [required],
|
|
expireTime: [required],
|
|
username: [
|
|
username: [
|
|
@@ -34,7 +66,8 @@ export const rules = reactive({
|
|
max: 30,
|
|
max: 30,
|
|
trigger: 'blur',
|
|
trigger: 'blur',
|
|
message: '用户名称长度为 4-30 个字符'
|
|
message: '用户名称长度为 4-30 个字符'
|
|
- }
|
|
|
|
|
|
+ },
|
|
|
|
+ { validator: validateName, trigger: 'blur' }
|
|
],
|
|
],
|
|
password: [
|
|
password: [
|
|
required,
|
|
required,
|
|
@@ -90,7 +123,8 @@ const crudSchemas = reactive<VxeCrudSchema>({
|
|
title: '用户名称',
|
|
title: '用户名称',
|
|
field: 'username',
|
|
field: 'username',
|
|
isTable: false,
|
|
isTable: false,
|
|
- isDetail: false
|
|
|
|
|
|
+ isDetail: false,
|
|
|
|
+ isForm: false
|
|
},
|
|
},
|
|
{
|
|
{
|
|
title: '用户密码',
|
|
title: '用户密码',
|
|
@@ -99,7 +133,8 @@ const crudSchemas = reactive<VxeCrudSchema>({
|
|
isDetail: false,
|
|
isDetail: false,
|
|
form: {
|
|
form: {
|
|
component: 'InputPassword'
|
|
component: 'InputPassword'
|
|
- }
|
|
|
|
|
|
+ },
|
|
|
|
+ isForm: false
|
|
},
|
|
},
|
|
{
|
|
{
|
|
title: '账号额度',
|
|
title: '账号额度',
|