mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
refactor(projects): 抽离格式化相关依赖配置
This commit is contained in:
@ -3,7 +3,7 @@ import { defineStore } from 'pinia';
|
||||
import { router } from '@/router';
|
||||
import { fetchLogin, fetchUserInfo } from '@/service';
|
||||
import { useRouterPush } from '@/composables';
|
||||
import { getUserInfo, getToken, setUserInfo, setToken, setRefreshToken, clearAuthStorage } from '@/utils';
|
||||
import { clearAuthStorage, getToken, getUserInfo, setRefreshToken, setToken, setUserInfo } from '@/utils';
|
||||
import { useTabStore } from '../tab';
|
||||
import { useRouteStore } from '../route';
|
||||
|
||||
|
@ -1,17 +1,17 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import { router, ROOT_ROUTE, constantRoutes, routes as staticRoutes } from '@/router';
|
||||
import { ROOT_ROUTE, constantRoutes, router, routes as staticRoutes } from '@/router';
|
||||
import { fetchUserRoutes } from '@/service';
|
||||
import {
|
||||
filterAuthRoutesByUserPermission,
|
||||
getCacheRoutes,
|
||||
getConstantRouteNames,
|
||||
getUserInfo,
|
||||
transformAuthRouteToMenu,
|
||||
transformAuthRoutesToVueRoutes,
|
||||
transformAuthRouteToVueRoute,
|
||||
transformAuthRoutesToSearchMenus,
|
||||
getCacheRoutes,
|
||||
filterAuthRoutesByUserPermission,
|
||||
transformRoutePathToRouteName,
|
||||
transformAuthRoutesToVueRoutes,
|
||||
transformRouteNameToRoutePath,
|
||||
getConstantRouteNames
|
||||
transformRoutePathToRouteName
|
||||
} from '@/utils';
|
||||
import { useAuthStore } from '../auth';
|
||||
import { useTabStore } from '../tab';
|
||||
@ -66,7 +66,7 @@ export const useRouteStore = defineStore('route-store', {
|
||||
* @param routes - 权限路由
|
||||
*/
|
||||
handleAuthRoutes(routes: AuthRoute.Route[]) {
|
||||
this.menus = transformAuthRouteToMenu(routes);
|
||||
(this.menus as GlobalMenuOption[]) = transformAuthRouteToMenu(routes);
|
||||
this.searchMenus = transformAuthRoutesToSearchMenus(routes);
|
||||
|
||||
const vueRoutes = transformAuthRoutesToVueRoutes(routes);
|
||||
@ -80,7 +80,7 @@ export const useRouteStore = defineStore('route-store', {
|
||||
/** 动态路由模式下:更新根路由的重定向 */
|
||||
handleUpdateRootRedirect(routeKey: AuthRoute.RouteKey) {
|
||||
if (routeKey === 'root' || routeKey === 'not-found-page') {
|
||||
throw Error('routeKey的值不能为root或者not-found-page');
|
||||
throw new Error('routeKey的值不能为root或者not-found-page');
|
||||
}
|
||||
const rootRoute: AuthRoute.Route = { ...ROOT_ROUTE, redirect: transformRouteNameToRoutePath(routeKey) };
|
||||
const rootRouteName: AuthRoute.RouteKey = 'root';
|
||||
|
@ -1,6 +1,6 @@
|
||||
import type { RouteRecordNormalized, RouteLocationNormalizedLoaded } from 'vue-router';
|
||||
import type { RouteLocationNormalizedLoaded, RouteRecordNormalized } from 'vue-router';
|
||||
import { EnumStorageKey } from '@/enum';
|
||||
import { setLocal, getLocal } from '@/utils';
|
||||
import { getLocal, setLocal } from '@/utils';
|
||||
|
||||
/**
|
||||
* 根据vue路由获取tab路由
|
||||
|
@ -1,15 +1,15 @@
|
||||
import type { Router, RouteLocationNormalizedLoaded } from 'vue-router';
|
||||
import type { RouteLocationNormalizedLoaded, Router } from 'vue-router';
|
||||
import { defineStore } from 'pinia';
|
||||
import { useRouterPush } from '@/composables';
|
||||
import { useThemeStore } from '../theme';
|
||||
import {
|
||||
getTabRouteByVueRoute,
|
||||
isInTabRoutes,
|
||||
clearTabRoutes,
|
||||
getIndexInTabRoutes,
|
||||
getIndexInTabRoutesByRouteName,
|
||||
setTabRoutes,
|
||||
getTabRouteByVueRoute,
|
||||
getTabRoutes,
|
||||
clearTabRoutes
|
||||
isInTabRoutes,
|
||||
setTabRoutes
|
||||
} from './helpers';
|
||||
|
||||
interface TabState {
|
||||
|
@ -2,7 +2,7 @@ import type { GlobalThemeOverrides } from 'naive-ui';
|
||||
import { cloneDeep } from 'lodash-es';
|
||||
import { themeSetting } from '@/settings';
|
||||
import { EnumStorageKey } from '@/enum';
|
||||
import { getThemeColor, getColorPalette, addColorAlpha, setLocal, getLocal, removeLocal } from '@/utils';
|
||||
import { addColorAlpha, getColorPalette, getLocal, getThemeColor, removeLocal, setLocal } from '@/utils';
|
||||
|
||||
/** 初始化主题配置 */
|
||||
export function initThemeSettings() {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import { darkTheme } from 'naive-ui';
|
||||
import { initThemeSettings, getNaiveThemeOverrides, setThemeSettings, clearThemeSettings } from './helpers';
|
||||
import { clearThemeSettings, getNaiveThemeOverrides, initThemeSettings, setThemeSettings } from './helpers';
|
||||
|
||||
type ThemeState = Theme.Setting;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { watch, onUnmounted } from 'vue';
|
||||
import { onUnmounted, watch } from 'vue';
|
||||
import { useOsTheme } from 'naive-ui';
|
||||
import type { GlobalThemeOverrides } from 'naive-ui';
|
||||
import { useElementSize } from '@vueuse/core';
|
||||
|
Reference in New Issue
Block a user