|
@@ -46,25 +46,32 @@ const props = defineProps({ phoneDisabled: Boolean, placeholder: String, validEm
|
|
|
const passwordType = ref(false)
|
|
|
const emits = defineEmits(['handleEnter'])
|
|
|
|
|
|
-const phoneRules = ref([
|
|
|
- value => {
|
|
|
- if (value) return true
|
|
|
- return props.placeholder ? props.placeholder : '请输入手机号码'
|
|
|
- },
|
|
|
- value => {
|
|
|
- if (value?.length <= 11 && /^1[3456789]\d{9}$/.test(value)) return true
|
|
|
- return t('login.correctPhoneNumber')
|
|
|
- }
|
|
|
-])
|
|
|
+const phoneRules = ref([])
|
|
|
|
|
|
-// 邮箱效验
|
|
|
if (props.validEmail) {
|
|
|
- phoneRules.value.push(
|
|
|
+ // 邮箱效验
|
|
|
+ phoneRules.value = [
|
|
|
+ value => {
|
|
|
+ if (value) return true
|
|
|
+ return props.placeholder ? props.placeholder : '请输入企业邮箱'
|
|
|
+ },
|
|
|
value => {
|
|
|
if (checkEmail(value)) return true
|
|
|
return '请输入正确的企业邮箱'
|
|
|
}
|
|
|
- )
|
|
|
+ ]
|
|
|
+} else {
|
|
|
+ // 手机号码效验
|
|
|
+ phoneRules.value = [
|
|
|
+ value => {
|
|
|
+ if (value) return true
|
|
|
+ return props.placeholder ? props.placeholder : '请输入手机号码'
|
|
|
+ },
|
|
|
+ value => {
|
|
|
+ if (value?.length <= 11 && /^1[3456789]\d{9}$/.test(value)) return true
|
|
|
+ return t('login.correctPhoneNumber')
|
|
|
+ }
|
|
|
+ ]
|
|
|
}
|
|
|
|
|
|
// 手机号区域
|