xiaoxian521 2 gadi atpakaļ
vecāks
revīzija
49dabd6b36

+ 2 - 2
package.json

@@ -35,8 +35,8 @@
     "@logicflow/core": "^1.1.30",
     "@logicflow/extension": "^1.1.30",
     "@pureadmin/descriptions": "^1.1.0",
-    "@pureadmin/table": "^1.8.3",
-    "@pureadmin/utils": "^1.7.5",
+    "@pureadmin/table": "^1.9.0",
+    "@pureadmin/utils": "^1.8.2",
     "@vueuse/core": "^9.6.0",
     "@vueuse/motion": "2.0.0-beta.12",
     "@wangeditor/editor": "^5.1.21",

+ 8 - 12
pnpm-lock.yaml

@@ -14,9 +14,9 @@ specifiers:
   "@logicflow/core": ^1.1.30
   "@logicflow/extension": ^1.1.30
   "@pureadmin/descriptions": ^1.1.0
-  "@pureadmin/table": ^1.8.3
+  "@pureadmin/table": ^1.9.0
   "@pureadmin/theme": ^2.4.0
-  "@pureadmin/utils": ^1.7.5
+  "@pureadmin/utils": ^1.8.2
   "@types/element-resize-detector": 1.1.3
   "@types/intro.js": ^5.1.0
   "@types/js-cookie": ^3.0.1
@@ -123,8 +123,8 @@ dependencies:
   "@logicflow/core": 1.1.31
   "@logicflow/extension": 1.1.31
   "@pureadmin/descriptions": 1.1.1_element-plus@2.2.26
-  "@pureadmin/table": 1.8.3_element-plus@2.2.26
-  "@pureadmin/utils": 1.7.5_aotapuqn7htzdjltsyimavekky
+  "@pureadmin/table": 1.9.0_element-plus@2.2.26
+  "@pureadmin/utils": 1.8.2_echarts@5.4.0+vue@3.2.45
   "@vueuse/core": 9.6.0_vue@3.2.45
   "@vueuse/motion": 2.0.0-beta.12_vue@3.2.45
   "@wangeditor/editor": 5.1.23
@@ -1271,10 +1271,10 @@ packages:
       vue: 3.2.45
     dev: false
 
-  /@pureadmin/table/1.8.3_element-plus@2.2.26:
+  /@pureadmin/table/1.9.0_element-plus@2.2.26:
     resolution:
       {
-        integrity: sha512-M+I+CDu74s/ffNybbDg0rHhiMHTdkgVIaksfmmrEwjuLB2nEaz7R0tob2qC5rKE96U2Z246meDHBidyQNx2z9w==
+        integrity: sha512-3cGbQc5QV0E7i1h0QZJWVuwJKXn1Kk2Ae6T/Z/pxEVRbwE0L+vixI/x9WO31/yZEL7qNz2lD+OIOtUU+HjTbYA==
       }
     peerDependencies:
       element-plus: ^2.0.0
@@ -1294,24 +1294,20 @@ packages:
       string-hash: 1.1.3
     dev: true
 
-  /@pureadmin/utils/1.7.5_aotapuqn7htzdjltsyimavekky:
+  /@pureadmin/utils/1.8.2_echarts@5.4.0+vue@3.2.45:
     resolution:
       {
-        integrity: sha512-WqjtvMD67egsIJuPYx9V9aaXG3iYOTMj48XPfYxBzWTuUSvGkEj9M+3P1IrgG6GZQlK8dCPqaog8B0vujLjYJA==
+        integrity: sha512-9mr/y3RZJZGCYpKuRVngR6XVumdMjRNPLkFfljwU9KS5UQio70cfqsH6TQ8uL/Oh0eepDym+/KkSVTMx2EsOyQ==
       }
     peerDependencies:
-      dayjs: "*"
       echarts: "*"
       vue: "*"
     peerDependenciesMeta:
-      dayjs:
-        optional: true
       echarts:
         optional: true
       vue:
         optional: true
     dependencies:
