import Vue from 'vue' import VueRouter from 'vue-router' const Preload = r => require.ensure([], () => r(require('@page/Preload')), 'Preload') const Login = r => require.ensure([], () => r(require('@page/modules/login/login.vue')), 'login') const IndexComponent = r => require.ensure([], () => r(require('@page/shells/index/index.vue')), 'shells') const MiniIndexComponent = r => require.ensure([], () => r(require('@page/shells/mini/index.vue')), 'mini') const Home = r => require.ensure([], () => r(require('@page/modules/home/home.vue')), 'modules') const MiniHome = r => require.ensure([], () => r(require('@page/modules/home/home_mini.vue')), 'mini') const CarryPoint = r => require.ensure([], () => r(require('@page/modules/taskmanage/CarryPoint.vue')), 'modules') const TaskLists = r => require.ensure([], () => r(require('@page/modules/taskmanage/TaskLists.vue')), 'modules') const TaskOperates = r => require.ensure([], () => r(require('@page/modules/taskmanage/TaskOperates.vue')), 'modules') const ErrorInfo = r => require.ensure([], () => r(require('@page/modules/errormanage/ErrorInfo.vue')), 'modules') const ErrorDeal = r => require.ensure([], () => r(require('@page/modules/errormanage/ErrorDeal.vue')), 'modules') const VehicleStatus = r => require.ensure([], () => r(require('@page/modules/vehicleinformation/vehiclestatus.vue')), 'modules') const VehicleControl = r => require.ensure([], () => r(require('@page/modules/vehicleinformation/vehiclecontrol.vue')), 'modules') const Slam = r => require.ensure([], () => r(require('@page/modules/teach/slam.vue')), 'modules') const Teach = r => require.ensure([], () => r(require('@page/modules/teach/teach.vue')), 'modules') const Debug = r => require.ensure([], () => r(require('@page/modules/teach/debug.vue')), 'modules') const User = r => require.ensure([], () => r(require('@page/modules/SystemManage/user.vue')), 'modules') const Role = r => require.ensure([], () => r(require('@page/modules/SystemManage/role.vue')), 'modules') const System = r => require.ensure([], () => r(require('@page/modules/SystemManage/system.vue')), 'modules') const Developer = r => require.ensure([], () => r(require('@page/modules/SystemManage/developer.vue')), 'modules') const Remote = r => require.ensure([], () => r(require('@page/modules/SystemManage/remote.vue')), 'modules') Vue.use(VueRouter) const router = new VueRouter({ routes: [ { path: '/', redirect: '/login' }, { path: '/preload', component: Preload }, { path: '/login', component: Login }, { path: '/index', component: IndexComponent, children: [{ path: 'home', component: Home, meta: {jumpPath: '1', guidePath: '1'} }, { path: 'carrypoint', component: CarryPoint, meta: {jumpPath: '2', guidePath: '1'} }, { path: 'tasklists', component: TaskLists, meta: {jumpPath: '2', guidePath: '2'} }, { path: 'taskoperates', component: TaskOperates, meta: {jumpPath: '2', guidePath: '3'} }, { path: 'errorinfo', component: ErrorInfo, meta: {jumpPath: '3', guidePath: '1'} }, { path: 'errordeal', component: ErrorDeal, meta: {jumpPath: '3', guidePath: '2'} }, { path: 'vehiclestatus', component: VehicleStatus, meta: {jumpPath: '4', guidePath: '1'} }, { path: 'vehiclecontrol', component: VehicleControl, meta: {jumpPath: '4', guidePath: '2'} }, { path: 'slam', component: Slam, meta: {jumpPath: '4', guidePath: '3'} }, { path: 'teach', component: Teach, meta: {jumpPath: '5', guidePath: '1'} }, { path: 'user', component: User, meta: {jumpPath: '6', guidePath: '1'} }, { path: 'role', component: Role, meta: {jumpPath: '6', guidePath: '2'} }, { path: 'system', component: System, meta: {jumpPath: '6', guidePath: '3'} }, { path: 'developer', component: Developer, meta: {jumpPath: '6', guidePath: '4'} }, { path: 'remote', component: Remote, meta: {jumpPath: '6', guidePath: '5'} }, { path: 'debug', component: Debug, meta: {jumpPath: '7', guidePath: '1'} }] }, { path: '/mini', component: MiniIndexComponent, children: [{ path: 'home', component: MiniHome }, { path: 'carrypoint', component: CarryPoint }, { path: 'errorinfo', component: ErrorInfo, meta: {guidePath: '1'} }, { path: 'slam', component: Slam, meta: {guidePath: '2'} }, { path: 'teach', component: Teach }] } ] }) // router.beforeEach((to, from, next) => { // if (!localStorage.getItem('locale')) { // let lang = navigator.language // if (lang === 'zh' || lang === 'zh-CN') { // localStorage.setItem('locale', 'zh-CN') // } else { // localStorage.setItem('locale', 'en-US') // } // } // next() // }) export default router