123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- import Vue from 'vue';
- import Router from 'vue-router';
- import { getAuth } from '@/utils/auth';
- import { getGuide } from '@/utils/guide';
- import {
- getTenantCode, getSystemConfig,
- getUserIcon, shitiStatusControl,
- saveHistoryPaths,
- } from '@/utils/common';
- Vue.use(Router);
- const router = new Router({
- mode: 'history',
- base: process.env.BASE_URL,
- routes: [
- {
- path: '/',
- redirect: '/index',
- },
- {
- name: '首页',
- path: '/index',
- component: () => {
- return import(/* webpackChunkName: "index" */ './views/client/Index.vue');
- },
- },
- {
- name: '课程开发',
- path: '/courseDev',
- component: () => {
- return import(/* webpackChunkName: "index" */ './views/client/CourseDev.vue');
- },
- },
- {
- name: 'Login',
- path: '/login',
- component: () => {
- return import(/* webpackChunkName: "Login" */ './views/management/Login/index.vue');
- },
- },
- {
- name: 'admin',
- path: '/admin',
- meta: {
- icon: "el-icon-platform-eleme",
- title: "页面管理"
- },
- isAdminMenu: true,
- component: () => {
- return import(/* webpackChunkName: "Home" */ './views/management/Home/index.vue');
- },
- children: [
- {
- path: '/hangyezixun',
- name: 'hangyezixun',
- meta: {
- icon: "",
- title: "行业资讯"
- },
- isAdminMenu: true,
- component: () => {
- return import(/* webpackChunkName: "Home" */ './views/management/HangYeZiXun/index.vue');
- },
- },
- ],
- },
- ],
- });
- function dispatchScss(path) {
- if (!path) {
- return;
- }
- if (path.indexOf('/a/') > -1) {
- require('@/assets/css/main/main-a.scss');
- } else if (path.indexOf('/c/') > -1) {
- require('@/assets/css/main/main-c.scss');
- } else {
- require('@/assets/css/main/main-z.scss');
- }
- }
- router.beforeEach((to, from, next) => {
- dispatchScss(to.fullPath);
- getAuth();
- getGuide();
- // getTenantCode();
- getSystemConfig();
- if (getSystemConfig()) {
- document.title = getSystemConfig().logoText; // describe: 更改title(刷新问题待优化) author: Wgy date:2019-12-04
- }
- //个人头像
- getUserIcon();
- shitiStatusControl(to);
- saveHistoryPaths(to, from, next);
- next();
- });
- export default router;
|