Bladeren bron

企业注册

lifanagju_citu 8 maanden geleden
bovenliggende
commit
d3314ce2bc
3 gewijzigde bestanden met toevoegingen van 76 en 8 verwijderingen
  1. 63 4
      src/views/recruit/enterprise/register/register.vue
  2. 11 2
      src/views/register/company.vue
  3. 2 2
      src/views/register/select.vue

+ 63 - 4
src/views/recruit/enterprise/register/register.vue

@@ -1,7 +1,8 @@
 <template>
-  <div class="my-5">
+  <div class="login-box pb-5">
     <div :class="isMobile? 'mobileBox' : 'default-width'">
-      <v-btn class="my-2" color="primary" variant="text" size="large" @click="router.push('/recruitHome')">{{ `<< 回到首页` }}</v-btn>
+      <v-btn v-if="btnType === 1" class="my-2" color="black" variant="text" size="large" @click="router.go(-1)">{{ `<< 返回` }}</v-btn>
+      <v-btn v-else class="my-2" color="primary" variant="text" size="large" @click="router.push('/recruitHome')">{{ `<< 回到首页` }}</v-btn>
     </div>
     <v-card class="pa-5" :class="isMobile? 'mobileBox' : 'default-width'" :elevation="isMobile? '0' : '3'">
       <!-- 标题 -->
@@ -79,6 +80,10 @@ onMounted(() => {
   isMobile.value = /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i.test(userAgent)
 })
 
+
+import { useRoute } from 'vue-router'; const route = useRoute()
+const btnType = route?.query?.type === 'login' ? 1 : 0
+
 // 是否筹建中
 const isPrepare = ref(false)
 const isPrepareChange = () => {
@@ -113,6 +118,8 @@ const formItems = ref({
       key: 'contactName',
       value: '',
       label: '联系人姓名 *',
+      // col: 6,
+      // flexStyle: 'mr-3',
       rules: [v => !!v || '请输入联系人姓名']
     },
     {
@@ -126,8 +133,32 @@ const formItems = ref({
       type: 'text',
       key: 'email',
       value: '',
-      label: '联系邮箱 *',
-      rules: [v => !!v || '请输入联系邮箱']
+      label: '联系邮箱(可用于企业登录) *',
+      rules: [
+        value => {
+          if (value) return true
+          return '请输入联系邮箱'
+        },
+        value => {
+          const pattern = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
+          if (pattern.test(value)) return true
+          return '请输入邮箱'
+        }
+      ]
+    },
+    {
+      type: 'text',
+      key: 'password',
+      value: '',
+      label: '设置邮箱登录密码',
+      placeholder: '若想使用邮箱登录,请设置密码'
+    },
+    {
+      type: 'text',
+      key: 'passwordConfirm',
+      value: '',
+      label: '确认邮箱登录密码',
+      placeholder: '请输入与上面邮箱登录相同的密码'
     },
     {
       type: 'textarea',
@@ -149,6 +180,7 @@ let licenseUrl = ref('')
 const handleCommit = async () => {
   const { valid } = await CtFormRef.value.formRef.validate()
   if (!valid) return
+
   const businessLicenseUrl = licenseUrl.value;
   if (!isPrepare.value && !businessLicenseUrl) return Snackbar.warning('请上传营业执照图片')
   const params = {
@@ -156,6 +188,26 @@ const handleCommit = async () => {
     prepare: isPrepare.value,
   }
   formItems.value.options.forEach(e => { params[e.key] = e.value })
+  // 邮箱登录密码校验
+  if (params.password && !params.passwordConfirm) return Snackbar.warning('请输入确认邮箱登录密码')
+  // if (params.password && !params.passwordConfirm) {
+  //   const item = formItems.value.options.find(e => e.key == 'password')
+  //   if (item) item.rules = [v => !!v || '请输入确认邮箱登录密码']
+  //   Snackbar.warning('请输入确认邮箱登录密码')
+  //   return
+  // }
+  if (params.passwordConfirm && !params.password) return Snackbar.warning('请输入邮箱登录密码')
+  if (params.passwordConfirm !== params.password) return Snackbar.warning('两次输入的邮箱登录密码不一致,请确认输入内容')
+  
+  if (params.passwordConfirm !== params.password) {
+    const password = formItems.value.options.find(e => e.key == 'password')
+    if (password) password.rules = [true]
+    // const passwordConfirm = formItems.value.options.find(e => e.key == 'password')
+    // if (passwordConfirm) passwordConfirm.rules = [v => !!v || '请输入确认邮箱登录密码']
+    Snackbar.warning('请输入确认邮箱登录密码')
+    return
+  }
+
   await enterpriseRegisterApply(params)
   Snackbar.success(t('common.submittedSuccessfully'))
   router.push({ path: '/recruit/enterprise/register/inReview' })
@@ -183,6 +235,13 @@ if (info && Object.keys(info).length && info.status === '2') {
   font-size: 14px;
   line-height: 32px;
 }
+.login-box {
+  position: relative;
+  width: 100%;
+  height: 100%;
+  background-image: url('https://www.mendunerhr.com/images/userfiles/92d7e4a755e2428b94aab3636d5047f3/images/recruitment/adImages/2018/11/1920x940.jpg');
+  background-size: cover;
+}
 .file-box {
   display: flex;
   flex-wrap: wrap; /* 允许换行 */

+ 11 - 2
src/views/register/company.vue

@@ -115,9 +115,16 @@ const formItems = ref({
       type: 'text',
       key: 'password',
       value: '',
-      label: '邮箱登录密码',
+      label: '设置邮箱登录密码',
       placeholder: '若想使用邮箱登录,请设置密码'
     },
+    {
+      type: 'text',
+      key: 'passwordConfirm',
+      value: '',
+      label: '确认邮箱登录密码',
+      placeholder: '请输入与上面邮箱登录相同的密码'
+    },
     {
       type: 'textarea',
       key: 'description',
@@ -136,7 +143,9 @@ const handleValidate = () => {
   valid.value = true
 }
 
-const handleCommit = async () => {}
+const handleCommit = async () => {
+  
+}
 </script>
 
 <style scoped lang="scss">

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

@@ -3,7 +3,7 @@
     <div class="register-content">
       <h2 style="color: #666; font-weight: 400;">请选择您当前注册的身份</h2>
       <div class="d-flex mt-16">
-        <div style="width: 50%;" class="cursor-pointer item pa-3" @click="handleToRegister('/register/company')">
+        <div style="width: 50%;" class="cursor-pointer item pa-3" @click="handleToRegister('/recruit/enterprise/register')">
           <v-icon color="primary" size="100">mdi-home-city-outline</v-icon>
           <div class="color-primary" style="font-size: 24px">企业用户</div>
         </div>
@@ -23,7 +23,7 @@ import { useRouter } from 'vue-router'
 const router = useRouter()
 
 const handleToRegister = (path) => {
-  router.push({ path })
+  router.push({ path, query: { type: 'login' } })
 }
 </script>