Forráskód Böngészése

手机号不能重复,校验邮箱格式

lifanagju_citu 4 hónapja
szülő
commit
4f57a2bde5
1 módosított fájl, 16 hozzáadás és 2 törlés
  1. 16 2
      src/views/recruit/entRegister/register.vue

+ 16 - 2
src/views/recruit/entRegister/register.vue

@@ -350,28 +350,35 @@ if (info && Object.keys(info).length && info.status === '2') {
 const contactSubmit = () => {
   let falseValueIndex = null
   let falseKey = null
+  let phoneList = []
   let emailList = []
   contactCopy.value.forEach((e, index) => {
     if (falseValueIndex !== null) return
     if (e && Object.keys(e).length) {
       Object.keys(e).forEach(key => {
         if (falseValueIndex !== null) return
-        if (!e[key]) {
+        if (!e[key] ) {
           falseValueIndex = index
           falseKey = key
         }
       })
     }
+    if (e.email && !checkCompanyEmail(e.email)) {
+      falseValueIndex = index
+      falseKey = 'emailCheck'
+    }
     if (e.password && e.passwordConfirm && e.password !== e.passwordConfirm) {
       falseValueIndex = index
       falseKey = 'compareFalse'
     }
+    if (e.phone) phoneList.push(e.phone)
     if (e.email) emailList.push(e.email)
   })
   const textList =  {
     contactName: '姓名',
     phone: '联系电话',
     email: '企业邮箱',
+    emailCheck: '企业邮箱格式',
     password: '登录密码',
     passwordConfirm: '登录密码',
   }
@@ -386,10 +393,17 @@ const contactSubmit = () => {
     Confirm(t('common.confirmTitle'), text, { hideCancelBtn: true })
     return
   }
+  // 联系电话不能相同
+  const phone_duplicates = findFirstDuplicateWithIndices(phoneList)
+  if (phone_duplicates) {
+    let text = phone_duplicates.firstIndex ? `联系人${phone_duplicates.firstIndex}的联系电话和联系人${phone_duplicates.secondIndex} 的联系电话重复,请修改!` : `管理员的联系电话和联系人${phone_duplicates.secondIndex} 的联系电话重复,请修改!`
+    Confirm(t('common.confirmTitle'), text, { hideCancelBtn: true })
+    return
+  }
   // 邮箱不能相同
   const duplicates = findFirstDuplicateWithIndices(emailList)
   if (duplicates) {
-    let text = duplicates.firstIndex ? `联系人${duplicates.firstIndex}的企业邮箱和联系人${duplicates.secondIndex}的企业邮箱重复,请修改!` : `管理员的企业邮箱和联系人${duplicates.secondIndex}的企业邮箱重复,请修改!`
+    let text = duplicates.firstIndex ? `联系人${duplicates.firstIndex}的企业邮箱和联系人${duplicates.secondIndex} 的企业邮箱重复,请修改!` : `管理员的企业邮箱和联系人${duplicates.secondIndex} 的企业邮箱重复,请修改!`
     Confirm(t('common.confirmTitle'), text, { hideCancelBtn: true })
     return
   }