From 0554c79f656b2f9b48ca4d8d70d89560ddb38aaf Mon Sep 17 00:00:00 2001 From: "aoli.qu" <408346101@qq.com> Date: Thu, 2 Sep 2021 11:04:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A8=E6=80=81=E8=B7=AF=E7=94=B1=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/login.js | 7 +- src/assets/welcome.png | Bin 0 -> 17743 bytes src/config/router.config.js | 419 +-------------------------- src/main.js | 6 +- src/permission.js | 15 +- src/router/generator-routers.js | 133 ++++++++- src/store/getters.js | 1 + src/store/modules/async-router.js | 1 - src/store/modules/user.js | 5 +- src/utils/permissions.js | 14 + src/utils/request.js | 11 +- src/views/index/welcome.vue | 15 + src/views/security/user/UserList.vue | 30 +- 13 files changed, 202 insertions(+), 455 deletions(-) create mode 100644 src/assets/welcome.png create mode 100644 src/views/index/welcome.vue diff --git a/src/api/login.js b/src/api/login.js index f2cff67..d16e48a 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -14,7 +14,7 @@ export function login (parameter) { }) } -export function getLoginUser () { +export function getLoginUser (parameter) { return request({ url: userApi.getLoginUser, method: 'post', @@ -25,10 +25,7 @@ export function getLoginUser () { export function logout () { return request({ url: userApi.logout, - method: 'post', - headers: { - 'Content-Type': 'application/json;charset=UTF-8' - } + method: 'get' }) } export function getSmsCaptcha (parameter) { diff --git a/src/assets/welcome.png b/src/assets/welcome.png new file mode 100644 index 0000000000000000000000000000000000000000..94abec2409104a21fc6db682ad9f83c5d8e124d7 GIT binary patch literal 17743 zcmeEuRa6{Z(Cy$BAb4;mNU)&6U4jh+3$DQ}XmAPc0fGg0m*6hJ-F0vR4DK-4?R@Lr z*ZcOr{k;}2tEXqWy6T*gy{iZZE6ZY{lc0k@AWV5VDK!uXeinE=gNh9N&T0H^4E#ZJ zl>6)q0%73&`+)ND2Xiu;U?(C7qcIii$&$n^+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Zhvt)A7-UzPQ&jxHyS!}Ctm zjmy4=OuT1If7eMrdR?-=CQ-cg+MDz1hr9Y;{^|EfWu_ruEp;bE1he@h{>KldP@K-; zbZ_fX{JgyE^;O!f>3{vYgkP`iU}-+vQ>Toxbo$UmQReZi^DI+V@gOJT6@rxf%U^4CFhnG9(Buo?0@caJ(H#%s64F h('router-view') -} - export const asyncRouterMap = [ { path: '/', - name: 'index', + name: 'MenuIndex.vue', component: BasicLayout, - meta: { title: 'menu.home' }, + meta: { title: '首页' }, redirect: '/dashboard/workplace', children: [ // dashboard { - path: '/dashboard', + path: 'dashboard', name: 'dashboard', redirect: '/dashboard/workplace', component: RouteView, - meta: { title: 'menu.dashboard', keepAlive: true, icon: bxAnaalyse, permission: ['dashboard'] }, + meta: { title: '仪表盘', keepAlive: true, icon: bxAnaalyse /* permission: [ 'dashboard' ] */ }, children: [ { - path: '/dashboard/workplace', + path: 'workplace', name: 'Workplace', component: () => import('@/views/dashboard/Workplace'), - meta: { title: 'menu.dashboard.workplace', keepAlive: true, permission: ['dashboard'] } - } - ] - }, - // 权限管理 - { - path: '/security', - name: 'security', - redirect: '/security/user', - component: RouteView, - meta: { title: '系统设置', keepAlive: true, icon: bxAnaalyse, permission: ['security'] }, - children: [ - { - path: '/security/user', - name: 'SecurityUser', - component: () => import('@/views/security/user/UserList'), - meta: { title: '用户管理', keepAlive: true, permission: ['security'] } - }, - { - path: '/security/role', - name: 'SecurityRole', - component: () => import('@/views/security/role/RoleList'), - meta: { title: '角色管理', keepAlive: true } - }, - { - path: '/security/menu', - name: 'SecurityMenu', - component: () => import('@/views/security/menu/MenuList'), - meta: { title: '菜单管理', keepAlive: true } - }, - { - path: '/sys/dictionary', - name: 'DictionaryList', - component: () => import('@/views/sys/dictionary/DictionaryList'), - meta: { title: '数据词典', keepAlive: true } - }, - { - path: '/sys/oss', - name: 'OssList', - component: () => import('@/views/sys/oss/OssList'), - meta: { title: '文件中心', keepAlive: true } - } - ] - }, - // 项目管理 - { - path: '/project', - redirect: '/project/list', - component: RouteView, - meta: { title: '项目管理', icon: bxAnaalyse, permission: ['from'] }, - children: [ - { - path: '/project/list', - name: 'projectList', - component: () => import('@/views/project/ProjectList'), - meta: { title: '自主项目', keepAlive: true, permission: ['form'] }, - }, - // { - // path: '/project/add', - // name: 'ProjectForm', - // component: () => import('@/views/project/ProjectForm'), - // meta: { title: '新增项目', keepAlive: true, permission: ['form'], show: false } - // }, - { - path: '/project/projectStepForm', - name: 'projectStepForm', - component: () => import('@/views/project/form/ProjectStepForm'), - meta: { title: '新增项目-分布', keepAlive: true, permission: ['form'] } - }, - // { - // path: '/project/unitSelect', - // name: 'unitSelect', - // component: () => import('@/views/project/ProjectUnitSelect'), - // meta: { title: '选择单位', keepAlive: true, permission: ['form'] } - // }, - { - path: '/form/step-form', - name: 'StepForm', - component: () => import('@/views/form/stepForm/StepForm'), - meta: { title: '系统推荐', keepAlive: true, permission: ['form'] } - }, - { - path: '/form/advanced-form', - name: 'AdvanceForm', - component: () => import('@/views/form/advancedForm/AdvancedForm'), - meta: { title: '终端培训', keepAlive: true, permission: ['form'] } - } - ] - }, - // 课程管理 - { - path: '/courseManagement', - redirect: '/courseManagement/course/courseList', - component: RouteView, - meta: { title: '课程管理', icon: bxAnaalyse, permission: ['from'] }, - children: [ - { - path: '/courseManagement/course/courseList', - name: 'courseList', - component: () => import('@/views/course/CourseList'), - meta: { title: '系统课程', keepAlive: true, permission: ['form'] } - }, - { - path: '/courseManagement/customCourseList', - name: 'customCourse', - component: () => import('@/views/course/customCourseList'), - meta: { title: '自制课程', keepAlive: true, permission: ['form'] } - }, - { - path: '/form/advanced-form', - name: 'AdvanceForm', - component: () => import('@/views/form/advancedForm/AdvancedForm'), - meta: { title: '资源库', keepAlive: true, permission: ['form'] } - } - ] - }, - // 档案管理 - { - path: "/archives", - redirect: "/archives/user", - component: RouteView, - meta: { title: '档案管理', icon: 'profile', permission: ['form'] }, - children: [ - { - path: "/archives/user", - name: "archivesUser", - component: () => import('@/views/archives/user/Index'), - meta: { title: '人员档案', keepAlive: true, permission: ['form'] } - } - ] - }, - // forms - { - path: '/form', - redirect: '/form/base-form', - component: RouteView, - meta: { title: '表单页', icon: 'form', permission: ['form'] }, - children: [ - { - path: '/form/base-form', - name: 'BaseForm', - component: () => import('@/views/form/basicForm/Index'), - meta: { title: '基础表单', keepAlive: true, permission: ['form'] } - }, - { - path: '/form/step-form', - name: 'StepForm', - component: () => import('@/views/form/stepForm/StepForm'), - meta: { title: '分步表单', keepAlive: true, permission: ['form'] } - }, - { - path: '/form/advanced-form', - name: 'AdvanceForm', - component: () => import('@/views/form/advancedForm/AdvancedForm'), - meta: { title: '高级表单', keepAlive: true, permission: ['form'] } - } - ] - }, - - // list - { - path: '/list', - name: 'list', - component: RouteView, - redirect: '/list/table-list', - meta: { title: '列表页', icon: 'table', permission: ['table'] }, - children: [ - { - path: '/list/table-list/:pageNo([1-9]\\d*)?', - name: 'TableListWrapper', - hideChildrenInMenu: true, // 强制显示 MenuItem 而不是 SubMenu - component: () => import('@/views/list/TableList'), - meta: { title: '查询表格', keepAlive: true, permission: ['table'] } - }, - { - path: '/list/basic-list', - name: 'BasicList', - component: () => import('@/views/list/BasicList'), - meta: { title: '标准列表', keepAlive: true, permission: ['table'] } - }, - { - path: '/list/card', - name: 'CardList', - component: () => import('@/views/list/CardList'), - meta: { title: '卡片列表', keepAlive: true, permission: ['table'] } - }, - { - path: '/list/search', - name: 'SearchList', - component: () => import('@/views/list/search/SearchLayout'), - redirect: '/list/search/article', - meta: { title: '搜索列表', keepAlive: true, permission: ['table'] }, - children: [ - { - path: '/list/search/article', - name: 'SearchArticles', - component: () => import('../views/list/search/Article'), - meta: { title: '搜索列表(文章)', permission: ['table'] } - }, - { - path: '/list/search/project', - name: 'SearchProjects', - component: () => import('../views/list/search/Projects'), - meta: { title: '搜索列表(项目)', permission: ['table'] } - }, - { - path: '/list/search/application', - name: 'SearchApplications', - component: () => import('../views/list/search/Applications'), - meta: { title: '搜索列表(应用)', permission: ['table'] } - } - ] - } - ] - }, - // profile - { - path: '/profile', - name: 'profile', - component: RouteView, - redirect: '/profile/basic', - meta: { title: '详情页', icon: 'profile', permission: ['profile'] }, - children: [ - { - path: '/profile/basic', - name: 'ProfileBasic', - component: () => import('@/views/profile/basic/Index'), - meta: { title: '基础详情页', permission: ['profile'] } - }, - { - path: '/profile/advanced', - name: 'ProfileAdvanced', - component: () => import('@/views/profile/advanced/Advanced'), - meta: { title: '高级详情页', permission: ['profile'] } - } - ] - }, - // result - { - path: '/result', - name: 'result', - component: RouteView, - redirect: '/result/success', - meta: { title: '结果页', icon: 'check-circle-o', permission: ['result'] }, - children: [ - { - path: '/result/success', - name: 'ResultSuccess', - component: () => import(/* webpackChunkName: "result" */ '@/views/result/Success'), - meta: { title: '成功', keepAlive: false, hiddenHeaderContent: true, permission: ['result'] } - }, - { - path: '/result/fail', - name: 'ResultFail', - component: () => import(/* webpackChunkName: "result" */ '@/views/result/Error'), - meta: { title: '失败', keepAlive: false, hiddenHeaderContent: true, permission: ['result'] } - } - ] - }, - // Exception - { - path: '/exception', - name: 'exception', - component: RouteView, - redirect: '/exception/403', - meta: { title: '异常页', icon: 'warning', permission: ['exception'] }, - children: [ - { - path: '/exception/403', - name: 'Exception403', - component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/403'), - meta: { title: '403', permission: ['exception'] } - }, - { - path: '/exception/404', - name: 'Exception404', - component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404'), - meta: { title: '404', permission: ['exception'] } - }, - { - path: '/exception/500', - name: 'Exception500', - component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/500'), - meta: { title: '500', permission: ['exception'] } - } - ] - }, - // account - { - path: '/account', - component: RouteView, - redirect: '/account/center', - name: 'account', - meta: { title: '个人页', icon: 'user', keepAlive: true, permission: ['user'] }, - children: [ - { - path: '/account/center', - name: 'center', - component: () => import('@/views/account/center/Index'), - meta: { title: '个人中心', keepAlive: true, permission: ['user'] } - }, - { - path: '/account/settings', - name: 'settings', - component: () => import('@/views/account/settings/Index'), - meta: { title: '个人设置', hideHeader: true, permission: ['user'] }, - redirect: '/account/settings/base', - hideChildrenInMenu: true, - children: [ - { - path: '/account/settings/base', - name: 'BaseSettings', - component: () => import('@/views/account/settings/BaseSetting'), - meta: { title: '基本设置', hidden: true, permission: ['user'] } - }, - { - path: '/account/settings/security', - name: 'SecuritySettings', - component: () => import('@/views/account/settings/Security'), - meta: { title: '安全设置', hidden: true, keepAlive: true, permission: ['user'] } - }, - { - path: '/account/settings/custom', - name: 'CustomSettings', - component: () => import('@/views/account/settings/Custom'), - meta: { title: '个性化设置', hidden: true, keepAlive: true, permission: ['user'] } - }, - { - path: '/account/settings/binding', - name: 'BindingSettings', - component: () => import('@/views/account/settings/Binding'), - meta: { title: '账户绑定', hidden: true, keepAlive: true, permission: ['user'] } - }, - { - path: '/account/settings/notification', - name: 'NotificationSettings', - component: () => import('@/views/account/settings/Notification'), - meta: { title: '新消息通知', hidden: true, keepAlive: true, permission: ['user'] } - } - ] - } - ] - }, - { - path: '/other', - name: 'otherPage', - component: RouteView, - meta: { title: '其他组件', icon: 'slack', permission: ['dashboard'] }, - redirect: '/other/icon-selector', - children: [ - { - path: '/other/icon-selector', - name: 'TestIconSelect', - component: () => import('@/views/other/IconSelectorView'), - meta: { title: 'IconSelector', icon: 'tool', keepAlive: true, permission: ['dashboard'] } - }, - { - path: '/other/list', - component: RouteView, - meta: { title: '业务布局', icon: 'layout', permission: ['support'] }, - redirect: '/other/list/tree-list', - children: [ - { - path: '/other/list/tree-list', - name: 'TreeList', - component: () => import('@/views/other/TreeList'), - meta: { title: '树目录表格', keepAlive: true } - }, - { - path: '/other/list/edit-table', - name: 'EditList', - component: () => import('@/views/other/TableInnerEditList'), - meta: { title: '内联编辑表格', keepAlive: true } - }, - { - path: '/other/list/user-list', - name: 'UserList', - component: () => import('@/views/other/UserList'), - meta: { title: '用户列表', keepAlive: true } - }, - { - path: '/other/list/role-list', - name: 'RoleList', - component: () => import('@/views/other/RoleList'), - meta: { title: '角色列表', keepAlive: true } - }, - { - path: '/other/list/system-role', - name: 'SystemRole', - component: () => import('@/views/role/RoleList'), - meta: { title: '角色列表2', keepAlive: true } - }, - { - path: '/other/list/permission-list', - name: 'PermissionList', - component: () => import('@/views/other/PermissionList'), - meta: { title: '权限列表', keepAlive: true } - } - ] + meta: { title: '工作台', keepAlive: false/*, permission: [ 'dashboard' ] */ } } ] } @@ -486,5 +83,5 @@ export const constantRouterMap = [ meta: { title: '词典项', keepAlive: true, permission: ['dictionaryItem'] } } ] - }, + } ] diff --git a/src/main.js b/src/main.js index 326b0e6..94d8fe0 100644 --- a/src/main.js +++ b/src/main.js @@ -13,13 +13,15 @@ import themePluginConfig from '../config/themePluginConfig' import bootstrap from './core/bootstrap' import './core/lazy_use' -// import './permission' // permission control +import './permission' // permission control import './utils/filter' // global filter import './global.less' import moment from 'moment' import { FormModel } from 'ant-design-vue' -// import './mock' +import { hasBtnPermission } from './utils/permissions' + Vue.use(FormModel) +Vue.prototype.hasPerm = hasBtnPermission Vue.config.productionTip = false diff --git a/src/permission.js b/src/permission.js index a274f05..a4d9d4c 100644 --- a/src/permission.js +++ b/src/permission.js @@ -15,21 +15,19 @@ const loginRoutePath = '/user/login' const defaultRoutePath = '/dashboard/workplace' router.beforeEach((to, from, next) => { - debugger NProgress.start() // start progress bar to.meta && (typeof to.meta.title !== 'undefined' && setDocumentTitle(`${i18nRender(to.meta.title)} - ${domTitle}`)) - /* has token */ + console.log(storage.get(ACCESS_TOKEN)) + debugger if (storage.get(ACCESS_TOKEN)) { if (to.path === loginRoutePath) { next({ path: defaultRoutePath }) NProgress.done() } else { if (store.getters.roles.length === 0) { - console.log('逻辑开始1 => src/permission.js') store .dispatch('GetInfo') .then(res => { - console.log('流程3-获取个人信息返回 => src/permission.js ') if (res.menus.length < 1) { Modal.error({ title: '提示:', @@ -45,14 +43,19 @@ router.beforeEach((to, from, next) => { } const antDesignMenus = res.menus // generate dynamic router - console.log('流程4-从后端获取权限开始') store.dispatch('GenerateRoutes', { antDesignMenus }).then(() => { // 根据菜单权限生成可访问的路由表 // 动态添加可访问路由表 - router.addRoutes(store.getters.addRouters) + const routes = store.getters.addRouters + for(let i =0,length =routes.length;i import('@/views/dashboard/Workplace'), + // account + 'AccountCenter': () => import('@/views/account/center/Index'), + 'AccountSettings': () => import('@/views/account/settings/Index'), + 'BaseSettings': () => import('@/views/account/settings/BaseSetting'), + 'SecuritySettings': () => import('@/views/account/settings/Security'), + 'CustomSettings': () => import('@/views/account/settings/Custom'), + 'BindingSettings': () => import('@/views/account/settings/Binding'), + 'NotificationSettings': () => import('@/views/account/settings/Notification'), + + // 默认首页 + 'Console': () => import('@/views/index/welcome') } // 前端未找到页面路由(固定不用改) @@ -22,11 +33,120 @@ const notFoundRouter = { path: '*', redirect: '/404', hidden: true } +// 个人中心页面 +const userAccount = [ + // account + { + 'name': 'account', + 'pid': 0, + 'id': 10028, + 'meta': { + 'title': '个人页', + 'icon': 'user', + 'show': false + }, + 'redirect': '/account/center', + 'component': 'RouteView' + }, + { + 'name': 'center', + 'pid': 10028, + 'id': 10029, + 'meta': { + 'title': '个人中心', + 'show': false + }, + 'component': 'AccountCenter' + }, + // 特殊三级菜单 + { + 'name': 'settings', + 'pid': '10028', + 'id': '10030', + 'meta': { + 'title': '个人设置', + 'hideHeader': true, + 'hideChildren': true, + 'show': false + }, + 'redirect': '/account/settings/base', + 'component': 'AccountSettings' + }, + { + 'name': 'BaseSettings', + 'path': '/account/settings/base', + 'pid': 10030, + 'id': 10031, + 'meta': { + 'title': '基本设置', + 'show': false + }, + 'component': 'BaseSettings' + }, + { + 'name': 'SecuritySettings', + 'path': '/account/settings/security', + 'pid': 10030, + 'id': 10032, + 'meta': { + 'title': '安全设置', + 'show': false + }, + 'component': 'SecuritySettings' + }, + { + 'name': 'CustomSettings', + 'path': '/account/settings/custom', + 'pid': 10030, + 'id': 10033, + 'meta': { + 'title': '个性化设置', + 'show': false + }, + 'component': 'CustomSettings' + }, + { + 'name': 'BindingSettings', + 'path': '/account/settings/binding', + 'pid': 10030, + 'id': 10034, + 'meta': { + 'title': '账户绑定', + 'show': false + }, + 'component': 'BindingSettings' + }, + { + 'name': 'NotificationSettings', + 'path': '/account/settings/notification', + 'pid': 10030, + 'id': 10034, + 'meta': { + 'title': '新消息通知', + 'show': false + }, + 'component': 'NotificationSettings' + }, + { + 'name': 'Console', + 'path': '/welcome', + 'pid': 0, + 'id': 183183, + 'meta': { + 'title': '首页', + 'show': false + }, + 'component': 'Console' + } + +] + // 根级菜单 const rootRouter = { path: '/', name: 'index', component: 'BasicLayout', + redirect: '/welcome', meta: { title: '首页' }, children: [] } @@ -38,17 +158,14 @@ const rootRouter = { */ export const generatorDynamicRouter = (data) => { return new Promise((resolve, reject) => { - console.log('流程5-后端返回的权限菜单:generatorDynamicRouter') - console.log(data) const resNav = data.antDesignMenus const menuNav = [] const childrenNav = [] - // 后端数据, 根级树数组, 根级 PID + // 后端数据, 根级树数组, 根级 PID listToTree(resNav, childrenNav, 0) + // 增加静态网页 + listToTree(userAccount, childrenNav, 0) rootRouter.children = childrenNav - if (childrenNav.length > 0) { - rootRouter.redirect = childrenNav[0].path - } menuNav.push(rootRouter) const routers = generator(menuNav) routers.push(notFoundRouter) @@ -85,7 +202,7 @@ export const generator = (routerMap, parent) => { icon: icon || undefined, hiddenHeaderContent: hiddenHeaderContent, target: target, - permission: item.name + // permission: item.name } } // 是否设置了隐藏菜单 @@ -120,7 +237,7 @@ export const generator = (routerMap, parent) => { const listToTree = (list, tree, parentId) => { list.forEach(item => { // 判断是否为父级菜单 - if (item.parentId === parentId) { + if (item.pid === parentId) { const child = { ...item, key: item.key || item.name, diff --git a/src/store/getters.js b/src/store/getters.js index 5a5ad70..b83c4f4 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -8,6 +8,7 @@ const getters = { nickname: state => state.user.name, welcome: state => state.user.welcome, roles: state => state.user.roles, + buttons: state => state.user.buttons, userInfo: state => state.user.info, addRouters: state => state.permission.addRouters, multiTab: state => state.app.multiTab diff --git a/src/store/modules/async-router.js b/src/store/modules/async-router.js index e20348d..4491e06 100644 --- a/src/store/modules/async-router.js +++ b/src/store/modules/async-router.js @@ -18,7 +18,6 @@ const permission = { actions: { GenerateRoutes ({ commit }, data) { return new Promise(resolve => { - console.log('动态生成路由:GenerateRoutes async-router 111') generatorDynamicRouter(data).then(routers => { commit('SET_ROUTERS', routers) resolve() diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 8b65db8..19f6dcf 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -56,8 +56,6 @@ const user = { getLoginUser().then(response => { if (response.code === 200) { const data = response.data - console.log('流程2-获取到个人信息 => user.js') - console.log(data) commit('SET_ROLES', 1) commit('SET_BUTTONS', data.permissions) commit('SET_INFO', data) @@ -79,7 +77,7 @@ const user = { // 登出 Logout ({ commit, state }) { return new Promise((resolve) => { - logout(state.token).then(() => { + logout().then(() => { resolve() }).catch(() => { resolve() @@ -87,6 +85,7 @@ const user = { commit('SET_TOKEN', '') commit('SET_ROLES', []) commit('SET_BUTTONS', []) + storage.remove(ACCESS_TOKEN) }) }) } diff --git a/src/utils/permissions.js b/src/utils/permissions.js index f8668bb..768f921 100644 --- a/src/utils/permissions.js +++ b/src/utils/permissions.js @@ -1,3 +1,5 @@ +import store from '@/store' + export function actionToObject (json) { try { return JSON.parse(json) @@ -6,3 +8,15 @@ export function actionToObject (json) { } return [] } + +/** + * 控制按钮是否显示 + */ +export function hasBtnPermission (permission) { + const myBtns = store.getters.buttons + const nickname = store.getters.nickname + if (nickname == '超级管理员') { + return true + } + return myBtns.indexOf(permission) > -1 +} \ No newline at end of file diff --git a/src/utils/request.js b/src/utils/request.js index f50c7ef..c3bea4e 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -4,9 +4,10 @@ import storage from 'store' import notification from 'ant-design-vue/es/notification' import { VueAxios } from './axios' import { ACCESS_TOKEN } from '@/store/mutation-types' +import router from '../router' const SUCCESS_CODE = 200 -const INVALID_TOKEN_CODE = '0000' +const INVALID_TOKEN_CODE = 401 const toast = (msg, description) => { notification.error({ @@ -29,7 +30,7 @@ const errorHandler = (error) => { // 从 localstorage 获取 token const token = storage.get(ACCESS_TOKEN) if (error.response.status === 403) { - toast('Forbidden:', data.message) + toast('Forbidden:', data.msg) } if (error.response.status === 401 && !(data.result && data.result.isLogin)) { toast('Unauthorized:', 'Authorization verification failed') @@ -47,9 +48,9 @@ const errorHandler = (error) => { // request interceptor request.interceptors.request.use(config => { - // const token = storage.get(ACCESS_TOKEN) + const token = storage.get(ACCESS_TOKEN) // 由于登录接口待联调,token使用默认值 - const token = 'eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjBkYjU0YzQ0LWQ5MDktNDQ0ZC05YTYwLTE4ZGU1YjgyMzg5YyJ9.l37UO6WC9tPTuoJnbWKpTusHdtmon95Islq-jRNo9zmCKJ4GWwnY9_szBpgOii2Y7OVvc4sWibmFBdTwmAg8sg' + // const token = 'eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjY0MjM0YmY0LTkxOWEtNDFkMS05MzZlLTMwZDU3NDhkYmVjZCJ9.J15_FhVqcm_GsNIS2BCEYf26sWQQ4pMSTedV5eKauZT8-f6480Mx1s5ZdqWdEOlORnkKSc5pUioCngbCopr9cQ' // 如果 token 存在,让每个请求携带自定义 token 请根据实际情况自行修改 if (token) { config.headers[ACCESS_TOKEN] = token @@ -69,7 +70,7 @@ request.interceptors.response.use((response) => { } else if (response.data && response.data.code === INVALID_TOKEN_CODE) { toast(response.data.msg) store.dispatch('Logout').then(() => { - this.$router.push({ name: 'login' }) + router.push({ name: 'login' }) }) return Promise.reject(response) } else { diff --git a/src/views/index/welcome.vue b/src/views/index/welcome.vue new file mode 100644 index 0000000..a5c7575 --- /dev/null +++ b/src/views/index/welcome.vue @@ -0,0 +1,15 @@ + + + + + diff --git a/src/views/security/user/UserList.vue b/src/views/security/user/UserList.vue index 7f86219..5c4f779 100644 --- a/src/views/security/user/UserList.vue +++ b/src/views/security/user/UserList.vue @@ -28,8 +28,8 @@
- 新增用户 - + 新增用户 + 批量删除
@@ -46,22 +46,22 @@ {{ record.sex | sexFilter }} - 编辑 - - + 编辑 + + 更多 - + 重置密码 - + 授权角色 - + 删除 @@ -112,12 +112,6 @@ export default { }, { title: '手机', dataIndex: 'phoneNumber' - }, - { - title: '操作', - width: '150px', - dataIndex: 'action', - scopedSlots: { customRender: 'action' } } ], // 加载数据方法 必须为 Promise 对象 @@ -144,6 +138,14 @@ export default { }, created () { // 动态加载权限 + if (this.hasPerm('sys:user:edit') || this.hasPerm('sys:user:resetPwd') || this.hasPerm('sys:user:grantRole') || this.hasPerm('sys:user:delete')) { + this.columns.push({ + title: '操作', + width: '150px', + dataIndex: 'action', + scopedSlots: { customRender: 'action' } + }) + } }, methods: { // 重置密码