|
@@ -5,6 +5,7 @@ import { getToken, getIsEnterprise } from '@/utils/auth'
|
|
|
// import { useDictStore } from '@/store/dict'
|
|
|
import { useUserStore } from '@/store/user'
|
|
|
import Confirm from '@/plugins/confirm'
|
|
|
+import fullScreen from '@/plugins/fullScreen'
|
|
|
import dialogExtend from '@/plugins/dialogExtend'
|
|
|
import { useMallStore } from '@/store/mall'
|
|
|
import { useEnterpriseStore } from '@/store/enterprise'
|
|
@@ -76,15 +77,37 @@ router.beforeEach(async (to, from, next) => {
|
|
|
next('/404')
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+ // 强制修改密码
|
|
|
+ if (localStorage.getItem('entUpdatePassword') === 'needChange') fullScreen('entUpdatePassword')
|
|
|
+ // 企业登录-招聘会广告
|
|
|
+ else if (hasRoute('/recruit/enterprise/jobFair/index') && !localStorage.getItem('jobFairAd') && tokenIndex === 1) {
|
|
|
+ localStorage.setItem('jobFairAd', 'hasBeenShow')
|
|
|
+ dialogExtend('jobFairAd')
|
|
|
+ }
|
|
|
+ // 企业登录-免费职位广告提示
|
|
|
+ else if (hasRoute('/recruit/enterprise/position/index') && localStorage.getItem('positionAd') && tokenIndex === 1) {
|
|
|
+ localStorage.setItem('positionAd', '')
|
|
|
+ dialogExtend('positionAd')
|
|
|
+ }
|
|
|
+ // 企业信息完成度提示(只有企业管理弹)
|
|
|
+ else if (localStorage.getItem('checkEnterpriseBaseInfoFalseHref') && tokenIndex === 1) {
|
|
|
+ if (to.path !== '/recruit/enterprise/position/add') { // 除了点击企业登录免费职位广告提示跳转路由不提示
|
|
|
+ const href = localStorage.getItem('checkEnterpriseBaseInfoFalseHref')
|
|
|
+ localStorage.setItem('checkEnterpriseBaseInfoFalseHref', '')
|
|
|
+ localStorage.setItem('entUpdatePassword', '')
|
|
|
+ if (to.path !== href) {
|
|
|
+ setTimeout(() => {
|
|
|
+ Confirm('系统提示', '企业信息设置未完善,是否前往完善?').then(() => {
|
|
|
+ window.location.href = href
|
|
|
+ })
|
|
|
+ }, 4000)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if (to.path === ENTERPRISE_PATH) {
|
|
|
next(findPath(routes))
|
|
|
- // const firstPath = routes[0]
|
|
|
- // if (!firstPath.children) {
|
|
|
- // next(firstPath.path)
|
|
|
- // } else {
|
|
|
- // // 查找二级路由
|
|
|
- // next(routes[0].children[0].path)
|
|
|
- // }
|
|
|
function findPath (nodes, root = '') {
|
|
|
const first = nodes[0]
|
|
|
const path = root + first.path
|
|
@@ -94,6 +117,7 @@ router.beforeEach(async (to, from, next) => {
|
|
|
return findPath(first.children, path + '/')
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
next({ ...to, replace: true })
|
|
|
return
|
|
|
}
|
|
@@ -103,43 +127,15 @@ router.beforeEach(async (to, from, next) => {
|
|
|
return
|
|
|
}
|
|
|
}
|
|
|
- // 强制修改密码
|
|
|
- if (localStorage.getItem('entUpdatePassword') === 'needChange') fullScreen('entUpdatePassword')
|
|
|
+
|
|
|
// 强制填写个人信息 fddeaddc47868b/ready
|
|
|
- else if (localStorage.getItem('chooseRole') === 'showChooseRole' && to.path !== '/register/selectedPersonRole' && tokenIndex === 2) next('/register/selectedPersonRole')
|
|
|
+ if (localStorage.getItem('chooseRole') === 'showChooseRole' && to.path !== '/register/selectedPersonRole' && tokenIndex === 2) next('/register/selectedPersonRole')
|
|
|
else if (localStorage.getItem('necessaryInfoReady') === 'fddeaddc47868b' && tokenIndex === 2 && localStorage.getItem('chooseRole') !== 'showChooseRole') dialogExtend('necessaryInfoDialog')
|
|
|
- // 企业登录-招聘会广告
|
|
|
- else if (!localStorage.getItem('jobFairAd') && tokenIndex === 1) {
|
|
|
- localStorage.setItem('jobFairAd', 'hasBeenShow')
|
|
|
- dialogExtend('jobFairAd')
|
|
|
- }
|
|
|
- // 企业登录-免费职位广告提示
|
|
|
- else if (localStorage.getItem('positionAd') && tokenIndex === 1) {
|
|
|
- localStorage.setItem('positionAd', '')
|
|
|
- dialogExtend('positionAd')
|
|
|
- }
|
|
|
- // 企业信息完成度提示
|
|
|
- else if (localStorage.getItem('checkEnterpriseBaseInfoFalseHref') && tokenIndex === 1) {
|
|
|
- if (to.path !== '/recruit/enterprise/position/add') { // 除了点击企业登录免费职位广告提示跳转路由不提示
|
|
|
- const href = localStorage.getItem('checkEnterpriseBaseInfoFalseHref')
|
|
|
- localStorage.setItem('checkEnterpriseBaseInfoFalseHref', '')
|
|
|
- localStorage.setItem('entUpdatePassword', '')
|
|
|
- if (to.path !== href) {
|
|
|
- setTimeout(() => {
|
|
|
- Confirm('系统提示', '企业信息设置未完善,是否前往完善?').then(() => {
|
|
|
- window.location.href = href
|
|
|
- })
|
|
|
- }, 4000)
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
if (to.fullPath === '/login') {
|
|
|
next('/recruitHome')
|
|
|
return
|
|
|
}
|
|
|
- // 获取字典信息
|
|
|
- // const dictStore = useDictStore()
|
|
|
- // dictStore.getDictTypeData()
|
|
|
next()
|
|
|
return
|
|
|
}
|