From 9f1b4ed85be7518e1c1f0ba3183881a6db9e2898 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=AF=BB=E6=AC=A2?= Date: Thu, 1 Feb 2024 18:09:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=80=BB=E8=BE=91=E5=AE=8C=E5=96=84?= =?UTF-8?q?=EF=BC=8C=E5=AF=B9=E6=8E=A5=E5=90=8E=E7=AB=AF=E8=8F=9C=E5=8D=95?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mock/asyncRoutes.ts | 49 --------------------------------- mock/login.ts | 36 ------------------------ mock/refreshToken.ts | 27 ------------------ src/views/system/menu/index.vue | 12 ++++++++ src/views/system/role/index.vue | 12 ++++++++ src/views/system/user/index.vue | 12 ++++++++ 6 files changed, 36 insertions(+), 112 deletions(-) delete mode 100644 mock/asyncRoutes.ts delete mode 100644 mock/login.ts delete mode 100644 mock/refreshToken.ts create mode 100644 src/views/system/menu/index.vue create mode 100644 src/views/system/role/index.vue create mode 100644 src/views/system/user/index.vue diff --git a/mock/asyncRoutes.ts b/mock/asyncRoutes.ts deleted file mode 100644 index da6a559..0000000 --- a/mock/asyncRoutes.ts +++ /dev/null @@ -1,49 +0,0 @@ -// 模拟后端动态生成路由 -import { MockMethod } from "vite-plugin-mock"; - -/** - * roles:页面级别权限,这里模拟二种 "admin"、"common" - * admin:管理员角色 - * common:普通角色 - */ - -const permissionRouter = { - path: "/permission", - meta: { - title: "权限管理", - icon: "lollipop", - rank: 10 - }, - children: [ - { - path: "/permission/page/index", - name: "PermissionPage", - meta: { - title: "页面权限", - roles: ["admin", "common"] - } - }, - { - path: "/permission/button/index", - name: "PermissionButton", - meta: { - title: "按钮权限", - roles: ["admin", "common"], - auths: ["btn_add", "btn_edit", "btn_delete"] - } - } - ] -}; - -export default [ - { - url: "/getAsyncRoutes", - method: "get", - response: () => { - return { - success: true, - data: [permissionRouter] - }; - } - } -] as MockMethod[]; diff --git a/mock/login.ts b/mock/login.ts deleted file mode 100644 index cddd4e4..0000000 --- a/mock/login.ts +++ /dev/null @@ -1,36 +0,0 @@ -// 根据角色动态生成路由 -import { MockMethod } from "vite-plugin-mock"; - -export default [ - { - url: "/login", - method: "post", - response: ({ body }) => { - if (body.username === "admin") { - return { - success: true, - data: { - username: "admin", - // 一个用户可能有多个角色 - roles: ["admin"], - accessToken: "eyJhbGciOiJIUzUxMiJ9.admin", - refreshToken: "eyJhbGciOiJIUzUxMiJ9.adminRefresh", - expires: "2023/10/30 00:00:00" - } - }; - } else { - return { - success: true, - data: { - username: "common", - // 一个用户可能有多个角色 - roles: ["common"], - accessToken: "eyJhbGciOiJIUzUxMiJ9.common", - refreshToken: "eyJhbGciOiJIUzUxMiJ9.commonRefresh", - expires: "2023/10/30 00:00:00" - } - }; - } - } - } -] as MockMethod[]; diff --git a/mock/refreshToken.ts b/mock/refreshToken.ts deleted file mode 100644 index 87b8995..0000000 --- a/mock/refreshToken.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { MockMethod } from "vite-plugin-mock"; - -// 模拟刷新token接口 -export default [ - { - url: "/refreshToken", - method: "post", - response: ({ body }) => { - if (body.refreshToken) { - return { - success: true, - data: { - accessToken: "eyJhbGciOiJIUzUxMiJ9.newAdmin", - refreshToken: "eyJhbGciOiJIUzUxMiJ9.newAdminRefresh", - // `expires`选择这种日期格式是为了方便调试,后端直接设置时间戳或许更方便(每次都应该递增)。如果后端返回的是时间戳格式,前端开发请来到这个目录`src/utils/auth.ts`,把第`38`行的代码换成expires = data.expires即可。 - expires: "2023/10/30 23:59:59" - } - }; - } else { - return { - success: false, - data: {} - }; - } - } - } -] as MockMethod[]; diff --git a/src/views/system/menu/index.vue b/src/views/system/menu/index.vue new file mode 100644 index 0000000..5ee101a --- /dev/null +++ b/src/views/system/menu/index.vue @@ -0,0 +1,12 @@ + + + diff --git a/src/views/system/role/index.vue b/src/views/system/role/index.vue new file mode 100644 index 0000000..34faac1 --- /dev/null +++ b/src/views/system/role/index.vue @@ -0,0 +1,12 @@ + + + diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue new file mode 100644 index 0000000..34faac1 --- /dev/null +++ b/src/views/system/user/index.vue @@ -0,0 +1,12 @@ + + +