diff --git a/console-web/src/main.js b/console-web/src/main.js index e05af936..5670844f 100644 --- a/console-web/src/main.js +++ b/console-web/src/main.js @@ -1,18 +1,21 @@ import Vue from 'vue' import App from '@/App' -import router from '@/router' // api: https://github.com/vuejs/vue-router -import store from '@/store' // api: https://github.com/vuejs/vuex -import VueCookie from 'vue-cookie' // api: https://github.com/alfhen/vue-cookie -import '@/element-ui' // api: https://github.com/ElemeFE/element -import '@/icons' // api: http://www.iconfont.cn/ +import router from '@/router' // api: https://github.com/vuejs/vue-router +import store from '@/store' // api: https://github.com/vuejs/vuex +import VueCookie from 'vue-cookie' // api: https://github.com/alfhen/vue-cookie +import '@/element-ui' // api: https://github.com/ElemeFE/element +import '@/icons' // api: http://www.iconfont.cn/ import '@/element-ui-theme' import '@/assets/scss/index.scss' import httpRequest from '@/utils/httpRequest' // api: https://github.com/axios/axios -import { isAuth } from '@/utils' +import {isAuth} from '@/utils' import cloneDeep from 'lodash/cloneDeep' import './utils/directives.js' import dict from './utils/dict' +import {Scrollbar} from 'element-ui' //滚动条 + +Vue.use(Scrollbar) Vue.use(VueCookie) Vue.config.productionTip = false Vue.prototype.dict = dict @@ -36,5 +39,5 @@ new Vue({ router, store, template: '', - components: { App } + components: {App} }) diff --git a/console-web/src/router/index.js b/console-web/src/router/index.js index c7191f11..459e7a63 100644 --- a/console-web/src/router/index.js +++ b/console-web/src/router/index.js @@ -7,8 +7,10 @@ import Vue from 'vue' import Router from 'vue-router' import http from '@/utils/httpRequest' -import { isURL } from '@/utils/validate' -import { clearLoginInfo, isGDASucc } from '@/utils' +import {isURL} from '@/utils/validate' +import {clearLoginInfo, isGDASucc} from '@/utils' + + Vue.use(Router) @@ -17,8 +19,8 @@ const _import = require('./import-' + process.env.NODE_ENV) // 全局路由(无需嵌套上左右整体布局) const globalRoutes = [ - { path: '/404', component: _import('common/404'), name: '404', meta: { title: '404未找到' } }, - { path: '/login', component: _import('common/login'), name: 'login', meta: { title: '登录' } } + {path: '/404', component: _import('common/404'), name: '404', meta: {title: '404未找到'}}, + {path: '/login', component: _import('common/login'), name: 'login', meta: {title: '登录'}} ] // 主入口路由(需嵌套上左右整体布局) @@ -26,23 +28,33 @@ const mainRoutes = { path: '/', component: _import('main'), name: 'main', - redirect: { name: 'home' }, - meta: { title: '主入口整体布局' }, + redirect: {name: 'home'}, + meta: {title: '主入口整体布局'}, children: [ // 通过meta对象设置路由展示方式 // 1. isTab: 是否通过tab展示内容, true: 是, false: 否 // 2. iframeUrl: 是否通过iframe嵌套展示内容, '以http[s]://开头': 是, '': 否 // 提示: 如需要通过iframe嵌套展示内容, 但不通过tab打开, 请自行创建组件使用iframe处理! - { path: '/home', component: _import('common/home'), name: 'home', meta: { title: '首页' } }, - { path: '/theme', component: _import('common/theme'), name: 'theme', meta: { title: '主题' } }, - { path: '/demo-echarts', component: _import('demo/echarts'), name: 'demo-echarts', meta: { title: 'demo-echarts', isTab: true } }, - { path: '/demo-ueditor', component: _import('demo/ueditor'), name: 'demo-ueditor', meta: { title: 'demo-ueditor', isTab: true } } + {path: '/home', component: _import('common/home'), name: 'home', meta: {title: '首页'}}, + {path: '/theme', component: _import('common/theme'), name: 'theme', meta: {title: '主题'}}, + { + path: '/demo-echarts', + component: _import('demo/echarts'), + name: 'demo-echarts', + meta: {title: 'demo-echarts', isTab: true} + }, + { + path: '/demo-ueditor', + component: _import('demo/ueditor'), + name: 'demo-ueditor', + meta: {title: 'demo-ueditor', isTab: true} + } ], - beforeEnter (to, from, next) { + beforeEnter(to, from, next) { let token = Vue.cookie.get('token') if (!token || !/\S/.test(token)) { clearLoginInfo() - next({ name: 'login' }) + next({name: 'login'}) } next() } @@ -50,7 +62,7 @@ const mainRoutes = { const router = new Router({ mode: 'hash', - scrollBehavior: () => ({ y: 0 }), + scrollBehavior: () => ({y: 0}), isAddDynamicMenuRoutes: false, // 是否已经添加动态(菜单)路由 routes: globalRoutes.concat(mainRoutes) }) @@ -72,7 +84,7 @@ router.beforeEach((to, from, next) => { router.options.isAddDynamicMenuRoutes = true sessionStorage.setItem('menuList', JSON.stringify(data.data.menulist || '[]')) sessionStorage.setItem('permissions', data.data.permissions || '') - next({ ...to, replace: true }) + next({...to, replace: true}) } else { sessionStorage.setItem('menuList', '[]') sessionStorage.setItem('permissions', '') @@ -80,7 +92,7 @@ router.beforeEach((to, from, next) => { } }).catch((e) => { console.log(`%c${e} 请求菜单列表和权限失败,跳转至登录页!!`, 'color:blue') - router.push({ name: 'login' }) + router.push({name: 'login'}) }) } }) @@ -89,7 +101,7 @@ router.beforeEach((to, from, next) => { * 判断当前路由类型, global: 全局路由, main: 主入口路由 * @param {*} route 当前路由 */ -function fnCurrentRouteType (route, globalRoutes = []) { +function fnCurrentRouteType(route, globalRoutes = []) { var temp = [] for (var i = 0; i < globalRoutes.length; i++) { if (route.path === globalRoutes[i].path) { @@ -106,7 +118,7 @@ function fnCurrentRouteType (route, globalRoutes = []) { * @param {*} menuList 菜单列表 * @param {*} routes 递归创建的动态(菜单)路由 */ -function fnAddDynamicMenuRoutes (menuList = [], routes = []) { +function fnAddDynamicMenuRoutes(menuList = [], routes = []) { var temp = [] for (var i = 0; i < menuList.length; i++) { if (menuList[i].list && menuList[i].list.length >= 1) { @@ -147,7 +159,7 @@ function fnAddDynamicMenuRoutes (menuList = [], routes = []) { mainRoutes.children = routes router.addRoutes([ mainRoutes, - { path: '*', redirect: { name: '404' } } + {path: '*', redirect: {name: '404'}} ]) sessionStorage.setItem('dynamicMenuRoutes', JSON.stringify(mainRoutes.children || '[]')) console.log('\n') diff --git a/console-web/src/views/modules/pub/role.vue b/console-web/src/views/modules/pub/role.vue index cd2735e3..b4e9e55f 100644 --- a/console-web/src/views/modules/pub/role.vue +++ b/console-web/src/views/modules/pub/role.vue @@ -5,7 +5,7 @@ - 查询 + 查看 新增 批量删除 @@ -56,7 +56,7 @@ width="180" label="操作">