فهرست منبع

切换为企业-校验企业必填信息-弹窗提示去填写

lifanagju_citu 8 ماه پیش
والد
کامیت
65a7ca9cae

+ 3 - 5
src/layout/personal/navBar.vue

@@ -192,17 +192,15 @@ const changeLoginType = async () => {
   else getApplyInfo()
 }
 
-import Snackbar from '@/plugins/snackbar'
 // 切换为招聘者
 const toEnterprise = async (enterpriseId) => {
   await getUserBindEnterpriseList({ enterpriseId })
   // 获取企业账号令牌以及企业用户个人信息
   await userStore.changeRole(enterpriseId)
-  const check = await userStore.checkEnterpriseBaseInfo()
   // router.push({ path: '/recruit/enterprise' })
-  const href = check ? '/recruit/enterprise' : '/recruit/enterprise/informationManagement/informationSettings'
-  Snackbar.info('请完善企业信息设置!')
-  window.location.href = href
+
+  // 跳转企业路由 且验证是否已完善必填基本信息
+  window.location.href = '/enterpriseVerification'
 }
 
 // 查看用户是否有在申请中的数据

+ 3 - 0
src/permission.js

@@ -3,16 +3,19 @@ import { useNProgress } from '@/hooks/web/useNProgress'
 import { useTitle } from '@/hooks/web/useTitle'
 import { getToken, getEnterpriseToken, removeToken } from '@/utils/auth'
 import { useDictStore } from '@/store/dict'
+import { useUserStore } from '@/store/user'
 
 const { start, done } = useNProgress()
 // loginType:1.enterprise: 企业路由
 //            2.personal: 个人路由
+//            3.common: 没有限制访问权限
 //            3.personalCommon: 无需登录也能访问的页面,但登录企业不能访问
 // 路由守卫
 router.beforeEach(async (to, from, next) => {
   start()
   // loadStart()
   if (getToken()) {
+    if (to.path === '/enterpriseVerification') useUserStore().checkEnterpriseBaseInfo() // 校验企业必填信息
     if (to.path === '/login') {
       if (getEnterpriseToken()) next({ path: '/enterprise' }) // 已登录企业
       else next({ path: '/recruitHome' }) // 已登录个人账号

+ 16 - 3
src/store/user.js

@@ -18,6 +18,7 @@ import Snackbar from '@/plugins/snackbar'
 import { timesTampChange } from '@/utils/date'
 import { updateEventList } from '@/utils/eventList'
 import { getBaseInfoDictOfName } from '@/utils/getText'
+import Confirm from '@/plugins/confirm'
 
 // import { useIMStore } from './im'
 
@@ -160,12 +161,24 @@ export const useUserStore = defineStore('user',
         localStorage.setItem('enterpriseUserAccount', JSON.stringify(data))
         return data // 方便直接获取
       },
+
       // 获取《企业基本信息》
       async checkEnterpriseBaseInfo () {
         const data = await getEnterpriseBaseInfo()
-        const keyArr = ['industryId', 'financingStatus', 'scale', 'introduce', 'logoUrl'] // 必填信息
-        const check = Object.keys(data).length && keyArr.every(e => data[e] && data[e] !== 0) // 校验必填人才信息
-        return check
+        // 检验必填信息
+        const keyArr = ['industryId', 'financingStatus', 'scale', 'introduce', 'logoUrl'] // 必填信息列表
+        let href = '/recruit/enterprise/informationManagement/informationSettings'
+        const valid = Object.keys(data).length && keyArr.every(e => {
+          const bool = data[e] && data[e] !== 0
+          if (!bool && e === 'logoUrl') href = '/recruit/enterprise/informationManagement/informationSettings?tabKey=2'
+          return bool
+        })
+        if (!valid) {
+          Confirm('系统提示', '企业信息设置未完善,是否前往完善?').then(() => {
+            window.location.href = href
+          })
+        }
+        // return valid
       },
 
       // 获取用户账户信息

+ 3 - 1
src/views/recruit/enterprise/informationManagement/informationSettings.vue

@@ -46,8 +46,10 @@ const tabList = [
   { label: t('setting.realNameAuthentication'), value: 6, path: authentication },
 ]
 
+watch(() => route?.query?.tabKey, (newVal) => { // newQuery, oldQuery
+  if (newVal) tab.value = newVal - 0
+}, { deep: true, immediate: true })
 
-watch(() => route?.query?.tabKey, (newVal) => { if (newVal) tab.value = newVal - 0 })
 const handleTabClick = () => {
   // 基本信息-获取企业管理员实名认证信息
   if (tab.value === 1) {