From e64ebeda4895868d2af6d2b2fd0fb7a316d326f6 Mon Sep 17 00:00:00 2001 From: herenshan112 Date: Fri, 25 Jul 2025 08:18:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=99=BB=E5=BD=95=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E9=AA=8C=E8=AF=81=E7=A0=81=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/permission.ts | 3 +- src/store/modules/permission.ts | 10 +- src/views/login/index.vue | 189 +++++++++++++++----------------- 3 files changed, 100 insertions(+), 102 deletions(-) diff --git a/src/permission.ts b/src/permission.ts index 6862acd..1294ba2 100644 --- a/src/permission.ts +++ b/src/permission.ts @@ -44,8 +44,9 @@ router.beforeEach(async (to:any, from:any, next:any) => { // const { roles } = await userStore.getInfo(); const { perms } = await userStore.getInfo(); const accessRoutes = await permissionStore.generateRoutes(perms); - // console.log("路由权限--perms--》",accessRoutes); + console.log("路由权限--perms--》",accessRoutes); accessRoutes.forEach((route:any) => { + console.log("路由权限--addRoutecessRoutes",route); router.addRoute(route); }); next({ ...to, replace: true }); diff --git a/src/store/modules/permission.ts b/src/store/modules/permission.ts index d0d0f3c..7843ea9 100644 --- a/src/store/modules/permission.ts +++ b/src/store/modules/permission.ts @@ -103,8 +103,13 @@ export const usePermissionStore = defineStore("permission", () => { listRoutes() .then(({ data: asyncRoutes }) => { // 根据角色获取有访问权限的路由 - // console.log("获取到的路由---->",asyncRoutes, roles); + console.log("获取到的路由---->",asyncRoutes); const accessedRoutes = filterAsyncRoutes(asyncRoutes, roles); + + console.log("获取到的路由--1-->",accessedRoutes); + + console.log("获取到的路由--2-->",roles); + setRoutes(accessedRoutes); resolve(accessedRoutes); }) @@ -113,6 +118,9 @@ export const usePermissionStore = defineStore("permission", () => { }); }); } + console.log("获取到的路由--3->",routes) + console.log("获取到的路由--4->",setRoutes) + console.log("获取到的路由--5->",generateRoutes) return { routes, setRoutes, generateRoutes }; }); diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 1a3e7ac..bafda16 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -2,97 +2,90 @@
- @@ -190,18 +183,15 @@ function handleLogin() { const redirect = (query.redirect as LocationQueryValue) ?? "/"; - const otherQueryParams = Object.keys(query).reduce( - (acc: any, cur: string) => { - if (cur !== "redirect") { - acc[cur] = query[cur]; - } - return acc; - }, - {} - ); - //console.log("登陆输出:",redirect,otherQueryParams); + const otherQueryParams = Object.keys(query).reduce((acc: any, cur: string) => { + if (cur !== "redirect") { + acc[cur] = query[cur]; + } + return acc; + }, {}); + //console.log("登陆输出:",redirect,otherQueryParams); router.push({ path: redirect, query: otherQueryParams }); - getCaptcha(); + getCaptcha(); }) .catch(() => { // 验证失败,重新生成验证码 @@ -227,11 +217,11 @@ onMounted(() => { background-image: url(../../assets/login/bg.png); background-repeat: no-repeat; background-size: 100% 100%; - background-color: #ECEFF5; + background-color: #eceff5; display: flex; justify-content: center; align-items: center; - .login-main{ + .login-main { width: 800px; height: 700px; position: relative; @@ -239,11 +229,11 @@ onMounted(() => { background-repeat: no-repeat; background-size: 100% 100%; margin-left: -18%; - .login-title{ + .login-title { font-weight: bold; font-size: 37px; text-align: center; - color: #1E5EFF; + color: #1e5eff; line-height: 43px; margin-bottom: 30px; } @@ -252,12 +242,12 @@ onMounted(() => { width: 500px; background-color: #fff; border-radius: 6px; - box-shadow: 0px 0px 42px -28px #37508E; + box-shadow: 0px 0px 42px -28px #37508e; padding: 60px 30px; position: absolute; left: 50%; top: 50%; - transform: translate(-50%,-50%); + transform: translate(-50%, -50%); margin-left: 60%; overflow: hidden; box-sizing: border-box; @@ -278,12 +268,11 @@ onMounted(() => { .el-form-item { border-radius: 5px; - border: solid 1px #D9D9D9; + border: solid 1px #d9d9d9; color: #666; } .el-input { - // 子组件 scoped 无效,使用 :deep :deep(.el-input__wrapper) { padding: 0;