Browse Source

更新企业邮箱格式效验

Xiao_123 6 months ago
parent
commit
8ac78358ff

+ 2 - 2
src/components/VerificationCode/index.vue

@@ -62,7 +62,7 @@
 defineOptions({ name: 'verification-code' })
 import { ref, reactive } from 'vue'
 import { setCodeTime } from '@/utils/code'
-import { checkEmail } from '@/utils/validate'
+import { checkCompanyEmail } from '@/utils/validate'
 import { sendSmsCode } from '@/api/common/index'
 import { useI18n } from '@/hooks/web/useI18n'
 import Snackbar from '@/plugins/snackbar'
@@ -114,7 +114,7 @@ const emailRules = ref([
     return props.placeholder ? props.placeholder : '请输入企业邮箱'
   },
   value => {
-    if (checkEmail(value)) return true
+    if (checkCompanyEmail(value)) return true
     return '请输入正确的企业邮箱'
   }
 ])

+ 1 - 1
src/layout/company/navBar.vue

@@ -19,7 +19,7 @@
           </div>
           <div class="ml-3 cursor-pointer border-left border-right px-3 commonHover" @click="handleLogout(false)">我要求职</div>
           <div class="d-flex align-center px-3 border-right">
-            <div>{{ $t('enterprise.account.remainingPoints') }}:{{ enterpriseUserAccount?.balance || 0 }}点</div>
+            <div>{{ $t('enterprise.account.remainingPoints') }}:{{ enterpriseUserAccount?.balance ? enterpriseUserAccount?.balance / 100 : 0 }}点</div>
           </div>
           <!-- <svg-icon @click="handleToVip" name="vip" size="30" class="cursor-pointer ml-3"></svg-icon> -->
           

+ 6 - 0
src/utils/validate.js

@@ -62,6 +62,12 @@ export const checkEmail = (email) => {
   return emailReg.test(email)
 }
 
