mirror of
http://git.mhez-qa.uplus.co.kr/hubez/hubez-admin.git
synced 2025-12-07 04:27:21 +09:00
105 lines
3.1 KiB
JavaScript
105 lines
3.1 KiB
JavaScript
import Vue from 'vue';
|
|
import Router from 'vue-router';
|
|
import store from './store'
|
|
//import login from '@/modules/login/store/index'
|
|
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 subsList from './modules/custMgt/views/SubsList';
|
|
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: subsList
|
|
},
|
|
// {
|
|
// 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');
|
|
}else{
|
|
var nextUrl = to.fullPath;
|
|
if(nextUrl == '/'){
|
|
console.log(store.getters);
|
|
const rootUrl = store.getters['login/getRootUrl'];
|
|
if(rootUrl == null){
|
|
return next('/login');
|
|
}
|
|
return next(rootUrl);
|
|
}
|
|
}
|
|
|
|
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 {
|
|
// 그 외의 경우 검색 조건 초기화
|
|
store.commit("searchcondition/updateSearchCondition", null);
|
|
// console.log("낫패밀리");
|
|
}
|
|
}
|
|
next();
|
|
});
|
|
});
|
|
|
|
export default router;
|