From 156dc1821ccef5ff5bbfeee0863d787a194c0cbf Mon Sep 17 00:00:00 2001 From: cshaptx4869 <994774638@qq.com> Date: Wed, 14 Aug 2024 11:01:31 +0800 Subject: [PATCH] =?UTF-8?q?style:=20:lipstick:=20=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/Sidebar/components/SidebarMixTopMenu.vue | 2 -- src/store/modules/tagsView.ts | 4 ++++ src/store/modules/user.ts | 5 ++--- src/utils/request.ts | 1 - src/views/login/index.vue | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/layout/components/Sidebar/components/SidebarMixTopMenu.vue b/src/layout/components/Sidebar/components/SidebarMixTopMenu.vue index 5893f155..6c431158 100644 --- a/src/layout/components/Sidebar/components/SidebarMixTopMenu.vue +++ b/src/layout/components/Sidebar/components/SidebarMixTopMenu.vue @@ -41,8 +41,6 @@ const appStore = useAppStore(); const permissionStore = usePermissionStore(); const router = useRouter(); -console.log("当前路由", useRoute().path); - // 避免 activeTopMenuPath 缓存被清理,从当前路由路径获取顶部菜单路径,eg. /system/user → /system const activeTopMenuPath = useRoute().path.match(/^\/[^\/]+/)?.[0] || "/"; appStore.activeTopMenu(activeTopMenuPath); diff --git a/src/store/modules/tagsView.ts b/src/store/modules/tagsView.ts index a92e4fe8..53a1a05a 100644 --- a/src/store/modules/tagsView.ts +++ b/src/store/modules/tagsView.ts @@ -3,6 +3,7 @@ export const useTagsViewStore = defineStore("tagsView", () => { const cachedViews = ref([]); const router = useRouter(); const route = useRoute(); + /** * 添加已访问视图到已访问视图列表中 */ @@ -144,6 +145,7 @@ export const useTagsViewStore = defineStore("tagsView", () => { }); }); } + function delRightViews(view: TagView) { return new Promise((resolve) => { const currIndex = visitedViews.value.findIndex( @@ -209,6 +211,7 @@ export const useTagsViewStore = defineStore("tagsView", () => { } }); } + function isActive(tag: TagView) { return tag.path === route.path; } @@ -228,6 +231,7 @@ export const useTagsViewStore = defineStore("tagsView", () => { } } } + return { visitedViews, cachedViews, diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index 43c92d55..4eea0408 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,8 +1,7 @@ -import AuthAPI, { LoginData } from "@/api/auth"; -import UserAPI, { UserInfo } from "@/api/user"; +import AuthAPI, { type LoginData } from "@/api/auth"; +import UserAPI, { type UserInfo } from "@/api/user"; import { resetRouter } from "@/router"; import { store } from "@/store"; - import { TOKEN_KEY } from "@/enums/CacheEnum"; export const useUserStore = defineStore("user", () => { diff --git a/src/utils/request.ts b/src/utils/request.ts index 407af7b0..3f89b54d 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -9,7 +9,6 @@ const service = axios.create({ baseURL: import.meta.env.VITE_APP_BASE_API, timeout: 50000, headers: { "Content-Type": "application/json;charset=utf-8" }, - paramsSerializer: (params) => { return qs.stringify(params); }, diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 4ebe87c3..e2dd4699 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -120,7 +120,7 @@ import { LocationQuery, useRoute } from "vue-router"; // 内部依赖 import { useSettingsStore, useUserStore } from "@/store"; -import AuthAPI, { LoginData } from "@/api/auth"; +import AuthAPI, { type LoginData } from "@/api/auth"; import router from "@/router"; import defaultSettings from "@/settings"; import { ThemeEnum } from "@/enums/ThemeEnum"; @@ -158,7 +158,7 @@ const loginData = ref({ password: "123456", captchaKey: "", captchaCode: "", -} as LoginData); +}); const loginRules = computed(() => { return {