From c5705f7032da01f38acc26c78f0825b4c659645d Mon Sep 17 00:00:00 2001 From: "chen.home" <1147347984@qq.com> Date: Wed, 11 Jan 2023 00:21:50 +0800 Subject: [PATCH] =?UTF-8?q?feat(project):=20=E9=87=8D=E6=9E=84=E8=BD=BD?= =?UTF-8?q?=E5=85=A5=E5=8A=A8=E7=94=BB=E5=92=8C=E7=B3=BB=E7=BB=9F=E7=BB=93?= =?UTF-8?q?=E6=9E=84=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 5 +- build/plugins/html.ts | 18 +- index.html | 32 +-- package.json | 70 ++--- public/resource/loading.css | 74 ------ src/App.vue | 33 ++- src/components/common/appLoading.vue | 241 ++++++++++++++++++ src/hooks/index.ts | 1 + src/hooks/useSystem.ts | 23 ++ src/layouts/BasicLayout/index.vue | 70 +++-- .../components/common/HeaderButton.vue | 27 +- src/layouts/components/sider/Logo.vue | 17 +- src/layouts/components/sider/Menu.vue | 3 +- src/main.ts | 29 +-- src/router/guard/index.ts | 37 +-- src/store/modules/app.ts | 238 ++++++++--------- src/typings/env.d.ts | 64 ++--- src/views/list/cardList/index.vue | 151 ++++++----- 18 files changed, 705 insertions(+), 428 deletions(-) delete mode 100644 public/resource/loading.css create mode 100644 src/components/common/appLoading.vue create mode 100644 src/hooks/useSystem.ts diff --git a/.env b/.env index 006aa0b..32badd6 100644 --- a/.env +++ b/.env @@ -1,7 +1,10 @@ # 项目根目录 VITE_BASE_URL=/ # 项目名称 -VITE_APP_TITLE = Ench Admin +VITE_APP_NAME=EnchAdmin +VITE_APP_TITLE=Ench管理系统 +VITE_APP_DESC=EnchAdmin是一个中后台管理系统模版 + # 路由模式 VITE_HASH_ROUTE = Y # 权限路由模式: static | dynamic diff --git a/build/plugins/html.ts b/build/plugins/html.ts index 6a50eae..cfa86bc 100644 --- a/build/plugins/html.ts +++ b/build/plugins/html.ts @@ -1,13 +1,13 @@ import { createHtmlPlugin } from 'vite-plugin-html'; // https://github.com/vbenjs/vite-plugin-html/blob/main/README.zh_CN.md export default (env: ImportMetaEnv) => { - return createHtmlPlugin({ - minify: true, // 压缩HTML - inject: { - // 注入数据 - data: { - title: env.VITE_APP_TITLE, - }, - }, - }); + return createHtmlPlugin({ + minify: true, // 压缩HTML + inject: { + // 注入数据 + data: { + title: env.VITE_APP_TITLE, + }, + }, + }); }; diff --git a/index.html b/index.html index 04144e4..dcaef9e 100644 --- a/index.html +++ b/index.html @@ -1,25 +1,13 @@ - - - - - - <%= title %> - - -
-
-
-
-
-
-
-
-
- <%= title %>管理系统 -
-
- - + + + + + <%= title %> + + +
+ + diff --git a/package.json b/package.json index 65531d8..9382547 100644 --- a/package.json +++ b/package.json @@ -31,54 +31,54 @@ "./src/**/*.{vue,js,jsx,ts,tsx,json}": "eslint --fix" }, "dependencies": { - "@vueuse/core": "^9.3.0", - "@wangeditor/editor": "^5.1.21", + "@vueuse/core": "^9.10.0", + "@wangeditor/editor": "^5.1.23", "@wangeditor/editor-for-vue": "^5.1.12", - "axios": "^0.27.2", - "echarts": "^5.4.0", - "md-editor-v3": "^2.3.0", - "pinia": "^2.0.20", + "axios": "^1.2.2", + "echarts": "^5.4.1", + "md-editor-v3": "^2.7.2", + "pinia": "^2.0.28", "pinia-plugin-persist": "^1.0.0", - "vue": "^3.2.37", + "vue": "^3.2.45", "vue-qr": "^4.0.9", - "vue-router": "^4.1.4" + "vue-router": "^4.1.6" }, "devDependencies": { - "@commitlint/cli": "^17.0.3", - "@commitlint/config-conventional": "^17.0.3", - "@iconify-json/icon-park-outline": "^1.1.5", - "@iconify/vue": "^3.2.1", - "@types/mockjs": "^1.0.6", - "@types/node": "^18.7.13", - "@typescript-eslint/eslint-plugin": "^5.35.1", - "@typescript-eslint/parser": "^5.35.1", - "@unocss/preset-attributify": "^0.45.18", - "@unocss/preset-uno": "^0.45.18", - "@unocss/vite": "^0.45.18", - "@vitejs/plugin-vue": "^3.0.3", - "@vitejs/plugin-vue-jsx": "^2.0.0", - "@vue/eslint-config-typescript": "^11.0.0", - "commitizen": "^4.2.5", + "@commitlint/cli": "^17.4.1", + "@commitlint/config-conventional": "^17.4.0", + "@iconify-json/icon-park-outline": "^1.1.9", + "@iconify/vue": "^4.0.2", + "@types/mockjs": "^1.0.7", + "@types/node": "^18.11.18", + "@typescript-eslint/eslint-plugin": "^5.48.1", + "@typescript-eslint/parser": "^5.48.1", + "@unocss/preset-attributify": "^0.48.3", + "@unocss/preset-uno": "^0.48.3", + "@unocss/vite": "^0.48.3", + "@vitejs/plugin-vue": "^4.0.0", + "@vitejs/plugin-vue-jsx": "^3.0.0", + "@vue/eslint-config-typescript": "^11.0.2", + "commitizen": "^4.2.6", "cross-env": "^7.0.3", "cz-conventional-changelog": "^3.3.0", - "cz-customizable": "^6.9.1", - "eslint": "^8.22.0", + "cz-customizable": "^7.0.0", + "eslint": "^8.31.0", "eslint-import-resolver-alias": "^1.1.2", "eslint-plugin-import": "^2.26.0", - "eslint-plugin-vue": "^9.4.0", - "husky": "^8.0.1", - "lint-staged": "^13.0.3", + "eslint-plugin-vue": "^9.8.0", + "husky": "^8.0.3", + "lint-staged": "^13.1.0", "mockjs": "^1.1.0", - "naive-ui": "^2.32.2", - "rollup-plugin-visualizer": "^5.8.0", - "typescript": "^4.7.4", - "unplugin-icons": "^0.14.8", - "unplugin-vue-components": "^0.22.4", - "vite": "^3.0.9", + "naive-ui": "^2.34.3", + "rollup-plugin-visualizer": "^5.9.0", + "typescript": "^4.9.4", + "unplugin-icons": "^0.15.1", + "unplugin-vue-components": "^0.22.12", + "vite": "^4.0.4", "vite-plugin-compression": "^0.5.1", "vite-plugin-html": "^3.2.0", "vite-plugin-mock": "^2.9.6", "vite-plugin-svg-icons": "^2.0.1", - "vue-tsc": "^0.40.1" + "vue-tsc": "^1.0.24" } } diff --git a/public/resource/loading.css b/public/resource/loading.css deleted file mode 100644 index 4480b6e..0000000 --- a/public/resource/loading.css +++ /dev/null @@ -1,74 +0,0 @@ -body{ - margin: 0; -} -#loading-container{ - width: 100vw; - height: 100vh; - display: flex; - align-items: center; - justify-content: center; - flex-direction: column; - gap: 10vh; - position: fixed; - background-color: aliceblue; - z-index: 1; -} -.app-loading { - width: 88px; - height: 88px; - animation: app-loading-y0fdc1 2s infinite ease; - transform-style: preserve-3d; -} -.loading-title{ - font-size: 1.5em; -} - -.app-loading > div { - background-color: rgba(0, 77, 255, 0.2); - height: 100%; - position: absolute; - width: 100%; - border: 2px solid #004dff; -} - -.app-loading div:nth-of-type(1) { - transform: translateZ(-44px) rotateY(180deg); -} - -.app-loading div:nth-of-type(2) { - transform: rotateY(-270deg) translateX(50%); - transform-origin: top right; -} - -.app-loading div:nth-of-type(3) { - transform: rotateY(270deg) translateX(-50%); - transform-origin: center left; -} - -.app-loading div:nth-of-type(4) { - transform: rotateX(90deg) translateY(-50%); - transform-origin: top center; -} - -.app-loading div:nth-of-type(5) { - transform: rotateX(-90deg) translateY(50%); - transform-origin: bottom center; -} - -.app-loading div:nth-of-type(6) { - transform: translateZ(44px); -} - -@keyframes app-loading-y0fdc1 { - 0% { - transform: rotate(45deg) rotateX(-25deg) rotateY(25deg); - } - - 50% { - transform: rotate(45deg) rotateX(-385deg) rotateY(25deg); - } - - 100% { - transform: rotate(45deg) rotateX(-385deg) rotateY(385deg); - } -} \ No newline at end of file diff --git a/src/App.vue b/src/App.vue index 7291ee1..c8e0083 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,15 +1,3 @@ - - + + diff --git a/src/components/common/appLoading.vue b/src/components/common/appLoading.vue new file mode 100644 index 0000000..08a3906 --- /dev/null +++ b/src/components/common/appLoading.vue @@ -0,0 +1,241 @@ + + + + + diff --git a/src/hooks/index.ts b/src/hooks/index.ts index 6f40bc7..4ecd953 100644 --- a/src/hooks/index.ts +++ b/src/hooks/index.ts @@ -3,3 +3,4 @@ export * from './useBoolean'; export * from './useLoading'; export * from './useEcharts'; export * from './useClipBoard'; +export * from './useSystem'; diff --git a/src/hooks/useSystem.ts b/src/hooks/useSystem.ts new file mode 100644 index 0000000..af23208 --- /dev/null +++ b/src/hooks/useSystem.ts @@ -0,0 +1,23 @@ +interface AppInfo { + /** 项目名称 */ + name: string; + /** 项目标题 */ + title: string; + /** 项目描述 */ + desc: string; +} + +/** 项目信息 */ +export function useAppInfo(): AppInfo { + const { + VITE_APP_NAME: name, + VITE_APP_TITLE: title, + VITE_APP_DESC: desc, + } = import.meta.env; + + return { + name, + title, + desc, + }; +} diff --git a/src/layouts/BasicLayout/index.vue b/src/layouts/BasicLayout/index.vue index b4d1274..33aa157 100644 --- a/src/layouts/BasicLayout/index.vue +++ b/src/layouts/BasicLayout/index.vue @@ -1,5 +1,8 @@