import Vue from 'vue' import Router from 'vue-router' import constants from '@/utils/constants' Vue.use(Router) const router = new Router({ // mode: 'history', mode: 'hash', routes: [{ path: '/', name: 'login', component: () => import('@/views/login'), }, { path: '/demo', name: 'demo', component: () => import('@/views/demo'), }, { path:'/projdetail', name: 'projdetail', component: () => import('@/views/components_web/projDetail/projDetail') }, { path: '/watch', name: 'watch', component: () => import('@/views/main_web/watchall/watchall') }, { path: '/notification', name: 'notification', component: () => import('@/components/notification/notification') }, { path:'/newproject', name:'newproject', component: ()=> import('@/views/components_web/project/newProj') }, { path: '/watchlink', name: 'watchlink', component: () => import('@/views/main_web/watchall/watchlink') }, { path: '/platform', name: 'platform', component: () => import('@/views/platform_center'), }, { path: '/index', name: 'index', component: () => import('@/views/main_web/index'), }, { path: '/projnotice', name: 'projnotice', component: () => import('@/views/main_web/projnotice'), }, { path: '/email', name: 'email', component: () => import('@/views/components_web/head/email'), }, { path: '/workspace', name: 'workspace', component: () => import('@/views/main_web/workspace'), }, { path: '/project', name: 'project', component: () => import('@/views/main_web/project'), }, { path: '/recycle', name: 'recycle', component: () => import('@/views/main_web/workspace/recyclebin'), }, { path: '/history', name: 'history', component: () => import('@/views/main_web/workspace/components/file-history'), }, { path: '/cloud', name: 'cloud', component: () => import('@/views/main_web/cloud'), }, { path: '/cloudrecycle', name: 'cloudrecycle', component: () => import('@/views/main_web/cloudrecycle'), }, { path: '/cloudsource', name: 'cloudsource', component: () => import('@/views/main_web/cloudsource'), }, // 探索者后台 { path: '/company', name: 'company', component: () => import('@/views/manage_company'), redirect: { name: 'company_home' }, children: [ { path: 'home', name: 'company_home', component: () => import('@/views/manage_company/message'), }, { path: 'message', name: 'company_message', component: () => import('@/views/manage_company/message_detail'), }, { path: 'user', name: 'company_user', component: () => import('@/views/manage_company/user'), }, { path: 'project', name: 'company_project', component: () => import('@/views/manage_company/project'), }, { path: 'template', name: 'company_template', component: () => import('@/views/manage_company/template'), }, { path: 'template/detail', name: 'company_template_detail', component: () => import('@/views/manage_company/template_detail'), }, { path: 'template/market', name: 'company_template_market', component: () => import('@/views/manage_company/template_market'), }, { path: 'setting', name: 'company_setting', component: () => import('@/views/manage_company/setting'), }, { path: 'app', name: 'company_app', component: () => import('@/views/manage_company/app'), }, ] }, // { // path: '/company', // name: 'company', // component: () => import('@/views/manage_company/message'), // }, // { // path: '/company/message', // name: 'company_message', // component: () => import('@/views/manage_company/message_detail'), // }, // { // path: '/company/user', // name: 'company_user', // component: () => import('@/views/manage_company/user'), // }, // { // path: '/company/project', // name: 'company_project', // component: () => import('@/views/manage_company/project'), // }, // { // path: '/company/template', // name: 'company_template', // component: () => import('@/views/manage_company/template'), // }, // { // path: '/company/template/detail', // name: 'company_template_detail', // component: () => import('@/views/manage_company/template_detail'), // }, // { // path: '/company/template/market', // name: 'company_template_market', // component: () => import('@/views/manage_company/template_market'), // }, // { // path: '/company/setting', // name: 'company_setting', // component: () => import('@/views/manage_company/setting'), // }, // { // path: '/company/app', // name: 'company_app', // component: () => import('@/views/manage_company/app'), // }, /* 模板平台 */ { path: '/template', name: 'template', component: resolve => require(['@/views/manage_template/index'], resolve) }, { path: '/template/create', name: 'template_create', component: resolve => require(['@/views/manage_template/create_template'], resolve) }, // 探索者总后台 { path: '/system', // name: 'system', component: () => import('@/views/manage_system'), redirect: { name: 'system_customer' }, children: [{ path: 'customer', name: 'system_customer', component: () => import('@/views/manage_system/customer'), },{ path: 'template', name: 'system_template', component: () => import('@/views/manage_system/template'), }, { path: 'runmanage', name: 'system_runmanage', component: () => import('@/views/manage_system/runmanage'), }, { path: 'template/matrix', name: 'system_template_matrix', component: () => import('@/views/manage_system/template/matrix'), }, { path: 'template/mind', name: 'system_template_mind', component: () => import('@/views/manage_system/template/mind'), }, { path: 'template/tempfile', name: 'system_template_file', component: () => import('@/views/manage_system/template_file'), }, { path: 'appcenter', name: 'system_appcenter', component: () => import('@/views/manage_system/appcenter'), }, { path: 'appinfo', name: 'system_appinfo', component: () => import('@/views/manage_system/appinfo'), }, { path: 'setting', name: 'system_setting', component: () => import('@/views/manage_system/setting'), },{ path: '*', redirect: { name: 'system_customer' }, }] }, // { // path: '/system/template', // name: 'system_template', // component: () => import('@/views/manage_system/template'), // }, // 页面未找到时提示(这个页面要放在最后) { path: '*', name: 'notfound', component: () => import('@/views/components_web/notFound/notFound'), } ] }) // 添加路由验证 router.beforeEach((to, from, next) => { if (to.path === '/') { next() } else { if (!sessionStorage.getItem('userId')) { next({ path: '/' }) } else { next() } } }) // 导航后置守卫,可以在确定导航到目标页面时再更改title router.afterEach((to) => { window.document.title = constants[to.name] || 'LOCKING | 云建筑' }) export default router