Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e161102495 | ||
|
|
5300781d05 | ||
|
|
2e7e2ee3ce | ||
|
|
aa165ff70b | ||
|
|
b77ba43572 | ||
|
|
7cc69ac52d | ||
|
|
1b93ce989c | ||
|
|
9e5fe5edbc | ||
|
|
248fbf26ed | ||
|
|
d943550e10 | ||
|
|
3a7832b7fe | ||
|
|
ad3f964c32 |
@@ -37,7 +37,7 @@ module.exports = {
|
|||||||
"eslint:recommended",
|
"eslint:recommended",
|
||||||
"@vue/typescript/recommended",
|
"@vue/typescript/recommended",
|
||||||
"@vue/prettier",
|
"@vue/prettier",
|
||||||
"@vue/prettier/@typescript-eslint"
|
"@vue/eslint-config-typescript"
|
||||||
],
|
],
|
||||||
parser: "vue-eslint-parser",
|
parser: "vue-eslint-parser",
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
@@ -50,6 +50,10 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
|
"vue/no-v-html": "off",
|
||||||
|
"vue/require-default-prop": "off",
|
||||||
|
"vue/require-explicit-emits": "off",
|
||||||
|
"vue/multi-word-component-names": "off",
|
||||||
"@typescript-eslint/no-explicit-any": "off", // any
|
"@typescript-eslint/no-explicit-any": "off", // any
|
||||||
"no-debugger": "off",
|
"no-debugger": "off",
|
||||||
"@typescript-eslint/explicit-module-boundary-types": "off", // setup()
|
"@typescript-eslint/explicit-module-boundary-types": "off", // setup()
|
||||||
|
|||||||
1
.gitignore
vendored
@@ -4,6 +4,7 @@ dist
|
|||||||
dist-ssr
|
dist-ssr
|
||||||
*.local
|
*.local
|
||||||
.eslintcache
|
.eslintcache
|
||||||
|
.stylelintcache
|
||||||
|
|
||||||
yarn.lock
|
yarn.lock
|
||||||
npm-debug.log*
|
npm-debug.log*
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
bracketSpacing: true,
|
bracketSpacing: true,
|
||||||
jsxBracketSameLine: true,
|
|
||||||
singleQuote: false,
|
singleQuote: false,
|
||||||
arrowParens: "avoid",
|
arrowParens: "avoid",
|
||||||
trailingComma: "none"
|
trailingComma: "none"
|
||||||
|
|||||||
2
LICENSE
@@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2021 啝裳
|
Copyright (c) 2022 啝裳
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
@@ -6,11 +6,16 @@
|
|||||||
|
|
||||||
## introduce
|
## introduce
|
||||||
|
|
||||||
The lite version is based on the shelf extracted from https://github.com/xiaoxian521/vue-pure-admin, which contains the main functions and is more suitable for actual project development
|
The lite version is based on the shelf extracted from [vue-pure-admin](https://github.com/xiaoxian521/vue-pure-admin), which contains the main functions and is more suitable for actual project development, the packaged size is only more than `2MB`
|
||||||
|
|
||||||
|
## Supporting Video
|
||||||
|
|
||||||
|
- [Click Watch Tutorial](https://www.bilibili.com/video/BV1534y1S7HV)
|
||||||
|
- [Click Watch UI Design](https://www.bilibili.com/video/BV17g411T7rq)
|
||||||
|
|
||||||
## Docs
|
## Docs
|
||||||
|
|
||||||
<https://pure-admin-doc.vercel.app/>
|
- [Click Watch Docs](https://pure-admin-doc.vercel.app)
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
@@ -35,3 +40,7 @@ bilibili: https://www.bilibili.com/video/BV1534y1S7HV/
|
|||||||
## ⚠️ Note
|
## ⚠️ Note
|
||||||
|
|
||||||
The lite version does not accept any issues and prs. If you have any questions, please go to the full version https://github.com/xiaoxian521/vue-pure-admin/issues/new/choose to mention it, thank you! ! !
|
The lite version does not accept any issues and prs. If you have any questions, please go to the full version https://github.com/xiaoxian521/vue-pure-admin/issues/new/choose to mention it, thank you! ! !
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
In principle, no fees and copyrights are charged, and you can use it with confidence, but if you need secondary open source, please contact the author for permission!
|
||||||
|
|||||||
18
README.md
@@ -6,16 +6,16 @@
|
|||||||
|
|
||||||
## 介绍
|
## 介绍
|
||||||
|
|
||||||
精简版是基于 https://github.com/xiaoxian521/vue-pure-admin 提炼出的架子,包含主体功能,更适合实际项目开发
|
精简版是基于[vue-pure-admin](https://github.com/xiaoxian521/vue-pure-admin)提炼出的架子,包含主体功能,更适合实际项目开发,打包后的大小仅 `2MB`多
|
||||||
|
|
||||||
## 配套视频
|
## 配套视频
|
||||||
|
|
||||||
教程:<https://www.bilibili.com/video/BV1534y1S7HV/>
|
- [点我查看教程](https://www.bilibili.com/video/BV1534y1S7HV)
|
||||||
UI 设计:<https://www.bilibili.com/video/BV17g411T7rq/>
|
- [点我查看 UI 设计](https://www.bilibili.com/video/BV17g411T7rq)
|
||||||
|
|
||||||
## 配套文档
|
## 配套文档
|
||||||
|
|
||||||
<https://pure-admin-doc.vercel.app/>
|
- [点我查看文档](https://pure-admin-doc.vercel.app)
|
||||||
|
|
||||||
## 维护者
|
## 维护者
|
||||||
|
|
||||||
@@ -27,11 +27,11 @@ UI 设计:<https://www.bilibili.com/video/BV17g411T7rq/>
|
|||||||
|
|
||||||
<img src="http://yiming_chang.gitee.io/manages/pay.jpg" width="150px" height="150px" />
|
<img src="http://yiming_chang.gitee.io/manages/pay.jpg" width="150px" height="150px" />
|
||||||
|
|
||||||
## 付费咨询、需求定制
|
## QQ 交流群
|
||||||
|
|
||||||
作者精力有限,需要提供技术服务的可扫下面的二维码加微信,添加请备注来意
|
群里严禁`黄`、`赌`、`毒`、`vpn`等违法行为!
|
||||||
|
|
||||||
<img src="http://yiming_chang.gitee.io/manages/wechat.jpg" width="150px" height="150px" />
|
<img src="http://yiming_chang.gitee.io/manages/qq.jpg" width="150px" height="225px" />
|
||||||
|
|
||||||
## 用法
|
## 用法
|
||||||
|
|
||||||
@@ -52,3 +52,7 @@ pnpm remove 包名
|
|||||||
## ⚠️ 注意
|
## ⚠️ 注意
|
||||||
|
|
||||||
精简版不接受任何 issues 和 pr,如果有问题请到完整版 https://github.com/xiaoxian521/vue-pure-admin/issues/new/choose 去提,谢谢!!!
|
精简版不接受任何 issues 和 pr,如果有问题请到完整版 https://github.com/xiaoxian521/vue-pure-admin/issues/new/choose 去提,谢谢!!!
|
||||||
|
|
||||||
|
## 许可证
|
||||||
|
|
||||||
|
原则上不收取任何费用及版权,可以放心使用,不过如需二次开源(比如用此平台二次开发并开源)请联系作者获取许可!
|
||||||
|
|||||||
108
build/plugins.ts
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
import vue from "@vitejs/plugin-vue";
|
||||||
|
import svgLoader from "vite-svg-loader";
|
||||||
|
import legacy from "@vitejs/plugin-legacy";
|
||||||
|
import vueJsx from "@vitejs/plugin-vue-jsx";
|
||||||
|
import WindiCSS from "vite-plugin-windicss";
|
||||||
|
import { viteMockServe } from "vite-plugin-mock";
|
||||||
|
import liveReload from "vite-plugin-live-reload";
|
||||||
|
import ElementPlus from "unplugin-element-plus/vite";
|
||||||
|
import { visualizer } from "rollup-plugin-visualizer";
|
||||||
|
import removeConsole from "vite-plugin-remove-console";
|
||||||
|
import themePreprocessorPlugin from "@zougt/vite-plugin-theme-preprocessor";
|
||||||
|
|
||||||
|
export function getPluginsList(command, VITE_LEGACY) {
|
||||||
|
const prodMock = true;
|
||||||
|
const lifecycle = process.env.npm_lifecycle_event;
|
||||||
|
return [
|
||||||
|
vue(),
|
||||||
|
// jsx、tsx语法支持
|
||||||
|
vueJsx(),
|
||||||
|
WindiCSS(),
|
||||||
|
// 线上环境删除console
|
||||||
|
removeConsole(),
|
||||||
|
// 修改layout文件夹下的文件时自动重载浏览器 解决 https://github.com/xiaoxian521/vue-pure-admin/issues/170
|
||||||
|
liveReload(["src/layout/**/*", "src/router/**/*"]),
|
||||||
|
// 自定义主题
|
||||||
|
themePreprocessorPlugin({
|
||||||
|
scss: {
|
||||||
|
multipleScopeVars: [
|
||||||
|
{
|
||||||
|
scopeName: "layout-theme-default",
|
||||||
|
path: "src/layout/theme/default-vars.scss"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
scopeName: "layout-theme-light",
|
||||||
|
path: "src/layout/theme/light-vars.scss"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
scopeName: "layout-theme-dusk",
|
||||||
|
path: "src/layout/theme/dusk-vars.scss"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
scopeName: "layout-theme-volcano",
|
||||||
|
path: "src/layout/theme/volcano-vars.scss"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
scopeName: "layout-theme-yellow",
|
||||||
|
path: "src/layout/theme/yellow-vars.scss"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
scopeName: "layout-theme-mingQing",
|
||||||
|
path: "src/layout/theme/mingQing-vars.scss"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
scopeName: "layout-theme-auroraGreen",
|
||||||
|
path: "src/layout/theme/auroraGreen-vars.scss"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
scopeName: "layout-theme-pink",
|
||||||
|
path: "src/layout/theme/pink-vars.scss"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
scopeName: "layout-theme-saucePurple",
|
||||||
|
path: "src/layout/theme/saucePurple-vars.scss"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
// 默认取 multipleScopeVars[0].scopeName
|
||||||
|
defaultScopeName: "",
|
||||||
|
// 在生产模式是否抽取独立的主题css文件,extract为true以下属性有效
|
||||||
|
extract: true,
|
||||||
|
// 独立主题css文件的输出路径,默认取 viteConfig.build.assetsDir 相对于 (viteConfig.build.outDir)
|
||||||
|
outputDir: "",
|
||||||
|
// 会选取defaultScopeName对应的主题css文件在html添加link
|
||||||
|
themeLinkTagId: "head",
|
||||||
|
// "head"||"head-prepend" || "body" ||"body-prepend"
|
||||||
|
themeLinkTagInjectTo: "head",
|
||||||
|
// 是否对抽取的css文件内对应scopeName的权重类名移除
|
||||||
|
removeCssScopeName: false,
|
||||||
|
// 可以自定义css文件名称的函数
|
||||||
|
customThemeCssFileName: scopeName => scopeName
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
// svg组件化支持
|
||||||
|
svgLoader(),
|
||||||
|
ElementPlus({}),
|
||||||
|
// mock支持
|
||||||
|
viteMockServe({
|
||||||
|
mockPath: "mock",
|
||||||
|
localEnabled: command === "serve",
|
||||||
|
prodEnabled: command !== "serve" && prodMock,
|
||||||
|
injectCode: `
|
||||||
|
import { setupProdMockServer } from './mockProdServer';
|
||||||
|
setupProdMockServer();
|
||||||
|
`,
|
||||||
|
logger: true
|
||||||
|
}),
|
||||||
|
// 是否为打包后的文件提供传统浏览器兼容性支持
|
||||||
|
VITE_LEGACY
|
||||||
|
? legacy({
|
||||||
|
targets: ["ie >= 11"],
|
||||||
|
additionalLegacyPolyfills: ["regenerator-runtime/runtime"]
|
||||||
|
})
|
||||||
|
: null,
|
||||||
|
// 打包分析
|
||||||
|
lifecycle === "report"
|
||||||
|
? visualizer({ open: true, brotliSize: true, filename: "report.html" })
|
||||||
|
: null
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -3,7 +3,6 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<link rel="icon" href="/favicon.ico" />
|
<link rel="icon" href="/favicon.ico" />
|
||||||
<link rel="stylesheet" href="/iconfont.css" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>pure-admin-thin</title>
|
<title>pure-admin-thin</title>
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ const permissionRouter = {
|
|||||||
title: "menus.permission",
|
title: "menus.permission",
|
||||||
icon: "lollipop",
|
icon: "lollipop",
|
||||||
i18n: true,
|
i18n: true,
|
||||||
showLink: true,
|
|
||||||
rank: 3
|
rank: 3
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
@@ -18,8 +17,7 @@ const permissionRouter = {
|
|||||||
name: "permissionPage",
|
name: "permissionPage",
|
||||||
meta: {
|
meta: {
|
||||||
title: "menus.permissionPage",
|
title: "menus.permissionPage",
|
||||||
i18n: true,
|
i18n: true
|
||||||
showLink: true
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -28,7 +26,6 @@ const permissionRouter = {
|
|||||||
meta: {
|
meta: {
|
||||||
title: "menus.permissionButton",
|
title: "menus.permissionButton",
|
||||||
i18n: true,
|
i18n: true,
|
||||||
showLink: true,
|
|
||||||
authority: []
|
authority: []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
77
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "pure-admin-thin",
|
"name": "pure-admin-thin",
|
||||||
"version": "2.8.5",
|
"version": "3.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 16",
|
"node": ">= 16",
|
||||||
@@ -10,6 +10,7 @@
|
|||||||
"dev": "cross-env --max_old_space_size=4096 vite",
|
"dev": "cross-env --max_old_space_size=4096 vite",
|
||||||
"serve": "pnpm dev",
|
"serve": "pnpm dev",
|
||||||
"build": "rimraf dist && cross-env vite build",
|
"build": "rimraf dist && cross-env vite build",
|
||||||
|
"report": "rimraf dist && cross-env vite build",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"preview:build": "pnpm build && vite preview",
|
"preview:build": "pnpm build && vite preview",
|
||||||
"clean:cache": "rm -rf node_modules && rm -rf .eslintcache && pnpm install",
|
"clean:cache": "rm -rf node_modules && rm -rf .eslintcache && pnpm install",
|
||||||
@@ -29,33 +30,27 @@
|
|||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ctrl/tinycolor": "^3.4.0",
|
"@ctrl/tinycolor": "^3.4.0",
|
||||||
"@fortawesome/fontawesome-svg-core": "^1.2.36",
|
"@vueuse/core": "^7.6.2",
|
||||||
"@fortawesome/free-solid-svg-icons": "^5.15.4",
|
|
||||||
"@fortawesome/vue-fontawesome": "^3.0.0-5",
|
|
||||||
"@vueuse/core": "^7.5.3",
|
|
||||||
"@vueuse/motion": "^2.0.0-beta.9",
|
"@vueuse/motion": "^2.0.0-beta.9",
|
||||||
"@vueuse/shared": "^7.5.3",
|
"@vueuse/shared": "^7.6.2",
|
||||||
"animate.css": "^4.1.1",
|
"animate.css": "^4.1.1",
|
||||||
"axios": "^0.25.0",
|
"axios": "^0.25.0",
|
||||||
"css-color-function": "^1.3.3",
|
"css-color-function": "^1.3.3",
|
||||||
"dayjs": "^1.10.7",
|
"element-plus": "^2.0.2",
|
||||||
"element-plus": "1.3.0-beta.1",
|
|
||||||
"element-resize-detector": "^1.2.3",
|
"element-resize-detector": "^1.2.3",
|
||||||
"font-awesome": "^4.7.0",
|
|
||||||
"js-cookie": "^3.0.1",
|
"js-cookie": "^3.0.1",
|
||||||
"lodash-es": "^4.17.21",
|
"lodash-es": "^4.17.21",
|
||||||
"mitt": "^3.0.0",
|
"mitt": "^3.0.0",
|
||||||
"mockjs": "^1.1.0",
|
"mockjs": "^1.1.0",
|
||||||
"nprogress": "^0.2.0",
|
"nprogress": "^0.2.0",
|
||||||
"path": "^0.12.7",
|
"path": "^0.12.7",
|
||||||
"pinia": "^2.0.9",
|
"pinia": "^2.0.11",
|
||||||
"qs": "^6.10.2",
|
"qs": "^6.10.2",
|
||||||
"remixicon": "^2.5.0",
|
|
||||||
"resize-observer-polyfill": "^1.5.1",
|
"resize-observer-polyfill": "^1.5.1",
|
||||||
"responsive-storage": "^1.0.11",
|
"responsive-storage": "^1.0.11",
|
||||||
"rgb-hex": "^4.0.0",
|
"rgb-hex": "^4.0.0",
|
||||||
"vue": "^3.2.27",
|
"vue": "^3.2.31",
|
||||||
"vue-i18n": "^9.2.0-beta.26",
|
"vue-i18n": "^9.2.0-beta.30",
|
||||||
"vue-router": "^4.0.12",
|
"vue-router": "^4.0.12",
|
||||||
"vue-types": "^4.1.1"
|
"vue-types": "^4.1.1"
|
||||||
},
|
},
|
||||||
@@ -63,49 +58,57 @@
|
|||||||
"@commitlint/cli": "13.1.0",
|
"@commitlint/cli": "13.1.0",
|
||||||
"@commitlint/config-conventional": "13.1.0",
|
"@commitlint/config-conventional": "13.1.0",
|
||||||
"@iconify-icons/ep": "^1.1.3",
|
"@iconify-icons/ep": "^1.1.3",
|
||||||
"@iconify/vue": "^3.1.2",
|
"@iconify-icons/fa": "^1.1.1",
|
||||||
|
"@iconify-icons/fa-solid": "^1.1.2",
|
||||||
|
"@iconify-icons/ri": "^1.1.1",
|
||||||
|
"@iconify/vue": "^3.1.3",
|
||||||
"@types/element-resize-detector": "1.1.3",
|
"@types/element-resize-detector": "1.1.3",
|
||||||
"@types/js-cookie": "^3.0.1",
|
"@types/js-cookie": "^3.0.1",
|
||||||
"@types/mockjs": "1.0.3",
|
"@types/mockjs": "1.0.3",
|
||||||
"@types/node": "14.14.14",
|
"@types/node": "14.14.14",
|
||||||
"@types/nprogress": "0.2.0",
|
"@types/nprogress": "0.2.0",
|
||||||
"@types/qs": "^6.9.7",
|
"@types/qs": "^6.9.7",
|
||||||
"@typescript-eslint/eslint-plugin": "4.31.0",
|
"@typescript-eslint/eslint-plugin": "^5.10.2",
|
||||||
"@typescript-eslint/parser": "4.31.0",
|
"@typescript-eslint/parser": "^5.10.2",
|
||||||
"@vitejs/plugin-legacy": "^1.6.4",
|
"@vitejs/plugin-legacy": "^1.7.1",
|
||||||
"@vitejs/plugin-vue": "^2.0.1",
|
"@vitejs/plugin-vue": "^2.2.0",
|
||||||
"@vitejs/plugin-vue-jsx": "^1.3.3",
|
"@vitejs/plugin-vue-jsx": "^1.3.7",
|
||||||
"@vue/eslint-config-prettier": "6.0.0",
|
"@vue/eslint-config-prettier": "^7.0.0",
|
||||||
"@vue/eslint-config-typescript": "7.0.0",
|
"@vue/eslint-config-typescript": "^10.0.0",
|
||||||
"@zougt/vite-plugin-theme-preprocessor": "^1.4.4",
|
"@zougt/vite-plugin-theme-preprocessor": "^1.4.4",
|
||||||
"autoprefixer": "10.2.4",
|
"autoprefixer": "^10.4.2",
|
||||||
"cross-env": "7.0.3",
|
"cross-env": "7.0.3",
|
||||||
"eslint": "7.30.0",
|
"eslint": "^8.8.0",
|
||||||
"eslint-plugin-prettier": "3.4.0",
|
"eslint-plugin-prettier": "^4.0.0",
|
||||||
"eslint-plugin-vue": "7.17.0",
|
"eslint-plugin-vue": "^8.4.1",
|
||||||
"husky": "7.0.2",
|
"husky": "7.0.2",
|
||||||
"lint-staged": "11.1.2",
|
"lint-staged": "11.1.2",
|
||||||
"postcss": "8.2.6",
|
"postcss": "^8.4.6",
|
||||||
|
"postcss-html": "^1.3.0",
|
||||||
"postcss-import": "14.0.0",
|
"postcss-import": "14.0.0",
|
||||||
"prettier": "2.3.2",
|
"postcss-scss": "^4.0.3",
|
||||||
|
"prettier": "^2.5.1",
|
||||||
"pretty-quick": "3.1.1",
|
"pretty-quick": "3.1.1",
|
||||||
"rimraf": "3.0.2",
|
"rimraf": "3.0.2",
|
||||||
"sass": "^1.45.0",
|
"rollup-plugin-visualizer": "^5.5.4",
|
||||||
"sass-loader": "^12.3.0",
|
"sass": "^1.49.0",
|
||||||
"stylelint": "13.13.1",
|
"sass-loader": "^12.4.0",
|
||||||
"stylelint-config-prettier": "8.0.2",
|
"stylelint": "^14.3.0",
|
||||||
"stylelint-config-standard": "22.0.0",
|
"stylelint-config-html": "^1.0.0",
|
||||||
"stylelint-order": "4.1.0",
|
"stylelint-config-prettier": "^9.0.3",
|
||||||
|
"stylelint-config-recommended": "^6.0.0",
|
||||||
|
"stylelint-config-standard": "^24.0.0",
|
||||||
|
"stylelint-order": "^5.0.0",
|
||||||
"typescript": "^4.5.5",
|
"typescript": "^4.5.5",
|
||||||
"unplugin-element-plus": "^0.2.0",
|
"unplugin-element-plus": "^0.2.0",
|
||||||
"vite": "^2.7.13",
|
"vite": "2.7.13",
|
||||||
"vite-plugin-live-reload": "^2.1.0",
|
"vite-plugin-live-reload": "^2.1.0",
|
||||||
"vite-plugin-mock": "^2.9.6",
|
"vite-plugin-mock": "^2.9.6",
|
||||||
"vite-plugin-remove-console": "^0.0.6",
|
"vite-plugin-remove-console": "^0.0.6",
|
||||||
"vite-plugin-style-import": "^1.4.1",
|
"vite-plugin-style-import": "1.4.1",
|
||||||
"vite-plugin-windicss": "^1.6.3",
|
"vite-plugin-windicss": "^1.7.0",
|
||||||
"vite-svg-loader": "2.2.0",
|
"vite-svg-loader": "2.2.0",
|
||||||
"vue-eslint-parser": "7.10.0",
|
"vue-eslint-parser": "^8.2.0",
|
||||||
"windicss": "^3.4.3"
|
"windicss": "^3.4.3"
|
||||||
},
|
},
|
||||||
"repository": "git@github.com:xiaoxian521/vue-pure-admin.git",
|
"repository": "git@github.com:xiaoxian521/vue-pure-admin.git",
|
||||||
|
|||||||
2360
pnpm-lock.yaml
generated
@@ -1,18 +0,0 @@
|
|||||||
@font-face {
|
|
||||||
font-family: "iconfont"; /* project id 1098500 */
|
|
||||||
src: url("//at.alicdn.com/t/font_1098500_3d6un9zwltz.eot");
|
|
||||||
src: url("//at.alicdn.com/t/font_1098500_3d6un9zwltz.eot?#iefix")
|
|
||||||
format("embedded-opentype"),
|
|
||||||
url("//at.alicdn.com/t/font_1098500_3d6un9zwltz.woff2") format("woff2"),
|
|
||||||
url("//at.alicdn.com/t/font_1098500_3d6un9zwltz.woff") format("woff"),
|
|
||||||
url("//at.alicdn.com/t/font_1098500_3d6un9zwltz.ttf") format("truetype"),
|
|
||||||
url("//at.alicdn.com/t/font_1098500_3d6un9zwltz.svg#iconfont") format("svg");
|
|
||||||
}
|
|
||||||
|
|
||||||
.iconfont {
|
|
||||||
font-family: "iconfont" !important;
|
|
||||||
font-size: 16px;
|
|
||||||
font-style: normal;
|
|
||||||
-webkit-font-smoothing: antialiased;
|
|
||||||
-moz-osx-font-smoothing: grayscale;
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"Version": "2.8.5",
|
"Version": "3.0",
|
||||||
"Title": "PureAdmin",
|
"Title": "PureAdmin",
|
||||||
"FixedHeader": true,
|
"FixedHeader": true,
|
||||||
"HiddenSideBar": false,
|
"HiddenSideBar": false,
|
||||||
@@ -15,13 +15,5 @@
|
|||||||
"SidebarStatus": true,
|
"SidebarStatus": true,
|
||||||
"EpThemeColor": "#409EFF",
|
"EpThemeColor": "#409EFF",
|
||||||
"ShowLogo": true,
|
"ShowLogo": true,
|
||||||
"ShowModel": "smart",
|
"ShowModel": "smart"
|
||||||
"MapConfigure": {
|
|
||||||
"amapKey": "97b3248d1553172e81f168cf94ea667e",
|
|
||||||
"options": {
|
|
||||||
"resizeEnable": true,
|
|
||||||
"center": [113.6401, 34.72468],
|
|
||||||
"zoom": 12
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 11 KiB |
@@ -1,103 +1,13 @@
|
|||||||
import { App, defineComponent } from "vue";
|
|
||||||
import icon from "./src/Icon.vue";
|
|
||||||
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
|
|
||||||
import iconifyIconOffline from "./src/iconifyIconOffline";
|
import iconifyIconOffline from "./src/iconifyIconOffline";
|
||||||
import iconifyIconOnline from "./src/iconifyIconOnline";
|
import iconifyIconOnline from "./src/iconifyIconOnline";
|
||||||
|
import fontIcon from "./src/iconfont";
|
||||||
/**
|
|
||||||
* find icon component
|
|
||||||
* @param icon icon图标
|
|
||||||
* @returns component
|
|
||||||
*/
|
|
||||||
export function findIconReg(icon: string) {
|
|
||||||
// fontawesome4
|
|
||||||
const fa4Reg = /^fa-/;
|
|
||||||
// fontawesome5+
|
|
||||||
const fa5Reg = /^FA-/;
|
|
||||||
// iconfont
|
|
||||||
const iFReg = /^IF-/;
|
|
||||||
// remixicon
|
|
||||||
const riReg = /^RI-/;
|
|
||||||
// typeof icon === "function" 属于SVG
|
|
||||||
if (fa5Reg.test(icon)) {
|
|
||||||
const text = icon.split(fa5Reg)[1];
|
|
||||||
return findIcon(
|
|
||||||
text.slice(0, text.indexOf(" ") == -1 ? text.length : text.indexOf(" ")),
|
|
||||||
"FA",
|
|
||||||
text.slice(text.indexOf(" ") + 1, text.length)
|
|
||||||
);
|
|
||||||
} else if (fa4Reg.test(icon)) {
|
|
||||||
return findIcon(icon.split(fa4Reg)[1], "fa");
|
|
||||||
} else if (iFReg.test(icon)) {
|
|
||||||
return findIcon(icon.split(iFReg)[1], "IF");
|
|
||||||
} else if (typeof icon === "function") {
|
|
||||||
return findIcon(icon, "SVG");
|
|
||||||
} else if (riReg.test(icon)) {
|
|
||||||
return findIcon(icon.split(riReg)[1], "RI");
|
|
||||||
} else {
|
|
||||||
return findIcon(icon, "EL");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 支持fontawesome、iconfont、remixicon、element-plus/icons、自定义svg
|
|
||||||
export function findIcon(icon: String, type = "EL", property?: string) {
|
|
||||||
if (type === "FA") {
|
|
||||||
return defineComponent({
|
|
||||||
name: "FaIcon",
|
|
||||||
setup() {
|
|
||||||
return { icon, property };
|
|
||||||
},
|
|
||||||
components: { FontAwesomeIcon },
|
|
||||||
template: `<font-awesome-icon :icon="icon" v-bind:[property]="true" />`
|
|
||||||
});
|
|
||||||
} else if (type === "fa") {
|
|
||||||
return defineComponent({
|
|
||||||
name: "faIcon",
|
|
||||||
data() {
|
|
||||||
return { icon: `fa ${icon}` };
|
|
||||||
},
|
|
||||||
template: `<i :class="icon" />`
|
|
||||||
});
|
|
||||||
} else if (type === "IF") {
|
|
||||||
return defineComponent({
|
|
||||||
name: "IfIcon",
|
|
||||||
data() {
|
|
||||||
return { icon: `iconfont ${icon}` };
|
|
||||||
},
|
|
||||||
template: `<i :class="icon" />`
|
|
||||||
});
|
|
||||||
} else if (type === "RI") {
|
|
||||||
return defineComponent({
|
|
||||||
name: "RiIcon",
|
|
||||||
data() {
|
|
||||||
return { icon: `ri-${icon}` };
|
|
||||||
},
|
|
||||||
template: `<i :class="icon" />`
|
|
||||||
});
|
|
||||||
} else if (type === "EL") {
|
|
||||||
return defineComponent({
|
|
||||||
name: "ElIcon",
|
|
||||||
data() {
|
|
||||||
return { icon };
|
|
||||||
},
|
|
||||||
template: `<IconifyIconOffline :icon="icon" />`
|
|
||||||
});
|
|
||||||
} else if (type === "SVG") {
|
|
||||||
return icon;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const Icon = Object.assign(icon, {
|
|
||||||
install(app: App) {
|
|
||||||
app.component(icon.name, icon);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
export const IconifyIconOffline = iconifyIconOffline;
|
export const IconifyIconOffline = iconifyIconOffline;
|
||||||
export const IconifyIconOnline = iconifyIconOnline;
|
export const IconifyIconOnline = iconifyIconOnline;
|
||||||
|
export const FontIcon = fontIcon;
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
Icon,
|
|
||||||
IconifyIconOffline,
|
IconifyIconOffline,
|
||||||
IconifyIconOnline
|
IconifyIconOnline,
|
||||||
|
FontIcon
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,97 +0,0 @@
|
|||||||
<script lang="ts">
|
|
||||||
export default {
|
|
||||||
name: "Icon"
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
import { ref, computed } from "vue";
|
|
||||||
|
|
||||||
const props = defineProps({
|
|
||||||
content: {
|
|
||||||
type: String,
|
|
||||||
default: ""
|
|
||||||
},
|
|
||||||
size: {
|
|
||||||
type: Number,
|
|
||||||
default: 18
|
|
||||||
},
|
|
||||||
width: {
|
|
||||||
type: Number,
|
|
||||||
default: 20
|
|
||||||
},
|
|
||||||
height: {
|
|
||||||
type: Number,
|
|
||||||
default: 20
|
|
||||||
},
|
|
||||||
color: {
|
|
||||||
type: String,
|
|
||||||
default: ""
|
|
||||||
},
|
|
||||||
svg: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
|
||||||
(e: "click"): void;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
let text = ref("");
|
|
||||||
|
|
||||||
let className = computed(() => {
|
|
||||||
if (props.content.indexOf("fa-") > -1) {
|
|
||||||
return props.content.indexOf("fa ") === 0
|
|
||||||
? props.content
|
|
||||||
: ["fa", props.content];
|
|
||||||
} else if (props.content.indexOf("el-icon-") > -1) {
|
|
||||||
return props.content;
|
|
||||||
} else if (props.content.indexOf("#") > -1) {
|
|
||||||
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
|
||||||
text.value = props.content;
|
|
||||||
return "iconfont";
|
|
||||||
} else {
|
|
||||||
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
|
||||||
text.value = props.content;
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
let iconStyle = computed(() => {
|
|
||||||
return (
|
|
||||||
"font-size: " +
|
|
||||||
props.size +
|
|
||||||
"px; color: " +
|
|
||||||
props.color +
|
|
||||||
"; width: " +
|
|
||||||
props.width +
|
|
||||||
"px; height: " +
|
|
||||||
props.height +
|
|
||||||
"px; font-style: normal;"
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
const clickHandle = () => {
|
|
||||||
emit("click");
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<i
|
|
||||||
v-if="!props.svg"
|
|
||||||
:class="className"
|
|
||||||
:style="iconStyle"
|
|
||||||
v-html="text"
|
|
||||||
@click="clickHandle"
|
|
||||||
></i>
|
|
||||||
<svg
|
|
||||||
class="icon-svg"
|
|
||||||
v-if="props.svg"
|
|
||||||
aria-hidden="true"
|
|
||||||
:style="iconStyle"
|
|
||||||
@click="clickHandle"
|
|
||||||
>
|
|
||||||
<use :xlink:href="`#${props.content}`" />
|
|
||||||
</svg>
|
|
||||||
</template>
|
|
||||||
39
src/components/ReIcon/src/hooks.ts
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
import { h, defineComponent, Component } from "vue";
|
||||||
|
import { IconifyIconOffline, FontIcon } from "../index";
|
||||||
|
|
||||||
|
// 支持fontawesome4、5+、iconfont、remixicon、element-plus的icons、自定义svg
|
||||||
|
export function useRenderIcon(icon: string): Component {
|
||||||
|
// iconfont
|
||||||
|
const ifReg = /^IF-/;
|
||||||
|
// typeof icon === "function" 属于SVG
|
||||||
|
if (ifReg.test(icon)) {
|
||||||
|
// iconfont
|
||||||
|
const name = icon.split(ifReg)[1];
|
||||||
|
const iconName = name.slice(
|
||||||
|
0,
|
||||||
|
name.indexOf(" ") == -1 ? name.length : name.indexOf(" ")
|
||||||
|
);
|
||||||
|
const iconType = name.slice(name.indexOf(" ") + 1, name.length);
|
||||||
|
return defineComponent({
|
||||||
|
name: "FontIcon",
|
||||||
|
render() {
|
||||||
|
return h(FontIcon, {
|
||||||
|
icon: iconName,
|
||||||
|
iconType
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if (typeof icon === "function") {
|
||||||
|
// svg
|
||||||
|
return icon;
|
||||||
|
} else {
|
||||||
|
return defineComponent({
|
||||||
|
name: "Icon",
|
||||||
|
render() {
|
||||||
|
return h(IconifyIconOffline, {
|
||||||
|
icon: icon
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
48
src/components/ReIcon/src/iconfont.ts
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
import { h, defineComponent } from "vue";
|
||||||
|
|
||||||
|
// 封装iconfont组件,默认`font-class`引用模式,支持`unicode`引用、`font-class`引用、`symbol`引用 (https://www.iconfont.cn/help/detail?spm=a313x.7781069.1998910419.20&helptype=code)
|
||||||
|
export default defineComponent({
|
||||||
|
name: "fontIcon",
|
||||||
|
props: {
|
||||||
|
icon: {
|
||||||
|
type: String,
|
||||||
|
default: ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
render() {
|
||||||
|
const attrs = this.$attrs;
|
||||||
|
if (Object.keys(attrs).includes("uni") || attrs?.iconType === "uni") {
|
||||||
|
return h(
|
||||||
|
"i",
|
||||||
|
{
|
||||||
|
class: "iconfont",
|
||||||
|
...attrs
|
||||||
|
},
|
||||||
|
this.icon
|
||||||
|
);
|
||||||
|
} else if (
|
||||||
|
Object.keys(attrs).includes("svg") ||
|
||||||
|
attrs?.iconType === "svg"
|
||||||
|
) {
|
||||||
|
return h(
|
||||||
|
"svg",
|
||||||
|
{
|
||||||
|
class: "icon-svg",
|
||||||
|
"aria-hidden": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
default: () => [
|
||||||
|
h("use", {
|
||||||
|
"xlink:href": `#${this.icon}`
|
||||||
|
})
|
||||||
|
]
|
||||||
|
}
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return h("i", {
|
||||||
|
class: `iconfont ${this.icon}`,
|
||||||
|
...attrs
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
import { h, defineComponent } from "vue";
|
import { h, defineComponent } from "vue";
|
||||||
import { Icon as IconifyIcon, addIcon } from "@iconify/vue/dist/offline";
|
import { Icon as IconifyIcon, addIcon } from "@iconify/vue/dist/offline";
|
||||||
|
|
||||||
|
// element-plus icon
|
||||||
import Check from "@iconify-icons/ep/check";
|
import Check from "@iconify-icons/ep/check";
|
||||||
import Menu from "@iconify-icons/ep/menu";
|
import Menu from "@iconify-icons/ep/menu";
|
||||||
import HomeFilled from "@iconify-icons/ep/home-filled";
|
import HomeFilled from "@iconify-icons/ep/home-filled";
|
||||||
@@ -45,8 +47,23 @@ addIcon("tickets", Tickets);
|
|||||||
addIcon("office-building", OfficeBuilding);
|
addIcon("office-building", OfficeBuilding);
|
||||||
addIcon("notebook", Notebook);
|
addIcon("notebook", Notebook);
|
||||||
|
|
||||||
// Iconify Icon在Vue里离线使用(用于内网环境)
|
// remixicon
|
||||||
// https://docs.iconify.design/icon-components/vue/offline.html
|
import arrowRightSLine from "@iconify-icons/ri/arrow-right-s-line";
|
||||||
|
import arrowLeftSLine from "@iconify-icons/ri/arrow-left-s-line";
|
||||||
|
import logoutCircleRLine from "@iconify-icons/ri/logout-circle-r-line";
|
||||||
|
addIcon("arrow-right-s-line", arrowRightSLine);
|
||||||
|
addIcon("arrow-left-s-line", arrowLeftSLine);
|
||||||
|
addIcon("logout-circle-r-line", logoutCircleRLine);
|
||||||
|
|
||||||
|
// Font Awesome 4
|
||||||
|
import faUser from "@iconify-icons/fa/user";
|
||||||
|
import faLock from "@iconify-icons/fa/lock";
|
||||||
|
import faSignOut from "@iconify-icons/fa/sign-out";
|
||||||
|
addIcon("fa-user", faUser);
|
||||||
|
addIcon("fa-lock", faLock);
|
||||||
|
addIcon("fa-sign-out", faSignOut);
|
||||||
|
|
||||||
|
// Iconify Icon在Vue里离线使用(用于内网环境)https://docs.iconify.design/icon-components/vue/offline.html
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "IconifyIcon",
|
name: "IconifyIcon",
|
||||||
components: { IconifyIcon },
|
components: { IconifyIcon },
|
||||||
@@ -57,10 +74,12 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
render() {
|
render() {
|
||||||
|
const attrs = this.$attrs;
|
||||||
return h(
|
return h(
|
||||||
IconifyIcon,
|
IconifyIcon,
|
||||||
{
|
{
|
||||||
icon: `${this.icon}`
|
icon: `${this.icon}`,
|
||||||
|
...attrs
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
default: () => []
|
default: () => []
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
import { h, defineComponent } from "vue";
|
import { h, defineComponent } from "vue";
|
||||||
import { Icon as IconifyIcon } from "@iconify/vue";
|
import { Icon as IconifyIcon } from "@iconify/vue";
|
||||||
|
|
||||||
// Iconify Icon在Vue里在线使用(用于外网环境)
|
// Iconify Icon在Vue里在线使用(用于外网环境) https://docs.iconify.design/icon-components/vue/offline.html
|
||||||
// https://docs.iconify.design/icon-components/vue/offline.html
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "IconifyIcon",
|
name: "IconifyIcon",
|
||||||
components: { IconifyIcon },
|
components: { IconifyIcon },
|
||||||
@@ -11,16 +10,19 @@ export default defineComponent({
|
|||||||
type: String,
|
type: String,
|
||||||
default: ""
|
default: ""
|
||||||
},
|
},
|
||||||
|
// default element plus icon
|
||||||
type: {
|
type: {
|
||||||
type: String,
|
type: String,
|
||||||
default: "ep:"
|
default: "ep:"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
render() {
|
render() {
|
||||||
|
const attrs = this.$attrs;
|
||||||
return h(
|
return h(
|
||||||
IconifyIcon,
|
IconifyIcon,
|
||||||
{
|
{
|
||||||
icon: `${this.type}${this.icon}`
|
icon: `${this.type}${this.icon}`,
|
||||||
|
...attrs
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
default: () => []
|
default: () => []
|
||||||
|
|||||||
@@ -1,71 +1,43 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed } from "vue";
|
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
import { emitter } from "/@/utils/mitt";
|
import { useNav } from "../hooks/nav";
|
||||||
|
import { useRoute } from "vue-router";
|
||||||
import Notice from "./notice/index.vue";
|
import Notice from "./notice/index.vue";
|
||||||
|
import mixNav from "./sidebar/mixNav.vue";
|
||||||
import avatars from "/@/assets/avatars.jpg";
|
import avatars from "/@/assets/avatars.jpg";
|
||||||
import { transformI18n } from "/@/plugins/i18n";
|
|
||||||
import Hamburger from "./sidebar/hamBurger.vue";
|
import Hamburger from "./sidebar/hamBurger.vue";
|
||||||
import { useRouter, useRoute } from "vue-router";
|
import { watch, getCurrentInstance } from "vue";
|
||||||
import { storageSession } from "/@/utils/storage";
|
|
||||||
import Breadcrumb from "./sidebar/breadCrumb.vue";
|
import Breadcrumb from "./sidebar/breadCrumb.vue";
|
||||||
import { useAppStoreHook } from "/@/store/modules/app";
|
|
||||||
import { unref, watch, getCurrentInstance } from "vue";
|
|
||||||
import { deviceDetection } from "/@/utils/deviceDetection";
|
import { deviceDetection } from "/@/utils/deviceDetection";
|
||||||
import screenfull from "../components/screenfull/index.vue";
|
import screenfull from "../components/screenfull/index.vue";
|
||||||
import { useEpThemeStoreHook } from "/@/store/modules/epTheme";
|
|
||||||
import globalization from "/@/assets/svg/globalization.svg?component";
|
import globalization from "/@/assets/svg/globalization.svg?component";
|
||||||
|
|
||||||
|
const route = useRoute();
|
||||||
|
const { locale } = useI18n();
|
||||||
const instance =
|
const instance =
|
||||||
getCurrentInstance().appContext.config.globalProperties.$storage;
|
getCurrentInstance().appContext.config.globalProperties.$storage;
|
||||||
const pureApp = useAppStoreHook();
|
const {
|
||||||
const router = useRouter();
|
logout,
|
||||||
const route = useRoute();
|
onPanel,
|
||||||
let usename = storageSession.getItem("info")?.username;
|
changeTitle,
|
||||||
const { locale } = useI18n();
|
toggleSideBar,
|
||||||
|
pureApp,
|
||||||
const getDropdownItemStyle = computed(() => {
|
usename,
|
||||||
return t => {
|
getDropdownItemStyle
|
||||||
return {
|
} = useNav();
|
||||||
background: locale.value === t ? useEpThemeStoreHook().epThemeColor : "",
|
|
||||||
color: locale.value === t ? "#f4f4f5" : "#000"
|
|
||||||
};
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => locale.value,
|
() => locale.value,
|
||||||
() => {
|
() => {
|
||||||
//@ts-ignore
|
changeTitle(route.meta);
|
||||||
document.title = transformI18n(
|
|
||||||
//@ts-ignore
|
|
||||||
unref(route.meta.title),
|
|
||||||
unref(route.meta.i18n)
|
|
||||||
); // 动态title
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
// 退出登录
|
|
||||||
const logout = (): void => {
|
|
||||||
storageSession.removeItem("info");
|
|
||||||
router.push("/login");
|
|
||||||
};
|
|
||||||
|
|
||||||
function onPanel() {
|
|
||||||
emitter.emit("openPanel");
|
|
||||||
}
|
|
||||||
|
|
||||||
function toggleSideBar() {
|
|
||||||
pureApp.toggleSideBar();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 简体中文
|
|
||||||
function translationCh() {
|
function translationCh() {
|
||||||
instance.locale = { locale: "zh" };
|
instance.locale = { locale: "zh" };
|
||||||
locale.value = "zh";
|
locale.value = "zh";
|
||||||
}
|
}
|
||||||
|
|
||||||
// English
|
|
||||||
function translationEn() {
|
function translationEn() {
|
||||||
instance.locale = { locale: "en" };
|
instance.locale = { locale: "en" };
|
||||||
locale.value = "en";
|
locale.value = "en";
|
||||||
@@ -75,14 +47,17 @@ function translationEn() {
|
|||||||
<template>
|
<template>
|
||||||
<div class="navbar">
|
<div class="navbar">
|
||||||
<Hamburger
|
<Hamburger
|
||||||
|
v-if="pureApp.layout !== 'mix'"
|
||||||
:is-active="pureApp.sidebar.opened"
|
:is-active="pureApp.sidebar.opened"
|
||||||
class="hamburger-container"
|
class="hamburger-container"
|
||||||
@toggleClick="toggleSideBar"
|
@toggleClick="toggleSideBar"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Breadcrumb class="breadcrumb-container" />
|
<Breadcrumb v-if="pureApp.layout !== 'mix'" class="breadcrumb-container" />
|
||||||
|
|
||||||
<div class="vertical-header-right">
|
<mixNav v-if="pureApp.layout === 'mix'" />
|
||||||
|
|
||||||
|
<div v-if="pureApp.layout === 'vertical'" class="vertical-header-right">
|
||||||
<!-- 通知 -->
|
<!-- 通知 -->
|
||||||
<Notice id="header-notice" />
|
<Notice id="header-notice" />
|
||||||
<!-- 全屏 -->
|
<!-- 全屏 -->
|
||||||
@@ -93,7 +68,7 @@ function translationEn() {
|
|||||||
<template #dropdown>
|
<template #dropdown>
|
||||||
<el-dropdown-menu class="translation">
|
<el-dropdown-menu class="translation">
|
||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
:style="getDropdownItemStyle('zh')"
|
:style="getDropdownItemStyle(locale, 'zh')"
|
||||||
@click="translationCh"
|
@click="translationCh"
|
||||||
><IconifyIconOffline
|
><IconifyIconOffline
|
||||||
class="check-zh"
|
class="check-zh"
|
||||||
@@ -102,7 +77,7 @@ function translationEn() {
|
|||||||
/>简体中文</el-dropdown-item
|
/>简体中文</el-dropdown-item
|
||||||
>
|
>
|
||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
:style="getDropdownItemStyle('en')"
|
:style="getDropdownItemStyle(locale, 'en')"
|
||||||
@click="translationEn"
|
@click="translationEn"
|
||||||
><el-icon class="check-en" v-show="locale === 'en'"
|
><el-icon class="check-en" v-show="locale === 'en'"
|
||||||
><IconifyIconOffline icon="check" /></el-icon
|
><IconifyIconOffline icon="check" /></el-icon
|
||||||
@@ -120,8 +95,10 @@ function translationEn() {
|
|||||||
<template #dropdown>
|
<template #dropdown>
|
||||||
<el-dropdown-menu class="logout">
|
<el-dropdown-menu class="logout">
|
||||||
<el-dropdown-item @click="logout">
|
<el-dropdown-item @click="logout">
|
||||||
<i class="ri-logout-circle-r-line"></i
|
<IconifyIconOffline
|
||||||
>{{ $t("buttons.hsLoginOut") }}</el-dropdown-item
|
icon="logout-circle-r-line"
|
||||||
|
style="margin: 5px"
|
||||||
|
/>{{ $t("buttons.hsLoginOut") }}</el-dropdown-item
|
||||||
>
|
>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</template>
|
</template>
|
||||||
@@ -232,14 +209,8 @@ function translationEn() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.translation {
|
.translation {
|
||||||
.el-dropdown-menu__item {
|
::v-deep(.el-dropdown-menu__item) {
|
||||||
padding: 5px 40px !important;
|
padding: 5px 40px;
|
||||||
}
|
|
||||||
|
|
||||||
.el-dropdown-menu__item:focus,
|
|
||||||
.el-dropdown-menu__item:not(.is-disabled):hover {
|
|
||||||
color: #606266;
|
|
||||||
background: #f0f0f0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.check-zh {
|
.check-zh {
|
||||||
@@ -256,16 +227,10 @@ function translationEn() {
|
|||||||
.logout {
|
.logout {
|
||||||
max-width: 120px;
|
max-width: 120px;
|
||||||
|
|
||||||
.el-dropdown-menu__item {
|
::v-deep(.el-dropdown-menu__item) {
|
||||||
min-width: 100%;
|
min-width: 100%;
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-dropdown-menu__item:focus,
|
|
||||||
.el-dropdown-menu__item:not(.is-disabled):hover {
|
|
||||||
color: #606266;
|
|
||||||
background: #f0f0f0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ export const noticesData: TabItem[] = [
|
|||||||
{
|
{
|
||||||
avatar: "",
|
avatar: "",
|
||||||
title: "任务名称",
|
title: "任务名称",
|
||||||
description: "任务需要在 2021-11-16 20:00 前启动",
|
description: "任务需要在 2022-11-16 20:00 前启动",
|
||||||
datetime: "",
|
datetime: "",
|
||||||
extra: "未开始",
|
extra: "未开始",
|
||||||
status: "info",
|
status: "info",
|
||||||
@@ -118,7 +118,7 @@ export const noticesData: TabItem[] = [
|
|||||||
avatar: "",
|
avatar: "",
|
||||||
title: "第三方紧急代码变更",
|
title: "第三方紧急代码变更",
|
||||||
description:
|
description:
|
||||||
"一拳提交于 2021-11-16,需在 2021-11-18 前完成代码变更任务",
|
"一拳提交于 2022-11-16,需在 2022-11-18 前完成代码变更任务",
|
||||||
datetime: "",
|
datetime: "",
|
||||||
extra: "马上到期",
|
extra: "马上到期",
|
||||||
status: "danger",
|
status: "danger",
|
||||||
@@ -127,7 +127,7 @@ export const noticesData: TabItem[] = [
|
|||||||
{
|
{
|
||||||
avatar: "",
|
avatar: "",
|
||||||
title: "信息安全考试",
|
title: "信息安全考试",
|
||||||
description: "指派小仙于 2021-12-12 前完成更新并发布",
|
description: "指派小仙于 2022-12-12 前完成更新并发布",
|
||||||
datetime: "",
|
datetime: "",
|
||||||
extra: "已耗时 8 天",
|
extra: "已耗时 8 天",
|
||||||
status: "warning",
|
status: "warning",
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ emitter.on("openPanel", () => {
|
|||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
color: red;
|
color: var(--el-color-primary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,18 +5,14 @@ const { isFullscreen, toggle } = useFullscreen();
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="screen-full" @click="toggle">
|
<div class="screen-full" @click="toggle">
|
||||||
<i
|
<FontIcon
|
||||||
:title="
|
:title="
|
||||||
isFullscreen
|
isFullscreen
|
||||||
? $t('buttons.hsexitfullscreen')
|
? $t('buttons.hsexitfullscreen')
|
||||||
: $t('buttons.hsfullscreen')
|
: $t('buttons.hsfullscreen')
|
||||||
"
|
"
|
||||||
:class="
|
:icon="isFullscreen ? 'team-iconexit-fullscreen' : 'team-iconfullscreen'"
|
||||||
isFullscreen
|
/>
|
||||||
? 'iconfont team-iconexit-fullscreen'
|
|
||||||
: 'iconfont team-iconfullscreen'
|
|
||||||
"
|
|
||||||
></i>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ let themeColors = ref<Array<themeColorsType>>([
|
|||||||
|
|
||||||
const verticalRef = templateRef<HTMLElement | null>("verticalRef", null);
|
const verticalRef = templateRef<HTMLElement | null>("verticalRef", null);
|
||||||
const horizontalRef = templateRef<HTMLElement | null>("horizontalRef", null);
|
const horizontalRef = templateRef<HTMLElement | null>("horizontalRef", null);
|
||||||
|
const mixRef = templateRef<HTMLElement | null>("mixRef", null);
|
||||||
|
|
||||||
let layoutTheme =
|
let layoutTheme =
|
||||||
ref(storageLocal.getItem("responsive-layout")) ||
|
ref(storageLocal.getItem("responsive-layout")) ||
|
||||||
@@ -101,7 +102,7 @@ const getThemeColorStyle = computed(() => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
function changeStorageConfigure(key, val) {
|
function storageConfigureChange<T>(key: string, val: T): void {
|
||||||
const storageConfigure = instance.configure;
|
const storageConfigure = instance.configure;
|
||||||
storageConfigure[key] = val;
|
storageConfigure[key] = val;
|
||||||
instance.configure = storageConfigure;
|
instance.configure = storageConfigure;
|
||||||
@@ -117,7 +118,7 @@ function toggleClass(flag: boolean, clsName: string, target?: HTMLElement) {
|
|||||||
// 灰色模式设置
|
// 灰色模式设置
|
||||||
const greyChange = (value): void => {
|
const greyChange = (value): void => {
|
||||||
toggleClass(settings.greyVal, "html-grey", document.querySelector("html"));
|
toggleClass(settings.greyVal, "html-grey", document.querySelector("html"));
|
||||||
changeStorageConfigure("grey", value);
|
storageConfigureChange("grey", value);
|
||||||
};
|
};
|
||||||
|
|
||||||
// 色弱模式设置
|
// 色弱模式设置
|
||||||
@@ -127,29 +128,30 @@ const weekChange = (value): void => {
|
|||||||
"html-weakness",
|
"html-weakness",
|
||||||
document.querySelector("html")
|
document.querySelector("html")
|
||||||
);
|
);
|
||||||
changeStorageConfigure("weak", value);
|
storageConfigureChange("weak", value);
|
||||||
};
|
};
|
||||||
|
|
||||||
const tagsChange = () => {
|
const tagsChange = () => {
|
||||||
let showVal = settings.tabsVal;
|
let showVal = settings.tabsVal;
|
||||||
changeStorageConfigure("hideTabs", showVal);
|
storageConfigureChange("hideTabs", showVal);
|
||||||
emitter.emit("tagViewsChange", showVal);
|
emitter.emit("tagViewsChange", showVal);
|
||||||
};
|
};
|
||||||
|
|
||||||
const multiTagsCacheChange = () => {
|
const multiTagsCacheChange = () => {
|
||||||
let multiTagsCache = settings.multiTagsCache;
|
let multiTagsCache = settings.multiTagsCache;
|
||||||
changeStorageConfigure("multiTagsCache", multiTagsCache);
|
storageConfigureChange("multiTagsCache", multiTagsCache);
|
||||||
useMultiTagsStoreHook().multiTagsCacheChange(multiTagsCache);
|
useMultiTagsStoreHook().multiTagsCacheChange(multiTagsCache);
|
||||||
};
|
};
|
||||||
|
|
||||||
// 清空缓存并返回登录页
|
// 清空缓存并返回登录页
|
||||||
function onReset() {
|
function onReset() {
|
||||||
toggleClass(getConfig().Grey, "html-grey", document.querySelector("html"));
|
router.push("/login");
|
||||||
toggleClass(
|
const { Grey, Weak, MultiTagsCache, EpThemeColor, Layout } = getConfig();
|
||||||
getConfig().Weak,
|
useAppStoreHook().setLayout(Layout);
|
||||||
"html-weakness",
|
useEpThemeStoreHook().setEpThemeColor(EpThemeColor);
|
||||||
document.querySelector("html")
|
useMultiTagsStoreHook().multiTagsCacheChange(MultiTagsCache);
|
||||||
);
|
toggleClass(Grey, "html-grey", document.querySelector("html"));
|
||||||
|
toggleClass(Weak, "html-weakness", document.querySelector("html"));
|
||||||
useMultiTagsStoreHook().handleTags("equal", [
|
useMultiTagsStoreHook().handleTags("equal", [
|
||||||
{
|
{
|
||||||
path: "/welcome",
|
path: "/welcome",
|
||||||
@@ -157,28 +159,24 @@ function onReset() {
|
|||||||
meta: {
|
meta: {
|
||||||
title: "menus.hshome",
|
title: "menus.hshome",
|
||||||
icon: "home-filled",
|
icon: "home-filled",
|
||||||
i18n: true,
|
i18n: true
|
||||||
showLink: true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
useMultiTagsStoreHook().multiTagsCacheChange(getConfig().MultiTagsCache);
|
|
||||||
useEpThemeStoreHook().setEpThemeColor(getConfig().EpThemeColor);
|
|
||||||
storageLocal.clear();
|
storageLocal.clear();
|
||||||
storageSession.clear();
|
storageSession.clear();
|
||||||
router.push("/login");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function onChange(label) {
|
function onChange(label) {
|
||||||
changeStorageConfigure("showModel", label);
|
storageConfigureChange("showModel", label);
|
||||||
emitter.emit("tagViewsShowModel", label);
|
emitter.emit("tagViewsShowModel", label);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 侧边栏Logo
|
// 侧边栏Logo
|
||||||
function logoChange() {
|
function logoChange() {
|
||||||
unref(logoVal)
|
unref(logoVal)
|
||||||
? changeStorageConfigure("showLogo", true)
|
? storageConfigureChange("showLogo", true)
|
||||||
: changeStorageConfigure("showLogo", false);
|
: storageConfigureChange("showLogo", false);
|
||||||
emitter.emit("logoChange", unref(logoVal));
|
emitter.emit("logoChange", unref(logoVal));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -193,10 +191,17 @@ watch(instance, ({ layout }) => {
|
|||||||
case "vertical":
|
case "vertical":
|
||||||
toggleClass(true, isSelect, unref(verticalRef));
|
toggleClass(true, isSelect, unref(verticalRef));
|
||||||
debounce(setFalse([horizontalRef]), 50);
|
debounce(setFalse([horizontalRef]), 50);
|
||||||
|
debounce(setFalse([mixRef]), 50);
|
||||||
break;
|
break;
|
||||||
case "horizontal":
|
case "horizontal":
|
||||||
toggleClass(true, isSelect, unref(horizontalRef));
|
toggleClass(true, isSelect, unref(horizontalRef));
|
||||||
debounce(setFalse([verticalRef]), 50);
|
debounce(setFalse([verticalRef]), 50);
|
||||||
|
debounce(setFalse([mixRef]), 50);
|
||||||
|
break;
|
||||||
|
case "mix":
|
||||||
|
toggleClass(true, isSelect, unref(mixRef));
|
||||||
|
debounce(setFalse([verticalRef]), 50);
|
||||||
|
debounce(setFalse([horizontalRef]), 50);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -316,7 +321,7 @@ nextTick(() => {
|
|||||||
|
|
||||||
<el-divider>导航栏模式</el-divider>
|
<el-divider>导航栏模式</el-divider>
|
||||||
<ul class="pure-theme">
|
<ul class="pure-theme">
|
||||||
<el-tooltip class="item" content="左侧菜单模式" placement="bottom">
|
<el-tooltip class="item" content="左侧模式" placement="bottom">
|
||||||
<li
|
<li
|
||||||
:class="layoutTheme.layout === 'vertical' ? $style.isSelect : ''"
|
:class="layoutTheme.layout === 'vertical' ? $style.isSelect : ''"
|
||||||
ref="verticalRef"
|
ref="verticalRef"
|
||||||
@@ -327,7 +332,7 @@ nextTick(() => {
|
|||||||
</li>
|
</li>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
|
|
||||||
<el-tooltip class="item" content="顶部菜单模式" placement="bottom">
|
<el-tooltip class="item" content="顶部模式" placement="bottom">
|
||||||
<li
|
<li
|
||||||
:class="layoutTheme.layout === 'horizontal' ? $style.isSelect : ''"
|
:class="layoutTheme.layout === 'horizontal' ? $style.isSelect : ''"
|
||||||
ref="horizontalRef"
|
ref="horizontalRef"
|
||||||
@@ -337,6 +342,17 @@ nextTick(() => {
|
|||||||
<div></div>
|
<div></div>
|
||||||
</li>
|
</li>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
|
|
||||||
|
<el-tooltip class="item" content="混合模式" placement="bottom">
|
||||||
|
<li
|
||||||
|
:class="layoutTheme.layout === 'mix' ? $style.isSelect : ''"
|
||||||
|
ref="mixRef"
|
||||||
|
@click="setLayoutModel('mix')"
|
||||||
|
>
|
||||||
|
<div></div>
|
||||||
|
<div></div>
|
||||||
|
</li>
|
||||||
|
</el-tooltip>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<el-divider v-show="!dataTheme">主题色</el-divider>
|
<el-divider v-show="!dataTheme">主题色</el-divider>
|
||||||
@@ -437,7 +453,12 @@ nextTick(() => {
|
|||||||
style="width: 90%; margin: 24px 15px"
|
style="width: 90%; margin: 24px 15px"
|
||||||
@click="onReset"
|
@click="onReset"
|
||||||
>
|
>
|
||||||
<i class="fa fa-sign-out"></i>
|
<IconifyIconOffline
|
||||||
|
icon="fa-sign-out"
|
||||||
|
width="15"
|
||||||
|
height="15"
|
||||||
|
style="margin-right: 4px"
|
||||||
|
/>
|
||||||
清空缓存并返回登录页</el-button
|
清空缓存并返回登录页</el-button
|
||||||
>
|
>
|
||||||
</panel>
|
</panel>
|
||||||
@@ -477,15 +498,14 @@ nextTick(() => {
|
|||||||
.pure-theme {
|
.pure-theme {
|
||||||
margin-top: 25px;
|
margin-top: 25px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100px;
|
height: 50px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
justify-content: space-around;
|
justify-content: space-around;
|
||||||
|
|
||||||
li {
|
li {
|
||||||
margin: 10px;
|
width: 18%;
|
||||||
width: 36%;
|
height: 45px;
|
||||||
height: 70px;
|
|
||||||
background: #f0f2f5;
|
background: #f0f2f5;
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
@@ -523,6 +543,27 @@ nextTick(() => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&:nth-child(3) {
|
||||||
|
div {
|
||||||
|
&:nth-child(1) {
|
||||||
|
width: 100%;
|
||||||
|
height: 30%;
|
||||||
|
background: #1b2a47;
|
||||||
|
box-shadow: 0 0 1px #888;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:nth-child(2) {
|
||||||
|
width: 30%;
|
||||||
|
height: 70%;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
background: #fff;
|
||||||
|
box-shadow: 0 0 1px #888;
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,144 +1,80 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {
|
|
||||||
computed,
|
|
||||||
unref,
|
|
||||||
watch,
|
|
||||||
nextTick,
|
|
||||||
onMounted,
|
|
||||||
getCurrentInstance
|
|
||||||
} from "vue";
|
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
import { emitter } from "/@/utils/mitt";
|
import { useNav } from "../../hooks/nav";
|
||||||
import Notice from "../notice/index.vue";
|
import Notice from "../notice/index.vue";
|
||||||
import { templateRef } from "@vueuse/core";
|
import { templateRef } from "@vueuse/core";
|
||||||
import SidebarItem from "./sidebarItem.vue";
|
import SidebarItem from "./sidebarItem.vue";
|
||||||
import avatars from "/@/assets/avatars.jpg";
|
import avatars from "/@/assets/avatars.jpg";
|
||||||
import { algorithm } from "/@/utils/algorithm";
|
|
||||||
import screenfull from "../screenfull/index.vue";
|
import screenfull from "../screenfull/index.vue";
|
||||||
import { useRoute, useRouter } from "vue-router";
|
import { useRoute, useRouter } from "vue-router";
|
||||||
import { storageSession } from "/@/utils/storage";
|
|
||||||
import Icon from "/@/components/ReIcon/src/Icon.vue";
|
|
||||||
import { deviceDetection } from "/@/utils/deviceDetection";
|
import { deviceDetection } from "/@/utils/deviceDetection";
|
||||||
|
import { watch, nextTick, onMounted, getCurrentInstance } from "vue";
|
||||||
import { usePermissionStoreHook } from "/@/store/modules/permission";
|
import { usePermissionStoreHook } from "/@/store/modules/permission";
|
||||||
import globalization from "/@/assets/svg/globalization.svg?component";
|
import globalization from "/@/assets/svg/globalization.svg?component";
|
||||||
|
|
||||||
|
const route = useRoute();
|
||||||
|
const { locale } = useI18n();
|
||||||
|
const routers = useRouter().options.routes;
|
||||||
|
const menuRef = templateRef<ElRef | null>("menu", null);
|
||||||
const instance =
|
const instance =
|
||||||
getCurrentInstance().appContext.config.globalProperties.$storage;
|
getCurrentInstance().appContext.config.globalProperties.$storage;
|
||||||
|
|
||||||
const title =
|
const title =
|
||||||
getCurrentInstance().appContext.config.globalProperties.$config?.Title;
|
getCurrentInstance().appContext.config.globalProperties.$config?.Title;
|
||||||
|
|
||||||
const menuRef = templateRef<ElRef | null>("menu", null);
|
const {
|
||||||
const route = useRoute();
|
logout,
|
||||||
const router = useRouter();
|
backHome,
|
||||||
const routers = useRouter().options.routes;
|
onPanel,
|
||||||
let usename = storageSession.getItem("info")?.username;
|
changeTitle,
|
||||||
const { locale, t } = useI18n();
|
handleResize,
|
||||||
|
menuSelect,
|
||||||
|
usename,
|
||||||
|
getDropdownItemStyle
|
||||||
|
} = useNav();
|
||||||
|
|
||||||
const getDropdownItemStyle = computed(() => {
|
onMounted(() => {
|
||||||
return t => {
|
nextTick(() => {
|
||||||
return {
|
handleResize(menuRef.value);
|
||||||
background: locale.value === t ? "#1b2a47" : "",
|
});
|
||||||
color: locale.value === t ? "#f4f4f5" : "#000"
|
|
||||||
};
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => locale.value,
|
() => locale.value,
|
||||||
() => {
|
() => {
|
||||||
//@ts-ignore
|
changeTitle(route.meta);
|
||||||
// 动态title
|
|
||||||
document.title = t(unref(route.meta.title));
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
// 退出登录
|
|
||||||
const logout = (): void => {
|
|
||||||
storageSession.removeItem("info");
|
|
||||||
router.push("/login");
|
|
||||||
};
|
|
||||||
|
|
||||||
function onPanel() {
|
|
||||||
emitter.emit("openPanel");
|
|
||||||
}
|
|
||||||
|
|
||||||
const activeMenu = computed((): string => {
|
|
||||||
const { meta, path } = route;
|
|
||||||
if (meta.activeMenu) {
|
|
||||||
// @ts-ignore
|
|
||||||
return meta.activeMenu;
|
|
||||||
}
|
|
||||||
return path;
|
|
||||||
});
|
|
||||||
|
|
||||||
const menuSelect = (indexPath: string): void => {
|
|
||||||
let parentPath = "";
|
|
||||||
let parentPathIndex = indexPath.lastIndexOf("/");
|
|
||||||
if (parentPathIndex > 0) {
|
|
||||||
parentPath = indexPath.slice(0, parentPathIndex);
|
|
||||||
}
|
|
||||||
// 找到当前路由的信息
|
|
||||||
function findCurrentRoute(routes) {
|
|
||||||
return routes.map(item => {
|
|
||||||
if (item.path === indexPath) {
|
|
||||||
// 切换左侧菜单 通知标签页
|
|
||||||
emitter.emit("changLayoutRoute", {
|
|
||||||
indexPath,
|
|
||||||
parentPath
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
if (item.children) findCurrentRoute(item.children);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
findCurrentRoute(algorithm.increaseIndexes(routers));
|
|
||||||
};
|
|
||||||
|
|
||||||
function backHome() {
|
|
||||||
router.push("/welcome");
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleResize() {
|
|
||||||
// @ts-ignore
|
|
||||||
menuRef.value.handleResize();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 简体中文
|
|
||||||
function translationCh() {
|
function translationCh() {
|
||||||
instance.locale = { locale: "zh" };
|
instance.locale = { locale: "zh" };
|
||||||
locale.value = "zh";
|
locale.value = "zh";
|
||||||
handleResize();
|
handleResize(menuRef.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// English
|
|
||||||
function translationEn() {
|
function translationEn() {
|
||||||
instance.locale = { locale: "en" };
|
instance.locale = { locale: "en" };
|
||||||
locale.value = "en";
|
locale.value = "en";
|
||||||
handleResize();
|
handleResize(menuRef.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
nextTick(() => {
|
|
||||||
handleResize();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="horizontal-header">
|
<div class="horizontal-header">
|
||||||
<div class="horizontal-header-left" @click="backHome">
|
<div class="horizontal-header-left" @click="backHome">
|
||||||
<Icon svg :width="35" :height="35" content="team-iconlogo" />
|
<FontIcon
|
||||||
|
icon="team-iconlogo"
|
||||||
|
svg
|
||||||
|
style="width: 35px; height: 35px"
|
||||||
|
></FontIcon>
|
||||||
<h4>{{ title }}</h4>
|
<h4>{{ title }}</h4>
|
||||||
</div>
|
</div>
|
||||||
<el-menu
|
<el-menu
|
||||||
ref="menu"
|
ref="menu"
|
||||||
:default-active="activeMenu"
|
|
||||||
unique-opened
|
|
||||||
router
|
|
||||||
class="horizontal-header-menu"
|
class="horizontal-header-menu"
|
||||||
mode="horizontal"
|
mode="horizontal"
|
||||||
@select="menuSelect"
|
:default-active="route.path"
|
||||||
|
router
|
||||||
|
@select="indexPath => menuSelect(indexPath, routers)"
|
||||||
>
|
>
|
||||||
<sidebar-item
|
<sidebar-item
|
||||||
v-for="route in usePermissionStoreHook().wholeMenus"
|
v-for="route in usePermissionStoreHook().wholeMenus"
|
||||||
@@ -158,14 +94,14 @@ onMounted(() => {
|
|||||||
<template #dropdown>
|
<template #dropdown>
|
||||||
<el-dropdown-menu class="translation">
|
<el-dropdown-menu class="translation">
|
||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
:style="getDropdownItemStyle('zh')"
|
:style="getDropdownItemStyle(locale, 'zh')"
|
||||||
@click="translationCh"
|
@click="translationCh"
|
||||||
><el-icon class="check-zh" v-show="locale === 'zh'"
|
><el-icon class="check-zh" v-show="locale === 'zh'"
|
||||||
><IconifyIconOffline icon="check" /></el-icon
|
><IconifyIconOffline icon="check" /></el-icon
|
||||||
>简体中文</el-dropdown-item
|
>简体中文</el-dropdown-item
|
||||||
>
|
>
|
||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
:style="getDropdownItemStyle('en')"
|
:style="getDropdownItemStyle(locale, 'en')"
|
||||||
@click="translationEn"
|
@click="translationEn"
|
||||||
><el-icon class="check-en" v-show="locale === 'en'"
|
><el-icon class="check-en" v-show="locale === 'en'"
|
||||||
><IconifyIconOffline icon="check" /></el-icon
|
><IconifyIconOffline icon="check" /></el-icon
|
||||||
@@ -183,8 +119,11 @@ onMounted(() => {
|
|||||||
<template #dropdown>
|
<template #dropdown>
|
||||||
<el-dropdown-menu class="logout">
|
<el-dropdown-menu class="logout">
|
||||||
<el-dropdown-item @click="logout">
|
<el-dropdown-item @click="logout">
|
||||||
<i class="ri-logout-circle-r-line"></i
|
<IconifyIconOffline
|
||||||
>{{ $t("buttons.hsLoginOut") }}</el-dropdown-item
|
icon="logout-circle-r-line"
|
||||||
|
style="margin: 5px"
|
||||||
|
/>
|
||||||
|
{{ $t("buttons.hsLoginOut") }}</el-dropdown-item
|
||||||
>
|
>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</template>
|
</template>
|
||||||
@@ -202,14 +141,8 @@ onMounted(() => {
|
|||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.translation {
|
.translation {
|
||||||
.el-dropdown-menu__item {
|
::v-deep(.el-dropdown-menu__item) {
|
||||||
padding: 5px 40px !important;
|
padding: 5px 40px;
|
||||||
}
|
|
||||||
|
|
||||||
.el-dropdown-menu__item:focus,
|
|
||||||
.el-dropdown-menu__item:not(.is-disabled):hover {
|
|
||||||
color: #606266;
|
|
||||||
background: #f0f0f0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.check-zh {
|
.check-zh {
|
||||||
@@ -226,16 +159,10 @@ onMounted(() => {
|
|||||||
.logout {
|
.logout {
|
||||||
max-width: 120px;
|
max-width: 120px;
|
||||||
|
|
||||||
.el-dropdown-menu__item {
|
::v-deep(.el-dropdown-menu__item) {
|
||||||
min-width: 100%;
|
min-width: 100%;
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-dropdown-menu__item:focus,
|
|
||||||
.el-dropdown-menu__item:not(.is-disabled):hover {
|
|
||||||
color: #606266;
|
|
||||||
background: #f0f0f0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { getCurrentInstance } from "vue";
|
import { getCurrentInstance } from "vue";
|
||||||
import Icon from "/@/components/ReIcon/src/Icon.vue";
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
collapse: Boolean
|
collapse: Boolean
|
||||||
});
|
});
|
||||||
@@ -19,7 +18,11 @@ const title =
|
|||||||
class="sidebar-logo-link"
|
class="sidebar-logo-link"
|
||||||
to="/"
|
to="/"
|
||||||
>
|
>
|
||||||
<Icon svg :width="35" :height="35" content="team-iconlogo" />
|
<FontIcon
|
||||||
|
icon="team-iconlogo"
|
||||||
|
svg
|
||||||
|
style="width: 35px; height: 35px"
|
||||||
|
></FontIcon>
|
||||||
<span class="sidebar-title">{{ title }}</span>
|
<span class="sidebar-title">{{ title }}</span>
|
||||||
</router-link>
|
</router-link>
|
||||||
<router-link
|
<router-link
|
||||||
@@ -29,7 +32,11 @@ const title =
|
|||||||
class="sidebar-logo-link"
|
class="sidebar-logo-link"
|
||||||
to="/"
|
to="/"
|
||||||
>
|
>
|
||||||
<Icon svg :width="35" :height="35" content="team-iconlogo" />
|
<FontIcon
|
||||||
|
icon="team-iconlogo"
|
||||||
|
svg
|
||||||
|
style="width: 35px; height: 35px"
|
||||||
|
></FontIcon>
|
||||||
<span class="sidebar-title">{{ title }}</span>
|
<span class="sidebar-title">{{ title }}</span>
|
||||||
</router-link>
|
</router-link>
|
||||||
</transition>
|
</transition>
|
||||||
|
|||||||
239
src/layout/components/sidebar/mixNav.vue
Normal file
@@ -0,0 +1,239 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { useI18n } from "vue-i18n";
|
||||||
|
import Notice from "../notice/index.vue";
|
||||||
|
import { useNav } from "../../hooks/nav";
|
||||||
|
import { templateRef } from "@vueuse/core";
|
||||||
|
import avatars from "/@/assets/avatars.jpg";
|
||||||
|
import { transformI18n } from "/@/plugins/i18n";
|
||||||
|
import screenfull from "../screenfull/index.vue";
|
||||||
|
import { useRoute, useRouter } from "vue-router";
|
||||||
|
import { deviceDetection } from "/@/utils/deviceDetection";
|
||||||
|
import { useRenderIcon } from "/@/components/ReIcon/src/hooks";
|
||||||
|
import { useEpThemeStoreHook } from "/@/store/modules/epTheme";
|
||||||
|
import { getParentPaths, findRouteByPath } from "/@/router/utils";
|
||||||
|
import { usePermissionStoreHook } from "/@/store/modules/permission";
|
||||||
|
import globalization from "/@/assets/svg/globalization.svg?component";
|
||||||
|
import { ref, watch, nextTick, onMounted, getCurrentInstance } from "vue";
|
||||||
|
|
||||||
|
const route = useRoute();
|
||||||
|
const { locale } = useI18n();
|
||||||
|
const routers = useRouter().options.routes;
|
||||||
|
const menuRef = templateRef<ElRef | null>("menu", null);
|
||||||
|
const instance =
|
||||||
|
getCurrentInstance().appContext.config.globalProperties.$storage;
|
||||||
|
|
||||||
|
const {
|
||||||
|
logout,
|
||||||
|
onPanel,
|
||||||
|
changeTitle,
|
||||||
|
toggleSideBar,
|
||||||
|
handleResize,
|
||||||
|
menuSelect,
|
||||||
|
resolvePath,
|
||||||
|
pureApp,
|
||||||
|
usename,
|
||||||
|
getDropdownItemStyle
|
||||||
|
} = useNav();
|
||||||
|
|
||||||
|
let defaultActive = ref(null);
|
||||||
|
|
||||||
|
function getDefaultActive(routePath) {
|
||||||
|
const wholeMenus = usePermissionStoreHook().wholeMenus;
|
||||||
|
// 当前路由的父级路径
|
||||||
|
const parentRoutes = getParentPaths(routePath, wholeMenus)[0];
|
||||||
|
defaultActive.value = findRouteByPath(
|
||||||
|
parentRoutes,
|
||||||
|
wholeMenus
|
||||||
|
)?.children[0]?.path;
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getDefaultActive(route.path);
|
||||||
|
nextTick(() => {
|
||||||
|
handleResize(menuRef.value);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => locale.value,
|
||||||
|
() => {
|
||||||
|
changeTitle(route.meta);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => route.path,
|
||||||
|
() => {
|
||||||
|
getDefaultActive(route.path);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
function translationCh() {
|
||||||
|
instance.locale = { locale: "zh" };
|
||||||
|
locale.value = "zh";
|
||||||
|
handleResize(menuRef.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
function translationEn() {
|
||||||
|
instance.locale = { locale: "en" };
|
||||||
|
locale.value = "en";
|
||||||
|
handleResize(menuRef.value);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="horizontal-header">
|
||||||
|
<div
|
||||||
|
:class="classes.container"
|
||||||
|
:title="pureApp.sidebar.opened ? '点击折叠' : '点击展开'"
|
||||||
|
@click="toggleSideBar"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
:fill="useEpThemeStoreHook().fill"
|
||||||
|
:class="[
|
||||||
|
'hamburger',
|
||||||
|
pureApp.sidebar.opened ? 'is-active-hamburger' : ''
|
||||||
|
]"
|
||||||
|
viewBox="0 0 1024 1024"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
width="64"
|
||||||
|
height="64"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM142.4 642.1L298.7 519a8.84 8.84 0 0 0 0-13.9L142.4 381.9c-5.8-4.6-14.4-.5-14.4 6.9v246.3a8.9 8.9 0 0 0 14.4 7z"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
<el-menu
|
||||||
|
ref="menu"
|
||||||
|
class="horizontal-header-menu"
|
||||||
|
mode="horizontal"
|
||||||
|
:default-active="defaultActive"
|
||||||
|
router
|
||||||
|
@select="indexPath => menuSelect(indexPath, routers)"
|
||||||
|
>
|
||||||
|
<el-menu-item
|
||||||
|
v-for="route in usePermissionStoreHook().wholeMenus"
|
||||||
|
:key="route.path"
|
||||||
|
:index="resolvePath(route) || route.redirect"
|
||||||
|
>
|
||||||
|
<template #title>
|
||||||
|
<el-icon v-show="route.meta.icon" :class="route.meta.icon">
|
||||||
|
<component
|
||||||
|
:is="useRenderIcon(route.meta && route.meta.icon)"
|
||||||
|
></component>
|
||||||
|
</el-icon>
|
||||||
|
<span>{{ transformI18n(route.meta.title, route.meta.i18n) }}</span>
|
||||||
|
<FontIcon
|
||||||
|
v-if="route.meta.extraIcon"
|
||||||
|
width="30px"
|
||||||
|
height="30px"
|
||||||
|
style="position: absolute; right: 10px"
|
||||||
|
:icon="route.meta.extraIcon.name"
|
||||||
|
:svg="route.meta.extraIcon.svg ? true : false"
|
||||||
|
></FontIcon>
|
||||||
|
</template>
|
||||||
|
</el-menu-item>
|
||||||
|
</el-menu>
|
||||||
|
<div class="horizontal-header-right">
|
||||||
|
<!-- 通知 -->
|
||||||
|
<Notice id="header-notice" />
|
||||||
|
<!-- 全屏 -->
|
||||||
|
<screenfull id="header-screenfull" v-show="!deviceDetection()" />
|
||||||
|
<!-- 国际化 -->
|
||||||
|
<el-dropdown id="header-translation" trigger="click">
|
||||||
|
<globalization />
|
||||||
|
<template #dropdown>
|
||||||
|
<el-dropdown-menu class="translation">
|
||||||
|
<el-dropdown-item
|
||||||
|
:style="getDropdownItemStyle(locale, 'zh')"
|
||||||
|
@click="translationCh"
|
||||||
|
><el-icon class="check-zh" v-show="locale === 'zh'"
|
||||||
|
><IconifyIconOffline icon="check" /></el-icon
|
||||||
|
>简体中文</el-dropdown-item
|
||||||
|
>
|
||||||
|
<el-dropdown-item
|
||||||
|
:style="getDropdownItemStyle(locale, 'en')"
|
||||||
|
@click="translationEn"
|
||||||
|
><el-icon class="check-en" v-show="locale === 'en'"
|
||||||
|
><IconifyIconOffline icon="check" /></el-icon
|
||||||
|
>English</el-dropdown-item
|
||||||
|
>
|
||||||
|
</el-dropdown-menu>
|
||||||
|
</template>
|
||||||
|
</el-dropdown>
|
||||||
|
<!-- 退出登陆 -->
|
||||||
|
<el-dropdown trigger="click">
|
||||||
|
<span class="el-dropdown-link">
|
||||||
|
<img :src="avatars" />
|
||||||
|
<p>{{ usename }}</p>
|
||||||
|
</span>
|
||||||
|
<template #dropdown>
|
||||||
|
<el-dropdown-menu class="logout">
|
||||||
|
<el-dropdown-item @click="logout">
|
||||||
|
<IconifyIconOffline
|
||||||
|
icon="logout-circle-r-line"
|
||||||
|
style="margin: 5px"
|
||||||
|
/>
|
||||||
|
{{ $t("buttons.hsLoginOut") }}</el-dropdown-item
|
||||||
|
>
|
||||||
|
</el-dropdown-menu>
|
||||||
|
</template>
|
||||||
|
</el-dropdown>
|
||||||
|
<el-icon
|
||||||
|
class="el-icon-setting"
|
||||||
|
:title="$t('buttons.hssystemSet')"
|
||||||
|
@click="onPanel"
|
||||||
|
>
|
||||||
|
<IconifyIconOffline icon="setting" />
|
||||||
|
</el-icon>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style module="classes" scoped>
|
||||||
|
.container {
|
||||||
|
padding: 0 15px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.hamburger {
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.is-active-hamburger {
|
||||||
|
transform: rotate(180deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.translation {
|
||||||
|
::v-deep(.el-dropdown-menu__item) {
|
||||||
|
padding: 5px 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.check-zh {
|
||||||
|
position: absolute;
|
||||||
|
left: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.check-en {
|
||||||
|
position: absolute;
|
||||||
|
left: 20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.logout {
|
||||||
|
max-width: 120px;
|
||||||
|
|
||||||
|
::v-deep(.el-dropdown-menu__item) {
|
||||||
|
min-width: 100%;
|
||||||
|
display: inline-flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,22 +1,14 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {
|
import { ref, PropType, nextTick, computed, CSSProperties } from "vue";
|
||||||
ref,
|
|
||||||
PropType,
|
|
||||||
nextTick,
|
|
||||||
computed,
|
|
||||||
CSSProperties,
|
|
||||||
getCurrentInstance
|
|
||||||
} from "vue";
|
|
||||||
import path from "path";
|
import path from "path";
|
||||||
|
import { useNav } from "../../hooks/nav";
|
||||||
import { childrenType } from "../../types";
|
import { childrenType } from "../../types";
|
||||||
import { transformI18n } from "/@/plugins/i18n";
|
import { transformI18n } from "/@/plugins/i18n";
|
||||||
import { findIconReg } from "/@/components/ReIcon";
|
|
||||||
import Icon from "/@/components/ReIcon/src/Icon.vue";
|
|
||||||
import { useAppStoreHook } from "/@/store/modules/app";
|
import { useAppStoreHook } from "/@/store/modules/app";
|
||||||
|
import { useRenderIcon } from "/@/components/ReIcon/src/hooks";
|
||||||
|
|
||||||
const instance = getCurrentInstance().appContext.app.config.globalProperties;
|
const { pureApp } = useNav();
|
||||||
const menuMode = instance.$storage.layout?.layout === "vertical";
|
const menuMode = ["vertical", "mix"].includes(pureApp.layout);
|
||||||
const pureApp = useAppStoreHook();
|
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
item: {
|
item: {
|
||||||
@@ -32,6 +24,19 @@ const props = defineProps({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const getExtraIconStyle = computed((): CSSProperties => {
|
||||||
|
if (useAppStoreHook().getSidebarStatus) {
|
||||||
|
return {
|
||||||
|
position: "absolute",
|
||||||
|
right: "10px"
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
position: "static"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const getNoDropdownStyle = computed((): CSSProperties => {
|
const getNoDropdownStyle = computed((): CSSProperties => {
|
||||||
return {
|
return {
|
||||||
display: "flex",
|
display: "flex",
|
||||||
@@ -93,7 +98,6 @@ function hoverMenu(key) {
|
|||||||
: Object.assign(key, {
|
: Object.assign(key, {
|
||||||
showTooltip: false
|
showTooltip: false
|
||||||
});
|
});
|
||||||
|
|
||||||
hoverMenuMap.set(key, true);
|
hoverMenuMap.set(key, true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -120,8 +124,8 @@ function hasOneShowingChild(
|
|||||||
|
|
||||||
function resolvePath(routePath) {
|
function resolvePath(routePath) {
|
||||||
const httpReg = /^http(s?):\/\//;
|
const httpReg = /^http(s?):\/\//;
|
||||||
if (httpReg.test(routePath)) {
|
if (httpReg.test(routePath) || httpReg.test(props.basePath)) {
|
||||||
return props.basePath + "/" + routePath;
|
return routePath || props.basePath;
|
||||||
} else {
|
} else {
|
||||||
return path.resolve(props.basePath, routePath);
|
return path.resolve(props.basePath, routePath);
|
||||||
}
|
}
|
||||||
@@ -143,13 +147,25 @@ function resolvePath(routePath) {
|
|||||||
<el-icon v-show="props.item.meta.icon">
|
<el-icon v-show="props.item.meta.icon">
|
||||||
<component
|
<component
|
||||||
:is="
|
:is="
|
||||||
findIconReg(
|
useRenderIcon(
|
||||||
onlyOneChild.meta.icon ||
|
onlyOneChild.meta.icon ||
|
||||||
(props.item.meta && props.item.meta.icon)
|
(props.item.meta && props.item.meta.icon)
|
||||||
)
|
)
|
||||||
"
|
"
|
||||||
></component>
|
></component>
|
||||||
</el-icon>
|
</el-icon>
|
||||||
|
<div
|
||||||
|
v-if="
|
||||||
|
!pureApp.sidebar.opened &&
|
||||||
|
pureApp.layout === 'mix' &&
|
||||||
|
props.item?.pathList?.length === 2
|
||||||
|
"
|
||||||
|
:style="getDivStyle"
|
||||||
|
>
|
||||||
|
<span :style="getMenuTextStyle">
|
||||||
|
{{ transformI18n(onlyOneChild.meta.title, onlyOneChild.meta.i18n) }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
<template #title>
|
<template #title>
|
||||||
<div :style="getDivStyle">
|
<div :style="getDivStyle">
|
||||||
<span v-if="!menuMode">{{
|
<span v-if="!menuMode">{{
|
||||||
@@ -176,11 +192,14 @@ function resolvePath(routePath) {
|
|||||||
}}
|
}}
|
||||||
</span>
|
</span>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<Icon
|
<FontIcon
|
||||||
v-if="onlyOneChild.meta.extraIcon"
|
v-if="onlyOneChild.meta.extraIcon"
|
||||||
|
width="30px"
|
||||||
|
height="30px"
|
||||||
|
:style="getExtraIconStyle"
|
||||||
|
:icon="onlyOneChild.meta.extraIcon.name"
|
||||||
:svg="onlyOneChild.meta.extraIcon.svg ? true : false"
|
:svg="onlyOneChild.meta.extraIcon.svg ? true : false"
|
||||||
:content="`${onlyOneChild.meta.extraIcon.name}`"
|
></FontIcon>
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
@@ -195,7 +214,7 @@ function resolvePath(routePath) {
|
|||||||
<template #title>
|
<template #title>
|
||||||
<el-icon v-show="props.item.meta.icon" :class="props.item.meta.icon">
|
<el-icon v-show="props.item.meta.icon" :class="props.item.meta.icon">
|
||||||
<component
|
<component
|
||||||
:is="findIconReg(props.item.meta && props.item.meta.icon)"
|
:is="useRenderIcon(props.item.meta && props.item.meta.icon)"
|
||||||
></component>
|
></component>
|
||||||
</el-icon>
|
</el-icon>
|
||||||
<span v-if="!menuMode">{{
|
<span v-if="!menuMode">{{
|
||||||
@@ -220,11 +239,14 @@ function resolvePath(routePath) {
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<Icon
|
<FontIcon
|
||||||
v-if="props.item.meta.extraIcon"
|
v-if="props.item.meta.extraIcon"
|
||||||
|
width="30px"
|
||||||
|
height="30px"
|
||||||
|
style="position: absolute; right: 10px"
|
||||||
|
:icon="props.item.meta.extraIcon.name"
|
||||||
:svg="props.item.meta.extraIcon.svg ? true : false"
|
:svg="props.item.meta.extraIcon.svg ? true : false"
|
||||||
:content="`${props.item.meta.extraIcon.name}`"
|
></FontIcon>
|
||||||
/>
|
|
||||||
</template>
|
</template>
|
||||||
<sidebar-item
|
<sidebar-item
|
||||||
v-for="child in props.item.children"
|
v-for="child in props.item.children"
|
||||||
|
|||||||
@@ -1,61 +1,56 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import Logo from "./logo.vue";
|
import Logo from "./logo.vue";
|
||||||
import { emitter } from "/@/utils/mitt";
|
import { emitter } from "/@/utils/mitt";
|
||||||
|
import { useNav } from "../../hooks/nav";
|
||||||
import SidebarItem from "./sidebarItem.vue";
|
import SidebarItem from "./sidebarItem.vue";
|
||||||
import { algorithm } from "/@/utils/algorithm";
|
|
||||||
import { storageLocal } from "/@/utils/storage";
|
import { storageLocal } from "/@/utils/storage";
|
||||||
import { useRoute, useRouter } from "vue-router";
|
import { useRoute, useRouter } from "vue-router";
|
||||||
import { computed, ref, onBeforeMount } from "vue";
|
import { ref, computed, watch, onBeforeMount } from "vue";
|
||||||
import { useAppStoreHook } from "/@/store/modules/app";
|
import { findRouteByPath, getParentPaths } from "/@/router/utils";
|
||||||
import { usePermissionStoreHook } from "/@/store/modules/permission";
|
import { usePermissionStoreHook } from "/@/store/modules/permission";
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const pureApp = useAppStoreHook();
|
const routers = useRouter().options.routes;
|
||||||
const router = useRouter().options.routes;
|
|
||||||
const showLogo = ref(
|
const showLogo = ref(
|
||||||
storageLocal.getItem("responsive-configure")?.showLogo ?? true
|
storageLocal.getItem("responsive-configure")?.showLogo ?? true
|
||||||
);
|
);
|
||||||
const isCollapse = computed(() => {
|
|
||||||
return !pureApp.getSidebarStatus;
|
const { pureApp, isCollapse, menuSelect } = useNav();
|
||||||
});
|
|
||||||
const activeMenu = computed((): string => {
|
let subMenuData = ref([]);
|
||||||
const { meta, path } = route;
|
|
||||||
if (meta.activeMenu) {
|
const menuData = computed(() => {
|
||||||
// @ts-ignore
|
return pureApp.layout === "mix"
|
||||||
return meta.activeMenu;
|
? subMenuData.value
|
||||||
}
|
: usePermissionStoreHook().wholeMenus;
|
||||||
return path;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const menuSelect = (indexPath: string): void => {
|
function getSubMenuData(path) {
|
||||||
let parentPath = "";
|
// path的上级路由组成的数组
|
||||||
let parentPathIndex = indexPath.lastIndexOf("/");
|
const parentPathArr = getParentPaths(
|
||||||
if (parentPathIndex > 0) {
|
path,
|
||||||
parentPath = indexPath.slice(0, parentPathIndex);
|
usePermissionStoreHook().wholeMenus
|
||||||
}
|
);
|
||||||
// 找到当前路由的信息
|
// 当前路由的父级路由信息
|
||||||
// eslint-disable-next-line no-inner-declarations
|
const parenetRoute = findRouteByPath(
|
||||||
function findCurrentRoute(routes) {
|
parentPathArr[0] || path,
|
||||||
return routes.map(item => {
|
usePermissionStoreHook().wholeMenus
|
||||||
if (item.path === indexPath) {
|
);
|
||||||
// 切换左侧菜单 通知标签页
|
if (!parenetRoute?.children) return;
|
||||||
emitter.emit("changLayoutRoute", {
|
subMenuData.value = parenetRoute?.children;
|
||||||
indexPath,
|
}
|
||||||
parentPath
|
getSubMenuData(route.path);
|
||||||
});
|
|
||||||
} else {
|
|
||||||
if (item.children) findCurrentRoute(item.children);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
findCurrentRoute(algorithm.increaseIndexes(router));
|
|
||||||
};
|
|
||||||
|
|
||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
emitter.on("logoChange", key => {
|
emitter.on("logoChange", key => {
|
||||||
showLogo.value = key;
|
showLogo.value = key;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => route.path,
|
||||||
|
() => getSubMenuData(route.path)
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -63,21 +58,21 @@ onBeforeMount(() => {
|
|||||||
<Logo v-if="showLogo" :collapse="isCollapse" />
|
<Logo v-if="showLogo" :collapse="isCollapse" />
|
||||||
<el-scrollbar wrap-class="scrollbar-wrapper">
|
<el-scrollbar wrap-class="scrollbar-wrapper">
|
||||||
<el-menu
|
<el-menu
|
||||||
:default-active="activeMenu"
|
:default-active="route.path"
|
||||||
:collapse="isCollapse"
|
:collapse="isCollapse"
|
||||||
unique-opened
|
unique-opened
|
||||||
router
|
router
|
||||||
:collapse-transition="false"
|
:collapse-transition="false"
|
||||||
mode="vertical"
|
mode="vertical"
|
||||||
class="outer-most"
|
class="outer-most"
|
||||||
@select="menuSelect"
|
@select="indexPath => menuSelect(indexPath, routers)"
|
||||||
>
|
>
|
||||||
<sidebar-item
|
<sidebar-item
|
||||||
v-for="route in usePermissionStoreHook().wholeMenus"
|
v-for="routes in menuData"
|
||||||
:key="route.path"
|
:key="routes.path"
|
||||||
:item="route"
|
:item="routes"
|
||||||
class="outer-most"
|
class="outer-most"
|
||||||
:base-path="route.path"
|
:base-path="routes.path"
|
||||||
/>
|
/>
|
||||||
</el-menu>
|
</el-menu>
|
||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
|
|||||||
@@ -18,36 +18,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@-webkit-keyframes rotate {
|
|
||||||
from {
|
|
||||||
-webkit-transform: rotate(0deg);
|
|
||||||
}
|
|
||||||
|
|
||||||
to {
|
|
||||||
-webkit-transform: rotate(360deg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@-moz-keyframes rotate {
|
|
||||||
from {
|
|
||||||
-moz-transform: rotate(0deg);
|
|
||||||
}
|
|
||||||
|
|
||||||
to {
|
|
||||||
-moz-transform: rotate(360deg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@-o-keyframes rotate {
|
|
||||||
from {
|
|
||||||
-o-transform: rotate(0deg);
|
|
||||||
}
|
|
||||||
|
|
||||||
to {
|
|
||||||
-o-transform: rotate(360deg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes rotate {
|
@keyframes rotate {
|
||||||
from {
|
from {
|
||||||
transform: rotate(0deg);
|
transform: rotate(0deg);
|
||||||
@@ -80,7 +50,7 @@
|
|||||||
|
|
||||||
.scroll-item {
|
.scroll-item {
|
||||||
border-radius: 3px 3px 0 0;
|
border-radius: 3px 3px 0 0;
|
||||||
padding: 0 6px 0 6px;
|
padding: 0 6px;
|
||||||
box-shadow: 0 0 1px #888;
|
box-shadow: 0 0 1px #888;
|
||||||
position: relative;
|
position: relative;
|
||||||
margin-right: 4px;
|
margin-right: 4px;
|
||||||
@@ -92,7 +62,7 @@
|
|||||||
|
|
||||||
.el-icon-close {
|
.el-icon-close {
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
color: #1890ff;
|
color: var(--el-color-primary);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
@@ -123,7 +93,7 @@
|
|||||||
a {
|
a {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
color: #666;
|
color: #666;
|
||||||
padding: 0 4px 0 4px;
|
padding: 0 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.scroll-container {
|
.scroll-container {
|
||||||
@@ -190,7 +160,8 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background: #eee;
|
background: var(--el-color-primary-light-9);
|
||||||
|
color: var(--el-color-primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
svg {
|
svg {
|
||||||
@@ -236,7 +207,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.scroll-item.is-active {
|
.scroll-item.is-active {
|
||||||
background-color: #eaf4fe;
|
background-color: var(--el-color-primary-light-9);
|
||||||
position: relative;
|
position: relative;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
|
|
||||||
@@ -249,17 +220,27 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
color: #1890ff;
|
color: var(--el-color-primary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.ri-arrow-left-s-line {
|
.arrow-left,
|
||||||
|
.arrow-right {
|
||||||
width: 40px;
|
width: 40px;
|
||||||
height: 38px;
|
height: 38px;
|
||||||
line-height: 38px;
|
|
||||||
text-align: center;
|
|
||||||
font-size: 20px;
|
|
||||||
color: #00000073;
|
color: #00000073;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
svg {
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
position: absolute;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, 50%);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.arrow-left {
|
||||||
box-shadow: 5px 0 5px -6px #ccc;
|
box-shadow: 5px 0 5px -6px #ccc;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
@@ -267,15 +248,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.ri-arrow-right-s-line {
|
.arrow-right {
|
||||||
width: 40px;
|
|
||||||
height: 38px;
|
|
||||||
line-height: 38px;
|
|
||||||
text-align: center;
|
|
||||||
font-size: 20px;
|
|
||||||
border-right: 1px solid #ccc;
|
|
||||||
color: #00000073;
|
|
||||||
box-shadow: -5px 0 5px -6px #ccc;
|
box-shadow: -5px 0 5px -6px #ccc;
|
||||||
|
border-right: 1px solid #ccc;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
cursor: e-resize;
|
cursor: e-resize;
|
||||||
@@ -284,10 +259,10 @@
|
|||||||
|
|
||||||
/* 卡片模式下鼠标移入显示蓝色边框 */
|
/* 卡片模式下鼠标移入显示蓝色边框 */
|
||||||
.card-in {
|
.card-in {
|
||||||
color: #1890ff;
|
color: var(--el-color-primary);
|
||||||
|
|
||||||
a {
|
a {
|
||||||
color: #1890ff;
|
color: var(--el-color-primary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -308,7 +283,7 @@
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
left: 0;
|
left: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
background: #1890ff;
|
background: var(--el-color-primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 灵动模式下鼠标移入显示蓝色进度条 */
|
/* 灵动模式下鼠标移入显示蓝色进度条 */
|
||||||
@@ -318,7 +293,7 @@
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
left: 0;
|
left: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
background: #1890ff;
|
background: var(--el-color-primary);
|
||||||
animation: scheduleInWidth 400ms ease-in;
|
animation: scheduleInWidth 400ms ease-in;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -329,14 +304,11 @@
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
left: 0;
|
left: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
background: #1890ff;
|
background: var(--el-color-primary);
|
||||||
animation: scheduleOutWidth 400ms ease-in;
|
animation: scheduleOutWidth 400ms ease-in;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 刷新按钮动画效果 */
|
/* 刷新按钮动画效果 */
|
||||||
.refresh-button {
|
.refresh-button {
|
||||||
-webkit-animation: rotate 600ms linear infinite;
|
|
||||||
-moz-animation: rotate 600ms linear infinite;
|
|
||||||
-o-animation: rotate 600ms linear infinite;
|
|
||||||
animation: rotate 600ms linear infinite;
|
animation: rotate 600ms linear infinite;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,11 +40,11 @@ const activeIndex = ref<number>(-1);
|
|||||||
let refreshButton = "refresh-button";
|
let refreshButton = "refresh-button";
|
||||||
const instance = getCurrentInstance();
|
const instance = getCurrentInstance();
|
||||||
const pureSetting = useSettingStoreHook();
|
const pureSetting = useSettingStoreHook();
|
||||||
const showTags = ref(storageLocal.getItem("tagsVal") || false);
|
|
||||||
const tabDom = templateRef<HTMLElement | null>("tabDom", null);
|
const tabDom = templateRef<HTMLElement | null>("tabDom", null);
|
||||||
const containerDom = templateRef<HTMLElement | null>("containerDom", null);
|
const containerDom = templateRef<HTMLElement | null>("containerDom", null);
|
||||||
const scrollbarDom = templateRef<HTMLElement | null>("scrollbarDom", null);
|
const scrollbarDom = templateRef<HTMLElement | null>("scrollbarDom", null);
|
||||||
|
const showTags =
|
||||||
|
ref(storageLocal.getItem("responsive-configure").hideTabs) ?? "false";
|
||||||
let multiTags: ComputedRef<Array<RouteConfigs>> = computed(() => {
|
let multiTags: ComputedRef<Array<RouteConfigs>> = computed(() => {
|
||||||
return useMultiTagsStoreHook()?.multiTags;
|
return useMultiTagsStoreHook()?.multiTags;
|
||||||
});
|
});
|
||||||
@@ -106,7 +106,11 @@ const iconIsActive = computed(() => {
|
|||||||
|
|
||||||
const dynamicTagView = () => {
|
const dynamicTagView = () => {
|
||||||
const index = multiTags.value.findIndex(item => {
|
const index = multiTags.value.findIndex(item => {
|
||||||
return item.path === route.path;
|
if (item?.query) {
|
||||||
|
return isEqual(route?.query, item?.query);
|
||||||
|
} else {
|
||||||
|
return item.path === route.path;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
moveToView(index);
|
moveToView(index);
|
||||||
};
|
};
|
||||||
@@ -129,14 +133,14 @@ const moveToView = (index: number): void => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const tabItemEl = instance.refs["dynamic" + index][0];
|
const tabItemEl = instance.refs["dynamic" + index][0];
|
||||||
const tabItemElOffsetLeft = (tabItemEl as HTMLElement).offsetLeft;
|
const tabItemElOffsetLeft = (tabItemEl as HTMLElement)?.offsetLeft;
|
||||||
const tabItemOffsetWidth = (tabItemEl as HTMLElement).offsetWidth;
|
const tabItemOffsetWidth = (tabItemEl as HTMLElement)?.offsetWidth;
|
||||||
// 标签页导航栏可视长度(不包含溢出部分)
|
// 标签页导航栏可视长度(不包含溢出部分)
|
||||||
const scrollbarDomWidth = scrollbarDom.value
|
const scrollbarDomWidth = scrollbarDom.value
|
||||||
? scrollbarDom.value.offsetWidth
|
? scrollbarDom.value?.offsetWidth
|
||||||
: 0;
|
: 0;
|
||||||
// 已有标签页总长度(包含溢出部分)
|
// 已有标签页总长度(包含溢出部分)
|
||||||
const tabDomWidth = tabDom.value ? tabDom.value.offsetWidth : 0;
|
const tabDomWidth = tabDom.value ? tabDom.value?.offsetWidth : 0;
|
||||||
|
|
||||||
if (tabDomWidth < scrollbarDomWidth || tabItemElOffsetLeft === 0) {
|
if (tabDomWidth < scrollbarDomWidth || tabItemElOffsetLeft === 0) {
|
||||||
translateX.value = 0;
|
translateX.value = 0;
|
||||||
@@ -314,8 +318,7 @@ function deleteDynamicTag(obj: any, current: any, tag?: string) {
|
|||||||
meta: {
|
meta: {
|
||||||
title: "menus.hshome",
|
title: "menus.hshome",
|
||||||
i18n: true,
|
i18n: true,
|
||||||
icon: "el-icon-s-home",
|
icon: "home-filled"
|
||||||
showLink: true
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
obj
|
obj
|
||||||
@@ -424,6 +427,11 @@ function onClickDrop(key, item, selectRoute?: RouteConfigs) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleCommand(command: object) {
|
||||||
|
const { key, item } = command;
|
||||||
|
onClickDrop(key, item);
|
||||||
|
}
|
||||||
|
|
||||||
// 触发右键中菜单的点击事件
|
// 触发右键中菜单的点击事件
|
||||||
function selectTag(key, item) {
|
function selectTag(key, item) {
|
||||||
onClickDrop(key, item, currentSelect.value);
|
onClickDrop(key, item, currentSelect.value);
|
||||||
@@ -470,7 +478,6 @@ function showMenuModel(
|
|||||||
* currentIndex为1时,左侧的菜单是首页,则不显示关闭左侧标签页
|
* currentIndex为1时,左侧的菜单是首页,则不显示关闭左侧标签页
|
||||||
* 如果currentIndex等于routeLength-1,右侧没有菜单,则不显示关闭右侧标签页
|
* 如果currentIndex等于routeLength-1,右侧没有菜单,则不显示关闭右侧标签页
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (currentIndex === 1 && routeLength !== 2) {
|
if (currentIndex === 1 && routeLength !== 2) {
|
||||||
// 左侧的菜单是首页,右侧存在别的菜单
|
// 左侧的菜单是首页,右侧存在别的菜单
|
||||||
tagsViews[2].show = false;
|
tagsViews[2].show = false;
|
||||||
@@ -631,7 +638,9 @@ const getContextMenuStyle = computed((): CSSProperties => {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div ref="containerDom" class="tags-view" v-if="!showTags">
|
<div ref="containerDom" class="tags-view" v-if="!showTags">
|
||||||
<i class="ri-arrow-left-s-line" @click="handleScroll(200)"></i>
|
<div class="arrow-left">
|
||||||
|
<IconifyIconOffline icon="arrow-left-s-line" @click="handleScroll(200)" />
|
||||||
|
</div>
|
||||||
<div ref="scrollbarDom" class="scroll-container">
|
<div ref="scrollbarDom" class="scroll-container">
|
||||||
<div class="tab" ref="tabDom" :style="getTabStyle">
|
<div class="tab" ref="tabDom" :style="getTabStyle">
|
||||||
<div
|
<div
|
||||||
@@ -671,7 +680,12 @@ const getContextMenuStyle = computed((): CSSProperties => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<i class="ri-arrow-right-s-line" @click="handleScroll(-200)"></i>
|
<span class="arrow-right">
|
||||||
|
<IconifyIconOffline
|
||||||
|
icon="arrow-right-s-line"
|
||||||
|
@click="handleScroll(-200)"
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
<!-- 右键菜单按钮 -->
|
<!-- 右键菜单按钮 -->
|
||||||
<transition name="el-zoom-in-top">
|
<transition name="el-zoom-in-top">
|
||||||
<ul
|
<ul
|
||||||
@@ -704,7 +718,11 @@ const getContextMenuStyle = computed((): CSSProperties => {
|
|||||||
</el-icon>
|
</el-icon>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<el-dropdown trigger="click" placement="bottom-end">
|
<el-dropdown
|
||||||
|
trigger="click"
|
||||||
|
placement="bottom-end"
|
||||||
|
@command="handleCommand"
|
||||||
|
>
|
||||||
<el-icon>
|
<el-icon>
|
||||||
<IconifyIconOffline icon="arrow-down" />
|
<IconifyIconOffline icon="arrow-down" />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
@@ -713,11 +731,15 @@ const getContextMenuStyle = computed((): CSSProperties => {
|
|||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
v-for="(item, key) in tagsViews"
|
v-for="(item, key) in tagsViews"
|
||||||
:key="key"
|
:key="key"
|
||||||
|
:command="{ key, item }"
|
||||||
:divided="item.divided"
|
:divided="item.divided"
|
||||||
:disabled="item.disabled"
|
:disabled="item.disabled"
|
||||||
@click="onClickDrop(key, item)"
|
|
||||||
>
|
>
|
||||||
<component :is="item.icon" :key="key" />
|
<component
|
||||||
|
:is="item.icon"
|
||||||
|
:key="key"
|
||||||
|
style="margin-right: 6px"
|
||||||
|
/>
|
||||||
{{ $t(item.text) }}
|
{{ $t(item.text) }}
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
|
|||||||
110
src/layout/hooks/nav.ts
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
import { computed } from "vue";
|
||||||
|
import { router } from "/@/router";
|
||||||
|
import { emitter } from "/@/utils/mitt";
|
||||||
|
import { routeMetaType } from "../types";
|
||||||
|
import { transformI18n } from "/@/plugins/i18n";
|
||||||
|
import { storageSession } from "/@/utils/storage";
|
||||||
|
import { useAppStoreHook } from "/@/store/modules/app";
|
||||||
|
import { Title } from "../../../public/serverConfig.json";
|
||||||
|
import { useEpThemeStoreHook } from "/@/store/modules/epTheme";
|
||||||
|
|
||||||
|
export function useNav() {
|
||||||
|
const pureApp = useAppStoreHook();
|
||||||
|
// 用户名
|
||||||
|
const usename: string = storageSession.getItem("info")?.username;
|
||||||
|
|
||||||
|
// 设置国际化选中后的样式
|
||||||
|
const getDropdownItemStyle = computed(() => {
|
||||||
|
return (locale, t) => {
|
||||||
|
return {
|
||||||
|
background: locale === t ? useEpThemeStoreHook().epThemeColor : "",
|
||||||
|
color: locale === t ? "#f4f4f5" : "#000"
|
||||||
|
};
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
const isCollapse = computed(() => {
|
||||||
|
return !pureApp.getSidebarStatus;
|
||||||
|
});
|
||||||
|
|
||||||
|
// 动态title
|
||||||
|
function changeTitle(meta: routeMetaType) {
|
||||||
|
if (Title)
|
||||||
|
document.title = `${transformI18n(meta.title, meta.i18n)} | ${Title}`;
|
||||||
|
else document.title = transformI18n(meta.title, meta.i18n);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 退出登录
|
||||||
|
function logout() {
|
||||||
|
storageSession.removeItem("info");
|
||||||
|
router.push("/login");
|
||||||
|
}
|
||||||
|
|
||||||
|
function backHome() {
|
||||||
|
router.push("/welcome");
|
||||||
|
}
|
||||||
|
|
||||||
|
function onPanel() {
|
||||||
|
emitter.emit("openPanel");
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleSideBar() {
|
||||||
|
pureApp.toggleSideBar();
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleResize(menuRef) {
|
||||||
|
menuRef.handleResize();
|
||||||
|
}
|
||||||
|
|
||||||
|
function resolvePath(route) {
|
||||||
|
const httpReg = /^http(s?):\/\//;
|
||||||
|
const routeChildPath = route.children[0]?.path;
|
||||||
|
if (httpReg.test(routeChildPath)) {
|
||||||
|
return route.path + "/" + routeChildPath;
|
||||||
|
} else {
|
||||||
|
return routeChildPath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function menuSelect(indexPath: string, routers): void {
|
||||||
|
let parentPath = "";
|
||||||
|
const parentPathIndex = indexPath.lastIndexOf("/");
|
||||||
|
if (parentPathIndex > 0) {
|
||||||
|
parentPath = indexPath.slice(0, parentPathIndex);
|
||||||
|
}
|
||||||
|
// 找到当前路由的信息
|
||||||
|
function findCurrentRoute(indexPath: string, routes) {
|
||||||
|
return routes.map(item => {
|
||||||
|
if (item.path === indexPath) {
|
||||||
|
if (item.redirect) {
|
||||||
|
findCurrentRoute(item.redirect, item.children);
|
||||||
|
} else {
|
||||||
|
// 切换左侧菜单 通知标签页
|
||||||
|
emitter.emit("changLayoutRoute", {
|
||||||
|
indexPath,
|
||||||
|
parentPath
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (item.children) findCurrentRoute(indexPath, item.children);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
findCurrentRoute(indexPath, routers);
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
logout,
|
||||||
|
backHome,
|
||||||
|
onPanel,
|
||||||
|
changeTitle,
|
||||||
|
toggleSideBar,
|
||||||
|
menuSelect,
|
||||||
|
handleResize,
|
||||||
|
resolvePath,
|
||||||
|
isCollapse,
|
||||||
|
pureApp,
|
||||||
|
usename,
|
||||||
|
getDropdownItemStyle
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -171,7 +171,8 @@ const layoutHeader = defineComponent({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
default: () => [
|
default: () => [
|
||||||
!pureSetting.hiddenSideBar && layout.value.includes("vertical")
|
!pureSetting.hiddenSideBar &&
|
||||||
|
(layout.value.includes("vertical") || layout.value.includes("mix"))
|
||||||
? h(navbar)
|
? h(navbar)
|
||||||
: h("div"),
|
: h("div"),
|
||||||
!pureSetting.hiddenSideBar && layout.value.includes("horizontal")
|
!pureSetting.hiddenSideBar && layout.value.includes("horizontal")
|
||||||
@@ -213,7 +214,10 @@ const layoutHeader = defineComponent({
|
|||||||
@click="useAppStoreHook().toggleSideBar()"
|
@click="useAppStoreHook().toggleSideBar()"
|
||||||
/>
|
/>
|
||||||
<Vertical
|
<Vertical
|
||||||
v-show="!pureSetting.hiddenSideBar && layout.includes('vertical')"
|
v-show="
|
||||||
|
!pureSetting.hiddenSideBar &&
|
||||||
|
(layout.includes('vertical') || layout.includes('mix'))
|
||||||
|
"
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
:class="[
|
:class="[
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ $subMenuBg: #0f0303 !default;
|
|||||||
/* 有无子集的激活菜单背景 */
|
/* 有无子集的激活菜单背景 */
|
||||||
$subMenuActiveBg: #4091f7 !default;
|
$subMenuActiveBg: #4091f7 !default;
|
||||||
$navTextColor: #fff !default;
|
$navTextColor: #fff !default;
|
||||||
$menuText: rgba(254, 254, 254, 0.65) !default;
|
$menuText: rgb(254 254 254 / 65%) !default;
|
||||||
|
|
||||||
/* logo背景颜色 */
|
/* logo背景颜色 */
|
||||||
$sidebarLogo: #002140 !default;
|
$sidebarLogo: #002140 !default;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ $menuHover: #e13c39;
|
|||||||
$subMenuBg: #000;
|
$subMenuBg: #000;
|
||||||
$subMenuActiveBg: #e13c39;
|
$subMenuActiveBg: #e13c39;
|
||||||
$navTextColor: red;
|
$navTextColor: red;
|
||||||
$menuText: rgba(254, 254, 254, 0.651);
|
$menuText: rgb(254 254 254 / 65.1%);
|
||||||
$sidebarLogo: #42090c;
|
$sidebarLogo: #42090c;
|
||||||
$menuTitleHover: #fff;
|
$menuTitleHover: #fff;
|
||||||
$menuActiveBefore: #e13c39;
|
$menuActiveBefore: #e13c39;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* 动态改变element-plus主题色 */
|
/* 动态改变element-plus主题色 */
|
||||||
import rgbHex from "rgb-hex";
|
import rgbHex from "rgb-hex";
|
||||||
import color from "css-color-function";
|
import { convert } from "css-color-function";
|
||||||
import { TinyColor } from "@ctrl/tinycolor";
|
import { TinyColor } from "@ctrl/tinycolor";
|
||||||
import epCss from "element-plus/dist/index.css";
|
import epCss from "element-plus/dist/index.css";
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ export const createColors = (primary: string) => {
|
|||||||
};
|
};
|
||||||
Object.keys(formula).forEach(key => {
|
Object.keys(formula).forEach(key => {
|
||||||
const value = formula[key].replace(/primary/, primary);
|
const value = formula[key].replace(/primary/, primary);
|
||||||
colors[key] = "#" + rgbHex(color.convert(value));
|
colors[key] = "#" + rgbHex(convert(value));
|
||||||
});
|
});
|
||||||
return colors;
|
return colors;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ $menuHover: #e85f33;
|
|||||||
$subMenuBg: #0f0603;
|
$subMenuBg: #0f0603;
|
||||||
$subMenuActiveBg: #e85f33;
|
$subMenuActiveBg: #e85f33;
|
||||||
$navTextColor: #fff;
|
$navTextColor: #fff;
|
||||||
$menuText: rgba(254, 254, 254, 0.65);
|
$menuText: rgb(254 254 254 / 65%);
|
||||||
$sidebarLogo: #441708;
|
$sidebarLogo: #441708;
|
||||||
$menuTitleHover: #fff;
|
$menuTitleHover: #fff;
|
||||||
$menuActiveBefore: #e85f33;
|
$menuActiveBefore: #e85f33;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ $menuHover: #f6da4d;
|
|||||||
$subMenuBg: #0f0603;
|
$subMenuBg: #0f0603;
|
||||||
$subMenuActiveBg: #f6da4d;
|
$subMenuActiveBg: #f6da4d;
|
||||||
$navTextColor: #fff;
|
$navTextColor: #fff;
|
||||||
$menuText: rgba(254, 254, 254, 0.65);
|
$menuText: rgb(254 254 254 / 65%);
|
||||||
$sidebarLogo: #443b05;
|
$sidebarLogo: #443b05;
|
||||||
$menuTitleHover: #fff;
|
$menuTitleHover: #fff;
|
||||||
$menuActiveBefore: #f6da4d;
|
$menuActiveBefore: #f6da4d;
|
||||||
|
|||||||
@@ -6,24 +6,25 @@ export const routerArrays: Array<RouteConfigs> = [
|
|||||||
meta: {
|
meta: {
|
||||||
title: "menus.hshome",
|
title: "menus.hshome",
|
||||||
i18n: true,
|
i18n: true,
|
||||||
icon: "home-filled",
|
icon: "home-filled"
|
||||||
showLink: true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
export type routeMetaType = {
|
||||||
|
title?: string;
|
||||||
|
i18n?: boolean;
|
||||||
|
icon?: string;
|
||||||
|
showLink?: boolean;
|
||||||
|
savedPosition?: boolean;
|
||||||
|
authority?: Array<string>;
|
||||||
|
};
|
||||||
|
|
||||||
export type RouteConfigs = {
|
export type RouteConfigs = {
|
||||||
path?: string;
|
path?: string;
|
||||||
parentPath?: string;
|
parentPath?: string;
|
||||||
query?: object;
|
query?: object;
|
||||||
meta?: {
|
meta?: routeMetaType;
|
||||||
title?: string;
|
|
||||||
i18n?: boolean;
|
|
||||||
icon?: string;
|
|
||||||
showLink?: boolean;
|
|
||||||
savedPosition?: boolean;
|
|
||||||
authority?: Array<string>;
|
|
||||||
};
|
|
||||||
children?: RouteConfigs[];
|
children?: RouteConfigs[];
|
||||||
name?: string;
|
name?: string;
|
||||||
};
|
};
|
||||||
@@ -72,6 +73,8 @@ export type childrenType = {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
showTooltip?: boolean;
|
showTooltip?: boolean;
|
||||||
|
parentId?: number;
|
||||||
|
pathList?: number[];
|
||||||
};
|
};
|
||||||
|
|
||||||
export type themeColorsType = {
|
export type themeColorsType = {
|
||||||
|
|||||||
15
src/main.ts
@@ -5,7 +5,6 @@ import { getServerConfig } from "./config";
|
|||||||
import { createApp, Directive } from "vue";
|
import { createApp, Directive } from "vue";
|
||||||
import { usI18n } from "../src/plugins/i18n";
|
import { usI18n } from "../src/plugins/i18n";
|
||||||
import { MotionPlugin } from "@vueuse/motion";
|
import { MotionPlugin } from "@vueuse/motion";
|
||||||
import { useFontawesome } from "../src/plugins/fontawesome";
|
|
||||||
import { useElementPlus } from "../src/plugins/element-plus";
|
import { useElementPlus } from "../src/plugins/element-plus";
|
||||||
import { injectResponsiveStorage } from "/@/utils/storage/responsive";
|
import { injectResponsiveStorage } from "/@/utils/storage/responsive";
|
||||||
|
|
||||||
@@ -26,19 +25,19 @@ Object.keys(directives).forEach(key => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// 全局注册`@iconify/vue`图标库
|
// 全局注册`@iconify/vue`图标库
|
||||||
import { IconifyIconOffline, IconifyIconOnline } from "./components/ReIcon";
|
import {
|
||||||
|
IconifyIconOffline,
|
||||||
|
IconifyIconOnline,
|
||||||
|
FontIcon
|
||||||
|
} from "./components/ReIcon";
|
||||||
app.component("IconifyIconOffline", IconifyIconOffline);
|
app.component("IconifyIconOffline", IconifyIconOffline);
|
||||||
app.component("IconifyIconOnline", IconifyIconOnline);
|
app.component("IconifyIconOnline", IconifyIconOnline);
|
||||||
|
app.component("FontIcon", FontIcon);
|
||||||
|
|
||||||
getServerConfig(app).then(async config => {
|
getServerConfig(app).then(async config => {
|
||||||
injectResponsiveStorage(app, config);
|
injectResponsiveStorage(app, config);
|
||||||
setupStore(app);
|
setupStore(app);
|
||||||
app
|
app.use(router).use(MotionPlugin).use(useElementPlus).use(usI18n);
|
||||||
.use(router)
|
|
||||||
.use(MotionPlugin)
|
|
||||||
.use(useElementPlus)
|
|
||||||
.use(usI18n)
|
|
||||||
.use(useFontawesome);
|
|
||||||
await router.isReady();
|
await router.isReady();
|
||||||
app.mount("#app");
|
app.mount("#app");
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
import { App, Component } from "vue";
|
import { App, Component } from "vue";
|
||||||
import {
|
import {
|
||||||
ElTag,
|
ElTag,
|
||||||
ElAffix,
|
|
||||||
ElSkeleton,
|
|
||||||
ElBreadcrumb,
|
ElBreadcrumb,
|
||||||
ElBreadcrumbItem,
|
ElBreadcrumbItem,
|
||||||
ElScrollbar,
|
ElScrollbar,
|
||||||
@@ -10,30 +8,21 @@ import {
|
|||||||
ElButton,
|
ElButton,
|
||||||
ElCol,
|
ElCol,
|
||||||
ElRow,
|
ElRow,
|
||||||
ElSpace,
|
|
||||||
ElDivider,
|
ElDivider,
|
||||||
ElCard,
|
|
||||||
ElDropdown,
|
ElDropdown,
|
||||||
ElDialog,
|
|
||||||
ElMenu,
|
ElMenu,
|
||||||
ElMenuItem,
|
ElMenuItem,
|
||||||
ElDropdownItem,
|
ElDropdownItem,
|
||||||
ElDropdownMenu,
|
ElDropdownMenu,
|
||||||
ElIcon,
|
ElIcon,
|
||||||
ElInput,
|
ElInput,
|
||||||
ElForm,
|
|
||||||
ElFormItem,
|
|
||||||
ElPopover,
|
ElPopover,
|
||||||
ElPopper,
|
ElPopper,
|
||||||
ElTooltip,
|
ElTooltip,
|
||||||
ElDrawer,
|
ElDrawer,
|
||||||
ElPagination,
|
|
||||||
ElAlert,
|
|
||||||
ElRadio,
|
ElRadio,
|
||||||
ElRadioButton,
|
ElRadioButton,
|
||||||
ElRadioGroup,
|
ElRadioGroup,
|
||||||
ElDescriptions,
|
|
||||||
ElDescriptionsItem,
|
|
||||||
ElBacktop,
|
ElBacktop,
|
||||||
ElSwitch,
|
ElSwitch,
|
||||||
ElBadge,
|
ElBadge,
|
||||||
@@ -43,7 +32,6 @@ import {
|
|||||||
ElEmpty,
|
ElEmpty,
|
||||||
ElCollapse,
|
ElCollapse,
|
||||||
ElCollapseItem,
|
ElCollapseItem,
|
||||||
ElTreeV2,
|
|
||||||
// 指令
|
// 指令
|
||||||
ElLoading,
|
ElLoading,
|
||||||
ElInfiniteScroll
|
ElInfiniteScroll
|
||||||
@@ -54,8 +42,6 @@ const plugins = [ElLoading, ElInfiniteScroll];
|
|||||||
|
|
||||||
const components = [
|
const components = [
|
||||||
ElTag,
|
ElTag,
|
||||||
ElAffix,
|
|
||||||
ElSkeleton,
|
|
||||||
ElBreadcrumb,
|
ElBreadcrumb,
|
||||||
ElBreadcrumbItem,
|
ElBreadcrumbItem,
|
||||||
ElScrollbar,
|
ElScrollbar,
|
||||||
@@ -63,30 +49,21 @@ const components = [
|
|||||||
ElButton,
|
ElButton,
|
||||||
ElCol,
|
ElCol,
|
||||||
ElRow,
|
ElRow,
|
||||||
ElSpace,
|
|
||||||
ElDivider,
|
ElDivider,
|
||||||
ElCard,
|
|
||||||
ElDropdown,
|
ElDropdown,
|
||||||
ElDialog,
|
|
||||||
ElMenu,
|
ElMenu,
|
||||||
ElMenuItem,
|
ElMenuItem,
|
||||||
ElDropdownItem,
|
ElDropdownItem,
|
||||||
ElDropdownMenu,
|
ElDropdownMenu,
|
||||||
ElIcon,
|
ElIcon,
|
||||||
ElInput,
|
ElInput,
|
||||||
ElForm,
|
|
||||||
ElFormItem,
|
|
||||||
ElPopover,
|
ElPopover,
|
||||||
ElPopper,
|
ElPopper,
|
||||||
ElTooltip,
|
ElTooltip,
|
||||||
ElDrawer,
|
ElDrawer,
|
||||||
ElPagination,
|
|
||||||
ElAlert,
|
|
||||||
ElRadio,
|
ElRadio,
|
||||||
ElRadioButton,
|
ElRadioButton,
|
||||||
ElRadioGroup,
|
ElRadioGroup,
|
||||||
ElDescriptions,
|
|
||||||
ElDescriptionsItem,
|
|
||||||
ElBacktop,
|
ElBacktop,
|
||||||
ElSwitch,
|
ElSwitch,
|
||||||
ElBadge,
|
ElBadge,
|
||||||
@@ -95,8 +72,7 @@ const components = [
|
|||||||
ElAvatar,
|
ElAvatar,
|
||||||
ElEmpty,
|
ElEmpty,
|
||||||
ElCollapse,
|
ElCollapse,
|
||||||
ElCollapseItem,
|
ElCollapseItem
|
||||||
ElTreeV2
|
|
||||||
];
|
];
|
||||||
|
|
||||||
export function useElementPlus(app: App) {
|
export function useElementPlus(app: App) {
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
/** 兼容fontawesome4和5版本
|
|
||||||
* 4版本: www.fontawesome.com.cn/faicons/
|
|
||||||
* 5版本:https://fontawesome.com/v5.15/icons?d=gallery&p=2&m=free
|
|
||||||
* https://github.com/FortAwesome/vue-fontawesome
|
|
||||||
*/
|
|
||||||
import { App } from "vue";
|
|
||||||
import "font-awesome/css/font-awesome.css";
|
|
||||||
import { library } from "@fortawesome/fontawesome-svg-core";
|
|
||||||
import {
|
|
||||||
faUserSecret,
|
|
||||||
faCoffee,
|
|
||||||
faSpinner
|
|
||||||
} from "@fortawesome/free-solid-svg-icons";
|
|
||||||
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
|
|
||||||
// github.com/Remix-Design/RemixIcon/blob/master/README_CN.md#%E5%AE%89%E8%A3%85%E5%BC%95%E5%85%A5
|
|
||||||
import "remixicon/fonts/remixicon.css";
|
|
||||||
|
|
||||||
export function useFontawesome(app: App) {
|
|
||||||
library.add(faUserSecret, faCoffee, faSpinner);
|
|
||||||
app.component("font-awesome-icon", FontAwesomeIcon);
|
|
||||||
}
|
|
||||||
@@ -3,23 +3,9 @@ export default {
|
|||||||
hslogin: "Login",
|
hslogin: "Login",
|
||||||
hssysManagement: "System Manage",
|
hssysManagement: "System Manage",
|
||||||
hsBaseinfo: "Base Info",
|
hsBaseinfo: "Base Info",
|
||||||
hsDict: "Dict Manage",
|
|
||||||
hseditor: "Editor",
|
|
||||||
hserror: "Error Page",
|
hserror: "Error Page",
|
||||||
hsfourZeroFour: "404",
|
hsfourZeroFour: "404",
|
||||||
hsfourZeroOne: "401",
|
hsfourZeroOne: "401",
|
||||||
hscomponents: "Components",
|
|
||||||
hsvideo: "Video Components",
|
|
||||||
hsmap: "Map Components",
|
|
||||||
hsdraggable: "Draggable Components",
|
|
||||||
hssplitPane: "Split Pane",
|
|
||||||
hsbutton: "Button Components",
|
|
||||||
hscropping: "Picture Cropping",
|
|
||||||
hscountTo: "Digital Animation",
|
|
||||||
hsselector: "Selector Components",
|
|
||||||
hsflowChart: "Flow Chart",
|
|
||||||
hsseamless: "Seamless Scroll",
|
|
||||||
hscontextmenu: "Context Menu",
|
|
||||||
hsmenus: "MultiLevel Menu",
|
hsmenus: "MultiLevel Menu",
|
||||||
hsmenu1: "Menu1",
|
hsmenu1: "Menu1",
|
||||||
"hsmenu1-1": "Menu1-1",
|
"hsmenu1-1": "Menu1-1",
|
||||||
@@ -31,8 +17,5 @@ export default {
|
|||||||
permission: "Permission Manage",
|
permission: "Permission Manage",
|
||||||
permissionPage: "Page Permission",
|
permissionPage: "Page Permission",
|
||||||
permissionButton: "Button Permission",
|
permissionButton: "Button Permission",
|
||||||
hstabs: "Tabs Operate",
|
|
||||||
hsMenuTree: "Menu Tree",
|
|
||||||
hsguide: "Guide",
|
|
||||||
externalLink: "External Link"
|
externalLink: "External Link"
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -11,7 +11,10 @@ import { storageLocal } from "/@/utils/storage";
|
|||||||
* @param isI18n 如果true,获取对应的消息,否则返回本身
|
* @param isI18n 如果true,获取对应的消息,否则返回本身
|
||||||
* @returns message
|
* @returns message
|
||||||
*/
|
*/
|
||||||
export function transformI18n(message: string | object = "", isI18n = false) {
|
export function transformI18n(
|
||||||
|
message: string | unknown | object = "",
|
||||||
|
isI18n: boolean | unknown = false
|
||||||
|
) {
|
||||||
if (!message) {
|
if (!message) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,23 +3,9 @@ export default {
|
|||||||
hslogin: "登陆",
|
hslogin: "登陆",
|
||||||
hssysManagement: "系统管理",
|
hssysManagement: "系统管理",
|
||||||
hsBaseinfo: "基础信息",
|
hsBaseinfo: "基础信息",
|
||||||
hsDict: "字典管理",
|
|
||||||
hseditor: "编辑器",
|
|
||||||
hserror: "错误页面",
|
hserror: "错误页面",
|
||||||
hsfourZeroFour: "404",
|
hsfourZeroFour: "404",
|
||||||
hsfourZeroOne: "401",
|
hsfourZeroOne: "401",
|
||||||
hscomponents: "组件",
|
|
||||||
hsvideo: "视频组件",
|
|
||||||
hsmap: "地图组件",
|
|
||||||
hsdraggable: "拖拽组件",
|
|
||||||
hssplitPane: "切割面板",
|
|
||||||
hsbutton: "按钮组件",
|
|
||||||
hscropping: "图片裁剪",
|
|
||||||
hscountTo: "数字动画",
|
|
||||||
hsselector: "选择器组件",
|
|
||||||
hsflowChart: "流程图",
|
|
||||||
hsseamless: "无缝滚动",
|
|
||||||
hscontextmenu: "右键菜单",
|
|
||||||
hsmenus: "多级菜单",
|
hsmenus: "多级菜单",
|
||||||
hsmenu1: "菜单1",
|
hsmenu1: "菜单1",
|
||||||
"hsmenu1-1": "菜单1-1",
|
"hsmenu1-1": "菜单1-1",
|
||||||
@@ -31,8 +17,5 @@ export default {
|
|||||||
permission: "权限管理",
|
permission: "权限管理",
|
||||||
permissionPage: "页面权限",
|
permissionPage: "页面权限",
|
||||||
permissionButton: "按钮权限",
|
permissionButton: "按钮权限",
|
||||||
hstabs: "标签页操作",
|
|
||||||
hsMenuTree: "菜单树结构",
|
|
||||||
hsguide: "引导页",
|
|
||||||
externalLink: "外链"
|
externalLink: "外链"
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { split, findIndex } from "lodash-es";
|
|||||||
import { transformI18n } from "/@/plugins/i18n";
|
import { transformI18n } from "/@/plugins/i18n";
|
||||||
import remainingRouter from "./modules/remaining";
|
import remainingRouter from "./modules/remaining";
|
||||||
import { storageSession } from "/@/utils/storage";
|
import { storageSession } from "/@/utils/storage";
|
||||||
|
import { Title } from "../../public/serverConfig.json";
|
||||||
import { useMultiTagsStoreHook } from "/@/store/modules/multiTags";
|
import { useMultiTagsStoreHook } from "/@/store/modules/multiTags";
|
||||||
import { usePermissionStoreHook } from "/@/store/modules/permission";
|
import { usePermissionStoreHook } from "/@/store/modules/permission";
|
||||||
import { Router, RouteMeta, createRouter, RouteRecordName } from "vue-router";
|
import { Router, RouteMeta, createRouter, RouteRecordName } from "vue-router";
|
||||||
@@ -54,12 +55,13 @@ router.beforeEach((to: toRouteType, _from, next) => {
|
|||||||
const externalLink = to?.redirectedFrom?.fullPath;
|
const externalLink = to?.redirectedFrom?.fullPath;
|
||||||
if (!externalLink)
|
if (!externalLink)
|
||||||
to.matched.some(item => {
|
to.matched.some(item => {
|
||||||
item.meta.title
|
if (!item.meta.title) return "";
|
||||||
? (document.title = transformI18n(
|
if (Title)
|
||||||
item.meta.title as string,
|
document.title = `${transformI18n(
|
||||||
item.meta?.i18n as boolean
|
item.meta.title,
|
||||||
))
|
item.meta?.i18n
|
||||||
: "";
|
)} | ${Title}`;
|
||||||
|
else document.title = transformI18n(item.meta.title, item.meta?.i18n);
|
||||||
});
|
});
|
||||||
if (name) {
|
if (name) {
|
||||||
if (_from?.name) {
|
if (_from?.name) {
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ const errorRouter = {
|
|||||||
meta: {
|
meta: {
|
||||||
icon: "position",
|
icon: "position",
|
||||||
title: $t("menus.hserror"),
|
title: $t("menus.hserror"),
|
||||||
showLink: true,
|
|
||||||
i18n: true,
|
i18n: true,
|
||||||
rank: 7
|
rank: 7
|
||||||
},
|
},
|
||||||
@@ -20,8 +19,7 @@ const errorRouter = {
|
|||||||
component: () => import("/@/views/error/401.vue"),
|
component: () => import("/@/views/error/401.vue"),
|
||||||
meta: {
|
meta: {
|
||||||
title: $t("menus.hsfourZeroOne"),
|
title: $t("menus.hsfourZeroOne"),
|
||||||
i18n: true,
|
i18n: true
|
||||||
showLink: true
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -30,8 +28,7 @@ const errorRouter = {
|
|||||||
component: () => import("/@/views/error/404.vue"),
|
component: () => import("/@/views/error/404.vue"),
|
||||||
meta: {
|
meta: {
|
||||||
title: $t("menus.hsfourZeroFour"),
|
title: $t("menus.hsfourZeroFour"),
|
||||||
i18n: true,
|
i18n: true
|
||||||
showLink: true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ const externalLink = {
|
|||||||
meta: {
|
meta: {
|
||||||
icon: "link",
|
icon: "link",
|
||||||
title: $t("menus.externalLink"),
|
title: $t("menus.externalLink"),
|
||||||
showLink: true,
|
|
||||||
i18n: true,
|
i18n: true,
|
||||||
rank: 190
|
rank: 190
|
||||||
},
|
},
|
||||||
@@ -17,7 +16,6 @@ const externalLink = {
|
|||||||
path: "https://github.com/xiaoxian521/vue-pure-admin",
|
path: "https://github.com/xiaoxian521/vue-pure-admin",
|
||||||
meta: {
|
meta: {
|
||||||
title: $t("menus.externalLink"),
|
title: $t("menus.externalLink"),
|
||||||
showLink: true,
|
|
||||||
i18n: true,
|
i18n: true,
|
||||||
rank: 191
|
rank: 191
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ const homeRouter = {
|
|||||||
meta: {
|
meta: {
|
||||||
icon: "home-filled",
|
icon: "home-filled",
|
||||||
title: $t("menus.hshome"),
|
title: $t("menus.hshome"),
|
||||||
showLink: true,
|
|
||||||
i18n: true,
|
i18n: true,
|
||||||
rank: 0
|
rank: 0
|
||||||
},
|
},
|
||||||
@@ -20,8 +19,7 @@ const homeRouter = {
|
|||||||
component: () => import("/@/views/welcome.vue"),
|
component: () => import("/@/views/welcome.vue"),
|
||||||
meta: {
|
meta: {
|
||||||
title: $t("menus.hshome"),
|
title: $t("menus.hshome"),
|
||||||
i18n: true,
|
i18n: true
|
||||||
showLink: true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -10,13 +10,14 @@ import {
|
|||||||
formatTwoStageRoutes,
|
formatTwoStageRoutes,
|
||||||
formatFlatteningRoutes
|
formatFlatteningRoutes
|
||||||
} from "../utils";
|
} from "../utils";
|
||||||
|
import { buildHierarchyTree } from "/@/utils/tree";
|
||||||
|
|
||||||
// 原始静态路由(未做任何处理)
|
// 原始静态路由(未做任何处理)
|
||||||
const routes = [homeRouter, errorRouter, externalLink];
|
const routes = [homeRouter, errorRouter, externalLink];
|
||||||
|
|
||||||
// 导出处理后的静态路由(三级及以上的路由全部拍成二级)
|
// 导出处理后的静态路由(三级及以上的路由全部拍成二级)
|
||||||
export const constantRoutes: Array<RouteRecordRaw> = formatTwoStageRoutes(
|
export const constantRoutes: Array<RouteRecordRaw> = formatTwoStageRoutes(
|
||||||
formatFlatteningRoutes(ascending(routes))
|
formatFlatteningRoutes(buildHierarchyTree(ascending(routes)))
|
||||||
);
|
);
|
||||||
|
|
||||||
// 用于渲染菜单,保持原始层级
|
// 用于渲染菜单,保持原始层级
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ function ascending(arr: any[]) {
|
|||||||
// 过滤meta中showLink为false的路由
|
// 过滤meta中showLink为false的路由
|
||||||
function filterTree(data: RouteComponent[]) {
|
function filterTree(data: RouteComponent[]) {
|
||||||
const newTree = data.filter(
|
const newTree = data.filter(
|
||||||
(v: { meta: { showLink: boolean } }) => v.meta.showLink
|
(v: { meta: { showLink: boolean } }) => v.meta?.showLink !== false
|
||||||
);
|
);
|
||||||
newTree.forEach(
|
newTree.forEach(
|
||||||
(v: { children }) => v.children && (v.children = filterTree(v.children))
|
(v: { children }) => v.children && (v.children = filterTree(v.children))
|
||||||
|
|||||||
@@ -8,16 +8,29 @@ export const useEpThemeStore = defineStore({
|
|||||||
state: () => ({
|
state: () => ({
|
||||||
epThemeColor:
|
epThemeColor:
|
||||||
storageLocal.getItem("responsive-layout")?.epThemeColor ??
|
storageLocal.getItem("responsive-layout")?.epThemeColor ??
|
||||||
getConfig().EpThemeColor
|
getConfig().EpThemeColor,
|
||||||
|
epTheme:
|
||||||
|
storageLocal.getItem("responsive-layout")?.theme ?? getConfig().Theme
|
||||||
}),
|
}),
|
||||||
getters: {
|
getters: {
|
||||||
getEpThemeColor() {
|
getEpThemeColor() {
|
||||||
return this.epThemeColor;
|
return this.epThemeColor;
|
||||||
|
},
|
||||||
|
// 用于mix导航模式下hamburger-svg的fill属性
|
||||||
|
fill() {
|
||||||
|
if (this.epTheme === "light") {
|
||||||
|
return "#409eff";
|
||||||
|
} else if (this.epTheme === "yellow") {
|
||||||
|
return "#d25f00";
|
||||||
|
} else {
|
||||||
|
return "#fff";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
setEpThemeColor(newColor) {
|
setEpThemeColor(newColor) {
|
||||||
const layout = storageLocal.getItem("responsive-layout");
|
const layout = storageLocal.getItem("responsive-layout");
|
||||||
|
this.epTheme = layout?.theme;
|
||||||
this.epThemeColor = newColor;
|
this.epThemeColor = newColor;
|
||||||
layout.epThemeColor = newColor;
|
layout.epThemeColor = newColor;
|
||||||
storageLocal.setItem("responsive-layout", layout);
|
storageLocal.setItem("responsive-layout", layout);
|
||||||
|
|||||||
@@ -17,8 +17,7 @@ export const useMultiTagsStore = defineStore({
|
|||||||
meta: {
|
meta: {
|
||||||
title: "menus.hshome",
|
title: "menus.hshome",
|
||||||
icon: "home-filled",
|
icon: "home-filled",
|
||||||
i18n: true,
|
i18n: true
|
||||||
showLink: true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -60,8 +60,7 @@ export const useUserStore = defineStore({
|
|||||||
meta: {
|
meta: {
|
||||||
title: "menus.hshome",
|
title: "menus.hshome",
|
||||||
icon: "home-filled",
|
icon: "home-filled",
|
||||||
i18n: true,
|
i18n: true
|
||||||
showLink: true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.el-overlay {
|
.el-overlay {
|
||||||
background-color: rgba(0, 0, 0, 0.05) !important;
|
background-color: rgb(0 0 0 / 5%) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-drawer {
|
.el-drawer {
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.el-dropdown-menu {
|
.el-dropdown-menu {
|
||||||
padding: 2px 0 2px 0 !important;
|
padding: 2px 0 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-range-separator {
|
.el-range-separator {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ body {
|
|||||||
padding: 0;
|
padding: 0;
|
||||||
-moz-osx-font-smoothing: grayscale;
|
-moz-osx-font-smoothing: grayscale;
|
||||||
-webkit-font-smoothing: antialiased;
|
-webkit-font-smoothing: antialiased;
|
||||||
text-rendering: optimizeLegibility;
|
text-rendering: optimizelegibility;
|
||||||
font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB,
|
font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB,
|
||||||
Microsoft YaHei, Arial, sans-serif;
|
Microsoft YaHei, Arial, sans-serif;
|
||||||
}
|
}
|
||||||
@@ -74,19 +74,11 @@ ul {
|
|||||||
/* 灰色模式 */
|
/* 灰色模式 */
|
||||||
.html-grey {
|
.html-grey {
|
||||||
filter: grayscale(100%);
|
filter: grayscale(100%);
|
||||||
-webkit-filter: grayscale(100%);
|
|
||||||
-moz-filter: grayscale(100%);
|
|
||||||
-ms-filter: grayscale(100%);
|
|
||||||
-o-filter: grayscale(100%);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 色弱模式 */
|
/* 色弱模式 */
|
||||||
.html-weakness {
|
.html-weakness {
|
||||||
filter: invert(80%);
|
filter: invert(80%);
|
||||||
-webkit-filter: invert(80%);
|
|
||||||
-moz-filter: invert(80%);
|
|
||||||
-ms-filter: invert(80%);
|
|
||||||
-o-filter: invert(80%);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.pc-spacing {
|
.pc-spacing {
|
||||||
|
|||||||
@@ -85,7 +85,7 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon i {
|
.icon svg {
|
||||||
color: #d9d9d9;
|
color: #d9d9d9;
|
||||||
transition: 0.5s;
|
transition: 0.5s;
|
||||||
}
|
}
|
||||||
@@ -107,7 +107,7 @@
|
|||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.input-group.focus .icon i {
|
.input-group.focus .icon svg {
|
||||||
color: #5392f0;
|
color: #5392f0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -306,6 +306,10 @@
|
|||||||
height: 48px;
|
height: 48px;
|
||||||
line-height: 48px;
|
line-height: 48px;
|
||||||
background: $menuBg;
|
background: $menuBg;
|
||||||
|
|
||||||
|
svg {
|
||||||
|
position: static !important;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.is-active > .el-sub-menu__title,
|
.is-active > .el-sub-menu__title,
|
||||||
@@ -498,9 +502,7 @@
|
|||||||
background-color: $menuActiveBefore;
|
background-color: $menuActiveBefore;
|
||||||
content: "";
|
content: "";
|
||||||
clear: both;
|
clear: both;
|
||||||
-webkit-transition: all 0.2s ease-in-out;
|
|
||||||
transition: all 0.2s ease-in-out;
|
transition: all 0.2s ease-in-out;
|
||||||
-webkit-transform: translateY(0);
|
|
||||||
transform: translateY(0);
|
transform: translateY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -513,9 +515,7 @@
|
|||||||
background-color: $menuActiveBefore;
|
background-color: $menuActiveBefore;
|
||||||
content: "";
|
content: "";
|
||||||
clear: both;
|
clear: both;
|
||||||
-webkit-transition: all 0.2s ease-in-out;
|
|
||||||
transition: all 0.2s ease-in-out;
|
transition: all 0.2s ease-in-out;
|
||||||
-webkit-transform: translateY(0);
|
|
||||||
transform: translateY(0);
|
transform: translateY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -526,7 +526,6 @@
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
height: 0;
|
height: 0;
|
||||||
width: 3px;
|
width: 3px;
|
||||||
-webkit-transform: translateY(-50%);
|
|
||||||
transform: translateY(-50%);
|
transform: translateY(-50%);
|
||||||
top: 50%;
|
top: 50%;
|
||||||
}
|
}
|
||||||
@@ -600,16 +599,6 @@ body[layout="vertical"] {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-sub-menu {
|
|
||||||
overflow: hidden;
|
|
||||||
|
|
||||||
& > .el-sub-menu__title {
|
|
||||||
.el-sub-menu__icon-arrow {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 菜单折叠 */
|
/* 菜单折叠 */
|
||||||
.el-menu--collapse {
|
.el-menu--collapse {
|
||||||
.el-sub-menu {
|
.el-sub-menu {
|
||||||
@@ -649,3 +638,64 @@ body[layout="horizontal"] {
|
|||||||
transition: none !important;
|
transition: none !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
body[layout="mix"] {
|
||||||
|
$sideBarWidth: 210px;
|
||||||
|
@include merge-style($sideBarWidth);
|
||||||
|
|
||||||
|
.el-menu {
|
||||||
|
--el-menu-hover-bg-color: transparent !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hideSidebar {
|
||||||
|
.fixed-header {
|
||||||
|
width: calc(100% - 54px);
|
||||||
|
transition: width 0.28s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-container {
|
||||||
|
width: 54px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-container {
|
||||||
|
margin-left: 54px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.submenu-title-noDropdown {
|
||||||
|
padding: 0 !important;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
.el-tooltip {
|
||||||
|
padding: 0 !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 菜单折叠 */
|
||||||
|
.el-menu--collapse {
|
||||||
|
.el-sub-menu {
|
||||||
|
& > .el-sub-menu__title {
|
||||||
|
& > span {
|
||||||
|
height: 0;
|
||||||
|
width: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
visibility: hidden;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 无子菜单 */
|
||||||
|
.el-menu-item [class^="el-icon"] {
|
||||||
|
right: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-sub-menu__title [class^="el-icon"] {
|
||||||
|
right: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.submenu-title-noDropdown {
|
||||||
|
background: transparent !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
interface ProxyAlgorithm {
|
|
||||||
increaseIndexes<T>(val: Array<T>): Array<T>;
|
|
||||||
}
|
|
||||||
|
|
||||||
class algorithmProxy implements ProxyAlgorithm {
|
|
||||||
constructor() {}
|
|
||||||
|
|
||||||
// 数组每一项添加索引字段
|
|
||||||
public increaseIndexes<T>(val: Array<T>): Array<T> {
|
|
||||||
return Object.keys(val)
|
|
||||||
.map(v => {
|
|
||||||
return {
|
|
||||||
...val[v],
|
|
||||||
key: v
|
|
||||||
};
|
|
||||||
})
|
|
||||||
.filter(v => v.meta && v.meta.showLink);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const algorithm = new algorithmProxy();
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
interface ProxyLoader {
|
|
||||||
loadCss(src: string): any;
|
|
||||||
loadScript(src: string): Promise<any>;
|
|
||||||
loadScriptConcurrent(src: Array<string>): Promise<any>;
|
|
||||||
}
|
|
||||||
|
|
||||||
class loaderProxy implements ProxyLoader {
|
|
||||||
constructor() {}
|
|
||||||
|
|
||||||
protected scriptLoaderCache: Array<string> = [];
|
|
||||||
|
|
||||||
public loadCss = (src: string): any => {
|
|
||||||
const element: HTMLLinkElement = document.createElement("link");
|
|
||||||
element.rel = "stylesheet";
|
|
||||||
element.href = src;
|
|
||||||
document.body.appendChild(element);
|
|
||||||
};
|
|
||||||
|
|
||||||
public loadScript = async (src: string): Promise<any> => {
|
|
||||||
if (this.scriptLoaderCache.includes(src)) {
|
|
||||||
return src;
|
|
||||||
} else {
|
|
||||||
const element: HTMLScriptElement = document.createElement("script");
|
|
||||||
element.src = src;
|
|
||||||
document.body.appendChild(element);
|
|
||||||
element.onload = () => {
|
|
||||||
return this.scriptLoaderCache.push(src);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
public loadScriptConcurrent = async (
|
|
||||||
srcList: Array<string>
|
|
||||||
): Promise<any> => {
|
|
||||||
if (Array.isArray(srcList)) {
|
|
||||||
const len: number = srcList.length;
|
|
||||||
if (len > 0) {
|
|
||||||
let count = 0;
|
|
||||||
srcList.map(src => {
|
|
||||||
if (src) {
|
|
||||||
this.loadScript(src).then(() => {
|
|
||||||
count++;
|
|
||||||
if (count === len) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export const loader = new loaderProxy();
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
import ResizeObserver from "resize-observer-polyfill";
|
|
||||||
|
|
||||||
const isServer = typeof window === "undefined";
|
|
||||||
|
|
||||||
const resizeHandler = (entries: any[]): void => {
|
|
||||||
for (const entry of entries) {
|
|
||||||
const listeners = entry.target.__resizeListeners__ || [];
|
|
||||||
if (listeners.length) {
|
|
||||||
listeners.forEach((fn: () => any) => {
|
|
||||||
fn();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export const addResizeListener = (element: any, fn: () => any): any => {
|
|
||||||
if (isServer) return;
|
|
||||||
if (!element.__resizeListeners__) {
|
|
||||||
element.__resizeListeners__ = [];
|
|
||||||
element.__ro__ = new ResizeObserver(resizeHandler);
|
|
||||||
element.__ro__.observe(element);
|
|
||||||
}
|
|
||||||
element.__resizeListeners__.push(fn);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const removeResizeListener = (element: any, fn: () => any): any => {
|
|
||||||
if (!element || !element.__resizeListeners__) return;
|
|
||||||
element.__resizeListeners__.splice(
|
|
||||||
element.__resizeListeners__.indexOf(fn),
|
|
||||||
1
|
|
||||||
);
|
|
||||||
if (!element.__resizeListeners__.length) {
|
|
||||||
element.__ro__.disconnect();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -20,7 +20,7 @@ export const injectResponsiveStorage = (app: App, config: ServerConfigs) => {
|
|||||||
theme: config.Theme ?? "default",
|
theme: config.Theme ?? "default",
|
||||||
darkMode: config.DarkMode ?? false,
|
darkMode: config.DarkMode ?? false,
|
||||||
sidebarStatus: config.SidebarStatus ?? true,
|
sidebarStatus: config.SidebarStatus ?? true,
|
||||||
epThemeColor: config.EpThemeColor ?? "409EFF"
|
epThemeColor: config.EpThemeColor ?? "#409EFF"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
configure: {
|
configure: {
|
||||||
@@ -47,8 +47,7 @@ export const injectResponsiveStorage = (app: App, config: ServerConfigs) => {
|
|||||||
meta: {
|
meta: {
|
||||||
title: "menus.hshome",
|
title: "menus.hshome",
|
||||||
i18n: true,
|
i18n: true,
|
||||||
icon: "home-filled",
|
icon: "home-filled"
|
||||||
showLink: true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
67
src/utils/tree.ts
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
/**
|
||||||
|
* 提取菜单树中的每一项uniqueId
|
||||||
|
* @param {Array} {menuTree 菜单树}
|
||||||
|
* @param {return}} expandedPaths 每一项uniqueId组成的数组
|
||||||
|
*/
|
||||||
|
const expandedPaths = [];
|
||||||
|
export function extractPathList(menuTree) {
|
||||||
|
if (!Array.isArray(menuTree)) {
|
||||||
|
console.warn("menuTree must be an array");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!menuTree || menuTree.length === 0) return;
|
||||||
|
for (const node of menuTree) {
|
||||||
|
const hasChildren = node.children && node.children.length > 0;
|
||||||
|
if (hasChildren) {
|
||||||
|
extractPathList(node.children);
|
||||||
|
}
|
||||||
|
expandedPaths.push(node.uniqueId);
|
||||||
|
}
|
||||||
|
return expandedPaths;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 如果父级下children的length为1,删除children并自动组建唯一uniqueId
|
||||||
|
* @param {Array} {menuTree 菜单树}
|
||||||
|
* @param {Array} {pathList 每一项的id组成的数组}
|
||||||
|
* @param {return}}
|
||||||
|
*/
|
||||||
|
export function deleteChildren(menuTree, pathList = []) {
|
||||||
|
if (!Array.isArray(menuTree)) {
|
||||||
|
console.warn("menuTree must be an array");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!menuTree || menuTree.length === 0) return;
|
||||||
|
for (const [key, node] of menuTree.entries()) {
|
||||||
|
if (node.children && node.children.length === 1) delete node.children;
|
||||||
|
node.id = key;
|
||||||
|
node.parentId = pathList.length ? pathList[pathList.length - 1] : null;
|
||||||
|
node.pathList = [...pathList, node.id];
|
||||||
|
node.uniqueId =
|
||||||
|
node.pathList.length > 1 ? node.pathList.join("-") : node.pathList[0];
|
||||||
|
const hasChildren = node.children && node.children.length > 0;
|
||||||
|
if (hasChildren) {
|
||||||
|
deleteChildren(node.children, node.pathList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return menuTree;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建层级关系
|
||||||
|
export function buildHierarchyTree(menuTree, pathList = []) {
|
||||||
|
if (!Array.isArray(menuTree)) {
|
||||||
|
console.warn("menuTree must be an array");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!menuTree || menuTree.length === 0) return;
|
||||||
|
for (const [key, node] of menuTree.entries()) {
|
||||||
|
node.id = key;
|
||||||
|
node.parentId = pathList.length ? pathList[pathList.length - 1] : null;
|
||||||
|
node.pathList = [...pathList, node.id];
|
||||||
|
const hasChildren = node.children && node.children.length > 0;
|
||||||
|
if (hasChildren) {
|
||||||
|
buildHierarchyTree(node.children, node.pathList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return menuTree;
|
||||||
|
}
|
||||||
@@ -1,43 +1,15 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, computed } from "vue";
|
import { ref } from "vue";
|
||||||
import { useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
import { initRouter } from "/@/router/utils";
|
import { initRouter } from "/@/router/utils";
|
||||||
import { storageSession } from "/@/utils/storage";
|
import { storageSession } from "/@/utils/storage";
|
||||||
import { addClass, removeClass } from "/@/utils/operate";
|
import { addClass, removeClass } from "/@/utils/operate";
|
||||||
import bg from "/@/assets/login/bg.png";
|
import bg from "/@/assets/login/bg.png";
|
||||||
import avatar from "/@/assets/login/avatar.svg?component";
|
import avatar from "/@/assets/login/avatar.svg?component";
|
||||||
import illustration0 from "/@/assets/login/illustration0.svg?component";
|
import illustration from "/@/assets/login/illustration.svg?component";
|
||||||
import illustration1 from "/@/assets/login/illustration1.svg?component";
|
|
||||||
import illustration2 from "/@/assets/login/illustration2.svg?component";
|
|
||||||
import illustration3 from "/@/assets/login/illustration3.svg?component";
|
|
||||||
import illustration4 from "/@/assets/login/illustration4.svg?component";
|
|
||||||
import illustration5 from "/@/assets/login/illustration5.svg?component";
|
|
||||||
import illustration6 from "/@/assets/login/illustration6.svg?component";
|
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
// eslint-disable-next-line vue/return-in-computed-property
|
|
||||||
const currentWeek = computed(() => {
|
|
||||||
switch (String(new Date().getDay())) {
|
|
||||||
case "0":
|
|
||||||
return illustration0;
|
|
||||||
case "1":
|
|
||||||
return illustration1;
|
|
||||||
case "2":
|
|
||||||
return illustration2;
|
|
||||||
case "3":
|
|
||||||
return illustration3;
|
|
||||||
case "4":
|
|
||||||
return illustration4;
|
|
||||||
case "5":
|
|
||||||
return illustration5;
|
|
||||||
case "6":
|
|
||||||
return illustration6;
|
|
||||||
default:
|
|
||||||
return illustration4;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
let user = ref("admin");
|
let user = ref("admin");
|
||||||
let pwd = ref("123456");
|
let pwd = ref("123456");
|
||||||
|
|
||||||
@@ -73,7 +45,7 @@ function onPwdBlur() {
|
|||||||
<img :src="bg" class="wave" />
|
<img :src="bg" class="wave" />
|
||||||
<div class="login-container">
|
<div class="login-container">
|
||||||
<div class="img">
|
<div class="img">
|
||||||
<component :is="currentWeek"></component>
|
<illustration />
|
||||||
</div>
|
</div>
|
||||||
<div class="login-box">
|
<div class="login-box">
|
||||||
<div class="login-form">
|
<div class="login-form">
|
||||||
@@ -110,7 +82,7 @@ function onPwdBlur() {
|
|||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<div class="icon">
|
<div class="icon">
|
||||||
<i class="fa fa-user"></i>
|
<IconifyIconOffline icon="fa-user" width="14" height="14" />
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<h5>用户名</h5>
|
<h5>用户名</h5>
|
||||||
@@ -139,7 +111,7 @@ function onPwdBlur() {
|
|||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<div class="icon">
|
<div class="icon">
|
||||||
<i class="fa fa-lock"></i>
|
<IconifyIconOffline icon="fa-lock" width="14" height="14" />
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<h5>密码</h5>
|
<h5>密码</h5>
|
||||||
|
|||||||
@@ -1,18 +1,20 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
root: true,
|
root: true,
|
||||||
plugins: ["stylelint-order"],
|
plugins: ["stylelint-order"],
|
||||||
|
customSyntax: "postcss-html",
|
||||||
extends: ["stylelint-config-standard", "stylelint-config-prettier"],
|
extends: ["stylelint-config-standard", "stylelint-config-prettier"],
|
||||||
rules: {
|
rules: {
|
||||||
|
"selector-class-pattern": null,
|
||||||
"selector-pseudo-class-no-unknown": [
|
"selector-pseudo-class-no-unknown": [
|
||||||
true,
|
true,
|
||||||
{
|
{
|
||||||
ignorePseudoClasses: ["deep"]
|
ignorePseudoClasses: ["global"]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"selector-pseudo-element-no-unknown": [
|
"selector-pseudo-element-no-unknown": [
|
||||||
true,
|
true,
|
||||||
{
|
{
|
||||||
ignorePseudoElements: ["v-deep", ":deep"]
|
ignorePseudoElements: ["v-deep"]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"at-rule-no-unknown": [
|
"at-rule-no-unknown": [
|
||||||
@@ -65,5 +67,26 @@ module.exports = {
|
|||||||
{ severity: "warning" }
|
{ severity: "warning" }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
ignoreFiles: ["**/*.js", "**/*.jsx", "**/*.tsx", "**/*.ts", "**/*.json"]
|
ignoreFiles: ["**/*.js", "**/*.jsx", "**/*.tsx", "**/*.ts", "**/*.json"],
|
||||||
|
overrides: [
|
||||||
|
{
|
||||||
|
files: ["*.vue", "**/*.vue", "*.html", "**/*.html"],
|
||||||
|
extends: ["stylelint-config-recommended", "stylelint-config-html"],
|
||||||
|
rules: {
|
||||||
|
"keyframes-name-pattern": null,
|
||||||
|
"selector-pseudo-class-no-unknown": [
|
||||||
|
true,
|
||||||
|
{
|
||||||
|
ignorePseudoClasses: ["deep", "global"]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"selector-pseudo-element-no-unknown": [
|
||||||
|
true,
|
||||||
|
{
|
||||||
|
ignorePseudoElements: ["v-deep", "v-global", "v-slotted"]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
};
|
};
|
||||||
|
|||||||
1
types/global.d.ts
vendored
@@ -11,6 +11,7 @@ declare module "vue" {
|
|||||||
export interface GlobalComponents {
|
export interface GlobalComponents {
|
||||||
IconifyIconOffline: typeof import("../src/components/ReIcon")["IconifyIconOffline"];
|
IconifyIconOffline: typeof import("../src/components/ReIcon")["IconifyIconOffline"];
|
||||||
IconifyIconOnline: typeof import("../src/components/ReIcon")["IconifyIconOnline"];
|
IconifyIconOnline: typeof import("../src/components/ReIcon")["IconifyIconOnline"];
|
||||||
|
FontIcon: typeof import("../src/components/ReIcon")["FontIcon"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
106
vite.config.ts
@@ -1,16 +1,7 @@
|
|||||||
import { resolve } from "path";
|
import { resolve } from "path";
|
||||||
import vue from "@vitejs/plugin-vue";
|
|
||||||
import svgLoader from "vite-svg-loader";
|
|
||||||
import legacy from "@vitejs/plugin-legacy";
|
|
||||||
import vueJsx from "@vitejs/plugin-vue-jsx";
|
|
||||||
import WindiCSS from "vite-plugin-windicss";
|
|
||||||
import { warpperEnv, regExps } from "./build";
|
import { warpperEnv, regExps } from "./build";
|
||||||
import liveReload from "vite-plugin-live-reload";
|
import { getPluginsList } from "./build/plugins";
|
||||||
import { viteMockServe } from "vite-plugin-mock";
|
|
||||||
import ElementPlus from "unplugin-element-plus/vite";
|
|
||||||
import removeConsole from "vite-plugin-remove-console";
|
|
||||||
import { UserConfigExport, ConfigEnv, loadEnv } from "vite";
|
import { UserConfigExport, ConfigEnv, loadEnv } from "vite";
|
||||||
import themePreprocessorPlugin from "@zougt/vite-plugin-theme-preprocessor";
|
|
||||||
|
|
||||||
// 当前执行node命令时文件夹的地址(工作目录)
|
// 当前执行node命令时文件夹的地址(工作目录)
|
||||||
const root: string = process.cwd();
|
const root: string = process.cwd();
|
||||||
@@ -36,7 +27,6 @@ export default ({ command, mode }: ConfigEnv): UserConfigExport => {
|
|||||||
VITE_PROXY_DOMAIN,
|
VITE_PROXY_DOMAIN,
|
||||||
VITE_PROXY_DOMAIN_REAL
|
VITE_PROXY_DOMAIN_REAL
|
||||||
} = warpperEnv(loadEnv(mode, root));
|
} = warpperEnv(loadEnv(mode, root));
|
||||||
const prodMock = true;
|
|
||||||
return {
|
return {
|
||||||
base: VITE_PUBLIC_PATH,
|
base: VITE_PUBLIC_PATH,
|
||||||
root,
|
root,
|
||||||
@@ -80,102 +70,16 @@ export default ({ command, mode }: ConfigEnv): UserConfigExport => {
|
|||||||
}
|
}
|
||||||
: null
|
: null
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: getPluginsList(command, VITE_LEGACY),
|
||||||
vue(),
|
|
||||||
// jsx、tsx语法支持
|
|
||||||
vueJsx(),
|
|
||||||
WindiCSS(),
|
|
||||||
// 线上环境删除console
|
|
||||||
removeConsole(),
|
|
||||||
// 修改layout文件夹下的文件时自动重载浏览器 解决 https://github.com/xiaoxian521/vue-pure-admin/issues/170
|
|
||||||
liveReload(["src/layout/**/*"]),
|
|
||||||
// 自定义主题
|
|
||||||
themePreprocessorPlugin({
|
|
||||||
scss: {
|
|
||||||
multipleScopeVars: [
|
|
||||||
{
|
|
||||||
scopeName: "layout-theme-default",
|
|
||||||
path: pathResolve("src/layout/theme/default-vars.scss")
|
|
||||||
},
|
|
||||||
{
|
|
||||||
scopeName: "layout-theme-light",
|
|
||||||
path: pathResolve("src/layout/theme/light-vars.scss")
|
|
||||||
},
|
|
||||||
{
|
|
||||||
scopeName: "layout-theme-dusk",
|
|
||||||
path: pathResolve("src/layout/theme/dusk-vars.scss")
|
|
||||||
},
|
|
||||||
{
|
|
||||||
scopeName: "layout-theme-volcano",
|
|
||||||
path: pathResolve("src/layout/theme/volcano-vars.scss")
|
|
||||||
},
|
|
||||||
{
|
|
||||||
scopeName: "layout-theme-yellow",
|
|
||||||
path: pathResolve("src/layout/theme/yellow-vars.scss")
|
|
||||||
},
|
|
||||||
{
|
|
||||||
scopeName: "layout-theme-mingQing",
|
|
||||||
path: pathResolve("src/layout/theme/mingQing-vars.scss")
|
|
||||||
},
|
|
||||||
{
|
|
||||||
scopeName: "layout-theme-auroraGreen",
|
|
||||||
path: pathResolve("src/layout/theme/auroraGreen-vars.scss")
|
|
||||||
},
|
|
||||||
{
|
|
||||||
scopeName: "layout-theme-pink",
|
|
||||||
path: pathResolve("src/layout/theme/pink-vars.scss")
|
|
||||||
},
|
|
||||||
{
|
|
||||||
scopeName: "layout-theme-saucePurple",
|
|
||||||
path: pathResolve("src/layout/theme/saucePurple-vars.scss")
|
|
||||||
}
|
|
||||||
],
|
|
||||||
// 默认取 multipleScopeVars[0].scopeName
|
|
||||||
defaultScopeName: "",
|
|
||||||
// 在生产模式是否抽取独立的主题css文件,extract为true以下属性有效
|
|
||||||
extract: true,
|
|
||||||
// 独立主题css文件的输出路径,默认取 viteConfig.build.assetsDir 相对于 (viteConfig.build.outDir)
|
|
||||||
outputDir: "",
|
|
||||||
// 会选取defaultScopeName对应的主题css文件在html添加link
|
|
||||||
themeLinkTagId: "head",
|
|
||||||
// "head"||"head-prepend" || "body" ||"body-prepend"
|
|
||||||
themeLinkTagInjectTo: "head",
|
|
||||||
// 是否对抽取的css文件内对应scopeName的权重类名移除
|
|
||||||
removeCssScopeName: false,
|
|
||||||
// 可以自定义css文件名称的函数
|
|
||||||
customThemeCssFileName: scopeName => scopeName
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
// svg组件化支持
|
|
||||||
svgLoader(),
|
|
||||||
ElementPlus({}),
|
|
||||||
// mock支持
|
|
||||||
viteMockServe({
|
|
||||||
mockPath: "mock",
|
|
||||||
localEnabled: command === "serve",
|
|
||||||
prodEnabled: command !== "serve" && prodMock,
|
|
||||||
injectCode: `
|
|
||||||
import { setupProdMockServer } from './mockProdServer';
|
|
||||||
setupProdMockServer();
|
|
||||||
`,
|
|
||||||
logger: true
|
|
||||||
}),
|
|
||||||
// 是否为打包后的文件提供传统浏览器兼容性支持
|
|
||||||
VITE_LEGACY
|
|
||||||
? legacy({
|
|
||||||
targets: ["ie >= 11"],
|
|
||||||
additionalLegacyPolyfills: ["regenerator-runtime/runtime"]
|
|
||||||
})
|
|
||||||
: null
|
|
||||||
],
|
|
||||||
optimizeDeps: {
|
optimizeDeps: {
|
||||||
include: [
|
include: [
|
||||||
"pinia",
|
"pinia",
|
||||||
"vue-i18n",
|
"vue-i18n",
|
||||||
"lodash-es",
|
"lodash-es",
|
||||||
"@vueuse/core",
|
"@vueuse/core",
|
||||||
"element-plus/lib/locale/lang/zh-cn",
|
"@iconify/vue",
|
||||||
"element-plus/lib/locale/lang/en"
|
"element-plus/lib/locale/lang/en",
|
||||||
|
"element-plus/lib/locale/lang/zh-cn"
|
||||||
],
|
],
|
||||||
exclude: ["@zougt/vite-plugin-theme-preprocessor/dist/browser-utils"]
|
exclude: ["@zougt/vite-plugin-theme-preprocessor/dist/browser-utils"]
|
||||||
},
|
},
|
||||||
|
|||||||