diff --git a/src/router/routes.ts b/src/router/routes.ts index 388e27f..55660bc 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -21,7 +21,6 @@ export const constantRoute = [ { path: '/permissions-manage', name: '权限管理', - redirect: '/permissions-manage/doctor-manage', component: () => import('@/views/permissions-manage/index.vue'), children: [ { @@ -113,7 +112,6 @@ export const constantRoute = [ { path: '/logs-manage', name: '系统管理', - redirect: '/logs-manage/message-manage', component: () => import('@/views/logs-manage/index.vue'), children: [ { diff --git a/src/stores/user-info-store.ts b/src/stores/user-info-store.ts index cb1d107..42faec3 100644 --- a/src/stores/user-info-store.ts +++ b/src/stores/user-info-store.ts @@ -4,77 +4,88 @@ import {Local, Session} from "@/utils/storage"; import router from "@/router"; export const useUserStore = defineStore('login', { - state: () => { - return { - userInfo: { - account: '', - name: '', - /** - * 公司: 后台管理 - * 医院高级管理员: 首页、权限管理、患者管理、远程管理、日志管理 - * 医院中级管理员: 首页、患者管理、远程管理 - * 医院普通用户: 首页、患者管理 - */ - hospitalName: '', - hospitalId: '', - menuPathList: { - paths: [], - menus: [] - }, - roleName: '' - } as any, - showHomeMsg: false - } - }, - actions: { - getlogin() { - const onlineUser = Session.get("onlineUser"); - return this.userInfo.account && this.userInfo.account != null ? this.userInfo : onlineUser - }, - setlogin(key: string, e: any) { - this.userInfo[key] = e - Session.set("onlineUser", this.userInfo); - }, - logout() { - Session.clear(); - Local.clear(); - router.removeRoute("root"); - router.addRoute({ - name: "root", - path: "/", - redirect: "/login" - }) - }, - getMenuPathList(): Promise { - return new Promise(resolve => { - if (this.userInfo.menuPathList.paths.length == 0) { - getUserMenu().then((res: any) => { - if (res && res.code == 0) { - const paths: any = []; - const menus: any = []; - res.data.forEach((item: any) => { - handleMenuPath(item, paths, menus); - }); - this.userInfo.menuPathList = {paths, menus}; - resolve(this.userInfo.menuPathList); - } - }) - } else { - resolve(this.userInfo.menuPathList) + state: () => { + return { + userInfo: { + account: '', + name: '', + /** + * 公司: 后台管理 + * 医院高级管理员: 首页、权限管理、患者管理、远程管理、日志管理 + * 医院中级管理员: 首页、患者管理、远程管理 + * 医院普通用户: 首页、患者管理 + */ + hospitalName: '', + hospitalId: '', + menuPathList: { + paths: [], + menus: [] + }, + roleName: '' + } as any, + showHomeMsg: false + } + }, + actions: { + getlogin() { + const onlineUser = Session.get("onlineUser"); + return this.userInfo.account && this.userInfo.account != null ? this.userInfo : onlineUser + }, + setlogin(key: string, e: any) { + this.userInfo[key] = e + Session.set("onlineUser", this.userInfo); + }, + logout() { + Session.clear(); + Local.clear(); + router.removeRoute("root"); + router.addRoute({ + name: "root", + path: "/", + redirect: "/login" + }) + }, + getMenuPathList(): Promise { + return new Promise(resolve => { + if (this.userInfo.menuPathList.paths.length == 0) { + getUserMenu().then((res: any) => { + if (res && res.code == 0) { + const paths: any = []; + const menus: any = []; + res.data.forEach((item: any) => { + handleMenuPath(item, paths, menus); + }); + this.userInfo.menuPathList = {paths, menus}; + resolve(this.userInfo.menuPathList); + } + }) + } else { + resolve(this.userInfo.menuPathList) + } + }) + }, + getMenuChild(path: string) { + return new Promise(resolve => { + this.getMenuPathList().then((res: any) => { + res.menus.forEach((menu: any) => { + if (menu.path == path) { + resolve(menu.children) + } + }); + }) + }) } - }) } - }, }) function handleMenuPath(menu: any, paths: any, menus?: any) { - paths.push(menu.path); - if (menus) { - menus.push(menu); - } - if (menu.children && menu.children.length > 0) { - menu.children.forEach((child: any) => { - handleMenuPath(child, paths); - }) - } + paths.push(menu.path); + if (menus) { + menus.push(menu); + } + if (menu.children && menu.children.length > 0) { + menu.children.forEach((child: any) => { + handleMenuPath(child, paths); + }) + } } \ No newline at end of file diff --git a/src/utils/request.ts b/src/utils/request.ts index d461504..911565c 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -79,7 +79,7 @@ function handleResponse(response: any) { axiosInstance.interceptors.response.use(handleResponse, error => { const code = error.response.status || 200 - if (code == 424 || code == 401) { + if (code == 424) { ElMessageBox.confirm('令牌状态已过期,请点击重新登录', "系统提示", { confirmButtonText: "确定", cancelButtonText: "取消", diff --git a/src/views/login/login.vue b/src/views/login/login.vue index cdd190e..bc3e42d 100644 --- a/src/views/login/login.vue +++ b/src/views/login/login.vue @@ -1,127 +1,133 @@ diff --git a/src/views/logs-manage/index.vue b/src/views/logs-manage/index.vue index 8d0cdf9..a7b0b4a 100644 --- a/src/views/logs-manage/index.vue +++ b/src/views/logs-manage/index.vue @@ -1,78 +1,84 @@ diff --git a/src/views/permissions-manage/doctor-manage.vue b/src/views/permissions-manage/doctor-manage.vue index 8c90344..dbeaecf 100644 --- a/src/views/permissions-manage/doctor-manage.vue +++ b/src/views/permissions-manage/doctor-manage.vue @@ -24,9 +24,12 @@ -