mirror of
http://git.mhez-qa.uplus.co.kr/hubez/hubez-admin.git
synced 2025-12-07 01:04:20 +09:00
hubez-admin partner-git master -> hubez-git transfer 202205241800
This commit is contained in:
97
frontend/src/router.js
Normal file
97
frontend/src/router.js
Normal file
@@ -0,0 +1,97 @@
|
||||
import Vue from 'vue';
|
||||
import Router from 'vue-router';
|
||||
import searchcondition from './store'
|
||||
import tokenSvc from '@/common/token-service';
|
||||
|
||||
import HubwebLayout from './views/HubwebLayout.vue';
|
||||
|
||||
|
||||
import loginRoutes from './modules/login/router';
|
||||
import custRoutes from './modules/custMgt/router';
|
||||
import authRoutes from './modules/sysMgt/router';
|
||||
|
||||
import custList from './modules/custMgt/views/CustList';
|
||||
import channelRoutes from './modules/attractMgt/router';
|
||||
import rejectRoutes from './modules/servMgt/router';
|
||||
import clacRoutes from './modules/calculate/router';
|
||||
import templtRoutes from './modules/channelMgt/router';
|
||||
import profileRoutes from './modules/sendNumMgt/router';
|
||||
import mntrngRoutes from './modules/mntrng/router';
|
||||
import riskmgtRoutes from './modules/riskMgt/router';
|
||||
import monthRoutes from './modules/stats/router';
|
||||
// import channelList from './modules/attractMgt/views/ChannelList';
|
||||
|
||||
Vue.use(Router)
|
||||
|
||||
const router = new Router({
|
||||
mode: 'history',
|
||||
base: process.env.BASE_URL,
|
||||
routes: [
|
||||
{
|
||||
path: '/',
|
||||
component: HubwebLayout,
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
component: custList
|
||||
},
|
||||
// {
|
||||
// path: '/attractMgt/views',
|
||||
// component: channelList
|
||||
// },
|
||||
{
|
||||
path: '/view/error/404',
|
||||
component: () => import('./views/ErrorPage404.vue'),
|
||||
meta: { public: true }
|
||||
},
|
||||
{
|
||||
path: '/view/error/500',
|
||||
component: () => import('./views/ErrorPage500.vue'),
|
||||
meta: { public: true }
|
||||
},
|
||||
...loginRoutes,
|
||||
...custRoutes,
|
||||
...authRoutes,
|
||||
...channelRoutes,
|
||||
...rejectRoutes,
|
||||
...clacRoutes,
|
||||
...templtRoutes,
|
||||
...profileRoutes,
|
||||
...mntrngRoutes,
|
||||
...riskmgtRoutes,
|
||||
...monthRoutes,
|
||||
|
||||
|
||||
|
||||
|
||||
]
|
||||
},
|
||||
{path: '*', redirect: '/view/error/404'}
|
||||
]
|
||||
});
|
||||
|
||||
router.beforeEach((to, from, next) => {
|
||||
const isPublic = to.matched.some(record => record.meta.public);
|
||||
const loggedIn = !!tokenSvc.getToken();
|
||||
|
||||
if (!isPublic && !loggedIn) {
|
||||
return next('/login');
|
||||
}
|
||||
|
||||
to.matched.some(record => {
|
||||
if (record.meta.usingSearchCondition) {
|
||||
const shareList = record.meta.shareList;
|
||||
if (from.name && shareList && shareList.includes(from.name)) {
|
||||
// shareList에 포함되어 있는 라우터에서 온 경우 검색 조건을 유지한다.
|
||||
// console.log("패밀리");
|
||||
} else {
|
||||
// 그 외의 경우 검색 조건 초기화
|
||||
searchcondition.commit("searchcondition/updateSearchCondition", null);
|
||||
// console.log("낫패밀리");
|
||||
}
|
||||
}
|
||||
next();
|
||||
});
|
||||
});
|
||||
|
||||
export default router;
|
||||
Reference in New Issue
Block a user