+// 企业邮箱效验
+const companyEmailReg = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
+export const checkCompanyEmail = (email) => {
+  return companyEmailReg.test(email)
+}
+
 // 效验社会统一认证编码
 const USCIReg = /^[0-9A-HJ-NPQRTUWXY]{2}\d{6}[0-9A-HJ-NPQRTUWXY]{10}$/;  
 export const checkUSCI = (code) => {  

+ 3 - 3
src/views/login/components/editPasswordEnt.vue

@@ -9,7 +9,7 @@
         density="compact"
         color="primary"
         prepend-inner-icon="mdi-email" 
-        :rules="[v=> !!v || '请输入企业邮箱', v=> checkEmail(v) || '邮箱格式不正确']"
+        :rules="[v=> !!v || '请输入企业邮箱', v=> checkCompanyEmail(v) || '邮箱格式不正确']"
       ></v-text-field>
       <v-text-field
         v-model.trim="query.code"
@@ -73,7 +73,7 @@ defineOptions({ name: 'editPasswordEnt'})
 import { ref, reactive, computed } from 'vue'
 import { entResetPassword, getEmailCode } from '@/api/common/index'
 import Snackbar from '@/plugins/snackbar'
-import { checkEmail } from '@/utils/validate'
+import { checkCompanyEmail } from '@/utils/validate'
 import Verify from '@/components/Verifition'
 import { setCodeTime } from '@/utils/code'
 import { useRouter } from 'vue-router'; const router = useRouter()
@@ -138,7 +138,7 @@ const showCode = ref(true)
 const count = ref(0)
 const timer = ref(null)
 const handleCode = async () => {
-  if (!query.email || !checkEmail(query.email)) {
+  if (!query.email || !checkCompanyEmail(query.email)) {
     Snackbar.warning('请输入企业邮箱')
     return
   }

+ 2 - 2
src/views/login/components/passwordPage.vue

@@ -48,7 +48,7 @@
 <script setup name="passwordPage">
 import { ref, reactive, computed } from 'vue'
 defineOptions({ name: 'password-form' })
-import { checkEmail } from '@/utils/validate'
+import { checkCompanyEmail } from '@/utils/validate'
 import { useI18n } from '@/hooks/web/useI18n'
 const { t } = useI18n()
 
@@ -66,7 +66,7 @@ if (props.validEmail) {
       return props.placeholder ? props.placeholder : '请输入企业邮箱'
     },
     value => {
-      if (checkEmail(value)) return true
+      if (checkCompanyEmail(value)) return true
       return '请输入正确的企业邮箱'
     }
   ]

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

@@ -107,7 +107,7 @@ import { useI18n } from '@/hooks/web/useI18n'
 import { useRouter } from 'vue-router'; const router = useRouter()
 import { enterpriseRegisterApply } from '@/api/personal/user'
 import { onMounted, ref, computed } from 'vue';
-import { checkEmail } from '@/utils/validate'
+import { checkCompanyEmail } from '@/utils/validate'
 import { getBusinessLicenseOCR } from '@/api/common'
 import Confirm from '@/plugins/confirm'
 import TextUI from '@/components/FormUI/TextInput'
@@ -122,7 +122,6 @@ const showPreview = ref(false)
 const current = ref(0)
 const business = ref({})
 let licenseUrl = ref('')
-// const email = localStorage.getItem('loginAccount') && checkEmail(localStorage.getItem('loginAccount')) ? localStorage.getItem('loginAccount') : ''
 
 // 组件挂载后添加事件监听器
 const isMobile = ref(false)
@@ -421,7 +420,7 @@ const emailObj = {
       return '请输入企业邮箱'
     },
     value => {
-      if (checkEmail(value)) return true
+      if (checkCompanyEmail(value)) return true
       return '请输入正确的企业邮箱'
     }
   ],

+ 2 - 2
src/views/recruit/enterprise/systemManagement/groupAccount/index.vue

@@ -105,7 +105,7 @@ import { getEnterpriseTree } from '@/api/recruit/enterprise/system/group'
 import { getEnterpriseUserList, systemUserEnable, systemUserDisable } from '@/api/recruit/enterprise/system/user'
 import Confirm from '@/plugins/confirm'
 import Snackbar from '@/plugins/snackbar'
-import { checkEmail } from '@/utils/validate'
+import { checkCompanyEmail } from '@/utils/validate'
 import { updateGroupUserAccount } from '@/api/enterprise'
 import { getDict } from '@/hooks/web/useDictionaries'
 import { getUserAvatar } from '@/utils/avatar'
@@ -250,7 +250,7 @@ const formItems = ref({
           return '请输入联系邮箱'
         },
         value => {
-          if (checkEmail(value)) return true
+          if (checkCompanyEmail(value)) return true
           return '请输入正确的电子邮箱'
         }
       ]

+ 2 - 2
src/views/register/person.vue

@@ -26,7 +26,7 @@ import { useRouter } from 'vue-router'
 import phoneFrom from '@/components/VerificationCode'
 import { useUserStore } from '@/store/user'
 import Snackbar from '@/plugins/snackbar'
-import { checkEmail } from '@/utils/validate'
+import { checkCompanyEmail } from '@/utils/validate'
 import navBar from '@/layout/personal/navBar.vue'
 
 const isMobile = ref(false)
@@ -52,7 +52,7 @@ const phoneRef = ref()
 const loading = ref(false)
 const isAgree = ref(false)
 const userStore = useUserStore()
-const phone = localStorage.getItem('loginAccount') && !checkEmail(localStorage.getItem('loginAccount')) ? localStorage.getItem('loginAccount') : ''
+const phone = localStorage.getItem('loginAccount') && !checkCompanyEmail(localStorage.getItem('loginAccount')) ? localStorage.getItem('loginAccount') : ''
 
 // 注册
 const handleRegister = async () => {