diff --git a/src/api/jurisdiction.js b/src/api/jurisdiction.js index fc13873..fe36440 100644 --- a/src/api/jurisdiction.js +++ b/src/api/jurisdiction.js @@ -15,6 +15,17 @@ export function GET_LIST(params) { }).then(res => res.data) } +/** + * 管理员修改密码 + */ +export function MODIFY_PASSWORD(params) { + return request({ + url: `${admin}/modifyPassword`, + method: 'post', + data: params + }).then(res => res.data) +} + /** * 重置管理员密码 */ @@ -135,3 +146,14 @@ export function ROLE_ADD(params) { data: params }).then(res => res.data) } + +/** + * 获取当前角色所有的权限 + */ +export function GET_ALL_HAVE(params) { + return request({ + url: `${permission}/have`, + method: 'post', + data: params + }).then(res => res.data) +} diff --git a/src/router/menus/others.js b/src/router/menus/others.js index ce9216f..b07ae5a 100644 --- a/src/router/menus/others.js +++ b/src/router/menus/others.js @@ -4,6 +4,7 @@ const others = { path: '/others', component: Layout, meta: {title: '其他', icon: 'dingdan', noCache: true, affix: false}, + code: '9900', children: [ { path: '/configuration', diff --git a/src/router/modules/privilegeManagement.js b/src/router/modules/privilegeManagement.js index 332bcf3..17ecec0 100644 --- a/src/router/modules/privilegeManagement.js +++ b/src/router/modules/privilegeManagement.js @@ -4,19 +4,21 @@ const commodityManagement = { path: '/privilegeManagement', component: Layout, meta: {title: '权限管理', icon: 'shouquanguanli', noCache: true, affix: false}, + code: '6600', children: [ { path: '/privilegeManagement/account', component: () => import('@/views/privilegeManagement/account/index'), name: '账户管理', + code: '6601', meta: {title: '账户管理', noCache: false, affix: false} }, { path: '/privilegeManagement/role', component: () => import('@/views/privilegeManagement/role/index'), name: '角色管理', + code: '6602', meta: {title: '角色管理', noCache: false, affix: false}, - }, { path: '/privilegeManagement/role/permissions', @@ -24,7 +26,6 @@ const commodityManagement = { hidden:true, name: '新增角色', meta: {title: '新增角色', noCache: false, affix: false}, - }, { path: '/privilegeManagement/account/opiModel', @@ -32,7 +33,6 @@ const commodityManagement = { hidden:true, name: '用户增加/查看', meta: {title: '用户增加/查看', noCache: false, affix: false}, - } ] }; diff --git a/src/utils/request.js b/src/utils/request.js index 9c3b3fc..43ac3b5 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -46,27 +46,43 @@ service.interceptors.request.use( // response interceptor service.interceptors.response.use( - response => response, + // response => response, /** * 下面的注释为通过在response里,自定义code来标示请求状态 * 当code返回如下情况则说明权限有问题,登出并返回到登录页 * 如想通过 xmlhttprequest 来状态码标识 逻辑可写在下面error中 * 以下代码均为样例,请结合自生需求加以修改,若不需要,则可删除 */ - // response => { - // const res = response.data - - // if (res.code == 401) { - // debugger - // window.location.href = "#/login" - // return Promise.reject('error') - // } else { - // return response.data - // } - // }, + response => { + const res = response.data + if (res.code == 49) { + let time = 15 + // var timer = setInterval(() => { + // time -= 1 + // },1000) + var t = setTimeout(()=> { + window.location.href = "#/login" + // timer && clearInterval(timer) + },15000) + window._vm.$notify({ + type: 'warning', + title: '登录失效提示', + dangerouslyUseHTMLString: true, + message: `
登录失效, 将在${time}秒后退回到登录页, 点击关闭按钮取消回退!!
`, + duration: 16000, + onClose: ()=> { + t && clearTimeout(t) + // timer && clearInterval(timer) + return response + }, + }); + } else { + return response + } + }, error => { console.log('err' + error) // for debug - if (error.response.status == 401) { + if (error.response.status == 49) { myalert.fail("登录失效,请重新登录!!") setTimeout(() => { window.location.href = "#/login" diff --git a/src/views/layout/components/Sidebar/index.vue b/src/views/layout/components/Sidebar/index.vue index 9805f9f..60497c2 100644 --- a/src/views/layout/components/Sidebar/index.vue +++ b/src/views/layout/components/Sidebar/index.vue @@ -18,14 +18,12 @@ /> -
+
@@ -53,6 +51,7 @@ display: flex; justify-content: center; align-items: center; + cursor: pointer; } @@ -60,6 +59,8 @@ import { mapGetters, mapActions } from "vuex"; import SidebarItem from "./SidebarItem"; import variables from "@/styles/variables.scss"; +import { GET_ALL_HAVE } from '@/api/jurisdiction' + export default { components: { SidebarItem }, mounted() {}, @@ -72,12 +73,20 @@ export default { return !this.sidebar.opened; } }, + created() { + this.getAllPermission() + }, methods: { ...mapActions({ toggleSideBar: "toggleSideBar" }), click_collapse() { this.toggleSideBar(); + }, + getAllPermission() { + GET_ALL_HAVE({}).then(res => { + console.log(res) + }) } } }; diff --git a/src/views/layout/components/rightMenu/rightMenu.vue b/src/views/layout/components/rightMenu/rightMenu.vue index cef97eb..6bee218 100644 --- a/src/views/layout/components/rightMenu/rightMenu.vue +++ b/src/views/layout/components/rightMenu/rightMenu.vue @@ -10,7 +10,7 @@
- +
修改密码
退出
@@ -27,18 +27,58 @@
+ + + + + + + + + + + + + + + + + + + 确 定 + 取 消 + + + diff --git a/src/views/otherPage/index.vue b/src/views/otherPage/index.vue index 97362c0..c1a4c14 100644 --- a/src/views/otherPage/index.vue +++ b/src/views/otherPage/index.vue @@ -58,11 +58,20 @@