Compare commits
33 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d9b62a9e62 | ||
|
|
6911688ba6 | ||
|
|
45c08d779d | ||
|
|
41b35588c5 | ||
|
|
0a9eb30549 | ||
|
|
a7119c1cbe | ||
|
|
5a463ccfe7 | ||
|
|
73e98814e2 | ||
|
|
77049fdbd7 | ||
|
|
736f1c27cd | ||
|
|
2bac78478c | ||
|
|
bc8a0f3b35 | ||
|
|
53e19f7971 | ||
|
|
abc43dad6e | ||
|
|
f80fbbed20 | ||
|
|
12c2365a26 | ||
|
|
8a926c509f | ||
|
|
e87c38a9d2 | ||
|
|
340a79d286 | ||
|
|
45743a7c74 | ||
|
|
6887d4b1b8 | ||
|
|
b850783ca7 | ||
|
|
05e55ae9a1 | ||
|
|
f5b387231a | ||
|
|
79ebfb9284 | ||
|
|
51fd06c6a1 | ||
|
|
4bb8647990 | ||
|
|
a43d5ce865 | ||
|
|
aea8605a60 | ||
|
|
eb9d1e8238 | ||
|
|
138e0fd2e4 | ||
|
|
526023e0b0 | ||
|
|
885cbf2d9f |
14
.env.staging
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# 预发布也需要生产环境的行为
|
||||||
|
# https://cn.vitejs.dev/guide/env-and-mode.html#modes
|
||||||
|
NODE_ENV=production
|
||||||
|
|
||||||
|
VITE_PUBLIC_PATH = /
|
||||||
|
|
||||||
|
# 线上环境路由历史模式
|
||||||
|
VITE_ROUTER_HISTORY = "hash"
|
||||||
|
|
||||||
|
# 线上环境后端地址
|
||||||
|
VITE_PROXY_DOMAIN_REAL = ""
|
||||||
|
|
||||||
|
# 是否为打包后的文件提供传统浏览器兼容性支持 支持 true 不支持 false
|
||||||
|
VITE_LEGACY = false
|
||||||
12
.eslintrc.js
@@ -61,6 +61,18 @@ module.exports = {
|
|||||||
"@typescript-eslint/ban-ts-comment": "off",
|
"@typescript-eslint/ban-ts-comment": "off",
|
||||||
"@typescript-eslint/no-empty-function": "off",
|
"@typescript-eslint/no-empty-function": "off",
|
||||||
"@typescript-eslint/no-non-null-assertion": "off",
|
"@typescript-eslint/no-non-null-assertion": "off",
|
||||||
|
"vue/html-self-closing": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
html: {
|
||||||
|
void: "always",
|
||||||
|
normal: "always",
|
||||||
|
component: "always"
|
||||||
|
},
|
||||||
|
svg: "always",
|
||||||
|
math: "always"
|
||||||
|
}
|
||||||
|
],
|
||||||
"@typescript-eslint/no-unused-vars": [
|
"@typescript-eslint/no-unused-vars": [
|
||||||
"error",
|
"error",
|
||||||
{
|
{
|
||||||
|
|||||||
5
.vscode/extensions.json
vendored
@@ -1,7 +1,5 @@
|
|||||||
{
|
{
|
||||||
"recommendations": [
|
"recommendations": [
|
||||||
"johnsoncodehk.vscode-typescript-vue-plugin",
|
|
||||||
"voorjaar.windicss-intellisense",
|
|
||||||
"vscode-icons-team.vscode-icons",
|
"vscode-icons-team.vscode-icons",
|
||||||
"davidanson.vscode-markdownlint",
|
"davidanson.vscode-markdownlint",
|
||||||
"stylelint.vscode-stylelint",
|
"stylelint.vscode-stylelint",
|
||||||
@@ -11,6 +9,7 @@
|
|||||||
"lokalise.i18n-ally",
|
"lokalise.i18n-ally",
|
||||||
"mikestead.dotenv",
|
"mikestead.dotenv",
|
||||||
"eamodio.gitlens",
|
"eamodio.gitlens",
|
||||||
"antfu.iconify"
|
"antfu.iconify",
|
||||||
|
"antfu.unocss"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
12
.vscode/settings.json
vendored
@@ -1,13 +1,9 @@
|
|||||||
{
|
{
|
||||||
"editor.formatOnType": true,
|
"editor.formatOnType": true,
|
||||||
"editor.formatOnSave": true,
|
"editor.formatOnSave": true,
|
||||||
"javascript.updateImportsOnFileMove.enabled": "always",
|
|
||||||
"[vue]": {
|
"[vue]": {
|
||||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||||
},
|
},
|
||||||
"[javascript]": {
|
|
||||||
"editor.defaultFormatter": "vscode.typescript-language-features"
|
|
||||||
},
|
|
||||||
"editor.tabSize": 2,
|
"editor.tabSize": 2,
|
||||||
"editor.formatOnPaste": true,
|
"editor.formatOnPaste": true,
|
||||||
"files.autoSave": "afterDelay",
|
"files.autoSave": "afterDelay",
|
||||||
@@ -30,14 +26,12 @@
|
|||||||
"editor.codeActionsOnSave": {
|
"editor.codeActionsOnSave": {
|
||||||
"source.fixAll.eslint": true
|
"source.fixAll.eslint": true
|
||||||
},
|
},
|
||||||
"typescript.tsdk": "node_modules/typescript/lib",
|
"i18n-ally.localesPaths": "locales",
|
||||||
"i18n-ally.localesPaths": ["src/plugins/i18n"],
|
|
||||||
"i18n-ally.keystyle": "nested",
|
"i18n-ally.keystyle": "nested",
|
||||||
"i18n-ally.sortKeys": true,
|
"i18n-ally.sortKeys": true,
|
||||||
"i18n-ally.namespace": true,
|
"i18n-ally.namespace": true,
|
||||||
"i18n-ally.pathMatcher": "{locale}/{namespaces}.{ext}",
|
"i18n-ally.enabledParsers": ["yaml", "js"],
|
||||||
"i18n-ally.enabledParsers": ["ts"],
|
|
||||||
"i18n-ally.sourceLanguage": "en",
|
"i18n-ally.sourceLanguage": "en",
|
||||||
"i18n-ally.displayLanguage": "zh-CN",
|
"i18n-ally.displayLanguage": "zh-CN",
|
||||||
"i18n-ally.enabledFrameworks": ["vue", "react"]
|
"i18n-ally.enabledFrameworks": ["vue"]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
## introduce
|
## introduce
|
||||||
|
|
||||||
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`
|
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 `3MB`
|
||||||
|
|
||||||
## Supporting Video
|
## Supporting Video
|
||||||
|
|
||||||
@@ -37,9 +37,10 @@ I think you should fork the project first to develop, so that you can pull the u
|
|||||||
|
|
||||||
bilibili: https://www.bilibili.com/video/BV1534y1S7HV/
|
bilibili: https://www.bilibili.com/video/BV1534y1S7HV/
|
||||||
|
|
||||||
## ⚠️ Note
|
## ⚠️ Attention
|
||||||
|
|
||||||
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, thank you! ! !
|
||||||
|
- Don't use the `delete-i18n` branch code, this branch is just for you to completely delete the internationalized references, it won't sync the code! ! ! [Completely remove the internationalization tutorial](https://www.bilibili.com/video/BV1Ru411B7k3/), please be sure to use the code from the `main` branch! ! !
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|||||||
15
README.md
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
## 介绍
|
## 介绍
|
||||||
|
|
||||||
精简版是基于[vue-pure-admin](https://github.com/xiaoxian521/vue-pure-admin)提炼出的架子,包含主体功能,更适合实际项目开发,打包后的大小仅 `2MB`多
|
精简版是基于[vue-pure-admin](https://github.com/xiaoxian521/vue-pure-admin)提炼出的架子,包含主体功能,更适合实际项目开发,打包后的大小仅 `3MB`多
|
||||||
|
|
||||||
## 配套视频
|
## 配套视频
|
||||||
|
|
||||||
@@ -23,15 +23,15 @@
|
|||||||
|
|
||||||
## 捐赠
|
## 捐赠
|
||||||
|
|
||||||
如果你觉得这个项目对你有帮助,你可以帮作者买一杯咖啡表示支持
|
如果你觉得这个项目对您有帮助,可以帮作者买一杯果汁 🍹 表示支持
|
||||||
|
|
||||||
<img src="http://yiming_chang.gitee.io/manages/pay.jpg" width="150px" height="150px" />
|
<img src="https://p9-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/f69bf13c5b854ed5b699807cafa0e3ce~tplv-k3u1fbpfcp-zoom-in-crop-mark:1304:0:0:0.awebp?" width="150px" height="150px" />
|
||||||
|
|
||||||
## QQ 交流群
|
## QQ 交流群
|
||||||
|
|
||||||
群里严禁`黄`、`赌`、`毒`、`vpn`等违法行为!
|
群里严禁`黄`、`赌`、`毒`、`vpn`等违法行为!
|
||||||
|
|
||||||
<img src="http://yiming_chang.gitee.io/manages/qq.jpg" width="150px" height="225px" />
|
<img src="https://p9-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/f0697596aec84661b724f6eebdf8db17~tplv-k3u1fbpfcp-watermark.awebp?" width="150px" height="225px" />
|
||||||
|
|
||||||
## 用法
|
## 用法
|
||||||
|
|
||||||
@@ -47,12 +47,15 @@ pnpm add 包名
|
|||||||
|
|
||||||
pnpm remove 包名
|
pnpm remove 包名
|
||||||
|
|
||||||
我认为你应该先 fork 项目去开发,以便我更新时你可以同步拉取更新!!!
|
我认为你应该先 fork 项目去开发,以便我更新时您可以同步拉取更新!!!
|
||||||
|
|
||||||
## ⚠️ 注意
|
## ⚠️ 注意
|
||||||
|
|
||||||
精简版不接受任何 issues 和 pr,如果有问题请到完整版 https://github.com/xiaoxian521/vue-pure-admin/issues/new/choose 去提,谢谢!!!
|
- 精简版不接受任何 issues 和 pr,如果有问题请到完整版 https://github.com/xiaoxian521/vue-pure-admin/issues/new/choose 去提,谢谢!!!
|
||||||
|
- 不要使用`delete-i18n`分支代码,这个分支只是给你们完全删除国际化的参考,不会同步代码的!!,请务必使用`main`分支的代码!!!
|
||||||
|
|
||||||
## 许可证
|
## 许可证
|
||||||
|
|
||||||
原则上不收取任何费用及版权,可以放心使用,不过如需二次开源(比如用此平台二次开发并开源)请联系作者获取许可!
|
原则上不收取任何费用及版权,可以放心使用,不过如需二次开源(比如用此平台二次开发并开源)请联系作者获取许可!
|
||||||
|
|
||||||
|
[MIT © xiaoxian521-2020](./LICENSE)
|
||||||
|
|||||||
85
build/info.ts
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
import { readdir, stat } from "fs";
|
||||||
|
import type { Plugin } from "vite";
|
||||||
|
import dayjs, { Dayjs } from "dayjs";
|
||||||
|
import { sum } from "lodash-unified";
|
||||||
|
import duration from "dayjs/plugin/duration";
|
||||||
|
import { green, blue, bold } from "picocolors";
|
||||||
|
dayjs.extend(duration);
|
||||||
|
|
||||||
|
const staticPath = "dist";
|
||||||
|
const fileListTotal: number[] = [];
|
||||||
|
|
||||||
|
const recursiveDirectory = (folder: string, callback: Function): void => {
|
||||||
|
readdir(folder, (err, files: string[]) => {
|
||||||
|
if (err) throw err;
|
||||||
|
let count = 0;
|
||||||
|
const checkEnd = () => {
|
||||||
|
++count == files.length && callback();
|
||||||
|
};
|
||||||
|
files.forEach((item: string) => {
|
||||||
|
stat(folder + "/" + item, async (err, stats) => {
|
||||||
|
if (err) throw err;
|
||||||
|
if (stats.isFile()) {
|
||||||
|
fileListTotal.push(stats.size);
|
||||||
|
checkEnd();
|
||||||
|
} else if (stats.isDirectory()) {
|
||||||
|
recursiveDirectory(`${staticPath}/${item}/`, checkEnd);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
files.length === 0 && callback();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const formatBytes = (a: number, b?: number): string => {
|
||||||
|
if (0 == a) return "0 Bytes";
|
||||||
|
const c = 1024,
|
||||||
|
d = b || 2,
|
||||||
|
e = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"],
|
||||||
|
f = Math.floor(Math.log(a) / Math.log(c));
|
||||||
|
return parseFloat((a / Math.pow(c, f)).toFixed(d)) + " " + e[f];
|
||||||
|
};
|
||||||
|
|
||||||
|
export function viteBuildInfo(): Plugin {
|
||||||
|
let config: { command: string };
|
||||||
|
let startTime: Dayjs;
|
||||||
|
let endTime: Dayjs;
|
||||||
|
return {
|
||||||
|
name: "vite:buildInfo",
|
||||||
|
configResolved(resolvedConfig: { command: string }) {
|
||||||
|
config = resolvedConfig;
|
||||||
|
},
|
||||||
|
buildStart() {
|
||||||
|
if (config.command === "build") {
|
||||||
|
startTime = dayjs(new Date());
|
||||||
|
}
|
||||||
|
},
|
||||||
|
closeBundle() {
|
||||||
|
if (config.command === "build") {
|
||||||
|
console.log(
|
||||||
|
bold(
|
||||||
|
green(
|
||||||
|
`👏欢迎使用${blue(
|
||||||
|
"[vue-pure-admin]"
|
||||||
|
)},如果您感觉不错,记得点击后面链接给个star哦💖 https://github.com/xiaoxian521/vue-pure-admin`
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
endTime = dayjs(new Date());
|
||||||
|
recursiveDirectory(staticPath, () => {
|
||||||
|
console.log(
|
||||||
|
bold(
|
||||||
|
green(
|
||||||
|
`恭喜打包完成🎉(总用时${dayjs
|
||||||
|
.duration(endTime.diff(startTime))
|
||||||
|
.format("mm分ss秒")},打包后的大小为${formatBytes(
|
||||||
|
sum(fileListTotal)
|
||||||
|
)})`
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,87 +1,52 @@
|
|||||||
|
import { resolve } from "path";
|
||||||
|
import Unocss from "unocss/vite";
|
||||||
import vue from "@vitejs/plugin-vue";
|
import vue from "@vitejs/plugin-vue";
|
||||||
|
import { viteBuildInfo } from "./info";
|
||||||
import svgLoader from "vite-svg-loader";
|
import svgLoader from "vite-svg-loader";
|
||||||
import legacy from "@vitejs/plugin-legacy";
|
import legacy from "@vitejs/plugin-legacy";
|
||||||
import vueJsx from "@vitejs/plugin-vue-jsx";
|
import vueJsx from "@vitejs/plugin-vue-jsx";
|
||||||
import WindiCSS from "vite-plugin-windicss";
|
|
||||||
import { viteMockServe } from "vite-plugin-mock";
|
import { viteMockServe } from "vite-plugin-mock";
|
||||||
import liveReload from "vite-plugin-live-reload";
|
import VueI18n from "@intlify/vite-plugin-vue-i18n";
|
||||||
import ElementPlus from "unplugin-element-plus/vite";
|
// import ElementPlus from "unplugin-element-plus/vite";
|
||||||
import { visualizer } from "rollup-plugin-visualizer";
|
import { visualizer } from "rollup-plugin-visualizer";
|
||||||
import removeConsole from "vite-plugin-remove-console";
|
import removeConsole from "vite-plugin-remove-console";
|
||||||
import themePreprocessorPlugin from "@zougt/vite-plugin-theme-preprocessor";
|
import themePreprocessorPlugin from "@pureadmin/theme";
|
||||||
|
import { genScssMultipleScopeVars } from "/@/layout/theme";
|
||||||
|
|
||||||
export function getPluginsList(command, VITE_LEGACY) {
|
export function getPluginsList(command, VITE_LEGACY) {
|
||||||
const prodMock = true;
|
const prodMock = true;
|
||||||
const lifecycle = process.env.npm_lifecycle_event;
|
const lifecycle = process.env.npm_lifecycle_event;
|
||||||
return [
|
return [
|
||||||
vue(),
|
vue(),
|
||||||
|
// https://github.com/intlify/bundle-tools/tree/main/packages/vite-plugin-vue-i18n
|
||||||
|
VueI18n({
|
||||||
|
runtimeOnly: true,
|
||||||
|
compositionOnly: true,
|
||||||
|
include: [resolve("locales/**")]
|
||||||
|
}),
|
||||||
// jsx、tsx语法支持
|
// jsx、tsx语法支持
|
||||||
vueJsx(),
|
vueJsx(),
|
||||||
WindiCSS(),
|
Unocss(),
|
||||||
// 线上环境删除console
|
// 线上环境删除console
|
||||||
removeConsole(),
|
removeConsole(),
|
||||||
// 修改layout文件夹下的文件时自动重载浏览器 解决 https://github.com/xiaoxian521/vue-pure-admin/issues/170
|
viteBuildInfo(),
|
||||||
liveReload(["src/layout/**/*", "src/router/**/*"]),
|
|
||||||
// 自定义主题
|
// 自定义主题
|
||||||
themePreprocessorPlugin({
|
themePreprocessorPlugin({
|
||||||
scss: {
|
scss: {
|
||||||
multipleScopeVars: [
|
multipleScopeVars: genScssMultipleScopeVars(),
|
||||||
{
|
|
||||||
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以下属性有效
|
// 在生产模式是否抽取独立的主题css文件,extract为true以下属性有效
|
||||||
extract: true,
|
extract: true,
|
||||||
// 独立主题css文件的输出路径,默认取 viteConfig.build.assetsDir 相对于 (viteConfig.build.outDir)
|
|
||||||
outputDir: "",
|
|
||||||
// 会选取defaultScopeName对应的主题css文件在html添加link
|
// 会选取defaultScopeName对应的主题css文件在html添加link
|
||||||
themeLinkTagId: "head",
|
themeLinkTagId: "head",
|
||||||
// "head"||"head-prepend" || "body" ||"body-prepend"
|
// "head"||"head-prepend" || "body" ||"body-prepend"
|
||||||
themeLinkTagInjectTo: "head",
|
themeLinkTagInjectTo: "head",
|
||||||
// 是否对抽取的css文件内对应scopeName的权重类名移除
|
// 是否对抽取的css文件内对应scopeName的权重类名移除
|
||||||
removeCssScopeName: false,
|
removeCssScopeName: false
|
||||||
// 可以自定义css文件名称的函数
|
|
||||||
customThemeCssFileName: scopeName => scopeName
|
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
// svg组件化支持
|
// svg组件化支持
|
||||||
svgLoader(),
|
svgLoader(),
|
||||||
ElementPlus({}),
|
// ElementPlus({}),
|
||||||
// mock支持
|
// mock支持
|
||||||
viteMockServe({
|
viteMockServe({
|
||||||
mockPath: "mock",
|
mockPath: "mock",
|
||||||
@@ -91,7 +56,7 @@ export function getPluginsList(command, VITE_LEGACY) {
|
|||||||
import { setupProdMockServer } from './mockProdServer';
|
import { setupProdMockServer } from './mockProdServer';
|
||||||
setupProdMockServer();
|
setupProdMockServer();
|
||||||
`,
|
`,
|
||||||
logger: true
|
logger: false
|
||||||
}),
|
}),
|
||||||
// 是否为打包后的文件提供传统浏览器兼容性支持
|
// 是否为打包后的文件提供传统浏览器兼容性支持
|
||||||
VITE_LEGACY
|
VITE_LEGACY
|
||||||
|
|||||||
14
index.html
@@ -13,20 +13,16 @@
|
|||||||
<body>
|
<body>
|
||||||
<div id="app">
|
<div id="app">
|
||||||
<style>
|
<style>
|
||||||
* {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
html,
|
html,
|
||||||
body {
|
body,
|
||||||
|
#app {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
position: relative;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
font-family: "Reggae One", cursive;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.loader,
|
.loader,
|
||||||
@@ -52,6 +48,8 @@
|
|||||||
transform: translateZ(0);
|
transform: translateZ(0);
|
||||||
-webkit-animation-delay: -0.16s;
|
-webkit-animation-delay: -0.16s;
|
||||||
animation-delay: -0.16s;
|
animation-delay: -0.16s;
|
||||||
|
top: 0;
|
||||||
|
transform: translate(-50%, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
.loader:before,
|
.loader:before,
|
||||||
@@ -95,7 +93,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<div class="loader">Loading...</div>
|
<div class="loader"></div>
|
||||||
</div>
|
</div>
|
||||||
<script type="module" src="/src/main.ts"></script>
|
<script type="module" src="/src/main.ts"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
32
locales/en.yaml
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
buttons:
|
||||||
|
hsLoginOut: LoginOut
|
||||||
|
hsfullscreen: FullScreen
|
||||||
|
hsexitfullscreen: ExitFullscreen
|
||||||
|
hsrefreshRoute: RefreshRoute
|
||||||
|
hslogin: Login
|
||||||
|
hsadd: Add
|
||||||
|
hsmark: Mark/Cancel
|
||||||
|
hssave: Save
|
||||||
|
hssearch: Search
|
||||||
|
hsexpendAll: Expand All
|
||||||
|
hscollapseAll: Collapse All
|
||||||
|
hssystemSet: Open ProjectConfig
|
||||||
|
hsdelete: Delete
|
||||||
|
hsreload: Reload
|
||||||
|
hscloseCurrentTab: Close CurrentTab
|
||||||
|
hscloseLeftTabs: Close LeftTabs
|
||||||
|
hscloseRightTabs: Close RightTabs
|
||||||
|
hscloseOtherTabs: Close OtherTabs
|
||||||
|
hscloseAllTabs: Close AllTabs
|
||||||
|
menus:
|
||||||
|
hshome: Home
|
||||||
|
hslogin: Login
|
||||||
|
hserror: Error Page
|
||||||
|
hsfourZeroFour: "404"
|
||||||
|
hsfourZeroOne: "403"
|
||||||
|
hsFive: "500"
|
||||||
|
permission: Permission Manage
|
||||||
|
permissionPage: Page Permission
|
||||||
|
permissionButton: Button Permission
|
||||||
|
status:
|
||||||
|
hsLoad: Loading...
|
||||||
32
locales/zh-CN.yaml
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
buttons:
|
||||||
|
hsLoginOut: 退出系统
|
||||||
|
hsfullscreen: 全屏
|
||||||
|
hsexitfullscreen: 退出全屏
|
||||||
|
hsrefreshRoute: 刷新路由
|
||||||
|
hslogin: 登陆
|
||||||
|
hsadd: 新增
|
||||||
|
hsmark: 标记/取消
|
||||||
|
hssave: 保存
|
||||||
|
hssearch: 搜索
|
||||||
|
hsexpendAll: 全部展开
|
||||||
|
hscollapseAll: 全部折叠
|
||||||
|
hssystemSet: 打开项目配置
|
||||||
|
hsdelete: 删除
|
||||||
|
hsreload: 重新加载
|
||||||
|
hscloseCurrentTab: 关闭当前标签页
|
||||||
|
hscloseLeftTabs: 关闭左侧标签页
|
||||||
|
hscloseRightTabs: 关闭右侧标签页
|
||||||
|
hscloseOtherTabs: 关闭其他标签页
|
||||||
|
hscloseAllTabs: 关闭全部标签页
|
||||||
|
menus:
|
||||||
|
hshome: 首页
|
||||||
|
hslogin: 登陆
|
||||||
|
hserror: 错误页面
|
||||||
|
hsfourZeroFour: "404"
|
||||||
|
hsfourZeroOne: "403"
|
||||||
|
hsFive: "500"
|
||||||
|
permission: 权限管理
|
||||||
|
permissionPage: 页面权限
|
||||||
|
permissionButton: 按钮权限
|
||||||
|
status:
|
||||||
|
hsLoad: 加载中...
|
||||||
@@ -3,21 +3,18 @@ import { MockMethod } from "vite-plugin-mock";
|
|||||||
|
|
||||||
const permissionRouter = {
|
const permissionRouter = {
|
||||||
path: "/permission",
|
path: "/permission",
|
||||||
name: "permission",
|
|
||||||
redirect: "/permission/page/index",
|
redirect: "/permission/page/index",
|
||||||
meta: {
|
meta: {
|
||||||
title: "menus.permission",
|
title: "menus.permission",
|
||||||
icon: "lollipop",
|
icon: "lollipop",
|
||||||
i18n: true,
|
rank: 7
|
||||||
rank: 3
|
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: "/permission/page/index",
|
path: "/permission/page/index",
|
||||||
name: "permissionPage",
|
name: "permissionPage",
|
||||||
meta: {
|
meta: {
|
||||||
title: "menus.permissionPage",
|
title: "menus.permissionPage"
|
||||||
i18n: true
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -25,7 +22,6 @@ const permissionRouter = {
|
|||||||
name: "permissionButton",
|
name: "permissionButton",
|
||||||
meta: {
|
meta: {
|
||||||
title: "menus.permissionButton",
|
title: "menus.permissionButton",
|
||||||
i18n: true,
|
|
||||||
authority: []
|
authority: []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
77
package.json
@@ -1,15 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "pure-admin-thin",
|
"name": "pure-admin-thin",
|
||||||
"version": "3.0",
|
"version": "3.3.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"engines": {
|
|
||||||
"node": ">= 16",
|
|
||||||
"pnpm": ">= 6"
|
|
||||||
},
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"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",
|
||||||
|
"build:staging": "rimraf dist && cross-env vite build --mode staging",
|
||||||
"report": "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",
|
||||||
@@ -29,60 +26,68 @@
|
|||||||
"not op_mini all"
|
"not op_mini all"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ctrl/tinycolor": "^3.4.0",
|
"@ctrl/tinycolor": "^3.4.1",
|
||||||
"@vueuse/core": "^7.6.2",
|
"@pureadmin/components": "^1.0.6",
|
||||||
"@vueuse/motion": "^2.0.0-beta.9",
|
"@vueuse/core": "^8.4.2",
|
||||||
"@vueuse/shared": "^7.6.2",
|
"@vueuse/motion": "^2.0.0-beta.12",
|
||||||
|
"@vueuse/shared": "^8.4.2",
|
||||||
"animate.css": "^4.1.1",
|
"animate.css": "^4.1.1",
|
||||||
"axios": "^0.25.0",
|
"axios": "^0.27.2",
|
||||||
"css-color-function": "^1.3.3",
|
"css-color-function": "^1.3.3",
|
||||||
"element-plus": "^2.0.2",
|
"dayjs": "^1.11.2",
|
||||||
|
"element-plus": "2.1.11",
|
||||||
"element-resize-detector": "^1.2.3",
|
"element-resize-detector": "^1.2.3",
|
||||||
"js-cookie": "^3.0.1",
|
"js-cookie": "^3.0.1",
|
||||||
|
"lodash": "^4.17.21",
|
||||||
"lodash-es": "^4.17.21",
|
"lodash-es": "^4.17.21",
|
||||||
|
"lodash-unified": "^1.0.2",
|
||||||
"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.11",
|
"pinia": "^2.0.14",
|
||||||
|
"qrcode": "^1.5.0",
|
||||||
"qs": "^6.10.2",
|
"qs": "^6.10.2",
|
||||||
"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.31",
|
"vue": "^3.2.33",
|
||||||
"vue-i18n": "^9.2.0-beta.30",
|
"vue-i18n": "^9.2.0-beta.35",
|
||||||
"vue-router": "^4.0.12",
|
"vue-router": "^4.0.15",
|
||||||
"vue-types": "^4.1.1"
|
"vue-types": "^4.1.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@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.2.4",
|
||||||
"@iconify-icons/fa": "^1.1.1",
|
"@iconify-icons/ri": "^1.2.1",
|
||||||
"@iconify-icons/fa-solid": "^1.1.2",
|
"@iconify/vue": "^3.2.0",
|
||||||
"@iconify-icons/ri": "^1.1.1",
|
"@intlify/vite-plugin-vue-i18n": "^3.4.0",
|
||||||
"@iconify/vue": "^3.1.3",
|
"@pureadmin/theme": "^1.1.0",
|
||||||
"@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/lodash": "^4.14.180",
|
||||||
|
"@types/lodash-es": "^4.17.6",
|
||||||
"@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/qrcode": "^1.4.2",
|
||||||
"@types/qs": "^6.9.7",
|
"@types/qs": "^6.9.7",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.10.2",
|
"@typescript-eslint/eslint-plugin": "^5.10.2",
|
||||||
"@typescript-eslint/parser": "^5.10.2",
|
"@typescript-eslint/parser": "^5.10.2",
|
||||||
"@vitejs/plugin-legacy": "^1.7.1",
|
"@vitejs/plugin-legacy": "^1.8.2",
|
||||||
"@vitejs/plugin-vue": "^2.2.0",
|
"@vitejs/plugin-vue": "^2.3.2",
|
||||||
"@vitejs/plugin-vue-jsx": "^1.3.7",
|
"@vitejs/plugin-vue-jsx": "^1.3.10",
|
||||||
"@vue/eslint-config-prettier": "^7.0.0",
|
"@vue/eslint-config-prettier": "^7.0.0",
|
||||||
"@vue/eslint-config-typescript": "^10.0.0",
|
"@vue/eslint-config-typescript": "^10.0.0",
|
||||||
"@zougt/vite-plugin-theme-preprocessor": "^1.4.4",
|
"autoprefixer": "^10.4.5",
|
||||||
"autoprefixer": "^10.4.2",
|
|
||||||
"cross-env": "7.0.3",
|
"cross-env": "7.0.3",
|
||||||
"eslint": "^8.8.0",
|
"eslint": "^8.8.0",
|
||||||
"eslint-plugin-prettier": "^4.0.0",
|
"eslint-plugin-prettier": "^4.0.0",
|
||||||
"eslint-plugin-vue": "^8.4.1",
|
"eslint-plugin-vue": "^8.4.1",
|
||||||
"husky": "7.0.2",
|
"husky": "7.0.2",
|
||||||
"lint-staged": "11.1.2",
|
"lint-staged": "11.1.2",
|
||||||
|
"picocolors": "^1.0.0",
|
||||||
"postcss": "^8.4.6",
|
"postcss": "^8.4.6",
|
||||||
"postcss-html": "^1.3.0",
|
"postcss-html": "^1.3.0",
|
||||||
"postcss-import": "14.0.0",
|
"postcss-import": "14.0.0",
|
||||||
@@ -90,26 +95,22 @@
|
|||||||
"prettier": "^2.5.1",
|
"prettier": "^2.5.1",
|
||||||
"pretty-quick": "3.1.1",
|
"pretty-quick": "3.1.1",
|
||||||
"rimraf": "3.0.2",
|
"rimraf": "3.0.2",
|
||||||
"rollup-plugin-visualizer": "^5.5.4",
|
"rollup": "^2.70.1",
|
||||||
"sass": "^1.49.0",
|
"rollup-plugin-visualizer": "^5.6.0",
|
||||||
"sass-loader": "^12.4.0",
|
"sass": "^1.51.0",
|
||||||
"stylelint": "^14.3.0",
|
"stylelint": "^14.3.0",
|
||||||
"stylelint-config-html": "^1.0.0",
|
"stylelint-config-html": "^1.0.0",
|
||||||
"stylelint-config-prettier": "^9.0.3",
|
"stylelint-config-prettier": "^9.0.3",
|
||||||
"stylelint-config-recommended": "^6.0.0",
|
"stylelint-config-recommended": "^6.0.0",
|
||||||
"stylelint-config-standard": "^24.0.0",
|
"stylelint-config-standard": "^24.0.0",
|
||||||
"stylelint-order": "^5.0.0",
|
"stylelint-order": "^5.0.0",
|
||||||
"typescript": "^4.5.5",
|
"typescript": "^4.6.3",
|
||||||
"unplugin-element-plus": "^0.2.0",
|
"unocss": "^0.33.2",
|
||||||
"vite": "2.7.13",
|
"vite": "^2.9.8",
|
||||||
"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.7",
|
||||||
"vite-plugin-style-import": "1.4.1",
|
"vite-svg-loader": "^3.3.0",
|
||||||
"vite-plugin-windicss": "^1.7.0",
|
"vue-eslint-parser": "^8.2.0"
|
||||||
"vite-svg-loader": "2.2.0",
|
|
||||||
"vue-eslint-parser": "^8.2.0",
|
|
||||||
"windicss": "^3.4.3"
|
|
||||||
},
|
},
|
||||||
"repository": "git@github.com:xiaoxian521/vue-pure-admin.git",
|
"repository": "git@github.com:xiaoxian521/vue-pure-admin.git",
|
||||||
"author": "xiaoxian521",
|
"author": "xiaoxian521",
|
||||||
|
|||||||
3230
pnpm-lock.yaml
generated
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"Version": "3.0",
|
"Version": "3.3.0",
|
||||||
"Title": "PureAdmin",
|
"Title": "PureAdmin",
|
||||||
"FixedHeader": true,
|
"FixedHeader": true,
|
||||||
"HiddenSideBar": false,
|
"HiddenSideBar": false,
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 680 KiB |
|
Before Width: | Height: | Size: 96 KiB |
|
Before Width: | Height: | Size: 4.7 KiB |
1
src/assets/status/403.svg
Normal file
|
After Width: | Height: | Size: 12 KiB |
1
src/assets/status/404.svg
Normal file
|
After Width: | Height: | Size: 13 KiB |
1
src/assets/status/500.svg
Normal file
|
After Width: | Height: | Size: 15 KiB |
1
src/assets/svg/enter_outlined.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--ant-design" width="20" height="20" preserveAspectRatio="xMidYMid meet" viewBox="0 0 1024 1024"><path fill="currentColor" d="M864 170h-60c-4.4 0-8 3.6-8 8v518H310v-73c0-6.7-7.8-10.5-13-6.3l-141.9 112a8 8 0 0 0 0 12.6l141.9 112c5.3 4.2 13 .4 13-6.3v-75h498c35.3 0 64-28.7 64-64V178c0-4.4-3.6-8-8-8z"></path></svg>
|
||||||
|
After Width: | Height: | Size: 448 B |
1
src/assets/svg/mdi_keyboard_esc.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--mdi" width="20" height="20" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M1 7h6v2H3v2h4v2H3v2h4v2H1V7m10 0h4v2h-4v2h2a2 2 0 0 1 2 2v2c0 1.11-.89 2-2 2H9v-2h4v-2h-2a2 2 0 0 1-2-2V9c0-1.1.9-2 2-2m8 0h2a2 2 0 0 1 2 2v1h-2V9h-2v6h2v-1h2v1c0 1.11-.89 2-2 2h-2a2 2 0 0 1-2-2V9c0-1.1.9-2 2-2Z"></path></svg>
|
||||||
|
After Width: | Height: | Size: 477 B |
@@ -1,8 +1,14 @@
|
|||||||
|
import { iconType } from "./types";
|
||||||
import { h, defineComponent, Component } from "vue";
|
import { h, defineComponent, Component } from "vue";
|
||||||
import { IconifyIconOffline, FontIcon } from "../index";
|
import { IconifyIconOffline, FontIcon } from "../index";
|
||||||
|
|
||||||
// 支持fontawesome4、5+、iconfont、remixicon、element-plus的icons、自定义svg
|
/**
|
||||||
export function useRenderIcon(icon: string): Component {
|
* 支持fontawesome4、5+、iconfont、remixicon、element-plus的icons、自定义svg
|
||||||
|
* @param icon 必传 string 图标
|
||||||
|
* @param attrs 可选 iconType 属性
|
||||||
|
* @returns Component
|
||||||
|
*/
|
||||||
|
export function useRenderIcon(icon: string, attrs?: iconType): Component {
|
||||||
// iconfont
|
// iconfont
|
||||||
const ifReg = /^IF-/;
|
const ifReg = /^IF-/;
|
||||||
// typeof icon === "function" 属于SVG
|
// typeof icon === "function" 属于SVG
|
||||||
@@ -19,7 +25,8 @@ export function useRenderIcon(icon: string): Component {
|
|||||||
render() {
|
render() {
|
||||||
return h(FontIcon, {
|
return h(FontIcon, {
|
||||||
icon: iconName,
|
icon: iconName,
|
||||||
iconType
|
iconType,
|
||||||
|
...attrs
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -31,7 +38,8 @@ export function useRenderIcon(icon: string): Component {
|
|||||||
name: "Icon",
|
name: "Icon",
|
||||||
render() {
|
render() {
|
||||||
return h(IconifyIconOffline, {
|
return h(IconifyIconOffline, {
|
||||||
icon: icon
|
icon: icon,
|
||||||
|
...attrs
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,65 +3,43 @@ import { Icon as IconifyIcon, addIcon } from "@iconify/vue/dist/offline";
|
|||||||
|
|
||||||
// element-plus icon
|
// 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 HomeFilled from "@iconify-icons/ep/home-filled";
|
import HomeFilled from "@iconify-icons/ep/home-filled";
|
||||||
import SetUp from "@iconify-icons/ep/set-up";
|
|
||||||
import Edit from "@iconify-icons/ep/edit";
|
|
||||||
import Setting from "@iconify-icons/ep/setting";
|
import Setting from "@iconify-icons/ep/setting";
|
||||||
import Lollipop from "@iconify-icons/ep/lollipop";
|
import Lollipop from "@iconify-icons/ep/lollipop";
|
||||||
import Link from "@iconify-icons/ep/link";
|
|
||||||
import Position from "@iconify-icons/ep/position";
|
|
||||||
import Histogram from "@iconify-icons/ep/histogram";
|
|
||||||
import RefreshRight from "@iconify-icons/ep/refresh-right";
|
import RefreshRight from "@iconify-icons/ep/refresh-right";
|
||||||
import ArrowDown from "@iconify-icons/ep/arrow-down";
|
import ArrowDown from "@iconify-icons/ep/arrow-down";
|
||||||
import Close from "@iconify-icons/ep/close";
|
|
||||||
import CloseBold from "@iconify-icons/ep/close-bold";
|
import CloseBold from "@iconify-icons/ep/close-bold";
|
||||||
import Bell from "@iconify-icons/ep/bell";
|
import Bell from "@iconify-icons/ep/bell";
|
||||||
import Guide from "@iconify-icons/ep/guide";
|
import Search from "@iconify-icons/ep/search";
|
||||||
import User from "@iconify-icons/ep/user";
|
|
||||||
import Iphone from "@iconify-icons/ep/iphone";
|
|
||||||
import Location from "@iconify-icons/ep/location";
|
|
||||||
import Tickets from "@iconify-icons/ep/tickets";
|
|
||||||
import OfficeBuilding from "@iconify-icons/ep/office-building";
|
|
||||||
import Notebook from "@iconify-icons/ep/notebook";
|
|
||||||
addIcon("check", Check);
|
addIcon("check", Check);
|
||||||
addIcon("menu", Menu);
|
|
||||||
addIcon("home-filled", HomeFilled);
|
addIcon("home-filled", HomeFilled);
|
||||||
addIcon("set-up", SetUp);
|
|
||||||
addIcon("edit", Edit);
|
|
||||||
addIcon("setting", Setting);
|
addIcon("setting", Setting);
|
||||||
addIcon("lollipop", Lollipop);
|
addIcon("lollipop", Lollipop);
|
||||||
addIcon("link", Link);
|
|
||||||
addIcon("position", Position);
|
|
||||||
addIcon("histogram", Histogram);
|
|
||||||
addIcon("refresh-right", RefreshRight);
|
addIcon("refresh-right", RefreshRight);
|
||||||
addIcon("arrow-down", ArrowDown);
|
addIcon("arrow-down", ArrowDown);
|
||||||
addIcon("close", Close);
|
|
||||||
addIcon("close-bold", CloseBold);
|
addIcon("close-bold", CloseBold);
|
||||||
addIcon("bell", Bell);
|
addIcon("bell", Bell);
|
||||||
addIcon("guide", Guide);
|
addIcon("search", Search);
|
||||||
addIcon("user", User);
|
|
||||||
addIcon("iphone", Iphone);
|
|
||||||
addIcon("location", Location);
|
|
||||||
addIcon("tickets", Tickets);
|
|
||||||
addIcon("office-building", OfficeBuilding);
|
|
||||||
addIcon("notebook", Notebook);
|
|
||||||
|
|
||||||
// remixicon
|
// remixicon
|
||||||
import arrowRightSLine from "@iconify-icons/ri/arrow-right-s-line";
|
import ArrowRightSLine from "@iconify-icons/ri/arrow-right-s-line";
|
||||||
import arrowLeftSLine from "@iconify-icons/ri/arrow-left-s-line";
|
import ArrowLeftSLine from "@iconify-icons/ri/arrow-left-s-line";
|
||||||
import logoutCircleRLine from "@iconify-icons/ri/logout-circle-r-line";
|
import LogoutCircleRLine from "@iconify-icons/ri/logout-circle-r-line";
|
||||||
addIcon("arrow-right-s-line", arrowRightSLine);
|
import InformationLine from "@iconify-icons/ri/information-line";
|
||||||
addIcon("arrow-left-s-line", arrowLeftSLine);
|
import ArrowUpLine from "@iconify-icons/ri/arrow-up-line";
|
||||||
addIcon("logout-circle-r-line", logoutCircleRLine);
|
import ArrowDownLine from "@iconify-icons/ri/arrow-down-line";
|
||||||
|
import Bookmark from "@iconify-icons/ri/bookmark-2-line";
|
||||||
// Font Awesome 4
|
import User from "@iconify-icons/ri/user-3-fill";
|
||||||
import faUser from "@iconify-icons/fa/user";
|
import Lock from "@iconify-icons/ri/lock-fill";
|
||||||
import faLock from "@iconify-icons/fa/lock";
|
addIcon("arrow-right-s-line", ArrowRightSLine);
|
||||||
import faSignOut from "@iconify-icons/fa/sign-out";
|
addIcon("arrow-left-s-line", ArrowLeftSLine);
|
||||||
addIcon("fa-user", faUser);
|
addIcon("logout-circle-r-line", LogoutCircleRLine);
|
||||||
addIcon("fa-lock", faLock);
|
addIcon("information-line", InformationLine);
|
||||||
addIcon("fa-sign-out", faSignOut);
|
addIcon("arrow-up-line", ArrowUpLine);
|
||||||
|
addIcon("arrow-down-line", ArrowDownLine);
|
||||||
|
addIcon("bookmark", Bookmark);
|
||||||
|
addIcon("user", User);
|
||||||
|
addIcon("lock", Lock);
|
||||||
|
|
||||||
// Iconify Icon在Vue里离线使用(用于内网环境)https://docs.iconify.design/icon-components/vue/offline.html
|
// Iconify Icon在Vue里离线使用(用于内网环境)https://docs.iconify.design/icon-components/vue/offline.html
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
|
|||||||
@@ -9,11 +9,6 @@ export default defineComponent({
|
|||||||
icon: {
|
icon: {
|
||||||
type: String,
|
type: String,
|
||||||
default: ""
|
default: ""
|
||||||
},
|
|
||||||
// default element plus icon
|
|
||||||
type: {
|
|
||||||
type: String,
|
|
||||||
default: "ep:"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
render() {
|
render() {
|
||||||
@@ -21,7 +16,7 @@ export default defineComponent({
|
|||||||
return h(
|
return h(
|
||||||
IconifyIcon,
|
IconifyIcon,
|
||||||
{
|
{
|
||||||
icon: `${this.type}${this.icon}`,
|
icon: `${this.icon}`,
|
||||||
...attrs
|
...attrs
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
18
src/components/ReIcon/src/types.ts
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
export interface iconType {
|
||||||
|
// iconify (https://docs.iconify.design/icon-components/vue/#properties)
|
||||||
|
inline?: boolean;
|
||||||
|
width?: string | number;
|
||||||
|
height?: string | number;
|
||||||
|
horizontalFlip?: boolean;
|
||||||
|
verticalFlip?: boolean;
|
||||||
|
flip?: string;
|
||||||
|
rotate?: number | string;
|
||||||
|
color?: string;
|
||||||
|
horizontalAlign?: boolean;
|
||||||
|
verticalAlign?: boolean;
|
||||||
|
align?: string;
|
||||||
|
onLoad?: Function;
|
||||||
|
|
||||||
|
// all icon
|
||||||
|
style?: object;
|
||||||
|
}
|
||||||
12
src/components/ReImageVerify/index.ts
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import { App } from "vue";
|
||||||
|
import reImageVerify from "./src/index.vue";
|
||||||
|
|
||||||
|
export const ReImageVerify = Object.assign(reImageVerify, {
|
||||||
|
install(app: App) {
|
||||||
|
app.component(reImageVerify.name, reImageVerify);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export default {
|
||||||
|
ReImageVerify
|
||||||
|
};
|
||||||
85
src/components/ReImageVerify/src/hooks.ts
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
import { ref, onMounted } from "vue";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 绘制图形验证码
|
||||||
|
* @param width - 图形宽度
|
||||||
|
* @param height - 图形高度
|
||||||
|
*/
|
||||||
|
export const useImageVerify = (width = 120, height = 40) => {
|
||||||
|
const domRef = ref<HTMLCanvasElement>();
|
||||||
|
const imgCode = ref("");
|
||||||
|
|
||||||
|
function setImgCode(code: string) {
|
||||||
|
imgCode.value = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getImgCode() {
|
||||||
|
if (!domRef.value) return;
|
||||||
|
imgCode.value = draw(domRef.value, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getImgCode();
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
domRef,
|
||||||
|
imgCode,
|
||||||
|
setImgCode,
|
||||||
|
getImgCode
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
function randomNum(min: number, max: number) {
|
||||||
|
const num = Math.floor(Math.random() * (max - min) + min);
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
|
||||||
|
function randomColor(min: number, max: number) {
|
||||||
|
const r = randomNum(min, max);
|
||||||
|
const g = randomNum(min, max);
|
||||||
|
const b = randomNum(min, max);
|
||||||
|
return `rgb(${r},${g},${b})`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function draw(dom: HTMLCanvasElement, width: number, height: number) {
|
||||||
|
let imgCode = "";
|
||||||
|
|
||||||
|
const NUMBER_STRING = "0123456789";
|
||||||
|
|
||||||
|
const ctx = dom.getContext("2d");
|
||||||
|
if (!ctx) return imgCode;
|
||||||
|
|
||||||
|
ctx.fillStyle = randomColor(180, 230);
|
||||||
|
ctx.fillRect(0, 0, width, height);
|
||||||
|
for (let i = 0; i < 4; i += 1) {
|
||||||
|
const text = NUMBER_STRING[randomNum(0, NUMBER_STRING.length)];
|
||||||
|
imgCode += text;
|
||||||
|
const fontSize = randomNum(18, 41);
|
||||||
|
const deg = randomNum(-30, 30);
|
||||||
|
ctx.font = `${fontSize}px Simhei`;
|
||||||
|
ctx.textBaseline = "top";
|
||||||
|
ctx.fillStyle = randomColor(80, 150);
|
||||||
|
ctx.save();
|
||||||
|
ctx.translate(30 * i + 15, 15);
|
||||||
|
ctx.rotate((deg * Math.PI) / 180);
|
||||||
|
ctx.fillText(text, -15 + 5, -15);
|
||||||
|
ctx.restore();
|
||||||
|
}
|
||||||
|
for (let i = 0; i < 5; i += 1) {
|
||||||
|
ctx.beginPath();
|
||||||
|
ctx.moveTo(randomNum(0, width), randomNum(0, height));
|
||||||
|
ctx.lineTo(randomNum(0, width), randomNum(0, height));
|
||||||
|
ctx.strokeStyle = randomColor(180, 230);
|
||||||
|
ctx.closePath();
|
||||||
|
ctx.stroke();
|
||||||
|
}
|
||||||
|
for (let i = 0; i < 41; i += 1) {
|
||||||
|
ctx.beginPath();
|
||||||
|
ctx.arc(randomNum(0, width), randomNum(0, height), 1, 0, 2 * Math.PI);
|
||||||
|
ctx.closePath();
|
||||||
|
ctx.fillStyle = randomColor(150, 200);
|
||||||
|
ctx.fill();
|
||||||
|
}
|
||||||
|
return imgCode;
|
||||||
|
}
|
||||||
48
src/components/ReImageVerify/src/index.vue
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
export default {
|
||||||
|
name: "ReImageVerify"
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { watch } from "vue";
|
||||||
|
import { useImageVerify } from "./hooks";
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
code?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Emits {
|
||||||
|
(e: "update:code", code: string): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
|
code: ""
|
||||||
|
});
|
||||||
|
|
||||||
|
const emit = defineEmits<Emits>();
|
||||||
|
|
||||||
|
const { domRef, imgCode, setImgCode, getImgCode } = useImageVerify();
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.code,
|
||||||
|
newValue => {
|
||||||
|
setImgCode(newValue);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
watch(imgCode, newValue => {
|
||||||
|
emit("update:code", newValue);
|
||||||
|
});
|
||||||
|
|
||||||
|
defineExpose({ getImgCode });
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<canvas
|
||||||
|
ref="domRef"
|
||||||
|
width="120"
|
||||||
|
height="40"
|
||||||
|
class="cursor-pointer"
|
||||||
|
@click="getImgCode"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
10
src/components/ReQrcode/index.ts
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import { App } from "vue";
|
||||||
|
import reQrcode from "./src/index";
|
||||||
|
|
||||||
|
export const ReQrcode = Object.assign(reQrcode, {
|
||||||
|
install(app: App) {
|
||||||
|
app.component(reQrcode.name, reQrcode);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export default ReQrcode;
|
||||||
8
src/components/ReQrcode/src/index.scss
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
.qrcode {
|
||||||
|
&--disabled {
|
||||||
|
background: rgba(255, 255, 255, 0.95);
|
||||||
|
& > div {
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
262
src/components/ReQrcode/src/index.tsx
Normal file
@@ -0,0 +1,262 @@
|
|||||||
|
import {
|
||||||
|
ref,
|
||||||
|
unref,
|
||||||
|
watch,
|
||||||
|
nextTick,
|
||||||
|
computed,
|
||||||
|
PropType,
|
||||||
|
defineComponent
|
||||||
|
} from "vue";
|
||||||
|
import "./index.scss";
|
||||||
|
import { isString } from "/@/utils/is";
|
||||||
|
import { cloneDeep } from "lodash-unified";
|
||||||
|
import { propTypes } from "/@/utils/propTypes";
|
||||||
|
import { IconifyIconOffline } from "../../ReIcon";
|
||||||
|
import QRCode, { QRCodeRenderersOptions } from "qrcode";
|
||||||
|
|
||||||
|
interface QrcodeLogo {
|
||||||
|
src?: string;
|
||||||
|
logoSize?: number;
|
||||||
|
bgColor?: string;
|
||||||
|
borderSize?: number;
|
||||||
|
crossOrigin?: string;
|
||||||
|
borderRadius?: number;
|
||||||
|
logoRadius?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = {
|
||||||
|
// img 或者 canvas,img不支持logo嵌套
|
||||||
|
tag: propTypes.string
|
||||||
|
.validate((v: string) => ["canvas", "img"].includes(v))
|
||||||
|
.def("canvas"),
|
||||||
|
// 二维码内容
|
||||||
|
text: {
|
||||||
|
type: [String, Array] as PropType<string | Recordable[]>,
|
||||||
|
default: null
|
||||||
|
},
|
||||||
|
// qrcode.js配置项
|
||||||
|
options: {
|
||||||
|
type: Object as PropType<QRCodeRenderersOptions>,
|
||||||
|
default: (): QRCodeRenderersOptions => ({})
|
||||||
|
},
|
||||||
|
// 宽度
|
||||||
|
width: propTypes.number.def(200),
|
||||||
|
// logo
|
||||||
|
logo: {
|
||||||
|
type: [String, Object] as PropType<Partial<QrcodeLogo> | string>,
|
||||||
|
default: (): QrcodeLogo | string => ""
|
||||||
|
},
|
||||||
|
// 是否过期
|
||||||
|
disabled: propTypes.bool.def(false),
|
||||||
|
// 过期提示内容
|
||||||
|
disabledText: propTypes.string.def("")
|
||||||
|
};
|
||||||
|
|
||||||
|
export default defineComponent({
|
||||||
|
name: "ReQrcode",
|
||||||
|
props,
|
||||||
|
emits: ["done", "click", "disabled-click"],
|
||||||
|
setup(props, { emit }) {
|
||||||
|
const { toCanvas, toDataURL } = QRCode;
|
||||||
|
const loading = ref(true);
|
||||||
|
const wrapRef = ref<Nullable<HTMLCanvasElement | HTMLImageElement>>(null);
|
||||||
|
const renderText = computed(() => String(props.text));
|
||||||
|
const wrapStyle = computed(() => {
|
||||||
|
return {
|
||||||
|
width: props.width + "px",
|
||||||
|
height: props.width + "px"
|
||||||
|
};
|
||||||
|
});
|
||||||
|
const initQrcode = async () => {
|
||||||
|
await nextTick();
|
||||||
|
const options = cloneDeep(props.options || {});
|
||||||
|
if (props.tag === "canvas") {
|
||||||
|
// 容错率,默认对内容少的二维码采用高容错率,内容多的二维码采用低容错率
|
||||||
|
options.errorCorrectionLevel =
|
||||||
|
options.errorCorrectionLevel ||
|
||||||
|
getErrorCorrectionLevel(unref(renderText));
|
||||||
|
const _width: number = await getOriginWidth(unref(renderText), options);
|
||||||
|
options.scale =
|
||||||
|
props.width === 0 ? undefined : (props.width / _width) * 4;
|
||||||
|
const canvasRef: HTMLCanvasElement = await toCanvas(
|
||||||
|
unref(wrapRef) as HTMLCanvasElement,
|
||||||
|
unref(renderText),
|
||||||
|
options
|
||||||
|
);
|
||||||
|
if (props.logo) {
|
||||||
|
const url = await createLogoCode(canvasRef);
|
||||||
|
emit("done", url);
|
||||||
|
loading.value = false;
|
||||||
|
} else {
|
||||||
|
emit("done", canvasRef.toDataURL());
|
||||||
|
loading.value = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const url = await toDataURL(renderText.value, {
|
||||||
|
errorCorrectionLevel: "H",
|
||||||
|
width: props.width,
|
||||||
|
...options
|
||||||
|
});
|
||||||
|
(unref(wrapRef) as HTMLImageElement).src = url;
|
||||||
|
emit("done", url);
|
||||||
|
loading.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
watch(
|
||||||
|
() => renderText.value,
|
||||||
|
val => {
|
||||||
|
if (!val) return;
|
||||||
|
initQrcode();
|
||||||
|
},
|
||||||
|
{
|
||||||
|
deep: true,
|
||||||
|
immediate: true
|
||||||
|
}
|
||||||
|
);
|
||||||
|
const createLogoCode = (canvasRef: HTMLCanvasElement) => {
|
||||||
|
const canvasWidth = canvasRef.width;
|
||||||
|
const logoOptions: QrcodeLogo = Object.assign(
|
||||||
|
{
|
||||||
|
logoSize: 0.15,
|
||||||
|
bgColor: "#ffffff",
|
||||||
|
borderSize: 0.05,
|
||||||
|
crossOrigin: "anonymous",
|
||||||
|
borderRadius: 8,
|
||||||
|
logoRadius: 0
|
||||||
|
},
|
||||||
|
isString(props.logo) ? {} : props.logo
|
||||||
|
);
|
||||||
|
const {
|
||||||
|
logoSize = 0.15,
|
||||||
|
bgColor = "#ffffff",
|
||||||
|
borderSize = 0.05,
|
||||||
|
crossOrigin = "anonymous",
|
||||||
|
borderRadius = 8,
|
||||||
|
logoRadius = 0
|
||||||
|
} = logoOptions;
|
||||||
|
const logoSrc = isString(props.logo) ? props.logo : props.logo.src;
|
||||||
|
const logoWidth = canvasWidth * logoSize;
|
||||||
|
const logoXY = (canvasWidth * (1 - logoSize)) / 2;
|
||||||
|
const logoBgWidth = canvasWidth * (logoSize + borderSize);
|
||||||
|
const logoBgXY = (canvasWidth * (1 - logoSize - borderSize)) / 2;
|
||||||
|
const ctx = canvasRef.getContext("2d");
|
||||||
|
if (!ctx) return;
|
||||||
|
// logo 底色
|
||||||
|
canvasRoundRect(ctx)(
|
||||||
|
logoBgXY,
|
||||||
|
logoBgXY,
|
||||||
|
logoBgWidth,
|
||||||
|
logoBgWidth,
|
||||||
|
borderRadius
|
||||||
|
);
|
||||||
|
ctx.fillStyle = bgColor;
|
||||||
|
ctx.fill();
|
||||||
|
// logo
|
||||||
|
const image = new Image();
|
||||||
|
if (crossOrigin || logoRadius) {
|
||||||
|
image.setAttribute("crossOrigin", crossOrigin);
|
||||||
|
}
|
||||||
|
(image as any).src = logoSrc;
|
||||||
|
// 使用image绘制可以避免某些跨域情况
|
||||||
|
const drawLogoWithImage = (image: HTMLImageElement) => {
|
||||||
|
ctx.drawImage(image, logoXY, logoXY, logoWidth, logoWidth);
|
||||||
|
};
|
||||||
|
// 使用canvas绘制以获得更多的功能
|
||||||
|
const drawLogoWithCanvas = (image: HTMLImageElement) => {
|
||||||
|
const canvasImage = document.createElement("canvas");
|
||||||
|
canvasImage.width = logoXY + logoWidth;
|
||||||
|
canvasImage.height = logoXY + logoWidth;
|
||||||
|
const imageCanvas = canvasImage.getContext("2d");
|
||||||
|
if (!imageCanvas || !ctx) return;
|
||||||
|
imageCanvas.drawImage(image, logoXY, logoXY, logoWidth, logoWidth);
|
||||||
|
canvasRoundRect(ctx)(logoXY, logoXY, logoWidth, logoWidth, logoRadius);
|
||||||
|
if (!ctx) return;
|
||||||
|
const fillStyle = ctx.createPattern(canvasImage, "no-repeat");
|
||||||
|
if (fillStyle) {
|
||||||
|
ctx.fillStyle = fillStyle;
|
||||||
|
ctx.fill();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
// 将 logo绘制到 canvas上
|
||||||
|
return new Promise((resolve: any) => {
|
||||||
|
image.onload = () => {
|
||||||
|
logoRadius ? drawLogoWithCanvas(image) : drawLogoWithImage(image);
|
||||||
|
resolve(canvasRef.toDataURL());
|
||||||
|
};
|
||||||
|
});
|
||||||
|
};
|
||||||
|
// 得到原QrCode的大小,以便缩放得到正确的QrCode大小
|
||||||
|
const getOriginWidth = async (
|
||||||
|
content: string,
|
||||||
|
options: QRCodeRenderersOptions
|
||||||
|
) => {
|
||||||
|
const _canvas = document.createElement("canvas");
|
||||||
|
await toCanvas(_canvas, content, options);
|
||||||
|
return _canvas.width;
|
||||||
|
};
|
||||||
|
// 对于内容少的QrCode,增大容错率
|
||||||
|
const getErrorCorrectionLevel = (content: string) => {
|
||||||
|
if (content.length > 36) {
|
||||||
|
return "M";
|
||||||
|
} else if (content.length > 16) {
|
||||||
|
return "Q";
|
||||||
|
} else {
|
||||||
|
return "H";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
// 用于绘制圆角
|
||||||
|
const canvasRoundRect = (ctx: CanvasRenderingContext2D) => {
|
||||||
|
return (x: number, y: number, w: number, h: number, r: number) => {
|
||||||
|
const minSize = Math.min(w, h);
|
||||||
|
if (r > minSize / 2) {
|
||||||
|
r = minSize / 2;
|
||||||
|
}
|
||||||
|
ctx.beginPath();
|
||||||
|
ctx.moveTo(x + r, y);
|
||||||
|
ctx.arcTo(x + w, y, x + w, y + h, r);
|
||||||
|
ctx.arcTo(x + w, y + h, x, y + h, r);
|
||||||
|
ctx.arcTo(x, y + h, x, y, r);
|
||||||
|
ctx.arcTo(x, y, x + w, y, r);
|
||||||
|
ctx.closePath();
|
||||||
|
return ctx;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
const clickCode = () => {
|
||||||
|
emit("click");
|
||||||
|
};
|
||||||
|
const disabledClick = () => {
|
||||||
|
emit("disabled-click");
|
||||||
|
};
|
||||||
|
return () => (
|
||||||
|
<>
|
||||||
|
<div
|
||||||
|
v-loading={unref(loading)}
|
||||||
|
class="qrcode relative inline-block"
|
||||||
|
style={unref(wrapStyle)}
|
||||||
|
>
|
||||||
|
{props.tag === "canvas" ? (
|
||||||
|
<canvas ref={wrapRef} onClick={clickCode}></canvas>
|
||||||
|
) : (
|
||||||
|
<img ref={wrapRef} onClick={clickCode}></img>
|
||||||
|
)}
|
||||||
|
{props.disabled && (
|
||||||
|
<div
|
||||||
|
class="qrcode--disabled absolute top-0 left-0 flex w-full h-full items-center justify-center"
|
||||||
|
onClick={disabledClick}
|
||||||
|
>
|
||||||
|
<div class="absolute top-[50%] left-[50%] font-bold">
|
||||||
|
<IconifyIconOffline
|
||||||
|
class="cursor-pointer outline-none"
|
||||||
|
icon="refresh-right"
|
||||||
|
width="30"
|
||||||
|
color="var(--el-color-primary)"
|
||||||
|
/>
|
||||||
|
<div>{props.disabledText}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
@@ -7,7 +7,6 @@ import {
|
|||||||
defineComponent,
|
defineComponent,
|
||||||
getCurrentInstance
|
getCurrentInstance
|
||||||
} from "vue";
|
} from "vue";
|
||||||
import { RouterView } from "vue-router";
|
|
||||||
import backTop from "/@/assets/svg/back_top.svg?component";
|
import backTop from "/@/assets/svg/back_top.svg?component";
|
||||||
import { usePermissionStoreHook } from "/@/store/modules/permission";
|
import { usePermissionStoreHook } from "/@/store/modules/permission";
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
import { useNav } from "../hooks/nav";
|
import { useNav } from "../hooks/nav";
|
||||||
import { useRoute } from "vue-router";
|
import { useRoute } from "vue-router";
|
||||||
|
import Search from "./search/index.vue";
|
||||||
import Notice from "./notice/index.vue";
|
import Notice from "./notice/index.vue";
|
||||||
import mixNav from "./sidebar/mixNav.vue";
|
import mixNav from "./sidebar/mixNav.vue";
|
||||||
import avatars from "/@/assets/avatars.jpg";
|
import avatars from "/@/assets/avatars.jpg";
|
||||||
@@ -13,7 +14,7 @@ import screenfull from "../components/screenfull/index.vue";
|
|||||||
import globalization from "/@/assets/svg/globalization.svg?component";
|
import globalization from "/@/assets/svg/globalization.svg?component";
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { locale } = useI18n();
|
const { locale, t } = useI18n();
|
||||||
const instance =
|
const instance =
|
||||||
getCurrentInstance().appContext.config.globalProperties.$storage;
|
getCurrentInstance().appContext.config.globalProperties.$storage;
|
||||||
const {
|
const {
|
||||||
@@ -22,7 +23,8 @@ const {
|
|||||||
changeTitle,
|
changeTitle,
|
||||||
toggleSideBar,
|
toggleSideBar,
|
||||||
pureApp,
|
pureApp,
|
||||||
usename,
|
username,
|
||||||
|
avatarsStyle,
|
||||||
getDropdownItemStyle
|
getDropdownItemStyle
|
||||||
} = useNav();
|
} = useNav();
|
||||||
|
|
||||||
@@ -58,6 +60,8 @@ function translationEn() {
|
|||||||
<mixNav v-if="pureApp.layout === 'mix'" />
|
<mixNav v-if="pureApp.layout === 'mix'" />
|
||||||
|
|
||||||
<div v-if="pureApp.layout === 'vertical'" class="vertical-header-right">
|
<div v-if="pureApp.layout === 'vertical'" class="vertical-header-right">
|
||||||
|
<!-- 菜单搜索 -->
|
||||||
|
<Search />
|
||||||
<!-- 通知 -->
|
<!-- 通知 -->
|
||||||
<Notice id="header-notice" />
|
<Notice id="header-notice" />
|
||||||
<!-- 全屏 -->
|
<!-- 全屏 -->
|
||||||
@@ -79,18 +83,19 @@ function translationEn() {
|
|||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
:style="getDropdownItemStyle(locale, 'en')"
|
:style="getDropdownItemStyle(locale, 'en')"
|
||||||
@click="translationEn"
|
@click="translationEn"
|
||||||
><el-icon class="check-en" v-show="locale === 'en'"
|
|
||||||
><IconifyIconOffline icon="check" /></el-icon
|
|
||||||
>English</el-dropdown-item
|
|
||||||
>
|
>
|
||||||
|
<span class="check-en" v-show="locale === 'en'">
|
||||||
|
<IconifyIconOffline icon="check" /> </span
|
||||||
|
>English
|
||||||
|
</el-dropdown-item>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</template>
|
</template>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
<!-- 退出登陆 -->
|
<!-- 退出登陆 -->
|
||||||
<el-dropdown trigger="click">
|
<el-dropdown trigger="click">
|
||||||
<span class="el-dropdown-link">
|
<span class="el-dropdown-link">
|
||||||
<img :src="avatars" />
|
<img v-if="avatars" :src="avatars" :style="avatarsStyle" />
|
||||||
<p>{{ usename }}</p>
|
<p v-if="username">{{ username }}</p>
|
||||||
</span>
|
</span>
|
||||||
<template #dropdown>
|
<template #dropdown>
|
||||||
<el-dropdown-menu class="logout">
|
<el-dropdown-menu class="logout">
|
||||||
@@ -98,18 +103,18 @@ function translationEn() {
|
|||||||
<IconifyIconOffline
|
<IconifyIconOffline
|
||||||
icon="logout-circle-r-line"
|
icon="logout-circle-r-line"
|
||||||
style="margin: 5px"
|
style="margin: 5px"
|
||||||
/>{{ $t("buttons.hsLoginOut") }}</el-dropdown-item
|
/>{{ t("buttons.hsLoginOut") }}</el-dropdown-item
|
||||||
>
|
>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</template>
|
</template>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
<el-icon
|
<span
|
||||||
class="el-icon-setting"
|
class="el-icon-setting"
|
||||||
:title="$t('buttons.hssystemSet')"
|
:title="t('buttons.hssystemSet')"
|
||||||
@click="onPanel"
|
@click="onPanel"
|
||||||
>
|
>
|
||||||
<IconifyIconOffline icon="setting" />
|
<IconifyIconOffline icon="setting" />
|
||||||
</el-icon>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -165,7 +170,6 @@ function translationEn() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.el-dropdown-link {
|
.el-dropdown-link {
|
||||||
width: 100px;
|
|
||||||
height: 48px;
|
height: 48px;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import NoticeList from "./noticeList.vue";
|
|
||||||
import { noticesData } from "./data";
|
import { noticesData } from "./data";
|
||||||
|
import NoticeList from "./noticeList.vue";
|
||||||
|
import { templateRef } from "@vueuse/core";
|
||||||
|
import { Tabs, TabPane } from "@pureadmin/components";
|
||||||
|
|
||||||
|
const dropdownDom = templateRef<ElRef | null>("dropdownDom", null);
|
||||||
const activeName = ref(noticesData[0].name);
|
const activeName = ref(noticesData[0].name);
|
||||||
const notices = ref(noticesData);
|
const notices = ref(noticesData);
|
||||||
|
|
||||||
@@ -10,38 +13,51 @@ let noticesNum = ref(0);
|
|||||||
notices.value.forEach(notice => {
|
notices.value.forEach(notice => {
|
||||||
noticesNum.value += notice.list.length;
|
noticesNum.value += notice.list.length;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function tabClick() {
|
||||||
|
// @ts-expect-error
|
||||||
|
dropdownDom.value.handleOpen();
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<el-dropdown trigger="click" placement="bottom-end">
|
<el-dropdown ref="dropdownDom" trigger="click" placement="bottom-end">
|
||||||
<span class="dropdown-badge">
|
<span class="dropdown-badge">
|
||||||
<el-badge :value="noticesNum" :max="99">
|
<el-badge :value="noticesNum" :max="99">
|
||||||
<el-icon class="header-notice-icon"
|
<span class="header-notice-icon">
|
||||||
><IconifyIconOffline icon="bell"
|
<IconifyIconOffline icon="bell" />
|
||||||
/></el-icon>
|
</span>
|
||||||
</el-badge>
|
</el-badge>
|
||||||
</span>
|
</span>
|
||||||
<template #dropdown>
|
<template #dropdown>
|
||||||
<el-dropdown-menu>
|
<el-dropdown-menu>
|
||||||
<el-tabs v-model="activeName" class="dropdown-tabs">
|
<Tabs
|
||||||
|
centered
|
||||||
|
class="dropdown-tabs"
|
||||||
|
v-model:activeName="activeName"
|
||||||
|
@tabClick="tabClick"
|
||||||
|
>
|
||||||
<template v-for="item in notices" :key="item.key">
|
<template v-for="item in notices" :key="item.key">
|
||||||
<el-tab-pane
|
<TabPane :tab="`${item.name}(${item.list.length})`">
|
||||||
:label="`${item.name}(${item.list.length})`"
|
|
||||||
:name="item.name"
|
|
||||||
>
|
|
||||||
<el-scrollbar max-height="330px">
|
<el-scrollbar max-height="330px">
|
||||||
<div class="noticeList-container">
|
<div class="noticeList-container">
|
||||||
<NoticeList :list="item.list" />
|
<NoticeList :list="item.list" />
|
||||||
</div>
|
</div>
|
||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
</el-tab-pane>
|
</TabPane>
|
||||||
</template>
|
</template>
|
||||||
</el-tabs>
|
</Tabs>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</template>
|
</template>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.ant-tabs-dropdown {
|
||||||
|
z-index: 2900 !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.dropdown-badge {
|
.dropdown-badge {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -79,4 +95,8 @@ notices.value.forEach(notice => {
|
|||||||
padding: 15px 24px 0 24px;
|
padding: 15px 24px 0 24px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:deep(.ant-tabs-nav) {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ const props = defineProps({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const titleRef = ref(null);
|
const titleRef = ref(null);
|
||||||
const descriptionRef = ref(null);
|
|
||||||
const titleTooltip = ref(false);
|
const titleTooltip = ref(false);
|
||||||
|
const descriptionRef = ref(null);
|
||||||
const descriptionTooltip = ref(false);
|
const descriptionTooltip = ref(false);
|
||||||
|
|
||||||
function hoverTitle() {
|
function hoverTitle() {
|
||||||
@@ -50,7 +50,7 @@ function hoverDescription(event, description) {
|
|||||||
:size="30"
|
:size="30"
|
||||||
:src="props.noticeItem.avatar"
|
:src="props.noticeItem.avatar"
|
||||||
class="notice-container-avatar"
|
class="notice-container-avatar"
|
||||||
></el-avatar>
|
/>
|
||||||
<div class="notice-container-text">
|
<div class="notice-container-text">
|
||||||
<div class="notice-text-title">
|
<div class="notice-text-title">
|
||||||
<el-tooltip
|
<el-tooltip
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { PropType } from "vue";
|
import { PropType } from "vue";
|
||||||
import NoticeItem from "./noticeItem.vue";
|
|
||||||
import { ListItem } from "./data";
|
import { ListItem } from "./data";
|
||||||
|
import NoticeItem from "./noticeItem.vue";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
list: {
|
list: {
|
||||||
@@ -17,7 +17,7 @@ const props = defineProps({
|
|||||||
v-for="(item, index) in props.list"
|
v-for="(item, index) in props.list"
|
||||||
:noticeItem="item"
|
:noticeItem="item"
|
||||||
:key="index"
|
:key="index"
|
||||||
></NoticeItem>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<el-empty v-else description="暂无数据"></el-empty>
|
<el-empty v-else description="暂无数据" />
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -23,10 +23,10 @@ emitter.on("openPanel", () => {
|
|||||||
<div class="project-configuration">
|
<div class="project-configuration">
|
||||||
<h3>项目配置</h3>
|
<h3>项目配置</h3>
|
||||||
<el-icon title="关闭配置" class="el-icon-close" @click="show = !show">
|
<el-icon title="关闭配置" class="el-icon-close" @click="show = !show">
|
||||||
<IconifyIconOffline icon="close" />
|
<IconifyIconOffline icon="close-bold" />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
</div>
|
</div>
|
||||||
<div style="border-bottom: 1px solid #dcdfe6"></div>
|
<div style="border-bottom: 1px solid #dcdfe6" />
|
||||||
<slot />
|
<slot />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -54,7 +54,7 @@ emitter.on("openPanel", () => {
|
|||||||
|
|
||||||
.right-panel {
|
.right-panel {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 300px;
|
max-width: 315px;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
@@ -105,8 +105,8 @@ emitter.on("openPanel", () => {
|
|||||||
|
|
||||||
.right-panel-items {
|
.right-panel-items {
|
||||||
margin-top: 60px;
|
margin-top: 60px;
|
||||||
height: 100vh;
|
height: calc(100vh - 60px);
|
||||||
overflow: auto;
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.project-configuration {
|
.project-configuration {
|
||||||
@@ -120,7 +120,7 @@ emitter.on("openPanel", () => {
|
|||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
|
|
||||||
i {
|
i {
|
||||||
font-size: 20px;
|
font-size: 16px;
|
||||||
margin-right: 20px;
|
margin-right: 20px;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useFullscreen } from "@vueuse/core";
|
import { useFullscreen } from "@vueuse/core";
|
||||||
|
import { useI18n } from "vue-i18n";
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
const { isFullscreen, toggle } = useFullscreen();
|
const { isFullscreen, toggle } = useFullscreen();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -7,9 +10,7 @@ const { isFullscreen, toggle } = useFullscreen();
|
|||||||
<div class="screen-full" @click="toggle">
|
<div class="screen-full" @click="toggle">
|
||||||
<FontIcon
|
<FontIcon
|
||||||
:title="
|
:title="
|
||||||
isFullscreen
|
isFullscreen ? t('buttons.hsexitfullscreen') : t('buttons.hsfullscreen')
|
||||||
? $t('buttons.hsexitfullscreen')
|
|
||||||
: $t('buttons.hsfullscreen')
|
|
||||||
"
|
"
|
||||||
:icon="isFullscreen ? 'team-iconexit-fullscreen' : 'team-iconfullscreen'"
|
:icon="isFullscreen ? 'team-iconexit-fullscreen' : 'team-iconfullscreen'"
|
||||||
/>
|
/>
|
||||||
|
|||||||
42
src/layout/components/search/components/SearchFooter.vue
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
<template>
|
||||||
|
<div class="search-footer">
|
||||||
|
<span class="search-footer-item">
|
||||||
|
<enterOutlined class="icon" />
|
||||||
|
确认
|
||||||
|
</span>
|
||||||
|
<span class="search-footer-item">
|
||||||
|
<IconifyIconOffline icon="arrow-up-line" class="icon" />
|
||||||
|
<IconifyIconOffline icon="arrow-down-line" class="icon" />
|
||||||
|
切换
|
||||||
|
</span>
|
||||||
|
<span class="search-footer-item">
|
||||||
|
<mdiKeyboardEsc class="icon" />
|
||||||
|
关闭
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import enterOutlined from "/@/assets/svg/enter_outlined.svg?component";
|
||||||
|
import mdiKeyboardEsc from "/@/assets/svg/mdi_keyboard_esc.svg?component";
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.search-footer {
|
||||||
|
display: flex;
|
||||||
|
color: #333;
|
||||||
|
|
||||||
|
.search-footer-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
margin-right: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
padding: 2px;
|
||||||
|
margin-right: 3px;
|
||||||
|
font-size: 20px;
|
||||||
|
box-shadow: inset 0 -2px #cdcde6, inset 0 0 1px 1px #fff,
|
||||||
|
0 1px 2px 1px #1e235a66;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
165
src/layout/components/search/components/SearchModal.vue
Normal file
@@ -0,0 +1,165 @@
|
|||||||
|
<script lang="ts" setup>
|
||||||
|
import { useRouter } from "vue-router";
|
||||||
|
import SearchResult from "./SearchResult.vue";
|
||||||
|
import SearchFooter from "./SearchFooter.vue";
|
||||||
|
import { deleteChildren } from "/@/utils/tree";
|
||||||
|
import { transformI18n } from "/@/plugins/i18n";
|
||||||
|
import { useDebounceFn, onKeyStroke } from "@vueuse/core";
|
||||||
|
import { ref, watch, computed, nextTick, shallowRef } from "vue";
|
||||||
|
import { usePermissionStoreHook } from "/@/store/modules/permission";
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
/** 弹窗显隐 */
|
||||||
|
value: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Emits {
|
||||||
|
(e: "update:value", val: boolean): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const emit = defineEmits<Emits>();
|
||||||
|
const props = withDefaults(defineProps<Props>(), {});
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
|
const keyword = ref("");
|
||||||
|
const activePath = ref("");
|
||||||
|
const inputRef = ref<HTMLInputElement | null>(null);
|
||||||
|
const resultOptions = shallowRef([]);
|
||||||
|
const handleSearch = useDebounceFn(search, 300);
|
||||||
|
|
||||||
|
/** 菜单树形结构 */
|
||||||
|
const menusData = computed(() => {
|
||||||
|
return deleteChildren(usePermissionStoreHook().menusTree);
|
||||||
|
});
|
||||||
|
|
||||||
|
const show = computed({
|
||||||
|
get() {
|
||||||
|
return props.value;
|
||||||
|
},
|
||||||
|
set(val: boolean) {
|
||||||
|
emit("update:value", val);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
watch(show, async val => {
|
||||||
|
if (val) {
|
||||||
|
/** 自动聚焦 */
|
||||||
|
await nextTick();
|
||||||
|
inputRef.value?.focus();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/** 将菜单树形结构扁平化为一维数组,用于菜单查询 */
|
||||||
|
function flatTree(arr) {
|
||||||
|
const res = [];
|
||||||
|
function deep(arr) {
|
||||||
|
arr.forEach(item => {
|
||||||
|
res.push(item);
|
||||||
|
item.children && deep(item.children);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
deep(arr);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 查询 */
|
||||||
|
function search() {
|
||||||
|
const flatMenusData = flatTree(menusData.value);
|
||||||
|
resultOptions.value = flatMenusData.filter(
|
||||||
|
menu =>
|
||||||
|
keyword.value &&
|
||||||
|
transformI18n(menu.meta?.title)
|
||||||
|
.toLocaleLowerCase()
|
||||||
|
.includes(keyword.value.toLocaleLowerCase().trim())
|
||||||
|
);
|
||||||
|
if (resultOptions.value?.length > 0) {
|
||||||
|
activePath.value = resultOptions.value[0].path;
|
||||||
|
} else {
|
||||||
|
activePath.value = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleClose() {
|
||||||
|
show.value = false;
|
||||||
|
/** 延时处理防止用户看到某些操作 */
|
||||||
|
setTimeout(() => {
|
||||||
|
resultOptions.value = [];
|
||||||
|
keyword.value = "";
|
||||||
|
}, 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** key up */
|
||||||
|
function handleUp() {
|
||||||
|
const { length } = resultOptions.value;
|
||||||
|
if (length === 0) return;
|
||||||
|
const index = resultOptions.value.findIndex(
|
||||||
|
item => item.path === activePath.value
|
||||||
|
);
|
||||||
|
if (index === 0) {
|
||||||
|
activePath.value = resultOptions.value[length - 1].path;
|
||||||
|
} else {
|
||||||
|
activePath.value = resultOptions.value[index - 1].path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** key down */
|
||||||
|
function handleDown() {
|
||||||
|
const { length } = resultOptions.value;
|
||||||
|
if (length === 0) return;
|
||||||
|
const index = resultOptions.value.findIndex(
|
||||||
|
item => item.path === activePath.value
|
||||||
|
);
|
||||||
|
if (index + 1 === length) {
|
||||||
|
activePath.value = resultOptions.value[0].path;
|
||||||
|
} else {
|
||||||
|
activePath.value = resultOptions.value[index + 1].path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** key enter */
|
||||||
|
function handleEnter() {
|
||||||
|
const { length } = resultOptions.value;
|
||||||
|
if (length === 0 || activePath.value === "") return;
|
||||||
|
router.push(activePath.value);
|
||||||
|
handleClose();
|
||||||
|
}
|
||||||
|
|
||||||
|
onKeyStroke("Enter", handleEnter);
|
||||||
|
onKeyStroke("ArrowUp", handleUp);
|
||||||
|
onKeyStroke("ArrowDown", handleDown);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<el-dialog top="5vh" v-model="show" :before-close="handleClose">
|
||||||
|
<el-input
|
||||||
|
ref="inputRef"
|
||||||
|
v-model="keyword"
|
||||||
|
clearable
|
||||||
|
placeholder="请输入关键词搜索"
|
||||||
|
@input="handleSearch"
|
||||||
|
>
|
||||||
|
<template #prefix>
|
||||||
|
<span class="el-input__icon">
|
||||||
|
<IconifyIconOffline icon="search" />
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-input>
|
||||||
|
<div class="search-result-container">
|
||||||
|
<el-empty v-if="resultOptions.length === 0" description="暂无搜索结果" />
|
||||||
|
<SearchResult
|
||||||
|
v-else
|
||||||
|
v-model:value="activePath"
|
||||||
|
:options="resultOptions"
|
||||||
|
@click="handleEnter"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<template #footer>
|
||||||
|
<SearchFooter />
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.search-result-container {
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
91
src/layout/components/search/components/SearchResult.vue
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
<template>
|
||||||
|
<div class="result">
|
||||||
|
<template v-for="item in options" :key="item.path">
|
||||||
|
<div
|
||||||
|
class="result-item"
|
||||||
|
:style="{
|
||||||
|
background:
|
||||||
|
item?.path === active ? useEpThemeStoreHook().epThemeColor : '',
|
||||||
|
color: item.path === active ? '#fff' : ''
|
||||||
|
}"
|
||||||
|
@click="handleTo"
|
||||||
|
@mouseenter="handleMouse(item)"
|
||||||
|
>
|
||||||
|
<component :is="useRenderIcon(item.meta?.icon ?? 'bookmark')" />
|
||||||
|
<span class="result-item-title">{{ t(item.meta?.title) }}</span>
|
||||||
|
<enterOutlined />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { computed } from "vue";
|
||||||
|
import { useI18n } from "vue-i18n";
|
||||||
|
import { useEpThemeStoreHook } from "/@/store/modules/epTheme";
|
||||||
|
import { useRenderIcon } from "/@/components/ReIcon/src/hooks";
|
||||||
|
import enterOutlined from "/@/assets/svg/enter_outlined.svg?component";
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
interface optionsItem {
|
||||||
|
path: string;
|
||||||
|
meta?: {
|
||||||
|
icon?: string;
|
||||||
|
title?: string;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
value: string;
|
||||||
|
options: Array<optionsItem>;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Emits {
|
||||||
|
(e: "update:value", val: string): void;
|
||||||
|
(e: "enter"): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = withDefaults(defineProps<Props>(), {});
|
||||||
|
const emit = defineEmits<Emits>();
|
||||||
|
|
||||||
|
const active = computed({
|
||||||
|
get() {
|
||||||
|
return props.value;
|
||||||
|
},
|
||||||
|
set(val: string) {
|
||||||
|
emit("update:value", val);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/** 鼠标移入 */
|
||||||
|
async function handleMouse(item) {
|
||||||
|
active.value = item.path;
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleTo() {
|
||||||
|
emit("enter");
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.result {
|
||||||
|
padding-bottom: 12px;
|
||||||
|
|
||||||
|
&-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
height: 56px;
|
||||||
|
margin-top: 8px;
|
||||||
|
padding: 14px;
|
||||||
|
border-radius: 4px;
|
||||||
|
background: #e5e7eb;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
&-title {
|
||||||
|
display: flex;
|
||||||
|
flex: 1;
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
3
src/layout/components/search/components/index.ts
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
import SearchModal from "./SearchModal.vue";
|
||||||
|
|
||||||
|
export { SearchModal };
|
||||||
30
src/layout/components/search/index.vue
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<script lang="ts" setup>
|
||||||
|
import { SearchModal } from "./components";
|
||||||
|
import useBoolean from "../../hooks/useBoolean";
|
||||||
|
const { bool: show, toggle } = useBoolean();
|
||||||
|
function handleSearch() {
|
||||||
|
toggle();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="search-container" @click="handleSearch">
|
||||||
|
<IconifyIconOffline icon="search" />
|
||||||
|
</div>
|
||||||
|
<SearchModal v-model:value="show" />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.search-container {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
height: 48px;
|
||||||
|
width: 40px;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: #f6f6f6;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -9,8 +9,7 @@ import {
|
|||||||
useCssModule,
|
useCssModule,
|
||||||
getCurrentInstance
|
getCurrentInstance
|
||||||
} from "vue";
|
} from "vue";
|
||||||
import rgbHex from "rgb-hex";
|
import { find } from "lodash-unified";
|
||||||
import { find } from "lodash-es";
|
|
||||||
import { getConfig } from "/@/config";
|
import { getConfig } from "/@/config";
|
||||||
import { useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
import panel from "../panel/index.vue";
|
import panel from "../panel/index.vue";
|
||||||
@@ -24,7 +23,7 @@ import { useEpThemeStoreHook } from "/@/store/modules/epTheme";
|
|||||||
import { storageLocal, storageSession } from "/@/utils/storage";
|
import { storageLocal, storageSession } from "/@/utils/storage";
|
||||||
import { useMultiTagsStoreHook } from "/@/store/modules/multiTags";
|
import { useMultiTagsStoreHook } from "/@/store/modules/multiTags";
|
||||||
import { createNewStyle, writeNewStyle } from "../../theme/element-plus";
|
import { createNewStyle, writeNewStyle } from "../../theme/element-plus";
|
||||||
import { toggleTheme } from "@zougt/vite-plugin-theme-preprocessor/dist/browser-utils";
|
import { toggleTheme } from "@pureadmin/theme/dist/browser-utils";
|
||||||
|
|
||||||
import dayIcon from "/@/assets/svg/day.svg?component";
|
import dayIcon from "/@/assets/svg/day.svg?component";
|
||||||
import darkIcon from "/@/assets/svg/dark.svg?component";
|
import darkIcon from "/@/assets/svg/dark.svg?component";
|
||||||
@@ -40,23 +39,23 @@ const instanceConfig =
|
|||||||
|
|
||||||
let themeColors = ref<Array<themeColorsType>>([
|
let themeColors = ref<Array<themeColorsType>>([
|
||||||
// 道奇蓝(默认)
|
// 道奇蓝(默认)
|
||||||
{ rgb: "27, 42, 71", themeColor: "default" },
|
{ color: "#1b2a47", themeColor: "default" },
|
||||||
// 亮白色
|
// 亮白色
|
||||||
{ rgb: "255, 255, 255", themeColor: "light" },
|
{ color: "#ffffff", themeColor: "light" },
|
||||||
// 猩红色
|
// 猩红色
|
||||||
{ rgb: "245, 34, 45", themeColor: "dusk" },
|
{ color: "#f5222d", themeColor: "dusk" },
|
||||||
// 橙红色
|
// 橙红色
|
||||||
{ rgb: "250, 84, 28", themeColor: "volcano" },
|
{ color: "#fa541c", themeColor: "volcano" },
|
||||||
// 金色
|
// 金色
|
||||||
{ rgb: "250, 219, 20", themeColor: "yellow" },
|
{ color: "#fadb14", themeColor: "yellow" },
|
||||||
// 绿宝石
|
// 绿宝石
|
||||||
{ rgb: "19, 194, 194", themeColor: "mingQing" },
|
{ color: "#13c2c2", themeColor: "mingQing" },
|
||||||
// 酸橙绿
|
// 酸橙绿
|
||||||
{ rgb: "82, 196, 26", themeColor: "auroraGreen" },
|
{ color: "#52c41a", themeColor: "auroraGreen" },
|
||||||
// 深粉色
|
// 深粉色
|
||||||
{ rgb: "235, 47, 150", themeColor: "pink" },
|
{ color: "#eb2f96", themeColor: "pink" },
|
||||||
// 深紫罗兰色
|
// 深紫罗兰色
|
||||||
{ rgb: "114, 46, 209", themeColor: "saucePurple" }
|
{ color: "#722ed1", themeColor: "saucePurple" }
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const verticalRef = templateRef<HTMLElement | null>("verticalRef", null);
|
const verticalRef = templateRef<HTMLElement | null>("verticalRef", null);
|
||||||
@@ -97,8 +96,8 @@ const settings = reactive({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const getThemeColorStyle = computed(() => {
|
const getThemeColorStyle = computed(() => {
|
||||||
return rgb => {
|
return color => {
|
||||||
return { background: `rgb(${rgb})` };
|
return { background: color };
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -111,7 +110,7 @@ function storageConfigureChange<T>(key: string, val: T): void {
|
|||||||
function toggleClass(flag: boolean, clsName: string, target?: HTMLElement) {
|
function toggleClass(flag: boolean, clsName: string, target?: HTMLElement) {
|
||||||
const targetEl = target || document.body;
|
const targetEl = target || document.body;
|
||||||
let { className } = targetEl;
|
let { className } = targetEl;
|
||||||
className = className.replace(clsName, "");
|
className = className.replace(clsName, "").trim();
|
||||||
targetEl.className = flag ? `${className} ${clsName} ` : className;
|
targetEl.className = flag ? `${className} ${clsName} ` : className;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,8 +157,7 @@ function onReset() {
|
|||||||
parentPath: "/",
|
parentPath: "/",
|
||||||
meta: {
|
meta: {
|
||||||
title: "menus.hshome",
|
title: "menus.hshome",
|
||||||
icon: "home-filled",
|
icon: "home-filled"
|
||||||
i18n: true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
@@ -261,13 +259,13 @@ function setLayoutThemeColor(theme: string) {
|
|||||||
setEpThemeColor(getConfig().EpThemeColor);
|
setEpThemeColor(getConfig().EpThemeColor);
|
||||||
} else {
|
} else {
|
||||||
const colors = find(themeColors.value, { themeColor: theme });
|
const colors = find(themeColors.value, { themeColor: theme });
|
||||||
const color = "#" + rgbHex(colors.rgb);
|
setEpThemeColor(colors.color);
|
||||||
setEpThemeColor(color);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 设置ep主题色
|
// 设置ep主题色
|
||||||
const setEpThemeColor = (color: string) => {
|
const setEpThemeColor = (color: string) => {
|
||||||
|
// @ts-expect-error
|
||||||
writeNewStyle(createNewStyle(color));
|
writeNewStyle(createNewStyle(color));
|
||||||
useEpThemeStoreHook().setEpThemeColor(color);
|
useEpThemeStoreHook().setEpThemeColor(color);
|
||||||
body.style.setProperty("--el-color-primary-active", shadeBgColor(color));
|
body.style.setProperty("--el-color-primary-active", shadeBgColor(color));
|
||||||
@@ -300,7 +298,7 @@ nextTick(() => {
|
|||||||
settings.weakVal &&
|
settings.weakVal &&
|
||||||
document.querySelector("html")?.setAttribute("class", "html-weakness");
|
document.querySelector("html")?.setAttribute("class", "html-weakness");
|
||||||
settings.tabsVal && tagsChange();
|
settings.tabsVal && tagsChange();
|
||||||
|
// @ts-expect-error
|
||||||
writeNewStyle(createNewStyle(epThemeColor.value));
|
writeNewStyle(createNewStyle(epThemeColor.value));
|
||||||
dataThemeChange();
|
dataThemeChange();
|
||||||
});
|
});
|
||||||
@@ -316,8 +314,7 @@ nextTick(() => {
|
|||||||
:active-icon="dayIcon"
|
:active-icon="dayIcon"
|
||||||
:inactive-icon="darkIcon"
|
:inactive-icon="darkIcon"
|
||||||
@change="dataThemeChange"
|
@change="dataThemeChange"
|
||||||
>
|
/>
|
||||||
</el-switch>
|
|
||||||
|
|
||||||
<el-divider>导航栏模式</el-divider>
|
<el-divider>导航栏模式</el-divider>
|
||||||
<ul class="pure-theme">
|
<ul class="pure-theme">
|
||||||
@@ -327,8 +324,8 @@ nextTick(() => {
|
|||||||
ref="verticalRef"
|
ref="verticalRef"
|
||||||
@click="setLayoutModel('vertical')"
|
@click="setLayoutModel('vertical')"
|
||||||
>
|
>
|
||||||
<div></div>
|
<div />
|
||||||
<div></div>
|
<div />
|
||||||
</li>
|
</li>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
|
|
||||||
@@ -338,8 +335,8 @@ nextTick(() => {
|
|||||||
ref="horizontalRef"
|
ref="horizontalRef"
|
||||||
@click="setLayoutModel('horizontal')"
|
@click="setLayoutModel('horizontal')"
|
||||||
>
|
>
|
||||||
<div></div>
|
<div />
|
||||||
<div></div>
|
<div />
|
||||||
</li>
|
</li>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
|
|
||||||
@@ -349,8 +346,8 @@ nextTick(() => {
|
|||||||
ref="mixRef"
|
ref="mixRef"
|
||||||
@click="setLayoutModel('mix')"
|
@click="setLayoutModel('mix')"
|
||||||
>
|
>
|
||||||
<div></div>
|
<div />
|
||||||
<div></div>
|
<div />
|
||||||
</li>
|
</li>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -360,7 +357,7 @@ nextTick(() => {
|
|||||||
<li
|
<li
|
||||||
v-for="(item, index) in themeColors"
|
v-for="(item, index) in themeColors"
|
||||||
:key="index"
|
:key="index"
|
||||||
:style="getThemeColorStyle(item.rgb)"
|
:style="getThemeColorStyle(item.color)"
|
||||||
@click="setLayoutThemeColor(item.themeColor)"
|
@click="setLayoutThemeColor(item.themeColor)"
|
||||||
>
|
>
|
||||||
<el-icon
|
<el-icon
|
||||||
@@ -384,8 +381,7 @@ nextTick(() => {
|
|||||||
active-text="开"
|
active-text="开"
|
||||||
inactive-text="关"
|
inactive-text="关"
|
||||||
@change="greyChange"
|
@change="greyChange"
|
||||||
>
|
/>
|
||||||
</el-switch>
|
|
||||||
</li>
|
</li>
|
||||||
<li v-show="!dataTheme">
|
<li v-show="!dataTheme">
|
||||||
<span>色弱模式</span>
|
<span>色弱模式</span>
|
||||||
@@ -396,8 +392,7 @@ nextTick(() => {
|
|||||||
active-text="开"
|
active-text="开"
|
||||||
inactive-text="关"
|
inactive-text="关"
|
||||||
@change="weekChange"
|
@change="weekChange"
|
||||||
>
|
/>
|
||||||
</el-switch>
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<span>隐藏标签页</span>
|
<span>隐藏标签页</span>
|
||||||
@@ -408,8 +403,7 @@ nextTick(() => {
|
|||||||
active-text="开"
|
active-text="开"
|
||||||
inactive-text="关"
|
inactive-text="关"
|
||||||
@change="tagsChange"
|
@change="tagsChange"
|
||||||
>
|
/>
|
||||||
</el-switch>
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<span>侧边栏Logo</span>
|
<span>侧边栏Logo</span>
|
||||||
@@ -422,8 +416,7 @@ nextTick(() => {
|
|||||||
active-text="开"
|
active-text="开"
|
||||||
inactive-text="关"
|
inactive-text="关"
|
||||||
@change="logoChange"
|
@change="logoChange"
|
||||||
>
|
/>
|
||||||
</el-switch>
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<span>标签页持久化</span>
|
<span>标签页持久化</span>
|
||||||
@@ -434,8 +427,7 @@ nextTick(() => {
|
|||||||
active-text="开"
|
active-text="开"
|
||||||
inactive-text="关"
|
inactive-text="关"
|
||||||
@change="multiTagsCacheChange"
|
@change="multiTagsCacheChange"
|
||||||
>
|
/>
|
||||||
</el-switch>
|
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
@@ -454,7 +446,7 @@ nextTick(() => {
|
|||||||
@click="onReset"
|
@click="onReset"
|
||||||
>
|
>
|
||||||
<IconifyIconOffline
|
<IconifyIconOffline
|
||||||
icon="fa-sign-out"
|
icon="logout-circle-r-line"
|
||||||
width="15"
|
width="15"
|
||||||
height="15"
|
height="15"
|
||||||
style="margin-right: 4px"
|
style="margin-right: 4px"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, watch } from "vue";
|
import { ref, watch } from "vue";
|
||||||
import { isEqual } from "lodash-es";
|
import { isEqual } from "lodash-unified";
|
||||||
import { transformI18n } from "/@/plugins/i18n";
|
import { transformI18n } from "/@/plugins/i18n";
|
||||||
import { getParentPaths, findRouteByPath } from "/@/router/utils";
|
import { getParentPaths, findRouteByPath } from "/@/router/utils";
|
||||||
import { useMultiTagsStoreHook } from "/@/store/modules/multiTags";
|
import { useMultiTagsStoreHook } from "/@/store/modules/multiTags";
|
||||||
@@ -65,7 +65,7 @@ const getBreadcrumb = (): void => {
|
|||||||
{
|
{
|
||||||
path: "/welcome",
|
path: "/welcome",
|
||||||
parentPath: "/",
|
parentPath: "/",
|
||||||
meta: { title: "menus.hshome", i18n: true }
|
meta: { title: "menus.hshome" }
|
||||||
} as unknown as RouteLocationMatched
|
} as unknown as RouteLocationMatched
|
||||||
].concat(matched);
|
].concat(matched);
|
||||||
}
|
}
|
||||||
@@ -104,10 +104,10 @@ const handleLink = (item: RouteLocationMatched): any => {
|
|||||||
<span
|
<span
|
||||||
v-if="item.redirect === 'noRedirect' || index == levelList.length - 1"
|
v-if="item.redirect === 'noRedirect' || index == levelList.length - 1"
|
||||||
class="no-redirect"
|
class="no-redirect"
|
||||||
>{{ transformI18n(item.meta.title, item.meta.i18n) }}</span
|
>{{ transformI18n(item.meta.title) }}</span
|
||||||
>
|
>
|
||||||
<a v-else @click.prevent="handleLink(item)">
|
<a v-else @click.prevent="handleLink(item)">
|
||||||
{{ transformI18n(item.meta.title, item.meta.i18n) }}
|
{{ transformI18n(item.meta.title) }}
|
||||||
</a>
|
</a>
|
||||||
</el-breadcrumb-item>
|
</el-breadcrumb-item>
|
||||||
</transition-group>
|
</transition-group>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
import { useNav } from "../../hooks/nav";
|
import { useNav } from "../../hooks/nav";
|
||||||
|
import Search from "../search/index.vue";
|
||||||
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";
|
||||||
@@ -13,7 +14,7 @@ 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 route = useRoute();
|
||||||
const { locale } = useI18n();
|
const { locale, t } = useI18n();
|
||||||
const routers = useRouter().options.routes;
|
const routers = useRouter().options.routes;
|
||||||
const menuRef = templateRef<ElRef | null>("menu", null);
|
const menuRef = templateRef<ElRef | null>("menu", null);
|
||||||
const instance =
|
const instance =
|
||||||
@@ -28,7 +29,8 @@ const {
|
|||||||
changeTitle,
|
changeTitle,
|
||||||
handleResize,
|
handleResize,
|
||||||
menuSelect,
|
menuSelect,
|
||||||
usename,
|
username,
|
||||||
|
avatarsStyle,
|
||||||
getDropdownItemStyle
|
getDropdownItemStyle
|
||||||
} = useNav();
|
} = useNav();
|
||||||
|
|
||||||
@@ -45,6 +47,13 @@ watch(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => route.path,
|
||||||
|
() => {
|
||||||
|
menuSelect(route.path, routers);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
function translationCh() {
|
function translationCh() {
|
||||||
instance.locale = { locale: "zh" };
|
instance.locale = { locale: "zh" };
|
||||||
locale.value = "zh";
|
locale.value = "zh";
|
||||||
@@ -61,11 +70,7 @@ function translationEn() {
|
|||||||
<template>
|
<template>
|
||||||
<div class="horizontal-header">
|
<div class="horizontal-header">
|
||||||
<div class="horizontal-header-left" @click="backHome">
|
<div class="horizontal-header-left" @click="backHome">
|
||||||
<FontIcon
|
<FontIcon icon="team-iconlogo" svg style="width: 35px; height: 35px" />
|
||||||
icon="team-iconlogo"
|
|
||||||
svg
|
|
||||||
style="width: 35px; height: 35px"
|
|
||||||
></FontIcon>
|
|
||||||
<h4>{{ title }}</h4>
|
<h4>{{ title }}</h4>
|
||||||
</div>
|
</div>
|
||||||
<el-menu
|
<el-menu
|
||||||
@@ -84,6 +89,8 @@ function translationEn() {
|
|||||||
/>
|
/>
|
||||||
</el-menu>
|
</el-menu>
|
||||||
<div class="horizontal-header-right">
|
<div class="horizontal-header-right">
|
||||||
|
<!-- 菜单搜索 -->
|
||||||
|
<Search />
|
||||||
<!-- 通知 -->
|
<!-- 通知 -->
|
||||||
<Notice id="header-notice" />
|
<Notice id="header-notice" />
|
||||||
<!-- 全屏 -->
|
<!-- 全屏 -->
|
||||||
@@ -96,15 +103,17 @@ function translationEn() {
|
|||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
:style="getDropdownItemStyle(locale, 'zh')"
|
:style="getDropdownItemStyle(locale, 'zh')"
|
||||||
@click="translationCh"
|
@click="translationCh"
|
||||||
><el-icon class="check-zh" v-show="locale === 'zh'"
|
|
||||||
><IconifyIconOffline icon="check" /></el-icon
|
|
||||||
>简体中文</el-dropdown-item
|
|
||||||
>
|
>
|
||||||
|
<span class="check-zh" v-show="locale === 'zh'">
|
||||||
|
<IconifyIconOffline icon="check" /> </span
|
||||||
|
>简体中文
|
||||||
|
</el-dropdown-item>
|
||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
:style="getDropdownItemStyle(locale, 'en')"
|
:style="getDropdownItemStyle(locale, 'en')"
|
||||||
@click="translationEn"
|
@click="translationEn"
|
||||||
><el-icon class="check-en" v-show="locale === 'en'"
|
>
|
||||||
><IconifyIconOffline icon="check" /></el-icon
|
<span class="check-en" v-show="locale === 'en'">
|
||||||
|
<IconifyIconOffline icon="check" /> </span
|
||||||
>English</el-dropdown-item
|
>English</el-dropdown-item
|
||||||
>
|
>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
@@ -113,8 +122,8 @@ function translationEn() {
|
|||||||
<!-- 退出登陆 -->
|
<!-- 退出登陆 -->
|
||||||
<el-dropdown trigger="click">
|
<el-dropdown trigger="click">
|
||||||
<span class="el-dropdown-link">
|
<span class="el-dropdown-link">
|
||||||
<img :src="avatars" />
|
<img v-if="avatars" :src="avatars" :style="avatarsStyle" />
|
||||||
<p>{{ usename }}</p>
|
<p v-if="username">{{ username }}</p>
|
||||||
</span>
|
</span>
|
||||||
<template #dropdown>
|
<template #dropdown>
|
||||||
<el-dropdown-menu class="logout">
|
<el-dropdown-menu class="logout">
|
||||||
@@ -123,18 +132,18 @@ function translationEn() {
|
|||||||
icon="logout-circle-r-line"
|
icon="logout-circle-r-line"
|
||||||
style="margin: 5px"
|
style="margin: 5px"
|
||||||
/>
|
/>
|
||||||
{{ $t("buttons.hsLoginOut") }}</el-dropdown-item
|
{{ t("buttons.hsLoginOut") }}</el-dropdown-item
|
||||||
>
|
>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</template>
|
</template>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
<el-icon
|
<span
|
||||||
class="el-icon-setting"
|
class="el-icon-setting"
|
||||||
:title="$t('buttons.hssystemSet')"
|
:title="t('buttons.hssystemSet')"
|
||||||
@click="onPanel"
|
@click="onPanel"
|
||||||
>
|
>
|
||||||
<IconifyIconOffline icon="setting" />
|
<IconifyIconOffline icon="setting" />
|
||||||
</el-icon>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -18,11 +18,7 @@ const title =
|
|||||||
class="sidebar-logo-link"
|
class="sidebar-logo-link"
|
||||||
to="/"
|
to="/"
|
||||||
>
|
>
|
||||||
<FontIcon
|
<FontIcon icon="team-iconlogo" svg style="width: 35px; height: 35px" />
|
||||||
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
|
||||||
@@ -32,11 +28,7 @@ const title =
|
|||||||
class="sidebar-logo-link"
|
class="sidebar-logo-link"
|
||||||
to="/"
|
to="/"
|
||||||
>
|
>
|
||||||
<FontIcon
|
<FontIcon icon="team-iconlogo" svg style="width: 35px; height: 35px" />
|
||||||
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>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
|
import Search from "../search/index.vue";
|
||||||
import Notice from "../notice/index.vue";
|
import Notice from "../notice/index.vue";
|
||||||
import { useNav } from "../../hooks/nav";
|
import { useNav } from "../../hooks/nav";
|
||||||
import { templateRef } from "@vueuse/core";
|
import { templateRef } from "@vueuse/core";
|
||||||
@@ -16,7 +17,7 @@ import globalization from "/@/assets/svg/globalization.svg?component";
|
|||||||
import { ref, watch, nextTick, onMounted, getCurrentInstance } from "vue";
|
import { ref, watch, nextTick, onMounted, getCurrentInstance } from "vue";
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { locale } = useI18n();
|
const { locale, t } = useI18n();
|
||||||
const routers = useRouter().options.routes;
|
const routers = useRouter().options.routes;
|
||||||
const menuRef = templateRef<ElRef | null>("menu", null);
|
const menuRef = templateRef<ElRef | null>("menu", null);
|
||||||
const instance =
|
const instance =
|
||||||
@@ -31,7 +32,8 @@ const {
|
|||||||
menuSelect,
|
menuSelect,
|
||||||
resolvePath,
|
resolvePath,
|
||||||
pureApp,
|
pureApp,
|
||||||
usename,
|
username,
|
||||||
|
avatarsStyle,
|
||||||
getDropdownItemStyle
|
getDropdownItemStyle
|
||||||
} = useNav();
|
} = useNav();
|
||||||
|
|
||||||
@@ -118,12 +120,10 @@ function translationEn() {
|
|||||||
:index="resolvePath(route) || route.redirect"
|
:index="resolvePath(route) || route.redirect"
|
||||||
>
|
>
|
||||||
<template #title>
|
<template #title>
|
||||||
<el-icon v-show="route.meta.icon" :class="route.meta.icon">
|
<div v-show="route.meta.icon" :class="['el-icon', route.meta.icon]">
|
||||||
<component
|
<component :is="useRenderIcon(route.meta && route.meta.icon)" />
|
||||||
:is="useRenderIcon(route.meta && route.meta.icon)"
|
</div>
|
||||||
></component>
|
<span>{{ transformI18n(route.meta.title) }}</span>
|
||||||
</el-icon>
|
|
||||||
<span>{{ transformI18n(route.meta.title, route.meta.i18n) }}</span>
|
|
||||||
<FontIcon
|
<FontIcon
|
||||||
v-if="route.meta.extraIcon"
|
v-if="route.meta.extraIcon"
|
||||||
width="30px"
|
width="30px"
|
||||||
@@ -131,11 +131,13 @@ function translationEn() {
|
|||||||
style="position: absolute; right: 10px"
|
style="position: absolute; right: 10px"
|
||||||
:icon="route.meta.extraIcon.name"
|
:icon="route.meta.extraIcon.name"
|
||||||
:svg="route.meta.extraIcon.svg ? true : false"
|
:svg="route.meta.extraIcon.svg ? true : false"
|
||||||
></FontIcon>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
</el-menu>
|
</el-menu>
|
||||||
<div class="horizontal-header-right">
|
<div class="horizontal-header-right">
|
||||||
|
<!-- 菜单搜索 -->
|
||||||
|
<Search />
|
||||||
<!-- 通知 -->
|
<!-- 通知 -->
|
||||||
<Notice id="header-notice" />
|
<Notice id="header-notice" />
|
||||||
<!-- 全屏 -->
|
<!-- 全屏 -->
|
||||||
@@ -148,15 +150,15 @@ function translationEn() {
|
|||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
:style="getDropdownItemStyle(locale, 'zh')"
|
:style="getDropdownItemStyle(locale, 'zh')"
|
||||||
@click="translationCh"
|
@click="translationCh"
|
||||||
><el-icon class="check-zh" v-show="locale === 'zh'"
|
><span class="check-zh" v-show="locale === 'zh'"
|
||||||
><IconifyIconOffline icon="check" /></el-icon
|
><IconifyIconOffline icon="check" /></span
|
||||||
>简体中文</el-dropdown-item
|
>简体中文</el-dropdown-item
|
||||||
>
|
>
|
||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
:style="getDropdownItemStyle(locale, 'en')"
|
:style="getDropdownItemStyle(locale, 'en')"
|
||||||
@click="translationEn"
|
@click="translationEn"
|
||||||
><el-icon class="check-en" v-show="locale === 'en'"
|
><span class="check-en" v-show="locale === 'en'"
|
||||||
><IconifyIconOffline icon="check" /></el-icon
|
><IconifyIconOffline icon="check" /></span
|
||||||
>English</el-dropdown-item
|
>English</el-dropdown-item
|
||||||
>
|
>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
@@ -165,8 +167,8 @@ function translationEn() {
|
|||||||
<!-- 退出登陆 -->
|
<!-- 退出登陆 -->
|
||||||
<el-dropdown trigger="click">
|
<el-dropdown trigger="click">
|
||||||
<span class="el-dropdown-link">
|
<span class="el-dropdown-link">
|
||||||
<img :src="avatars" />
|
<img v-if="avatars" :src="avatars" :style="avatarsStyle" />
|
||||||
<p>{{ usename }}</p>
|
<p v-if="username">{{ username }}</p>
|
||||||
</span>
|
</span>
|
||||||
<template #dropdown>
|
<template #dropdown>
|
||||||
<el-dropdown-menu class="logout">
|
<el-dropdown-menu class="logout">
|
||||||
@@ -175,18 +177,18 @@ function translationEn() {
|
|||||||
icon="logout-circle-r-line"
|
icon="logout-circle-r-line"
|
||||||
style="margin: 5px"
|
style="margin: 5px"
|
||||||
/>
|
/>
|
||||||
{{ $t("buttons.hsLoginOut") }}</el-dropdown-item
|
{{ t("buttons.hsLoginOut") }}</el-dropdown-item
|
||||||
>
|
>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</template>
|
</template>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
<el-icon
|
<span
|
||||||
class="el-icon-setting"
|
class="el-icon-setting"
|
||||||
:title="$t('buttons.hssystemSet')"
|
:title="t('buttons.hssystemSet')"
|
||||||
@click="onPanel"
|
@click="onPanel"
|
||||||
>
|
>
|
||||||
<IconifyIconOffline icon="setting" />
|
<IconifyIconOffline icon="setting" />
|
||||||
</el-icon>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, PropType, nextTick, computed, CSSProperties } from "vue";
|
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import { useNav } from "../../hooks/nav";
|
import { useNav } from "../../hooks/nav";
|
||||||
import { childrenType } from "../../types";
|
import { childrenType } from "../../types";
|
||||||
import { transformI18n } from "/@/plugins/i18n";
|
import { transformI18n } from "/@/plugins/i18n";
|
||||||
import { useAppStoreHook } from "/@/store/modules/app";
|
import { useAppStoreHook } from "/@/store/modules/app";
|
||||||
import { useRenderIcon } from "/@/components/ReIcon/src/hooks";
|
import { useRenderIcon } from "/@/components/ReIcon/src/hooks";
|
||||||
|
import { ref, PropType, nextTick, computed, CSSProperties } from "vue";
|
||||||
|
|
||||||
const { pureApp } = useNav();
|
const { pureApp } = useNav();
|
||||||
const menuMode = ["vertical", "mix"].includes(pureApp.layout);
|
const menuMode = ["vertical", "mix"].includes(pureApp.layout);
|
||||||
@@ -111,6 +111,10 @@ function hasOneShowingChild(
|
|||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (showingChildren[0]?.meta?.showParent) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (showingChildren.length === 1) {
|
if (showingChildren.length === 1) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -144,7 +148,7 @@ function resolvePath(routePath) {
|
|||||||
:class="{ 'submenu-title-noDropdown': !isNest }"
|
:class="{ 'submenu-title-noDropdown': !isNest }"
|
||||||
:style="getNoDropdownStyle"
|
:style="getNoDropdownStyle"
|
||||||
>
|
>
|
||||||
<el-icon v-show="props.item.meta.icon">
|
<div class="sub-menu-icon" v-show="props.item.meta.icon">
|
||||||
<component
|
<component
|
||||||
:is="
|
:is="
|
||||||
useRenderIcon(
|
useRenderIcon(
|
||||||
@@ -152,8 +156,8 @@ function resolvePath(routePath) {
|
|||||||
(props.item.meta && props.item.meta.icon)
|
(props.item.meta && props.item.meta.icon)
|
||||||
)
|
)
|
||||||
"
|
"
|
||||||
></component>
|
/>
|
||||||
</el-icon>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-if="
|
v-if="
|
||||||
!pureApp.sidebar.opened &&
|
!pureApp.sidebar.opened &&
|
||||||
@@ -163,13 +167,13 @@ function resolvePath(routePath) {
|
|||||||
:style="getDivStyle"
|
:style="getDivStyle"
|
||||||
>
|
>
|
||||||
<span :style="getMenuTextStyle">
|
<span :style="getMenuTextStyle">
|
||||||
{{ transformI18n(onlyOneChild.meta.title, onlyOneChild.meta.i18n) }}
|
{{ transformI18n(onlyOneChild.meta.title) }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<template #title>
|
<template #title>
|
||||||
<div :style="getDivStyle">
|
<div :style="getDivStyle">
|
||||||
<span v-if="!menuMode">{{
|
<span v-if="!menuMode">{{
|
||||||
transformI18n(onlyOneChild.meta.title, onlyOneChild.meta.i18n)
|
transformI18n(onlyOneChild.meta.title)
|
||||||
}}</span>
|
}}</span>
|
||||||
<el-tooltip
|
<el-tooltip
|
||||||
v-else
|
v-else
|
||||||
@@ -178,18 +182,14 @@ function resolvePath(routePath) {
|
|||||||
:disabled="!onlyOneChild.showTooltip"
|
:disabled="!onlyOneChild.showTooltip"
|
||||||
>
|
>
|
||||||
<template #content>
|
<template #content>
|
||||||
{{
|
{{ transformI18n(onlyOneChild.meta.title) }}
|
||||||
transformI18n(onlyOneChild.meta.title, onlyOneChild.meta.i18n)
|
|
||||||
}}
|
|
||||||
</template>
|
</template>
|
||||||
<span
|
<span
|
||||||
ref="menuTextRef"
|
ref="menuTextRef"
|
||||||
:style="getMenuTextStyle"
|
:style="getMenuTextStyle"
|
||||||
@mouseover="hoverMenu(onlyOneChild)"
|
@mouseover="hoverMenu(onlyOneChild)"
|
||||||
>
|
>
|
||||||
{{
|
{{ transformI18n(onlyOneChild.meta.title) }}
|
||||||
transformI18n(onlyOneChild.meta.title, onlyOneChild.meta.i18n)
|
|
||||||
}}
|
|
||||||
</span>
|
</span>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<FontIcon
|
<FontIcon
|
||||||
@@ -199,7 +199,7 @@ function resolvePath(routePath) {
|
|||||||
:style="getExtraIconStyle"
|
:style="getExtraIconStyle"
|
||||||
:icon="onlyOneChild.meta.extraIcon.name"
|
:icon="onlyOneChild.meta.extraIcon.name"
|
||||||
:svg="onlyOneChild.meta.extraIcon.svg ? true : false"
|
:svg="onlyOneChild.meta.extraIcon.svg ? true : false"
|
||||||
></FontIcon>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
@@ -212,14 +212,12 @@ function resolvePath(routePath) {
|
|||||||
popper-append-to-body
|
popper-append-to-body
|
||||||
>
|
>
|
||||||
<template #title>
|
<template #title>
|
||||||
<el-icon v-show="props.item.meta.icon" :class="props.item.meta.icon">
|
<div v-show="props.item.meta.icon" class="sub-menu-icon">
|
||||||
<component
|
<component
|
||||||
:is="useRenderIcon(props.item.meta && props.item.meta.icon)"
|
:is="useRenderIcon(props.item.meta && props.item.meta.icon)"
|
||||||
></component>
|
/>
|
||||||
</el-icon>
|
</div>
|
||||||
<span v-if="!menuMode">{{
|
<span v-if="!menuMode">{{ transformI18n(props.item.meta.title) }}</span>
|
||||||
transformI18n(props.item.meta.title, props.item.meta.i18n)
|
|
||||||
}}</span>
|
|
||||||
<el-tooltip
|
<el-tooltip
|
||||||
v-else
|
v-else
|
||||||
placement="top"
|
placement="top"
|
||||||
@@ -227,7 +225,7 @@ function resolvePath(routePath) {
|
|||||||
:disabled="!pureApp.sidebar.opened || !props.item.showTooltip"
|
:disabled="!pureApp.sidebar.opened || !props.item.showTooltip"
|
||||||
>
|
>
|
||||||
<template #content>
|
<template #content>
|
||||||
{{ transformI18n(props.item.meta.title, props.item.meta.i18n) }}
|
{{ transformI18n(props.item.meta.title) }}
|
||||||
</template>
|
</template>
|
||||||
<div
|
<div
|
||||||
ref="menuTextRef"
|
ref="menuTextRef"
|
||||||
@@ -235,7 +233,7 @@ function resolvePath(routePath) {
|
|||||||
@mouseover="hoverMenu(props.item)"
|
@mouseover="hoverMenu(props.item)"
|
||||||
>
|
>
|
||||||
<span :style="getSpanStyle">
|
<span :style="getSpanStyle">
|
||||||
{{ transformI18n(props.item.meta.title, props.item.meta.i18n) }}
|
{{ transformI18n(props.item.meta.title) }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
@@ -246,7 +244,7 @@ function resolvePath(routePath) {
|
|||||||
style="position: absolute; right: 10px"
|
style="position: absolute; right: 10px"
|
||||||
:icon="props.item.meta.extraIcon.name"
|
:icon="props.item.meta.extraIcon.name"
|
||||||
:svg="props.item.meta.extraIcon.svg ? true : false"
|
:svg="props.item.meta.extraIcon.svg ? true : false"
|
||||||
></FontIcon>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<sidebar-item
|
<sidebar-item
|
||||||
v-for="child in props.item.children"
|
v-for="child in props.item.children"
|
||||||
|
|||||||
@@ -49,7 +49,10 @@ onBeforeMount(() => {
|
|||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => route.path,
|
() => route.path,
|
||||||
() => getSubMenuData(route.path)
|
() => {
|
||||||
|
getSubMenuData(route.path);
|
||||||
|
menuSelect(route.path, routers);
|
||||||
|
}
|
||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import {
|
|||||||
ref,
|
ref,
|
||||||
watch,
|
watch,
|
||||||
unref,
|
unref,
|
||||||
|
toRaw,
|
||||||
reactive,
|
reactive,
|
||||||
nextTick,
|
nextTick,
|
||||||
computed,
|
computed,
|
||||||
@@ -19,12 +20,12 @@ import closeLeft from "/@/assets/svg/close_left.svg?component";
|
|||||||
import closeOther from "/@/assets/svg/close_other.svg?component";
|
import closeOther from "/@/assets/svg/close_other.svg?component";
|
||||||
import closeRight from "/@/assets/svg/close_right.svg?component";
|
import closeRight from "/@/assets/svg/close_right.svg?component";
|
||||||
|
|
||||||
|
import { useI18n } from "vue-i18n";
|
||||||
import { emitter } from "/@/utils/mitt";
|
import { emitter } from "/@/utils/mitt";
|
||||||
import { $t as t } from "/@/plugins/i18n";
|
|
||||||
import { isEqual, isEmpty } from "lodash-es";
|
|
||||||
import { transformI18n } from "/@/plugins/i18n";
|
|
||||||
import { storageLocal } from "/@/utils/storage";
|
import { storageLocal } from "/@/utils/storage";
|
||||||
import { useRoute, useRouter } from "vue-router";
|
import { useRoute, useRouter } from "vue-router";
|
||||||
|
import { isEqual, isEmpty } from "lodash-unified";
|
||||||
|
import { transformI18n, $t } from "/@/plugins/i18n";
|
||||||
import { RouteConfigs, tagsViewsType } from "../../types";
|
import { RouteConfigs, tagsViewsType } from "../../types";
|
||||||
import { useSettingStoreHook } from "/@/store/modules/settings";
|
import { useSettingStoreHook } from "/@/store/modules/settings";
|
||||||
import { handleAliveRoute, delAliveRoutes } from "/@/router/utils";
|
import { handleAliveRoute, delAliveRoutes } from "/@/router/utils";
|
||||||
@@ -33,6 +34,7 @@ import { usePermissionStoreHook } from "/@/store/modules/permission";
|
|||||||
import { toggleClass, removeClass, hasClass } from "/@/utils/operate";
|
import { toggleClass, removeClass, hasClass } from "/@/utils/operate";
|
||||||
import { templateRef, useResizeObserver, useDebounceFn } from "@vueuse/core";
|
import { templateRef, useResizeObserver, useDebounceFn } from "@vueuse/core";
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const translateX = ref<number>(0);
|
const translateX = ref<number>(0);
|
||||||
@@ -193,42 +195,42 @@ const handleScroll = (offset: number): void => {
|
|||||||
const tagsViews = reactive<Array<tagsViewsType>>([
|
const tagsViews = reactive<Array<tagsViewsType>>([
|
||||||
{
|
{
|
||||||
icon: refresh,
|
icon: refresh,
|
||||||
text: t("buttons.hsreload"),
|
text: $t("buttons.hsreload"),
|
||||||
divided: false,
|
divided: false,
|
||||||
disabled: false,
|
disabled: false,
|
||||||
show: true
|
show: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: close,
|
icon: close,
|
||||||
text: t("buttons.hscloseCurrentTab"),
|
text: $t("buttons.hscloseCurrentTab"),
|
||||||
divided: false,
|
divided: false,
|
||||||
disabled: multiTags.value.length > 1 ? false : true,
|
disabled: multiTags.value.length > 1 ? false : true,
|
||||||
show: true
|
show: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: closeLeft,
|
icon: closeLeft,
|
||||||
text: t("buttons.hscloseLeftTabs"),
|
text: $t("buttons.hscloseLeftTabs"),
|
||||||
divided: true,
|
divided: true,
|
||||||
disabled: multiTags.value.length > 1 ? false : true,
|
disabled: multiTags.value.length > 1 ? false : true,
|
||||||
show: true
|
show: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: closeRight,
|
icon: closeRight,
|
||||||
text: t("buttons.hscloseRightTabs"),
|
text: $t("buttons.hscloseRightTabs"),
|
||||||
divided: false,
|
divided: false,
|
||||||
disabled: multiTags.value.length > 1 ? false : true,
|
disabled: multiTags.value.length > 1 ? false : true,
|
||||||
show: true
|
show: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: closeOther,
|
icon: closeOther,
|
||||||
text: t("buttons.hscloseOtherTabs"),
|
text: $t("buttons.hscloseOtherTabs"),
|
||||||
divided: true,
|
divided: true,
|
||||||
disabled: multiTags.value.length > 2 ? false : true,
|
disabled: multiTags.value.length > 2 ? false : true,
|
||||||
show: true
|
show: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: closeAll,
|
icon: closeAll,
|
||||||
text: t("buttons.hscloseAllTabs"),
|
text: $t("buttons.hscloseAllTabs"),
|
||||||
divided: false,
|
divided: false,
|
||||||
disabled: multiTags.value.length > 1 ? false : true,
|
disabled: multiTags.value.length > 1 ? false : true,
|
||||||
show: true
|
show: true
|
||||||
@@ -317,7 +319,6 @@ function deleteDynamicTag(obj: any, current: any, tag?: string) {
|
|||||||
parentPath: "/",
|
parentPath: "/",
|
||||||
meta: {
|
meta: {
|
||||||
title: "menus.hshome",
|
title: "menus.hshome",
|
||||||
i18n: true,
|
|
||||||
icon: "home-filled"
|
icon: "home-filled"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -428,6 +429,7 @@ function onClickDrop(key, item, selectRoute?: RouteConfigs) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleCommand(command: object) {
|
function handleCommand(command: object) {
|
||||||
|
// @ts-expect-error
|
||||||
const { key, item } = command;
|
const { key, item } = command;
|
||||||
onClickDrop(key, item);
|
onClickDrop(key, item);
|
||||||
}
|
}
|
||||||
@@ -660,9 +662,9 @@ const getContextMenuStyle = computed((): CSSProperties => {
|
|||||||
@click="tagOnClick(item)"
|
@click="tagOnClick(item)"
|
||||||
>
|
>
|
||||||
<router-link :to="item.path"
|
<router-link :to="item.path"
|
||||||
>{{ transformI18n(item.meta.title, item.meta.i18n) }}
|
>{{ transformI18n(item.meta.title) }}
|
||||||
</router-link>
|
</router-link>
|
||||||
<el-icon
|
<span
|
||||||
v-if="
|
v-if="
|
||||||
iconIsActive(item, index) ||
|
iconIsActive(item, index) ||
|
||||||
(index === activeIndex && index !== 0)
|
(index === activeIndex && index !== 0)
|
||||||
@@ -671,12 +673,12 @@ const getContextMenuStyle = computed((): CSSProperties => {
|
|||||||
@click.stop="deleteMenu(item)"
|
@click.stop="deleteMenu(item)"
|
||||||
>
|
>
|
||||||
<IconifyIconOffline icon="close-bold" />
|
<IconifyIconOffline icon="close-bold" />
|
||||||
</el-icon>
|
</span>
|
||||||
<div
|
<div
|
||||||
:ref="'schedule' + index"
|
:ref="'schedule' + index"
|
||||||
v-if="showModel !== 'card'"
|
v-if="showModel !== 'card'"
|
||||||
:class="[scheduleIsActive(item)]"
|
:class="[scheduleIsActive(item)]"
|
||||||
></div>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -700,8 +702,8 @@ const getContextMenuStyle = computed((): CSSProperties => {
|
|||||||
style="display: flex; align-items: center"
|
style="display: flex; align-items: center"
|
||||||
>
|
>
|
||||||
<li v-if="item.show" @click="selectTag(key, item)">
|
<li v-if="item.show" @click="selectTag(key, item)">
|
||||||
<component :is="item.icon" :key="key" />
|
<component :is="toRaw(item.icon)" :key="key" />
|
||||||
{{ $t(item.text) }}
|
{{ t(item.text) }}
|
||||||
</li>
|
</li>
|
||||||
</div>
|
</div>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -709,13 +711,13 @@ const getContextMenuStyle = computed((): CSSProperties => {
|
|||||||
<!-- 右侧功能按钮 -->
|
<!-- 右侧功能按钮 -->
|
||||||
<ul class="right-button">
|
<ul class="right-button">
|
||||||
<li>
|
<li>
|
||||||
<el-icon
|
<span
|
||||||
:title="$t('buttons.hsrefreshRoute')"
|
:title="t('buttons.hsrefreshRoute')"
|
||||||
class="el-icon-refresh-right rotate"
|
class="el-icon-refresh-right rotate"
|
||||||
@click="onFresh"
|
@click="onFresh"
|
||||||
>
|
>
|
||||||
<IconifyIconOffline icon="refresh-right" />
|
<IconifyIconOffline icon="refresh-right" />
|
||||||
</el-icon>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<el-dropdown
|
<el-dropdown
|
||||||
@@ -723,9 +725,7 @@ const getContextMenuStyle = computed((): CSSProperties => {
|
|||||||
placement="bottom-end"
|
placement="bottom-end"
|
||||||
@command="handleCommand"
|
@command="handleCommand"
|
||||||
>
|
>
|
||||||
<el-icon>
|
<IconifyIconOffline icon="arrow-down" />
|
||||||
<IconifyIconOffline icon="arrow-down" />
|
|
||||||
</el-icon>
|
|
||||||
<template #dropdown>
|
<template #dropdown>
|
||||||
<el-dropdown-menu>
|
<el-dropdown-menu>
|
||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
@@ -736,18 +736,18 @@ const getContextMenuStyle = computed((): CSSProperties => {
|
|||||||
:disabled="item.disabled"
|
:disabled="item.disabled"
|
||||||
>
|
>
|
||||||
<component
|
<component
|
||||||
:is="item.icon"
|
:is="toRaw(item.icon)"
|
||||||
:key="key"
|
:key="key"
|
||||||
style="margin-right: 6px"
|
style="margin-right: 6px"
|
||||||
/>
|
/>
|
||||||
{{ $t(item.text) }}
|
{{ t(item.text) }}
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</template>
|
</template>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<slot></slot>
|
<slot />
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
70
src/layout/frameView.vue
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
<template>
|
||||||
|
<div
|
||||||
|
class="frame"
|
||||||
|
v-loading="loading"
|
||||||
|
:element-loading-text="t('status.hsLoad')"
|
||||||
|
>
|
||||||
|
<iframe :src="frameSrc" class="frame-iframe" ref="frameRef" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { useI18n } from "vue-i18n";
|
||||||
|
import { useRoute } from "vue-router";
|
||||||
|
import { ref, unref, onMounted, nextTick } from "vue";
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
|
const loading = ref(false);
|
||||||
|
const currentRoute = useRoute();
|
||||||
|
const frameSrc = ref<string>("");
|
||||||
|
const frameRef = ref<HTMLElement | null>(null);
|
||||||
|
|
||||||
|
if (unref(currentRoute.meta)?.frameSrc) {
|
||||||
|
frameSrc.value = unref(currentRoute.meta)?.frameSrc as string;
|
||||||
|
}
|
||||||
|
|
||||||
|
function hideLoading() {
|
||||||
|
loading.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function init() {
|
||||||
|
nextTick(() => {
|
||||||
|
const iframe = unref(frameRef);
|
||||||
|
if (!iframe) return;
|
||||||
|
const _frame = iframe as any;
|
||||||
|
if (_frame.attachEvent) {
|
||||||
|
_frame.attachEvent("onload", () => {
|
||||||
|
hideLoading();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
iframe.onload = () => {
|
||||||
|
hideLoading();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
loading.value = true;
|
||||||
|
init();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.frame {
|
||||||
|
height: calc(100vh - 88px);
|
||||||
|
z-index: 998;
|
||||||
|
|
||||||
|
.frame-iframe {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
border: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-content {
|
||||||
|
margin: 2px 0 0 !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,17 +1,20 @@
|
|||||||
import { computed } from "vue";
|
import { computed } from "vue";
|
||||||
import { router } from "/@/router";
|
import { router } from "/@/router";
|
||||||
|
import { getConfig } from "/@/config";
|
||||||
import { emitter } from "/@/utils/mitt";
|
import { emitter } from "/@/utils/mitt";
|
||||||
import { routeMetaType } from "../types";
|
import { routeMetaType } from "../types";
|
||||||
|
import { remainingPaths } from "/@/router";
|
||||||
import { transformI18n } from "/@/plugins/i18n";
|
import { transformI18n } from "/@/plugins/i18n";
|
||||||
import { storageSession } from "/@/utils/storage";
|
import { storageSession } from "/@/utils/storage";
|
||||||
import { useAppStoreHook } from "/@/store/modules/app";
|
import { useAppStoreHook } from "/@/store/modules/app";
|
||||||
import { Title } from "../../../public/serverConfig.json";
|
|
||||||
import { useEpThemeStoreHook } from "/@/store/modules/epTheme";
|
import { useEpThemeStoreHook } from "/@/store/modules/epTheme";
|
||||||
|
|
||||||
|
const errorInfo = "当前路由配置不正确,请检查配置";
|
||||||
|
|
||||||
export function useNav() {
|
export function useNav() {
|
||||||
const pureApp = useAppStoreHook();
|
const pureApp = useAppStoreHook();
|
||||||
// 用户名
|
// 用户名
|
||||||
const usename: string = storageSession.getItem("info")?.username;
|
const username: string = storageSession.getItem("info")?.username;
|
||||||
|
|
||||||
// 设置国际化选中后的样式
|
// 设置国际化选中后的样式
|
||||||
const getDropdownItemStyle = computed(() => {
|
const getDropdownItemStyle = computed(() => {
|
||||||
@@ -23,15 +26,19 @@ export function useNav() {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const avatarsStyle = computed(() => {
|
||||||
|
return username ? { marginRight: "10px" } : "";
|
||||||
|
});
|
||||||
|
|
||||||
const isCollapse = computed(() => {
|
const isCollapse = computed(() => {
|
||||||
return !pureApp.getSidebarStatus;
|
return !pureApp.getSidebarStatus;
|
||||||
});
|
});
|
||||||
|
|
||||||
// 动态title
|
// 动态title
|
||||||
function changeTitle(meta: routeMetaType) {
|
function changeTitle(meta: routeMetaType) {
|
||||||
if (Title)
|
const Title = getConfig().Title;
|
||||||
document.title = `${transformI18n(meta.title, meta.i18n)} | ${Title}`;
|
if (Title) document.title = `${transformI18n(meta.title)} | ${Title}`;
|
||||||
else document.title = transformI18n(meta.title, meta.i18n);
|
else document.title = transformI18n(meta.title);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 退出登录
|
// 退出登录
|
||||||
@@ -57,6 +64,7 @@ export function useNav() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function resolvePath(route) {
|
function resolvePath(route) {
|
||||||
|
if (!route.children) return console.error(errorInfo);
|
||||||
const httpReg = /^http(s?):\/\//;
|
const httpReg = /^http(s?):\/\//;
|
||||||
const routeChildPath = route.children[0]?.path;
|
const routeChildPath = route.children[0]?.path;
|
||||||
if (httpReg.test(routeChildPath)) {
|
if (httpReg.test(routeChildPath)) {
|
||||||
@@ -67,6 +75,7 @@ export function useNav() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function menuSelect(indexPath: string, routers): void {
|
function menuSelect(indexPath: string, routers): void {
|
||||||
|
if (isRemaining(indexPath)) return;
|
||||||
let parentPath = "";
|
let parentPath = "";
|
||||||
const parentPathIndex = indexPath.lastIndexOf("/");
|
const parentPathIndex = indexPath.lastIndexOf("/");
|
||||||
if (parentPathIndex > 0) {
|
if (parentPathIndex > 0) {
|
||||||
@@ -74,6 +83,7 @@ export function useNav() {
|
|||||||
}
|
}
|
||||||
// 找到当前路由的信息
|
// 找到当前路由的信息
|
||||||
function findCurrentRoute(indexPath: string, routes) {
|
function findCurrentRoute(indexPath: string, routes) {
|
||||||
|
if (!routes) return console.error(errorInfo);
|
||||||
return routes.map(item => {
|
return routes.map(item => {
|
||||||
if (item.path === indexPath) {
|
if (item.path === indexPath) {
|
||||||
if (item.redirect) {
|
if (item.redirect) {
|
||||||
@@ -93,6 +103,11 @@ export function useNav() {
|
|||||||
findCurrentRoute(indexPath, routers);
|
findCurrentRoute(indexPath, routers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 判断路径是否参与菜单
|
||||||
|
function isRemaining(path: string): boolean {
|
||||||
|
return remainingPaths.includes(path);
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
logout,
|
logout,
|
||||||
backHome,
|
backHome,
|
||||||
@@ -104,7 +119,8 @@ export function useNav() {
|
|||||||
resolvePath,
|
resolvePath,
|
||||||
isCollapse,
|
isCollapse,
|
||||||
pureApp,
|
pureApp,
|
||||||
usename,
|
username,
|
||||||
|
avatarsStyle,
|
||||||
getDropdownItemStyle
|
getDropdownItemStyle
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
26
src/layout/hooks/useBoolean.ts
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
import { ref } from "vue";
|
||||||
|
|
||||||
|
export default function useBoolean(initValue = false) {
|
||||||
|
const bool = ref(initValue);
|
||||||
|
|
||||||
|
function setBool(value: boolean) {
|
||||||
|
bool.value = value;
|
||||||
|
}
|
||||||
|
function setTrue() {
|
||||||
|
setBool(true);
|
||||||
|
}
|
||||||
|
function setFalse() {
|
||||||
|
setBool(false);
|
||||||
|
}
|
||||||
|
function toggle() {
|
||||||
|
setBool(!bool.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
bool,
|
||||||
|
setBool,
|
||||||
|
setTrue,
|
||||||
|
setFalse,
|
||||||
|
toggle
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -16,5 +16,5 @@ replace({
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div></div>
|
<div />
|
||||||
</template>
|
</template>
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
<template>
|
|
||||||
<router-view>
|
|
||||||
<template #default="{ Component, route }">
|
|
||||||
<transition appear name="fade-transform" mode="out-in">
|
|
||||||
<component :is="Component" :key="route.fullPath" />
|
|
||||||
</transition>
|
|
||||||
</template>
|
|
||||||
</router-view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts">
|
|
||||||
export default {
|
|
||||||
name: "layoutParentView"
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
/* 酸橙绿 */
|
|
||||||
$subMenuActiveText: #fff;
|
|
||||||
$menuBg: #0b1e15;
|
|
||||||
$menuHover: #60ac80;
|
|
||||||
$subMenuBg: #000;
|
|
||||||
$subMenuActiveBg: #60ac80;
|
|
||||||
$navTextColor: #7a80b4;
|
|
||||||
$menuText: #7a80b4;
|
|
||||||
$sidebarLogo: #112f21;
|
|
||||||
$menuTitleHover: #fff;
|
|
||||||
$menuActiveBefore: #60ac80;
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
/**
|
|
||||||
* 道奇蓝(默认)
|
|
||||||
* 此scss变量文件作为multipleScopeVars去编译时,会自动移除!default以达到变量提升
|
|
||||||
* 同时此scss变量文件作为默认主题变量文件,被其他.scss通过 @import 时,必需 !default
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* 菜单选中后字体样式 */
|
|
||||||
$subMenuActiveText: #fff !default;
|
|
||||||
|
|
||||||
/* 菜单背景 */
|
|
||||||
$menuBg: #001529 !default;
|
|
||||||
|
|
||||||
/* 鼠标覆盖到菜单时的背景 */
|
|
||||||
$menuHover: #4091f7 !default;
|
|
||||||
|
|
||||||
/* 子菜单背景 */
|
|
||||||
$subMenuBg: #0f0303 !default;
|
|
||||||
|
|
||||||
/* 有无子集的激活菜单背景 */
|
|
||||||
$subMenuActiveBg: #4091f7 !default;
|
|
||||||
$navTextColor: #fff !default;
|
|
||||||
$menuText: rgb(254 254 254 / 65%) !default;
|
|
||||||
|
|
||||||
/* logo背景颜色 */
|
|
||||||
$sidebarLogo: #002140 !default;
|
|
||||||
|
|
||||||
/* 鼠标覆盖到菜单时的字体颜色 */
|
|
||||||
$menuTitleHover: #fff !default;
|
|
||||||
$menuActiveBefore: #4091f7 !default;
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
/* 猩红色 */
|
|
||||||
$subMenuActiveText: #fff;
|
|
||||||
$menuBg: #2a0608;
|
|
||||||
$menuHover: #e13c39;
|
|
||||||
$subMenuBg: #000;
|
|
||||||
$subMenuActiveBg: #e13c39;
|
|
||||||
$navTextColor: red;
|
|
||||||
$menuText: rgb(254 254 254 / 65.1%);
|
|
||||||
$sidebarLogo: #42090c;
|
|
||||||
$menuTitleHover: #fff;
|
|
||||||
$menuActiveBefore: #e13c39;
|
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
/* 动态改变element-plus主题色 */
|
/* 动态改变element-plus主题色 */
|
||||||
import rgbHex from "rgb-hex";
|
import rgbHex from "rgb-hex";
|
||||||
import { convert } from "css-color-function";
|
import epCss from "./element.scss";
|
||||||
import { TinyColor } from "@ctrl/tinycolor";
|
import { TinyColor } from "@ctrl/tinycolor";
|
||||||
import epCss from "element-plus/dist/index.css";
|
import { convert } from "css-color-function";
|
||||||
|
|
||||||
// 色值表
|
// 色值表
|
||||||
const formula = {
|
const formula = {
|
||||||
@@ -26,7 +26,9 @@ export const writeNewStyle = (newStyle: string): void => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 根据主题色,生成最新的样式表
|
// 根据主题色,生成最新的样式表
|
||||||
export const createNewStyle = (primaryStyle: string): string => {
|
export const createNewStyle = (
|
||||||
|
primaryStyle: Record<string, any>
|
||||||
|
): Record<string, any> => {
|
||||||
// 根据主色生成色值表
|
// 根据主色生成色值表
|
||||||
const colors = createColors(primaryStyle);
|
const colors = createColors(primaryStyle);
|
||||||
// 在当前ep的默认样式表中标记需要替换的色值
|
// 在当前ep的默认样式表中标记需要替换的色值
|
||||||
@@ -41,7 +43,9 @@ export const createNewStyle = (primaryStyle: string): string => {
|
|||||||
return cssText;
|
return cssText;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const createColors = (primary: string) => {
|
export const createColors = (
|
||||||
|
primary: Record<string, any>
|
||||||
|
): Record<string, any> => {
|
||||||
if (!primary) return;
|
if (!primary) return;
|
||||||
const colors = {
|
const colors = {
|
||||||
primary
|
primary
|
||||||
@@ -53,7 +57,7 @@ export const createColors = (primary: string) => {
|
|||||||
return colors;
|
return colors;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getStyleTemplate = (data: string): string => {
|
const getStyleTemplate = (data: Record<string, any>): Record<string, any> => {
|
||||||
const colorMap = {
|
const colorMap = {
|
||||||
"#3a8ee6": "shade-1",
|
"#3a8ee6": "shade-1",
|
||||||
"#409eff": "primary",
|
"#409eff": "primary",
|
||||||
|
|||||||
2
src/layout/theme/element.scss
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
/* 通过scss模块本地导入element-plus的全局样式文件,解决vite2.7.13版本后使用 import epCss from "element-plus/dist/index.css",打包后加载不到样式的问题 */
|
||||||
|
@import "element-plus/dist/index.css";
|
||||||
136
src/layout/theme/index.ts
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
const themeColors = {
|
||||||
|
default: {
|
||||||
|
color: "#409EFF",
|
||||||
|
subMenuActiveText: "#fff",
|
||||||
|
menuBg: "#001529",
|
||||||
|
menuHover: "#4091f7",
|
||||||
|
subMenuBg: "#0f0303",
|
||||||
|
subMenuActiveBg: "#4091f7",
|
||||||
|
navTextColor: "#fff",
|
||||||
|
menuText: "rgb(254 254 254 / 65%)",
|
||||||
|
sidebarLogo: "#002140",
|
||||||
|
menuTitleHover: "#fff",
|
||||||
|
menuActiveBefore: "#4091f7"
|
||||||
|
},
|
||||||
|
light: {
|
||||||
|
color: "#409EFF",
|
||||||
|
subMenuActiveText: "#409eff",
|
||||||
|
menuBg: "#fff",
|
||||||
|
menuHover: "#e0ebf6",
|
||||||
|
subMenuBg: "#fff",
|
||||||
|
subMenuActiveBg: "#e0ebf6",
|
||||||
|
navTextColor: "#7a80b4",
|
||||||
|
menuText: "#7a80b4",
|
||||||
|
sidebarLogo: "#fff",
|
||||||
|
menuTitleHover: "#000",
|
||||||
|
menuActiveBefore: "#4091f7"
|
||||||
|
},
|
||||||
|
dusk: {
|
||||||
|
color: "#f5222d",
|
||||||
|
subMenuActiveText: "#fff",
|
||||||
|
menuBg: "#2a0608",
|
||||||
|
menuHover: "#e13c39",
|
||||||
|
subMenuBg: "#000",
|
||||||
|
subMenuActiveBg: "#e13c39",
|
||||||
|
navTextColor: "#red",
|
||||||
|
menuText: "rgb(254 254 254 / 65.1%)",
|
||||||
|
sidebarLogo: "#42090c",
|
||||||
|
menuTitleHover: "#fff",
|
||||||
|
menuActiveBefore: "#e13c39"
|
||||||
|
},
|
||||||
|
volcano: {
|
||||||
|
color: "#fa541c",
|
||||||
|
subMenuActiveText: "#fff",
|
||||||
|
menuBg: "#2b0e05",
|
||||||
|
menuHover: "#e85f33",
|
||||||
|
subMenuBg: "#0f0603",
|
||||||
|
subMenuActiveBg: "#e85f33",
|
||||||
|
navTextColor: "#fff",
|
||||||
|
menuText: "rgb(254 254 254 / 65%)",
|
||||||
|
sidebarLogo: "#441708",
|
||||||
|
menuTitleHover: "#fff",
|
||||||
|
menuActiveBefore: "#e85f33"
|
||||||
|
},
|
||||||
|
yellow: {
|
||||||
|
color: "#fadb14",
|
||||||
|
subMenuActiveText: "#d25f00",
|
||||||
|
menuBg: "#2b2503",
|
||||||
|
menuHover: "#f6da4d",
|
||||||
|
subMenuBg: "#0f0603",
|
||||||
|
subMenuActiveBg: "#f6da4d",
|
||||||
|
navTextColor: "#fff",
|
||||||
|
menuText: "rgb(254 254 254 / 65%)",
|
||||||
|
sidebarLogo: "#443b05",
|
||||||
|
menuTitleHover: "#fff",
|
||||||
|
menuActiveBefore: "#f6da4d"
|
||||||
|
},
|
||||||
|
mingQing: {
|
||||||
|
color: "#13c2c2",
|
||||||
|
subMenuActiveText: "#fff",
|
||||||
|
menuBg: "#032121",
|
||||||
|
menuHover: "#59bfc1",
|
||||||
|
subMenuBg: "#000",
|
||||||
|
subMenuActiveBg: "#59bfc1",
|
||||||
|
navTextColor: "#7a80b4",
|
||||||
|
menuText: "#7a80b4",
|
||||||
|
sidebarLogo: "#053434",
|
||||||
|
menuTitleHover: "#fff",
|
||||||
|
menuActiveBefore: "#59bfc1"
|
||||||
|
},
|
||||||
|
auroraGreen: {
|
||||||
|
color: "#52c41a",
|
||||||
|
subMenuActiveText: "#fff",
|
||||||
|
menuBg: "#0b1e15",
|
||||||
|
menuHover: "#60ac80",
|
||||||
|
subMenuBg: "#000",
|
||||||
|
subMenuActiveBg: "#60ac80",
|
||||||
|
navTextColor: "#7a80b4",
|
||||||
|
menuText: "#7a80b4",
|
||||||
|
sidebarLogo: "#112f21",
|
||||||
|
menuTitleHover: "#fff",
|
||||||
|
menuActiveBefore: "#60ac80"
|
||||||
|
},
|
||||||
|
pink: {
|
||||||
|
color: "#eb2f96",
|
||||||
|
subMenuActiveText: "#fff",
|
||||||
|
menuBg: "#28081a",
|
||||||
|
menuHover: "#d84493",
|
||||||
|
subMenuBg: "#000",
|
||||||
|
subMenuActiveBg: "#d84493",
|
||||||
|
navTextColor: "#7a80b4",
|
||||||
|
menuText: "#7a80b4",
|
||||||
|
sidebarLogo: "#3f0d29",
|
||||||
|
menuTitleHover: "#fff",
|
||||||
|
menuActiveBefore: "#d84493"
|
||||||
|
},
|
||||||
|
saucePurple: {
|
||||||
|
color: "#722ed1",
|
||||||
|
subMenuActiveText: "#fff",
|
||||||
|
menuBg: "#130824",
|
||||||
|
menuHover: "#693ac9",
|
||||||
|
subMenuBg: "#000",
|
||||||
|
subMenuActiveBg: "#693ac9",
|
||||||
|
navTextColor: "#7a80b4",
|
||||||
|
menuText: "#7a80b4",
|
||||||
|
sidebarLogo: "#1f0c38",
|
||||||
|
menuTitleHover: "#fff",
|
||||||
|
menuActiveBefore: "#693ac9"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
type MultipleScopeVarsItem = {
|
||||||
|
scopeName: string;
|
||||||
|
path: string;
|
||||||
|
varsContent: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export function genScssMultipleScopeVars(): MultipleScopeVarsItem[] {
|
||||||
|
const result = [] as MultipleScopeVarsItem[];
|
||||||
|
Object.keys(themeColors).forEach(key => {
|
||||||
|
result.push({
|
||||||
|
scopeName: `layout-theme-${key}`,
|
||||||
|
varsContent: `$primary-color: ${themeColors[key].color} !default;$vxe-primary-color: $primary-color;$subMenuActiveText: ${themeColors[key].subMenuActiveText} !default;$menuBg: ${themeColors[key].menuBg} !default;$menuHover: ${themeColors[key].menuHover} !default;$subMenuBg: ${themeColors[key].subMenuBg} !default;$subMenuActiveBg: ${themeColors[key].subMenuActiveBg} !default;$navTextColor: ${themeColors[key].navTextColor} !default;$menuText: ${themeColors[key].menuText} !default;$sidebarLogo: ${themeColors[key].sidebarLogo} !default;$menuTitleHover: ${themeColors[key].menuTitleHover} !default;$menuActiveBefore: ${themeColors[key].menuActiveBefore} !default;`
|
||||||
|
} as MultipleScopeVarsItem);
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
}
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
/* 亮白色 */
|
|
||||||
$subMenuActiveText: #409eff;
|
|
||||||
$menuBg: #fff;
|
|
||||||
$menuHover: #e0ebf6;
|
|
||||||
$subMenuBg: #fff;
|
|
||||||
$subMenuActiveBg: #e0ebf6;
|
|
||||||
$navTextColor: #7a80b4;
|
|
||||||
$menuText: #7a80b4;
|
|
||||||
$sidebarLogo: #fff;
|
|
||||||
$menuTitleHover: #000;
|
|
||||||
$menuActiveBefore: #4091f7;
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
/* 绿宝石 */
|
|
||||||
$subMenuActiveText: #fff;
|
|
||||||
$menuBg: #032121;
|
|
||||||
$menuHover: #59bfc1;
|
|
||||||
$subMenuBg: #000;
|
|
||||||
$subMenuActiveBg: #59bfc1;
|
|
||||||
$navTextColor: #7a80b4;
|
|
||||||
$menuText: #7a80b4;
|
|
||||||
$sidebarLogo: #053434;
|
|
||||||
$menuTitleHover: #fff;
|
|
||||||
$menuActiveBefore: #59bfc1;
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
/* 深粉色 */
|
|
||||||
$subMenuActiveText: #fff;
|
|
||||||
$menuBg: #28081a;
|
|
||||||
$menuHover: #d84493;
|
|
||||||
$subMenuBg: #000;
|
|
||||||
$subMenuActiveBg: #d84493;
|
|
||||||
$navTextColor: #7a80b4;
|
|
||||||
$menuText: #7a80b4;
|
|
||||||
$sidebarLogo: #3f0d29;
|
|
||||||
$menuTitleHover: #fff;
|
|
||||||
$menuActiveBefore: #d84493;
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
/* 深紫罗兰色 */
|
|
||||||
$subMenuActiveText: #fff;
|
|
||||||
$menuBg: #130824;
|
|
||||||
$menuHover: #693ac9;
|
|
||||||
$subMenuBg: #000;
|
|
||||||
$subMenuActiveBg: #693ac9;
|
|
||||||
$navTextColor: #7a80b4;
|
|
||||||
$menuText: #7a80b4;
|
|
||||||
$sidebarLogo: #1f0c38;
|
|
||||||
$menuTitleHover: #fff;
|
|
||||||
$menuActiveBefore: #693ac9;
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
/* 橙红色 */
|
|
||||||
$subMenuActiveText: #fff;
|
|
||||||
$menuBg: #2b0e05;
|
|
||||||
$menuHover: #e85f33;
|
|
||||||
$subMenuBg: #0f0603;
|
|
||||||
$subMenuActiveBg: #e85f33;
|
|
||||||
$navTextColor: #fff;
|
|
||||||
$menuText: rgb(254 254 254 / 65%);
|
|
||||||
$sidebarLogo: #441708;
|
|
||||||
$menuTitleHover: #fff;
|
|
||||||
$menuActiveBefore: #e85f33;
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
/* 金色 */
|
|
||||||
$subMenuActiveText: #d25f00;
|
|
||||||
$menuBg: #2b2503;
|
|
||||||
$menuHover: #f6da4d;
|
|
||||||
$subMenuBg: #0f0603;
|
|
||||||
$subMenuActiveBg: #f6da4d;
|
|
||||||
$navTextColor: #fff;
|
|
||||||
$menuText: rgb(254 254 254 / 65%);
|
|
||||||
$sidebarLogo: #443b05;
|
|
||||||
$menuTitleHover: #fff;
|
|
||||||
$menuActiveBefore: #f6da4d;
|
|
||||||
@@ -5,7 +5,6 @@ export const routerArrays: Array<RouteConfigs> = [
|
|||||||
parentPath: "/",
|
parentPath: "/",
|
||||||
meta: {
|
meta: {
|
||||||
title: "menus.hshome",
|
title: "menus.hshome",
|
||||||
i18n: true,
|
|
||||||
icon: "home-filled"
|
icon: "home-filled"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -67,6 +66,7 @@ export type childrenType = {
|
|||||||
icon?: string;
|
icon?: string;
|
||||||
title?: string;
|
title?: string;
|
||||||
i18n?: boolean;
|
i18n?: boolean;
|
||||||
|
showParent?: boolean;
|
||||||
extraIcon?: {
|
extraIcon?: {
|
||||||
svg?: boolean;
|
svg?: boolean;
|
||||||
name?: string;
|
name?: string;
|
||||||
@@ -78,7 +78,7 @@ export type childrenType = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export type themeColorsType = {
|
export type themeColorsType = {
|
||||||
rgb: string;
|
color: string;
|
||||||
themeColor: string;
|
themeColor: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
16
src/main.ts
@@ -1,17 +1,22 @@
|
|||||||
import App from "./App.vue";
|
import App from "./App.vue";
|
||||||
import router from "./router";
|
import router from "./router";
|
||||||
import { setupStore } from "/@/store";
|
import { setupStore } from "/@/store";
|
||||||
|
import ElementPlus from "element-plus";
|
||||||
import { getServerConfig } from "./config";
|
import { getServerConfig } from "./config";
|
||||||
import { createApp, Directive } from "vue";
|
import { createApp, Directive } from "vue";
|
||||||
import { usI18n } from "../src/plugins/i18n";
|
import { useI18n } from "../src/plugins/i18n";
|
||||||
import { MotionPlugin } from "@vueuse/motion";
|
import { MotionPlugin } from "@vueuse/motion";
|
||||||
import { useElementPlus } from "../src/plugins/element-plus";
|
|
||||||
import { injectResponsiveStorage } from "/@/utils/storage/responsive";
|
import { injectResponsiveStorage } from "/@/utils/storage/responsive";
|
||||||
|
|
||||||
|
import "uno.css";
|
||||||
import "animate.css";
|
import "animate.css";
|
||||||
import "virtual:windi.css";
|
// 引入重置样式
|
||||||
|
import "./style/reset.scss";
|
||||||
// 导入公共样式
|
// 导入公共样式
|
||||||
import "./style/index.scss";
|
import "./style/index.scss";
|
||||||
|
import "element-plus/dist/index.css";
|
||||||
|
import "@pureadmin/components/dist/index.css";
|
||||||
|
import "@pureadmin/components/dist/theme.css";
|
||||||
// 导入字体图标
|
// 导入字体图标
|
||||||
import "./assets/iconfont/iconfont.js";
|
import "./assets/iconfont/iconfont.js";
|
||||||
import "./assets/iconfont/iconfont.css";
|
import "./assets/iconfont/iconfont.css";
|
||||||
@@ -35,9 +40,10 @@ app.component("IconifyIconOnline", IconifyIconOnline);
|
|||||||
app.component("FontIcon", FontIcon);
|
app.component("FontIcon", FontIcon);
|
||||||
|
|
||||||
getServerConfig(app).then(async config => {
|
getServerConfig(app).then(async config => {
|
||||||
|
app.use(router);
|
||||||
|
await router.isReady();
|
||||||
injectResponsiveStorage(app, config);
|
injectResponsiveStorage(app, config);
|
||||||
setupStore(app);
|
setupStore(app);
|
||||||
app.use(router).use(MotionPlugin).use(useElementPlus).use(usI18n);
|
app.use(MotionPlugin).use(useI18n).use(ElementPlus);
|
||||||
await router.isReady();
|
|
||||||
app.mount("#app");
|
app.mount("#app");
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
import { createProdMockServer } from "vite-plugin-mock/es/createProdMockServer";
|
import { createProdMockServer } from "vite-plugin-mock/es/createProdMockServer";
|
||||||
import asyncRoutesMock from "../mock/asyncRoutes";
|
|
||||||
|
|
||||||
export const mockModules = [...asyncRoutesMock];
|
const modules = import.meta.globEager("../mock/*.ts");
|
||||||
|
const mockModules = [];
|
||||||
|
|
||||||
|
Object.keys(modules).forEach(key => {
|
||||||
|
mockModules.push(...modules[key].default);
|
||||||
|
});
|
||||||
|
|
||||||
export function setupProdMockServer() {
|
export function setupProdMockServer() {
|
||||||
createProdMockServer(mockModules);
|
createProdMockServer(mockModules);
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ import {
|
|||||||
ElEmpty,
|
ElEmpty,
|
||||||
ElCollapse,
|
ElCollapse,
|
||||||
ElCollapseItem,
|
ElCollapseItem,
|
||||||
|
ElDialog,
|
||||||
|
ElCard,
|
||||||
// 指令
|
// 指令
|
||||||
ElLoading,
|
ElLoading,
|
||||||
ElInfiniteScroll
|
ElInfiniteScroll
|
||||||
@@ -72,7 +74,9 @@ const components = [
|
|||||||
ElAvatar,
|
ElAvatar,
|
||||||
ElEmpty,
|
ElEmpty,
|
||||||
ElCollapse,
|
ElCollapse,
|
||||||
ElCollapseItem
|
ElCollapseItem,
|
||||||
|
ElDialog,
|
||||||
|
ElCard
|
||||||
];
|
];
|
||||||
|
|
||||||
export function useElementPlus(app: App) {
|
export function useElementPlus(app: App) {
|
||||||
|
|||||||
72
src/plugins/i18n.ts
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
// 多组件库的国际化和本地项目国际化兼容
|
||||||
|
import { App, WritableComputedRef } from "vue";
|
||||||
|
import { storageLocal } from "/@/utils/storage";
|
||||||
|
import { type I18n, createI18n } from "vue-i18n";
|
||||||
|
|
||||||
|
// element-plus国际化
|
||||||
|
import enLocale from "element-plus/lib/locale/lang/en";
|
||||||
|
import zhLocale from "element-plus/lib/locale/lang/zh-cn";
|
||||||
|
|
||||||
|
function siphonI18n(prefix = "zh-CN") {
|
||||||
|
return Object.fromEntries(
|
||||||
|
Object.entries(import.meta.globEager("../../locales/*.y(a)?ml")).map(
|
||||||
|
([key, value]) => {
|
||||||
|
const matched = key.match(/([A-Za-z0-9-_]+)\./i)[1];
|
||||||
|
return [matched, value.default];
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)[prefix];
|
||||||
|
}
|
||||||
|
|
||||||
|
export const localesConfigs = {
|
||||||
|
zh: {
|
||||||
|
...siphonI18n("zh-CN"),
|
||||||
|
...zhLocale
|
||||||
|
},
|
||||||
|
en: {
|
||||||
|
...siphonI18n("en"),
|
||||||
|
...enLocale
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 国际化转换工具函数(自动读取根目录locales文件夹下文件进行国际化匹配)
|
||||||
|
* @param message message
|
||||||
|
* @returns 转化后的message
|
||||||
|
*/
|
||||||
|
export function transformI18n(message: any = "") {
|
||||||
|
if (!message) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理存储动态路由的title,格式 {zh:"",en:""}
|
||||||
|
if (typeof message === "object") {
|
||||||
|
const locale: string | WritableComputedRef<string> | any =
|
||||||
|
i18n.global.locale;
|
||||||
|
return message[locale?.value];
|
||||||
|
}
|
||||||
|
|
||||||
|
const key = message.match(/(\S*)\./)?.[1];
|
||||||
|
if (key && Object.keys(siphonI18n("zh-CN")).includes(key)) {
|
||||||
|
return i18n.global.t.call(i18n.global.locale, message);
|
||||||
|
} else if (!key && Object.keys(siphonI18n("zh-CN")).includes(message)) {
|
||||||
|
// 兼容非嵌套形式的国际化写法
|
||||||
|
return i18n.global.t.call(i18n.global.locale, message);
|
||||||
|
} else {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 此函数只是配合i18n Ally插件来进行国际化智能提示,并无实际意义(只对提示起作用),如果不需要国际化可删除
|
||||||
|
export const $t = (key: string) => key;
|
||||||
|
|
||||||
|
export const i18n: I18n = createI18n({
|
||||||
|
legacy: false,
|
||||||
|
locale: storageLocal.getItem("responsive-locale")?.locale ?? "zh",
|
||||||
|
fallbackLocale: "en",
|
||||||
|
messages: localesConfigs
|
||||||
|
});
|
||||||
|
|
||||||
|
export function useI18n(app: App) {
|
||||||
|
app.use(i18n);
|
||||||
|
}
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
import { siphonI18n } from "./index";
|
|
||||||
|
|
||||||
// element-plus国际化
|
|
||||||
import enLocale from "element-plus/lib/locale/lang/en";
|
|
||||||
import zhLocale from "element-plus/lib/locale/lang/zh-cn";
|
|
||||||
|
|
||||||
// 项目内自定义国际化
|
|
||||||
const zhModules = import.meta.globEager("./zh-CN/**/*.ts");
|
|
||||||
const enModules = import.meta.globEager("./en/**/*.ts");
|
|
||||||
|
|
||||||
export const localesConfigs = {
|
|
||||||
zh: {
|
|
||||||
...siphonI18n(zhModules, "zh-CN"),
|
|
||||||
...zhLocale
|
|
||||||
},
|
|
||||||
en: {
|
|
||||||
...siphonI18n(enModules, "en"),
|
|
||||||
...enLocale
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
export default {
|
|
||||||
hsLoginOut: "LoginOut",
|
|
||||||
hsfullscreen: "FullScreen",
|
|
||||||
hsexitfullscreen: "ExitFullscreen",
|
|
||||||
hsrefreshRoute: "RefreshRoute",
|
|
||||||
hslogin: "Login",
|
|
||||||
hsadd: "Add",
|
|
||||||
hsmark: "Mark/Cancel",
|
|
||||||
hssave: "Save",
|
|
||||||
hssearch: "Search",
|
|
||||||
hsexpendAll: "Expand All",
|
|
||||||
hscollapseAll: "Collapse All",
|
|
||||||
hssystemSet: "Open ProjectConfig",
|
|
||||||
hsdelete: "Delete",
|
|
||||||
hsreload: "Reload",
|
|
||||||
hscloseCurrentTab: "Close CurrentTab",
|
|
||||||
hscloseLeftTabs: "Close LeftTabs",
|
|
||||||
hscloseRightTabs: "Close RightTabs",
|
|
||||||
hscloseOtherTabs: "Close OtherTabs",
|
|
||||||
hscloseAllTabs: "Close AllTabs"
|
|
||||||
};
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
export default {
|
|
||||||
hshome: "Home",
|
|
||||||
hslogin: "Login",
|
|
||||||
hssysManagement: "System Manage",
|
|
||||||
hsBaseinfo: "Base Info",
|
|
||||||
hserror: "Error Page",
|
|
||||||
hsfourZeroFour: "404",
|
|
||||||
hsfourZeroOne: "401",
|
|
||||||
hsmenus: "MultiLevel Menu",
|
|
||||||
hsmenu1: "Menu1",
|
|
||||||
"hsmenu1-1": "Menu1-1",
|
|
||||||
"hsmenu1-2": "Menu1-2",
|
|
||||||
"hsmenu1-2-1": "Menu1-2-1",
|
|
||||||
"hsmenu1-2-2": "Menu1-2-2",
|
|
||||||
"hsmenu1-3": "Menu1-3",
|
|
||||||
hsmenu2: "Menu2",
|
|
||||||
permission: "Permission Manage",
|
|
||||||
permissionPage: "Page Permission",
|
|
||||||
permissionButton: "Button Permission",
|
|
||||||
externalLink: "External Link"
|
|
||||||
};
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
// 多组件库的国际化和本地项目国际化兼容
|
|
||||||
import { App } from "vue";
|
|
||||||
import { set } from "lodash-es";
|
|
||||||
import { createI18n } from "vue-i18n";
|
|
||||||
import { localesConfigs } from "./config";
|
|
||||||
import { storageLocal } from "/@/utils/storage";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 国际化转换工具函数
|
|
||||||
* @param message message
|
|
||||||
* @param isI18n 如果true,获取对应的消息,否则返回本身
|
|
||||||
* @returns message
|
|
||||||
*/
|
|
||||||
export function transformI18n(
|
|
||||||
message: string | unknown | object = "",
|
|
||||||
isI18n: boolean | unknown = false
|
|
||||||
) {
|
|
||||||
if (!message) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
// 处理存储动态路由的title,格式 {zh:"",en:""}
|
|
||||||
if (typeof message === "object") {
|
|
||||||
return message[i18n.global?.locale];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isI18n) {
|
|
||||||
//@ts-ignore
|
|
||||||
return i18n.global.tc.call(i18n.global, message);
|
|
||||||
} else {
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 从模块中抽取国际化
|
|
||||||
* @param langs 存放国际化模块
|
|
||||||
* @param prefix 语言 默认 zh-CN
|
|
||||||
* @returns obj 格式:{模块名.**}
|
|
||||||
*/
|
|
||||||
export function siphonI18n(
|
|
||||||
langs: Record<string, Record<string, any>>,
|
|
||||||
prefix = "zh-CN"
|
|
||||||
) {
|
|
||||||
const langsObj: Recordable = {};
|
|
||||||
Object.keys(langs).forEach((key: string) => {
|
|
||||||
let fileName = key.replace(`./${prefix}/`, "").replace(/^\.\//, "");
|
|
||||||
fileName = fileName.substring(0, fileName.lastIndexOf("."));
|
|
||||||
const keyList = fileName.split("/");
|
|
||||||
const moduleName = keyList.shift();
|
|
||||||
const objKey = keyList.join(".");
|
|
||||||
const langFileModule = langs[key].default;
|
|
||||||
|
|
||||||
if (moduleName) {
|
|
||||||
if (objKey) {
|
|
||||||
set(langsObj, moduleName, langsObj[moduleName] || {});
|
|
||||||
set(langsObj[moduleName], objKey, langFileModule);
|
|
||||||
} else {
|
|
||||||
set(langsObj, moduleName, langFileModule || {});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return langsObj;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 此函数只是配合i18n Ally插件来进行国际化智能提示,并无实际意义(只对提示起作用),如果不需要国际化可删除
|
|
||||||
export const $t = (key: string) => key;
|
|
||||||
|
|
||||||
export const i18n = createI18n({
|
|
||||||
locale: storageLocal.getItem("responsive-locale")?.locale ?? "zh",
|
|
||||||
fallbackLocale: "en",
|
|
||||||
messages: localesConfigs
|
|
||||||
});
|
|
||||||
|
|
||||||
export function usI18n(app: App) {
|
|
||||||
app.use(i18n);
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
export default {
|
|
||||||
hsLoginOut: "退出系统",
|
|
||||||
hsfullscreen: "全屏",
|
|
||||||
hsexitfullscreen: "退出全屏",
|
|
||||||
hsrefreshRoute: "刷新路由",
|
|
||||||
hslogin: "登陆",
|
|
||||||
hsadd: "新增",
|
|
||||||
hsmark: "标记/取消",
|
|
||||||
hssave: "保存",
|
|
||||||
hssearch: "搜索",
|
|
||||||
hsexpendAll: "全部展开",
|
|
||||||
hscollapseAll: "全部折叠",
|
|
||||||
hssystemSet: "打开项目配置",
|
|
||||||
hsdelete: "删除",
|
|
||||||
hsreload: "重新加载",
|
|
||||||
hscloseCurrentTab: "关闭当前标签页",
|
|
||||||
hscloseLeftTabs: "关闭左侧标签页",
|
|
||||||
hscloseRightTabs: "关闭右侧标签页",
|
|
||||||
hscloseOtherTabs: "关闭其他标签页",
|
|
||||||
hscloseAllTabs: "关闭全部标签页"
|
|
||||||
};
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
export default {
|
|
||||||
hshome: "首页",
|
|
||||||
hslogin: "登陆",
|
|
||||||
hssysManagement: "系统管理",
|
|
||||||
hsBaseinfo: "基础信息",
|
|
||||||
hserror: "错误页面",
|
|
||||||
hsfourZeroFour: "404",
|
|
||||||
hsfourZeroOne: "401",
|
|
||||||
hsmenus: "多级菜单",
|
|
||||||
hsmenu1: "菜单1",
|
|
||||||
"hsmenu1-1": "菜单1-1",
|
|
||||||
"hsmenu1-2": "菜单1-2",
|
|
||||||
"hsmenu1-2-1": "菜单1-2-1",
|
|
||||||
"hsmenu1-2-2": "菜单1-2-2",
|
|
||||||
"hsmenu1-3": "菜单1-3",
|
|
||||||
hsmenu2: "菜单2",
|
|
||||||
permission: "权限管理",
|
|
||||||
permissionPage: "页面权限",
|
|
||||||
permissionButton: "按钮权限",
|
|
||||||
externalLink: "外链"
|
|
||||||
};
|
|
||||||
@@ -1,23 +1,55 @@
|
|||||||
|
import { isUrl } from "/@/utils/is";
|
||||||
|
import { getConfig } from "/@/config";
|
||||||
import { toRouteType } from "./types";
|
import { toRouteType } from "./types";
|
||||||
import { openLink } from "/@/utils/link";
|
import { openLink } from "/@/utils/link";
|
||||||
import NProgress from "/@/utils/progress";
|
import NProgress from "/@/utils/progress";
|
||||||
import { constantRoutes } from "./modules";
|
import { findIndex } from "lodash-unified";
|
||||||
import { split, findIndex } from "lodash-es";
|
|
||||||
import { transformI18n } from "/@/plugins/i18n";
|
import { transformI18n } from "/@/plugins/i18n";
|
||||||
import remainingRouter from "./modules/remaining";
|
|
||||||
import { storageSession } from "/@/utils/storage";
|
import { storageSession } from "/@/utils/storage";
|
||||||
import { Title } from "../../public/serverConfig.json";
|
import { buildHierarchyTree } from "/@/utils/tree";
|
||||||
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 {
|
import {
|
||||||
|
Router,
|
||||||
|
RouteMeta,
|
||||||
|
createRouter,
|
||||||
|
RouteRecordRaw,
|
||||||
|
RouteComponent,
|
||||||
|
RouteRecordName
|
||||||
|
} from "vue-router";
|
||||||
|
import {
|
||||||
|
ascending,
|
||||||
initRouter,
|
initRouter,
|
||||||
getHistoryMode,
|
getHistoryMode,
|
||||||
getParentPaths,
|
getParentPaths,
|
||||||
findRouteByPath,
|
findRouteByPath,
|
||||||
handleAliveRoute
|
handleAliveRoute,
|
||||||
|
formatTwoStageRoutes,
|
||||||
|
formatFlatteningRoutes
|
||||||
} from "./utils";
|
} from "./utils";
|
||||||
|
|
||||||
|
import homeRouter from "./modules/home";
|
||||||
|
import errorRouter from "./modules/error";
|
||||||
|
import remainingRouter from "./modules/remaining";
|
||||||
|
|
||||||
|
// 原始静态路由(未做任何处理)
|
||||||
|
const routes = [homeRouter, errorRouter];
|
||||||
|
|
||||||
|
// 导出处理后的静态路由(三级及以上的路由全部拍成二级)
|
||||||
|
export const constantRoutes: Array<RouteRecordRaw> = formatTwoStageRoutes(
|
||||||
|
formatFlatteningRoutes(buildHierarchyTree(ascending(routes)))
|
||||||
|
);
|
||||||
|
|
||||||
|
// 用于渲染菜单,保持原始层级
|
||||||
|
export const constantMenus: Array<RouteComponent> = ascending(routes).concat(
|
||||||
|
...remainingRouter
|
||||||
|
);
|
||||||
|
|
||||||
|
// 不参与菜单的路由
|
||||||
|
export const remainingPaths = Object.keys(remainingRouter).map(v => {
|
||||||
|
return remainingRouter[v].path;
|
||||||
|
});
|
||||||
|
|
||||||
// 创建路由实例
|
// 创建路由实例
|
||||||
export const router: Router = createRouter({
|
export const router: Router = createRouter({
|
||||||
history: getHistoryMode(),
|
history: getHistoryMode(),
|
||||||
@@ -52,22 +84,20 @@ router.beforeEach((to: toRouteType, _from, next) => {
|
|||||||
}
|
}
|
||||||
const name = storageSession.getItem("info");
|
const name = storageSession.getItem("info");
|
||||||
NProgress.start();
|
NProgress.start();
|
||||||
const externalLink = to?.redirectedFrom?.fullPath;
|
const externalLink = isUrl(to?.name);
|
||||||
if (!externalLink)
|
if (!externalLink)
|
||||||
to.matched.some(item => {
|
to.matched.some(item => {
|
||||||
if (!item.meta.title) return "";
|
if (!item.meta.title) return "";
|
||||||
|
const Title = getConfig().Title;
|
||||||
if (Title)
|
if (Title)
|
||||||
document.title = `${transformI18n(
|
document.title = `${transformI18n(item.meta.title)} | ${Title}`;
|
||||||
item.meta.title,
|
else document.title = transformI18n(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) {
|
||||||
// 如果路由包含http 则是超链接 反之是普通路由
|
// name为超链接
|
||||||
if (externalLink && externalLink.includes("http")) {
|
if (externalLink) {
|
||||||
openLink(`http${split(externalLink, "http")[1]}`);
|
openLink(to?.name);
|
||||||
NProgress.done();
|
NProgress.done();
|
||||||
} else {
|
} else {
|
||||||
next();
|
next();
|
||||||
|
|||||||
@@ -1,25 +1,22 @@
|
|||||||
import { $t } from "/@/plugins/i18n";
|
import { $t } from "/@/plugins/i18n";
|
||||||
import Layout from "/@/layout/index.vue";
|
const Layout = () => import("/@/layout/index.vue");
|
||||||
|
|
||||||
const errorRouter = {
|
const errorRouter = {
|
||||||
path: "/error",
|
path: "/error",
|
||||||
name: "error",
|
|
||||||
component: Layout,
|
component: Layout,
|
||||||
redirect: "/error/401",
|
redirect: "/error/403",
|
||||||
meta: {
|
meta: {
|
||||||
icon: "position",
|
icon: "information-line",
|
||||||
title: $t("menus.hserror"),
|
title: $t("menus.hserror"),
|
||||||
i18n: true,
|
rank: 9
|
||||||
rank: 7
|
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: "/error/401",
|
path: "/error/403",
|
||||||
name: "401",
|
name: "403",
|
||||||
component: () => import("/@/views/error/401.vue"),
|
component: () => import("/@/views/error/403.vue"),
|
||||||
meta: {
|
meta: {
|
||||||
title: $t("menus.hsfourZeroOne"),
|
title: $t("menus.hsfourZeroOne")
|
||||||
i18n: true
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -27,8 +24,15 @@ const errorRouter = {
|
|||||||
name: "404",
|
name: "404",
|
||||||
component: () => import("/@/views/error/404.vue"),
|
component: () => import("/@/views/error/404.vue"),
|
||||||
meta: {
|
meta: {
|
||||||
title: $t("menus.hsfourZeroFour"),
|
title: $t("menus.hsfourZeroFour")
|
||||||
i18n: true
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/error/500",
|
||||||
|
name: "500",
|
||||||
|
component: () => import("/@/views/error/500.vue"),
|
||||||
|
meta: {
|
||||||
|
title: $t("menus.hsFive")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
import { $t } from "/@/plugins/i18n";
|
|
||||||
import Layout from "/@/layout/index.vue";
|
|
||||||
|
|
||||||
const externalLink = {
|
|
||||||
path: "/external",
|
|
||||||
name: "external",
|
|
||||||
component: Layout,
|
|
||||||
meta: {
|
|
||||||
icon: "link",
|
|
||||||
title: $t("menus.externalLink"),
|
|
||||||
i18n: true,
|
|
||||||
rank: 190
|
|
||||||
},
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
path: "https://github.com/xiaoxian521/vue-pure-admin",
|
|
||||||
meta: {
|
|
||||||
title: $t("menus.externalLink"),
|
|
||||||
i18n: true,
|
|
||||||
rank: 191
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
|
||||||
|
|
||||||
export default externalLink;
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { $t } from "/@/plugins/i18n";
|
import { $t } from "/@/plugins/i18n";
|
||||||
import Layout from "/@/layout/index.vue";
|
const Layout = () => import("/@/layout/index.vue");
|
||||||
|
|
||||||
const homeRouter = {
|
const homeRouter = {
|
||||||
path: "/",
|
path: "/",
|
||||||
@@ -9,7 +9,6 @@ const homeRouter = {
|
|||||||
meta: {
|
meta: {
|
||||||
icon: "home-filled",
|
icon: "home-filled",
|
||||||
title: $t("menus.hshome"),
|
title: $t("menus.hshome"),
|
||||||
i18n: true,
|
|
||||||
rank: 0
|
rank: 0
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
@@ -18,8 +17,7 @@ const homeRouter = {
|
|||||||
name: "welcome",
|
name: "welcome",
|
||||||
component: () => import("/@/views/welcome.vue"),
|
component: () => import("/@/views/welcome.vue"),
|
||||||
meta: {
|
meta: {
|
||||||
title: $t("menus.hshome"),
|
title: $t("menus.hshome")
|
||||||
i18n: true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
// 静态路由
|
|
||||||
import homeRouter from "./home";
|
|
||||||
import errorRouter from "./error";
|
|
||||||
import externalLink from "./externalLink";
|
|
||||||
import remainingRouter from "./remaining";
|
|
||||||
import { RouteRecordRaw, RouteComponent } from "vue-router";
|
|
||||||
|
|
||||||
import {
|
|
||||||
ascending,
|
|
||||||
formatTwoStageRoutes,
|
|
||||||
formatFlatteningRoutes
|
|
||||||
} from "../utils";
|
|
||||||
import { buildHierarchyTree } from "/@/utils/tree";
|
|
||||||
|
|
||||||
// 原始静态路由(未做任何处理)
|
|
||||||
const routes = [homeRouter, errorRouter, externalLink];
|
|
||||||
|
|
||||||
// 导出处理后的静态路由(三级及以上的路由全部拍成二级)
|
|
||||||
export const constantRoutes: Array<RouteRecordRaw> = formatTwoStageRoutes(
|
|
||||||
formatFlatteningRoutes(buildHierarchyTree(ascending(routes)))
|
|
||||||
);
|
|
||||||
|
|
||||||
// 用于渲染菜单,保持原始层级
|
|
||||||
export const constantMenus: Array<RouteComponent> = ascending(routes).concat(
|
|
||||||
...remainingRouter
|
|
||||||
);
|
|
||||||
@@ -1,26 +1,23 @@
|
|||||||
import { $t } from "/@/plugins/i18n";
|
import { $t } from "/@/plugins/i18n";
|
||||||
import Layout from "/@/layout/index.vue";
|
const Layout = () => import("/@/layout/index.vue");
|
||||||
|
|
||||||
const remainingRouter = [
|
const remainingRouter = [
|
||||||
{
|
{
|
||||||
path: "/login",
|
path: "/login",
|
||||||
name: "login",
|
name: "login",
|
||||||
component: () => import("/@/views/login.vue"),
|
component: () => import("/@/views/login/index.vue"),
|
||||||
meta: {
|
meta: {
|
||||||
title: $t("menus.hslogin"),
|
title: $t("menus.hslogin"),
|
||||||
showLink: false,
|
showLink: false,
|
||||||
i18n: true,
|
|
||||||
rank: 101
|
rank: 101
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/redirect",
|
path: "/redirect",
|
||||||
name: "redirect",
|
|
||||||
component: Layout,
|
component: Layout,
|
||||||
meta: {
|
meta: {
|
||||||
icon: "home-filled",
|
icon: "home-filled",
|
||||||
title: $t("menus.hshome"),
|
title: $t("menus.hshome"),
|
||||||
i18n: true,
|
|
||||||
showLink: false,
|
showLink: false,
|
||||||
rank: 104
|
rank: 104
|
||||||
},
|
},
|
||||||
@@ -28,7 +25,7 @@ const remainingRouter = [
|
|||||||
{
|
{
|
||||||
path: "/redirect/:path(.*)",
|
path: "/redirect/:path(.*)",
|
||||||
name: "redirect",
|
name: "redirect",
|
||||||
component: () => import("/@/views/redirect.vue")
|
component: () => import("/@/layout/redirect.vue")
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,10 +8,12 @@ import {
|
|||||||
} from "vue-router";
|
} from "vue-router";
|
||||||
import { router } from "./index";
|
import { router } from "./index";
|
||||||
import { loadEnv } from "../../build";
|
import { loadEnv } from "../../build";
|
||||||
import Layout from "/@/layout/index.vue";
|
|
||||||
import { useTimeoutFn } from "@vueuse/core";
|
import { useTimeoutFn } from "@vueuse/core";
|
||||||
import { RouteConfigs } from "/@/layout/types";
|
import { RouteConfigs } from "/@/layout/types";
|
||||||
|
import { buildHierarchyTree } from "/@/utils/tree";
|
||||||
import { usePermissionStoreHook } from "/@/store/modules/permission";
|
import { usePermissionStoreHook } from "/@/store/modules/permission";
|
||||||
|
const Layout = () => import("/@/layout/index.vue");
|
||||||
|
const IFrame = () => import("/@/layout/frameView.vue");
|
||||||
// https://cn.vitejs.dev/guide/features.html#glob-import
|
// https://cn.vitejs.dev/guide/features.html#glob-import
|
||||||
const modulesRoutes = import.meta.glob("/src/views/**/*.{vue,tsx}");
|
const modulesRoutes = import.meta.glob("/src/views/**/*.{vue,tsx}");
|
||||||
|
|
||||||
@@ -20,6 +22,14 @@ import { getAsyncRoutes } from "/@/api/routes";
|
|||||||
|
|
||||||
// 按照路由中meta下的rank等级升序来排序路由
|
// 按照路由中meta下的rank等级升序来排序路由
|
||||||
function ascending(arr: any[]) {
|
function ascending(arr: any[]) {
|
||||||
|
arr.forEach(v => {
|
||||||
|
if (v?.meta?.rank === null) v.meta.rank = undefined;
|
||||||
|
if (v?.meta?.rank === 0) {
|
||||||
|
if (v.name !== "home" && v.path !== "/") {
|
||||||
|
console.warn("rank only the home page can be 0");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
return arr.sort(
|
return arr.sort(
|
||||||
(a: { meta: { rank: number } }, b: { meta: { rank: number } }) => {
|
(a: { meta: { rank: number } }, b: { meta: { rank: number } }) => {
|
||||||
return a?.meta?.rank - b?.meta?.rank;
|
return a?.meta?.rank - b?.meta?.rank;
|
||||||
@@ -125,6 +135,10 @@ function initRouter(name: string) {
|
|||||||
// 最终路由进行升序
|
// 最终路由进行升序
|
||||||
ascending(router.options.routes[0].children);
|
ascending(router.options.routes[0].children);
|
||||||
if (!router.hasRoute(v?.name)) router.addRoute(v);
|
if (!router.hasRoute(v?.name)) router.addRoute(v);
|
||||||
|
const flattenRouters = router
|
||||||
|
.getRoutes()
|
||||||
|
.find(n => n.path === "/");
|
||||||
|
router.addRoute(flattenRouters);
|
||||||
}
|
}
|
||||||
resolve(router);
|
resolve(router);
|
||||||
}
|
}
|
||||||
@@ -146,14 +160,15 @@ function initRouter(name: string) {
|
|||||||
*/
|
*/
|
||||||
function formatFlatteningRoutes(routesList: RouteRecordRaw[]) {
|
function formatFlatteningRoutes(routesList: RouteRecordRaw[]) {
|
||||||
if (routesList.length === 0) return routesList;
|
if (routesList.length === 0) return routesList;
|
||||||
for (let i = 0; i < routesList.length; i++) {
|
let hierarchyList = buildHierarchyTree(routesList);
|
||||||
if (routesList[i].children) {
|
for (let i = 0; i < hierarchyList.length; i++) {
|
||||||
routesList = routesList
|
if (hierarchyList[i].children) {
|
||||||
|
hierarchyList = hierarchyList
|
||||||
.slice(0, i + 1)
|
.slice(0, i + 1)
|
||||||
.concat(routesList[i].children, routesList.slice(i + 1));
|
.concat(hierarchyList[i].children, hierarchyList.slice(i + 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return routesList;
|
return hierarchyList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -216,8 +231,14 @@ function addAsyncRoutes(arrRoutes: Array<RouteRecordRaw>) {
|
|||||||
arrRoutes.forEach((v: RouteRecordRaw) => {
|
arrRoutes.forEach((v: RouteRecordRaw) => {
|
||||||
if (v.redirect) {
|
if (v.redirect) {
|
||||||
v.component = Layout;
|
v.component = Layout;
|
||||||
|
} else if (v.meta?.frameSrc) {
|
||||||
|
v.component = IFrame;
|
||||||
} else {
|
} else {
|
||||||
const index = modulesRoutesKeys.findIndex(ev => ev.includes(v.path));
|
// 对后端传component组件路径和不传做兼容(如果后端传component组件路径,那么path可以随便写,如果不传,component组件路径会根path保持一致)
|
||||||
|
const index = v?.component
|
||||||
|
? // @ts-expect-error
|
||||||
|
modulesRoutesKeys.findIndex(ev => ev.includes(v.component))
|
||||||
|
: modulesRoutesKeys.findIndex(ev => ev.includes(v.path));
|
||||||
v.component = modulesRoutes[modulesRoutesKeys[index]];
|
v.component = modulesRoutes[modulesRoutesKeys[index]];
|
||||||
}
|
}
|
||||||
if (v.children) {
|
if (v.children) {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
import { store } from "/@/store";
|
import { store } from "/@/store";
|
||||||
import { isEqual } from "lodash-es";
|
import { isUrl } from "/@/utils/is";
|
||||||
|
import { isEqual } from "lodash-unified";
|
||||||
import { storageLocal } from "/@/utils/storage";
|
import { storageLocal } from "/@/utils/storage";
|
||||||
import { multiType, positionType } from "./types";
|
import { multiType, positionType } from "./types";
|
||||||
|
|
||||||
@@ -16,8 +17,7 @@ export const useMultiTagsStore = defineStore({
|
|||||||
parentPath: "/",
|
parentPath: "/",
|
||||||
meta: {
|
meta: {
|
||||||
title: "menus.hshome",
|
title: "menus.hshome",
|
||||||
icon: "home-filled",
|
icon: "home-filled"
|
||||||
i18n: true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -54,6 +54,7 @@ export const useMultiTagsStore = defineStore({
|
|||||||
case "push":
|
case "push":
|
||||||
{
|
{
|
||||||
const tagVal = value as multiType;
|
const tagVal = value as multiType;
|
||||||
|
if (isUrl(tagVal?.name)) return;
|
||||||
const tagPath = tagVal?.path;
|
const tagPath = tagVal?.path;
|
||||||
// 判断tag是否已存在
|
// 判断tag是否已存在
|
||||||
const tagHasExits = this.multiTags.some(tag => {
|
const tagHasExits = this.multiTags.some(tag => {
|
||||||
@@ -87,7 +88,13 @@ export const useMultiTagsStore = defineStore({
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "splice":
|
case "splice":
|
||||||
this.multiTags.splice(position?.startIndex, position?.length);
|
if (!position) {
|
||||||
|
const index = this.multiTags.findIndex(v => v.path === value);
|
||||||
|
if (index === -1) return;
|
||||||
|
this.multiTags.splice(index, 1);
|
||||||
|
} else {
|
||||||
|
this.multiTags.splice(position?.startIndex, position?.length);
|
||||||
|
}
|
||||||
this.tagsCache(this.multiTags);
|
this.tagsCache(this.multiTags);
|
||||||
return this.multiTags;
|
return this.multiTags;
|
||||||
case "slice":
|
case "slice":
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
import { store } from "/@/store";
|
import { store } from "/@/store";
|
||||||
import { cacheType } from "./types";
|
import { cacheType } from "./types";
|
||||||
import { cloneDeep } from "lodash-es";
|
import { constantMenus } from "/@/router";
|
||||||
|
import { cloneDeep } from "lodash-unified";
|
||||||
import { RouteConfigs } from "/@/layout/types";
|
import { RouteConfigs } from "/@/layout/types";
|
||||||
import { constantMenus } from "/@/router/modules";
|
|
||||||
import { ascending, filterTree } from "/@/router/utils";
|
import { ascending, filterTree } from "/@/router/utils";
|
||||||
|
|
||||||
export const usePermissionStore = defineStore({
|
export const usePermissionStore = defineStore({
|
||||||
|
|||||||
@@ -38,4 +38,6 @@ export type setType = {
|
|||||||
export type userType = {
|
export type userType = {
|
||||||
token: string;
|
token: string;
|
||||||
name?: string;
|
name?: string;
|
||||||
|
verifyCode?: string;
|
||||||
|
currentPage?: number;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
import { store } from "/@/store";
|
import { store } from "/@/store";
|
||||||
import { userType } from "./types";
|
import { userType } from "./types";
|
||||||
import { useRouter } from "vue-router";
|
import { router } from "/@/router";
|
||||||
|
import { storageSession } from "/@/utils/storage";
|
||||||
import { getLogin, refreshToken } from "/@/api/user";
|
import { getLogin, refreshToken } from "/@/api/user";
|
||||||
import { storageLocal, storageSession } from "/@/utils/storage";
|
|
||||||
import { getToken, setToken, removeToken } from "/@/utils/auth";
|
import { getToken, setToken, removeToken } from "/@/utils/auth";
|
||||||
import { useMultiTagsStoreHook } from "/@/store/modules/multiTags";
|
import { useMultiTagsStoreHook } from "/@/store/modules/multiTags";
|
||||||
|
|
||||||
@@ -22,7 +22,11 @@ export const useUserStore = defineStore({
|
|||||||
id: "pure-user",
|
id: "pure-user",
|
||||||
state: (): userType => ({
|
state: (): userType => ({
|
||||||
token,
|
token,
|
||||||
name
|
name,
|
||||||
|
// 前端生成的验证码(按实际需求替换)
|
||||||
|
verifyCode: "",
|
||||||
|
// 登陆显示组件判断 0:登陆 1:手机登陆 2:二维码登陆 3:注册 4:忘记密码,默认0:登陆
|
||||||
|
currentPage: 0
|
||||||
}),
|
}),
|
||||||
actions: {
|
actions: {
|
||||||
SET_TOKEN(token) {
|
SET_TOKEN(token) {
|
||||||
@@ -31,6 +35,12 @@ export const useUserStore = defineStore({
|
|||||||
SET_NAME(name) {
|
SET_NAME(name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
},
|
},
|
||||||
|
SET_VERIFYCODE(verifyCode) {
|
||||||
|
this.verifyCode = verifyCode;
|
||||||
|
},
|
||||||
|
SET_CURRENTPAGE(value) {
|
||||||
|
this.currentPage = value;
|
||||||
|
},
|
||||||
// 登入
|
// 登入
|
||||||
async loginByUsername(data) {
|
async loginByUsername(data) {
|
||||||
return new Promise<void>((resolve, reject) => {
|
return new Promise<void>((resolve, reject) => {
|
||||||
@@ -51,7 +61,6 @@ export const useUserStore = defineStore({
|
|||||||
this.token = "";
|
this.token = "";
|
||||||
this.name = "";
|
this.name = "";
|
||||||
removeToken();
|
removeToken();
|
||||||
storageLocal.clear();
|
|
||||||
storageSession.clear();
|
storageSession.clear();
|
||||||
useMultiTagsStoreHook().handleTags("equal", [
|
useMultiTagsStoreHook().handleTags("equal", [
|
||||||
{
|
{
|
||||||
@@ -59,12 +68,11 @@ export const useUserStore = defineStore({
|
|||||||
parentPath: "/",
|
parentPath: "/",
|
||||||
meta: {
|
meta: {
|
||||||
title: "menus.hshome",
|
title: "menus.hshome",
|
||||||
icon: "home-filled",
|
icon: "home-filled"
|
||||||
i18n: true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
useRouter().push("/login");
|
router.push("/login");
|
||||||
},
|
},
|
||||||
// 刷新token
|
// 刷新token
|
||||||
async refreshToken(data) {
|
async refreshToken(data) {
|
||||||
|
|||||||
@@ -36,14 +36,21 @@
|
|||||||
z-index: 99999 !important;
|
z-index: 99999 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 重置button中icon的margin */
|
||||||
|
.reset-margin [class*="el-icon"] + span {
|
||||||
|
margin-left: 2px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 自定义popover的类名 */
|
||||||
|
.pure-popper {
|
||||||
|
padding: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
/* 动态改变cssvar 用于主题切换 https://github.com/element-plus/element-plus/issues/4856#issuecomment-1000174357 */
|
/* 动态改变cssvar 用于主题切换 https://github.com/element-plus/element-plus/issues/4856#issuecomment-1000174357 */
|
||||||
.el-button--primary {
|
.el-button--primary,
|
||||||
--el-button-bg-color: var(--el-color-primary) !important;
|
.el-button--primary.is-plain {
|
||||||
--el-button-border-color: var(--el-color-primary) !important;
|
--el-button-active-bg-color: var(--el-color-primary) !important;
|
||||||
--el-button-hover-bg-color: var(--el-color-primary-light-2) !important;
|
--el-button-active-border-color: var(--el-color-primary) !important;
|
||||||
--el-button-hover-border-color: var(--el-color-primary-light-2) !important;
|
|
||||||
--el-button-active-bg-color: var(--el-color-primary-active) !important;
|
|
||||||
--el-button-active-border-color: var(--el-color-primary-active) !important;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* nprogress适配ep的primary */
|
/* nprogress适配ep的primary */
|
||||||
|
|||||||
@@ -7,13 +7,11 @@
|
|||||||
body {
|
body {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
margin: 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
html {
|
html {
|
||||||
@@ -22,48 +20,9 @@ html {
|
|||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
label {
|
#app {
|
||||||
font-weight: 700;
|
width: 100%;
|
||||||
}
|
height: 100%;
|
||||||
|
|
||||||
*,
|
|
||||||
*::before,
|
|
||||||
*::after {
|
|
||||||
box-sizing: inherit;
|
|
||||||
}
|
|
||||||
|
|
||||||
a:focus,
|
|
||||||
a:active {
|
|
||||||
outline: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
a,
|
|
||||||
a:focus,
|
|
||||||
a:hover {
|
|
||||||
cursor: pointer;
|
|
||||||
color: inherit;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
div:focus {
|
|
||||||
outline: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
ul {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
list-style: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.clearfix {
|
|
||||||
&::after {
|
|
||||||
visibility: hidden;
|
|
||||||
display: block;
|
|
||||||
font-size: 0;
|
|
||||||
content: " ";
|
|
||||||
clear: both;
|
|
||||||
height: 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 头部用户信息样式重置 */
|
/* 头部用户信息样式重置 */
|
||||||
|
|||||||
@@ -47,148 +47,11 @@
|
|||||||
font: bold 200% Consolas, Monaco, monospace;
|
font: bold 200% Consolas, Monaco, monospace;
|
||||||
}
|
}
|
||||||
|
|
||||||
.input-group {
|
@media screen and (max-width: 1180px) {
|
||||||
position: relative;
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: 7% 93%;
|
|
||||||
margin: 25px 0;
|
|
||||||
padding: 5px 0;
|
|
||||||
border-bottom: 2px solid #d9d9d9;
|
|
||||||
}
|
|
||||||
|
|
||||||
.input-group:nth-child(1) {
|
|
||||||
margin-bottom: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.input-group::before,
|
|
||||||
.input-group::after {
|
|
||||||
content: "";
|
|
||||||
position: absolute;
|
|
||||||
bottom: -2px;
|
|
||||||
width: 0;
|
|
||||||
height: 2px;
|
|
||||||
background-color: #c5d3f7;
|
|
||||||
transition: 0.5s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.input-group::after {
|
|
||||||
right: 50%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.input-group::before {
|
|
||||||
left: 50%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon svg {
|
|
||||||
color: #d9d9d9;
|
|
||||||
transition: 0.5s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.input-group > div {
|
|
||||||
position: relative;
|
|
||||||
height: 45px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.input-group > div > h5 {
|
|
||||||
position: absolute;
|
|
||||||
left: 10px;
|
|
||||||
top: 50%;
|
|
||||||
transform: translateY(-50%);
|
|
||||||
color: #d9d9d9;
|
|
||||||
font-size: 18px;
|
|
||||||
transition: 0.3s;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.input-group.focus .icon svg {
|
|
||||||
color: #5392f0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.input-group.focus div h5 {
|
|
||||||
top: -5px;
|
|
||||||
font-size: 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.input-group.focus::after,
|
|
||||||
.input-group.focus::before {
|
|
||||||
width: 50%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.input {
|
|
||||||
position: absolute;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
border: none;
|
|
||||||
outline: none;
|
|
||||||
background: none;
|
|
||||||
padding: 0.5rem 0.7rem;
|
|
||||||
font-size: 1.2rem;
|
|
||||||
color: #555;
|
|
||||||
font-family: "Roboto", sans-serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
a {
|
|
||||||
display: block;
|
|
||||||
text-align: right;
|
|
||||||
text-decoration: none;
|
|
||||||
color: #999;
|
|
||||||
font-size: 0.9rem;
|
|
||||||
transition: 0.3s;
|
|
||||||
}
|
|
||||||
|
|
||||||
a:hover {
|
|
||||||
color: #5392f0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn {
|
|
||||||
display: block;
|
|
||||||
width: 100%;
|
|
||||||
height: 50px;
|
|
||||||
border-radius: 25px;
|
|
||||||
margin: 1rem 0;
|
|
||||||
font-size: 1.2rem;
|
|
||||||
outline: none;
|
|
||||||
border: none;
|
|
||||||
background-image: linear-gradient(to right, #567dbe, #5392f0, #567dbe);
|
|
||||||
cursor: pointer;
|
|
||||||
color: #fff;
|
|
||||||
text-transform: uppercase;
|
|
||||||
font-family: "Roboto", sans-serif;
|
|
||||||
background-size: 200%;
|
|
||||||
transition: 0.5s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn:hover {
|
|
||||||
background-position: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
.copyright {
|
|
||||||
position: absolute;
|
|
||||||
width: 100%;
|
|
||||||
height: 50px;
|
|
||||||
bottom: 2px;
|
|
||||||
color: #5392f0;
|
|
||||||
text-align: center;
|
|
||||||
font-size: 18px;
|
|
||||||
font-family: "Roboto", sans-serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (max-width: 1080px) {
|
|
||||||
.login-container {
|
.login-container {
|
||||||
grid-gap: 9rem;
|
grid-gap: 9rem;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (max-width: 1024px) {
|
|
||||||
.login-form {
|
.login-form {
|
||||||
width: 290px;
|
width: 290px;
|
||||||
}
|
}
|
||||||
@@ -208,7 +71,7 @@ a:hover {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (max-width: 768px) {
|
@media screen and (max-width: 968px) {
|
||||||
.wave {
|
.wave {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|||||||
406
src/style/reset.scss
Normal file
@@ -0,0 +1,406 @@
|
|||||||
|
/*
|
||||||
|
1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)
|
||||||
|
2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)
|
||||||
|
*/
|
||||||
|
|
||||||
|
*,
|
||||||
|
::before,
|
||||||
|
::after {
|
||||||
|
box-sizing: border-box; /* 1 */
|
||||||
|
border-width: 0; /* 2 */
|
||||||
|
border-style: solid; /* 2 */
|
||||||
|
border-color: currentColor; /* 2 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
1. Use a consistent sensible line-height in all browsers.
|
||||||
|
2. Prevent adjustments of font size after orientation changes in iOS.
|
||||||
|
3. Use a more readable tab size.
|
||||||
|
4. Use the user's configured `sans` font-family by default.
|
||||||
|
*/
|
||||||
|
|
||||||
|
html {
|
||||||
|
line-height: 1.5; /* 1 */
|
||||||
|
-webkit-text-size-adjust: 100%; /* 2 */
|
||||||
|
-moz-tab-size: 4; /* 3 */
|
||||||
|
tab-size: 4; /* 3 */
|
||||||
|
font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB",
|
||||||
|
"Microsoft YaHei", "微软雅黑", Arial, sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
1. Remove the margin in all browsers.
|
||||||
|
2. Inherit line-height from `html` so users can set them as a class directly on the `html` element.
|
||||||
|
*/
|
||||||
|
|
||||||
|
body {
|
||||||
|
margin: 0; /* 1 */
|
||||||
|
line-height: inherit; /* 2 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
1. Add the correct height in Firefox.
|
||||||
|
2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)
|
||||||
|
3. Ensure horizontal rules are visible by default.
|
||||||
|
*/
|
||||||
|
|
||||||
|
hr {
|
||||||
|
height: 0; /* 1 */
|
||||||
|
color: inherit; /* 2 */
|
||||||
|
border-top-width: 1px; /* 3 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Add the correct text decoration in Chrome, Edge, and Safari.
|
||||||
|
*/
|
||||||
|
|
||||||
|
abbr:where([title]) {
|
||||||
|
text-decoration: underline dotted;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Remove the default font size and weight for headings.
|
||||||
|
*/
|
||||||
|
|
||||||
|
h1,
|
||||||
|
h2,
|
||||||
|
h3,
|
||||||
|
h4,
|
||||||
|
h5,
|
||||||
|
h6 {
|
||||||
|
font-size: inherit;
|
||||||
|
font-weight: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Reset links to optimize for opt-in styling instead of opt-out.
|
||||||
|
*/
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: inherit;
|
||||||
|
text-decoration: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Add the correct font weight in Edge and Safari.
|
||||||
|
*/
|
||||||
|
|
||||||
|
b,
|
||||||
|
strong {
|
||||||
|
font-weight: bolder;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
1. Use the user's configured `mono` font family by default.
|
||||||
|
2. Correct the odd `em` font sizing in all browsers.
|
||||||
|
*/
|
||||||
|
|
||||||
|
code,
|
||||||
|
kbd,
|
||||||
|
samp,
|
||||||
|
pre {
|
||||||
|
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
|
||||||
|
"Liberation Mono", "Courier New", monospace; /* 1 */
|
||||||
|
font-size: 1em; /* 2 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Add the correct font size in all browsers.
|
||||||
|
*/
|
||||||
|
|
||||||
|
small {
|
||||||
|
font-size: 80%;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Prevent `sub` and `sup` elements from affecting the line height in all browsers.
|
||||||
|
*/
|
||||||
|
|
||||||
|
sub,
|
||||||
|
sup {
|
||||||
|
font-size: 75%;
|
||||||
|
line-height: 0;
|
||||||
|
position: relative;
|
||||||
|
vertical-align: baseline;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub {
|
||||||
|
bottom: -0.25em;
|
||||||
|
}
|
||||||
|
|
||||||
|
sup {
|
||||||
|
top: -0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)
|
||||||
|
2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)
|
||||||
|
3. Remove gaps between table borders by default.
|
||||||
|
*/
|
||||||
|
|
||||||
|
table {
|
||||||
|
text-indent: 0; /* 1 */
|
||||||
|
border-color: inherit; /* 2 */
|
||||||
|
border-collapse: collapse; /* 3 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
1. Change the font styles in all browsers.
|
||||||
|
2. Remove the margin in Firefox and Safari.
|
||||||
|
3. Remove default padding in all browsers.
|
||||||
|
*/
|
||||||
|
|
||||||
|
button,
|
||||||
|
input,
|
||||||
|
optgroup,
|
||||||
|
select,
|
||||||
|
textarea {
|
||||||
|
font-family: inherit; /* 1 */
|
||||||
|
font-size: 100%; /* 1 */
|
||||||
|
line-height: inherit; /* 1 */
|
||||||
|
color: inherit; /* 1 */
|
||||||
|
margin: 0; /* 2 */
|
||||||
|
padding: 0; /* 3 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Remove the inheritance of text transform in Edge and Firefox.
|
||||||
|
*/
|
||||||
|
|
||||||
|
button,
|
||||||
|
select {
|
||||||
|
text-transform: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
1. Correct the inability to style clickable types in iOS and Safari.
|
||||||
|
2. Remove default button styles.
|
||||||
|
*/
|
||||||
|
|
||||||
|
button,
|
||||||
|
[type="button"],
|
||||||
|
[type="reset"],
|
||||||
|
[type="submit"] {
|
||||||
|
-webkit-appearance: button; /* 1 */
|
||||||
|
background-color: transparent; /* 2 */
|
||||||
|
background-image: none; /* 2 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Use the modern Firefox focus style for all focusable elements.
|
||||||
|
*/
|
||||||
|
|
||||||
|
:-moz-focusring {
|
||||||
|
outline: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Remove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)
|
||||||
|
*/
|
||||||
|
|
||||||
|
:-moz-ui-invalid {
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Add the correct vertical alignment in Chrome and Firefox.
|
||||||
|
*/
|
||||||
|
|
||||||
|
progress {
|
||||||
|
vertical-align: baseline;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Correct the cursor style of increment and decrement buttons in Safari.
|
||||||
|
*/
|
||||||
|
|
||||||
|
::-webkit-inner-spin-button,
|
||||||
|
::-webkit-outer-spin-button {
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
1. Correct the odd appearance in Chrome and Safari.
|
||||||
|
2. Correct the outline style in Safari.
|
||||||
|
*/
|
||||||
|
|
||||||
|
[type="search"] {
|
||||||
|
-webkit-appearance: textfield; /* 1 */
|
||||||
|
outline-offset: -2px; /* 2 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Remove the inner padding in Chrome and Safari on macOS.
|
||||||
|
*/
|
||||||
|
|
||||||
|
::-webkit-search-decoration {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
1. Correct the inability to style clickable types in iOS and Safari.
|
||||||
|
2. Change font properties to `inherit` in Safari.
|
||||||
|
*/
|
||||||
|
|
||||||
|
::-webkit-file-upload-button {
|
||||||
|
-webkit-appearance: button; /* 1 */
|
||||||
|
font: inherit; /* 2 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Add the correct display in Chrome and Safari.
|
||||||
|
*/
|
||||||
|
|
||||||
|
summary {
|
||||||
|
display: list-item;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Removes the default spacing and border for appropriate elements.
|
||||||
|
*/
|
||||||
|
|
||||||
|
blockquote,
|
||||||
|
dl,
|
||||||
|
dd,
|
||||||
|
h1,
|
||||||
|
h2,
|
||||||
|
h3,
|
||||||
|
h4,
|
||||||
|
h5,
|
||||||
|
h6,
|
||||||
|
hr,
|
||||||
|
figure,
|
||||||
|
p,
|
||||||
|
pre {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
fieldset {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
legend {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ol,
|
||||||
|
ul,
|
||||||
|
menu {
|
||||||
|
list-style: none;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Prevent resizing textareas horizontally by default.
|
||||||
|
*/
|
||||||
|
|
||||||
|
textarea {
|
||||||
|
resize: vertical;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)
|
||||||
|
2. Set the default placeholder color to the user's configured gray 400 color.
|
||||||
|
*/
|
||||||
|
|
||||||
|
input::placeholder,
|
||||||
|
textarea::placeholder {
|
||||||
|
opacity: 1; /* 1 */
|
||||||
|
color: #9ca3af; /* 2 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Set the default cursor for buttons.
|
||||||
|
*/
|
||||||
|
|
||||||
|
button,
|
||||||
|
[role="button"] {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Make sure disabled buttons don't get the pointer cursor.
|
||||||
|
*/
|
||||||
|
:disabled {
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)
|
||||||
|
2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)
|
||||||
|
This can trigger a poorly considered lint error in some tools but is included by design.
|
||||||
|
*/
|
||||||
|
|
||||||
|
img,
|
||||||
|
svg,
|
||||||
|
video,
|
||||||
|
canvas,
|
||||||
|
audio,
|
||||||
|
iframe,
|
||||||
|
embed,
|
||||||
|
object {
|
||||||
|
display: block; /* 1 */
|
||||||
|
vertical-align: middle; /* 2 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Constrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)
|
||||||
|
*/
|
||||||
|
|
||||||
|
img,
|
||||||
|
video {
|
||||||
|
max-width: 100%;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Ensure the default browser behavior of the `hidden` attribute.
|
||||||
|
*/
|
||||||
|
|
||||||
|
[hidden] {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dark {
|
||||||
|
color-scheme: dark;
|
||||||
|
}
|
||||||
|
|
||||||
|
label {
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
*,
|
||||||
|
*::before,
|
||||||
|
*::after {
|
||||||
|
box-sizing: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:focus,
|
||||||
|
a:active {
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
a,
|
||||||
|
a:focus,
|
||||||
|
a:hover {
|
||||||
|
cursor: pointer;
|
||||||
|
color: inherit;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
div:focus {
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.clearfix {
|
||||||
|
&::after {
|
||||||
|
visibility: hidden;
|
||||||
|
display: block;
|
||||||
|
font-size: 0;
|
||||||
|
content: " ";
|
||||||
|
clear: both;
|
||||||
|
height: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,3 @@
|
|||||||
@import "../layout/theme/default-vars.scss";
|
|
||||||
|
|
||||||
@mixin merge-style(
|
@mixin merge-style(
|
||||||
/* vertical模式下主体内容距离网页文档左侧的距离 */ $sideBarWidth
|
/* vertical模式下主体内容距离网页文档左侧的距离 */ $sideBarWidth
|
||||||
) {
|
) {
|
||||||
@@ -16,22 +14,26 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sub-menu-icon {
|
||||||
|
vertical-align: middle;
|
||||||
|
margin-right: 5px;
|
||||||
|
font-size: 18px;
|
||||||
|
display: inline-flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
.main-container {
|
.main-container {
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
min-height: 100%;
|
min-height: 100%;
|
||||||
transition: margin-left 0.28s;
|
transition: margin-left 0.1s;
|
||||||
margin-left: $sideBarWidth;
|
margin-left: $sideBarWidth;
|
||||||
position: relative;
|
position: relative;
|
||||||
background: #f0f2f5;
|
background: #f0f2f5;
|
||||||
@media screen and (min-width: 150px) and (max-width: 420px) {
|
|
||||||
.app-main .el-scrollbar__view:first-child {
|
.el-scrollbar__wrap {
|
||||||
overflow-y: hidden;
|
overflow: auto;
|
||||||
}
|
height: 100%;
|
||||||
}
|
|
||||||
@media screen and (min-width: 420px) {
|
|
||||||
.app-main .el-scrollbar__view:first-child {
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,7 +43,7 @@
|
|||||||
right: 0;
|
right: 0;
|
||||||
z-index: 998;
|
z-index: 998;
|
||||||
width: calc(100% - 210px);
|
width: calc(100% - 210px);
|
||||||
transition: width 0.28s;
|
transition: width 0.1s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.main-hidden {
|
.main-hidden {
|
||||||
@@ -61,7 +63,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.sidebar-container {
|
.sidebar-container {
|
||||||
transition: width 0.28s;
|
transition: width 0.1s;
|
||||||
width: $sideBarWidth !important;
|
width: $sideBarWidth !important;
|
||||||
background: $menuBg;
|
background: $menuBg;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
@@ -212,7 +214,7 @@
|
|||||||
|
|
||||||
.horizontal-header-right {
|
.horizontal-header-right {
|
||||||
display: flex;
|
display: flex;
|
||||||
min-width: 280px;
|
min-width: 340px;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
color: $subMenuActiveText;
|
color: $subMenuActiveText;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
@@ -226,6 +228,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.search-container {
|
||||||
|
&:hover {
|
||||||
|
background: $menuHover;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.screen-full {
|
.screen-full {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
@@ -247,7 +255,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.el-dropdown-link {
|
.el-dropdown-link {
|
||||||
width: 100px;
|
|
||||||
height: 48px;
|
height: 48px;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -481,11 +488,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-scrollbar__wrap {
|
|
||||||
overflow: auto;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.el-menu--collapse .el-menu .el-sub-menu {
|
.el-menu--collapse .el-menu .el-sub-menu {
|
||||||
min-width: $sideBarWidth !important;
|
min-width: $sideBarWidth !important;
|
||||||
}
|
}
|
||||||
@@ -496,8 +498,8 @@
|
|||||||
> .el-sub-menu__title::before {
|
> .el-sub-menu__title::before {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 2px;
|
||||||
width: 3px;
|
width: 2px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background-color: $menuActiveBefore;
|
background-color: $menuActiveBefore;
|
||||||
content: "";
|
content: "";
|
||||||
@@ -510,7 +512,7 @@
|
|||||||
.el-menu--collapse .is-active.submenu-title-noDropdown.outer-most::before {
|
.el-menu--collapse .is-active.submenu-title-noDropdown.outer-most::before {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
width: 3px;
|
width: 2px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background-color: $menuActiveBefore;
|
background-color: $menuActiveBefore;
|
||||||
content: "";
|
content: "";
|
||||||
@@ -534,7 +536,7 @@
|
|||||||
.mobile {
|
.mobile {
|
||||||
.fixed-header {
|
.fixed-header {
|
||||||
width: 100% !important;
|
width: 100% !important;
|
||||||
transition: width 0.28s;
|
transition: width 0.1s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.main-container {
|
.main-container {
|
||||||
@@ -542,7 +544,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.sidebar-container {
|
.sidebar-container {
|
||||||
transition: transform 0.28s;
|
transition: transform 0.1s;
|
||||||
width: $sideBarWidth;
|
width: $sideBarWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -579,7 +581,7 @@ body[layout="vertical"] {
|
|||||||
.hideSidebar {
|
.hideSidebar {
|
||||||
.fixed-header {
|
.fixed-header {
|
||||||
width: calc(100% - 54px);
|
width: calc(100% - 54px);
|
||||||
transition: width 0.28s;
|
transition: width 0.1s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar-container {
|
.sidebar-container {
|
||||||
@@ -613,20 +615,25 @@ body[layout="vertical"] {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 无子菜单 */
|
|
||||||
.el-menu-item [class^="el-icon"] {
|
|
||||||
right: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.el-sub-menu__title [class^="el-icon"] {
|
|
||||||
right: 2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.submenu-title-noDropdown {
|
.submenu-title-noDropdown {
|
||||||
background: transparent !important;
|
background: transparent !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 有无子菜单 */
|
||||||
|
.el-sub-menu__title,
|
||||||
|
.el-menu-item [class^="el-icon"] {
|
||||||
|
right: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-menu-tooltip__trigger {
|
||||||
|
padding: 0 18px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sub-menu-icon {
|
||||||
|
width: 24px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
body[layout="horizontal"] {
|
body[layout="horizontal"] {
|
||||||
@@ -650,7 +657,7 @@ body[layout="mix"] {
|
|||||||
.hideSidebar {
|
.hideSidebar {
|
||||||
.fixed-header {
|
.fixed-header {
|
||||||
width: calc(100% - 54px);
|
width: calc(100% - 54px);
|
||||||
transition: width 0.28s;
|
transition: width 0.1s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar-container {
|
.sidebar-container {
|
||||||
|
|||||||
@@ -1,12 +1,39 @@
|
|||||||
|
import { unref } from "vue";
|
||||||
|
import type { Ref } from "vue";
|
||||||
|
|
||||||
|
type FunctionArgs<Args extends any[] = any[], Return = void> = (
|
||||||
|
...args: Args
|
||||||
|
) => Return;
|
||||||
|
|
||||||
|
type MaybeRef<T> = T | Ref<T>;
|
||||||
|
|
||||||
// 延迟函数
|
// 延迟函数
|
||||||
export const delay = (timeout: number) =>
|
export const delay = (timeout: number) =>
|
||||||
new Promise(resolve => setTimeout(resolve, timeout));
|
new Promise(resolve => setTimeout(resolve, timeout));
|
||||||
|
|
||||||
// 防抖函数
|
/**
|
||||||
export const debounce = (fn: () => Fn, timeout: number) => {
|
* 防抖函数
|
||||||
|
* @param fn 函数
|
||||||
|
* @param timeout 延迟时间
|
||||||
|
* @param immediate 是否立即执行
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export const debounce = <T extends FunctionArgs>(
|
||||||
|
fn: T,
|
||||||
|
timeout: MaybeRef<number> = 200,
|
||||||
|
immediate = false
|
||||||
|
) => {
|
||||||
let timmer: TimeoutHandle;
|
let timmer: TimeoutHandle;
|
||||||
|
const wait = unref(timeout);
|
||||||
return () => {
|
return () => {
|
||||||
timmer ? clearTimeout(timmer) : null;
|
timmer && clearTimeout(timmer);
|
||||||
timmer = setTimeout(fn, timeout);
|
if (immediate) {
|
||||||
|
if (!timmer) {
|
||||||
|
fn();
|
||||||
|
}
|
||||||
|
timmer = setTimeout(() => (timmer = null), wait);
|
||||||
|
} else {
|
||||||
|
timmer = setTimeout(fn, wait);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import {
|
|||||||
resultType,
|
resultType,
|
||||||
PureHttpError,
|
PureHttpError,
|
||||||
RequestMethods,
|
RequestMethods,
|
||||||
PureHttpResoponse,
|
PureHttpResponse,
|
||||||
PureHttpRequestConfig
|
PureHttpRequestConfig
|
||||||
} from "./types.d";
|
} from "./types.d";
|
||||||
import qs from "qs";
|
import qs from "qs";
|
||||||
@@ -91,7 +91,7 @@ class PureHttp {
|
|||||||
private httpInterceptorsResponse(): void {
|
private httpInterceptorsResponse(): void {
|
||||||
const instance = PureHttp.axiosInstance;
|
const instance = PureHttp.axiosInstance;
|
||||||
instance.interceptors.response.use(
|
instance.interceptors.response.use(
|
||||||
(response: PureHttpResoponse) => {
|
(response: PureHttpResponse) => {
|
||||||
const $config = response.config;
|
const $config = response.config;
|
||||||
// 关闭进度条动画
|
// 关闭进度条动画
|
||||||
NProgress.done();
|
NProgress.done();
|
||||||
@@ -145,21 +145,21 @@ class PureHttp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 单独抽离的post工具函数
|
// 单独抽离的post工具函数
|
||||||
public post<T>(
|
public post<T, P>(
|
||||||
url: string,
|
url: string,
|
||||||
params?: T,
|
params?: T,
|
||||||
config?: PureHttpRequestConfig
|
config?: PureHttpRequestConfig
|
||||||
): Promise<T> {
|
): Promise<P> {
|
||||||
return this.request<T>("post", url, params, config);
|
return this.request<P>("post", url, params, config);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 单独抽离的get工具函数
|
// 单独抽离的get工具函数
|
||||||
public get<T>(
|
public get<T, P>(
|
||||||
url: string,
|
url: string,
|
||||||
params?: T,
|
params?: T,
|
||||||
config?: PureHttpRequestConfig
|
config?: PureHttpRequestConfig
|
||||||
): Promise<T> {
|
): Promise<P> {
|
||||||
return this.request<T>("get", url, params, config);
|
return this.request<P>("get", url, params, config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
16
src/utils/http/types.d.ts
vendored
@@ -18,13 +18,13 @@ export interface PureHttpError extends AxiosError {
|
|||||||
isCancelRequest?: boolean;
|
isCancelRequest?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PureHttpResoponse extends AxiosResponse {
|
export interface PureHttpResponse extends AxiosResponse {
|
||||||
config: PureHttpRequestConfig;
|
config: PureHttpRequestConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PureHttpRequestConfig extends AxiosRequestConfig {
|
export interface PureHttpRequestConfig extends AxiosRequestConfig {
|
||||||
beforeRequestCallback?: (request: PureHttpRequestConfig) => void;
|
beforeRequestCallback?: (request: PureHttpRequestConfig) => void;
|
||||||
beforeResponseCallback?: (response: PureHttpResoponse) => void;
|
beforeResponseCallback?: (response: PureHttpResponse) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class PureHttp {
|
export default class PureHttp {
|
||||||
@@ -34,6 +34,14 @@ export default class PureHttp {
|
|||||||
param?: AxiosRequestConfig,
|
param?: AxiosRequestConfig,
|
||||||
axiosConfig?: PureHttpRequestConfig
|
axiosConfig?: PureHttpRequestConfig
|
||||||
): Promise<T>;
|
): Promise<T>;
|
||||||
post<T>(url: string, params?: T, config?: PureHttpRequestConfig): Promise<T>;
|
post<T, P>(
|
||||||
get<T>(url: string, params?: T, config?: PureHttpRequestConfig): Promise<T>;
|
url: string,
|
||||||
|
params?: T,
|
||||||
|
config?: PureHttpRequestConfig
|
||||||
|
): Promise<P>;
|
||||||
|
get<T, P>(
|
||||||
|
url: string,
|
||||||
|
params?: T,
|
||||||
|
config?: PureHttpRequestConfig
|
||||||
|
): Promise<P>;
|
||||||
}
|
}
|
||||||
|
|||||||