From 4bcbccf7e6f63285c9383117efe856c7ae122453 Mon Sep 17 00:00:00 2001 From: haoxr <1490493387@qq.com> Date: Mon, 19 Dec 2022 09:57:44 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=B3=A8=E9=87=8A=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=92=8C=E5=88=A0=E9=99=A4=E6=97=A0=E7=94=A8=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Former-commit-id: bc4c1add7c69a236b6d1feaebe64ea115c34c5a4 --- src/store/modules/permission.ts | 2 +- src/store/modules/settings.ts | 2 +- src/store/modules/tagsView.ts | 2 +- src/store/modules/types.ts | 41 --------------------------------- src/store/modules/user.ts | 2 +- 5 files changed, 4 insertions(+), 45 deletions(-) delete mode 100644 src/store/modules/types.ts diff --git a/src/store/modules/permission.ts b/src/store/modules/permission.ts index 282422ad..f04320ee 100644 --- a/src/store/modules/permission.ts +++ b/src/store/modules/permission.ts @@ -53,7 +53,7 @@ export const usePermissionStore = defineStore('permission', () => { const routes = ref([]); const addRoutes = ref([]); - // auctions + // actions function setRoutes(newRoutes: RouteRecordRaw[]) { addRoutes.value = newRoutes; routes.value = constantRoutes.concat(newRoutes); diff --git a/src/store/modules/settings.ts b/src/store/modules/settings.ts index e25c507c..16193f17 100644 --- a/src/store/modules/settings.ts +++ b/src/store/modules/settings.ts @@ -19,7 +19,7 @@ export const useSettingsStore = defineStore('setting', () => { const fixedHeader = ref(defaultSettings.fixedHeader); const sidebarLogo = ref(defaultSettings.sidebarLogo); - // auction + // actions function changeSetting(param: { key: string; value: any }) { const { key, value } = param; switch (key) { diff --git a/src/store/modules/tagsView.ts b/src/store/modules/tagsView.ts index f304744f..f8a69a23 100644 --- a/src/store/modules/tagsView.ts +++ b/src/store/modules/tagsView.ts @@ -12,7 +12,7 @@ export const useTagsViewStore = defineStore('tagsView', () => { const visitedViews = ref([]); const cachedViews = ref([]); - // auctions + // actions function addVisitedView(view: TagView) { if (visitedViews.value.some(v => v.path === view.path)) return; if (view.meta && view.meta.affix) { diff --git a/src/store/modules/types.ts b/src/store/modules/types.ts deleted file mode 100644 index a03d4cc9..00000000 --- a/src/store/modules/types.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { RouteLocationNormalized, RouteRecordRaw } from 'vue-router'; - -export interface AppState { - device: string; - sidebar: { - opened: boolean; - withoutAnimation: boolean; - }; - language: string; - size: string; -} - -export interface PermissionState { - routes: RouteRecordRaw[]; - addRoutes: RouteRecordRaw[]; -} - -export interface SettingState { - theme: string; - tagsView: boolean; - fixedHeader: boolean; - showSettings: boolean; - sidebarLogo: boolean; -} - -export interface UserState { - token: string; - nickname: string; - avatar: string; - roles: string[]; - perms: string[]; -} - -export interface TagView extends Partial { - title?: string; -} - -export interface TagsViewState { - visitedViews: TagView[]; - cachedViews: string[]; -} diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index f436d5fc..60ce7caa 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -17,7 +17,7 @@ export const useUserStore = defineStore('user', () => { const roles = ref>([]); // 用户角色编码集合 → 判断路由权限 const perms = ref>([]); // 用户权限编码集合 → 判断按钮权限 - // auctions + // actions // 登录 function login(loginData: LoginData) {