Compare commits
51 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c6e25d6933 | ||
|
|
cabf1f85ef | ||
|
|
cb3d7cd552 | ||
|
|
80453ec4b1 | ||
|
|
8ca8bbcee0 | ||
|
|
2b67efe771 | ||
|
|
bbe23ce0a2 | ||
|
|
68492ec362 | ||
|
|
bc3b199860 | ||
|
|
4407dd5d10 | ||
|
|
b3cbdd6e87 | ||
|
|
b5f0ca52ce | ||
|
|
6110be29a1 | ||
|
|
d53496e495 | ||
|
|
1bafbeaab7 | ||
|
|
9a802296c7 | ||
|
|
e183ea75a0 | ||
|
|
969775c7cf | ||
|
|
841c5bd53a | ||
|
|
761b0e5ec2 | ||
|
|
b811256830 | ||
|
|
6019739c16 | ||
|
|
0dd1c67280 | ||
|
|
7d419c3b35 | ||
|
|
6ceb37624f | ||
|
|
fdf12660c1 | ||
|
|
49cdcf216f | ||
|
|
936070c9ce | ||
|
|
f14077bc6f | ||
|
|
1003a31b4d | ||
|
|
cc8a07d25b | ||
|
|
24db509381 | ||
|
|
43069ac127 | ||
|
|
f7ba97c73e | ||
|
|
ee65ec9f72 | ||
|
|
230af57c3e | ||
|
|
cdaa4cdba8 | ||
|
|
496947b524 | ||
|
|
d48058c28f | ||
|
|
820f724d5b | ||
|
|
63e2ddc171 | ||
|
|
60cdaf4697 | ||
|
|
d3cabb0f33 | ||
|
|
97193a71a6 | ||
|
|
f8694e953c | ||
|
|
55f97fce96 | ||
|
|
29144aba44 | ||
|
|
9a448143ae | ||
|
|
a85a2f9022 | ||
|
|
20fee1418c | ||
|
|
2888f8c4f1 |
@@ -1,14 +1,8 @@
|
|||||||
# 项目本地运行端口号
|
# 平台本地运行端口号
|
||||||
VITE_PORT = 8848
|
VITE_PORT = 8848
|
||||||
|
|
||||||
# 开发环境读取配置文件路径
|
# 开发环境读取配置文件路径
|
||||||
VITE_PUBLIC_PATH = /
|
VITE_PUBLIC_PATH = /
|
||||||
|
|
||||||
# 开发环境代理
|
# 开发环境路由历史模式(Hash模式传"hash"、HTML5模式传"h5"、Hash模式带base参数传"hash,base参数"、HTML5模式带base参数传"h5,base参数")
|
||||||
VITE_PROXY_DOMAIN = /api
|
|
||||||
|
|
||||||
# 开发环境路由历史模式
|
|
||||||
VITE_ROUTER_HISTORY = "hash"
|
VITE_ROUTER_HISTORY = "hash"
|
||||||
|
|
||||||
# 开发环境后端地址
|
|
||||||
VITE_PROXY_DOMAIN_REAL = "http://127.0.0.1:3000"
|
|
||||||
@@ -1,11 +1,13 @@
|
|||||||
# 线上环境项目打包路径
|
# 线上环境平台打包路径
|
||||||
VITE_PUBLIC_PATH = /
|
VITE_PUBLIC_PATH = /
|
||||||
|
|
||||||
# 线上环境路由历史模式
|
# 线上环境路由历史模式(Hash模式传"hash"、HTML5模式传"h5"、Hash模式带base参数传"hash,base参数"、HTML5模式带base参数传"h5,base参数")
|
||||||
VITE_ROUTER_HISTORY = "hash"
|
VITE_ROUTER_HISTORY = "hash"
|
||||||
|
|
||||||
# 线上环境后端地址
|
# 是否在打包时使用cdn替换本地库 替换 true 不替换 false
|
||||||
VITE_PROXY_DOMAIN_REAL = ""
|
VITE_CDN = false
|
||||||
|
|
||||||
# 是否为打包后的文件提供传统浏览器兼容性支持 支持 true 不支持 false
|
# 是否启用gzip压缩或brotli压缩(分两种情况,删除原始文件和不删除原始文件)
|
||||||
VITE_LEGACY = false
|
# 压缩时不删除原始文件的配置:gzip、brotli、both(同时开启 gzip 与 brotli 压缩)、none(不开启压缩,默认)
|
||||||
|
# 压缩时删除原始文件的配置:gzip-clear、brotli-clear、both-clear(同时开启 gzip 与 brotli 压缩)、none(不开启压缩,默认)
|
||||||
|
VITE_COMPRESSION = "none"
|
||||||
12
.env.staging
@@ -4,11 +4,13 @@ NODE_ENV=production
|
|||||||
|
|
||||||
VITE_PUBLIC_PATH = /
|
VITE_PUBLIC_PATH = /
|
||||||
|
|
||||||
# 线上环境路由历史模式
|
# 预发布环境路由历史模式(Hash模式传"hash"、HTML5模式传"h5"、Hash模式带base参数传"hash,base参数"、HTML5模式带base参数传"h5,base参数")
|
||||||
VITE_ROUTER_HISTORY = "hash"
|
VITE_ROUTER_HISTORY = "hash"
|
||||||
|
|
||||||
# 线上环境后端地址
|
# 是否在打包时使用cdn替换本地库 替换 true 不替换 false
|
||||||
VITE_PROXY_DOMAIN_REAL = ""
|
VITE_CDN = true
|
||||||
|
|
||||||
# 是否为打包后的文件提供传统浏览器兼容性支持 支持 true 不支持 false
|
# 是否启用gzip压缩或brotli压缩(分两种情况,删除原始文件和不删除原始文件)
|
||||||
VITE_LEGACY = false
|
# 压缩时不删除原始文件的配置:gzip、brotli、both(同时开启 gzip 与 brotli 压缩)、none(不开启压缩,默认)
|
||||||
|
# 压缩时删除原始文件的配置:gzip-clear、brotli-clear、both-clear(同时开启 gzip 与 brotli 压缩)、none(不开启压缩,默认)
|
||||||
|
VITE_COMPRESSION = "both-clear"
|
||||||
|
|||||||
@@ -1,4 +1,11 @@
|
|||||||
public
|
public
|
||||||
dist
|
dist
|
||||||
*.d.ts
|
*.d.ts
|
||||||
package.json
|
/src/assets
|
||||||
|
package.json
|
||||||
|
.eslintrc.js
|
||||||
|
.prettierrc.js
|
||||||
|
commitlint.config.js
|
||||||
|
postcss.config.js
|
||||||
|
tailwind.config.js
|
||||||
|
stylelint.config.js
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
"*.{js,jsx,ts,tsx}": ["eslint --fix", "prettier --write"],
|
"*.{js,jsx,ts,tsx}": ["eslint --fix", "prettier --write"],
|
||||||
"{!(package)*.json,.!(browserslist)*rc}": ["prettier --write--parser json"],
|
"{!(package)*.json}": ["prettier --write--parser json"],
|
||||||
"package.json": ["prettier --write"],
|
"package.json": ["prettier --write"],
|
||||||
"*.vue": ["eslint --fix", "prettier --write", "stylelint --fix"],
|
"*.vue": ["eslint --fix", "prettier --write", "stylelint --fix"],
|
||||||
"*.{vue,css,scss,postcss,less}": ["stylelint --fix", "prettier --write"],
|
"*.{vue,css,scss,postcss,less}": ["stylelint --fix", "prettier --write"],
|
||||||
|
|||||||
3
.npmrc
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
shamefully-hoist=true
|
||||||
|
strict-peer-dependencies=false
|
||||||
|
shell-emulator=true
|
||||||
6
.vscode/extensions.json
vendored
@@ -1,15 +1,17 @@
|
|||||||
{
|
{
|
||||||
"recommendations": [
|
"recommendations": [
|
||||||
|
"christian-kohler.path-intellisense",
|
||||||
"vscode-icons-team.vscode-icons",
|
"vscode-icons-team.vscode-icons",
|
||||||
"davidanson.vscode-markdownlint",
|
"davidanson.vscode-markdownlint",
|
||||||
"stylelint.vscode-stylelint",
|
"stylelint.vscode-stylelint",
|
||||||
|
"bradlc.vscode-tailwindcss",
|
||||||
"dbaeumer.vscode-eslint",
|
"dbaeumer.vscode-eslint",
|
||||||
"esbenp.prettier-vscode",
|
"esbenp.prettier-vscode",
|
||||||
"lokalise.i18n-ally",
|
"redhat.vscode-yaml",
|
||||||
|
"csstools.postcss",
|
||||||
"mikestead.dotenv",
|
"mikestead.dotenv",
|
||||||
"eamodio.gitlens",
|
"eamodio.gitlens",
|
||||||
"antfu.iconify",
|
"antfu.iconify",
|
||||||
"antfu.unocss",
|
|
||||||
"Vue.volar"
|
"Vue.volar"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
9
.vscode/settings.json
vendored
@@ -6,6 +6,7 @@
|
|||||||
},
|
},
|
||||||
"editor.tabSize": 2,
|
"editor.tabSize": 2,
|
||||||
"editor.formatOnPaste": true,
|
"editor.formatOnPaste": true,
|
||||||
|
"editor.guides.bracketPairs": "active",
|
||||||
"files.autoSave": "afterDelay",
|
"files.autoSave": "afterDelay",
|
||||||
"git.confirmSync": false,
|
"git.confirmSync": false,
|
||||||
"workbench.startupEditor": "newUntitledFile",
|
"workbench.startupEditor": "newUntitledFile",
|
||||||
@@ -26,13 +27,5 @@
|
|||||||
"editor.codeActionsOnSave": {
|
"editor.codeActionsOnSave": {
|
||||||
"source.fixAll.eslint": true
|
"source.fixAll.eslint": true
|
||||||
},
|
},
|
||||||
"i18n-ally.localesPaths": "locales",
|
|
||||||
"i18n-ally.keystyle": "nested",
|
|
||||||
"i18n-ally.sortKeys": true,
|
|
||||||
"i18n-ally.namespace": true,
|
|
||||||
"i18n-ally.enabledParsers": ["yaml", "js"],
|
|
||||||
"i18n-ally.sourceLanguage": "en",
|
|
||||||
"i18n-ally.displayLanguage": "zh-CN",
|
|
||||||
"i18n-ally.enabledFrameworks": ["vue"],
|
|
||||||
"iconify.excludes": ["el"]
|
"iconify.excludes": ["el"]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
<h1>vue-pure-admin Lite Edition</h1>
|
<h1>vue-pure-admin Lite Edition(no i18n version)</h1>
|
||||||
|
|
||||||
[](LICENSE)
|
[](LICENSE)
|
||||||
|
|
||||||
**English** | [中文](./README.md)
|
**English** | [中文](./README.md)
|
||||||
|
|
||||||
## 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 `3MB`
|
The simplified version is based on the shelf extracted from [vue-pure-admin](https://github.com/xiaoxian521/vue-pure-admin), which contains main functions and is more suitable for actual project development. The packaged size is introduced globally [element-plus](https://element-plus.org) is still below `2.3MB`, and the full version of the code will be permanently synchronized. After enabling `brotli` compression and `cdn` to replace the local library mode, the package size is less than `350kb`
|
||||||
|
|
||||||
## Supporting Video
|
## Supporting Video
|
||||||
|
|
||||||
@@ -15,7 +15,8 @@ The lite version is based on the shelf extracted from [vue-pure-admin](https://g
|
|||||||
|
|
||||||
## Docs
|
## Docs
|
||||||
|
|
||||||
- [Click Watch Docs](https://pure-admin-doc.vercel.app)
|
- [Click me to view the domestic documentation site](https://yiming_chang.gitee.io/pure-admin-doc)
|
||||||
|
- [Click me to view foreign document site](https://xiaoxian521.github.io/pure-admin-doc)
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
@@ -40,7 +41,6 @@ bilibili: https://www.bilibili.com/video/BV1534y1S7HV/
|
|||||||
## ⚠️ Attention
|
## ⚠️ 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, 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
|
||||||
|
|
||||||
|
|||||||
20
README.md
@@ -1,4 +1,4 @@
|
|||||||
<h1>vue-pure-admin精简版</h1>
|
<h1>vue-pure-admin精简版(非国际化版本)</h1>
|
||||||
|
|
||||||
[](LICENSE)
|
[](LICENSE)
|
||||||
|
|
||||||
@@ -6,7 +6,11 @@
|
|||||||
|
|
||||||
## 介绍
|
## 介绍
|
||||||
|
|
||||||
精简版是基于[vue-pure-admin](https://github.com/xiaoxian521/vue-pure-admin)提炼出的架子,包含主体功能,更适合实际项目开发,打包后的大小仅 `3MB`
|
精简版是基于 [vue-pure-admin](https://github.com/xiaoxian521/vue-pure-admin) 提炼出的架子,包含主体功能,更适合实际项目开发,打包后的大小在全局引入 [element-plus](https://element-plus.org) 的情况下仍然低于 `2.3MB`,并且会永久同步完整版的代码。开启 `brotli` 压缩和 `cdn` 替换本地库模式后,打包大小低于 `350kb`
|
||||||
|
|
||||||
|
## 版本选择
|
||||||
|
|
||||||
|
当前是非国际化版本哦,如果您需要国际化版本 [请点击](https://github.com/xiaoxian521/pure-admin-thin/tree/i18n)
|
||||||
|
|
||||||
## 配套视频
|
## 配套视频
|
||||||
|
|
||||||
@@ -15,7 +19,8 @@
|
|||||||
|
|
||||||
## 配套文档
|
## 配套文档
|
||||||
|
|
||||||
- [点我查看文档](https://pure-admin-doc.vercel.app)
|
- [点我查看国内文档站](https://yiming_chang.gitee.io/pure-admin-doc)
|
||||||
|
- [点我查看国外文档站](https://xiaoxian521.github.io/pure-admin-doc)
|
||||||
|
|
||||||
## 维护者
|
## 维护者
|
||||||
|
|
||||||
@@ -29,9 +34,9 @@
|
|||||||
|
|
||||||
## QQ 交流群
|
## QQ 交流群
|
||||||
|
|
||||||
一群已满,下面是二群,群里严禁`黄`、`赌`、`毒`、`vpn`等违法行为!
|
一群已满,下面是二群,群里严禁 `黄` 、 `赌` 、 `毒` 、 `vpn` 等违法行为!
|
||||||
|
|
||||||
<img src="https://pure-admin-doc.vercel.app/img/support/qq.png" width="150px" height="225px" />
|
<img src="http://yiming_chang.gitee.io/pure-admin-doc/img/support/qq.png" width="150px" height="225px" />
|
||||||
|
|
||||||
## 用法
|
## 用法
|
||||||
|
|
||||||
@@ -47,12 +52,11 @@ pnpm add 包名
|
|||||||
|
|
||||||
pnpm remove 包名
|
pnpm remove 包名
|
||||||
|
|
||||||
我认为你应该先 fork 项目去开发,以便我更新时您可以同步拉取更新!!!
|
我认为你应该先 `fork` 项目去开发,以便我更新时您可以同步拉取更新!!!
|
||||||
|
|
||||||
## ⚠️ 注意
|
## ⚠️ 注意
|
||||||
|
|
||||||
- 精简版不接受任何 issues 和 pr,如果有问题请到完整版 https://github.com/xiaoxian521/vue-pure-admin/issues/new/choose 去提,谢谢!!!
|
- 精简版不接受任何 `issues` 和 `pr`,如果有问题请到完整版 [issues](https://github.com/xiaoxian521/vue-pure-admin/issues/new/choose) 去提,谢谢!!!
|
||||||
- 不要使用`delete-i18n`分支代码,这个分支只是给你们完全删除国际化的参考,不会同步代码的!!,请务必使用`main`分支的代码!!!
|
|
||||||
|
|
||||||
## 许可证
|
## 许可证
|
||||||
|
|
||||||
|
|||||||
62
build/cdn.ts
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
import { Plugin as importToCDN } from "vite-plugin-cdn-import";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 打包时采用`cdn`模式,仅限外网使用(默认不采用,如果需要采用cdn模式,请在 .env.production 文件,将 VITE_CDN 设置成true)
|
||||||
|
* 平台采用国内cdn:https://www.bootcdn.cn,当然你也可以选择 https://unpkg.com 或者 https://www.jsdelivr.com
|
||||||
|
* 提醒:mockjs不能用cdn模式引入,会报错。正确的方式是,生产环境删除mockjs,使用真实的后端请求
|
||||||
|
* 注意:上面提到的仅限外网使用也不是完全肯定的,如果你们公司内网部署的有相关js、css文件,也可以将下面配置对应改一下,整一套内网版cdn
|
||||||
|
*/
|
||||||
|
export const cdn = importToCDN({
|
||||||
|
//(prodUrl解释: name: 对应下面modules的name,version: 自动读取本地package.json中dependencies依赖中对应包的版本号,path: 对应下面modules的path)
|
||||||
|
prodUrl: "https://cdn.bootcdn.net/ajax/libs/{name}/{version}/{path}",
|
||||||
|
modules: [
|
||||||
|
{
|
||||||
|
name: "vue",
|
||||||
|
var: "Vue",
|
||||||
|
path: "vue.global.prod.min.js"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "vue-router",
|
||||||
|
var: "VueRouter",
|
||||||
|
path: "vue-router.global.min.js"
|
||||||
|
},
|
||||||
|
// 项目中没有直接安装vue-demi,但是pinia用到了,所以需要在引入pinia前引入vue-demi(https://github.com/vuejs/pinia/blob/v2/packages/pinia/package.json#L77)
|
||||||
|
{
|
||||||
|
name: "vue-demi",
|
||||||
|
var: "VueDemi",
|
||||||
|
path: "index.iife.min.js"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "pinia",
|
||||||
|
var: "Pinia",
|
||||||
|
path: "pinia.iife.min.js"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "element-plus",
|
||||||
|
var: "ElementPlus",
|
||||||
|
path: "index.full.min.js",
|
||||||
|
css: "index.min.css"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "axios",
|
||||||
|
var: "axios",
|
||||||
|
path: "axios.min.js"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "dayjs",
|
||||||
|
var: "dayjs",
|
||||||
|
path: "dayjs.min.js"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "echarts",
|
||||||
|
var: "echarts",
|
||||||
|
path: "echarts.min.js"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "lodash",
|
||||||
|
var: "lodash",
|
||||||
|
// 可写`完整路径`,会替换`prodUrl`
|
||||||
|
path: "https://cdn.bootcdn.net/ajax/libs/lodash.js/4.17.21/lodash.min.js"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
63
build/compress.ts
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
import type { Plugin } from "vite";
|
||||||
|
import { isArray } from "@pureadmin/utils";
|
||||||
|
import compressPlugin from "vite-plugin-compression";
|
||||||
|
|
||||||
|
export const configCompressPlugin = (
|
||||||
|
compress: ViteCompression
|
||||||
|
): Plugin | Plugin[] => {
|
||||||
|
if (compress === "none") return null;
|
||||||
|
|
||||||
|
const gz = {
|
||||||
|
// 生成的压缩包后缀
|
||||||
|
ext: ".gz",
|
||||||
|
// 体积大于threshold才会被压缩
|
||||||
|
threshold: 0,
|
||||||
|
// 默认压缩.js|mjs|json|css|html后缀文件,设置成true,压缩全部文件
|
||||||
|
filter: () => true,
|
||||||
|
// 压缩后是否删除原始文件
|
||||||
|
deleteOriginFile: false
|
||||||
|
};
|
||||||
|
const br = {
|
||||||
|
ext: ".br",
|
||||||
|
algorithm: "brotliCompress",
|
||||||
|
threshold: 0,
|
||||||
|
filter: () => true,
|
||||||
|
deleteOriginFile: false
|
||||||
|
};
|
||||||
|
|
||||||
|
const codeList = [
|
||||||
|
{ k: "gzip", v: gz },
|
||||||
|
{ k: "brotli", v: br },
|
||||||
|
{ k: "both", v: [gz, br] }
|
||||||
|
];
|
||||||
|
|
||||||
|
const plugins: Plugin[] = [];
|
||||||
|
|
||||||
|
codeList.forEach(item => {
|
||||||
|
if (compress.includes(item.k)) {
|
||||||
|
if (compress.includes("clear")) {
|
||||||
|
if (isArray(item.v)) {
|
||||||
|
item.v.forEach(vItem => {
|
||||||
|
plugins.push(
|
||||||
|
compressPlugin(Object.assign(vItem, { deleteOriginFile: true }))
|
||||||
|
);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
plugins.push(
|
||||||
|
compressPlugin(Object.assign(item.v, { deleteOriginFile: true }))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (isArray(item.v)) {
|
||||||
|
item.v.forEach(vItem => {
|
||||||
|
plugins.push(compressPlugin(vItem));
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
plugins.push(compressPlugin(item.v));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return plugins;
|
||||||
|
};
|
||||||
@@ -1,13 +1,12 @@
|
|||||||
// 处理环境变量
|
/** 处理环境变量 */
|
||||||
const warpperEnv = (envConf: Recordable): ViteEnv => {
|
const warpperEnv = (envConf: Recordable): ViteEnv => {
|
||||||
// 此处为默认值,无需修改
|
/** 此处为默认值 */
|
||||||
const ret: ViteEnv = {
|
const ret: ViteEnv = {
|
||||||
VITE_PORT: 8848,
|
VITE_PORT: 8848,
|
||||||
VITE_PUBLIC_PATH: "",
|
VITE_PUBLIC_PATH: "",
|
||||||
VITE_PROXY_DOMAIN: "",
|
|
||||||
VITE_PROXY_DOMAIN_REAL: "",
|
|
||||||
VITE_ROUTER_HISTORY: "",
|
VITE_ROUTER_HISTORY: "",
|
||||||
VITE_LEGACY: false
|
VITE_CDN: false,
|
||||||
|
VITE_COMPRESSION: "none"
|
||||||
};
|
};
|
||||||
|
|
||||||
for (const envName of Object.keys(envConf)) {
|
for (const envName of Object.keys(envConf)) {
|
||||||
@@ -28,14 +27,9 @@ const warpperEnv = (envConf: Recordable): ViteEnv => {
|
|||||||
return ret;
|
return ret;
|
||||||
};
|
};
|
||||||
|
|
||||||
// 跨域代理重写
|
/** 获取环境变量 */
|
||||||
const regExps = (value: string, reg: string): string => {
|
|
||||||
return value.replace(new RegExp(`^${reg}`, "g"), "");
|
|
||||||
};
|
|
||||||
|
|
||||||
// 环境变量
|
|
||||||
const loadEnv = (): ViteEnv => {
|
const loadEnv = (): ViteEnv => {
|
||||||
return import.meta.env;
|
return import.meta.env;
|
||||||
};
|
};
|
||||||
|
|
||||||
export { warpperEnv, regExps, loadEnv };
|
export { warpperEnv, loadEnv };
|
||||||
|
|||||||
@@ -9,10 +9,12 @@ export function viteBuildInfo(): Plugin {
|
|||||||
let config: { command: string };
|
let config: { command: string };
|
||||||
let startTime: Dayjs;
|
let startTime: Dayjs;
|
||||||
let endTime: Dayjs;
|
let endTime: Dayjs;
|
||||||
|
let outDir: string;
|
||||||
return {
|
return {
|
||||||
name: "vite:buildInfo",
|
name: "vite:buildInfo",
|
||||||
configResolved(resolvedConfig: { command: string }) {
|
configResolved(resolvedConfig) {
|
||||||
config = resolvedConfig;
|
config = resolvedConfig;
|
||||||
|
outDir = resolvedConfig.build?.outDir ?? "dist";
|
||||||
},
|
},
|
||||||
buildStart() {
|
buildStart() {
|
||||||
console.log(
|
console.log(
|
||||||
@@ -32,6 +34,7 @@ export function viteBuildInfo(): Plugin {
|
|||||||
if (config.command === "build") {
|
if (config.command === "build") {
|
||||||
endTime = dayjs(new Date());
|
endTime = dayjs(new Date());
|
||||||
getPackageSize({
|
getPackageSize({
|
||||||
|
folder: outDir,
|
||||||
callback: (size: string) => {
|
callback: (size: string) => {
|
||||||
console.log(
|
console.log(
|
||||||
bold(
|
bold(
|
||||||
|
|||||||
37
build/optimize.ts
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
/**
|
||||||
|
* 此文件作用于 `vite.config.ts` 的 `optimizeDeps.include` 依赖预构建配置项
|
||||||
|
* 依赖预构建,`vite` 启动时会将下面 include 里的模块,编译成 esm 格式并缓存到 node_modules/.vite 文件夹,页面加载到对应模块时如果浏览器有缓存就读取浏览器缓存,如果没有会读取本地缓存并按需加载
|
||||||
|
* 尤其当您禁用浏览器缓存时(这种情况只应该发生在调试阶段)必须将对应模块加入到 include里,否则会遇到开发环境切换页面卡顿的问题(vite 会认为它是一个新的依赖包会重新加载并强制刷新页面),因为它既无法使用浏览器缓存,又没有在本地 node_modules/.vite 里缓存
|
||||||
|
* 温馨提示:如果您使用的第三方库是全局引入,也就是引入到 src/main.ts 文件里,就不需要再添加到 include 里了,因为 vite 会自动将它们缓存到 node_modules/.vite
|
||||||
|
*/
|
||||||
|
const include = [
|
||||||
|
"qs",
|
||||||
|
"mitt",
|
||||||
|
"dayjs",
|
||||||
|
"axios",
|
||||||
|
"pinia",
|
||||||
|
"lodash",
|
||||||
|
"echarts",
|
||||||
|
"xe-utils",
|
||||||
|
"vxe-table",
|
||||||
|
"js-cookie",
|
||||||
|
"lodash-es",
|
||||||
|
"@vueuse/core",
|
||||||
|
"lodash-unified",
|
||||||
|
"@ctrl/tinycolor",
|
||||||
|
"@pureadmin/utils",
|
||||||
|
"responsive-storage",
|
||||||
|
"element-resize-detector"
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 在预构建中强制排除的依赖项
|
||||||
|
* 温馨提示:所有以 `@iconify-icons/` 开头引入的的本地图标模块,都应该加入到下面的 `exclude` 里,因为平台推荐的使用方式是哪里需要哪里引入而且都是单个的引入,不需要预构建,直接让浏览器加载就好
|
||||||
|
*/
|
||||||
|
const exclude = [
|
||||||
|
"@iconify-icons/ep",
|
||||||
|
"@iconify-icons/ri",
|
||||||
|
"@pureadmin/theme/dist/browser-utils"
|
||||||
|
];
|
||||||
|
|
||||||
|
export { include, exclude };
|
||||||
@@ -1,33 +1,30 @@
|
|||||||
import { resolve } from "path";
|
import { cdn } from "./cdn";
|
||||||
import Unocss from "unocss/vite";
|
|
||||||
import vue from "@vitejs/plugin-vue";
|
import vue from "@vitejs/plugin-vue";
|
||||||
import { viteBuildInfo } from "./info";
|
import { viteBuildInfo } from "./info";
|
||||||
import svgLoader from "vite-svg-loader";
|
import svgLoader from "vite-svg-loader";
|
||||||
import legacy from "@vitejs/plugin-legacy";
|
|
||||||
import vueJsx from "@vitejs/plugin-vue-jsx";
|
import vueJsx from "@vitejs/plugin-vue-jsx";
|
||||||
import { viteMockServe } from "vite-plugin-mock";
|
import { viteMockServe } from "vite-plugin-mock";
|
||||||
import VueI18n from "@intlify/vite-plugin-vue-i18n";
|
import { configCompressPlugin } from "./compress";
|
||||||
// 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 "@pureadmin/theme";
|
import themePreprocessorPlugin from "@pureadmin/theme";
|
||||||
import { genScssMultipleScopeVars } from "/@/layout/theme";
|
|
||||||
import DefineOptions from "unplugin-vue-define-options/vite";
|
import DefineOptions from "unplugin-vue-define-options/vite";
|
||||||
|
import { genScssMultipleScopeVars } from "../src/layout/theme";
|
||||||
|
|
||||||
export function getPluginsList(command, VITE_LEGACY) {
|
export function getPluginsList(
|
||||||
|
command: string,
|
||||||
|
VITE_CDN: boolean,
|
||||||
|
VITE_COMPRESSION: ViteCompression
|
||||||
|
) {
|
||||||
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(),
|
||||||
Unocss(),
|
VITE_CDN ? cdn : null,
|
||||||
|
configCompressPlugin(VITE_COMPRESSION),
|
||||||
DefineOptions(),
|
DefineOptions(),
|
||||||
// 线上环境删除console
|
// 线上环境删除console
|
||||||
removeConsole({ external: ["src/assets/iconfont/iconfont.js"] }),
|
removeConsole({ external: ["src/assets/iconfont/iconfont.js"] }),
|
||||||
@@ -60,13 +57,6 @@ export function getPluginsList(command, VITE_LEGACY) {
|
|||||||
`,
|
`,
|
||||||
logger: false
|
logger: false
|
||||||
}),
|
}),
|
||||||
// 是否为打包后的文件提供传统浏览器兼容性支持
|
|
||||||
VITE_LEGACY
|
|
||||||
? legacy({
|
|
||||||
targets: ["ie >= 11"],
|
|
||||||
additionalLegacyPolyfills: ["regenerator-runtime/runtime"]
|
|
||||||
})
|
|
||||||
: null,
|
|
||||||
// 打包分析
|
// 打包分析
|
||||||
lifecycle === "report"
|
lifecycle === "report"
|
||||||
? visualizer({ open: true, brotliSize: true, filename: "report.html" })
|
? visualizer({ open: true, brotliSize: true, filename: "report.html" })
|
||||||
|
|||||||
18
index.html
@@ -36,9 +36,7 @@
|
|||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
width: 2.5em;
|
width: 2.5em;
|
||||||
height: 2.5em;
|
height: 2.5em;
|
||||||
-webkit-animation-fill-mode: both;
|
|
||||||
animation-fill-mode: both;
|
animation-fill-mode: both;
|
||||||
-webkit-animation: loadAnimation 1.8s infinite ease-in-out;
|
|
||||||
animation: loadAnimation 1.8s infinite ease-in-out;
|
animation: loadAnimation 1.8s infinite ease-in-out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,10 +46,7 @@
|
|||||||
margin: 80px auto;
|
margin: 80px auto;
|
||||||
position: relative;
|
position: relative;
|
||||||
text-indent: -9999em;
|
text-indent: -9999em;
|
||||||
-webkit-transform: translateZ(0);
|
|
||||||
-ms-transform: translateZ(0);
|
|
||||||
transform: translateZ(0);
|
transform: translateZ(0);
|
||||||
-webkit-animation-delay: -0.16s;
|
|
||||||
animation-delay: -0.16s;
|
animation-delay: -0.16s;
|
||||||
top: 0;
|
top: 0;
|
||||||
transform: translate(-50%, 0);
|
transform: translate(-50%, 0);
|
||||||
@@ -66,7 +61,6 @@
|
|||||||
|
|
||||||
.loader:before {
|
.loader:before {
|
||||||
left: -3.5em;
|
left: -3.5em;
|
||||||
-webkit-animation-delay: -0.32s;
|
|
||||||
animation-delay: -0.32s;
|
animation-delay: -0.32s;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,18 +68,6 @@
|
|||||||
left: 3.5em;
|
left: 3.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
@-webkit-keyframes loadAnimation {
|
|
||||||
0%,
|
|
||||||
80%,
|
|
||||||
100% {
|
|
||||||
box-shadow: 0 2.5em 0 -1.3em;
|
|
||||||
}
|
|
||||||
|
|
||||||
40% {
|
|
||||||
box-shadow: 0 2.5em 0 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes loadAnimation {
|
@keyframes loadAnimation {
|
||||||
0%,
|
0%,
|
||||||
80%,
|
80%,
|
||||||
|
|||||||
@@ -1,72 +0,0 @@
|
|||||||
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...
|
|
||||||
login:
|
|
||||||
username: Username
|
|
||||||
password: Password
|
|
||||||
verifyCode: VerifyCode
|
|
||||||
remember: Remember Password
|
|
||||||
sure: Sure Password
|
|
||||||
forget: Forget Password?
|
|
||||||
login: Login
|
|
||||||
thirdLogin: Third Login
|
|
||||||
phoneLogin: Phone Login
|
|
||||||
qRCodeLogin: QRCode Login
|
|
||||||
register: Register
|
|
||||||
weChatLogin: WeChat Login
|
|
||||||
alipayLogin: Alipay Login
|
|
||||||
qqLogin: QQ Login
|
|
||||||
weiboLogin: Weibo Login
|
|
||||||
phone: Phone
|
|
||||||
smsVerifyCode: SMS VerifyCode
|
|
||||||
back: Back
|
|
||||||
test: Mock Test
|
|
||||||
tip: After scanning the code, click "Confirm" to complete the login
|
|
||||||
definite: Definite
|
|
||||||
loginSuccess: Login Success
|
|
||||||
registerSuccess: Regist Success
|
|
||||||
tickPrivacy: Please tick Privacy Policy
|
|
||||||
readAccept: I have read it carefully and accept
|
|
||||||
privacyPolicy: Privacy Policy
|
|
||||||
getVerifyCode: Get VerifyCode
|
|
||||||
info: Seconds
|
|
||||||
usernameReg: Please enter username
|
|
||||||
passwordReg: Please enter password
|
|
||||||
verifyCodeReg: Please enter verify code
|
|
||||||
verifyCodeCorrectReg: Please enter correct verify code
|
|
||||||
verifyCodeSixReg: Please enter a 6-digit verify code
|
|
||||||
phoneReg: Please enter the phone
|
|
||||||
phoneCorrectReg: Please enter the correct phone number format
|
|
||||||
passwordRuleReg: The password format should be any combination of 8-18 digits
|
|
||||||
passwordSureReg: Please enter confirm password
|
|
||||||
passwordDifferentReg: The two passwords do not match!
|
|
||||||
passwordUpdateReg: Password has been updated
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
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: 加载中...
|
|
||||||
login:
|
|
||||||
username: 账号
|
|
||||||
password: 密码
|
|
||||||
verifyCode: 验证码
|
|
||||||
remember: 记住密码
|
|
||||||
sure: 确认密码
|
|
||||||
forget: 忘记密码?
|
|
||||||
login: 登录
|
|
||||||
thirdLogin: 第三方登录
|
|
||||||
phoneLogin: 手机登录
|
|
||||||
qRCodeLogin: 二维码登录
|
|
||||||
register: 注册
|
|
||||||
weChatLogin: 微信登录
|
|
||||||
alipayLogin: 支付宝登录
|
|
||||||
qqLogin: QQ登录
|
|
||||||
weiboLogin: 微博登录
|
|
||||||
phone: 手机号码
|
|
||||||
smsVerifyCode: 短信验证码
|
|
||||||
back: 返回
|
|
||||||
test: 模拟测试
|
|
||||||
tip: 扫码后点击"确认",即可完成登录
|
|
||||||
definite: 确定
|
|
||||||
loginSuccess: 登录成功
|
|
||||||
registerSuccess: 注册成功
|
|
||||||
tickPrivacy: 请勾选隐私政策
|
|
||||||
readAccept: 我已仔细阅读并接受
|
|
||||||
privacyPolicy: 《隐私政策》
|
|
||||||
getVerifyCode: 获取验证码
|
|
||||||
info: 秒后重新获取
|
|
||||||
usernameReg: 请输入账号
|
|
||||||
passwordReg: 请输入密码
|
|
||||||
verifyCodeReg: 请输入验证码
|
|
||||||
verifyCodeCorrectReg: 请输入正确的验证码
|
|
||||||
verifyCodeSixReg: 请输入6位数字验证码
|
|
||||||
phoneReg: 请输入手机号码
|
|
||||||
phoneCorrectReg: 请输入正确的手机号码格式
|
|
||||||
passwordRuleReg: 密码格式应为8-18位数字、字母、符号的任意两种组合
|
|
||||||
passwordSureReg: 请输入确认密码
|
|
||||||
passwordDifferentReg: 两次密码不一致!
|
|
||||||
passwordUpdateReg: 修改密码成功
|
|
||||||
@@ -1,54 +1,51 @@
|
|||||||
// 根据角色动态生成路由
|
// 模拟后端动态生成路由
|
||||||
import { MockMethod } from "vite-plugin-mock";
|
import { MockMethod } from "vite-plugin-mock";
|
||||||
|
|
||||||
|
import Lollipop from "@iconify-icons/ep/lollipop";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* roles:页面级别权限,这里模拟二种 "admin"、"common"
|
||||||
|
* admin:管理员角色
|
||||||
|
* common:普通角色
|
||||||
|
*/
|
||||||
|
|
||||||
const permissionRouter = {
|
const permissionRouter = {
|
||||||
path: "/permission",
|
path: "/permission",
|
||||||
meta: {
|
meta: {
|
||||||
title: "menus.permission",
|
title: "权限管理",
|
||||||
icon: "lollipop",
|
icon: Lollipop,
|
||||||
rank: 7
|
rank: 10
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: "/permission/page/index",
|
path: "/permission/page/index",
|
||||||
name: "PermissionPage",
|
name: "PermissionPage",
|
||||||
meta: {
|
meta: {
|
||||||
title: "menus.permissionPage"
|
title: "页面权限",
|
||||||
|
roles: ["admin", "common"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/permission/button/index",
|
path: "/permission/button/index",
|
||||||
name: "PermissionButton",
|
name: "PermissionButton",
|
||||||
meta: {
|
meta: {
|
||||||
title: "menus.permissionButton",
|
title: "按钮权限",
|
||||||
authority: []
|
roles: ["admin", "common"],
|
||||||
|
auths: ["btn_add", "btn_edit", "btn_delete"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
// 添加不同按钮权限到/permission/button页面中
|
|
||||||
function setDifAuthority(authority, routes) {
|
|
||||||
routes.children[1].meta.authority = [authority];
|
|
||||||
return routes;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
url: "/getAsyncRoutes",
|
url: "/getAsyncRoutes",
|
||||||
method: "get",
|
method: "get",
|
||||||
response: ({ query }) => {
|
response: () => {
|
||||||
if (query.name === "admin") {
|
return {
|
||||||
return {
|
success: true,
|
||||||
code: 0,
|
data: [permissionRouter]
|
||||||
info: [setDifAuthority("v-admin", permissionRouter)]
|
};
|
||||||
};
|
|
||||||
} else {
|
|
||||||
return {
|
|
||||||
code: 0,
|
|
||||||
info: [setDifAuthority("v-test", permissionRouter)]
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
] as MockMethod[];
|
] as MockMethod[];
|
||||||
|
|||||||
36
mock/login.ts
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
// 根据角色动态生成路由
|
||||||
|
import { MockMethod } from "vite-plugin-mock";
|
||||||
|
|
||||||
|
export default [
|
||||||
|
{
|
||||||
|
url: "/login",
|
||||||
|
method: "post",
|
||||||
|
response: ({ body }) => {
|
||||||
|
if (body.username === "admin") {
|
||||||
|
return {
|
||||||
|
success: true,
|
||||||
|
data: {
|
||||||
|
username: "admin",
|
||||||
|
// 一个用户可能有多个角色
|
||||||
|
roles: ["admin"],
|
||||||
|
accessToken: "eyJhbGciOiJIUzUxMiJ9.admin",
|
||||||
|
refreshToken: "eyJhbGciOiJIUzUxMiJ9.adminRefresh",
|
||||||
|
expires: "2023/10/30 00:00:00"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
success: true,
|
||||||
|
data: {
|
||||||
|
username: "common",
|
||||||
|
// 一个用户可能有多个角色
|
||||||
|
roles: ["common"],
|
||||||
|
accessToken: "eyJhbGciOiJIUzUxMiJ9.common",
|
||||||
|
refreshToken: "eyJhbGciOiJIUzUxMiJ9.commonRefresh",
|
||||||
|
expires: "2023/10/30 00:00:00"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
] as MockMethod[];
|
||||||
27
mock/refreshToken.ts
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
import { MockMethod } from "vite-plugin-mock";
|
||||||
|
|
||||||
|
// 模拟刷新token接口
|
||||||
|
export default [
|
||||||
|
{
|
||||||
|
url: "/refreshToken",
|
||||||
|
method: "post",
|
||||||
|
response: ({ body }) => {
|
||||||
|
if (body.refreshToken) {
|
||||||
|
return {
|
||||||
|
success: true,
|
||||||
|
data: {
|
||||||
|
accessToken: "eyJhbGciOiJIUzUxMiJ9.newAdmin",
|
||||||
|
refreshToken: "eyJhbGciOiJIUzUxMiJ9.newAdminRefresh",
|
||||||
|
// `expires`选择这种日期格式是为了方便调试,后端直接设置时间戳或许更方便(每次都应该递增)。如果后端返回的是时间戳格式,前端开发请来到这个目录`src/utils/auth.ts`,把第`38`行的代码换成expires = data.expires即可。
|
||||||
|
expires: "2023/10/30 23:59:59"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
success: false,
|
||||||
|
data: {}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
] as MockMethod[];
|
||||||
116
package.json
@@ -1,20 +1,21 @@
|
|||||||
{
|
{
|
||||||
"name": "pure-admin-thin",
|
"name": "pure-admin-thin",
|
||||||
"version": "3.4.5",
|
"version": "3.9.2",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "cross-env --max_old_space_size=4096 vite",
|
"dev": "NODE_OPTIONS=--max-old-space-size=4096 vite",
|
||||||
"serve": "pnpm dev",
|
"serve": "pnpm dev",
|
||||||
"build": "rimraf dist && cross-env NODE_OPTIONS=--max-old-space-size=8192 vite build",
|
"build": "rimraf dist && NODE_OPTIONS=--max-old-space-size=8192 vite build",
|
||||||
"build:staging": "rimraf dist && cross-env vite build --mode staging",
|
"build:staging": "rimraf dist && vite build --mode staging",
|
||||||
"report": "rimraf dist && cross-env vite build",
|
"report": "rimraf dist && vite build",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"preview:build": "pnpm build && vite preview",
|
"preview:build": "pnpm build && vite preview",
|
||||||
"typecheck": "tsc --noEmit && vue-tsc --noEmit --skipLibCheck",
|
"typecheck": "tsc --noEmit && vue-tsc --noEmit --skipLibCheck",
|
||||||
"cloc": "cross-env --max_old_space_size=4096 cloc . --exclude-dir=node_modules --exclude-lang=YAML",
|
"svgo": "svgo -f src/assets/svg -o src/assets/svg",
|
||||||
|
"cloc": "NODE_OPTIONS=--max-old-space-size=4096 cloc . --exclude-dir=node_modules --exclude-lang=YAML",
|
||||||
"clean:cache": "rm -rf node_modules && rm -rf .eslintcache && pnpm install",
|
"clean:cache": "rm -rf node_modules && rm -rf .eslintcache && pnpm install",
|
||||||
"lint:eslint": "eslint --cache --max-warnings 0 \"{src,mock}/**/*.{vue,ts,tsx}\" --fix",
|
"lint:eslint": "eslint --cache --max-warnings 0 \"{src,mock,build}/**/*.{vue,js,ts,tsx}\" --fix",
|
||||||
"lint:prettier": "prettier --write \"src/**/*.{js,json,tsx,css,less,scss,vue,html,md}\"",
|
"lint:prettier": "prettier --write \"src/**/*.{js,ts,json,tsx,css,less,scss,vue,html,md}\"",
|
||||||
"lint:stylelint": "stylelint --cache --fix \"**/*.{vue,css,scss,postcss,less}\" --cache --cache-location node_modules/.cache/stylelint/",
|
"lint:stylelint": "stylelint --cache --fix \"**/*.{vue,css,scss,postcss,less}\" --cache --cache-location node_modules/.cache/stylelint/",
|
||||||
"lint:lint-staged": "lint-staged -c ./.husky/lintstagedrc.js",
|
"lint:lint-staged": "lint-staged -c ./.husky/lintstagedrc.js",
|
||||||
"lint:pretty": "pretty-quick --staged",
|
"lint:pretty": "pretty-quick --staged",
|
||||||
@@ -29,20 +30,17 @@
|
|||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ctrl/tinycolor": "^3.4.1",
|
"@ctrl/tinycolor": "^3.4.1",
|
||||||
"@pureadmin/components": "^1.1.0",
|
|
||||||
"@pureadmin/descriptions": "^1.1.0",
|
"@pureadmin/descriptions": "^1.1.0",
|
||||||
"@pureadmin/table": "^1.2.0",
|
"@pureadmin/table": "^1.8.2",
|
||||||
"@pureadmin/utils": "^0.1.1",
|
"@pureadmin/utils": "^1.7.2",
|
||||||
"@vueuse/core": "^9.1.0",
|
"@vueuse/core": "^9.6.0",
|
||||||
"@vueuse/motion": "^2.0.0-beta.12",
|
"@vueuse/motion": "2.0.0-beta.12",
|
||||||
"@vueuse/shared": "^9.1.0",
|
|
||||||
"animate.css": "^4.1.1",
|
"animate.css": "^4.1.1",
|
||||||
"axios": "^0.27.2",
|
"axios": "^1.2.0",
|
||||||
"css-color-function": "^1.3.3",
|
"dayjs": "^1.11.6",
|
||||||
"dayjs": "^1.11.4",
|
"echarts": "^5.4.0",
|
||||||
"echarts": "^5.3.3",
|
"element-plus": "^2.2.26",
|
||||||
"element-plus": "^2.2.14",
|
"element-resize-detector": "^1.2.4",
|
||||||
"element-resize-detector": "^1.2.3",
|
|
||||||
"js-cookie": "^3.0.1",
|
"js-cookie": "^3.0.1",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"lodash-es": "^4.17.21",
|
"lodash-es": "^4.17.21",
|
||||||
@@ -51,85 +49,81 @@
|
|||||||
"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.19",
|
"pinia": "^2.0.27",
|
||||||
"qrcode": "^1.5.1",
|
|
||||||
"qs": "^6.11.0",
|
"qs": "^6.11.0",
|
||||||
"resize-observer-polyfill": "^1.5.1",
|
|
||||||
"responsive-storage": "^2.1.0",
|
"responsive-storage": "^2.1.0",
|
||||||
"rgb-hex": "^4.0.0",
|
"vue": "^3.2.45",
|
||||||
"vue": "^3.2.37",
|
"vue-router": "^4.1.6",
|
||||||
"vue-i18n": "^9.2.2",
|
|
||||||
"vue-router": "^4.1.3",
|
|
||||||
"vue-types": "^4.2.1",
|
"vue-types": "^4.2.1",
|
||||||
"vxe-table": "^4.3.0-beta.5",
|
"vxe-table": "^4.3.6",
|
||||||
"xe-utils": "^3.5.6"
|
"xe-utils": "^3.5.7"
|
||||||
},
|
},
|
||||||
"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.2.7",
|
"@iconify-icons/ep": "^1.2.7",
|
||||||
"@iconify-icons/ri": "^1.2.3",
|
"@iconify-icons/ri": "^1.2.3",
|
||||||
"@iconify/vue": "^3.2.1",
|
"@iconify/vue": "^4.0.0",
|
||||||
"@intlify/vite-plugin-vue-i18n": "^6.0.1",
|
|
||||||
"@pureadmin/theme": "^2.4.0",
|
"@pureadmin/theme": "^2.4.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": "^4.14.180",
|
||||||
"@types/lodash-es": "^4.17.6",
|
"@types/lodash-es": "^4.17.6",
|
||||||
"@types/mockjs": "1.0.3",
|
"@types/mockjs": "^1.0.7",
|
||||||
"@types/node": "14.14.14",
|
"@types/node": "^18.11.9",
|
||||||
"@types/nprogress": "0.2.0",
|
"@types/nprogress": "0.2.0",
|
||||||
"@types/qrcode": "^1.5.0",
|
|
||||||
"@types/qs": "^6.9.7",
|
"@types/qs": "^6.9.7",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.10.2",
|
"@typescript-eslint/eslint-plugin": "^5.42.1",
|
||||||
"@typescript-eslint/parser": "^5.10.2",
|
"@typescript-eslint/parser": "^5.42.1",
|
||||||
"@vitejs/plugin-legacy": "^2.0.0",
|
"@vitejs/plugin-legacy": "^2.3.1",
|
||||||
"@vitejs/plugin-vue": "^3.0.1",
|
"@vitejs/plugin-vue": "^3.2.0",
|
||||||
"@vitejs/plugin-vue-jsx": "^2.0.0",
|
"@vitejs/plugin-vue-jsx": "^2.1.1",
|
||||||
"@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": "^11.0.2",
|
||||||
"@vue/runtime-core": "^3.2.37",
|
"autoprefixer": "^10.4.13",
|
||||||
"autoprefixer": "^10.4.8",
|
|
||||||
"cloc": "^2.10.0",
|
"cloc": "^2.10.0",
|
||||||
"cross-env": "7.0.3",
|
"cssnano": "^5.1.14",
|
||||||
"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": "^9.7.0",
|
||||||
"font-awesome": "^4.7.0",
|
"font-awesome": "^4.7.0",
|
||||||
"husky": "^7.0.4",
|
"husky": "^7.0.4",
|
||||||
"lint-staged": "11.1.2",
|
"lint-staged": "11.1.2",
|
||||||
"picocolors": "^1.0.0",
|
"picocolors": "^1.0.0",
|
||||||
"postcss": "^8.4.16",
|
"postcss": "^8.4.18",
|
||||||
"postcss-html": "^1.5.0",
|
"postcss-html": "^1.5.0",
|
||||||
"postcss-import": "^14.1.0",
|
"postcss-import": "^15.0.0",
|
||||||
"postcss-scss": "^4.0.4",
|
"postcss-scss": "^4.0.5",
|
||||||
"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.7.1",
|
"rollup-plugin-visualizer": "^5.8.3",
|
||||||
"sass": "^1.53.0",
|
"sass": "^1.56.1",
|
||||||
"sass-loader": "^13.0.2",
|
"sass-loader": "^13.2.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": "^9.0.0",
|
||||||
"stylelint-config-standard": "^24.0.0",
|
"stylelint-config-standard": "^29.0.0",
|
||||||
"stylelint-order": "^5.0.0",
|
"stylelint-order": "^5.0.0",
|
||||||
"typescript": "^4.7.4",
|
"svgo": "^3.0.2",
|
||||||
"unocss": "^0.45.9",
|
"tailwindcss": "^3.2.4",
|
||||||
"unplugin-vue-define-options": "^0.7.3",
|
"terser": "^5.15.1",
|
||||||
"vite": "^3.0.9",
|
"typescript": "^4.9.3",
|
||||||
|
"unplugin-vue-define-options": "^1.0.0",
|
||||||
|
"vite": "3.1.8",
|
||||||
|
"vite-plugin-cdn-import": "^0.3.5",
|
||||||
|
"vite-plugin-compression": "^0.5.1",
|
||||||
"vite-plugin-mock": "^2.9.6",
|
"vite-plugin-mock": "^2.9.6",
|
||||||
"vite-plugin-remove-console": "^1.1.0",
|
"vite-plugin-remove-console": "^1.3.0",
|
||||||
"vite-svg-loader": "^3.4.0",
|
"vite-svg-loader": "^3.6.0",
|
||||||
"vue-eslint-parser": "^8.2.0",
|
"vue-eslint-parser": "^9.1.0",
|
||||||
"vue-tsc": "^0.40.1"
|
"vue-tsc": "^1.0.9"
|
||||||
},
|
},
|
||||||
"pnpm": {
|
"pnpm": {
|
||||||
"peerDependencyRules": {
|
"peerDependencyRules": {
|
||||||
"ignoreMissing": [
|
"ignoreMissing": [
|
||||||
"rollup",
|
"rollup",
|
||||||
"terser",
|
|
||||||
"webpack"
|
"webpack"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
7429
pnpm-lock.yaml
generated
@@ -1,3 +1,8 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
plugins: [require("autoprefixer"), require("postcss-import")]
|
plugins: {
|
||||||
|
"postcss-import": {},
|
||||||
|
tailwindcss: {},
|
||||||
|
autoprefixer: {},
|
||||||
|
...(process.env.NODE_ENV === "production" ? { cssnano: {} } : {})
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
{
|
{
|
||||||
"Version": "3.4.5",
|
"Version": "3.9.2",
|
||||||
"Title": "PureAdmin",
|
"Title": "PureAdmin",
|
||||||
"FixedHeader": true,
|
"FixedHeader": true,
|
||||||
"HiddenSideBar": false,
|
"HiddenSideBar": false,
|
||||||
"MultiTagsCache": false,
|
"MultiTagsCache": false,
|
||||||
"KeepAlive": true,
|
"KeepAlive": true,
|
||||||
"Locale": "zh",
|
|
||||||
"Layout": "vertical",
|
"Layout": "vertical",
|
||||||
"Theme": "default",
|
"Theme": "default",
|
||||||
"DarkMode": false,
|
"DarkMode": false,
|
||||||
@@ -15,5 +14,8 @@
|
|||||||
"SidebarStatus": true,
|
"SidebarStatus": true,
|
||||||
"EpThemeColor": "#409EFF",
|
"EpThemeColor": "#409EFF",
|
||||||
"ShowLogo": true,
|
"ShowLogo": true,
|
||||||
"ShowModel": "smart"
|
"ShowModel": "smart",
|
||||||
|
"MenuArrowIconNoTransition": true,
|
||||||
|
"CachingAsyncRoutes": true,
|
||||||
|
"TooltipEffect": "light"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
import { defineComponent } from "vue";
|
import { defineComponent } from "vue";
|
||||||
import { ElConfigProvider } from "element-plus";
|
import { ElConfigProvider } from "element-plus";
|
||||||
import zhCn from "element-plus/lib/locale/lang/zh-cn";
|
import zhCn from "element-plus/lib/locale/lang/zh-cn";
|
||||||
import en from "element-plus/lib/locale/lang/en";
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "app",
|
name: "app",
|
||||||
components: {
|
components: {
|
||||||
@@ -16,7 +15,7 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
currentLocale() {
|
currentLocale() {
|
||||||
return this.$storage.locale?.locale === "zh" ? zhCn : en;
|
return zhCn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { http } from "../utils/http";
|
import { http } from "@/utils/http";
|
||||||
|
|
||||||
type Result = {
|
type Result = {
|
||||||
code: number;
|
success: boolean;
|
||||||
info: Array<any>;
|
data: Array<any>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getAsyncRoutes = (params?: object) => {
|
export const getAsyncRoutes = () => {
|
||||||
return http.request<Result>("get", "/getAsyncRoutes", { params });
|
return http.request<Result>("get", "/getAsyncRoutes");
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,26 +1,39 @@
|
|||||||
import { http } from "../utils/http";
|
import { http } from "@/utils/http";
|
||||||
|
|
||||||
type Result = {
|
export type UserResult = {
|
||||||
svg?: string;
|
success: boolean;
|
||||||
code?: number;
|
data: {
|
||||||
info?: object;
|
/** 用户名 */
|
||||||
|
username: string;
|
||||||
|
/** 当前登陆用户的角色 */
|
||||||
|
roles: Array<string>;
|
||||||
|
/** `token` */
|
||||||
|
accessToken: string;
|
||||||
|
/** 用于调用刷新`accessToken`的接口时所需的`token` */
|
||||||
|
refreshToken: string;
|
||||||
|
/** `accessToken`的过期时间(格式'xxxx/xx/xx xx:xx:xx') */
|
||||||
|
expires: Date;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// 获取验证码
|
export type RefreshTokenResult = {
|
||||||
export const getVerify = () => {
|
success: boolean;
|
||||||
return http.request<Result>("get", "/captcha");
|
data: {
|
||||||
|
/** `token` */
|
||||||
|
accessToken: string;
|
||||||
|
/** 用于调用刷新`accessToken`的接口时所需的`token` */
|
||||||
|
refreshToken: string;
|
||||||
|
/** `accessToken`的过期时间(格式'xxxx/xx/xx xx:xx:xx') */
|
||||||
|
expires: Date;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// 登录
|
/** 登录 */
|
||||||
export const getLogin = (data: object) => {
|
export const getLogin = (data?: object) => {
|
||||||
return http.request("post", "/login", { data });
|
return http.request<UserResult>("post", "/login", { data });
|
||||||
};
|
};
|
||||||
|
|
||||||
// 刷新token
|
/** 刷新token */
|
||||||
export const refreshToken = (data: object) => {
|
export const refreshTokenApi = (data?: object) => {
|
||||||
return http.request("post", "/refreshToken", { data });
|
return http.request<RefreshTokenResult>("post", "/refreshToken", { data });
|
||||||
};
|
};
|
||||||
|
|
||||||
// export const searchVague = (data: object) => {
|
|
||||||
// return http.request("post", "/searchVague", { data });
|
|
||||||
// };
|
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 23 KiB |
@@ -1 +1 @@
|
|||||||
<svg t="1636193306629" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1847" width="32" height="32"><path d="M410.558481 0.10861C410.558481 211.083075 109.682285 361.860579 109.682285 633.656511c0 174.943176 134.703259 316.787527 300.876196 316.787527s300.876197-141.817198 300.876197-316.787527C711.407525 361.751969 410.558481 210.974465 410.558481 0.10861z" fill="#386BF3" p-id="1848"></path><path d="M613.468671 73.664572c0 211.055922-300.876197 361.914883-300.876196 633.547901 0 174.943176 134.703259 316.787527 300.876196 316.787527s300.876197-141.817198 300.876197-316.787527c-0.054305-271.633018-300.876197-422.491979-300.876197-633.547901z" fill="#C3D2FB" p-id="1849"></path><path d="M312.592475 707.212473c0-183.713414 137.635722-312.171612 226.72288-441.390078 81.701694 106.111739 172.119322 218.740063 172.119323 367.725506a309.755045 309.755045 0 0 1-291.074166 316.516003 323.114046 323.114046 0 0 1-107.768037-242.851431z" fill="#303F5B" p-id="1850"></path></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" class="icon" viewBox="0 0 1024 1024"><path fill="#386BF3" d="M410.558.109c0 210.974-300.876 361.752-300.876 633.548 0 174.943 134.704 316.787 300.876 316.787s300.877-141.817 300.877-316.787C711.408 361.752 410.558 210.974 410.558.109z"/><path fill="#C3D2FB" d="M613.469 73.665c0 211.055-300.877 361.914-300.877 633.547C312.592 882.156 447.296 1024 613.47 1024s300.876-141.817 300.876-316.788C914.29 435.58 613.469 284.72 613.469 73.665z"/><path fill="#303F5B" d="M312.592 707.212c0-183.713 137.636-312.171 226.723-441.39 81.702 106.112 172.12 218.74 172.12 367.726A309.755 309.755 0 0 1 420.36 950.064a323.114 323.114 0 0 1-107.769-242.852z"/></svg>
|
||||||
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 712 B |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 13 KiB |
@@ -1 +1 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="none" d="M0 0h24v24H0z"/><path d="M2.88 18.054a35.897 35.897 0 0 1 8.531-16.32.8.8 0 0 1 1.178 0c.166.18.304.332.413.455a35.897 35.897 0 0 1 8.118 15.865c-2.141.451-4.34.747-6.584.874l-2.089 4.178a.5.5 0 0 1-.894 0l-2.089-4.178a44.019 44.019 0 0 1-6.584-.874zm6.698-1.123l1.157.066L12 19.527l1.265-2.53 1.157-.066a42.137 42.137 0 0 0 4.227-.454A33.913 33.913 0 0 0 12 4.09a33.913 33.913 0 0 0-6.649 12.387c1.395.222 2.805.374 4.227.454zM12 15a3 3 0 1 1 0-6 3 3 0 0 1 0 6zm0-2a1 1 0 1 0 0-2 1 1 0 0 0 0 2z"/></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path fill="none" d="M0 0h24v24H0z"/><path d="M2.88 18.054a35.897 35.897 0 0 1 8.531-16.32.8.8 0 0 1 1.178 0c.166.18.304.332.413.455a35.897 35.897 0 0 1 8.118 15.865c-2.141.451-4.34.747-6.584.874l-2.089 4.178a.5.5 0 0 1-.894 0l-2.089-4.178a44.019 44.019 0 0 1-6.584-.874zm6.698-1.123 1.157.066L12 19.527l1.265-2.53 1.157-.066a42.137 42.137 0 0 0 4.227-.454A33.913 33.913 0 0 0 12 4.09a33.913 33.913 0 0 0-6.649 12.387c1.395.222 2.805.374 4.227.454zM12 15a3 3 0 1 1 0-6 3 3 0 0 1 0 6zm0-2a1 1 0 1 0 0-2 1 1 0 0 0 0 2z"/></svg>
|
||||||
|
Before Width: | Height: | Size: 608 B After Width: | Height: | Size: 588 B |
@@ -1 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 36 36"><path d="M19.41 18l8.29-8.29a1 1 0 0 0-1.41-1.41L18 16.59l-8.29-8.3a1 1 0 0 0-1.42 1.42l8.3 8.29l-8.3 8.29A1 1 0 1 0 9.7 27.7l8.3-8.29l8.29 8.29a1 1 0 0 0 1.41-1.41z" fill="currentColor"></path></svg>
|
|
||||||
|
Before Width: | Height: | Size: 395 B |
@@ -1 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 36 36"><path d="M26 17H10a1 1 0 0 0 0 2h16a1 1 0 0 0 0-2z" fill="currentColor"></path></svg>
|
|
||||||
|
Before Width: | Height: | Size: 279 B |
@@ -1 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><g fill="none"><path d="M7 12l7 7" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path><path d="M7 12l7-7" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path><path d="M21 12H7.5" stroke="currentColor" stroke-width="2" stroke-linecap="round" ></path><path d="M3 3v18" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path></g></svg>
|
|
||||||
|
Before Width: | Height: | Size: 647 B |
@@ -1 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 20 20"><path d="M3 5h14V3H3v2zm12 8V7H5v6h10zM3 17h14v-2H3v2z" fill="currentColor"></path></svg>
|
|
||||||
|
Before Width: | Height: | Size: 284 B |
@@ -1 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><g transform="translate(24 0) scale(-1 1)"><g fill="none"><path d="M7 12l7 7" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path><path d="M7 12l7-7" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path><path d="M21 12H7.5" stroke="currentColor" stroke-width="2" stroke-linecap="round"></path><path d="M3 3v18" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path></g></g></svg>
|
|
||||||
|
Before Width: | Height: | Size: 693 B |
@@ -1 +1 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16"><path fill="none" d="M0 0h24v24H0z"/><path d="M11.38 2.019a7.5 7.5 0 1 0 10.6 10.6C21.662 17.854 17.316 22 12.001 22 6.477 22 2 17.523 2 12c0-5.315 4.146-9.661 9.38-9.981z"/></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M11.38 2.019a7.5 7.5 0 1 0 10.6 10.6C21.662 17.854 17.316 22 12.001 22 6.477 22 2 17.523 2 12c0-5.315 4.146-9.661 9.38-9.981z"/></svg>
|
||||||
|
Before Width: | Height: | Size: 263 B After Width: | Height: | Size: 263 B |
@@ -1 +1 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16"><path fill="none" d="M0 0h24v24H0z"/><path d="M12 18a6 6 0 1 1 0-12 6 6 0 0 1 0 12zM11 1h2v3h-2V1zm0 19h2v3h-2v-3zM3.515 4.929l1.414-1.414L7.05 5.636 5.636 7.05 3.515 4.93zM16.95 18.364l1.414-1.414 2.121 2.121-1.414 1.414-2.121-2.121zm2.121-14.85l1.414 1.415-2.121 2.121-1.414-1.414 2.121-2.121zM5.636 16.95l1.414 1.414-2.121 2.121-1.414-1.414 2.121-2.121zM23 11v2h-3v-2h3zM4 11v2H1v-2h3z"/></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M12 18a6 6 0 1 1 0-12 6 6 0 0 1 0 12zM11 1h2v3h-2V1zm0 19h2v3h-2v-3zM3.515 4.929l1.414-1.414L7.05 5.636 5.636 7.05 3.515 4.93zM16.95 18.364l1.414-1.414 2.121 2.121-1.414 1.414-2.121-2.121zm2.121-14.85 1.414 1.415-2.121 2.121-1.414-1.414 2.121-2.121zM5.636 16.95l1.414 1.414-2.121 2.121-1.414-1.414 2.121-2.121zM23 11v2h-3v-2h3zM4 11v2H1v-2h3z"/></svg>
|
||||||
|
Before Width: | Height: | Size: 480 B After Width: | Height: | Size: 480 B |
@@ -1 +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>
|
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" aria-hidden="true" class="iconify iconify--ant-design" 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"/></svg>
|
||||||
|
Before Width: | Height: | Size: 448 B After Width: | Height: | Size: 352 B |
@@ -1 +1 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" class="re-screen" color="#00000073" preserveAspectRatio="xMidYMid meet" viewBox="0 0 16 16"><g fill="currentColor"><path d="M3.5 4H1V3h2V1h1v2.5l-.5.5zM13 3V1h-1v2.5l.5.5H15V3h-2zm-1 9.5V15h1v-2h2v-1h-2.5l-.5.5zM1 12v1h2v2h1v-2.5l-.5-.5H1zm11-1.5l-.5.5h-7l-.5-.5v-5l.5-.5h7l.5.5v5zM10 7H6v2h4V7z"></path></g></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" aria-hidden="true" class="re-screen" color="#00000073" viewBox="0 0 16 16"><path fill="currentColor" d="M3.5 4H1V3h2V1h1v2.5l-.5.5zM13 3V1h-1v2.5l.5.5H15V3h-2zm-1 9.5V15h1v-2h2v-1h-2.5l-.5.5zM1 12v1h2v2h1v-2.5l-.5-.5H1zm11-1.5-.5.5h-7l-.5-.5v-5l.5-.5h7l.5.5v5zM10 7H6v2h4V7z"/></svg>
|
||||||
|
Before Width: | Height: | Size: 452 B After Width: | Height: | Size: 348 B |
@@ -1 +1 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" class="re-screen" color="#00000073" preserveAspectRatio="xMidYMid meet" viewBox="0 0 16 16"><g fill="currentColor"><path d="M3 12h10V4H3v8zm2-6h6v4H5V6zM2 6H1V2.5l.5-.5H5v1H2v3zm13-3.5V6h-1V3h-3V2h3.5l.5.5zM14 10h1v3.5l-.5.5H11v-1h3v-3zM2 13h3v1H1.5l-.5-.5V10h1v3z"></path></g></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" aria-hidden="true" class="re-screen" color="#00000073" viewBox="0 0 16 16"><path fill="currentColor" d="M3 12h10V4H3v8zm2-6h6v4H5V6zM2 6H1V2.5l.5-.5H5v1H2v3zm13-3.5V6h-1V3h-3V2h3.5l.5.5zM14 10h1v3.5l-.5.5H11v-1h3v-3zM2 13h3v1H1.5l-.5-.5V10h1v3z"/></svg>
|
||||||
|
Before Width: | Height: | Size: 421 B After Width: | Height: | Size: 318 B |
@@ -1 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="globalization" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 512 512"><path d="M478.33 433.6l-90-218a22 22 0 0 0-40.67 0l-90 218a22 22 0 1 0 40.67 16.79L316.66 406h102.67l18.33 44.39A22 22 0 0 0 458 464a22 22 0 0 0 20.32-30.4zM334.83 362L368 281.65L401.17 362z" fill="currentColor"></path><path d="M267.84 342.92a22 22 0 0 0-4.89-30.7c-.2-.15-15-11.13-36.49-34.73c39.65-53.68 62.11-114.75 71.27-143.49H330a22 22 0 0 0 0-44H214V70a22 22 0 0 0-44 0v20H54a22 22 0 0 0 0 44h197.25c-9.52 26.95-27.05 69.5-53.79 108.36c-31.41-41.68-43.08-68.65-43.17-68.87a22 22 0 0 0-40.58 17c.58 1.38 14.55 34.23 52.86 83.93c.92 1.19 1.83 2.35 2.74 3.51c-39.24 44.35-77.74 71.86-93.85 80.74a22 22 0 1 0 21.07 38.63c2.16-1.18 48.6-26.89 101.63-85.59c22.52 24.08 38 35.44 38.93 36.1a22 22 0 0 0 30.75-4.9z" fill="currentColor"></path></svg>
|
|
||||||
|
Before Width: | Height: | Size: 965 B |
1
src/assets/svg/keyboard_esc.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" aria-hidden="true" class="iconify iconify--mdi" 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"/></svg>
|
||||||
|
After Width: | Height: | Size: 381 B |
@@ -1 +0,0 @@
|
|||||||
<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>
|
|
||||||
|
Before Width: | Height: | Size: 477 B |
@@ -1 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 512 512"><path d="M400 148l-21.12-24.57A191.43 191.43 0 0 0 240 64C134 64 48 150 48 256s86 192 192 192a192.09 192.09 0 0 0 181.07-128" fill="none" stroke="currentColor" stroke-linecap="square" stroke-miterlimit="10" stroke-width="32"></path><path d="M464 68.45V220a4 4 0 0 1-4 4H308.45a4 4 0 0 1-2.83-6.83L457.17 65.62a4 4 0 0 1 6.83 2.83z" fill="currentColor"></path></svg>
|
|
||||||
|
Before Width: | Height: | Size: 561 B |
5
src/components/ReAuth/index.ts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
import auth from "./src/auth";
|
||||||
|
|
||||||
|
const Auth = auth;
|
||||||
|
|
||||||
|
export { Auth };
|
||||||
20
src/components/ReAuth/src/auth.tsx
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import { defineComponent, Fragment } from "vue";
|
||||||
|
import { hasAuth } from "@/router/utils";
|
||||||
|
|
||||||
|
export default defineComponent({
|
||||||
|
name: "Auth",
|
||||||
|
props: {
|
||||||
|
value: {
|
||||||
|
type: undefined,
|
||||||
|
default: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
setup(props, { slots }) {
|
||||||
|
return () => {
|
||||||
|
if (!slots) return null;
|
||||||
|
return hasAuth(props.value) ? (
|
||||||
|
<Fragment>{slots.default?.()}</Fragment>
|
||||||
|
) : null;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
@@ -2,7 +2,7 @@ import iconifyIconOffline from "./src/iconifyIconOffline";
|
|||||||
import iconifyIconOnline from "./src/iconifyIconOnline";
|
import iconifyIconOnline from "./src/iconifyIconOnline";
|
||||||
import fontIcon from "./src/iconfont";
|
import fontIcon from "./src/iconfont";
|
||||||
|
|
||||||
/** 离线图标组件 */
|
/** 本地图标组件 */
|
||||||
const IconifyIconOffline = iconifyIconOffline;
|
const IconifyIconOffline = iconifyIconOffline;
|
||||||
/** 在线图标组件 */
|
/** 在线图标组件 */
|
||||||
const IconifyIconOnline = iconifyIconOnline;
|
const IconifyIconOnline = iconifyIconOnline;
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ import { h, defineComponent, Component } from "vue";
|
|||||||
import { IconifyIconOnline, IconifyIconOffline, FontIcon } from "../index";
|
import { IconifyIconOnline, IconifyIconOffline, FontIcon } from "../index";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 支持fontawesome4、5+、iconfont、remixicon、element-plus的icons、自定义svg
|
* 支持 `iconfont`、自定义 `svg` 以及 `iconify` 中所有的图标
|
||||||
|
* @see 点击查看文档图标篇 {@link https://yiming_chang.gitee.io/pure-admin-doc/pages/icon/}
|
||||||
* @param icon 必传 图标
|
* @param icon 必传 图标
|
||||||
* @param attrs 可选 iconType 属性
|
* @param attrs 可选 iconType 属性
|
||||||
* @returns Component
|
* @returns Component
|
||||||
@@ -33,12 +34,23 @@ export function useRenderIcon(icon: any, attrs?: iconType): Component {
|
|||||||
} else if (typeof icon === "function" || typeof icon?.render === "function") {
|
} else if (typeof icon === "function" || typeof icon?.render === "function") {
|
||||||
// svg
|
// svg
|
||||||
return icon;
|
return icon;
|
||||||
|
} else if (typeof icon === "object") {
|
||||||
|
return defineComponent({
|
||||||
|
name: "OfflineIcon",
|
||||||
|
render() {
|
||||||
|
return h(IconifyIconOffline, {
|
||||||
|
icon: icon,
|
||||||
|
...attrs
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
|
// 通过是否存在 : 符号来判断是在线还是本地图标,存在即是在线图标,反之
|
||||||
return defineComponent({
|
return defineComponent({
|
||||||
name: "Icon",
|
name: "Icon",
|
||||||
render() {
|
render() {
|
||||||
const IconifyIcon =
|
const IconifyIcon =
|
||||||
attrs && attrs["online"] ? IconifyIconOnline : IconifyIconOffline;
|
icon && icon.includes(":") ? IconifyIconOnline : IconifyIconOffline;
|
||||||
return h(IconifyIcon, {
|
return h(IconifyIcon, {
|
||||||
icon: icon,
|
icon: icon,
|
||||||
...attrs
|
...attrs
|
||||||
|
|||||||
@@ -1,66 +1,22 @@
|
|||||||
import { h, defineComponent } from "vue";
|
import { h, defineComponent } from "vue";
|
||||||
import { Icon as IconifyIcon, addIcon } from "@iconify/vue/dist/offline";
|
import { Icon as IconifyIcon, addIcon } from "@iconify/vue/dist/offline";
|
||||||
|
|
||||||
// element-plus icon
|
// Iconify Icon在Vue里本地使用(用于内网环境)https://docs.iconify.design/icon-components/vue/offline.html
|
||||||
import Check from "@iconify-icons/ep/check";
|
|
||||||
import HomeFilled from "@iconify-icons/ep/home-filled";
|
|
||||||
import Setting from "@iconify-icons/ep/setting";
|
|
||||||
import Lollipop from "@iconify-icons/ep/lollipop";
|
|
||||||
import RefreshRight from "@iconify-icons/ep/refresh-right";
|
|
||||||
import ArrowDown from "@iconify-icons/ep/arrow-down";
|
|
||||||
import CloseBold from "@iconify-icons/ep/close-bold";
|
|
||||||
import Bell from "@iconify-icons/ep/bell";
|
|
||||||
import Search from "@iconify-icons/ep/search";
|
|
||||||
addIcon("check", Check);
|
|
||||||
addIcon("home-filled", HomeFilled);
|
|
||||||
addIcon("setting", Setting);
|
|
||||||
addIcon("lollipop", Lollipop);
|
|
||||||
addIcon("refresh-right", RefreshRight);
|
|
||||||
addIcon("arrow-down", ArrowDown);
|
|
||||||
addIcon("close-bold", CloseBold);
|
|
||||||
addIcon("bell", Bell);
|
|
||||||
addIcon("search", Search);
|
|
||||||
|
|
||||||
// remixicon
|
|
||||||
import ArrowRightSLine from "@iconify-icons/ri/arrow-right-s-line";
|
|
||||||
import ArrowLeftSLine from "@iconify-icons/ri/arrow-left-s-line";
|
|
||||||
import LogoutCircleRLine from "@iconify-icons/ri/logout-circle-r-line";
|
|
||||||
import InformationLine from "@iconify-icons/ri/information-line";
|
|
||||||
import ArrowUpLine from "@iconify-icons/ri/arrow-up-line";
|
|
||||||
import ArrowDownLine from "@iconify-icons/ri/arrow-down-line";
|
|
||||||
import Bookmark2Line from "@iconify-icons/ri/bookmark-2-line";
|
|
||||||
import User from "@iconify-icons/ri/user-3-fill";
|
|
||||||
import Lock from "@iconify-icons/ri/lock-fill";
|
|
||||||
import MenuUnfold from "@iconify-icons/ri/menu-unfold-fill";
|
|
||||||
import MenuFold from "@iconify-icons/ri/menu-fold-fill";
|
|
||||||
addIcon("arrow-right-s-line", ArrowRightSLine);
|
|
||||||
addIcon("arrow-left-s-line", ArrowLeftSLine);
|
|
||||||
addIcon("logout-circle-r-line", LogoutCircleRLine);
|
|
||||||
addIcon("information-line", InformationLine);
|
|
||||||
addIcon("arrow-up-line", ArrowUpLine);
|
|
||||||
addIcon("arrow-down-line", ArrowDownLine);
|
|
||||||
addIcon("bookmark-2-line", Bookmark2Line);
|
|
||||||
addIcon("user", User);
|
|
||||||
addIcon("lock", Lock);
|
|
||||||
addIcon("menu-unfold", MenuUnfold);
|
|
||||||
addIcon("menu-fold", MenuFold);
|
|
||||||
|
|
||||||
// Iconify Icon在Vue里离线使用(用于内网环境)https://docs.iconify.design/icon-components/vue/offline.html
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "IconifyIconOffline",
|
name: "IconifyIconOffline",
|
||||||
components: { IconifyIcon },
|
components: { IconifyIcon },
|
||||||
props: {
|
props: {
|
||||||
icon: {
|
icon: {
|
||||||
type: String,
|
default: null
|
||||||
default: ""
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
render() {
|
render() {
|
||||||
|
if (typeof this.icon === "object") addIcon(this.icon, this.icon);
|
||||||
const attrs = this.$attrs;
|
const attrs = this.$attrs;
|
||||||
return h(
|
return h(
|
||||||
IconifyIcon,
|
IconifyIcon,
|
||||||
{
|
{
|
||||||
icon: `${this.icon}`,
|
icon: this.icon,
|
||||||
style: attrs?.style
|
style: attrs?.style
|
||||||
? Object.assign(attrs.style, { outline: "none" })
|
? Object.assign(attrs.style, { outline: "none" })
|
||||||
: { outline: "none" },
|
: { outline: "none" },
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ export interface iconType {
|
|||||||
horizontalAlign?: boolean;
|
horizontalAlign?: boolean;
|
||||||
verticalAlign?: boolean;
|
verticalAlign?: boolean;
|
||||||
align?: string;
|
align?: string;
|
||||||
online?: boolean;
|
|
||||||
onLoad?: Function;
|
onLoad?: Function;
|
||||||
includes?: Function;
|
includes?: Function;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
import reImageVerify from "./src/index.vue";
|
|
||||||
import { withInstall } from "@pureadmin/utils";
|
|
||||||
|
|
||||||
/** 图形验证码组件 */
|
|
||||||
export const ReImageVerify = withInstall(reImageVerify);
|
|
||||||
|
|
||||||
export default ReImageVerify;
|
|
||||||
@@ -1,85 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import { watch } from "vue";
|
|
||||||
import { useImageVerify } from "./hooks";
|
|
||||||
|
|
||||||
defineOptions({
|
|
||||||
name: "ReImageVerify"
|
|
||||||
});
|
|
||||||
|
|
||||||
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>
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
import reQrcode from "./src/index";
|
|
||||||
import { withInstall } from "@pureadmin/utils";
|
|
||||||
|
|
||||||
/** 二维码组件 */
|
|
||||||
export const ReQrcode = withInstall(reQrcode);
|
|
||||||
|
|
||||||
export default ReQrcode;
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
.qrcode {
|
|
||||||
&--disabled {
|
|
||||||
background: rgba(255, 255, 255, 0.95);
|
|
||||||
& > div {
|
|
||||||
transform: translate(-50%, -50%);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,262 +0,0 @@
|
|||||||
import {
|
|
||||||
ref,
|
|
||||||
unref,
|
|
||||||
watch,
|
|
||||||
nextTick,
|
|
||||||
computed,
|
|
||||||
PropType,
|
|
||||||
defineComponent
|
|
||||||
} from "vue";
|
|
||||||
import "./index.scss";
|
|
||||||
import { cloneDeep } from "lodash-unified";
|
|
||||||
import { isString } from "@pureadmin/utils";
|
|
||||||
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: any = 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"
|
|
||||||
icon="refresh-right"
|
|
||||||
width="30"
|
|
||||||
color="var(--el-color-primary)"
|
|
||||||
/>
|
|
||||||
<div>{props.disabledText}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
@@ -27,11 +27,10 @@ const getConfig = (key?: string): ServerConfigs => {
|
|||||||
return config;
|
return config;
|
||||||
};
|
};
|
||||||
|
|
||||||
// 获取项目动态全局配置
|
/** 获取项目动态全局配置 */
|
||||||
export const getServerConfig = async (app: App): Promise<undefined> => {
|
export const getServerConfig = async (app: App): Promise<undefined> => {
|
||||||
app.config.globalProperties.$config = getConfig();
|
app.config.globalProperties.$config = getConfig();
|
||||||
return axios({
|
return axios({
|
||||||
baseURL: "",
|
|
||||||
method: "get",
|
method: "get",
|
||||||
url: `${VITE_PUBLIC_PATH}serverConfig.json`
|
url: `${VITE_PUBLIC_PATH}serverConfig.json`
|
||||||
})
|
})
|
||||||
@@ -44,8 +43,6 @@ export const getServerConfig = async (app: App): Promise<undefined> => {
|
|||||||
// 设置全局配置
|
// 设置全局配置
|
||||||
setConfig($config);
|
setConfig($config);
|
||||||
}
|
}
|
||||||
// 设置全局baseURL
|
|
||||||
app.config.globalProperties.$baseUrl = $config.baseURL;
|
|
||||||
return $config;
|
return $config;
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
|
|||||||
13
src/directives/auth/index.ts
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import { hasAuth } from "@/router/utils";
|
||||||
|
import { Directive, type DirectiveBinding } from "vue";
|
||||||
|
|
||||||
|
export const auth: Directive = {
|
||||||
|
mounted(el: HTMLElement, binding: DirectiveBinding) {
|
||||||
|
const { value } = binding;
|
||||||
|
if (value) {
|
||||||
|
!hasAuth(value) && el.parentNode.removeChild(el);
|
||||||
|
} else {
|
||||||
|
throw new Error("need auths! Like v-auth=\"['btn.add','btn.edit']\"");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -1,8 +1,7 @@
|
|||||||
import { Directive, type DirectiveBinding, type VNode } from "vue";
|
import { Directive, type DirectiveBinding, type VNode } from "vue";
|
||||||
import elementResizeDetectorMaker from "element-resize-detector";
|
import elementResizeDetectorMaker from "element-resize-detector";
|
||||||
import type { Erd } from "element-resize-detector";
|
import type { Erd } from "element-resize-detector";
|
||||||
import { optimizeFps } from "@pureadmin/utils";
|
import { emitter } from "@/utils/mitt";
|
||||||
import { emitter } from "/@/utils/mitt";
|
|
||||||
|
|
||||||
const erd: Erd = elementResizeDetectorMaker({
|
const erd: Erd = elementResizeDetectorMaker({
|
||||||
strategy: "scroll"
|
strategy: "scroll"
|
||||||
@@ -14,9 +13,7 @@ export const resize: Directive = {
|
|||||||
const width = elem.offsetWidth;
|
const width = elem.offsetWidth;
|
||||||
const height = elem.offsetHeight;
|
const height = elem.offsetHeight;
|
||||||
if (binding?.instance) {
|
if (binding?.instance) {
|
||||||
optimizeFps(() => {
|
emitter.emit("resize", { detail: { width, height } });
|
||||||
emitter.emit("resize", { detail: { width, height } });
|
|
||||||
})();
|
|
||||||
} else {
|
} else {
|
||||||
vnode.el.dispatchEvent(
|
vnode.el.dispatchEvent(
|
||||||
new CustomEvent("resize", { detail: { width, height } })
|
new CustomEvent("resize", { detail: { width, height } })
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
export * from "./permission";
|
export * from "./auth";
|
||||||
export * from "./elResizeDetector";
|
export * from "./elResizeDetector";
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
import { usePermissionStoreHook } from "/@/store/modules/permission";
|
|
||||||
import { Directive } from "vue";
|
|
||||||
import type { DirectiveBinding } from "vue";
|
|
||||||
|
|
||||||
export const auth: Directive = {
|
|
||||||
mounted(el: HTMLElement, binding: DirectiveBinding) {
|
|
||||||
const { value } = binding;
|
|
||||||
if (value) {
|
|
||||||
const authRoles = value;
|
|
||||||
const hasAuth = usePermissionStoreHook().buttonAuth.includes(authRoles);
|
|
||||||
if (!hasAuth) {
|
|
||||||
el.parentNode.removeChild(el);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
throw new Error("need roles! Like v-auth=\"['admin','test']\"");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useGlobal } from "@pureadmin/utils";
|
import { useGlobal } from "@pureadmin/utils";
|
||||||
import backTop from "/@/assets/svg/back_top.svg?component";
|
import backTop from "@/assets/svg/back_top.svg?component";
|
||||||
import { h, computed, Transition, defineComponent } from "vue";
|
import { h, computed, Transition, defineComponent } from "vue";
|
||||||
import { usePermissionStoreHook } from "/@/store/modules/permission";
|
import { usePermissionStoreHook } from "@/store/modules/permission";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
fixedHeader: Boolean
|
fixedHeader: Boolean
|
||||||
|
|||||||
@@ -2,14 +2,11 @@
|
|||||||
import Search from "./search/index.vue";
|
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 { useNav } from "@/layout/hooks/useNav";
|
||||||
import { useNav } from "/@/layout/hooks/useNav";
|
|
||||||
import Breadcrumb from "./sidebar/breadCrumb.vue";
|
import Breadcrumb from "./sidebar/breadCrumb.vue";
|
||||||
import { deviceDetection } from "@pureadmin/utils";
|
|
||||||
import topCollapse from "./sidebar/topCollapse.vue";
|
import topCollapse from "./sidebar/topCollapse.vue";
|
||||||
import screenfull from "../components/screenfull/index.vue";
|
import LogoutCircleRLine from "@iconify-icons/ri/logout-circle-r-line";
|
||||||
import { useTranslationLang } from "../hooks/useTranslationLang";
|
import Setting from "@iconify-icons/ri/settings-3-line";
|
||||||
import globalization from "/@/assets/svg/globalization.svg?component";
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
layout,
|
layout,
|
||||||
@@ -19,12 +16,8 @@ const {
|
|||||||
pureApp,
|
pureApp,
|
||||||
username,
|
username,
|
||||||
avatarsStyle,
|
avatarsStyle,
|
||||||
toggleSideBar,
|
toggleSideBar
|
||||||
getDropdownItemStyle,
|
|
||||||
getDropdownItemClass
|
|
||||||
} = useNav();
|
} = useNav();
|
||||||
|
|
||||||
const { t, locale, translationCh, translationEn } = useTranslationLang();
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -50,64 +43,33 @@ const { t, locale, translationCh, translationEn } = useTranslationLang();
|
|||||||
<Search />
|
<Search />
|
||||||
<!-- 通知 -->
|
<!-- 通知 -->
|
||||||
<Notice id="header-notice" />
|
<Notice id="header-notice" />
|
||||||
<!-- 全屏 -->
|
|
||||||
<screenfull id="header-screenfull" v-show="!deviceDetection()" />
|
|
||||||
<!-- 国际化 -->
|
|
||||||
<el-dropdown id="header-translation" trigger="click">
|
|
||||||
<globalization
|
|
||||||
class="navbar-bg-hover w-40px h-48px p-11px cursor-pointer outline-none"
|
|
||||||
/>
|
|
||||||
<template #dropdown>
|
|
||||||
<el-dropdown-menu class="translation">
|
|
||||||
<el-dropdown-item
|
|
||||||
:style="getDropdownItemStyle(locale, 'zh')"
|
|
||||||
:class="['!dark:color-white', getDropdownItemClass(locale, 'zh')]"
|
|
||||||
@click="translationCh"
|
|
||||||
>
|
|
||||||
<IconifyIconOffline
|
|
||||||
class="check-zh"
|
|
||||||
v-show="locale === 'zh'"
|
|
||||||
icon="check"
|
|
||||||
/>
|
|
||||||
简体中文
|
|
||||||
</el-dropdown-item>
|
|
||||||
<el-dropdown-item
|
|
||||||
:style="getDropdownItemStyle(locale, 'en')"
|
|
||||||
:class="['!dark:color-white', getDropdownItemClass(locale, 'en')]"
|
|
||||||
@click="translationEn"
|
|
||||||
>
|
|
||||||
<span class="check-en" v-show="locale === 'en'">
|
|
||||||
<IconifyIconOffline icon="check" />
|
|
||||||
</span>
|
|
||||||
English
|
|
||||||
</el-dropdown-item>
|
|
||||||
</el-dropdown-menu>
|
|
||||||
</template>
|
|
||||||
</el-dropdown>
|
|
||||||
<!-- 退出登录 -->
|
<!-- 退出登录 -->
|
||||||
<el-dropdown trigger="click">
|
<el-dropdown trigger="click">
|
||||||
<span class="el-dropdown-link navbar-bg-hover">
|
<span class="el-dropdown-link navbar-bg-hover select-none">
|
||||||
<img v-if="avatars" :src="avatars" :style="avatarsStyle" />
|
<img
|
||||||
<p v-if="username" class="dark:color-white">{{ username }}</p>
|
src="https://avatars.githubusercontent.com/u/44761321?v=4"
|
||||||
|
:style="avatarsStyle"
|
||||||
|
/>
|
||||||
|
<p v-if="username" class="dark:text-white">{{ username }}</p>
|
||||||
</span>
|
</span>
|
||||||
<template #dropdown>
|
<template #dropdown>
|
||||||
<el-dropdown-menu class="logout">
|
<el-dropdown-menu class="logout">
|
||||||
<el-dropdown-item @click="logout">
|
<el-dropdown-item @click="logout">
|
||||||
<IconifyIconOffline
|
<IconifyIconOffline
|
||||||
icon="logout-circle-r-line"
|
:icon="LogoutCircleRLine"
|
||||||
style="margin: 5px"
|
style="margin: 5px"
|
||||||
/>
|
/>
|
||||||
{{ t("buttons.hsLoginOut") }}
|
退出系统
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</template>
|
</template>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
<span
|
<span
|
||||||
class="el-icon-setting navbar-bg-hover"
|
class="set-icon navbar-bg-hover"
|
||||||
:title="t('buttons.hssystemSet')"
|
title="打开项目配置"
|
||||||
@click="onPanel"
|
@click="onPanel"
|
||||||
>
|
>
|
||||||
<IconifyIconOffline icon="setting" />
|
<IconifyIconOffline :icon="Setting" />
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -153,15 +115,6 @@ const { t, locale, translationCh, translationEn } = useTranslationLang();
|
|||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-icon-setting {
|
|
||||||
height: 48px;
|
|
||||||
width: 38px;
|
|
||||||
padding: 12px;
|
|
||||||
display: flex;
|
|
||||||
cursor: pointer;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.breadcrumb-container {
|
.breadcrumb-container {
|
||||||
@@ -170,22 +123,6 @@ const { t, locale, translationCh, translationEn } = useTranslationLang();
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.translation {
|
|
||||||
::v-deep(.el-dropdown-menu__item) {
|
|
||||||
padding: 5px 40px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.check-zh {
|
|
||||||
position: absolute;
|
|
||||||
left: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.check-en {
|
|
||||||
position: absolute;
|
|
||||||
left: 20px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.logout {
|
.logout {
|
||||||
max-width: 120px;
|
max-width: 120px;
|
||||||
|
|
||||||
|
|||||||
@@ -2,61 +2,45 @@
|
|||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import { noticesData } from "./data";
|
import { noticesData } from "./data";
|
||||||
import NoticeList from "./noticeList.vue";
|
import NoticeList from "./noticeList.vue";
|
||||||
import { templateRef } from "@vueuse/core";
|
import Bell from "@iconify-icons/ep/bell";
|
||||||
import { Tabs, TabPane } from "@pureadmin/components";
|
|
||||||
|
|
||||||
const dropdownDom = templateRef<ElRef | null>("dropdownDom", null);
|
const noticesNum = ref(0);
|
||||||
const activeName = ref(noticesData[0].name);
|
|
||||||
const notices = ref(noticesData);
|
const notices = ref(noticesData);
|
||||||
|
const activeKey = ref(noticesData[0].key);
|
||||||
|
|
||||||
let noticesNum = ref(0);
|
notices.value.map(v => (noticesNum.value += v.list.length));
|
||||||
notices.value.forEach(notice => {
|
|
||||||
noticesNum.value += notice.list.length;
|
|
||||||
});
|
|
||||||
|
|
||||||
function tabClick() {
|
|
||||||
(dropdownDom as any).value.handleOpen();
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<el-dropdown ref="dropdownDom" trigger="click" placement="bottom-end">
|
<el-dropdown trigger="click" placement="bottom-end">
|
||||||
<span class="dropdown-badge navbar-bg-hover select-none">
|
<span class="dropdown-badge navbar-bg-hover select-none">
|
||||||
<el-badge :value="noticesNum" :max="99">
|
<el-badge :value="noticesNum" :max="99">
|
||||||
<span class="header-notice-icon">
|
<span class="header-notice-icon">
|
||||||
<IconifyIconOffline icon="bell" />
|
<IconifyIconOffline :icon="Bell" />
|
||||||
</span>
|
</span>
|
||||||
</el-badge>
|
</el-badge>
|
||||||
</span>
|
</span>
|
||||||
<template #dropdown>
|
<template #dropdown>
|
||||||
<el-dropdown-menu>
|
<el-dropdown-menu>
|
||||||
<Tabs
|
<el-tabs :stretch="true" v-model="activeKey" class="dropdown-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">
|
||||||
<TabPane :tab="`${item.name}(${item.list.length})`">
|
<el-tab-pane
|
||||||
|
:label="`${item.name}(${item.list.length})`"
|
||||||
|
:name="`${item.key}`"
|
||||||
|
>
|
||||||
<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>
|
||||||
</TabPane>
|
</el-tab-pane>
|
||||||
</template>
|
</template>
|
||||||
</Tabs>
|
</el-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;
|
||||||
@@ -72,30 +56,28 @@ function tabClick() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.dropdown-tabs {
|
.dropdown-tabs {
|
||||||
width: 336px;
|
width: 330px;
|
||||||
background-color: #fff;
|
|
||||||
box-shadow: 0 2px 8px rgb(0 0 0 / 15%);
|
.noticeList-container {
|
||||||
border-radius: 4px;
|
padding: 15px 24px 0 24px;
|
||||||
|
}
|
||||||
|
|
||||||
:deep(.el-tabs__header) {
|
:deep(.el-tabs__header) {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.el-tabs__nav-scroll) {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.el-tabs__nav-wrap)::after {
|
:deep(.el-tabs__nav-wrap)::after {
|
||||||
height: 1px;
|
height: 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.noticeList-container) {
|
// 如果上面的 notices 长度大于 3 请注释掉下面代码
|
||||||
padding: 15px 24px 0 24px;
|
:deep(.el-tabs__nav-wrap) {
|
||||||
|
padding: 0 36px 0 36px;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果上面的 notices 长度大于 3 请注释掉下面代码
|
||||||
|
:deep(.el-tabs__active-bar) {
|
||||||
|
margin: 0 36px 0 36px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.ant-tabs-nav) {
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ListItem } from "./data";
|
import { ListItem } from "./data";
|
||||||
import { ref, PropType, nextTick } from "vue";
|
import { ref, PropType, nextTick } from "vue";
|
||||||
|
import { useNav } from "@/layout/hooks/useNav";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
noticeItem: {
|
noticeItem: {
|
||||||
@@ -13,6 +14,7 @@ const titleRef = ref(null);
|
|||||||
const titleTooltip = ref(false);
|
const titleTooltip = ref(false);
|
||||||
const descriptionRef = ref(null);
|
const descriptionRef = ref(null);
|
||||||
const descriptionTooltip = ref(false);
|
const descriptionTooltip = ref(false);
|
||||||
|
const { tooltipEffect } = useNav();
|
||||||
|
|
||||||
function hoverTitle() {
|
function hoverTitle() {
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
@@ -24,11 +26,11 @@ function hoverTitle() {
|
|||||||
|
|
||||||
function hoverDescription(event, description) {
|
function hoverDescription(event, description) {
|
||||||
// currentWidth 为文本在页面中所占的宽度,创建标签,加入到页面,获取currentWidth ,最后在移除
|
// currentWidth 为文本在页面中所占的宽度,创建标签,加入到页面,获取currentWidth ,最后在移除
|
||||||
let tempTag = document.createElement("span");
|
const tempTag = document.createElement("span");
|
||||||
tempTag.innerText = description;
|
tempTag.innerText = description;
|
||||||
tempTag.className = "getDescriptionWidth";
|
tempTag.className = "getDescriptionWidth";
|
||||||
document.querySelector("body").appendChild(tempTag);
|
document.querySelector("body").appendChild(tempTag);
|
||||||
let currentWidth = (
|
const currentWidth = (
|
||||||
document.querySelector(".getDescriptionWidth") as HTMLSpanElement
|
document.querySelector(".getDescriptionWidth") as HTMLSpanElement
|
||||||
).offsetWidth;
|
).offsetWidth;
|
||||||
document.querySelector(".getDescriptionWidth").remove();
|
document.querySelector(".getDescriptionWidth").remove();
|
||||||
@@ -45,7 +47,7 @@ function hoverDescription(event, description) {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
class="notice-container border-b-1 border-[#f0f0f0] dark:border-[#303030]"
|
class="notice-container border-b-[1px] border-solid border-[#f0f0f0] dark:border-[#303030]"
|
||||||
>
|
>
|
||||||
<el-avatar
|
<el-avatar
|
||||||
v-if="props.noticeItem.avatar"
|
v-if="props.noticeItem.avatar"
|
||||||
@@ -54,9 +56,10 @@ function hoverDescription(event, description) {
|
|||||||
class="notice-container-avatar"
|
class="notice-container-avatar"
|
||||||
/>
|
/>
|
||||||
<div class="notice-container-text">
|
<div class="notice-container-text">
|
||||||
<div class="notice-text-title color-[#000000d9] dark:color-white">
|
<div class="notice-text-title text-[#000000d9] dark:text-white">
|
||||||
<el-tooltip
|
<el-tooltip
|
||||||
popper-class="notice-title-popper"
|
popper-class="notice-title-popper"
|
||||||
|
:effect="tooltipEffect"
|
||||||
:disabled="!titleTooltip"
|
:disabled="!titleTooltip"
|
||||||
:content="props.noticeItem.title"
|
:content="props.noticeItem.title"
|
||||||
placement="top-start"
|
placement="top-start"
|
||||||
@@ -81,6 +84,7 @@ function hoverDescription(event, description) {
|
|||||||
|
|
||||||
<el-tooltip
|
<el-tooltip
|
||||||
popper-class="notice-title-popper"
|
popper-class="notice-title-popper"
|
||||||
|
:effect="tooltipEffect"
|
||||||
:disabled="!descriptionTooltip"
|
:disabled="!descriptionTooltip"
|
||||||
:content="props.noticeItem.description"
|
:content="props.noticeItem.description"
|
||||||
placement="top-start"
|
placement="top-start"
|
||||||
@@ -93,7 +97,7 @@ function hoverDescription(event, description) {
|
|||||||
{{ props.noticeItem.description }}
|
{{ props.noticeItem.description }}
|
||||||
</div>
|
</div>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<div class="notice-text-datetime color-[#00000073] dark:color-white">
|
<div class="notice-text-datetime text-[#00000073] dark:text-white">
|
||||||
{{ props.noticeItem.datetime }}
|
{{ props.noticeItem.datetime }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,10 +1,27 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from "vue";
|
import { ref, computed } from "vue";
|
||||||
|
import { emitter } from "@/utils/mitt";
|
||||||
import { onClickOutside } from "@vueuse/core";
|
import { onClickOutside } from "@vueuse/core";
|
||||||
import { emitter } from "/@/utils/mitt";
|
import Close from "@iconify-icons/ep/close";
|
||||||
|
|
||||||
let show = ref<Boolean>(false);
|
|
||||||
const target = ref(null);
|
const target = ref(null);
|
||||||
|
const show = ref<Boolean>(false);
|
||||||
|
|
||||||
|
const iconClass = computed(() => {
|
||||||
|
return [
|
||||||
|
"mr-[20px]",
|
||||||
|
"outline-none",
|
||||||
|
"width-[20px]",
|
||||||
|
"height-[20px]",
|
||||||
|
"rounded-[4px]",
|
||||||
|
"cursor-pointer",
|
||||||
|
"transition-colors",
|
||||||
|
"hover:bg-[#0000000f]",
|
||||||
|
"dark:hover:bg-[#ffffff1f]",
|
||||||
|
"dark:hover:text-[#ffffffd9]"
|
||||||
|
];
|
||||||
|
});
|
||||||
|
|
||||||
onClickOutside(target, (event: any) => {
|
onClickOutside(target, (event: any) => {
|
||||||
if (event.clientX > target.value.offsetLeft) return;
|
if (event.clientX > target.value.offsetLeft) return;
|
||||||
show.value = false;
|
show.value = false;
|
||||||
@@ -18,15 +35,23 @@ emitter.on("openPanel", () => {
|
|||||||
<template>
|
<template>
|
||||||
<div :class="{ show: show }" class="right-panel-container">
|
<div :class="{ show: show }" class="right-panel-container">
|
||||||
<div class="right-panel-background" />
|
<div class="right-panel-background" />
|
||||||
<div ref="target" class="right-panel bg-white dark:bg-dark">
|
<div ref="target" class="right-panel bg-bg_color">
|
||||||
<div class="right-panel-items">
|
<div class="right-panel-items">
|
||||||
<div class="project-configuration">
|
<div class="project-configuration">
|
||||||
<h3>项目配置</h3>
|
<h4 class="dark:text-white">项目配置</h4>
|
||||||
<el-icon title="关闭配置" class="el-icon-close" @click="show = !show">
|
<span title="关闭配置" :class="iconClass">
|
||||||
<IconifyIconOffline icon="close" />
|
<IconifyIconOffline
|
||||||
</el-icon>
|
class="dark:text-white"
|
||||||
|
width="20px"
|
||||||
|
height="20px"
|
||||||
|
:icon="Close"
|
||||||
|
@click="show = !show"
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="border-b-1 border-[#dcdfe6] dark:border-[#303030]" />
|
<div
|
||||||
|
class="border-b-[1px] border-solid border-[#dcdfe6] dark:border-[#303030]"
|
||||||
|
/>
|
||||||
<slot />
|
<slot />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -62,7 +87,6 @@ emitter.on("openPanel", () => {
|
|||||||
box-shadow: 0 0 15px 0 rgba(0, 0, 0, 0.05);
|
box-shadow: 0 0 15px 0 rgba(0, 0, 0, 0.05);
|
||||||
transition: all 0.25s cubic-bezier(0.7, 0.3, 0.1, 1);
|
transition: all 0.25s cubic-bezier(0.7, 0.3, 0.1, 1);
|
||||||
transform: translate(100%);
|
transform: translate(100%);
|
||||||
// background: #fff;
|
|
||||||
z-index: 40000;
|
z-index: 40000;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,16 +142,6 @@ emitter.on("openPanel", () => {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
top: 15px;
|
top: 15px;
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
|
|
||||||
i {
|
|
||||||
font-size: 20px;
|
|
||||||
margin-right: 20px;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
cursor: pointer;
|
|
||||||
color: var(--el-color-primary);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.el-divider--horizontal) {
|
:deep(.el-divider--horizontal) {
|
||||||
|
|||||||
@@ -1,20 +1,16 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useI18n } from "vue-i18n";
|
|
||||||
import { useFullscreen } from "@vueuse/core";
|
import { useFullscreen } from "@vueuse/core";
|
||||||
|
|
||||||
const { t } = useI18n();
|
|
||||||
const { isFullscreen, toggle } = useFullscreen();
|
const { isFullscreen, toggle } = useFullscreen();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
class="screen-full w-36px h-48px flex-ac cursor-pointer navbar-bg-hover"
|
class="screen-full w-[36px] h-[48px] flex-ac cursor-pointer navbar-bg-hover"
|
||||||
@click="toggle"
|
@click="toggle"
|
||||||
>
|
>
|
||||||
<FontIcon
|
<FontIcon
|
||||||
:title="
|
:title="isFullscreen ? '退出全屏' : '全屏'"
|
||||||
isFullscreen ? t('buttons.hsexitfullscreen') : t('buttons.hsfullscreen')
|
|
||||||
"
|
|
||||||
:icon="isFullscreen ? 'team-iconexit-fullscreen' : 'team-iconfullscreen'"
|
:icon="isFullscreen ? 'team-iconexit-fullscreen' : 'team-iconfullscreen'"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="search-footer color-[#333] dark:color-white">
|
<div class="search-footer text-[#333] dark:text-white">
|
||||||
<span class="search-footer-item">
|
<span class="search-footer-item">
|
||||||
<enterOutlined class="icon" />
|
<enterOutlined class="icon" />
|
||||||
确认
|
确认
|
||||||
</span>
|
</span>
|
||||||
<span class="search-footer-item">
|
<span class="search-footer-item">
|
||||||
<IconifyIconOffline icon="arrow-up-line" class="icon" />
|
<IconifyIconOffline :icon="ArrowUpLine" class="icon" />
|
||||||
<IconifyIconOffline icon="arrow-down-line" class="icon" />
|
<IconifyIconOffline :icon="ArrowDownLine" class="icon" />
|
||||||
切换
|
切换
|
||||||
</span>
|
</span>
|
||||||
<span class="search-footer-item">
|
<span class="search-footer-item">
|
||||||
@@ -16,10 +16,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script setup lang="ts">
|
||||||
import enterOutlined from "/@/assets/svg/enter_outlined.svg?component";
|
import ArrowUpLine from "@iconify-icons/ri/arrow-up-line";
|
||||||
import mdiKeyboardEsc from "/@/assets/svg/mdi_keyboard_esc.svg?component";
|
import ArrowDownLine from "@iconify-icons/ri/arrow-down-line";
|
||||||
|
import mdiKeyboardEsc from "@/assets/svg/keyboard_esc.svg?component";
|
||||||
|
import enterOutlined from "@/assets/svg/enter_outlined.svg?component";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.search-footer {
|
.search-footer {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
<script lang="ts" setup>
|
<script setup lang="ts">
|
||||||
import { useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
|
import { cloneDeep } from "lodash-unified";
|
||||||
import SearchResult from "./SearchResult.vue";
|
import SearchResult from "./SearchResult.vue";
|
||||||
import SearchFooter from "./SearchFooter.vue";
|
import SearchFooter from "./SearchFooter.vue";
|
||||||
import { useNav } from "/@/layout/hooks/useNav";
|
import { deleteChildren } from "@/utils/tree";
|
||||||
import { transformI18n } from "/@/plugins/i18n";
|
import { useNav } from "@/layout/hooks/useNav";
|
||||||
import { deleteChildren } from "@pureadmin/utils";
|
|
||||||
import { useDebounceFn, onKeyStroke } from "@vueuse/core";
|
import { useDebounceFn, onKeyStroke } from "@vueuse/core";
|
||||||
import { ref, watch, computed, nextTick, shallowRef } from "vue";
|
import { ref, watch, computed, nextTick, shallowRef } from "vue";
|
||||||
import { usePermissionStoreHook } from "/@/store/modules/permission";
|
import { usePermissionStoreHook } from "@/store/modules/permission";
|
||||||
|
import Search from "@iconify-icons/ep/search";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
/** 弹窗显隐 */
|
/** 弹窗显隐 */
|
||||||
@@ -31,7 +32,7 @@ const handleSearch = useDebounceFn(search, 300);
|
|||||||
|
|
||||||
/** 菜单树形结构 */
|
/** 菜单树形结构 */
|
||||||
const menusData = computed(() => {
|
const menusData = computed(() => {
|
||||||
return deleteChildren(usePermissionStoreHook().menusTree);
|
return deleteChildren(cloneDeep(usePermissionStoreHook().wholeMenus));
|
||||||
});
|
});
|
||||||
|
|
||||||
const show = computed({
|
const show = computed({
|
||||||
@@ -70,7 +71,7 @@ function search() {
|
|||||||
resultOptions.value = flatMenusData.filter(
|
resultOptions.value = flatMenusData.filter(
|
||||||
menu =>
|
menu =>
|
||||||
keyword.value &&
|
keyword.value &&
|
||||||
transformI18n(menu.meta?.title)
|
menu.meta?.title
|
||||||
.toLocaleLowerCase()
|
.toLocaleLowerCase()
|
||||||
.includes(keyword.value.toLocaleLowerCase().trim())
|
.includes(keyword.value.toLocaleLowerCase().trim())
|
||||||
);
|
);
|
||||||
@@ -147,7 +148,7 @@ onKeyStroke("ArrowDown", handleDown);
|
|||||||
>
|
>
|
||||||
<template #prefix>
|
<template #prefix>
|
||||||
<span class="el-input__icon">
|
<span class="el-input__icon">
|
||||||
<IconifyIconOffline icon="search" />
|
<IconifyIconOffline :icon="Search" />
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
<script lang="ts" setup>
|
<script setup lang="ts">
|
||||||
import { computed } from "vue";
|
import { computed } from "vue";
|
||||||
import { useI18n } from "vue-i18n";
|
import { useEpThemeStoreHook } from "@/store/modules/epTheme";
|
||||||
import { useEpThemeStoreHook } from "/@/store/modules/epTheme";
|
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
|
||||||
import { useRenderIcon } from "/@/components/ReIcon/src/hooks";
|
import enterOutlined from "@/assets/svg/enter_outlined.svg?component";
|
||||||
import enterOutlined from "/@/assets/svg/enter_outlined.svg?component";
|
import Bookmark2Line from "@iconify-icons/ri/bookmark-2-line";
|
||||||
|
|
||||||
const { t } = useI18n();
|
|
||||||
|
|
||||||
interface optionsItem {
|
interface optionsItem {
|
||||||
path: string;
|
path: string;
|
||||||
@@ -67,8 +65,8 @@ function handleTo() {
|
|||||||
@click="handleTo"
|
@click="handleTo"
|
||||||
@mouseenter="handleMouse(item)"
|
@mouseenter="handleMouse(item)"
|
||||||
>
|
>
|
||||||
<component :is="useRenderIcon(item.meta?.icon ?? 'bookmark-2-line')" />
|
<component :is="useRenderIcon(item.meta?.icon ?? Bookmark2Line)" />
|
||||||
<span class="result-item-title">{{ t(item.meta?.title) }}</span>
|
<span class="result-item-title">{{ item.meta?.title }}</span>
|
||||||
<enterOutlined />
|
<enterOutlined />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
<script lang="ts" setup>
|
<script setup lang="ts">
|
||||||
import { SearchModal } from "./components";
|
import { SearchModal } from "./components";
|
||||||
import { useBoolean } from "../../hooks/useBoolean";
|
import { useBoolean } from "../../hooks/useBoolean";
|
||||||
|
import Search from "@iconify-icons/ep/search";
|
||||||
|
|
||||||
const { bool: show, toggle } = useBoolean();
|
const { bool: show, toggle } = useBoolean();
|
||||||
function handleSearch() {
|
function handleSearch() {
|
||||||
toggle();
|
toggle();
|
||||||
@@ -9,10 +11,10 @@ function handleSearch() {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
class="search-container w-40px h-48px flex-c cursor-pointer navbar-bg-hover"
|
class="search-container w-[40px] h-[48px] flex-c cursor-pointer navbar-bg-hover"
|
||||||
@click="handleSearch"
|
@click="handleSearch"
|
||||||
>
|
>
|
||||||
<IconifyIconOffline icon="search" />
|
<IconifyIconOffline :icon="Search" />
|
||||||
</div>
|
</div>
|
||||||
<SearchModal v-model:value="show" />
|
<SearchModal v-model:value="show" />
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,24 +1,4 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {
|
|
||||||
ref,
|
|
||||||
unref,
|
|
||||||
watch,
|
|
||||||
reactive,
|
|
||||||
computed,
|
|
||||||
nextTick,
|
|
||||||
useCssModule
|
|
||||||
} from "vue";
|
|
||||||
import { getConfig } from "/@/config";
|
|
||||||
import { useRouter } from "vue-router";
|
|
||||||
import panel from "../panel/index.vue";
|
|
||||||
import { emitter } from "/@/utils/mitt";
|
|
||||||
import { resetRouter } from "/@/router";
|
|
||||||
import { templateRef } from "@vueuse/core";
|
|
||||||
import { routerArrays } from "/@/layout/types";
|
|
||||||
import { useNav } from "/@/layout/hooks/useNav";
|
|
||||||
import { useAppStoreHook } from "/@/store/modules/app";
|
|
||||||
import { useMultiTagsStoreHook } from "/@/store/modules/multiTags";
|
|
||||||
import { useDataThemeChange } from "/@/layout/hooks/useDataThemeChange";
|
|
||||||
import {
|
import {
|
||||||
useDark,
|
useDark,
|
||||||
debounce,
|
debounce,
|
||||||
@@ -26,23 +6,35 @@ import {
|
|||||||
storageLocal,
|
storageLocal,
|
||||||
storageSession
|
storageSession
|
||||||
} from "@pureadmin/utils";
|
} from "@pureadmin/utils";
|
||||||
|
import { getConfig } from "@/config";
|
||||||
|
import { useRouter } from "vue-router";
|
||||||
|
import panel from "../panel/index.vue";
|
||||||
|
import { emitter } from "@/utils/mitt";
|
||||||
|
import { resetRouter } from "@/router";
|
||||||
|
import { removeToken } from "@/utils/auth";
|
||||||
|
import { routerArrays } from "@/layout/types";
|
||||||
|
import { useNav } from "@/layout/hooks/useNav";
|
||||||
|
import { useAppStoreHook } from "@/store/modules/app";
|
||||||
import { toggleTheme } from "@pureadmin/theme/dist/browser-utils";
|
import { toggleTheme } from "@pureadmin/theme/dist/browser-utils";
|
||||||
|
import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
|
||||||
|
import { ref, unref, watch, reactive, computed, nextTick } from "vue";
|
||||||
|
import { useDataThemeChange } from "@/layout/hooks/useDataThemeChange";
|
||||||
|
|
||||||
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";
|
||||||
|
import Check from "@iconify-icons/ep/check";
|
||||||
|
import Logout from "@iconify-icons/ri/logout-circle-r-line";
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { device } = useNav();
|
|
||||||
const { isDark } = useDark();
|
const { isDark } = useDark();
|
||||||
const { isSelect } = useCssModule();
|
const { device, tooltipEffect } = useNav();
|
||||||
const { $storage } = useGlobal<GlobalPropertiesApi>();
|
const { $storage } = useGlobal<GlobalPropertiesApi>();
|
||||||
|
|
||||||
const mixRef = templateRef<HTMLElement | null>("mixRef", null);
|
const mixRef = ref();
|
||||||
const verticalRef = templateRef<HTMLElement | null>("verticalRef", null);
|
const verticalRef = ref();
|
||||||
const horizontalRef = templateRef<HTMLElement | null>("horizontalRef", null);
|
const horizontalRef = ref();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
body,
|
|
||||||
dataTheme,
|
dataTheme,
|
||||||
layoutTheme,
|
layoutTheme,
|
||||||
themeColors,
|
themeColors,
|
||||||
@@ -53,8 +45,8 @@ const {
|
|||||||
|
|
||||||
/* body添加layout属性,作用于src/style/sidebar.scss */
|
/* body添加layout属性,作用于src/style/sidebar.scss */
|
||||||
if (unref(layoutTheme)) {
|
if (unref(layoutTheme)) {
|
||||||
let layout = unref(layoutTheme).layout;
|
const layout = unref(layoutTheme).layout;
|
||||||
let theme = unref(layoutTheme).theme;
|
const theme = unref(layoutTheme).theme;
|
||||||
toggleTheme({
|
toggleTheme({
|
||||||
scopeName: `layout-theme-${theme}`
|
scopeName: `layout-theme-${theme}`
|
||||||
});
|
});
|
||||||
@@ -118,29 +110,30 @@ const weekChange = (value): void => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const tagsChange = () => {
|
const tagsChange = () => {
|
||||||
let showVal = settings.tabsVal;
|
const showVal = settings.tabsVal;
|
||||||
storageConfigureChange("hideTabs", showVal);
|
storageConfigureChange("hideTabs", showVal);
|
||||||
emitter.emit("tagViewsChange", showVal as unknown as string);
|
emitter.emit("tagViewsChange", showVal as unknown as string);
|
||||||
};
|
};
|
||||||
|
|
||||||
const multiTagsCacheChange = () => {
|
const multiTagsCacheChange = () => {
|
||||||
let multiTagsCache = settings.multiTagsCache;
|
const multiTagsCache = settings.multiTagsCache;
|
||||||
storageConfigureChange("multiTagsCache", multiTagsCache);
|
storageConfigureChange("multiTagsCache", multiTagsCache);
|
||||||
useMultiTagsStoreHook().multiTagsCacheChange(multiTagsCache);
|
useMultiTagsStoreHook().multiTagsCacheChange(multiTagsCache);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 清空缓存并返回登录页 */
|
/** 清空缓存并返回登录页 */
|
||||||
function onReset() {
|
function onReset() {
|
||||||
router.push("/login");
|
removeToken();
|
||||||
|
storageLocal.clear();
|
||||||
|
storageSession.clear();
|
||||||
const { Grey, Weak, MultiTagsCache, EpThemeColor, Layout } = getConfig();
|
const { Grey, Weak, MultiTagsCache, EpThemeColor, Layout } = getConfig();
|
||||||
useAppStoreHook().setLayout(Layout);
|
useAppStoreHook().setLayout(Layout);
|
||||||
setEpThemeColor(EpThemeColor);
|
setEpThemeColor(EpThemeColor);
|
||||||
useMultiTagsStoreHook().multiTagsCacheChange(MultiTagsCache);
|
useMultiTagsStoreHook().multiTagsCacheChange(MultiTagsCache);
|
||||||
toggleClass(Grey, "html-grey", document.querySelector("html"));
|
toggleClass(Grey, "html-grey", document.querySelector("html"));
|
||||||
toggleClass(Weak, "html-weakness", document.querySelector("html"));
|
toggleClass(Weak, "html-weakness", document.querySelector("html"));
|
||||||
|
router.push("/login");
|
||||||
useMultiTagsStoreHook().handleTags("equal", [...routerArrays]);
|
useMultiTagsStoreHook().handleTags("equal", [...routerArrays]);
|
||||||
storageLocal.clear();
|
|
||||||
storageSession.clear();
|
|
||||||
resetRouter();
|
resetRouter();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,32 +152,10 @@ function logoChange() {
|
|||||||
|
|
||||||
function setFalse(Doms): any {
|
function setFalse(Doms): any {
|
||||||
Doms.forEach(v => {
|
Doms.forEach(v => {
|
||||||
toggleClass(false, isSelect, unref(v));
|
toggleClass(false, "is-select", unref(v));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
watch($storage, ({ layout }) => {
|
|
||||||
/* 设置wangeditorV5主题色 */
|
|
||||||
body.style.setProperty("--w-e-toolbar-active-color", layout["epThemeColor"]);
|
|
||||||
switch (layout["layout"]) {
|
|
||||||
case "vertical":
|
|
||||||
toggleClass(true, isSelect, unref(verticalRef));
|
|
||||||
debounce(setFalse([horizontalRef]), 50);
|
|
||||||
debounce(setFalse([mixRef]), 50);
|
|
||||||
break;
|
|
||||||
case "horizontal":
|
|
||||||
toggleClass(true, isSelect, unref(horizontalRef));
|
|
||||||
debounce(setFalse([verticalRef]), 50);
|
|
||||||
debounce(setFalse([mixRef]), 50);
|
|
||||||
break;
|
|
||||||
case "mix":
|
|
||||||
toggleClass(true, isSelect, unref(mixRef));
|
|
||||||
debounce(setFalse([verticalRef]), 50);
|
|
||||||
debounce(setFalse([horizontalRef]), 50);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
/** 主题色 激活选择项 */
|
/** 主题色 激活选择项 */
|
||||||
const getThemeColor = computed(() => {
|
const getThemeColor = computed(() => {
|
||||||
return current => {
|
return current => {
|
||||||
@@ -227,6 +198,26 @@ nextTick(() => {
|
|||||||
settings.tabsVal && tagsChange();
|
settings.tabsVal && tagsChange();
|
||||||
dataThemeChange();
|
dataThemeChange();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
watch($storage, ({ layout }) => {
|
||||||
|
switch (layout["layout"]) {
|
||||||
|
case "vertical":
|
||||||
|
toggleClass(true, "is-select", unref(verticalRef));
|
||||||
|
debounce(setFalse([horizontalRef]), 50);
|
||||||
|
debounce(setFalse([mixRef]), 50);
|
||||||
|
break;
|
||||||
|
case "horizontal":
|
||||||
|
toggleClass(true, "is-select", unref(horizontalRef));
|
||||||
|
debounce(setFalse([verticalRef]), 50);
|
||||||
|
debounce(setFalse([mixRef]), 50);
|
||||||
|
break;
|
||||||
|
case "mix":
|
||||||
|
toggleClass(true, "is-select", unref(mixRef));
|
||||||
|
debounce(setFalse([verticalRef]), 50);
|
||||||
|
debounce(setFalse([horizontalRef]), 50);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -243,9 +234,15 @@ nextTick(() => {
|
|||||||
|
|
||||||
<el-divider>导航栏模式</el-divider>
|
<el-divider>导航栏模式</el-divider>
|
||||||
<ul class="pure-theme">
|
<ul class="pure-theme">
|
||||||
<el-tooltip class="item" content="左侧模式" placement="bottom">
|
<el-tooltip
|
||||||
|
:effect="tooltipEffect"
|
||||||
|
class="item"
|
||||||
|
content="左侧模式"
|
||||||
|
placement="bottom"
|
||||||
|
popper-class="pure-tooltip"
|
||||||
|
>
|
||||||
<li
|
<li
|
||||||
:class="layoutTheme.layout === 'vertical' ? $style.isSelect : ''"
|
:class="layoutTheme.layout === 'vertical' ? 'is-select' : ''"
|
||||||
ref="verticalRef"
|
ref="verticalRef"
|
||||||
@click="setLayoutModel('vertical')"
|
@click="setLayoutModel('vertical')"
|
||||||
>
|
>
|
||||||
@@ -256,12 +253,14 @@ nextTick(() => {
|
|||||||
|
|
||||||
<el-tooltip
|
<el-tooltip
|
||||||
v-if="device !== 'mobile'"
|
v-if="device !== 'mobile'"
|
||||||
|
:effect="tooltipEffect"
|
||||||
class="item"
|
class="item"
|
||||||
content="顶部模式"
|
content="顶部模式"
|
||||||
placement="bottom"
|
placement="bottom"
|
||||||
|
popper-class="pure-tooltip"
|
||||||
>
|
>
|
||||||
<li
|
<li
|
||||||
:class="layoutTheme.layout === 'horizontal' ? $style.isSelect : ''"
|
:class="layoutTheme.layout === 'horizontal' ? 'is-select' : ''"
|
||||||
ref="horizontalRef"
|
ref="horizontalRef"
|
||||||
@click="setLayoutModel('horizontal')"
|
@click="setLayoutModel('horizontal')"
|
||||||
>
|
>
|
||||||
@@ -272,12 +271,14 @@ nextTick(() => {
|
|||||||
|
|
||||||
<el-tooltip
|
<el-tooltip
|
||||||
v-if="device !== 'mobile'"
|
v-if="device !== 'mobile'"
|
||||||
|
:effect="tooltipEffect"
|
||||||
class="item"
|
class="item"
|
||||||
content="混合模式"
|
content="混合模式"
|
||||||
placement="bottom"
|
placement="bottom"
|
||||||
|
popper-class="pure-tooltip"
|
||||||
>
|
>
|
||||||
<li
|
<li
|
||||||
:class="layoutTheme.layout === 'mix' ? $style.isSelect : ''"
|
:class="layoutTheme.layout === 'mix' ? 'is-select' : ''"
|
||||||
ref="mixRef"
|
ref="mixRef"
|
||||||
@click="setLayoutModel('mix')"
|
@click="setLayoutModel('mix')"
|
||||||
>
|
>
|
||||||
@@ -301,7 +302,7 @@ nextTick(() => {
|
|||||||
:size="17"
|
:size="17"
|
||||||
:color="getThemeColor(item.themeColor)"
|
:color="getThemeColor(item.themeColor)"
|
||||||
>
|
>
|
||||||
<IconifyIconOffline icon="check" />
|
<IconifyIconOffline :icon="Check" />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -309,7 +310,7 @@ nextTick(() => {
|
|||||||
<el-divider>界面显示</el-divider>
|
<el-divider>界面显示</el-divider>
|
||||||
<ul class="setting">
|
<ul class="setting">
|
||||||
<li>
|
<li>
|
||||||
<span>灰色模式</span>
|
<span class="dark:text-white">灰色模式</span>
|
||||||
<el-switch
|
<el-switch
|
||||||
v-model="settings.greyVal"
|
v-model="settings.greyVal"
|
||||||
inline-prompt
|
inline-prompt
|
||||||
@@ -320,7 +321,7 @@ nextTick(() => {
|
|||||||
/>
|
/>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<span>色弱模式</span>
|
<span class="dark:text-white">色弱模式</span>
|
||||||
<el-switch
|
<el-switch
|
||||||
v-model="settings.weakVal"
|
v-model="settings.weakVal"
|
||||||
inline-prompt
|
inline-prompt
|
||||||
@@ -331,7 +332,7 @@ nextTick(() => {
|
|||||||
/>
|
/>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<span>隐藏标签页</span>
|
<span class="dark:text-white">隐藏标签页</span>
|
||||||
<el-switch
|
<el-switch
|
||||||
v-model="settings.tabsVal"
|
v-model="settings.tabsVal"
|
||||||
inline-prompt
|
inline-prompt
|
||||||
@@ -342,7 +343,7 @@ nextTick(() => {
|
|||||||
/>
|
/>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<span>侧边栏Logo</span>
|
<span class="dark:text-white">侧边栏Logo</span>
|
||||||
<el-switch
|
<el-switch
|
||||||
v-model="logoVal"
|
v-model="logoVal"
|
||||||
inline-prompt
|
inline-prompt
|
||||||
@@ -355,7 +356,7 @@ nextTick(() => {
|
|||||||
/>
|
/>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<span>标签页持久化</span>
|
<span class="dark:text-white">标签页持久化</span>
|
||||||
<el-switch
|
<el-switch
|
||||||
v-model="settings.multiTagsCache"
|
v-model="settings.multiTagsCache"
|
||||||
inline-prompt
|
inline-prompt
|
||||||
@@ -367,7 +368,7 @@ nextTick(() => {
|
|||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<span>标签风格</span>
|
<span class="dark:text-white">标签风格</span>
|
||||||
<el-radio-group v-model="markValue" size="small" @change="onChange">
|
<el-radio-group v-model="markValue" size="small" @change="onChange">
|
||||||
<el-radio label="card">卡片</el-radio>
|
<el-radio label="card">卡片</el-radio>
|
||||||
<el-radio label="smart">灵动</el-radio>
|
<el-radio label="smart">灵动</el-radio>
|
||||||
@@ -382,7 +383,7 @@ nextTick(() => {
|
|||||||
@click="onReset"
|
@click="onReset"
|
||||||
>
|
>
|
||||||
<IconifyIconOffline
|
<IconifyIconOffline
|
||||||
icon="fa-sign-out"
|
:icon="Logout"
|
||||||
width="15"
|
width="15"
|
||||||
height="15"
|
height="15"
|
||||||
style="margin-right: 4px"
|
style="margin-right: 4px"
|
||||||
@@ -392,13 +393,16 @@ nextTick(() => {
|
|||||||
</panel>
|
</panel>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped module>
|
<style lang="scss" scoped>
|
||||||
.isSelect {
|
:deep(.el-divider__text) {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.is-select {
|
||||||
border: 2px solid var(--el-color-primary);
|
border: 2px solid var(--el-color-primary);
|
||||||
}
|
}
|
||||||
</style>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.setting {
|
.setting {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
@@ -410,11 +414,6 @@ nextTick(() => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.el-divider__text) {
|
|
||||||
font-size: 16px;
|
|
||||||
font-weight: 700;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pure-datatheme {
|
.pure-datatheme {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 50px;
|
height: 50px;
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { isEqual } from "lodash-unified";
|
import { isEqual } from "@pureadmin/utils";
|
||||||
import { transformI18n } from "/@/plugins/i18n";
|
|
||||||
import { ref, watch, onMounted, toRaw } from "vue";
|
import { ref, watch, onMounted, toRaw } from "vue";
|
||||||
import { getParentPaths, findRouteByPath } from "/@/router/utils";
|
import { getParentPaths, findRouteByPath } from "@/router/utils";
|
||||||
import { useMultiTagsStoreHook } from "/@/store/modules/multiTags";
|
import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
|
||||||
import { useRoute, useRouter, RouteLocationMatched } from "vue-router";
|
import { useRoute, useRouter, RouteLocationMatched } from "vue-router";
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
@@ -53,7 +52,7 @@ const getBreadcrumb = (): void => {
|
|||||||
{
|
{
|
||||||
path: "/welcome",
|
path: "/welcome",
|
||||||
parentPath: "/",
|
parentPath: "/",
|
||||||
meta: { title: "menus.hshome" }
|
meta: { title: "首页" }
|
||||||
} as unknown as RouteLocationMatched
|
} as unknown as RouteLocationMatched
|
||||||
].concat(matched);
|
].concat(matched);
|
||||||
}
|
}
|
||||||
@@ -97,10 +96,14 @@ watch(
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<el-breadcrumb class="!leading-[50px] select-none" separator="/">
|
<el-breadcrumb class="!leading-[50px] select-none" separator="/">
|
||||||
<transition-group appear name="breadcrumb">
|
<transition-group name="breadcrumb">
|
||||||
<el-breadcrumb-item v-for="item in levelList" :key="item.path">
|
<el-breadcrumb-item
|
||||||
|
class="!inline !items-stretch"
|
||||||
|
v-for="item in levelList"
|
||||||
|
:key="item.path"
|
||||||
|
>
|
||||||
<a @click.prevent="handleLink(item)">
|
<a @click.prevent="handleLink(item)">
|
||||||
{{ transformI18n(item.meta.title) }}
|
{{ item.meta.title }}
|
||||||
</a>
|
</a>
|
||||||
</el-breadcrumb-item>
|
</el-breadcrumb-item>
|
||||||
</transition-group>
|
</transition-group>
|
||||||
|
|||||||
@@ -1,21 +1,17 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, watch } from "vue";
|
|
||||||
import Search from "../search/index.vue";
|
import Search from "../search/index.vue";
|
||||||
import Notice from "../notice/index.vue";
|
import Notice from "../notice/index.vue";
|
||||||
|
import { ref, watch, nextTick } from "vue";
|
||||||
import SidebarItem from "./sidebarItem.vue";
|
import SidebarItem from "./sidebarItem.vue";
|
||||||
import avatars from "/@/assets/avatars.jpg";
|
import { useNav } from "@/layout/hooks/useNav";
|
||||||
import { useNav } from "/@/layout/hooks/useNav";
|
import { usePermissionStoreHook } from "@/store/modules/permission";
|
||||||
import screenfull from "../screenfull/index.vue";
|
import LogoutCircleRLine from "@iconify-icons/ri/logout-circle-r-line";
|
||||||
import { deviceDetection } from "@pureadmin/utils";
|
import Setting from "@iconify-icons/ri/settings-3-line";
|
||||||
import { useTranslationLang } from "../../hooks/useTranslationLang";
|
|
||||||
import { usePermissionStoreHook } from "/@/store/modules/permission";
|
|
||||||
import globalization from "/@/assets/svg/globalization.svg?component";
|
|
||||||
|
|
||||||
const menuRef = ref();
|
const menuRef = ref();
|
||||||
|
|
||||||
const { t, route, locale, translationCh, translationEn } =
|
|
||||||
useTranslationLang(menuRef);
|
|
||||||
const {
|
const {
|
||||||
|
route,
|
||||||
title,
|
title,
|
||||||
routers,
|
routers,
|
||||||
logout,
|
logout,
|
||||||
@@ -23,11 +19,13 @@ const {
|
|||||||
onPanel,
|
onPanel,
|
||||||
menuSelect,
|
menuSelect,
|
||||||
username,
|
username,
|
||||||
avatarsStyle,
|
avatarsStyle
|
||||||
getDropdownItemStyle,
|
|
||||||
getDropdownItemClass
|
|
||||||
} = useNav();
|
} = useNav();
|
||||||
|
|
||||||
|
nextTick(() => {
|
||||||
|
menuRef.value?.handleResize();
|
||||||
|
});
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => route.path,
|
() => route.path,
|
||||||
() => {
|
() => {
|
||||||
@@ -62,84 +60,39 @@ watch(
|
|||||||
<Search />
|
<Search />
|
||||||
<!-- 通知 -->
|
<!-- 通知 -->
|
||||||
<Notice id="header-notice" />
|
<Notice id="header-notice" />
|
||||||
<!-- 全屏 -->
|
|
||||||
<screenfull id="header-screenfull" v-show="!deviceDetection()" />
|
|
||||||
<!-- 国际化 -->
|
|
||||||
<el-dropdown id="header-translation" trigger="click">
|
|
||||||
<globalization
|
|
||||||
class="navbar-bg-hover w-40px h-48px p-11px cursor-pointer outline-none"
|
|
||||||
/>
|
|
||||||
<template #dropdown>
|
|
||||||
<el-dropdown-menu class="translation">
|
|
||||||
<el-dropdown-item
|
|
||||||
:style="getDropdownItemStyle(locale, 'zh')"
|
|
||||||
:class="['!dark:color-white', getDropdownItemClass(locale, 'zh')]"
|
|
||||||
@click="translationCh"
|
|
||||||
>
|
|
||||||
<span class="check-zh" v-show="locale === 'zh'">
|
|
||||||
<IconifyIconOffline icon="check" />
|
|
||||||
</span>
|
|
||||||
简体中文
|
|
||||||
</el-dropdown-item>
|
|
||||||
<el-dropdown-item
|
|
||||||
:style="getDropdownItemStyle(locale, 'en')"
|
|
||||||
:class="['!dark:color-white', getDropdownItemClass(locale, 'en')]"
|
|
||||||
@click="translationEn"
|
|
||||||
>
|
|
||||||
<span class="check-en" v-show="locale === 'en'">
|
|
||||||
<IconifyIconOffline icon="check" />
|
|
||||||
</span>
|
|
||||||
English
|
|
||||||
</el-dropdown-item>
|
|
||||||
</el-dropdown-menu>
|
|
||||||
</template>
|
|
||||||
</el-dropdown>
|
|
||||||
<!-- 退出登录 -->
|
<!-- 退出登录 -->
|
||||||
<el-dropdown trigger="click">
|
<el-dropdown trigger="click">
|
||||||
<span class="el-dropdown-link navbar-bg-hover">
|
<span class="el-dropdown-link navbar-bg-hover">
|
||||||
<img v-if="avatars" :src="avatars" :style="avatarsStyle" />
|
<img
|
||||||
<p v-if="username" class="dark:color-white">{{ username }}</p>
|
src="https://avatars.githubusercontent.com/u/44761321?v=4"
|
||||||
|
:style="avatarsStyle"
|
||||||
|
/>
|
||||||
|
<p v-if="username" class="dark:text-white">{{ username }}</p>
|
||||||
</span>
|
</span>
|
||||||
<template #dropdown>
|
<template #dropdown>
|
||||||
<el-dropdown-menu class="logout">
|
<el-dropdown-menu class="logout">
|
||||||
<el-dropdown-item @click="logout">
|
<el-dropdown-item @click="logout">
|
||||||
<IconifyIconOffline
|
<IconifyIconOffline
|
||||||
icon="logout-circle-r-line"
|
:icon="LogoutCircleRLine"
|
||||||
style="margin: 5px"
|
style="margin: 5px"
|
||||||
/>
|
/>
|
||||||
{{ t("buttons.hsLoginOut") }}
|
退出系统
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</template>
|
</template>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
<span
|
<span
|
||||||
class="el-icon-setting navbar-bg-hover"
|
class="set-icon navbar-bg-hover"
|
||||||
:title="t('buttons.hssystemSet')"
|
title="打开项目配置"
|
||||||
@click="onPanel"
|
@click="onPanel"
|
||||||
>
|
>
|
||||||
<IconifyIconOffline icon="setting" />
|
<IconifyIconOffline :icon="Setting" />
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.translation {
|
|
||||||
::v-deep(.el-dropdown-menu__item) {
|
|
||||||
padding: 5px 40px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.check-zh {
|
|
||||||
position: absolute;
|
|
||||||
left: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.check-en {
|
|
||||||
position: absolute;
|
|
||||||
left: 20px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.logout {
|
.logout {
|
||||||
max-width: 120px;
|
max-width: 120px;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useDark } from "@pureadmin/utils";
|
import { ref, computed } from "vue";
|
||||||
|
import { useNav } from "@/layout/hooks/useNav";
|
||||||
|
import MenuFold from "@iconify-icons/ri/menu-fold-fill";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
isActive: boolean;
|
isActive: boolean;
|
||||||
@@ -8,7 +10,25 @@ interface Props {
|
|||||||
const props = withDefaults(defineProps<Props>(), {
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
isActive: false
|
isActive: false
|
||||||
});
|
});
|
||||||
const { isDark } = useDark();
|
|
||||||
|
const visible = ref(false);
|
||||||
|
const { tooltipEffect } = useNav();
|
||||||
|
|
||||||
|
const iconClass = computed(() => {
|
||||||
|
return [
|
||||||
|
"ml-4",
|
||||||
|
"mb-1",
|
||||||
|
"w-[16px]",
|
||||||
|
"h-[16px]",
|
||||||
|
"inline-block",
|
||||||
|
"align-middle",
|
||||||
|
"text-primary",
|
||||||
|
"cursor-pointer",
|
||||||
|
"duration-[360ms]",
|
||||||
|
"hover:text-primary",
|
||||||
|
"dark:hover:!text-white"
|
||||||
|
];
|
||||||
|
});
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: "toggleClick"): void;
|
(e: "toggleClick"): void;
|
||||||
@@ -23,13 +43,17 @@ const toggleClick = () => {
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
<el-tooltip
|
<el-tooltip
|
||||||
placement="right"
|
placement="right"
|
||||||
:effect="isDark ? 'dark' : 'light'"
|
:visible="visible"
|
||||||
|
:effect="tooltipEffect"
|
||||||
:content="props.isActive ? '点击折叠' : '点击展开'"
|
:content="props.isActive ? '点击折叠' : '点击展开'"
|
||||||
>
|
>
|
||||||
<IconifyIconOffline
|
<IconifyIconOffline
|
||||||
:icon="props.isActive ? 'menu-fold' : 'menu-unfold'"
|
:icon="MenuFold"
|
||||||
class="cursor-pointer inline-block align-middle color-primary hover:color-primary !dark:hover:color-white w-16px h-16px ml-4 mb-1"
|
:class="iconClass"
|
||||||
|
:style="{ transform: props.isActive ? 'none' : 'rotateY(180deg)' }"
|
||||||
@click="toggleClick"
|
@click="toggleClick"
|
||||||
|
@mouseenter="visible = true"
|
||||||
|
@mouseleave="visible = false"
|
||||||
/>
|
/>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useNav } from "/@/layout/hooks/useNav";
|
import { useNav } from "@/layout/hooks/useNav";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
collapse: Boolean
|
collapse: Boolean
|
||||||
@@ -9,7 +9,7 @@ const { title } = useNav();
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="sidebar-logo-container" :class="{ collapse: props.collapse }">
|
<div class="sidebar-logo-container" :class="{ collapses: props.collapse }">
|
||||||
<transition name="sidebarLogoFade">
|
<transition name="sidebarLogoFade">
|
||||||
<router-link
|
<router-link
|
||||||
v-if="props.collapse"
|
v-if="props.collapse"
|
||||||
@@ -51,6 +51,12 @@ const { title } = useNav();
|
|||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
|
|
||||||
.sidebar-title {
|
.sidebar-title {
|
||||||
|
display: block;
|
||||||
|
width: 160px;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-align: left;
|
||||||
color: #1890ff;
|
color: #1890ff;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
@@ -59,7 +65,7 @@ const { title } = useNav();
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.collapse {
|
.collapses {
|
||||||
.sidebar-logo {
|
.sidebar-logo {
|
||||||
margin-right: 0;
|
margin-right: 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,24 +1,19 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import Search from "../search/index.vue";
|
import Search from "../search/index.vue";
|
||||||
import Notice from "../notice/index.vue";
|
import Notice from "../notice/index.vue";
|
||||||
import avatars from "/@/assets/avatars.jpg";
|
import { useNav } from "@/layout/hooks/useNav";
|
||||||
import { useNav } from "/@/layout/hooks/useNav";
|
import { ref, toRaw, watch, onMounted, nextTick } from "vue";
|
||||||
import { transformI18n } from "/@/plugins/i18n";
|
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
|
||||||
import screenfull from "../screenfull/index.vue";
|
import { getParentPaths, findRouteByPath } from "@/router/utils";
|
||||||
import { deviceDetection } from "@pureadmin/utils";
|
import { usePermissionStoreHook } from "@/store/modules/permission";
|
||||||
import { ref, toRaw, watch, onMounted } from "vue";
|
import LogoutCircleRLine from "@iconify-icons/ri/logout-circle-r-line";
|
||||||
import { useRenderIcon } from "/@/components/ReIcon/src/hooks";
|
import Setting from "@iconify-icons/ri/settings-3-line";
|
||||||
import { getParentPaths, findRouteByPath } from "/@/router/utils";
|
|
||||||
import { useTranslationLang } from "../../hooks/useTranslationLang";
|
|
||||||
import { usePermissionStoreHook } from "/@/store/modules/permission";
|
|
||||||
import globalization from "/@/assets/svg/globalization.svg?component";
|
|
||||||
|
|
||||||
const menuRef = ref();
|
const menuRef = ref();
|
||||||
let defaultActive = ref(null);
|
const defaultActive = ref(null);
|
||||||
|
|
||||||
const { t, route, locale, translationCh, translationEn } =
|
|
||||||
useTranslationLang(menuRef);
|
|
||||||
const {
|
const {
|
||||||
|
route,
|
||||||
device,
|
device,
|
||||||
routers,
|
routers,
|
||||||
logout,
|
logout,
|
||||||
@@ -26,9 +21,7 @@ const {
|
|||||||
menuSelect,
|
menuSelect,
|
||||||
resolvePath,
|
resolvePath,
|
||||||
username,
|
username,
|
||||||
avatarsStyle,
|
avatarsStyle
|
||||||
getDropdownItemStyle,
|
|
||||||
getDropdownItemClass
|
|
||||||
} = useNav();
|
} = useNav();
|
||||||
|
|
||||||
function getDefaultActive(routePath) {
|
function getDefaultActive(routePath) {
|
||||||
@@ -45,8 +38,12 @@ onMounted(() => {
|
|||||||
getDefaultActive(route.path);
|
getDefaultActive(route.path);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
nextTick(() => {
|
||||||
|
menuRef.value?.handleResize();
|
||||||
|
});
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => route.path,
|
() => [route.path, usePermissionStoreHook().wholeMenus],
|
||||||
() => {
|
() => {
|
||||||
getDefaultActive(route.path);
|
getDefaultActive(route.path);
|
||||||
}
|
}
|
||||||
@@ -77,7 +74,7 @@ watch(
|
|||||||
:is="useRenderIcon(route.meta && toRaw(route.meta.icon))"
|
:is="useRenderIcon(route.meta && toRaw(route.meta.icon))"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<span class="select-none">{{ transformI18n(route.meta.title) }}</span>
|
<span class="select-none">{{ route.meta.title }}</span>
|
||||||
<FontIcon
|
<FontIcon
|
||||||
v-if="route.meta.extraIcon"
|
v-if="route.meta.extraIcon"
|
||||||
width="30px"
|
width="30px"
|
||||||
@@ -94,84 +91,39 @@ watch(
|
|||||||
<Search />
|
<Search />
|
||||||
<!-- 通知 -->
|
<!-- 通知 -->
|
||||||
<Notice id="header-notice" />
|
<Notice id="header-notice" />
|
||||||
<!-- 全屏 -->
|
|
||||||
<screenfull id="header-screenfull" v-show="!deviceDetection()" />
|
|
||||||
<!-- 国际化 -->
|
|
||||||
<el-dropdown id="header-translation" trigger="click">
|
|
||||||
<globalization
|
|
||||||
class="navbar-bg-hover w-40px h-48px p-11px cursor-pointer outline-none"
|
|
||||||
/>
|
|
||||||
<template #dropdown>
|
|
||||||
<el-dropdown-menu class="translation">
|
|
||||||
<el-dropdown-item
|
|
||||||
:style="getDropdownItemStyle(locale, 'zh')"
|
|
||||||
:class="['!dark:color-white', getDropdownItemClass(locale, 'zh')]"
|
|
||||||
@click="translationCh"
|
|
||||||
>
|
|
||||||
<span class="check-zh" v-show="locale === 'zh'">
|
|
||||||
<IconifyIconOffline icon="check" />
|
|
||||||
</span>
|
|
||||||
简体中文
|
|
||||||
</el-dropdown-item>
|
|
||||||
<el-dropdown-item
|
|
||||||
:style="getDropdownItemStyle(locale, 'en')"
|
|
||||||
:class="['!dark:color-white', getDropdownItemClass(locale, 'en')]"
|
|
||||||
@click="translationEn"
|
|
||||||
>
|
|
||||||
<span class="check-en" v-show="locale === 'en'">
|
|
||||||
<IconifyIconOffline icon="check" />
|
|
||||||
</span>
|
|
||||||
English
|
|
||||||
</el-dropdown-item>
|
|
||||||
</el-dropdown-menu>
|
|
||||||
</template>
|
|
||||||
</el-dropdown>
|
|
||||||
<!-- 退出登录 -->
|
<!-- 退出登录 -->
|
||||||
<el-dropdown trigger="click">
|
<el-dropdown trigger="click">
|
||||||
<span class="el-dropdown-link navbar-bg-hover">
|
<span class="el-dropdown-link navbar-bg-hover select-none">
|
||||||
<img v-if="avatars" :src="avatars" :style="avatarsStyle" />
|
<img
|
||||||
<p v-if="username" class="dark:color-white">{{ username }}</p>
|
src="https://avatars.githubusercontent.com/u/44761321?v=4"
|
||||||
|
:style="avatarsStyle"
|
||||||
|
/>
|
||||||
|
<p v-if="username" class="dark:text-white">{{ username }}</p>
|
||||||
</span>
|
</span>
|
||||||
<template #dropdown>
|
<template #dropdown>
|
||||||
<el-dropdown-menu class="logout">
|
<el-dropdown-menu class="logout">
|
||||||
<el-dropdown-item @click="logout">
|
<el-dropdown-item @click="logout">
|
||||||
<IconifyIconOffline
|
<IconifyIconOffline
|
||||||
icon="logout-circle-r-line"
|
:icon="LogoutCircleRLine"
|
||||||
style="margin: 5px"
|
style="margin: 5px"
|
||||||
/>
|
/>
|
||||||
{{ t("buttons.hsLoginOut") }}
|
退出系统
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</template>
|
</template>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
<span
|
<span
|
||||||
class="el-icon-setting navbar-bg-hover"
|
class="set-icon navbar-bg-hover"
|
||||||
:title="t('buttons.hssystemSet')"
|
title="打开项目配置"
|
||||||
@click="onPanel"
|
@click="onPanel"
|
||||||
>
|
>
|
||||||
<IconifyIconOffline icon="setting" />
|
<IconifyIconOffline :icon="Setting" />
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.translation {
|
|
||||||
::v-deep(.el-dropdown-menu__item) {
|
|
||||||
padding: 5px 40px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.check-zh {
|
|
||||||
position: absolute;
|
|
||||||
left: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.check-en {
|
|
||||||
position: absolute;
|
|
||||||
left: 20px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.logout {
|
.logout {
|
||||||
max-width: 120px;
|
max-width: 120px;
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,17 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import path from "path";
|
import path from "path";
|
||||||
|
import { getConfig } from "@/config";
|
||||||
import { childrenType } from "../../types";
|
import { childrenType } from "../../types";
|
||||||
import { useNav } from "/@/layout/hooks/useNav";
|
import { useNav } from "@/layout/hooks/useNav";
|
||||||
import { transformI18n } from "/@/plugins/i18n";
|
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
|
||||||
import { useRenderIcon } from "/@/components/ReIcon/src/hooks";
|
|
||||||
import { ref, toRaw, PropType, nextTick, computed, CSSProperties } from "vue";
|
import { ref, toRaw, PropType, nextTick, computed, CSSProperties } from "vue";
|
||||||
|
|
||||||
const { layout, isCollapse } = useNav();
|
import ArrowUp from "@iconify-icons/ep/arrow-up";
|
||||||
|
import EpArrowDown from "@iconify-icons/ep/arrow-down";
|
||||||
|
import ArrowLeft from "@iconify-icons/ep/arrow-left";
|
||||||
|
import ArrowRight from "@iconify-icons/ep/arrow-right";
|
||||||
|
|
||||||
|
const { layout, isCollapse, tooltipEffect } = useNav();
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
item: {
|
item: {
|
||||||
@@ -76,6 +81,16 @@ const getSpanStyle = computed(() => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const expandCloseIcon = computed(() => {
|
||||||
|
if (!getConfig()?.MenuArrowIconNoTransition) return "";
|
||||||
|
return {
|
||||||
|
"expand-close-icon": useRenderIcon(EpArrowDown),
|
||||||
|
"expand-open-icon": useRenderIcon(ArrowUp),
|
||||||
|
"collapse-close-icon": useRenderIcon(ArrowRight),
|
||||||
|
"collapse-open-icon": useRenderIcon(ArrowLeft)
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
const onlyOneChild: childrenType = ref(null);
|
const onlyOneChild: childrenType = ref(null);
|
||||||
// 存放菜单是否存在showTooltip属性标识
|
// 存放菜单是否存在showTooltip属性标识
|
||||||
const hoverMenuMap = new WeakMap();
|
const hoverMenuMap = new WeakMap();
|
||||||
@@ -164,7 +179,7 @@ function resolvePath(routePath) {
|
|||||||
:style="getDivStyle"
|
:style="getDivStyle"
|
||||||
>
|
>
|
||||||
<span :style="getMenuTextStyle">
|
<span :style="getMenuTextStyle">
|
||||||
{{ transformI18n(onlyOneChild.meta.title) }}
|
{{ onlyOneChild.meta.title }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
@@ -174,29 +189,30 @@ function resolvePath(routePath) {
|
|||||||
:style="getDivStyle"
|
:style="getDivStyle"
|
||||||
>
|
>
|
||||||
<span :style="getMenuTextStyle">
|
<span :style="getMenuTextStyle">
|
||||||
{{ transformI18n(onlyOneChild.meta.title) }}
|
{{ onlyOneChild.meta.title }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<template #title>
|
<template #title>
|
||||||
<div :style="getDivStyle">
|
<div :style="getDivStyle">
|
||||||
<span v-if="layout === 'horizontal'">
|
<span v-if="layout === 'horizontal'">
|
||||||
{{ transformI18n(onlyOneChild.meta.title) }}
|
{{ onlyOneChild.meta.title }}
|
||||||
</span>
|
</span>
|
||||||
<el-tooltip
|
<el-tooltip
|
||||||
v-else
|
v-else
|
||||||
placement="top"
|
placement="top"
|
||||||
|
:effect="tooltipEffect"
|
||||||
:offset="-10"
|
:offset="-10"
|
||||||
:disabled="!onlyOneChild.showTooltip"
|
:disabled="!isCollapse && !onlyOneChild.showTooltip"
|
||||||
>
|
>
|
||||||
<template #content>
|
<template #content>
|
||||||
{{ transformI18n(onlyOneChild.meta.title) }}
|
{{ onlyOneChild.meta.title }}
|
||||||
</template>
|
</template>
|
||||||
<span
|
<span
|
||||||
ref="menuTextRef"
|
ref="menuTextRef"
|
||||||
:style="getMenuTextStyle"
|
:style="getMenuTextStyle"
|
||||||
@mouseover="hoverMenu(onlyOneChild)"
|
@mouseover="hoverMenu(onlyOneChild)"
|
||||||
>
|
>
|
||||||
{{ transformI18n(onlyOneChild.meta.title) }}
|
{{ onlyOneChild.meta.title }}
|
||||||
</span>
|
</span>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<FontIcon
|
<FontIcon
|
||||||
@@ -212,7 +228,12 @@ function resolvePath(routePath) {
|
|||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<el-sub-menu v-else ref="subMenu" :index="resolvePath(props.item.path)">
|
<el-sub-menu
|
||||||
|
v-else
|
||||||
|
ref="subMenu"
|
||||||
|
v-bind="expandCloseIcon"
|
||||||
|
:index="resolvePath(props.item.path)"
|
||||||
|
>
|
||||||
<template #title>
|
<template #title>
|
||||||
<div v-if="toRaw(props.item.meta.icon)" class="sub-menu-icon">
|
<div v-if="toRaw(props.item.meta.icon)" class="sub-menu-icon">
|
||||||
<component
|
<component
|
||||||
@@ -220,16 +241,17 @@ function resolvePath(routePath) {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<span v-if="layout === 'horizontal'">
|
<span v-if="layout === 'horizontal'">
|
||||||
{{ transformI18n(props.item.meta.title) }}
|
{{ props.item.meta.title }}
|
||||||
</span>
|
</span>
|
||||||
<el-tooltip
|
<el-tooltip
|
||||||
v-else
|
v-else
|
||||||
placement="top"
|
placement="top"
|
||||||
|
:effect="tooltipEffect"
|
||||||
:offset="-10"
|
:offset="-10"
|
||||||
:disabled="!isCollapse || !props.item.showTooltip"
|
:disabled="!props.item.showTooltip"
|
||||||
>
|
>
|
||||||
<template #content>
|
<template #content>
|
||||||
{{ transformI18n(props.item.meta.title) }}
|
{{ props.item.meta.title }}
|
||||||
</template>
|
</template>
|
||||||
<div
|
<div
|
||||||
ref="menuTextRef"
|
ref="menuTextRef"
|
||||||
@@ -237,7 +259,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.title }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import MenuFold from "@iconify-icons/ri/menu-fold-fill";
|
||||||
|
import MenuUnfold from "@iconify-icons/ri/menu-unfold-fill";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
isActive: boolean;
|
isActive: boolean;
|
||||||
}
|
}
|
||||||
@@ -23,8 +26,8 @@ const toggleClick = () => {
|
|||||||
@click="toggleClick"
|
@click="toggleClick"
|
||||||
>
|
>
|
||||||
<IconifyIconOffline
|
<IconifyIconOffline
|
||||||
:icon="props.isActive ? 'menu-fold' : 'menu-unfold'"
|
:icon="props.isActive ? MenuFold : MenuUnfold"
|
||||||
class="inline-block align-middle hover:color-primary !dark:hover:color-white"
|
class="inline-block align-middle hover:text-primary dark:hover:!text-white"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,15 +1,14 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import Logo from "./logo.vue";
|
import Logo from "./logo.vue";
|
||||||
import { useRoute } from "vue-router";
|
import { useRoute } from "vue-router";
|
||||||
import { emitter } from "/@/utils/mitt";
|
import { emitter } from "@/utils/mitt";
|
||||||
import SidebarItem from "./sidebarItem.vue";
|
import SidebarItem from "./sidebarItem.vue";
|
||||||
import leftCollapse from "./leftCollapse.vue";
|
import leftCollapse from "./leftCollapse.vue";
|
||||||
import type { StorageConfigs } from "/#/index";
|
import { useNav } from "@/layout/hooks/useNav";
|
||||||
import { useNav } from "/@/layout/hooks/useNav";
|
|
||||||
import { storageLocal } from "@pureadmin/utils";
|
import { storageLocal } from "@pureadmin/utils";
|
||||||
import { ref, computed, watch, onBeforeMount } from "vue";
|
import { ref, computed, watch, onBeforeMount } from "vue";
|
||||||
import { findRouteByPath, getParentPaths } from "/@/router/utils";
|
import { findRouteByPath, getParentPaths } from "@/router/utils";
|
||||||
import { usePermissionStoreHook } from "/@/store/modules/permission";
|
import { usePermissionStoreHook } from "@/store/modules/permission";
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const showLogo = ref(
|
const showLogo = ref(
|
||||||
@@ -19,7 +18,7 @@ const showLogo = ref(
|
|||||||
const { routers, device, pureApp, isCollapse, menuSelect, toggleSideBar } =
|
const { routers, device, pureApp, isCollapse, menuSelect, toggleSideBar } =
|
||||||
useNav();
|
useNav();
|
||||||
|
|
||||||
let subMenuData = ref([]);
|
const subMenuData = ref([]);
|
||||||
|
|
||||||
const menuData = computed(() => {
|
const menuData = computed(() => {
|
||||||
return pureApp.layout === "mix" && device.value !== "mobile"
|
return pureApp.layout === "mix" && device.value !== "mobile"
|
||||||
@@ -27,7 +26,7 @@ const menuData = computed(() => {
|
|||||||
: usePermissionStoreHook().wholeMenus;
|
: usePermissionStoreHook().wholeMenus;
|
||||||
});
|
});
|
||||||
|
|
||||||
function getSubMenuData(path) {
|
function getSubMenuData(path: string) {
|
||||||
// path的上级路由组成的数组
|
// path的上级路由组成的数组
|
||||||
const parentPathArr = getParentPaths(
|
const parentPathArr = getParentPaths(
|
||||||
path,
|
path,
|
||||||
@@ -41,6 +40,7 @@ function getSubMenuData(path) {
|
|||||||
if (!parenetRoute?.children) return;
|
if (!parenetRoute?.children) return;
|
||||||
subMenuData.value = parenetRoute?.children;
|
subMenuData.value = parenetRoute?.children;
|
||||||
}
|
}
|
||||||
|
|
||||||
getSubMenuData(route.path);
|
getSubMenuData(route.path);
|
||||||
|
|
||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
@@ -50,7 +50,7 @@ onBeforeMount(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => route.path,
|
() => [route.path, usePermissionStoreHook().wholeMenus],
|
||||||
() => {
|
() => {
|
||||||
getSubMenuData(route.path);
|
getSubMenuData(route.path);
|
||||||
menuSelect(route.path, routers);
|
menuSelect(route.path, routers);
|
||||||
|
|||||||
@@ -121,21 +121,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.right-button {
|
|
||||||
display: flex;
|
|
||||||
font-size: 16px;
|
|
||||||
|
|
||||||
li {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
width: 40px;
|
|
||||||
height: 38px;
|
|
||||||
border-right: 1px solid #ccc;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 右键菜单 */
|
/* 右键菜单 */
|
||||||
.contextmenu {
|
.contextmenu {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
@@ -196,6 +181,9 @@
|
|||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:deep(.el-dropdown-menu__item--divided) {
|
||||||
|
margin: 1px 0;
|
||||||
|
}
|
||||||
.el-dropdown-menu__item--divided::before {
|
.el-dropdown-menu__item--divided::before {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
@@ -223,7 +211,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.arrow-left,
|
.arrow-left,
|
||||||
.arrow-right {
|
.arrow-right,
|
||||||
|
.arrow-down {
|
||||||
width: 40px;
|
width: 40px;
|
||||||
height: 38px;
|
height: 38px;
|
||||||
color: var(--el-text-color-primary);
|
color: var(--el-text-color-primary);
|
||||||
@@ -248,7 +237,7 @@
|
|||||||
|
|
||||||
.arrow-right {
|
.arrow-right {
|
||||||
box-shadow: -5px 0 5px -6px #ccc;
|
box-shadow: -5px 0 5px -6px #ccc;
|
||||||
border-right: 1px solid #ccc;
|
border-right: 0.5px solid #ccc;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
cursor: e-resize;
|
cursor: e-resize;
|
||||||
@@ -305,8 +294,3 @@
|
|||||||
background: var(--el-color-primary);
|
background: var(--el-color-primary);
|
||||||
animation: scheduleOutWidth 400ms ease-in;
|
animation: scheduleOutWidth 400ms ease-in;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 刷新按钮动画效果 */
|
|
||||||
.refresh-button {
|
|
||||||
animation: rotate 600ms linear infinite;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,16 +1,21 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { emitter } from "/@/utils/mitt";
|
import { emitter } from "@/utils/mitt";
|
||||||
import { RouteConfigs } from "../../types";
|
import { RouteConfigs } from "../../types";
|
||||||
import { useTags } from "../../hooks/useTag";
|
import { useTags } from "../../hooks/useTag";
|
||||||
import { routerArrays } from "/@/layout/types";
|
import { routerArrays } from "@/layout/types";
|
||||||
import { isEqual, isEmpty } from "lodash-unified";
|
import { isEqual, isEmpty } from "lodash-unified";
|
||||||
import { toggleClass, removeClass } from "@pureadmin/utils";
|
import { useSettingStoreHook } from "@/store/modules/settings";
|
||||||
import { useResizeObserver, useDebounceFn } from "@vueuse/core";
|
import { ref, watch, unref, nextTick, onBeforeMount } from "vue";
|
||||||
import { useSettingStoreHook } from "/@/store/modules/settings";
|
import { handleAliveRoute, delAliveRoutes } from "@/router/utils";
|
||||||
import { handleAliveRoute, delAliveRoutes } from "/@/router/utils";
|
import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
|
||||||
import { useMultiTagsStoreHook } from "/@/store/modules/multiTags";
|
import { useResizeObserver, useDebounceFn, useFullscreen } from "@vueuse/core";
|
||||||
import { usePermissionStoreHook } from "/@/store/modules/permission";
|
|
||||||
import { ref, watch, unref, toRaw, nextTick, onBeforeMount } from "vue";
|
import ExitFullscreen from "@iconify-icons/ri/fullscreen-exit-fill";
|
||||||
|
import Fullscreen from "@iconify-icons/ri/fullscreen-fill";
|
||||||
|
import ArrowDown from "@iconify-icons/ri/arrow-down-s-line";
|
||||||
|
import ArrowRightSLine from "@iconify-icons/ri/arrow-right-s-line";
|
||||||
|
import ArrowLeftSLine from "@iconify-icons/ri/arrow-left-s-line";
|
||||||
|
import CloseBold from "@iconify-icons/ep/close-bold";
|
||||||
|
|
||||||
const {
|
const {
|
||||||
route,
|
route,
|
||||||
@@ -24,6 +29,7 @@ const {
|
|||||||
buttonLeft,
|
buttonLeft,
|
||||||
showModel,
|
showModel,
|
||||||
translateX,
|
translateX,
|
||||||
|
pureSetting,
|
||||||
activeIndex,
|
activeIndex,
|
||||||
getTabStyle,
|
getTabStyle,
|
||||||
iconIsActive,
|
iconIsActive,
|
||||||
@@ -35,12 +41,14 @@ const {
|
|||||||
onMounted,
|
onMounted,
|
||||||
onMouseenter,
|
onMouseenter,
|
||||||
onMouseleave,
|
onMouseleave,
|
||||||
transformI18n
|
onContentFullScreen
|
||||||
} = useTags();
|
} = useTags();
|
||||||
|
|
||||||
const tabDom = ref();
|
const tabDom = ref();
|
||||||
const containerDom = ref();
|
const containerDom = ref();
|
||||||
const scrollbarDom = ref();
|
const scrollbarDom = ref();
|
||||||
|
const isShowArrow = ref(false);
|
||||||
|
const { isFullscreen, toggle } = useFullscreen();
|
||||||
|
|
||||||
const dynamicTagView = () => {
|
const dynamicTagView = () => {
|
||||||
const index = multiTags.value.findIndex(item => {
|
const index = multiTags.value.findIndex(item => {
|
||||||
@@ -67,6 +75,9 @@ const moveToView = (index: number): void => {
|
|||||||
: 0;
|
: 0;
|
||||||
// 已有标签页总长度(包含溢出部分)
|
// 已有标签页总长度(包含溢出部分)
|
||||||
const tabDomWidth = tabDom.value ? tabDom.value?.offsetWidth : 0;
|
const tabDomWidth = tabDom.value ? tabDom.value?.offsetWidth : 0;
|
||||||
|
scrollbarDomWidth <= tabDomWidth
|
||||||
|
? (isShowArrow.value = true)
|
||||||
|
: (isShowArrow.value = false);
|
||||||
if (tabDomWidth < scrollbarDomWidth || tabItemElOffsetLeft === 0) {
|
if (tabDomWidth < scrollbarDomWidth || tabItemElOffsetLeft === 0) {
|
||||||
translateX.value = 0;
|
translateX.value = 0;
|
||||||
} else if (tabItemElOffsetLeft < -translateX.value) {
|
} else if (tabItemElOffsetLeft < -translateX.value) {
|
||||||
@@ -123,7 +134,7 @@ function dynamicRouteTag(value: string, parentPath: string): void {
|
|||||||
function concatPath(arr: object[], value: string, parentPath: string) {
|
function concatPath(arr: object[], value: string, parentPath: string) {
|
||||||
if (!hasValue) {
|
if (!hasValue) {
|
||||||
arr.forEach((arrItem: any) => {
|
arr.forEach((arrItem: any) => {
|
||||||
let pathConcat = parentPath + arrItem.path;
|
const pathConcat = parentPath + arrItem.path;
|
||||||
if (arrItem.path === value || pathConcat === value) {
|
if (arrItem.path === value || pathConcat === value) {
|
||||||
useMultiTagsStoreHook().handleTags("push", {
|
useMultiTagsStoreHook().handleTags("push", {
|
||||||
path: value,
|
path: value,
|
||||||
@@ -144,22 +155,17 @@ function dynamicRouteTag(value: string, parentPath: string): void {
|
|||||||
|
|
||||||
/** 刷新路由 */
|
/** 刷新路由 */
|
||||||
function onFresh() {
|
function onFresh() {
|
||||||
const refreshButton = "refresh-button";
|
|
||||||
toggleClass(true, refreshButton, document.querySelector(".rotate"));
|
|
||||||
const { fullPath, query } = unref(route);
|
const { fullPath, query } = unref(route);
|
||||||
router.replace({
|
router.replace({
|
||||||
path: "/redirect" + fullPath,
|
path: "/redirect" + fullPath,
|
||||||
query: query
|
query: query
|
||||||
});
|
});
|
||||||
setTimeout(() => {
|
|
||||||
removeClass(document.querySelector(".rotate"), refreshButton);
|
|
||||||
}, 600);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteDynamicTag(obj: any, current: any, tag?: string) {
|
function deleteDynamicTag(obj: any, current: any, tag?: string) {
|
||||||
// 存放被删除的缓存路由
|
// 存放被删除的缓存路由
|
||||||
let delAliveRouteList = [];
|
let delAliveRouteList = [];
|
||||||
let valueIndex: number = multiTags.value.findIndex((item: any) => {
|
const valueIndex: number = multiTags.value.findIndex((item: any) => {
|
||||||
if (item.query) {
|
if (item.query) {
|
||||||
if (item.path === obj.path) {
|
if (item.path === obj.path) {
|
||||||
return item.query === obj.query;
|
return item.query === obj.query;
|
||||||
@@ -198,7 +204,7 @@ function deleteDynamicTag(obj: any, current: any, tag?: string) {
|
|||||||
// 从当前匹配到的路径中删除
|
// 从当前匹配到的路径中删除
|
||||||
spliceRoute(valueIndex, 1);
|
spliceRoute(valueIndex, 1);
|
||||||
}
|
}
|
||||||
let newRoute = useMultiTagsStoreHook().handleTags("slice");
|
const newRoute = useMultiTagsStoreHook().handleTags("slice");
|
||||||
if (current === route.path) {
|
if (current === route.path) {
|
||||||
// 删除缓存路由
|
// 删除缓存路由
|
||||||
tag
|
tag
|
||||||
@@ -276,9 +282,34 @@ function onClickDrop(key, item, selectRoute?: RouteConfigs) {
|
|||||||
startIndex: 1,
|
startIndex: 1,
|
||||||
length: multiTags.value.length
|
length: multiTags.value.length
|
||||||
});
|
});
|
||||||
usePermissionStoreHook().clearAllCachePage();
|
|
||||||
router.push("/welcome");
|
router.push("/welcome");
|
||||||
break;
|
break;
|
||||||
|
case 6:
|
||||||
|
// 整体页面全屏
|
||||||
|
toggle();
|
||||||
|
setTimeout(() => {
|
||||||
|
if (isFullscreen.value) {
|
||||||
|
tagsViews[6].icon = ExitFullscreen;
|
||||||
|
tagsViews[6].text = "退出全屏";
|
||||||
|
} else {
|
||||||
|
tagsViews[6].icon = Fullscreen;
|
||||||
|
tagsViews[6].text = "全屏";
|
||||||
|
}
|
||||||
|
}, 100);
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
// 内容区全屏
|
||||||
|
onContentFullScreen();
|
||||||
|
setTimeout(() => {
|
||||||
|
if (pureSetting.hiddenSideBar) {
|
||||||
|
tagsViews[7].icon = ExitFullscreen;
|
||||||
|
tagsViews[7].text = "内容区退出全屏";
|
||||||
|
} else {
|
||||||
|
tagsViews[7].icon = Fullscreen;
|
||||||
|
tagsViews[7].text = "内容区全屏";
|
||||||
|
}
|
||||||
|
}, 100);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
showMenuModel(route.fullPath, route.query);
|
showMenuModel(route.fullPath, route.query);
|
||||||
@@ -313,8 +344,8 @@ function showMenuModel(
|
|||||||
query: object = {},
|
query: object = {},
|
||||||
refresh = false
|
refresh = false
|
||||||
) {
|
) {
|
||||||
let allRoute = multiTags.value;
|
const allRoute = multiTags.value;
|
||||||
let routeLength = multiTags.value.length;
|
const routeLength = multiTags.value.length;
|
||||||
let currentIndex = -1;
|
let currentIndex = -1;
|
||||||
if (isEmpty(query)) {
|
if (isEmpty(query)) {
|
||||||
currentIndex = allRoute.findIndex(v => v.path === currentPath);
|
currentIndex = allRoute.findIndex(v => v.path === currentPath);
|
||||||
@@ -469,11 +500,11 @@ onMounted(() => {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div ref="containerDom" class="tags-view" v-if="!showTags">
|
<div ref="containerDom" class="tags-view" v-if="!showTags">
|
||||||
<div class="arrow-left">
|
<span v-show="isShowArrow" class="arrow-left">
|
||||||
<IconifyIconOffline icon="arrow-left-s-line" @click="handleScroll(200)" />
|
<IconifyIconOffline :icon="ArrowLeftSLine" @click="handleScroll(200)" />
|
||||||
</div>
|
</span>
|
||||||
<div ref="scrollbarDom" class="scroll-container">
|
<div ref="scrollbarDom" class="scroll-container">
|
||||||
<div class="tab" ref="tabDom" :style="getTabStyle">
|
<div class="tab select-none" ref="tabDom" :style="getTabStyle">
|
||||||
<div
|
<div
|
||||||
:ref="'dynamic' + index"
|
:ref="'dynamic' + index"
|
||||||
v-for="(item, index) in multiTags"
|
v-for="(item, index) in multiTags"
|
||||||
@@ -492,9 +523,9 @@ onMounted(() => {
|
|||||||
>
|
>
|
||||||
<router-link
|
<router-link
|
||||||
:to="item.path"
|
:to="item.path"
|
||||||
class="!dark:color-text_color_primary !dark:hover:color-primary"
|
class="dark:!text-text_color_primary dark:hover:!text-primary"
|
||||||
>
|
>
|
||||||
{{ transformI18n(item.meta.title) }}
|
{{ item.meta.title }}
|
||||||
</router-link>
|
</router-link>
|
||||||
<span
|
<span
|
||||||
v-if="
|
v-if="
|
||||||
@@ -504,7 +535,7 @@ onMounted(() => {
|
|||||||
class="el-icon-close"
|
class="el-icon-close"
|
||||||
@click.stop="deleteMenu(item)"
|
@click.stop="deleteMenu(item)"
|
||||||
>
|
>
|
||||||
<IconifyIconOffline icon="close-bold" />
|
<IconifyIconOffline :icon="CloseBold" />
|
||||||
</span>
|
</span>
|
||||||
<div
|
<div
|
||||||
:ref="'schedule' + index"
|
:ref="'schedule' + index"
|
||||||
@@ -514,11 +545,8 @@ onMounted(() => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<span class="arrow-right">
|
<span v-show="isShowArrow" class="arrow-right">
|
||||||
<IconifyIconOffline
|
<IconifyIconOffline :icon="ArrowRightSLine" @click="handleScroll(-200)" />
|
||||||
icon="arrow-right-s-line"
|
|
||||||
@click="handleScroll(-200)"
|
|
||||||
/>
|
|
||||||
</span>
|
</span>
|
||||||
<!-- 右键菜单按钮 -->
|
<!-- 右键菜单按钮 -->
|
||||||
<transition name="el-zoom-in-top">
|
<transition name="el-zoom-in-top">
|
||||||
@@ -529,59 +557,41 @@ onMounted(() => {
|
|||||||
class="contextmenu"
|
class="contextmenu"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
v-for="(item, key) in tagsViews"
|
v-for="(item, key) in tagsViews.slice(0, 6)"
|
||||||
:key="key"
|
:key="key"
|
||||||
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="toRaw(item.icon)" :key="key" />
|
<IconifyIconOffline :icon="item.icon" />
|
||||||
{{ transformI18n(item.text) }}
|
{{ item.text }}
|
||||||
</li>
|
</li>
|
||||||
</div>
|
</div>
|
||||||
</ul>
|
</ul>
|
||||||
</transition>
|
</transition>
|
||||||
<!-- 右侧功能按钮 -->
|
<!-- 右侧功能按钮 -->
|
||||||
<ul class="right-button">
|
<el-dropdown
|
||||||
<li>
|
trigger="click"
|
||||||
<span
|
placement="bottom-end"
|
||||||
:title="transformI18n('buttons.hsrefreshRoute')"
|
@command="handleCommand"
|
||||||
class="el-icon-refresh-right rotate"
|
>
|
||||||
@click="onFresh"
|
<span class="arrow-down">
|
||||||
>
|
<IconifyIconOffline :icon="ArrowDown" class="dark:text-white" />
|
||||||
<IconifyIconOffline icon="refresh-right" />
|
</span>
|
||||||
</span>
|
<template #dropdown>
|
||||||
</li>
|
<el-dropdown-menu>
|
||||||
<li>
|
<el-dropdown-item
|
||||||
<el-dropdown
|
v-for="(item, key) in tagsViews"
|
||||||
trigger="click"
|
:key="key"
|
||||||
placement="bottom-end"
|
:command="{ key, item }"
|
||||||
@command="handleCommand"
|
:divided="item.divided"
|
||||||
>
|
:disabled="item.disabled"
|
||||||
<IconifyIconOffline icon="arrow-down" class="dark:color-white" />
|
>
|
||||||
<template #dropdown>
|
<IconifyIconOffline :icon="item.icon" />
|
||||||
<el-dropdown-menu>
|
{{ item.text }}
|
||||||
<el-dropdown-item
|
</el-dropdown-item>
|
||||||
v-for="(item, key) in tagsViews"
|
</el-dropdown-menu>
|
||||||
:key="key"
|
</template>
|
||||||
:command="{ key, item }"
|
</el-dropdown>
|
||||||
:divided="item.divided"
|
|
||||||
:disabled="item.disabled"
|
|
||||||
>
|
|
||||||
<component
|
|
||||||
:is="toRaw(item.icon)"
|
|
||||||
:key="key"
|
|
||||||
style="margin-right: 6px"
|
|
||||||
/>
|
|
||||||
{{ transformI18n(item.text) }}
|
|
||||||
</el-dropdown-item>
|
|
||||||
</el-dropdown-menu>
|
|
||||||
</template>
|
|
||||||
</el-dropdown>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<slot />
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { useI18n } from "vue-i18n";
|
|
||||||
import { useRoute } from "vue-router";
|
import { useRoute } from "vue-router";
|
||||||
import { ref, unref, onMounted, nextTick } from "vue";
|
import { ref, unref, onMounted, nextTick } from "vue";
|
||||||
|
|
||||||
@@ -7,7 +6,6 @@ defineOptions({
|
|||||||
name: "FrameView"
|
name: "FrameView"
|
||||||
});
|
});
|
||||||
|
|
||||||
const { t } = useI18n();
|
|
||||||
const loading = ref(true);
|
const loading = ref(true);
|
||||||
const currentRoute = useRoute();
|
const currentRoute = useRoute();
|
||||||
const frameSrc = ref<string>("");
|
const frameSrc = ref<string>("");
|
||||||
@@ -45,11 +43,7 @@ onMounted(() => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div class="frame" v-loading="loading" element-loading-text="加载中...">
|
||||||
class="frame"
|
|
||||||
v-loading="loading"
|
|
||||||
:element-loading-text="t('status.hsLoad')"
|
|
||||||
>
|
|
||||||
<iframe :src="frameSrc" class="frame-iframe" ref="frameRef" />
|
<iframe :src="frameSrc" class="frame-iframe" ref="frameRef" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import { getConfig } from "/@/config";
|
import { getConfig } from "@/config";
|
||||||
import { find } from "lodash-unified";
|
import { find } from "lodash-unified";
|
||||||
import { useLayout } from "./useLayout";
|
import { useLayout } from "./useLayout";
|
||||||
import { themeColorsType } from "../types";
|
import { themeColorsType } from "../types";
|
||||||
import { TinyColor } from "@ctrl/tinycolor";
|
import { TinyColor } from "@ctrl/tinycolor";
|
||||||
import { useGlobal } from "@pureadmin/utils";
|
import { useGlobal } from "@pureadmin/utils";
|
||||||
import { useEpThemeStoreHook } from "/@/store/modules/epTheme";
|
import { useEpThemeStoreHook } from "@/store/modules/epTheme";
|
||||||
import {
|
import {
|
||||||
darken,
|
darken,
|
||||||
lighten,
|
lighten,
|
||||||
@@ -69,7 +69,7 @@ export function useDataThemeChange() {
|
|||||||
return new TinyColor(color).shade(10).toString();
|
return new TinyColor(color).shade(10).toString();
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 设置ep主题色 */
|
/** 设置 `element-plus` 主题色 */
|
||||||
const setEpThemeColor = (color: string) => {
|
const setEpThemeColor = (color: string) => {
|
||||||
useEpThemeStoreHook().setEpThemeColor(color);
|
useEpThemeStoreHook().setEpThemeColor(color);
|
||||||
body.style.setProperty("--el-color-primary-active", shadeBgColor(color));
|
body.style.setProperty("--el-color-primary-active", shadeBgColor(color));
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
import { computed } from "vue";
|
import { computed } from "vue";
|
||||||
import { useI18n } from "vue-i18n";
|
|
||||||
import { routerArrays } from "../types";
|
import { routerArrays } from "../types";
|
||||||
import { useGlobal } from "@pureadmin/utils";
|
import { useGlobal } from "@pureadmin/utils";
|
||||||
import { useMultiTagsStore } from "/@/store/modules/multiTags";
|
import { useMultiTagsStore } from "@/store/modules/multiTags";
|
||||||
|
|
||||||
export function useLayout() {
|
export function useLayout() {
|
||||||
const { $storage, $config } = useGlobal<GlobalPropertiesApi>();
|
const { $storage, $config } = useGlobal<GlobalPropertiesApi>();
|
||||||
@@ -15,11 +14,6 @@ export function useLayout() {
|
|||||||
) {
|
) {
|
||||||
$storage.tags = routerArrays;
|
$storage.tags = routerArrays;
|
||||||
}
|
}
|
||||||
/** 国际化 */
|
|
||||||
if (!$storage.locale) {
|
|
||||||
$storage.locale = { locale: $config?.Locale ?? "zh" };
|
|
||||||
useI18n().locale.value = $config?.Locale ?? "zh";
|
|
||||||
}
|
|
||||||
/** 导航 */
|
/** 导航 */
|
||||||
if (!$storage.layout) {
|
if (!$storage.layout) {
|
||||||
$storage.layout = {
|
$storage.layout = {
|
||||||
|
|||||||
@@ -1,45 +1,32 @@
|
|||||||
import { computed } from "vue";
|
import { computed } from "vue";
|
||||||
import { router } from "/@/router";
|
import { storeToRefs } from "pinia";
|
||||||
import { getConfig } from "/@/config";
|
import { getConfig } from "@/config";
|
||||||
import { useRouter } from "vue-router";
|
import { emitter } from "@/utils/mitt";
|
||||||
import { emitter } from "/@/utils/mitt";
|
|
||||||
import { routeMetaType } from "../types";
|
import { routeMetaType } from "../types";
|
||||||
import type { StorageConfigs } from "/#/index";
|
import { useGlobal } from "@pureadmin/utils";
|
||||||
import { routerArrays } from "/@/layout/types";
|
import { useRouter, useRoute } from "vue-router";
|
||||||
import { transformI18n } from "/@/plugins/i18n";
|
import { router, remainingPaths } from "@/router";
|
||||||
import { useAppStoreHook } from "/@/store/modules/app";
|
import { useAppStoreHook } from "@/store/modules/app";
|
||||||
import { remainingPaths, resetRouter } from "/@/router";
|
import { useUserStoreHook } from "@/store/modules/user";
|
||||||
import { storageSession, useGlobal } from "@pureadmin/utils";
|
import { usePermissionStoreHook } from "@/store/modules/permission";
|
||||||
import { useEpThemeStoreHook } from "/@/store/modules/epTheme";
|
|
||||||
import { useMultiTagsStoreHook } from "/@/store/modules/multiTags";
|
|
||||||
|
|
||||||
const errorInfo = "当前路由配置不正确,请检查配置";
|
const errorInfo = "当前路由配置不正确,请检查配置";
|
||||||
|
|
||||||
export function useNav() {
|
export function useNav() {
|
||||||
|
const route = useRoute();
|
||||||
const pureApp = useAppStoreHook();
|
const pureApp = useAppStoreHook();
|
||||||
const routers = useRouter().options.routes;
|
const routers = useRouter().options.routes;
|
||||||
|
const { wholeMenus } = storeToRefs(usePermissionStoreHook());
|
||||||
|
/** 平台`layout`中所有`el-tooltip`的`effect`配置,默认`light` */
|
||||||
|
const tooltipEffect = getConfig()?.TooltipEffect ?? "light";
|
||||||
|
|
||||||
/** 用户名 */
|
/** 用户名 */
|
||||||
const username: string =
|
const username = computed(() => {
|
||||||
storageSession.getItem<StorageConfigs>("info")?.username;
|
return useUserStoreHook()?.username;
|
||||||
|
|
||||||
/** 设置国际化选中后的样式 */
|
|
||||||
const getDropdownItemStyle = computed(() => {
|
|
||||||
return (locale, t) => {
|
|
||||||
return {
|
|
||||||
background: locale === t ? useEpThemeStoreHook().epThemeColor : "",
|
|
||||||
color: locale === t ? "#f4f4f5" : "#000"
|
|
||||||
};
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
const getDropdownItemClass = computed(() => {
|
|
||||||
return (locale, t) => {
|
|
||||||
return locale === t ? "" : "!dark:hover:color-primary";
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const avatarsStyle = computed(() => {
|
const avatarsStyle = computed(() => {
|
||||||
return username ? { marginRight: "10px" } : "";
|
return username.value ? { marginRight: "10px" } : "";
|
||||||
});
|
});
|
||||||
|
|
||||||
const isCollapse = computed(() => {
|
const isCollapse = computed(() => {
|
||||||
@@ -62,16 +49,13 @@ export function useNav() {
|
|||||||
/** 动态title */
|
/** 动态title */
|
||||||
function changeTitle(meta: routeMetaType) {
|
function changeTitle(meta: routeMetaType) {
|
||||||
const Title = getConfig().Title;
|
const Title = getConfig().Title;
|
||||||
if (Title) document.title = `${transformI18n(meta.title)} | ${Title}`;
|
if (Title) document.title = `${meta.title} | ${Title}`;
|
||||||
else document.title = transformI18n(meta.title);
|
else document.title = meta.title;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 退出登录 */
|
/** 退出登录 */
|
||||||
function logout() {
|
function logout() {
|
||||||
useMultiTagsStoreHook().handleTags("equal", [...routerArrays]);
|
useUserStoreHook().logOut();
|
||||||
storageSession.removeItem("info");
|
|
||||||
router.push("/login");
|
|
||||||
resetRouter();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function backHome() {
|
function backHome() {
|
||||||
@@ -102,6 +86,7 @@ export function useNav() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function menuSelect(indexPath: string, routers): void {
|
function menuSelect(indexPath: string, routers): void {
|
||||||
|
if (wholeMenus.value.length === 0) return;
|
||||||
if (isRemaining(indexPath)) return;
|
if (isRemaining(indexPath)) return;
|
||||||
let parentPath = "";
|
let parentPath = "";
|
||||||
const parentPathIndex = indexPath.lastIndexOf("/");
|
const parentPathIndex = indexPath.lastIndexOf("/");
|
||||||
@@ -136,6 +121,7 @@ export function useNav() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
route,
|
||||||
title,
|
title,
|
||||||
device,
|
device,
|
||||||
layout,
|
layout,
|
||||||
@@ -153,7 +139,6 @@ export function useNav() {
|
|||||||
pureApp,
|
pureApp,
|
||||||
username,
|
username,
|
||||||
avatarsStyle,
|
avatarsStyle,
|
||||||
getDropdownItemStyle,
|
tooltipEffect
|
||||||
getDropdownItemClass
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,25 +9,26 @@ import {
|
|||||||
getCurrentInstance
|
getCurrentInstance
|
||||||
} from "vue";
|
} from "vue";
|
||||||
import { tagsViewsType } from "../types";
|
import { tagsViewsType } from "../types";
|
||||||
import { isEqual } from "lodash-unified";
|
|
||||||
import type { StorageConfigs } from "/#/index";
|
|
||||||
import { useEventListener } from "@vueuse/core";
|
import { useEventListener } from "@vueuse/core";
|
||||||
import { useRoute, useRouter } from "vue-router";
|
import { useRoute, useRouter } from "vue-router";
|
||||||
import { transformI18n, $t } from "/@/plugins/i18n";
|
import { isEqual, isBoolean } from "@pureadmin/utils";
|
||||||
import { useMultiTagsStoreHook } from "/@/store/modules/multiTags";
|
import { useSettingStoreHook } from "@/store/modules/settings";
|
||||||
|
import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
|
||||||
import { storageLocal, toggleClass, hasClass } from "@pureadmin/utils";
|
import { storageLocal, toggleClass, hasClass } from "@pureadmin/utils";
|
||||||
|
|
||||||
import close from "/@/assets/svg/close.svg?component";
|
import Fullscreen from "@iconify-icons/ri/fullscreen-fill";
|
||||||
import refresh from "/@/assets/svg/refresh.svg?component";
|
import CloseAllTags from "@iconify-icons/ri/subtract-line";
|
||||||
import closeAll from "/@/assets/svg/close_all.svg?component";
|
import CloseOtherTags from "@iconify-icons/ri/text-spacing";
|
||||||
import closeLeft from "/@/assets/svg/close_left.svg?component";
|
import CloseRightTags from "@iconify-icons/ri/text-direction-l";
|
||||||
import closeOther from "/@/assets/svg/close_other.svg?component";
|
import CloseLeftTags from "@iconify-icons/ri/text-direction-r";
|
||||||
import closeRight from "/@/assets/svg/close_right.svg?component";
|
import RefreshRight from "@iconify-icons/ep/refresh-right";
|
||||||
|
import Close from "@iconify-icons/ep/close";
|
||||||
|
|
||||||
export function useTags() {
|
export function useTags() {
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const instance = getCurrentInstance();
|
const instance = getCurrentInstance();
|
||||||
|
const pureSetting = useSettingStoreHook();
|
||||||
|
|
||||||
const buttonTop = ref(0);
|
const buttonTop = ref(0);
|
||||||
const buttonLeft = ref(0);
|
const buttonLeft = ref(0);
|
||||||
@@ -53,59 +54,72 @@ export function useTags() {
|
|||||||
|
|
||||||
const tagsViews = reactive<Array<tagsViewsType>>([
|
const tagsViews = reactive<Array<tagsViewsType>>([
|
||||||
{
|
{
|
||||||
icon: refresh,
|
icon: RefreshRight,
|
||||||
text: $t("buttons.hsreload"),
|
text: "重新加载",
|
||||||
divided: false,
|
divided: false,
|
||||||
disabled: false,
|
disabled: false,
|
||||||
show: true
|
show: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: close,
|
icon: Close,
|
||||||
text: $t("buttons.hscloseCurrentTab"),
|
text: "关闭当前标签页",
|
||||||
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: CloseLeftTags,
|
||||||
text: $t("buttons.hscloseLeftTabs"),
|
text: "关闭左侧标签页",
|
||||||
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: CloseRightTags,
|
||||||
text: $t("buttons.hscloseRightTabs"),
|
text: "关闭右侧标签页",
|
||||||
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: CloseOtherTags,
|
||||||
text: $t("buttons.hscloseOtherTabs"),
|
text: "关闭其他标签页",
|
||||||
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: CloseAllTags,
|
||||||
text: $t("buttons.hscloseAllTabs"),
|
text: "关闭全部标签页",
|
||||||
divided: false,
|
divided: false,
|
||||||
disabled: multiTags.value.length > 1 ? false : true,
|
disabled: multiTags.value.length > 1 ? false : true,
|
||||||
show: true
|
show: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon: Fullscreen,
|
||||||
|
text: "整体页面全屏",
|
||||||
|
divided: true,
|
||||||
|
disabled: false,
|
||||||
|
show: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon: Fullscreen,
|
||||||
|
text: "内容区全屏",
|
||||||
|
divided: false,
|
||||||
|
disabled: false,
|
||||||
|
show: true
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
function conditionHandle(item, previous, next) {
|
function conditionHandle(item, previous, next) {
|
||||||
if (
|
if (isBoolean(route?.meta?.showLink) && route?.meta?.showLink === false) {
|
||||||
Object.keys(route.query).length === 0 &&
|
if (Object.keys(route.query).length > 0) {
|
||||||
Object.keys(route.params).length === 0
|
return isEqual(route.query, item.query) ? previous : next;
|
||||||
) {
|
} else {
|
||||||
return route.path === item.path ? previous : next;
|
return isEqual(route.params, item.params) ? previous : next;
|
||||||
} else if (Object.keys(route.query).length > 0) {
|
}
|
||||||
return isEqual(route.query, item.query) ? previous : next;
|
|
||||||
} else {
|
} else {
|
||||||
return isEqual(route.params, item.params) ? previous : next;
|
return route.path === item.path ? previous : next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,6 +186,12 @@ export function useTags() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onContentFullScreen() {
|
||||||
|
pureSetting.hiddenSideBar
|
||||||
|
? pureSetting.changeSetting({ key: "hiddenSideBar", value: false })
|
||||||
|
: pureSetting.changeSetting({ key: "hiddenSideBar", value: true });
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (!showModel.value) {
|
if (!showModel.value) {
|
||||||
const configure = storageLocal.getItem<StorageConfigs>(
|
const configure = storageLocal.getItem<StorageConfigs>(
|
||||||
@@ -201,6 +221,7 @@ export function useTags() {
|
|||||||
buttonTop,
|
buttonTop,
|
||||||
buttonLeft,
|
buttonLeft,
|
||||||
translateX,
|
translateX,
|
||||||
|
pureSetting,
|
||||||
activeIndex,
|
activeIndex,
|
||||||
getTabStyle,
|
getTabStyle,
|
||||||
iconIsActive,
|
iconIsActive,
|
||||||
@@ -208,11 +229,10 @@ export function useTags() {
|
|||||||
currentSelect,
|
currentSelect,
|
||||||
scheduleIsActive,
|
scheduleIsActive,
|
||||||
getContextMenuStyle,
|
getContextMenuStyle,
|
||||||
$t,
|
|
||||||
closeMenu,
|
closeMenu,
|
||||||
onMounted,
|
onMounted,
|
||||||
onMouseenter,
|
onMouseenter,
|
||||||
onMouseleave,
|
onMouseleave,
|
||||||
transformI18n
|
onContentFullScreen
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
import { useNav } from "./useNav";
|
|
||||||
import { useI18n } from "vue-i18n";
|
|
||||||
import { useRoute } from "vue-router";
|
|
||||||
import { watch, type Ref } from "vue";
|
|
||||||
|
|
||||||
export function useTranslationLang(ref?: Ref) {
|
|
||||||
const { $storage, changeTitle, handleResize } = useNav();
|
|
||||||
const { locale, t } = useI18n();
|
|
||||||
const route = useRoute();
|
|
||||||
|
|
||||||
function translationCh() {
|
|
||||||
$storage.locale = { locale: "zh" };
|
|
||||||
locale.value = "zh";
|
|
||||||
ref && handleResize(ref.value);
|
|
||||||
}
|
|
||||||
|
|
||||||
function translationEn() {
|
|
||||||
$storage.locale = { locale: "en" };
|
|
||||||
locale.value = "en";
|
|
||||||
ref && handleResize(ref.value);
|
|
||||||
}
|
|
||||||
|
|
||||||
watch(
|
|
||||||
() => locale.value,
|
|
||||||
() => {
|
|
||||||
changeTitle(route.meta);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
return {
|
|
||||||
t,
|
|
||||||
route,
|
|
||||||
locale,
|
|
||||||
translationCh,
|
|
||||||
translationEn
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,22 +1,22 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import "animate.css";
|
||||||
|
// vxe-table的所有icon不支持component模式,间接依赖了font-awesome
|
||||||
|
// import "font-awesome/css/font-awesome.min.css";
|
||||||
import { setType } from "./types";
|
import { setType } from "./types";
|
||||||
import { emitter } from "/@/utils/mitt";
|
import { emitter } from "@/utils/mitt";
|
||||||
import { useLayout } from "./hooks/useLayout";
|
import { useLayout } from "./hooks/useLayout";
|
||||||
import { useAppStoreHook } from "/@/store/modules/app";
|
import { useAppStoreHook } from "@/store/modules/app";
|
||||||
import { useSettingStoreHook } from "/@/store/modules/settings";
|
import { useSettingStoreHook } from "@/store/modules/settings";
|
||||||
import { deviceDetection, useDark, useGlobal } from "@pureadmin/utils";
|
import { deviceDetection, useDark, useGlobal } from "@pureadmin/utils";
|
||||||
import { h, reactive, computed, onMounted, defineComponent } from "vue";
|
import { h, reactive, computed, onMounted, defineComponent } from "vue";
|
||||||
|
|
||||||
import backTop from "/@/assets/svg/back_top.svg?component";
|
|
||||||
import fullScreen from "/@/assets/svg/full_screen.svg?component";
|
|
||||||
import exitScreen from "/@/assets/svg/exit_screen.svg?component";
|
|
||||||
|
|
||||||
import navbar from "./components/navbar.vue";
|
import navbar from "./components/navbar.vue";
|
||||||
import tag from "./components/tag/index.vue";
|
import tag from "./components/tag/index.vue";
|
||||||
import appMain from "./components/appMain.vue";
|
import appMain from "./components/appMain.vue";
|
||||||
import setting from "./components/setting/index.vue";
|
import setting from "./components/setting/index.vue";
|
||||||
import Vertical from "./components/sidebar/vertical.vue";
|
import Vertical from "./components/sidebar/vertical.vue";
|
||||||
import Horizontal from "./components/sidebar/horizontal.vue";
|
import Horizontal from "./components/sidebar/horizontal.vue";
|
||||||
|
import backTop from "@/assets/svg/back_top.svg?component";
|
||||||
|
|
||||||
const { isDark } = useDark();
|
const { isDark } = useDark();
|
||||||
const { layout } = useLayout();
|
const { layout } = useLayout();
|
||||||
@@ -73,7 +73,7 @@ let isAutoCloseSidebar = true;
|
|||||||
// 监听容器
|
// 监听容器
|
||||||
emitter.on("resize", ({ detail }) => {
|
emitter.on("resize", ({ detail }) => {
|
||||||
if (isMobile) return;
|
if (isMobile) return;
|
||||||
let { width } = detail;
|
const { width } = detail;
|
||||||
width <= 760 ? setTheme("vertical") : setTheme(useAppStoreHook().layout);
|
width <= 760 ? setTheme("vertical") : setTheme(useAppStoreHook().layout);
|
||||||
/** width app-wrapper类容器宽度
|
/** width app-wrapper类容器宽度
|
||||||
* 0 < width <= 760 隐藏侧边栏
|
* 0 < width <= 760 隐藏侧边栏
|
||||||
@@ -102,12 +102,6 @@ onMounted(() => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function onFullScreen() {
|
|
||||||
pureSetting.hiddenSideBar
|
|
||||||
? pureSetting.changeSetting({ key: "hiddenSideBar", value: false })
|
|
||||||
: pureSetting.changeSetting({ key: "hiddenSideBar", value: true });
|
|
||||||
}
|
|
||||||
|
|
||||||
const layoutHeader = defineComponent({
|
const layoutHeader = defineComponent({
|
||||||
render() {
|
render() {
|
||||||
return h(
|
return h(
|
||||||
@@ -127,31 +121,11 @@ const layoutHeader = defineComponent({
|
|||||||
!pureSetting.hiddenSideBar &&
|
!pureSetting.hiddenSideBar &&
|
||||||
(layout.value.includes("vertical") || layout.value.includes("mix"))
|
(layout.value.includes("vertical") || layout.value.includes("mix"))
|
||||||
? h(navbar)
|
? h(navbar)
|
||||||
: h("div"),
|
: null,
|
||||||
!pureSetting.hiddenSideBar && layout.value.includes("horizontal")
|
!pureSetting.hiddenSideBar && layout.value.includes("horizontal")
|
||||||
? h(Horizontal)
|
? h(Horizontal)
|
||||||
: h("div"),
|
: null,
|
||||||
h(
|
h(tag)
|
||||||
tag,
|
|
||||||
{},
|
|
||||||
{
|
|
||||||
default: () => [
|
|
||||||
h(
|
|
||||||
"span",
|
|
||||||
{
|
|
||||||
onClick: onFullScreen
|
|
||||||
},
|
|
||||||
{
|
|
||||||
default: () => [
|
|
||||||
!pureSetting.hiddenSideBar
|
|
||||||
? h(fullScreen, { class: "dark:color-white" })
|
|
||||||
: h(exitScreen, { class: "dark:color-white" })
|
|
||||||
]
|
|
||||||
}
|
|
||||||
)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
)
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -226,10 +200,6 @@ const layoutHeader = defineComponent({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.main-hidden {
|
|
||||||
margin-left: 0 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.app-mask {
|
.app-mask {
|
||||||
background: #000;
|
background: #000;
|
||||||
opacity: 0.3;
|
opacity: 0.3;
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ const themeColors = {
|
|||||||
menuHover: "#4091f7",
|
menuHover: "#4091f7",
|
||||||
subMenuBg: "#0f0303",
|
subMenuBg: "#0f0303",
|
||||||
subMenuActiveBg: "#4091f7",
|
subMenuActiveBg: "#4091f7",
|
||||||
navTextColor: "#fff",
|
|
||||||
menuText: "rgb(254 254 254 / 65%)",
|
menuText: "rgb(254 254 254 / 65%)",
|
||||||
sidebarLogo: "#002140",
|
sidebarLogo: "#002140",
|
||||||
menuTitleHover: "#fff",
|
menuTitleHover: "#fff",
|
||||||
@@ -33,7 +32,6 @@ const themeColors = {
|
|||||||
menuHover: "#e0ebf6",
|
menuHover: "#e0ebf6",
|
||||||
subMenuBg: "#fff",
|
subMenuBg: "#fff",
|
||||||
subMenuActiveBg: "#e0ebf6",
|
subMenuActiveBg: "#e0ebf6",
|
||||||
navTextColor: "#7a80b4",
|
|
||||||
menuText: "#7a80b4",
|
menuText: "#7a80b4",
|
||||||
sidebarLogo: "#fff",
|
sidebarLogo: "#fff",
|
||||||
menuTitleHover: "#000",
|
menuTitleHover: "#000",
|
||||||
@@ -46,7 +44,6 @@ const themeColors = {
|
|||||||
menuHover: "#e13c39",
|
menuHover: "#e13c39",
|
||||||
subMenuBg: "#000",
|
subMenuBg: "#000",
|
||||||
subMenuActiveBg: "#e13c39",
|
subMenuActiveBg: "#e13c39",
|
||||||
navTextColor: "#red",
|
|
||||||
menuText: "rgb(254 254 254 / 65.1%)",
|
menuText: "rgb(254 254 254 / 65.1%)",
|
||||||
sidebarLogo: "#42090c",
|
sidebarLogo: "#42090c",
|
||||||
menuTitleHover: "#fff",
|
menuTitleHover: "#fff",
|
||||||
@@ -59,7 +56,6 @@ const themeColors = {
|
|||||||
menuHover: "#e85f33",
|
menuHover: "#e85f33",
|
||||||
subMenuBg: "#0f0603",
|
subMenuBg: "#0f0603",
|
||||||
subMenuActiveBg: "#e85f33",
|
subMenuActiveBg: "#e85f33",
|
||||||
navTextColor: "#fff",
|
|
||||||
menuText: "rgb(254 254 254 / 65%)",
|
menuText: "rgb(254 254 254 / 65%)",
|
||||||
sidebarLogo: "#441708",
|
sidebarLogo: "#441708",
|
||||||
menuTitleHover: "#fff",
|
menuTitleHover: "#fff",
|
||||||
@@ -72,7 +68,6 @@ const themeColors = {
|
|||||||
menuHover: "#f6da4d",
|
menuHover: "#f6da4d",
|
||||||
subMenuBg: "#0f0603",
|
subMenuBg: "#0f0603",
|
||||||
subMenuActiveBg: "#f6da4d",
|
subMenuActiveBg: "#f6da4d",
|
||||||
navTextColor: "#fff",
|
|
||||||
menuText: "rgb(254 254 254 / 65%)",
|
menuText: "rgb(254 254 254 / 65%)",
|
||||||
sidebarLogo: "#443b05",
|
sidebarLogo: "#443b05",
|
||||||
menuTitleHover: "#fff",
|
menuTitleHover: "#fff",
|
||||||
@@ -85,7 +80,6 @@ const themeColors = {
|
|||||||
menuHover: "#59bfc1",
|
menuHover: "#59bfc1",
|
||||||
subMenuBg: "#000",
|
subMenuBg: "#000",
|
||||||
subMenuActiveBg: "#59bfc1",
|
subMenuActiveBg: "#59bfc1",
|
||||||
navTextColor: "#7a80b4",
|
|
||||||
menuText: "#7a80b4",
|
menuText: "#7a80b4",
|
||||||
sidebarLogo: "#053434",
|
sidebarLogo: "#053434",
|
||||||
menuTitleHover: "#fff",
|
menuTitleHover: "#fff",
|
||||||
@@ -98,7 +92,6 @@ const themeColors = {
|
|||||||
menuHover: "#60ac80",
|
menuHover: "#60ac80",
|
||||||
subMenuBg: "#000",
|
subMenuBg: "#000",
|
||||||
subMenuActiveBg: "#60ac80",
|
subMenuActiveBg: "#60ac80",
|
||||||
navTextColor: "#7a80b4",
|
|
||||||
menuText: "#7a80b4",
|
menuText: "#7a80b4",
|
||||||
sidebarLogo: "#112f21",
|
sidebarLogo: "#112f21",
|
||||||
menuTitleHover: "#fff",
|
menuTitleHover: "#fff",
|
||||||
@@ -111,7 +104,6 @@ const themeColors = {
|
|||||||
menuHover: "#d84493",
|
menuHover: "#d84493",
|
||||||
subMenuBg: "#000",
|
subMenuBg: "#000",
|
||||||
subMenuActiveBg: "#d84493",
|
subMenuActiveBg: "#d84493",
|
||||||
navTextColor: "#7a80b4",
|
|
||||||
menuText: "#7a80b4",
|
menuText: "#7a80b4",
|
||||||
sidebarLogo: "#3f0d29",
|
sidebarLogo: "#3f0d29",
|
||||||
menuTitleHover: "#fff",
|
menuTitleHover: "#fff",
|
||||||
@@ -124,7 +116,6 @@ const themeColors = {
|
|||||||
menuHover: "#693ac9",
|
menuHover: "#693ac9",
|
||||||
subMenuBg: "#000",
|
subMenuBg: "#000",
|
||||||
subMenuActiveBg: "#693ac9",
|
subMenuActiveBg: "#693ac9",
|
||||||
navTextColor: "#7a80b4",
|
|
||||||
menuText: "#7a80b4",
|
menuText: "#7a80b4",
|
||||||
sidebarLogo: "#1f0c38",
|
sidebarLogo: "#1f0c38",
|
||||||
menuTitleHover: "#fff",
|
menuTitleHover: "#fff",
|
||||||
@@ -147,7 +138,6 @@ export const genScssMultipleScopeVars = (): MultipleScopeVarsItem[] => {
|
|||||||
$menuHover: ${themeColors[key].menuHover} !default;
|
$menuHover: ${themeColors[key].menuHover} !default;
|
||||||
$subMenuBg: ${themeColors[key].subMenuBg} !default;
|
$subMenuBg: ${themeColors[key].subMenuBg} !default;
|
||||||
$subMenuActiveBg: ${themeColors[key].subMenuActiveBg} !default;
|
$subMenuActiveBg: ${themeColors[key].subMenuActiveBg} !default;
|
||||||
$navTextColor: ${themeColors[key].navTextColor} !default;
|
|
||||||
$menuText: ${themeColors[key].menuText} !default;
|
$menuText: ${themeColors[key].menuText} !default;
|
||||||
$sidebarLogo: ${themeColors[key].sidebarLogo} !default;
|
$sidebarLogo: ${themeColors[key].sidebarLogo} !default;
|
||||||
$menuTitleHover: ${themeColors[key].menuTitleHover} !default;
|
$menuTitleHover: ${themeColors[key].menuTitleHover} !default;
|
||||||
|
|||||||
@@ -1,21 +1,23 @@
|
|||||||
import { Component } from "vue";
|
import type { IconifyIcon } from "@iconify/vue";
|
||||||
|
import HomeFilled from "@iconify-icons/ep/home-filled";
|
||||||
|
|
||||||
export const routerArrays: Array<RouteConfigs> = [
|
export const routerArrays: Array<RouteConfigs> = [
|
||||||
{
|
{
|
||||||
path: "/welcome",
|
path: "/welcome",
|
||||||
parentPath: "/",
|
parentPath: "/",
|
||||||
meta: {
|
meta: {
|
||||||
title: "menus.hshome",
|
title: "首页",
|
||||||
icon: "home-filled"
|
icon: HomeFilled
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
export type routeMetaType = {
|
export type routeMetaType = {
|
||||||
title?: string;
|
title?: string;
|
||||||
icon?: string;
|
icon?: string | IconifyIcon;
|
||||||
showLink?: boolean;
|
showLink?: boolean;
|
||||||
savedPosition?: boolean;
|
savedPosition?: boolean;
|
||||||
authority?: Array<string>;
|
auths?: Array<string>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type RouteConfigs = {
|
export type RouteConfigs = {
|
||||||
@@ -33,7 +35,7 @@ export type multiTagsType = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export type tagsViewsType = {
|
export type tagsViewsType = {
|
||||||
icon: Component;
|
icon: string | IconifyIcon;
|
||||||
text: string;
|
text: string;
|
||||||
divided: boolean;
|
divided: boolean;
|
||||||
disabled: boolean;
|
disabled: boolean;
|
||||||
|
|||||||
22
src/main.ts
@@ -1,28 +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 ElementPlus from "element-plus";
|
||||||
import { getServerConfig } from "./config";
|
import { getServerConfig } from "./config";
|
||||||
import { createApp, Directive } from "vue";
|
import { createApp, Directive } from "vue";
|
||||||
import { useI18n } from "../src/plugins/i18n";
|
|
||||||
import { MotionPlugin } from "@vueuse/motion";
|
import { MotionPlugin } from "@vueuse/motion";
|
||||||
// import { useEcharts } from "/@/plugins/echarts";
|
// import { useEcharts } from "@/plugins/echarts";
|
||||||
// import { useTable } from "../src/plugins/vxe-table";
|
// import { useTable } from "@/plugins/vxe-table";
|
||||||
import { injectResponsiveStorage } from "/@/utils/responsive";
|
import { injectResponsiveStorage } from "@/utils/responsive";
|
||||||
|
|
||||||
// import Table from "@pureadmin/table";
|
// import Table from "@pureadmin/table";
|
||||||
// import PureDescriptions from "@pureadmin/descriptions";
|
// import PureDescriptions from "@pureadmin/descriptions";
|
||||||
|
|
||||||
import "uno.css";
|
|
||||||
import "animate.css";
|
|
||||||
// 引入重置样式
|
// 引入重置样式
|
||||||
import "./style/reset.scss";
|
import "./style/reset.scss";
|
||||||
// 导入公共样式
|
// 导入公共样式
|
||||||
import "./style/index.scss";
|
import "./style/index.scss";
|
||||||
import "element-plus/dist/index.css";
|
import "element-plus/dist/index.css";
|
||||||
import "@pureadmin/components/dist/index.css";
|
|
||||||
import "@pureadmin/components/dist/theme.css";
|
|
||||||
import "@pureadmin/components/dist/dark.scss";
|
|
||||||
// 导入字体图标
|
// 导入字体图标
|
||||||
import "./assets/iconfont/iconfont.js";
|
import "./assets/iconfont/iconfont.js";
|
||||||
import "./assets/iconfont/iconfont.css";
|
import "./assets/iconfont/iconfont.css";
|
||||||
@@ -30,7 +24,7 @@ import "./assets/iconfont/iconfont.css";
|
|||||||
const app = createApp(App);
|
const app = createApp(App);
|
||||||
|
|
||||||
// 自定义指令
|
// 自定义指令
|
||||||
import * as directives from "/@/directives";
|
import * as directives from "@/directives";
|
||||||
Object.keys(directives).forEach(key => {
|
Object.keys(directives).forEach(key => {
|
||||||
app.directive(key, (directives as { [key: string]: Directive })[key]);
|
app.directive(key, (directives as { [key: string]: Directive })[key]);
|
||||||
});
|
});
|
||||||
@@ -45,12 +39,16 @@ app.component("IconifyIconOffline", IconifyIconOffline);
|
|||||||
app.component("IconifyIconOnline", IconifyIconOnline);
|
app.component("IconifyIconOnline", IconifyIconOnline);
|
||||||
app.component("FontIcon", FontIcon);
|
app.component("FontIcon", FontIcon);
|
||||||
|
|
||||||
|
// 全局注册按钮级别权限组件
|
||||||
|
import { Auth } from "@/components/ReAuth";
|
||||||
|
app.component("Auth", Auth);
|
||||||
|
|
||||||
getServerConfig(app).then(async config => {
|
getServerConfig(app).then(async config => {
|
||||||
app.use(router);
|
app.use(router);
|
||||||
await router.isReady();
|
await router.isReady();
|
||||||
injectResponsiveStorage(app, config);
|
injectResponsiveStorage(app, config);
|
||||||
setupStore(app);
|
setupStore(app);
|
||||||
app.use(MotionPlugin).use(useI18n).use(ElementPlus);
|
app.use(MotionPlugin).use(ElementPlus);
|
||||||
// .use(useEcharts);
|
// .use(useEcharts);
|
||||||
// .use(Table);
|
// .use(Table);
|
||||||
// .use(PureDescriptions);
|
// .use(PureDescriptions);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { App } from "vue";
|
import type { App } from "vue";
|
||||||
import * as echarts from "echarts/core";
|
import * as echarts from "echarts/core";
|
||||||
import { SVGRenderer } from "echarts/renderers";
|
import { CanvasRenderer } from "echarts/renderers";
|
||||||
import { PieChart, BarChart, LineChart } from "echarts/charts";
|
import { PieChart, BarChart, LineChart } from "echarts/charts";
|
||||||
import {
|
import {
|
||||||
GridComponent,
|
GridComponent,
|
||||||
@@ -19,7 +19,7 @@ use([
|
|||||||
PieChart,
|
PieChart,
|
||||||
BarChart,
|
BarChart,
|
||||||
LineChart,
|
LineChart,
|
||||||
SVGRenderer,
|
CanvasRenderer,
|
||||||
GridComponent,
|
GridComponent,
|
||||||
TitleComponent,
|
TitleComponent,
|
||||||
LegendComponent,
|
LegendComponent,
|
||||||
@@ -33,6 +33,7 @@ use([
|
|||||||
/**
|
/**
|
||||||
* @description 按需引入echarts
|
* @description 按需引入echarts
|
||||||
* @see {@link https://echarts.apache.org/handbook/zh/basics/import#%E6%8C%89%E9%9C%80%E5%BC%95%E5%85%A5-echarts-%E5%9B%BE%E8%A1%A8%E5%92%8C%E7%BB%84%E4%BB%B6}
|
* @see {@link https://echarts.apache.org/handbook/zh/basics/import#%E6%8C%89%E9%9C%80%E5%BC%95%E5%85%A5-echarts-%E5%9B%BE%E8%A1%A8%E5%92%8C%E7%BB%84%E4%BB%B6}
|
||||||
|
* @see 温馨提示:必须将 `$echarts` 添加到全局 `globalProperties` ,为了配合 https://pure-admin-utils.netlify.app/hooks/useEcharts/useEcharts.html 使用
|
||||||
*/
|
*/
|
||||||
export function useEcharts(app: App) {
|
export function useEcharts(app: App) {
|
||||||
app.config.globalProperties.$echarts = echarts;
|
app.config.globalProperties.$echarts = echarts;
|
||||||
|
|||||||