Переглянути джерело

Merge branch 'dev' of https://git.citupro.com/zhengnaiwen_citu/menduner into dev

Xiao_123 10 місяців тому
батько
коміт
126eb2ea75

+ 5 - 0
src/components/Enterprise/details.vue

@@ -74,6 +74,9 @@ import { getEnterpriseDetails, getEnterpriseSubscribeCheck, getEnterpriseSubscri
 import { timesTampChange } from '@/utils/date'
 import { dealDictObjData } from '@/utils/position'
 import { useRoute, useRouter } from 'vue-router'
+import { getPersonalToken } from '@/utils/auth'
+import Snackbar from '@/plugins/snackbar'
+import { useI18n } from '@/hooks/web/useI18n'; const { t } = useI18n()
 
 const props = defineProps({
   id: {
@@ -117,12 +120,14 @@ getDetails()
 // 效验求职者是否关注该企业
 const isCollection = ref(false)
 const getCollectionStatus = async (id) => {
+  if (!getPersonalToken()) return isCollection.value = false
   const data = await getEnterpriseSubscribeCheck({ enterpriseId: id })
   isCollection.value = data
 }
 
 // 关注&取消关注企业
 const handleFollow = async () => {
+  if (!getPersonalToken()) return Snackbar.warning(t('resume.changeRolePlease'))
   const api = isCollection.value ? getEnterpriseUnsubscribe : getEnterpriseSubscribe
   await api(isCollection.value ? props.id : { enterpriseId: props.id })
   getCollectionStatus(props.id)

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

@@ -46,7 +46,7 @@
 defineOptions({ name: 'enterprise-side'})
 import { computed } from 'vue'
 import { getCurrentLocaleLang } from '@/utils/lang.js'
-import enterpriseRoute from '@/router/modules/enterprise'
+import enterpriseRoute from '@/router/modules/components/recruit/enterprise'
 
 const list = computed(() => {
   return getList(enterpriseRoute)

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

@@ -27,7 +27,7 @@
         </div>
         
         <div class="d-flex user-nav">
-          <div class="btns d-flex align-center" v-if="!getToken()">
+          <div class="btns d-flex align-center" v-if="!getPersonalToken()">
             <!-- <span class="nav-resume-tools">
               <a href="">{{ $t('sys.lookingJob') }}</a>
               <a href="">{{ $t('sys.recruit') }}</a>
@@ -36,7 +36,7 @@
           </div>
           
           <!-- 头像用户名 -->
-          <div class="d-flex align-center" v-if="getToken()">
+          <div class="d-flex align-center" v-if="getPersonalToken()">
             <a target="_blank" href="/mall/purchasePackage" class="cursor-pointer mr-5" style="color: #FB8C00;">{{ $t('vipPackage.purchasePackage') }}</a>
             <span class="cursor-pointer" @click="router.push({ path: '/recruit/personal/TaskCenter' })">{{ $t('sys.signIn') }}</span>
             <span class="cursor-pointer mx-5">{{ $t('sys.news') }}</span>
@@ -105,7 +105,7 @@
 
 <script setup>
 import { ref } from 'vue'
-import { getToken } from '@/utils/auth'
+import { getPersonalToken } from '@/utils/auth'
 import { useUserStore } from '@/store/user'
 import { useLocaleStore } from '@/store/locale'
 import { useI18n } from '@/hooks/web/useI18n'
@@ -126,12 +126,12 @@ const localeStore = useLocaleStore()
 const userStore = useUserStore()
 
 const list = ref([
-  { text: t('common.home'), path: '/home' },
+  { text: t('common.home'), path: '/recruitHome' },
   { text: t('common.position'), path: '/recruit/personal/position' },
   { text: t('common.company'), path: '/recruit/personal/company' }
 ])
 
-const handleLogoClick = () => { window.open('/') } // /home 点击logo
+const handleLogoClick = () => { window.open('/') } // 点击logo
 const handleSubmit = () => { toEnterprise(radios.value) }
 
 // 查看用户是否有企业

+ 1 - 0
src/locales/en.js

@@ -213,6 +213,7 @@ export default {
     resumeYetSubmit: 'You have not uploaded your resume yet. Please upload your resume first before submitting it',
     alreadyResume: 'You have already submitted your resume, please do not resubmit it',
     deliverySuccess: 'Delivery successful',
+    changeRolePlease: 'Please switch to a job seeker and try again',
     selectedResumeNotExist: 'The currently selected resume does not exist',
     phoneNumber: 'Mobile phone number',
     userEmail: 'User email',

+ 1 - 0
src/locales/zh-CN.js

@@ -213,6 +213,7 @@ export default {
     resumeYetSubmit: '您还未上传过简历,请先上传简历后再投递',
     alreadyResume: '您已投递过简历,请勿重复投递',
     deliverySuccess: '投递成功',
+    changeRolePlease: '请切换成牛人后再试',
     selectedResumeNotExist: '当前选择的简历不存在',
     phoneNumber: '手机号码',
     userEmail: '用户邮箱',

+ 7 - 6
src/permission.js

@@ -1,7 +1,7 @@
 import router from './router'
 import { useNProgress } from '@/hooks/web/useNProgress'
 import { useTitle } from '@/hooks/web/useTitle'
-import { getToken, removeToken } from '@/utils/auth'
+import { getToken, getEnterpriseToken, removeToken } from '@/utils/auth'
 
 const { start, done } = useNProgress()
 // 路由不重定向白名单
@@ -22,21 +22,22 @@ const { start, done } = useNProgress()
 
 // loginType:1.enterprise: 企业路由
 //            2.personal: 个人路由
-//            3.noLogin: 无需登录也能访问的页面(personal里面的一种特殊类型,企业相关路由都需要登录)
+//            3.noLogin: 无需登录也能访问的页面
 // 路由守卫
 router.beforeEach(async (to, from, next) => {
   start()
   // loadStart()
   if (getToken()) {
     if (to.path === '/login') {
-      next({ path: '/' })
+      if (getEnterpriseToken()) next({ path: '/enterprise' }) // 已登录企业
+      else next({ path: '/' }) // 已登录个人账号
     } else {
       const type = localStorage.getItem('loginType')
       // 判断企业路由和个人路由,防止互串
       if (!type) { removeToken(); next(`/login?redirect=${to.fullPath}`) }
-      else if (to.path === '/mall') next()
-      else if (type === 'enterprise' && to.meta?.loginType === 'noLogin') next({ path: `/${type}` })
-      else if (type === 'personal' && to.meta?.loginType === 'noLogin') next()
+      else if (to.meta?.loginType === 'noLogin') next()
+      // else if (type === 'enterprise' && to.meta?.loginType === 'noLogin') next({ path: `/${type}` }) // 企业端不能访问个人端路由
+      // else if (type === 'personal' && to.meta?.loginType === 'noLogin') next()
       else if (to.meta?.loginType === type) next()
       else next({ path: `/${type}` })
       // next()

+ 40 - 0
src/router/modules/common.js

@@ -0,0 +1,40 @@
+// 公共路由(任何身份都可以访问的路由 如:商城)
+
+const common = [
+  {
+    path: '', // 门墩项目列表/项目入口页
+    redirect: '/entrances',
+    children: [
+      { path: '/', redirect: '/entrances' },
+      {
+        path: '/entrances',
+        component: () => import('@/views/entrances/index'),
+        meta: {
+          title: '门墩儿应用中心'
+        }
+      }
+    ]
+  },
+  {
+    path: '/mall',
+    children: [
+      {
+        path: '/mall',
+        component: () => import('@/views/mall/index'),
+        meta: {
+          title: '臻选商城'
+        }
+      }
+    ]
+  },
+  {
+    path: '/shareJob',
+    name: 'shareJob',
+    meta: {
+      title: '分享职位'
+    },
+    component: () => import('@/views/recruit/personal/shareJob/index.vue')
+  },
+]
+
+export default common

+ 0 - 0
src/router/modules/enterprise.js → src/router/modules/components/recruit/enterprise.js


+ 0 - 0
src/router/modules/personal.js → src/router/modules/components/recruit/personal.js


+ 37 - 2
src/router/modules/recruit.js

@@ -1,10 +1,35 @@
 
 // 门墩儿招聘
+import enterprise from './components/recruit/enterprise'
+import personal from './components/recruit/personal'
 import Layout from '@/layout'
+import { setLoginType } from '@/utils/loginType'
 const recruit = [
+  // {
+  //   path: '/home',
+  //   redirect: '/recruitHome'
+  // },
   {
     path: '/recruit',
-    redirect: '/home'
+    redirect: '/recruitHome'
+  },
+  {
+    path: '/personal', // 不可删 // 个人账号登录时,缺省只能访问个人账号路由和不需要登录,防止用户在地址栏直接输入地址访问其他页面(不可删,permission中用到)
+    redirect: '/recruitHome'
+  },
+  {
+    path: '/recruitHome',
+    component: Layout,
+    children: [
+      {
+        path: '/recruitHome',
+        component: () => import('@/views/recruit/personal/home'),
+        name: 'recruitHome',
+        meta: {
+          title: '首页'
+        }
+      }
+    ]
   },
   {
     path: '/recruit/personal/position',
@@ -55,4 +80,14 @@ const recruit = [
     ]
   }
 ]
-export default recruit
+
+setLoginType(recruit, 'noLogin'),
+setLoginType(enterprise, 'enterprise'),
+setLoginType(personal, 'personal')
+
+const routeArray = [
+  ...recruit,
+  ...enterprise,
+  ...personal
+]
+export default routeArray

+ 4 - 56
src/router/modules/remaining.js

@@ -1,5 +1,4 @@
-import personal from './personal'
-import enterprise from './enterprise'
+import common from './common'
 import recruit from './recruit'
 import Layout from '@/layout'
 import { setLoginType } from '@/utils/loginType'
@@ -43,66 +42,15 @@ const remainingRouter = [
       }
     ]
   },
-  {
-    path: '',
-    redirect: '/entrances',
-    children: [
-      { path: '/', redirect: '/entrances' },
-      {
-        path: '/entrances',
-        component: () => import('@/views/entrances/index'),
-        meta: {
-          title: '门墩儿应用中心'
-        }
-      }
-    ]
-  },
-  {
-    path: '/home',
-    component: Layout,
-    children: [
-      { path: '/personal', redirect: '/home' }, // 个人账号登录时,缺省只能访问个人账号路由和不需要登录,防止用户在地址栏直接输入地址访问其他页面(不可删,permission中用到)
-      {
-        path: '/home',
-        component: () => import('@/views/recruit/personal/home'),
-        meta: {
-          title: '首页'
-        }
-      }
-    ]
-  },
-  {
-    path: '/mall',
-    children: [
-      {
-        path: '/mall',
-        component: () => import('@/views/mall/index'),
-        meta: {
-          title: '臻选商城'
-        }
-      }
-    ]
-  },
-  {
-    path: '/shareJob',
-    name: 'shareJob',
-    meta: {
-      title: '分享职位'
-    },
-    component: () => import('@/views/recruit/personal/shareJob/index.vue')
-  },
 ]
-
 setLoginType(remainingRouter, 'noLogin')
-setLoginType(recruit, 'noLogin')
-setLoginType(personal, 'personal')
-setLoginType(enterprise, 'enterprise')
+setLoginType(common, 'noLogin')
 
 const routeArray = [
   ...remainingRouter,
   ...recruit,
-  ...personal,
-  ...enterprise
+  ...common
 ]
+console.log('recruit', recruit)
 
 export default routeArray

+ 10 - 0
src/utils/auth.js

@@ -31,3 +31,13 @@ export const getTenantId = () => {
 export const setTenantId = (username) => {
   localStorage.setItem('tenantId', username)
 }
+
+// 招聘端个人token
+export const getEnterpriseToken = () => {
+  return localStorage.getItem('loginType') === 'enterprise' && localStorage.getItem('ACCESS_TOKEN')
+}
+
+// 招聘端企业token
+export const getPersonalToken = () => {
+  return localStorage.getItem('loginType') === 'personal' && localStorage.getItem('ACCESS_TOKEN')
+}

+ 2 - 2
src/views/entrances/list/index.vue

@@ -40,8 +40,8 @@ const smallTitle = [
 const menuList = ref([
   { icon: 'mdi-account-group-outline', title: '门墩儿直聘', to: '/personal' },
   { icon: 'mdi-shopping-outline', title: '臻选商城', to: '/mall' },
-  { icon: 'mdi-chart-bar-stacked', title: '考勤管理', to: '' },
-  { icon: 'mdi-checkbox-marked-outline', title: '审批管理', to: '' },
+  { icon: 'mdi-chart-bar-stacked', title: '数据服务', to: '' },
+  { icon: 'mdi-school-outline', title: '火苗儿校企', to: '' },
 ])
  const handleClick = (item) => {
   // router.push(item.to)

+ 1 - 1
src/views/login/index.vue

@@ -141,7 +141,7 @@ const handleLogin = async () => {
     // await userStore.handleSmsLogin({ ...phoneRef.value.loginData, type })
     await userStore[api](params)
     Snackbar.success(t('login.loginSuccess'))
-    const path = type === 330 ? '/recruit/enterprise' : '/home'
+    const path = type === 330 ? '/recruit/enterprise' : '/recruitHome'
     router.push({ path })
   }
   finally {

+ 7 - 3
src/views/recruit/personal/position/components/details.vue

@@ -116,7 +116,7 @@
     >
       <div>
         <div class="pa-4" style="background-color: #f0f0f0; border-radius: 8px;">{{ shareUrlTxt }}</div>
-        <v-btn v-if="!getToken()" class="mt-1" color="warning" variant="text">您还未登录,登录后分享可享受分享有礼活动!</v-btn>
+        <v-btn v-if="!getPersonalToken()" class="mt-1" color="warning" variant="text">您还未登录,登录后分享可享受分享有礼活动!</v-btn>
         <v-btn class="mt-4 ml-3" color="success" @click="copyText">复制分享链接</v-btn>
         <v-btn class="mt-4 ml-3" color="primary" variant="outlined" @click="openShareLink">打开分享链接</v-btn>
       </div>
@@ -148,7 +148,7 @@ import similarPositions from '@/components/Position/similarPositions.vue'
 import EnterpriseInfo from '@/components/Enterprise/info.vue'
 import Snackbar from '@/plugins/snackbar'
 import Dialog from '@/components/CtDialog'
-import { getToken } from '@/utils/auth'
+import { getPersonalToken } from '@/utils/auth'
 
 const { t } = useI18n()
 const router = useRouter()
@@ -177,10 +177,11 @@ getPositionDetail()
 
 // 效验是否有投递过简历
 const deliveryCheck = async () => {
+  if (!getPersonalToken()) return delivery.value = false
   const data = await jobCvRelCheckSend({ jobId: id })
   if (data) delivery.value = true
 }
-if (getToken()) deliveryCheck()
+if (getPersonalToken()) deliveryCheck()
 
 const desc = [
   { mdi: 'mdi-map-marker-outline', value: 'areaName' },
@@ -191,6 +192,7 @@ const desc = [
 // 效验求职者是否有收藏该职位
 const isCollection = ref(true)
 const getCollectionStatus = async () => {
+  if (!getPersonalToken()) return isCollection.value = false
   const data = await getJobFavoriteCheck({ jobId: id })
   isCollection.value = data
 }
@@ -248,6 +250,7 @@ const copyText = async () => {
 
 // 收藏&取消收藏职位
 const handleCollection = async () => {
+  if (!getPersonalToken()) return Snackbar.warning(t('resume.changeRolePlease'))
   const api = isCollection.value ? getPersonJobUnfavorite : getPersonJobFavorite
   await api(isCollection.value ? id : { jobId: id })
   await getCollectionStatus()
@@ -265,6 +268,7 @@ const handleToUpload = () => {
 const resumeList = ref([])
 const selectResume = ref()
 const handleDelivery = async () => {
+  if (!getPersonalToken()) return Snackbar.warning(t('resume.changeRolePlease'))
   if (delivery.value) return Snackbar.warning(t('resume.alreadyResume'))
   const result = await getPersonResumeCv()
   resumeList.value = result