diff --git a/scripts/vite/file.json b/scripts/vite/file.json
new file mode 100644
index 0000000..5650a93
--- /dev/null
+++ b/scripts/vite/file.json
@@ -0,0 +1,26 @@
+{
+ "txt": "",
+ "excel": "",
+ "ppt": "",
+ "video": "",
+ "folder": "",
+ "image": "",
+ "unknown": "",
+ "zip": "",
+ "link": "",
+ "pdf": "",
+ "word": "",
+ "audio": "",
+ "ippt": "",
+ "itxt": "",
+ "iexcel": "",
+ "ivideo": "",
+ "iimage": "",
+ "iunknown": "",
+ "ifolder": "",
+ "izip": "",
+ "iword": "",
+ "ipdf": "",
+ "iaudio": "",
+ "ilink": ""
+}
diff --git a/scripts/vite/icon-file.json b/scripts/vite/icon-file.json
deleted file mode 100644
index 97b66ca..0000000
--- a/scripts/vite/icon-file.json
+++ /dev/null
@@ -1,266 +0,0 @@
-[
- {
- "id": 21721547,
- "name": "标准图-记事本",
- "project_id": 4270790,
- "projectId": 4270790,
- "show_svg": "",
- "unicode": "59044",
- "font_class": "txt",
- "freeze": 0,
- "path_attributes": "fill=\"#8289AD\"|fill=\"#FFFFFF\"|fill=\"#CDCFDE\""
- },
- {
- "id": 21721548,
- "name": "标准图-工作表",
- "project_id": 4270790,
- "projectId": 4270790,
- "show_svg": "",
- "unicode": "59045",
- "font_class": "excel",
- "freeze": 0,
- "path_attributes": "fill=\"#4CB050\"|fill=\"#FFFFFF\"|fill=\"#B7DFB9\""
- },
- {
- "id": 21721549,
- "name": "标准图-幻灯片",
- "project_id": 4270790,
- "projectId": 4270790,
- "show_svg": "",
- "unicode": "59046",
- "font_class": "ppt",
- "freeze": 0,
- "path_attributes": "fill=\"#FF9333\"|fill=\"#FFFFFF\"|fill=\"#FFD3AD\""
- },
- {
- "id": 21721550,
- "name": "标准图-视频文件",
- "project_id": 4270790,
- "projectId": 4270790,
- "show_svg": "",
- "unicode": "59047",
- "font_class": "video",
- "freeze": 0,
- "path_attributes": "fill=\"#7C8EEE\"|fill=\"#FFFFFF\"|fill=\"#CAD1F8\""
- },
- {
- "id": 21721551,
- "name": "标准图-文件夹",
- "project_id": 4270790,
- "projectId": 4270790,
- "show_svg": "",
- "unicode": "59048",
- "font_class": "folder",
- "freeze": 0,
- "path_attributes": "fill=\"#FFA000\"|fill=\"#FFFFFF\"|fill=\"#FFCA28\""
- },
- {
- "id": 21721552,
- "name": "标准图-图片文件",
- "project_id": 4270790,
- "projectId": 4270790,
- "show_svg": "",
- "unicode": "59049",
- "font_class": "image",
- "freeze": 0,
- "path_attributes": "fill=\"#F6AD00\"|fill=\"#FFF7F7\"|fill=\"#FFFFFF\"|fill=\"#FBDE99\""
- },
- {
- "id": 21721553,
- "name": "标准图-未知文件",
- "project_id": 4270790,
- "projectId": 4270790,
- "show_svg": "",
- "unicode": "59050",
- "font_class": "unknown",
- "freeze": 0,
- "path_attributes": "fill=\"#CCCCCC\"|fill=\"#EAEAEA\"|fill=\"#FFFFFF\""
- },
- {
- "id": 21721554,
- "name": "标准图-压缩文件",
- "project_id": 4270790,
- "projectId": 4270790,
- "show_svg": "",
- "unicode": "59051",
- "font_class": "zip",
- "freeze": 0,
- "path_attributes": "fill=\"#576A95\"|fill=\"#FFFFFF\"|fill=\"#BBC3D4\""
- },
- {
- "id": 21721555,
- "name": "标准图-链接",
- "project_id": 4270790,
- "projectId": 4270790,
- "show_svg": "",
- "unicode": "59052",
- "font_class": "link",
- "freeze": 0,
- "path_attributes": "fill=\"#4876F9\"|fill=\"#FFFFFF\"|fill=\"#B5C8FC\""
- },
- {
- "id": 21721556,
- "name": "标准图-PDF文档",
- "project_id": 4270790,
- "projectId": 4270790,
- "show_svg": "",
- "unicode": "59053",
- "font_class": "pdf",
- "freeze": 0,
- "path_attributes": "fill=\"#FA4E4E\"|fill=\"#FFFFFF\"|fill=\"#FDB8B8\""
- },
- {
- "id": 21721557,
- "name": "标准图-Word文档",
- "project_id": 4270790,
- "projectId": 4270790,
- "show_svg": "",
- "unicode": "59054",
- "font_class": "word",
- "freeze": 0,
- "path_attributes": "fill=\"#4876F9\"|fill=\"#FFFFFF\"|fill=\"#B5C8FC\""
- },
- {
- "id": 21721558,
- "name": "标准图-声音文件",
- "project_id": 4270790,
- "projectId": 4270790,
- "show_svg": "",
- "unicode": "59055",
- "font_class": "audio",
- "freeze": 0,
- "path_attributes": "fill=\"#F16C00\"|fill=\"#FFFFFF\"|fill=\"#F9C499\""
- },
- {
- "id": 21721566,
- "name": "缩略图-幻灯片",
- "project_id": 4270790,
- "projectId": 4270790,
- "show_svg": "",
- "unicode": "59056",
- "font_class": "ippt",
- "freeze": 0,
- "path_attributes": "fill=\"#FF9333\"|fill=\"#FFFFFF\""
- },
- {
- "id": 21721567,
- "name": "缩略图-记事本",
- "project_id": 4270790,
- "projectId": 4270790,
- "show_svg": "",
- "unicode": "59057",
- "font_class": "itxt",
- "freeze": 0,
- "path_attributes": "fill=\"#8289AD\"|fill=\"#FFFFFF\""
- },
- {
- "id": 21721568,
- "name": "缩略图-工作表",
- "project_id": 4270790,
- "projectId": 4270790,
- "show_svg": "",
- "unicode": "59058",
- "font_class": "iexcel",
- "freeze": 0,
- "path_attributes": "fill=\"#4CB050\"|fill=\"#FFFFFF\""
- },
- {
- "id": 21721569,
- "name": "缩略图-视频文件",
- "project_id": 4270790,
- "projectId": 4270790,
- "show_svg": "",
- "unicode": "59059",
- "font_class": "ivideo",
- "freeze": 0,
- "path_attributes": "fill=\"#7C8EEE\"|fill=\"#FFFFFF\""
- },
- {
- "id": 21721570,
- "name": "缩略图-图片文件",
- "project_id": 4270790,
- "projectId": 4270790,
- "show_svg": "",
- "unicode": "59060",
- "font_class": "iimage",
- "freeze": 0,
- "path_attributes": "fill=\"#F6AD00\"|fill=\"#FFF7F7\"|fill=\"#FFFFFF\""
- },
- {
- "id": 21721571,
- "name": "缩略图-未知文件",
- "project_id": 4270790,
- "projectId": 4270790,
- "show_svg": "",
- "unicode": "59061",
- "font_class": "iunknown",
- "freeze": 0,
- "path_attributes": "fill=\"#CCCCCC\"|fill=\"#FFFFFF\""
- },
- {
- "id": 21721572,
- "name": "缩略图-文件夹",
- "project_id": 4270790,
- "projectId": 4270790,
- "show_svg": "",
- "unicode": "59062",
- "font_class": "ifolder",
- "freeze": 0,
- "path_attributes": "fill=\"#FFA000\"|fill=\"#FFCA28\""
- },
- {
- "id": 21721573,
- "name": "缩略图-压缩文件",
- "project_id": 4270790,
- "projectId": 4270790,
- "show_svg": "",
- "unicode": "59063",
- "font_class": "izip",
- "freeze": 0,
- "path_attributes": "fill=\"#576A95\"|fill=\"#FFFFFF\""
- },
- {
- "id": 21721574,
- "name": "缩略图-Word",
- "project_id": 4270790,
- "projectId": 4270790,
- "show_svg": "",
- "unicode": "59064",
- "font_class": "iword",
- "freeze": 0,
- "path_attributes": "fill=\"#4876F9\"|fill=\"#FFFFFF\""
- },
- {
- "id": 21721575,
- "name": "缩略图-PDF文档",
- "project_id": 4270790,
- "projectId": 4270790,
- "show_svg": "",
- "unicode": "59065",
- "font_class": "ipdf",
- "freeze": 0,
- "path_attributes": "fill=\"#FA4E4E\"|fill=\"#FFFFFF\""
- },
- {
- "id": 21721576,
- "name": "缩略图-声音文件",
- "project_id": 4270790,
- "projectId": 4270790,
- "show_svg": "",
- "unicode": "59066",
- "font_class": "iaudio",
- "freeze": 0,
- "path_attributes": "fill=\"#F16C00\"|fill=\"#FFFFFF\""
- },
- {
- "id": 21721577,
- "name": "缩略图-链接",
- "project_id": 4270790,
- "projectId": 4270790,
- "show_svg": "",
- "unicode": "59067",
- "font_class": "ilink",
- "freeze": 0,
- "path_attributes": "fill=\"#4876F9\"|fill=\"#FFFFFF\""
- }
-]
diff --git a/src/router/menus/index.ts b/src/router/menus/index.ts
index 37e9ae3..d9335a4 100644
--- a/src/router/menus/index.ts
+++ b/src/router/menus/index.ts
@@ -90,10 +90,7 @@ function listToTree(list: MenuItem[]) {
* @param key 排序字段
* @returns
*/
-function sort(
- routes: T[],
- key = "sort"
-) {
+function sort(routes: T[], key = "sort") {
return routes.sort((a, b) => {
if (Array.isArray(a.children)) {
a.children = sort(a.children);
@@ -112,7 +109,6 @@ function sort(
*/
function transformToMenuItems(routes: RouteRecordRaw[]) {
const menus = routesToItems(routes);
- console.log(menus);
const tree = listToTree(menus);
return sort(tree);
}
@@ -124,4 +120,3 @@ const menus = transformToMenuItems(appRoutes);
export { menus };
export type { MenuItem };
-
diff --git a/src/router/routes/index.ts b/src/router/routes/index.ts
index 8d48366..e09945f 100644
--- a/src/router/routes/index.ts
+++ b/src/router/routes/index.ts
@@ -1,6 +1,5 @@
import generatedRoutes from "virtual:generated-pages";
import { RouteRecordRaw } from "vue-router";
-import { routes as rawRoutes } from "vue-router/auto/routes";
const APP_ROUTE_NAME = "_layout";
diff --git a/tsconfig.node.json b/tsconfig.node.json
index e83357f..be9f0a4 100644
--- a/tsconfig.node.json
+++ b/tsconfig.node.json
@@ -9,7 +9,7 @@
"include": [
"vite.config.ts",
"scripts/vite/**/*.ts",
- "scripts/vite/icon-file.json",
+ "scripts/vite/file.json",
"package.json",
"src/types/env.d.ts"
]
diff --git a/vite.config.ts b/vite.config.ts
index 8a3a945..c4373df 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -6,11 +6,10 @@ import Unocss from "unocss/vite";
import AutoImport from "unplugin-auto-import/vite";
import { ArcoResolver } from "unplugin-vue-components/resolvers";
import AutoComponent from "unplugin-vue-components/vite";
-import AutoRouter from "unplugin-vue-router/vite";
import { defineConfig, loadEnv } from "vite";
import Page from "vite-plugin-pages";
import { arcoToUnoColor } from "./scripts/vite/color";
-import fileIcon from "./scripts/vite/icon-file.json";
+import iconFile from "./scripts/vite/file.json";
import plugin from "./scripts/vite/plugin";
/**
@@ -24,15 +23,6 @@ export default defineConfig(({ mode }) => {
return {
base: "./",
plugins: [
- /**
- * 自动路由生成(须在vue插件前)
- * @see https://github.com/posva/unplugin-vue-router
- */
- AutoRouter({
- exclude: ["**/components/*.vue", "**/*.*.vue"],
- dts: "src/types/auto-router.d.ts",
- }),
-
/**
* 提供 Vue 3 单文件组件支持
* @see https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue
@@ -92,13 +82,7 @@ export default defineConfig(({ mode }) => {
presetIcons({
prefix: "",
collections: {
- "icon-file": (() => {
- const icons = {};
- for (const item of fileIcon) {
- icons[item.font_class] = item.show_svg;
- }
- return icons;
- })(),
+ "icon-file": iconFile,
},
}),
],