-      dayjs: 1.11.6
       echarts: 5.4.0
       vue: 3.2.45
     dev: false

+ 2 - 2
src/layout/components/setting/index.vue

@@ -132,8 +132,8 @@ const multiTagsCacheChange = () => {
 /** 清空缓存并返回登录页 */
 function onReset() {
   removeToken();
-  storageLocal.clear();
-  storageSession.clear();
+  storageLocal().clear();
+  storageSession().clear();
   const { Grey, Weak, MultiTagsCache, EpThemeColor, Layout } = getConfig();
   useAppStoreHook().setLayout(Layout);
   setEpThemeColor(EpThemeColor);

+ 2 - 1
src/layout/components/sidebar/vertical.vue

@@ -12,7 +12,8 @@ import { usePermissionStoreHook } from "@/store/modules/permission";
 
 const route = useRoute();
 const showLogo = ref(
-  storageLocal.getItem<StorageConfigs>("responsive-configure")?.showLogo ?? true
+  storageLocal().getItem<StorageConfigs>("responsive-configure")?.showLogo ??
+    true
 );
 
 const { routers, device, pureApp, isCollapse, menuSelect, toggleSideBar } =

+ 4 - 4
src/layout/hooks/useTag.ts

@@ -41,13 +41,13 @@ export function useTags() {
 
   /** 显示模式,默认灵动模式 */
   const showModel = ref(
-    storageLocal.getItem<StorageConfigs>("responsive-configure")?.showModel ||
+    storageLocal().getItem<StorageConfigs>("responsive-configure")?.showModel ||
       "smart"
   );
   /** 是否隐藏标签页,默认显示 */
   const showTags =
     ref(
-      storageLocal.getItem<StorageConfigs>("responsive-configure").hideTabs
+      storageLocal().getItem<StorageConfigs>("responsive-configure").hideTabs
     ) ?? ref("false");
   const multiTags: any = computed(() => {
     return useMultiTagsStoreHook().multiTags;
@@ -195,11 +195,11 @@ export function useTags() {
 
   onMounted(() => {
     if (!showModel.value) {
-      const configure = storageLocal.getItem<StorageConfigs>(
+      const configure = storageLocal().getItem<StorageConfigs>(
         "responsive-configure"
       );
       configure.showModel = "card";
-      storageLocal.setItem("responsive-configure", configure);
+      storageLocal().setItem("responsive-configure", configure);
     }
   });
 

+ 1 - 1
src/plugins/i18n.ts

@@ -63,7 +63,7 @@ export const $t = (key: string) => key;
 export const i18n: I18n = createI18n({
   legacy: false,
   locale:
-    storageLocal.getItem<StorageConfigs>("responsive-locale")?.locale ?? "zh",
+    storageLocal().getItem<StorageConfigs>("responsive-locale")?.locale ?? "zh",
   fallbackLocale: "en",
   messages: localesConfigs
 });

+ 1 - 1
src/router/index.ts

@@ -106,7 +106,7 @@ router.beforeEach((to: toRouteType, _from, next) => {
       handleAliveRoute(newMatched);
     }
   }
-  const userInfo = storageSession.getItem<DataInfo<number>>(sessionKey);
+  const userInfo = storageSession().getItem<DataInfo<number>>(sessionKey);
   NProgress.start();
   const externalLink = isUrl(to?.name as string);
   if (!externalLink) {

+ 3 - 3
src/router/utils.ts

@@ -84,7 +84,7 @@ function isOneOfArray(a: Array<string>, b: Array<string>) {
 /** 从sessionStorage里取出当前登陆用户的角色roles,过滤无权限的菜单 */
 function filterNoPermissionTree(data: RouteComponent[]) {
   const currentRoles =
-    storageSession.getItem<DataInfo<number>>(sessionKey)?.roles ?? [];
+    storageSession().getItem<DataInfo<number>>(sessionKey)?.roles ?? [];
   const newTree = cloneDeep(data).filter((v: any) =>
     isOneOfArray(v.meta?.roles, currentRoles)
   );
@@ -196,7 +196,7 @@ function initRouter() {
   if (getConfig()?.CachingAsyncRoutes) {
     // 开启动态路由缓存本地sessionStorage
     const key = "async-routes";
-    const asyncRouteList = storageSession.getItem(key) as any;
+    const asyncRouteList = storageSession().getItem(key) as any;
     if (asyncRouteList && asyncRouteList?.length > 0) {
       return new Promise(resolve => {
         handleAsyncRoutes(asyncRouteList);
@@ -206,7 +206,7 @@ function initRouter() {
       return new Promise(resolve => {
         getAsyncRoutes().then(({ data }) => {
           handleAsyncRoutes(cloneDeep(data));
-          storageSession.setItem(key, data);
+          storageSession().setItem(key, data);
           resolve(router);
         });
       });

+ 5 - 4
src/store/modules/app.ts

@@ -9,14 +9,14 @@ export const useAppStore = defineStore({
   state: (): appType => ({
     sidebar: {
       opened:
-        storageLocal.getItem<StorageConfigs>("responsive-layout")
+        storageLocal().getItem<StorageConfigs>("responsive-layout")
           ?.sidebarStatus ?? getConfig().SidebarStatus,
       withoutAnimation: false,
       isClickCollapse: false
     },
     // 这里的layout用于监听容器拖拉后恢复对应的导航模式
     layout:
-      storageLocal.getItem<StorageConfigs>("responsive-layout")?.layout ??
+      storageLocal().getItem<StorageConfigs>("responsive-layout")?.layout ??
       getConfig().Layout,
     device: deviceDetection() ? "mobile" : "desktop",
     // 作用于 src/views/components/draggable/index.vue 页面,当离开页面并不会销毁 new Swap(),sortablejs 官网也没有提供任何销毁的 api
@@ -32,7 +32,8 @@ export const useAppStore = defineStore({
   },
   actions: {
     TOGGLE_SIDEBAR(opened?: boolean, resize?: string) {
-      const layout = storageLocal.getItem<StorageConfigs>("responsive-layout");
+      const layout =
+        storageLocal().getItem<StorageConfigs>("responsive-layout");
       if (opened && resize) {
         this.sidebar.withoutAnimation = true;
         this.sidebar.opened = true;
@@ -47,7 +48,7 @@ export const useAppStore = defineStore({
         this.sidebar.isClickCollapse = !this.sidebar.opened;
         layout.sidebarStatus = this.sidebar.opened;
       }
-      storageLocal.setItem("responsive-layout", layout);
+      storageLocal().setItem("responsive-layout", layout);
     },
     async toggleSideBar(opened?: boolean, resize?: string) {
       await this.TOGGLE_SIDEBAR(opened, resize);

+ 6 - 5
src/store/modules/epTheme.ts

@@ -7,10 +7,10 @@ export const useEpThemeStore = defineStore({
   id: "pure-epTheme",
   state: () => ({
     epThemeColor:
-      storageLocal.getItem<StorageConfigs>("responsive-layout")?.epThemeColor ??
-      getConfig().EpThemeColor,
+      storageLocal().getItem<StorageConfigs>("responsive-layout")
+        ?.epThemeColor ?? getConfig().EpThemeColor,
     epTheme:
-      storageLocal.getItem<StorageConfigs>("responsive-layout")?.theme ??
+      storageLocal().getItem<StorageConfigs>("responsive-layout")?.theme ??
       getConfig().Theme
   }),
   getters: {
@@ -30,12 +30,13 @@ export const useEpThemeStore = defineStore({
   },
   actions: {
     setEpThemeColor(newColor: string): void {
-      const layout = storageLocal.getItem<StorageConfigs>("responsive-layout");
+      const layout =
+        storageLocal().getItem<StorageConfigs>("responsive-layout");
       this.epTheme = layout?.theme;
       this.epThemeColor = newColor;
       if (!layout) return;
       layout.epThemeColor = newColor;
-      storageLocal.setItem("responsive-layout", layout);
+      storageLocal().setItem("responsive-layout", layout);
     }
   }
 });

+ 8 - 7
src/store/modules/multiTags.ts

@@ -9,12 +9,13 @@ export const useMultiTagsStore = defineStore({
   id: "pure-multiTags",
   state: () => ({
     // 存储标签页信息(路由信息)
-    multiTags: storageLocal.getItem<StorageConfigs>("responsive-configure")
+    multiTags: storageLocal().getItem<StorageConfigs>("responsive-configure")
       ?.multiTagsCache
-      ? storageLocal.getItem<StorageConfigs>("responsive-tags")
+      ? storageLocal().getItem<StorageConfigs>("responsive-tags")
       : [...routerArrays],
-    multiTagsCache: storageLocal.getItem<StorageConfigs>("responsive-configure")
-      ?.multiTagsCache
+    multiTagsCache: storageLocal().getItem<StorageConfigs>(
+      "responsive-configure"
+    )?.multiTagsCache
   }),
   getters: {
     getMultiTagsCache() {
@@ -25,14 +26,14 @@ export const useMultiTagsStore = defineStore({
     multiTagsCacheChange(multiTagsCache: boolean) {
       this.multiTagsCache = multiTagsCache;
       if (multiTagsCache) {
-        storageLocal.setItem("responsive-tags", this.multiTags);
+        storageLocal().setItem("responsive-tags", this.multiTags);
       } else {
-        storageLocal.removeItem("responsive-tags");
+        storageLocal().removeItem("responsive-tags");
       }
     },
     tagsCache(multiTags) {
       this.getMultiTagsCache &&
-        storageLocal.setItem("responsive-tags", multiTags);
+        storageLocal().setItem("responsive-tags", multiTags);
     },
     handleTags<T>(
       mode: string,

+ 2 - 2
src/store/modules/user.ts

@@ -14,9 +14,9 @@ export const useUserStore = defineStore({
   state: (): userType => ({
     // 用户名
     username:
-      storageSession.getItem<DataInfo<number>>(sessionKey)?.username ?? "",
+      storageSession().getItem<DataInfo<number>>(sessionKey)?.username ?? "",
     // 页面级别权限
-    roles: storageSession.getItem<DataInfo<number>>(sessionKey)?.roles ?? [],
+    roles: storageSession().getItem<DataInfo<number>>(sessionKey)?.roles ?? [],
     // 前端生成的验证码(按实际需求替换)
     verifyCode: "",
     // 判断登录页面显示哪个组件(0:登录(默认)、1:手机登录、2:二维码登录、3:注册、4:忘记密码)

+ 4 - 4
src/utils/auth.ts

@@ -23,7 +23,7 @@ export function getToken(): DataInfo<number> {
   // 此处与`TokenKey`相同,此写法解决初始化时`Cookies`中不存在`TokenKey`报错
   return Cookies.get(TokenKey)
     ? JSON.parse(Cookies.get(TokenKey))
-    : storageSession.getItem(sessionKey);
+    : storageSession().getItem(sessionKey);
 }
 
 /**
@@ -47,7 +47,7 @@ export function setToken(data: DataInfo<Date>) {
   function setSessionKey(username: string, roles: Array<string>) {
     useUserStoreHook().SET_USERNAME(username);
     useUserStoreHook().SET_ROLES(roles);
-    storageSession.setItem(sessionKey, {
+    storageSession().setItem(sessionKey, {
       refreshToken,
       expires,
       username,
@@ -60,9 +60,9 @@ export function setToken(data: DataInfo<Date>) {
     setSessionKey(username, roles);
   } else {
     const username =
-      storageSession.getItem<DataInfo<number>>(sessionKey)?.username ?? "";
+      storageSession().getItem<DataInfo<number>>(sessionKey)?.username ?? "";
     const roles =
-      storageSession.getItem<DataInfo<number>>(sessionKey)?.roles ?? [];
+      storageSession().getItem<DataInfo<number>>(sessionKey)?.roles ?? [];
     setSessionKey(username, roles);
   }
 }