style(store): modify package

This commit is contained in:
chen.home 2023-03-02 07:18:44 +08:00
parent ebe4861163
commit 564ffd2ddd
2 changed files with 24 additions and 23 deletions

View File

@ -31,8 +31,6 @@
"./src/**/*.{vue,js,jsx,ts,tsx,json}": "eslint --fix"
},
"dependencies": {
"@types/crypto-js": "^4.1.1",
"@types/qs": "^6.9.7",
"@vueuse/core": "^9.10.0",
"@wangeditor/editor": "^5.1.23",
"@wangeditor/editor-for-vue": "^5.1.12",
@ -52,8 +50,10 @@
"@commitlint/config-conventional": "^17.4.0",
"@iconify-json/icon-park-outline": "^1.1.9",
"@iconify/vue": "^4.0.2",
"@types/crypto-js": "^4.1.1",
"@types/mockjs": "^1.0.7",
"@types/node": "^18.11.18",
"@types/qs": "^6.9.7",
"@typescript-eslint/eslint-plugin": "^5.48.1",
"@typescript-eslint/parser": "^5.48.1",
"@unocss/preset-attributify": "^0.48.3",

View File

@ -76,27 +76,6 @@ export const useRouteStore = defineStore('route-store', {
this.userRoutes = userRoutes;
this.menus = this.transformAuthRoutesToMenus(userRoutes);
},
/* 初始化动态路由 */
async initDynamicRoute() {
// 根据用户id来获取用户的路由
const { userId } = getUserInfo();
const { data: routes } = await fetchUserRoutes({ userId });
// 根据用户返回的路由表来生成真实路由
const appRoutes = await createDynamicRoutes(routes);
// 生成侧边菜单
await this.createMenus(routes);
// 插入路由表
router.addRoute(appRoutes);
},
/* 初始化静态路由 */
async initStaticRoute() {
// 根据静态路由表来生成真实路由
const appRoutes = await createDynamicRoutes(staticRoutes);
// 生成侧边菜单
await this.createMenus(staticRoutes);
// 插入路由表
router.addRoute(appRoutes);
},
//* 将返回的路由表渲染成侧边栏 */
transformAuthRoutesToMenus(userRoutes: AppRoute.Route[]): MenuOption[] {
return userRoutes
@ -123,6 +102,28 @@ export const useRouteStore = defineStore('route-store', {
return target;
});
},
/* 初始化动态路由 */
async initDynamicRoute() {
// 根据用户id来获取用户的路由
const { userId } = getUserInfo();
const { data: routes } = await fetchUserRoutes({ userId });
// 根据用户返回的路由表来生成真实路由
const appRoutes = await createDynamicRoutes(routes);
// 生成侧边菜单
await this.createMenus(routes);
// 插入路由表
router.addRoute(appRoutes);
},
/* 初始化静态路由 */
async initStaticRoute() {
// 根据静态路由表来生成真实路由
const appRoutes = await createDynamicRoutes(staticRoutes);
// 生成侧边菜单
await this.createMenus(staticRoutes);
// 插入路由表
router.addRoute(appRoutes);
},
async initAuthRoute() {
this.isInitAuthRoute = false;
if (this.authRouteMode === 'dynamic') {