Compare commits
76 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2395bb11b5 | ||
|
|
00256f7843 | ||
|
|
0ac157201e | ||
|
|
1bc940500c | ||
|
|
c50bb9981b | ||
|
|
a4f9251789 | ||
|
|
3ac71be372 | ||
|
|
8c01eeab7f | ||
|
|
fa1b397c33 | ||
|
|
3ebf0bda2f | ||
|
|
31a9a10d1b | ||
|
|
1a24c56d92 | ||
|
|
c4ee2e1235 | ||
|
|
df842d93e6 | ||
|
|
67926cf915 | ||
|
|
f3e3d60e22 | ||
|
|
b4893be543 | ||
|
|
a8953d009f | ||
|
|
b76600a981 | ||
|
|
b20157fa2e | ||
|
|
a5752a0493 | ||
|
|
9d1f3089d0 | ||
|
|
b058952e45 | ||
|
|
b4c80166be | ||
|
|
5a0ce44307 | ||
|
|
12a5adb842 | ||
|
|
2cebae520c | ||
|
|
77d3923439 | ||
|
|
c819ef1ff3 | ||
|
|
70772864ac | ||
|
|
d543b57e34 | ||
|
|
a9ba7cbe61 | ||
|
|
96a39b3974 | ||
|
|
496feeb005 | ||
|
|
97f0e1531c | ||
|
|
e0f28acdc4 | ||
|
|
9b9ff10be1 | ||
|
|
94e2943608 | ||
|
|
d19e7849cc | ||
|
|
91f915462a | ||
|
|
1038f16783 | ||
|
|
dedde7d47f | ||
|
|
f220db4eed | ||
|
|
b043cf76f5 | ||
|
|
ca76b12cc6 | ||
|
|
1508afa7c3 | ||
|
|
f2cf1d0af7 | ||
|
|
14f1e8cc97 | ||
|
|
cdf4abeb58 | ||
|
|
6faffacf77 | ||
|
|
806f56d80c | ||
|
|
0b8e10f964 | ||
|
|
d4c2e139a3 | ||
|
|
17ec8c6af4 | ||
|
|
3075dc61f7 | ||
|
|
23d9cdaf81 | ||
|
|
1154c0b9f8 | ||
|
|
ab772081ec | ||
|
|
17d1b98bdf | ||
|
|
fba17f188d | ||
|
|
5cb19eec75 | ||
|
|
cac6d8071f | ||
|
|
12a003a430 | ||
|
|
d6af3e9d33 | ||
|
|
28267cf22e | ||
|
|
2e6733cbc7 | ||
|
|
2d56e471cb | ||
|
|
24b33b5401 | ||
|
|
6dc29c134f | ||
|
|
12973dcf5b | ||
|
|
d0d02d7128 | ||
|
|
9839746b00 | ||
|
|
3069785575 | ||
|
|
0bc8a4e9df | ||
|
|
ea28240d56 | ||
|
|
758a84f5c6 |
@@ -1,11 +0,0 @@
|
|||||||
public
|
|
||||||
dist
|
|
||||||
*.d.ts
|
|
||||||
/src/assets
|
|
||||||
package.json
|
|
||||||
eslint.config.js
|
|
||||||
.prettierrc.js
|
|
||||||
commitlint.config.js
|
|
||||||
postcss.config.js
|
|
||||||
tailwind.config.js
|
|
||||||
stylelint.config.js
|
|
||||||
120
.eslintrc.js
@@ -1,120 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
root: true,
|
|
||||||
env: {
|
|
||||||
node: true
|
|
||||||
},
|
|
||||||
globals: {
|
|
||||||
// Ref sugar (take 2)
|
|
||||||
$: "readonly",
|
|
||||||
$$: "readonly",
|
|
||||||
$ref: "readonly",
|
|
||||||
$shallowRef: "readonly",
|
|
||||||
$computed: "readonly",
|
|
||||||
|
|
||||||
// index.d.ts
|
|
||||||
// global.d.ts
|
|
||||||
Fn: "readonly",
|
|
||||||
PromiseFn: "readonly",
|
|
||||||
RefType: "readonly",
|
|
||||||
LabelValueOptions: "readonly",
|
|
||||||
EmitType: "readonly",
|
|
||||||
TargetContext: "readonly",
|
|
||||||
ComponentElRef: "readonly",
|
|
||||||
ComponentRef: "readonly",
|
|
||||||
ElRef: "readonly",
|
|
||||||
global: "readonly",
|
|
||||||
ForDataType: "readonly",
|
|
||||||
ComponentRoutes: "readonly",
|
|
||||||
|
|
||||||
// script setup
|
|
||||||
defineProps: "readonly",
|
|
||||||
defineEmits: "readonly",
|
|
||||||
defineExpose: "readonly",
|
|
||||||
withDefaults: "readonly"
|
|
||||||
},
|
|
||||||
extends: [
|
|
||||||
"plugin:vue/vue3-essential",
|
|
||||||
"eslint:recommended",
|
|
||||||
"@vue/typescript/recommended",
|
|
||||||
"@vue/prettier",
|
|
||||||
"@vue/eslint-config-typescript"
|
|
||||||
],
|
|
||||||
parser: "vue-eslint-parser",
|
|
||||||
parserOptions: {
|
|
||||||
parser: "@typescript-eslint/parser",
|
|
||||||
ecmaVersion: 2020,
|
|
||||||
sourceType: "module",
|
|
||||||
jsxPragma: "React",
|
|
||||||
ecmaFeatures: {
|
|
||||||
jsx: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
overrides: [
|
|
||||||
{
|
|
||||||
files: ["*.ts", "*.vue"],
|
|
||||||
rules: {
|
|
||||||
"no-undef": "off"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
files: ["*.vue"],
|
|
||||||
parser: "vue-eslint-parser",
|
|
||||||
parserOptions: {
|
|
||||||
parser: "@typescript-eslint/parser",
|
|
||||||
extraFileExtensions: [".vue"],
|
|
||||||
ecmaVersion: "latest",
|
|
||||||
ecmaFeatures: {
|
|
||||||
jsx: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
rules: {
|
|
||||||
"no-undef": "off"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
rules: {
|
|
||||||
"vue/no-v-html": "off",
|
|
||||||
"vue/require-default-prop": "off",
|
|
||||||
"vue/require-explicit-emits": "off",
|
|
||||||
"vue/multi-word-component-names": "off",
|
|
||||||
"@typescript-eslint/no-explicit-any": "off", // any
|
|
||||||
"no-debugger": "off",
|
|
||||||
"@typescript-eslint/explicit-module-boundary-types": "off", // setup()
|
|
||||||
"@typescript-eslint/ban-types": "off",
|
|
||||||
"@typescript-eslint/ban-ts-comment": "off",
|
|
||||||
"@typescript-eslint/no-empty-function": "off",
|
|
||||||
"@typescript-eslint/no-non-null-assertion": "off",
|
|
||||||
"vue/html-self-closing": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
html: {
|
|
||||||
void: "always",
|
|
||||||
normal: "always",
|
|
||||||
component: "always"
|
|
||||||
},
|
|
||||||
svg: "always",
|
|
||||||
math: "always"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"@typescript-eslint/no-unused-vars": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
argsIgnorePattern: "^_",
|
|
||||||
varsIgnorePattern: "^_"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"no-unused-vars": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
argsIgnorePattern: "^_",
|
|
||||||
varsIgnorePattern: "^_"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"prettier/prettier": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
endOfLine: "auto"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -3,14 +3,18 @@
|
|||||||
"prettier --cache --ignore-unknown --write",
|
"prettier --cache --ignore-unknown --write",
|
||||||
"eslint --cache --fix"
|
"eslint --cache --fix"
|
||||||
],
|
],
|
||||||
"{!(package)*.json,*.code-snippets,.!({browserslist,nvm})*rc}": [
|
"{!(package)*.json,*.code-snippets,.!({browserslist,npm,nvm})*rc}": [
|
||||||
"prettier --cache --write--parser json"
|
"prettier --cache --write--parser json"
|
||||||
],
|
],
|
||||||
"package.json": ["prettier --cache --write"],
|
"package.json": ["prettier --cache --write"],
|
||||||
"*.vue": ["prettier --write", "eslint --cache --fix", "stylelint --fix"],
|
"*.vue": [
|
||||||
|
"prettier --write",
|
||||||
|
"eslint --cache --fix",
|
||||||
|
"stylelint --fix --allow-empty-input"
|
||||||
|
],
|
||||||
"*.{css,scss,html}": [
|
"*.{css,scss,html}": [
|
||||||
"prettier --cache --ignore-unknown --write",
|
"prettier --cache --ignore-unknown --write",
|
||||||
"stylelint --fix"
|
"stylelint --fix --allow-empty-input"
|
||||||
],
|
],
|
||||||
"*.md": ["prettier --cache --ignore-unknown --write"]
|
"*.md": ["prettier --cache --ignore-unknown --write"]
|
||||||
}
|
}
|
||||||
|
|||||||
5
.npmrc
@@ -1,3 +1,4 @@
|
|||||||
|
shell-emulator=true
|
||||||
shamefully-hoist=true
|
shamefully-hoist=true
|
||||||
strict-peer-dependencies=false
|
enable-pre-post-scripts=false
|
||||||
shell-emulator=true
|
strict-peer-dependencies=false
|
||||||
4
.vscode/extensions.json
vendored
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"recommendations": [
|
"recommendations": [
|
||||||
"christian-kohler.path-intellisense",
|
"christian-kohler.path-intellisense",
|
||||||
|
"warmthsea.vscode-custom-code-color",
|
||||||
"vscode-icons-team.vscode-icons",
|
"vscode-icons-team.vscode-icons",
|
||||||
"davidanson.vscode-markdownlint",
|
"davidanson.vscode-markdownlint",
|
||||||
"ms-azuretools.vscode-docker",
|
"ms-azuretools.vscode-docker",
|
||||||
@@ -8,6 +9,7 @@
|
|||||||
"bradlc.vscode-tailwindcss",
|
"bradlc.vscode-tailwindcss",
|
||||||
"dbaeumer.vscode-eslint",
|
"dbaeumer.vscode-eslint",
|
||||||
"esbenp.prettier-vscode",
|
"esbenp.prettier-vscode",
|
||||||
|
"lokalise.i18n-ally",
|
||||||
"redhat.vscode-yaml",
|
"redhat.vscode-yaml",
|
||||||
"csstools.postcss",
|
"csstools.postcss",
|
||||||
"mikestead.dotenv",
|
"mikestead.dotenv",
|
||||||
@@ -15,4 +17,4 @@
|
|||||||
"antfu.iconify",
|
"antfu.iconify",
|
||||||
"Vue.volar"
|
"Vue.volar"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
30
.vscode/settings.json
vendored
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"tailwindCSS.experimental.configFile": "src/style/tailwind.css",
|
||||||
"editor.formatOnType": true,
|
"editor.formatOnType": true,
|
||||||
"editor.formatOnSave": true,
|
"editor.formatOnSave": true,
|
||||||
"[vue]": {
|
"[vue]": {
|
||||||
@@ -27,5 +28,30 @@
|
|||||||
"editor.codeActionsOnSave": {
|
"editor.codeActionsOnSave": {
|
||||||
"source.fixAll.eslint": "explicit"
|
"source.fixAll.eslint": "explicit"
|
||||||
},
|
},
|
||||||
"iconify.excludes": ["el"]
|
"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"
|
||||||
|
],
|
||||||
|
"vscodeCustomCodeColor.highlightValue": [
|
||||||
|
"v-loading",
|
||||||
|
"v-auth",
|
||||||
|
"v-copy",
|
||||||
|
"v-longpress",
|
||||||
|
"v-optimize",
|
||||||
|
"v-perms",
|
||||||
|
"v-ripple"
|
||||||
|
],
|
||||||
|
"vscodeCustomCodeColor.highlightValueColor": "#b392f0",
|
||||||
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
FROM node:18-alpine as build-stage
|
FROM node:20-alpine as build-stage
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
RUN corepack enable
|
RUN corepack enable
|
||||||
RUN corepack prepare pnpm@8.6.10 --activate
|
RUN corepack prepare pnpm@latest --activate
|
||||||
|
|
||||||
RUN npm config set registry https://registry.npmmirror.com
|
RUN npm config set registry https://registry.npmmirror.com
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<h1>vue-pure-admin Lite Edition(no i18n version)</h1>
|
<h1>vue-pure-admin Lite Edition(i18n version)</h1>
|
||||||
|
|
||||||
[](LICENSE)
|
[](LICENSE)
|
||||||
|
|
||||||
@@ -8,18 +8,23 @@
|
|||||||
|
|
||||||
The simplified version is based on the shelf extracted from [vue-pure-admin](https://github.com/pure-admin/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`
|
The simplified version is based on the shelf extracted from [vue-pure-admin](https://github.com/pure-admin/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
|
||||||
|
|
||||||
- [Click Watch Tutorial](https://www.bilibili.com/video/BV1kg411v7QT)
|
[Click me to view UI design](https://www.bilibili.com/video/BV17g411T7rq)
|
||||||
- [Click Watch UI Design](https://www.bilibili.com/video/BV17g411T7rq)
|
[Click me to view the rapid development tutorial](https://www.bilibili.com/video/BV1kg411v7QT)
|
||||||
|
|
||||||
## Docs
|
## Nanny-level documents
|
||||||
|
|
||||||
- [documentation site](https://yiming_chang.gitee.io/pure-admin-doc)
|
[Click me to view vue-pure-admin documentation](https://pure-admin.cn/)
|
||||||
|
[Click me to view @pureadmin/utils documentation](https://pure-admin-utils.netlify.app)
|
||||||
|
|
||||||
|
## Premium service
|
||||||
|
|
||||||
|
[Click me to view details](https://pure-admin.cn/pages/service/)
|
||||||
|
|
||||||
## Preview
|
## Preview
|
||||||
|
|
||||||
- [Click me to view the preview station](https://pure-admin-thin.netlify.app/#/login)
|
[Click me to view the preview station](https://pure-admin-thin.netlify.app/#/login)
|
||||||
|
|
||||||
## Maintainer
|
## Maintainer
|
||||||
|
|
||||||
@@ -27,7 +32,7 @@ The simplified version is based on the shelf extracted from [vue-pure-admin](htt
|
|||||||
|
|
||||||
## ⚠️ Attention
|
## ⚠️ Attention
|
||||||
|
|
||||||
- The Lite version does not accept any issues and prs. If you have any questions, please go to the full version [issues](https://github.com/pure-admin/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 [issues](https://github.com/pure-admin/vue-pure-admin/issues/new/choose) to mention, thank you!
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|||||||
19
README.md
@@ -1,4 +1,4 @@
|
|||||||
<h1>vue-pure-admin精简版(非国际化版本)</h1>
|
<h1>vue-pure-admin精简版(国际化版本)</h1>
|
||||||
|
|
||||||
[](LICENSE)
|
[](LICENSE)
|
||||||
|
|
||||||
@@ -10,20 +10,25 @@
|
|||||||
|
|
||||||
## 版本选择
|
## 版本选择
|
||||||
|
|
||||||
当前是非国际化版本,如果您需要国际化版本 [请点击](https://github.com/pure-admin/pure-admin-thin/tree/i18n)
|
当前是国际化版本,如果您需要非国际化版本 [请点击](https://github.com/pure-admin/pure-admin-thin)
|
||||||
|
|
||||||
## 配套视频
|
## 配套视频
|
||||||
|
|
||||||
- [点我查看教程](https://www.bilibili.com/video/BV1kg411v7QT)
|
[点我查看 UI 设计](https://www.bilibili.com/video/BV17g411T7rq)
|
||||||
- [点我查看 UI 设计](https://www.bilibili.com/video/BV17g411T7rq)
|
[点我查看快速开发教程](https://www.bilibili.com/video/BV1kg411v7QT)
|
||||||
|
|
||||||
## 配套保姆级文档
|
## 配套保姆级文档
|
||||||
|
|
||||||
- [查看文档](https://yiming_chang.gitee.io/pure-admin-doc)
|
[点我查看 vue-pure-admin 文档](https://pure-admin.cn/)
|
||||||
|
[点我查看 @pureadmin/utils 文档](https://pure-admin-utils.netlify.app)
|
||||||
|
|
||||||
|
## 高级服务
|
||||||
|
|
||||||
|
[点我查看详情](https://pure-admin.cn/pages/service/)
|
||||||
|
|
||||||
## 预览
|
## 预览
|
||||||
|
|
||||||
- [查看预览](https://pure-admin-thin.netlify.app/#/login)
|
[查看预览](https://pure-admin-thin.netlify.app/#/login)
|
||||||
|
|
||||||
## 维护者
|
## 维护者
|
||||||
|
|
||||||
@@ -31,7 +36,7 @@
|
|||||||
|
|
||||||
## ⚠️ 注意
|
## ⚠️ 注意
|
||||||
|
|
||||||
- 精简版不接受任何 `issues` 和 `pr`,如果有问题请到完整版 [issues](https://github.com/pure-admin/vue-pure-admin/issues/new/choose) 去提,谢谢!
|
精简版不接受任何 `issues` 和 `pr`,如果有问题请到完整版 [issues](https://github.com/pure-admin/vue-pure-admin/issues/new/choose) 去提,谢谢!
|
||||||
|
|
||||||
## 许可证
|
## 许可证
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import { Plugin as importToCDN } from "vite-plugin-cdn-import";
|
|||||||
/**
|
/**
|
||||||
* @description 打包时采用`cdn`模式,仅限外网使用(默认不采用,如果需要采用cdn模式,请在 .env.production 文件,将 VITE_CDN 设置成true)
|
* @description 打包时采用`cdn`模式,仅限外网使用(默认不采用,如果需要采用cdn模式,请在 .env.production 文件,将 VITE_CDN 设置成true)
|
||||||
* 平台采用国内cdn:https://www.bootcdn.cn,当然你也可以选择 https://unpkg.com 或者 https://www.jsdelivr.com
|
* 平台采用国内cdn:https://www.bootcdn.cn,当然你也可以选择 https://unpkg.com 或者 https://www.jsdelivr.com
|
||||||
* 提醒:mockjs不能用cdn模式引入,会报错。正确的方式是,生产环境删除mockjs,使用真实的后端请求
|
|
||||||
* 注意:上面提到的仅限外网使用也不是完全肯定的,如果你们公司内网部署的有相关js、css文件,也可以将下面配置对应改一下,整一套内网版cdn
|
* 注意:上面提到的仅限外网使用也不是完全肯定的,如果你们公司内网部署的有相关js、css文件,也可以将下面配置对应改一下,整一套内网版cdn
|
||||||
*/
|
*/
|
||||||
export const cdn = importToCDN({
|
export const cdn = importToCDN({
|
||||||
@@ -20,6 +19,11 @@ export const cdn = importToCDN({
|
|||||||
var: "VueRouter",
|
var: "VueRouter",
|
||||||
path: "vue-router.global.min.js"
|
path: "vue-router.global.min.js"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "vue-i18n",
|
||||||
|
var: "VueI18n",
|
||||||
|
path: "vue-i18n.runtime.global.prod.min.js"
|
||||||
|
},
|
||||||
// 项目中没有直接安装vue-demi,但是pinia用到了,所以需要在引入pinia前引入vue-demi(https://github.com/vuejs/pinia/blob/v2/packages/pinia/package.json#L77)
|
// 项目中没有直接安装vue-demi,但是pinia用到了,所以需要在引入pinia前引入vue-demi(https://github.com/vuejs/pinia/blob/v2/packages/pinia/package.json#L77)
|
||||||
{
|
{
|
||||||
name: "vue-demi",
|
name: "vue-demi",
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import type { Plugin } from "vite";
|
import type { Plugin } from "vite";
|
||||||
|
import gradient from "gradient-string";
|
||||||
import { getPackageSize } from "./utils";
|
import { getPackageSize } from "./utils";
|
||||||
import dayjs, { type Dayjs } from "dayjs";
|
import dayjs, { type Dayjs } from "dayjs";
|
||||||
import duration from "dayjs/plugin/duration";
|
import duration from "dayjs/plugin/duration";
|
||||||
import gradientString from "gradient-string";
|
|
||||||
import boxen, { type Options as BoxenOptions } from "boxen";
|
import boxen, { type Options as BoxenOptions } from "boxen";
|
||||||
dayjs.extend(duration);
|
dayjs.extend(duration);
|
||||||
|
|
||||||
const welcomeMessage = gradientString("cyan", "magenta").multiline(
|
const welcomeMessage = gradient(["cyan", "magenta"]).multiline(
|
||||||
`Hello! 欢迎使用 pure-admin 开源项目\n我们为您精心准备了下面两个贴心的保姆级文档\nhttps://yiming_chang.gitee.io/pure-admin-doc\nhttps://pure-admin-utils.netlify.app`
|
`您好! 欢迎使用 pure-admin 开源项目\n我们为您精心准备了下面两个贴心的保姆级文档\nhttps://pure-admin.cn\nhttps://pure-admin-utils.netlify.app`
|
||||||
);
|
);
|
||||||
|
|
||||||
const boxenOptions: BoxenOptions = {
|
const boxenOptions: BoxenOptions = {
|
||||||
@@ -41,7 +41,7 @@ export function viteBuildInfo(): Plugin {
|
|||||||
callback: (size: string) => {
|
callback: (size: string) => {
|
||||||
console.log(
|
console.log(
|
||||||
boxen(
|
boxen(
|
||||||
gradientString("cyan", "magenta").multiline(
|
gradient(["cyan", "magenta"]).multiline(
|
||||||
`🎉 恭喜打包完成(总用时${dayjs
|
`🎉 恭喜打包完成(总用时${dayjs
|
||||||
.duration(endTime.diff(startTime))
|
.duration(endTime.diff(startTime))
|
||||||
.format("mm分ss秒")},打包后的大小为${size})`
|
.format("mm分ss秒")},打包后的大小为${size})`
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ const include = [
|
|||||||
"dayjs",
|
"dayjs",
|
||||||
"axios",
|
"axios",
|
||||||
"pinia",
|
"pinia",
|
||||||
|
"vue-i18n",
|
||||||
"vue-types",
|
"vue-types",
|
||||||
"js-cookie",
|
"js-cookie",
|
||||||
"vue-tippy",
|
"vue-tippy",
|
||||||
@@ -22,12 +23,8 @@ const include = [
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 在预构建中强制排除的依赖项
|
* 在预构建中强制排除的依赖项
|
||||||
* 温馨提示:所有以 `@iconify-icons/` 开头引入的的本地图标模块,都应该加入到下面的 `exclude` 里,因为平台推荐的使用方式是哪里需要哪里引入而且都是单个的引入,不需要预构建,直接让浏览器加载就好
|
* 温馨提示:平台推荐的使用方式是哪里需要哪里引入而且都是单个的引入,不需要预构建,直接让浏览器加载就好
|
||||||
*/
|
*/
|
||||||
const exclude = [
|
const exclude = ["@iconify/json"];
|
||||||
"@iconify-icons/ep",
|
|
||||||
"@iconify-icons/ri",
|
|
||||||
"@pureadmin/theme/dist/browser-utils"
|
|
||||||
];
|
|
||||||
|
|
||||||
export { include, exclude };
|
export { include, exclude };
|
||||||
|
|||||||
@@ -1,15 +1,18 @@
|
|||||||
import { cdn } from "./cdn";
|
import { cdn } from "./cdn";
|
||||||
import vue from "@vitejs/plugin-vue";
|
import vue from "@vitejs/plugin-vue";
|
||||||
|
import { pathResolve } from "./utils";
|
||||||
import { viteBuildInfo } from "./info";
|
import { viteBuildInfo } from "./info";
|
||||||
import svgLoader from "vite-svg-loader";
|
import svgLoader from "vite-svg-loader";
|
||||||
|
import Icons from "unplugin-icons/vite";
|
||||||
import type { PluginOption } from "vite";
|
import type { PluginOption } from "vite";
|
||||||
import vueJsx from "@vitejs/plugin-vue-jsx";
|
import vueJsx from "@vitejs/plugin-vue-jsx";
|
||||||
|
import tailwindcss from "@tailwindcss/vite";
|
||||||
import { configCompressPlugin } from "./compress";
|
import { configCompressPlugin } from "./compress";
|
||||||
import removeNoMatch from "vite-plugin-router-warn";
|
import removeNoMatch from "vite-plugin-router-warn";
|
||||||
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 VueI18nPlugin from "@intlify/unplugin-vue-i18n/vite";
|
||||||
import { genScssMultipleScopeVars } from "../src/layout/theme";
|
import { codeInspectorPlugin } from "code-inspector-plugin";
|
||||||
import { vitePluginFakeServer } from "vite-plugin-fake-server";
|
import { vitePluginFakeServer } from "vite-plugin-fake-server";
|
||||||
|
|
||||||
export function getPluginsList(
|
export function getPluginsList(
|
||||||
@@ -18,9 +21,23 @@ export function getPluginsList(
|
|||||||
): PluginOption[] {
|
): PluginOption[] {
|
||||||
const lifecycle = process.env.npm_lifecycle_event;
|
const lifecycle = process.env.npm_lifecycle_event;
|
||||||
return [
|
return [
|
||||||
|
tailwindcss(),
|
||||||
vue(),
|
vue(),
|
||||||
// jsx、tsx语法支持
|
// jsx、tsx语法支持
|
||||||
vueJsx(),
|
vueJsx(),
|
||||||
|
VueI18nPlugin({
|
||||||
|
include: [pathResolve("../locales/**")]
|
||||||
|
}),
|
||||||
|
/**
|
||||||
|
* 在页面上按住组合键时,鼠标在页面移动即会在 DOM 上出现遮罩层并显示相关信息,点击一下将自动打开 IDE 并将光标定位到元素对应的代码位置
|
||||||
|
* Mac 默认组合键 Option + Shift
|
||||||
|
* Windows 默认组合键 Alt + Shift
|
||||||
|
* 更多用法看 https://inspector.fe-dev.cn/guide/start.html
|
||||||
|
*/
|
||||||
|
codeInspectorPlugin({
|
||||||
|
bundler: "vite",
|
||||||
|
hideConsole: true
|
||||||
|
}),
|
||||||
viteBuildInfo(),
|
viteBuildInfo(),
|
||||||
/**
|
/**
|
||||||
* 开发环境下移除非必要的vue-router动态路由警告No match found for location with path
|
* 开发环境下移除非必要的vue-router动态路由警告No match found for location with path
|
||||||
@@ -35,15 +52,13 @@ export function getPluginsList(
|
|||||||
infixName: false,
|
infixName: false,
|
||||||
enableProd: true
|
enableProd: true
|
||||||
}),
|
}),
|
||||||
// 自定义主题
|
|
||||||
themePreprocessorPlugin({
|
|
||||||
scss: {
|
|
||||||
multipleScopeVars: genScssMultipleScopeVars(),
|
|
||||||
extract: true
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
// svg组件化支持
|
// svg组件化支持
|
||||||
svgLoader(),
|
svgLoader(),
|
||||||
|
// 自动按需加载图标
|
||||||
|
Icons({
|
||||||
|
compiler: "vue3",
|
||||||
|
scale: 1
|
||||||
|
}),
|
||||||
VITE_CDN ? cdn : null,
|
VITE_CDN ? cdn : null,
|
||||||
configCompressPlugin(VITE_COMPRESSION),
|
configCompressPlugin(VITE_COMPRESSION),
|
||||||
// 线上环境删除console
|
// 线上环境删除console
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ const __APP_INFO__ = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** 处理环境变量 */
|
/** 处理环境变量 */
|
||||||
const warpperEnv = (envConf: Recordable): ViteEnv => {
|
const wrapperEnv = (envConf: Recordable): ViteEnv => {
|
||||||
// 默认值
|
// 默认值
|
||||||
const ret: ViteEnv = {
|
const ret: ViteEnv = {
|
||||||
VITE_PORT: 8848,
|
VITE_PORT: 8848,
|
||||||
@@ -107,4 +107,4 @@ const getPackageSize = options => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export { root, pathResolve, alias, __APP_INFO__, warpperEnv, getPackageSize };
|
export { root, pathResolve, alias, __APP_INFO__, wrapperEnv, getPackageSize };
|
||||||
|
|||||||
@@ -1,19 +1,25 @@
|
|||||||
import js from "@eslint/js";
|
import js from "@eslint/js";
|
||||||
|
import tseslint from "typescript-eslint";
|
||||||
import pluginVue from "eslint-plugin-vue";
|
import pluginVue from "eslint-plugin-vue";
|
||||||
import * as parserVue from "vue-eslint-parser";
|
import * as parserVue from "vue-eslint-parser";
|
||||||
import configPrettier from "eslint-config-prettier";
|
import configPrettier from "eslint-config-prettier";
|
||||||
import pluginPrettier from "eslint-plugin-prettier";
|
import pluginPrettier from "eslint-plugin-prettier";
|
||||||
import { defineFlatConfig } from "eslint-define-config";
|
import { defineConfig, globalIgnores } from "eslint/config";
|
||||||
import * as parserTypeScript from "@typescript-eslint/parser";
|
|
||||||
import pluginTypeScript from "@typescript-eslint/eslint-plugin";
|
|
||||||
|
|
||||||
export default defineFlatConfig([
|
export default defineConfig([
|
||||||
|
globalIgnores([
|
||||||
|
"**/.*",
|
||||||
|
"dist/*",
|
||||||
|
"*.d.ts",
|
||||||
|
"public/*",
|
||||||
|
"src/assets/**",
|
||||||
|
"src/**/iconfont/**"
|
||||||
|
]),
|
||||||
{
|
{
|
||||||
...js.configs.recommended,
|
...js.configs.recommended,
|
||||||
ignores: ["src/assets/**", "src/**/iconfont/**"],
|
|
||||||
languageOptions: {
|
languageOptions: {
|
||||||
globals: {
|
globals: {
|
||||||
// index.d.ts
|
// types/index.d.ts
|
||||||
RefType: "readonly",
|
RefType: "readonly",
|
||||||
EmitType: "readonly",
|
EmitType: "readonly",
|
||||||
TargetContext: "readonly",
|
TargetContext: "readonly",
|
||||||
@@ -66,26 +72,18 @@ export default defineFlatConfig([
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
...tseslint.config({
|
||||||
|
extends: [...tseslint.configs.recommended],
|
||||||
files: ["**/*.?([cm])ts", "**/*.?([cm])tsx"],
|
files: ["**/*.?([cm])ts", "**/*.?([cm])tsx"],
|
||||||
languageOptions: {
|
|
||||||
parser: parserTypeScript,
|
|
||||||
parserOptions: {
|
|
||||||
sourceType: "module"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
plugins: {
|
|
||||||
"@typescript-eslint": pluginTypeScript
|
|
||||||
},
|
|
||||||
rules: {
|
rules: {
|
||||||
...pluginTypeScript.configs.strict.rules,
|
|
||||||
"@typescript-eslint/ban-types": "off",
|
|
||||||
"@typescript-eslint/no-redeclare": "error",
|
"@typescript-eslint/no-redeclare": "error",
|
||||||
"@typescript-eslint/ban-ts-comment": "off",
|
"@typescript-eslint/ban-ts-comment": "off",
|
||||||
"@typescript-eslint/no-explicit-any": "off",
|
"@typescript-eslint/no-explicit-any": "off",
|
||||||
"@typescript-eslint/prefer-as-const": "warn",
|
"@typescript-eslint/prefer-as-const": "warn",
|
||||||
"@typescript-eslint/no-empty-function": "off",
|
"@typescript-eslint/no-empty-function": "off",
|
||||||
"@typescript-eslint/no-non-null-assertion": "off",
|
"@typescript-eslint/no-non-null-assertion": "off",
|
||||||
|
"@typescript-eslint/no-unused-expressions": "off",
|
||||||
|
"@typescript-eslint/no-unsafe-function-type": "off",
|
||||||
"@typescript-eslint/no-import-type-side-effects": "error",
|
"@typescript-eslint/no-import-type-side-effects": "error",
|
||||||
"@typescript-eslint/explicit-module-boundary-types": "off",
|
"@typescript-eslint/explicit-module-boundary-types": "off",
|
||||||
"@typescript-eslint/consistent-type-imports": [
|
"@typescript-eslint/consistent-type-imports": [
|
||||||
@@ -104,20 +102,20 @@ export default defineFlatConfig([
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
}),
|
||||||
{
|
{
|
||||||
files: ["**/*.d.ts"],
|
files: ["**/*.d.ts"],
|
||||||
rules: {
|
rules: {
|
||||||
"eslint-comments/no-unlimited-disable": "off",
|
"eslint-comments/no-unlimited-disable": "off",
|
||||||
"import/no-duplicates": "off",
|
"import/no-duplicates": "off",
|
||||||
|
"no-restricted-syntax": "off",
|
||||||
"unused-imports/no-unused-vars": "off"
|
"unused-imports/no-unused-vars": "off"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
files: ["**/*.?([cm])js"],
|
files: ["**/*.?([cm])js"],
|
||||||
rules: {
|
rules: {
|
||||||
"@typescript-eslint/no-require-imports": "off",
|
"@typescript-eslint/no-require-imports": "off"
|
||||||
"@typescript-eslint/no-var-requires": "off"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -138,18 +136,19 @@ export default defineFlatConfig([
|
|||||||
jsx: true
|
jsx: true
|
||||||
},
|
},
|
||||||
extraFileExtensions: [".vue"],
|
extraFileExtensions: [".vue"],
|
||||||
parser: "@typescript-eslint/parser",
|
parser: tseslint.parser,
|
||||||
sourceType: "module"
|
sourceType: "module"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
plugins: {
|
plugins: {
|
||||||
|
"@typescript-eslint": tseslint.plugin,
|
||||||
vue: pluginVue
|
vue: pluginVue
|
||||||
},
|
},
|
||||||
processor: pluginVue.processors[".vue"],
|
processor: pluginVue.processors[".vue"],
|
||||||
rules: {
|
rules: {
|
||||||
...pluginVue.configs.base.rules,
|
...pluginVue.configs.base.rules,
|
||||||
...pluginVue.configs["vue3-essential"].rules,
|
...pluginVue.configs.essential.rules,
|
||||||
...pluginVue.configs["vue3-recommended"].rules,
|
...pluginVue.configs.recommended.rules,
|
||||||
"no-undef": "off",
|
"no-undef": "off",
|
||||||
"no-unused-vars": "off",
|
"no-unused-vars": "off",
|
||||||
"vue/no-v-html": "off",
|
"vue/no-v-html": "off",
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
@@ -10,9 +10,6 @@
|
|||||||
/>
|
/>
|
||||||
<title>pure-admin-thin</title>
|
<title>pure-admin-thin</title>
|
||||||
<link rel="icon" href="/favicon.ico" />
|
<link rel="icon" href="/favicon.ico" />
|
||||||
<script>
|
|
||||||
window.process = {};
|
|
||||||
</script>
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
91
locales/en.yaml
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
buttons:
|
||||||
|
pureLoginOut: LoginOut
|
||||||
|
pureLogin: Login
|
||||||
|
pureOpenSystemSet: Open System Configs
|
||||||
|
pureReload: Reload
|
||||||
|
pureCloseCurrentTab: Close CurrentTab
|
||||||
|
pureCloseLeftTabs: Close LeftTabs
|
||||||
|
pureCloseRightTabs: Close RightTabs
|
||||||
|
pureCloseOtherTabs: Close OtherTabs
|
||||||
|
pureCloseAllTabs: Close AllTabs
|
||||||
|
pureContentFullScreen: Content FullScreen
|
||||||
|
pureContentExitFullScreen: Content ExitFullScreen
|
||||||
|
pureClickCollapse: Collapse
|
||||||
|
pureClickExpand: Expand
|
||||||
|
pureConfirm: Confirm
|
||||||
|
pureSwitch: Switch
|
||||||
|
pureClose: Close
|
||||||
|
pureBackTop: BackTop
|
||||||
|
pureOpenText: Open
|
||||||
|
pureCloseText: Close
|
||||||
|
search:
|
||||||
|
pureTotal: Total
|
||||||
|
pureHistory: History
|
||||||
|
pureCollect: Collect
|
||||||
|
pureDragSort: (Drag Sort)
|
||||||
|
pureEmpty: Empty
|
||||||
|
purePlaceholder: Search Menu
|
||||||
|
panel:
|
||||||
|
pureSystemSet: System Configs
|
||||||
|
pureCloseSystemSet: Close System Configs
|
||||||
|
pureClearCacheAndToLogin: Clear cache and return to login page
|
||||||
|
pureClearCache: Clear Cache
|
||||||
|
pureOverallStyle: Overall Style
|
||||||
|
pureOverallStyleLight: Light
|
||||||
|
pureOverallStyleLightTip: Set sail freshly and light up the comfortable work interface
|
||||||
|
pureOverallStyleDark: Dark
|
||||||
|
pureOverallStyleDarkTip: Moonlight Overture, indulge in the tranquility and elegance of the night
|
||||||
|
pureOverallStyleSystem: Auto
|
||||||
|
pureOverallStyleSystemTip: Synchronize time, the interface naturally responds to morning and dusk
|
||||||
|
pureThemeColor: Theme Color
|
||||||
|
pureLayoutModel: Layout Model
|
||||||
|
pureVerticalTip: The menu on the left is familiar and friendly
|
||||||
|
pureHorizontalTip: Top menu, concise overview
|
||||||
|
pureMixTip: Mixed menu, flexible
|
||||||
|
pureStretch: Stretch Page
|
||||||
|
pureStretchFixed: Fixed
|
||||||
|
pureStretchFixedTip: Compact pages make it easy to find the information you need
|
||||||
|
pureStretchCustom: Custom
|
||||||
|
pureStretchCustomTip: Minimum 1280, maximum 1600
|
||||||
|
pureTagsStyle: Tags Style
|
||||||
|
pureTagsStyleSmart: Smart
|
||||||
|
pureTagsStyleSmartTip: Smart tags add fun and brilliance
|
||||||
|
pureTagsStyleCard: Card
|
||||||
|
pureTagsStyleCardTip: Card tags for efficient browsing
|
||||||
|
pureTagsStyleChrome: Chrome
|
||||||
|
pureTagsStyleChromeTip: Chrome style is classic and elegant
|
||||||
|
pureInterfaceDisplay: Interface Display
|
||||||
|
pureGreyModel: Grey Model
|
||||||
|
pureWeakModel: Weak Model
|
||||||
|
pureHiddenTags: Hidden Tags
|
||||||
|
pureHiddenFooter: Hidden Footer
|
||||||
|
pureMultiTagsCache: MultiTags Cache
|
||||||
|
menus:
|
||||||
|
pureHome: Home
|
||||||
|
pureLogin: Login
|
||||||
|
pureAbnormal: Abnormal Page
|
||||||
|
purePageNotFound: "404"
|
||||||
|
pureAccessDenied: "403"
|
||||||
|
pureServerError: "500"
|
||||||
|
purePermission: Permission Manage
|
||||||
|
purePermissionPage: Page Permission
|
||||||
|
purePermissionButton: Button Permission
|
||||||
|
purePermissionButtonRouter: Route return button permission
|
||||||
|
purePermissionButtonLogin: Login interface return button permission
|
||||||
|
status:
|
||||||
|
pureLoad: Loading...
|
||||||
|
pureMessage: Message
|
||||||
|
pureNotify: Notify
|
||||||
|
pureTodo: Todo
|
||||||
|
pureNoMessage: No Message
|
||||||
|
pureNoNotify: No Notify
|
||||||
|
pureNoTodo: No Todo
|
||||||
|
login:
|
||||||
|
pureUsername: Username
|
||||||
|
purePassword: Password
|
||||||
|
pureLogin: Login
|
||||||
|
pureLoginSuccess: Login Success
|
||||||
|
pureLoginFail: Login Fail
|
||||||
|
pureUsernameReg: Please enter username
|
||||||
|
purePassWordReg: Please enter password
|
||||||
|
purePassWordRuleReg: The password format should be any combination of 8-18 digits
|
||||||
91
locales/zh-CN.yaml
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
buttons:
|
||||||
|
pureLoginOut: 退出系统
|
||||||
|
pureLogin: 登录
|
||||||
|
pureOpenSystemSet: 打开系统配置
|
||||||
|
pureReload: 重新加载
|
||||||
|
pureCloseCurrentTab: 关闭当前标签页
|
||||||
|
pureCloseLeftTabs: 关闭左侧标签页
|
||||||
|
pureCloseRightTabs: 关闭右侧标签页
|
||||||
|
pureCloseOtherTabs: 关闭其他标签页
|
||||||
|
pureCloseAllTabs: 关闭全部标签页
|
||||||
|
pureContentFullScreen: 内容区全屏
|
||||||
|
pureContentExitFullScreen: 内容区退出全屏
|
||||||
|
pureClickCollapse: 点击折叠
|
||||||
|
pureClickExpand: 点击展开
|
||||||
|
pureConfirm: 确认
|
||||||
|
pureSwitch: 切换
|
||||||
|
pureClose: 关闭
|
||||||
|
pureBackTop: 回到顶部
|
||||||
|
pureOpenText: 开
|
||||||
|
pureCloseText: 关
|
||||||
|
search:
|
||||||
|
pureTotal: 共
|
||||||
|
pureHistory: 搜索历史
|
||||||
|
pureCollect: 收藏
|
||||||
|
pureDragSort: (可拖拽排序)
|
||||||
|
pureEmpty: 暂无搜索结果
|
||||||
|
purePlaceholder: 搜索菜单(支持拼音搜索)
|
||||||
|
panel:
|
||||||
|
pureSystemSet: 系统配置
|
||||||
|
pureCloseSystemSet: 关闭配置
|
||||||
|
pureClearCacheAndToLogin: 清空缓存并返回登录页
|
||||||
|
pureClearCache: 清空缓存
|
||||||
|
pureOverallStyle: 整体风格
|
||||||
|
pureOverallStyleLight: 浅色
|
||||||
|
pureOverallStyleLightTip: 清新启航,点亮舒适的工作界面
|
||||||
|
pureOverallStyleDark: 深色
|
||||||
|
pureOverallStyleDarkTip: 月光序曲,沉醉于夜的静谧雅致
|
||||||
|
pureOverallStyleSystem: 自动
|
||||||
|
pureOverallStyleSystemTip: 同步时光,界面随晨昏自然呼应
|
||||||
|
pureThemeColor: 主题色
|
||||||
|
pureLayoutModel: 导航模式
|
||||||
|
pureVerticalTip: 左侧菜单,亲切熟悉
|
||||||
|
pureHorizontalTip: 顶部菜单,简洁概览
|
||||||
|
pureMixTip: 混合菜单,灵活多变
|
||||||
|
pureStretch: 页宽
|
||||||
|
pureStretchFixed: 固定
|
||||||
|
pureStretchFixedTip: 紧凑页面,轻松找到所需信息
|
||||||
|
pureStretchCustom: 自定义
|
||||||
|
pureStretchCustomTip: 最小1280、最大1600
|
||||||
|
pureTagsStyle: 页签风格
|
||||||
|
pureTagsStyleSmart: 灵动
|
||||||
|
pureTagsStyleSmartTip: 灵动标签,添趣生辉
|
||||||
|
pureTagsStyleCard: 卡片
|
||||||
|
pureTagsStyleCardTip: 卡片标签,高效浏览
|
||||||
|
pureTagsStyleChrome: 谷歌
|
||||||
|
pureTagsStyleChromeTip: 谷歌风格,经典美观
|
||||||
|
pureInterfaceDisplay: 界面显示
|
||||||
|
pureGreyModel: 灰色模式
|
||||||
|
pureWeakModel: 色弱模式
|
||||||
|
pureHiddenTags: 隐藏标签页
|
||||||
|
pureHiddenFooter: 隐藏页脚
|
||||||
|
pureMultiTagsCache: 页签持久化
|
||||||
|
menus:
|
||||||
|
pureHome: 首页
|
||||||
|
pureLogin: 登录
|
||||||
|
pureAbnormal: 异常页面
|
||||||
|
purePageNotFound: "404"
|
||||||
|
pureAccessDenied: "403"
|
||||||
|
pureServerError: "500"
|
||||||
|
purePermission: 权限管理
|
||||||
|
purePermissionPage: 页面权限
|
||||||
|
purePermissionButton: 按钮权限
|
||||||
|
purePermissionButtonRouter: 路由返回按钮权限
|
||||||
|
purePermissionButtonLogin: 登录接口返回按钮权限
|
||||||
|
status:
|
||||||
|
pureLoad: 加载中...
|
||||||
|
pureMessage: 消息
|
||||||
|
pureNotify: 通知
|
||||||
|
pureTodo: 待办
|
||||||
|
pureNoMessage: 暂无消息
|
||||||
|
pureNoNotify: 暂无通知
|
||||||
|
pureNoTodo: 暂无待办
|
||||||
|
login:
|
||||||
|
pureUsername: 账号
|
||||||
|
purePassword: 密码
|
||||||
|
pureLogin: 登录
|
||||||
|
pureLoginSuccess: 登录成功
|
||||||
|
pureLoginFail: 登录失败
|
||||||
|
pureUsernameReg: 请输入账号
|
||||||
|
purePassWordReg: 请输入密码
|
||||||
|
purePassWordRuleReg: 密码格式应为8-18位数字、字母、符号的任意两种组合
|
||||||
@@ -9,7 +9,7 @@ import { defineFakeRoute } from "vite-plugin-fake-server/client";
|
|||||||
const permissionRouter = {
|
const permissionRouter = {
|
||||||
path: "/permission",
|
path: "/permission",
|
||||||
meta: {
|
meta: {
|
||||||
title: "权限管理",
|
title: "menus.purePermission",
|
||||||
icon: "ep:lollipop",
|
icon: "ep:lollipop",
|
||||||
rank: 10
|
rank: 10
|
||||||
},
|
},
|
||||||
@@ -18,22 +18,39 @@ const permissionRouter = {
|
|||||||
path: "/permission/page/index",
|
path: "/permission/page/index",
|
||||||
name: "PermissionPage",
|
name: "PermissionPage",
|
||||||
meta: {
|
meta: {
|
||||||
title: "页面权限",
|
title: "menus.purePermissionPage",
|
||||||
roles: ["admin", "common"]
|
roles: ["admin", "common"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/permission/button/index",
|
path: "/permission/button",
|
||||||
name: "PermissionButton",
|
|
||||||
meta: {
|
meta: {
|
||||||
title: "按钮权限",
|
title: "menus.purePermissionButton",
|
||||||
roles: ["admin", "common"],
|
roles: ["admin", "common"]
|
||||||
auths: [
|
},
|
||||||
"permission:btn:add",
|
children: [
|
||||||
"permission:btn:edit",
|
{
|
||||||
"permission:btn:delete"
|
path: "/permission/button/router",
|
||||||
]
|
component: "permission/button/index",
|
||||||
}
|
name: "PermissionButtonRouter",
|
||||||
|
meta: {
|
||||||
|
title: "menus.purePermissionButtonRouter",
|
||||||
|
auths: [
|
||||||
|
"permission:btn:add",
|
||||||
|
"permission:btn:edit",
|
||||||
|
"permission:btn:delete"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/permission/button/login",
|
||||||
|
component: "permission/button/perms",
|
||||||
|
name: "PermissionButtonLogin",
|
||||||
|
meta: {
|
||||||
|
title: "menus.purePermissionButtonLogin"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -10,9 +10,13 @@ export default defineFakeRoute([
|
|||||||
return {
|
return {
|
||||||
success: true,
|
success: true,
|
||||||
data: {
|
data: {
|
||||||
|
avatar: "https://avatars.githubusercontent.com/u/44761321",
|
||||||
username: "admin",
|
username: "admin",
|
||||||
|
nickname: "小铭",
|
||||||
// 一个用户可能有多个角色
|
// 一个用户可能有多个角色
|
||||||
roles: ["admin"],
|
roles: ["admin"],
|
||||||
|
// 按钮级别权限
|
||||||
|
permissions: ["*:*:*"],
|
||||||
accessToken: "eyJhbGciOiJIUzUxMiJ9.admin",
|
accessToken: "eyJhbGciOiJIUzUxMiJ9.admin",
|
||||||
refreshToken: "eyJhbGciOiJIUzUxMiJ9.adminRefresh",
|
refreshToken: "eyJhbGciOiJIUzUxMiJ9.adminRefresh",
|
||||||
expires: "2030/10/30 00:00:00"
|
expires: "2030/10/30 00:00:00"
|
||||||
@@ -22,9 +26,11 @@ export default defineFakeRoute([
|
|||||||
return {
|
return {
|
||||||
success: true,
|
success: true,
|
||||||
data: {
|
data: {
|
||||||
|
avatar: "https://avatars.githubusercontent.com/u/52823142",
|
||||||
username: "common",
|
username: "common",
|
||||||
// 一个用户可能有多个角色
|
nickname: "小林",
|
||||||
roles: ["common"],
|
roles: ["common"],
|
||||||
|
permissions: ["permission:btn:add", "permission:btn:edit"],
|
||||||
accessToken: "eyJhbGciOiJIUzUxMiJ9.common",
|
accessToken: "eyJhbGciOiJIUzUxMiJ9.common",
|
||||||
refreshToken: "eyJhbGciOiJIUzUxMiJ9.commonRefresh",
|
refreshToken: "eyJhbGciOiJIUzUxMiJ9.commonRefresh",
|
||||||
expires: "2030/10/30 00:00:00"
|
expires: "2030/10/30 00:00:00"
|
||||||
|
|||||||
168
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "pure-admin-thin",
|
"name": "pure-admin-thin",
|
||||||
"version": "5.1.0",
|
"version": "6.2.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -13,7 +13,6 @@
|
|||||||
"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",
|
||||||
"svgo": "svgo -f . -r",
|
"svgo": "svgo -f . -r",
|
||||||
"cloc": "NODE_OPTIONS=--max-old-space-size=4096 cloc . --exclude-dir=node_modules --exclude-lang=YAML",
|
|
||||||
"clean:cache": "rimraf .eslintcache && rimraf pnpm-lock.yaml && rimraf node_modules && pnpm store prune && pnpm install",
|
"clean:cache": "rimraf .eslintcache && rimraf pnpm-lock.yaml && rimraf node_modules && pnpm store prune && pnpm install",
|
||||||
"lint:eslint": "eslint --cache --max-warnings 0 \"{src,mock,build}/**/*.{vue,js,ts,tsx}\" --fix",
|
"lint:eslint": "eslint --cache --max-warnings 0 \"{src,mock,build}/**/*.{vue,js,ts,tsx}\" --fix",
|
||||||
"lint:prettier": "prettier --write \"src/**/*.{js,ts,json,tsx,css,scss,vue,html,md}\"",
|
"lint:prettier": "prettier --write \"src/**/*.{js,ts,json,tsx,css,scss,vue,html,md}\"",
|
||||||
@@ -23,6 +22,7 @@
|
|||||||
"preinstall": "npx only-allow pnpm"
|
"preinstall": "npx only-allow pnpm"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
"pure-admin-thin",
|
||||||
"vue-pure-admin",
|
"vue-pure-admin",
|
||||||
"element-plus",
|
"element-plus",
|
||||||
"tailwindcss",
|
"tailwindcss",
|
||||||
@@ -33,13 +33,13 @@
|
|||||||
"vite",
|
"vite",
|
||||||
"esm"
|
"esm"
|
||||||
],
|
],
|
||||||
"homepage": "https://github.com/pure-admin/pure-admin-thin",
|
"homepage": "https://github.com/pure-admin/pure-admin-thin/tree/i18n",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/pure-admin/pure-admin-thin.git"
|
"url": "git+https://github.com/pure-admin/pure-admin-thin.git"
|
||||||
},
|
},
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/pure-admin/pure-admin-thin/issues"
|
"url": "https://github.com/pure-admin/vue-pure-admin/issues"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"author": {
|
"author": {
|
||||||
@@ -48,101 +48,117 @@
|
|||||||
"url": "https://github.com/xiaoxian521"
|
"url": "https://github.com/xiaoxian521"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pureadmin/descriptions": "^1.2.0",
|
"@pureadmin/descriptions": "^1.2.1",
|
||||||
"@pureadmin/table": "^3.1.2",
|
"@pureadmin/table": "^3.3.0",
|
||||||
"@pureadmin/utils": "^2.4.5",
|
"@pureadmin/utils": "^2.6.2",
|
||||||
"@vueuse/core": "^10.9.0",
|
"@vueuse/core": "^14.0.0",
|
||||||
"@vueuse/motion": "^2.1.0",
|
"@vueuse/motion": "^3.0.3",
|
||||||
"animate.css": "^4.1.1",
|
"animate.css": "^4.1.1",
|
||||||
"axios": "^1.6.7",
|
"axios": "^1.12.2",
|
||||||
"dayjs": "^1.11.10",
|
"dayjs": "^1.11.18",
|
||||||
"echarts": "^5.5.0",
|
"echarts": "^6.0.0",
|
||||||
"element-plus": "^2.6.0",
|
"element-plus": "^2.11.5",
|
||||||
"js-cookie": "^3.0.5",
|
"js-cookie": "^3.0.5",
|
||||||
"localforage": "^1.10.0",
|
"localforage": "^1.10.0",
|
||||||
"mitt": "^3.0.1",
|
"mitt": "^3.0.1",
|
||||||
"nprogress": "^0.2.0",
|
"nprogress": "^0.2.0",
|
||||||
"path": "^0.12.7",
|
"path-browserify": "^1.0.1",
|
||||||
"pinia": "^2.1.7",
|
"pinia": "^3.0.3",
|
||||||
"pinyin-pro": "^3.19.6",
|
"pinyin-pro": "^3.27.0",
|
||||||
"qs": "^6.11.2",
|
"qs": "^6.14.0",
|
||||||
"responsive-storage": "^2.2.0",
|
"responsive-storage": "^2.2.0",
|
||||||
"sortablejs": "^1.15.2",
|
"sortablejs": "^1.15.6",
|
||||||
"vue": "^3.4.21",
|
"vue": "^3.5.22",
|
||||||
"vue-router": "^4.3.0",
|
"vue-i18n": "^11.1.12",
|
||||||
"vue-tippy": "^6.4.1",
|
"vue-router": "^4.6.3",
|
||||||
"vue-types": "^5.1.1"
|
"vue-tippy": "^6.7.1",
|
||||||
|
"vue-types": "^6.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@commitlint/cli": "^18.6.1",
|
"@commitlint/cli": "^20.1.0",
|
||||||
"@commitlint/config-conventional": "^18.6.2",
|
"@commitlint/config-conventional": "^20.0.0",
|
||||||
"@commitlint/types": "^18.6.1",
|
"@commitlint/types": "^20.0.0",
|
||||||
"@eslint/js": "^8.57.0",
|
"@eslint/js": "^9.38.0",
|
||||||
"@faker-js/faker": "^8.4.1",
|
"@faker-js/faker": "^10.1.0",
|
||||||
"@iconify-icons/ep": "^1.2.12",
|
"@iconify/json": "^2.2.400",
|
||||||
"@iconify-icons/ri": "^1.2.10",
|
"@iconify/vue": "4.2.0",
|
||||||
"@iconify/vue": "^4.1.1",
|
"@intlify/unplugin-vue-i18n": "^11.0.1",
|
||||||
"@pureadmin/theme": "^3.2.0",
|
"@tailwindcss/vite": "^4.1.16",
|
||||||
"@types/gradient-string": "^1.1.5",
|
|
||||||
"@types/js-cookie": "^3.0.6",
|
"@types/js-cookie": "^3.0.6",
|
||||||
"@types/node": "^20.11.24",
|
"@types/node": "^20.19.23",
|
||||||
"@types/nprogress": "^0.2.3",
|
"@types/nprogress": "^0.2.3",
|
||||||
"@types/qs": "^6.9.12",
|
"@types/path-browserify": "^1.0.3",
|
||||||
"@types/sortablejs": "^1.15.8",
|
"@types/qs": "^6.14.0",
|
||||||
"@typescript-eslint/eslint-plugin": "^7.1.1",
|
"@types/sortablejs": "^1.15.9",
|
||||||
"@typescript-eslint/parser": "^7.1.1",
|
"@vitejs/plugin-vue": "^6.0.1",
|
||||||
"@vitejs/plugin-vue": "^5.0.4",
|
"@vitejs/plugin-vue-jsx": "^5.1.1",
|
||||||
"@vitejs/plugin-vue-jsx": "^3.1.0",
|
"boxen": "^8.0.1",
|
||||||
"autoprefixer": "^10.4.18",
|
"code-inspector-plugin": "^1.2.10",
|
||||||
"boxen": "^7.1.1",
|
"cssnano": "^7.1.1",
|
||||||
"cloc": "^2.11.0",
|
"eslint": "^9.38.0",
|
||||||
"cssnano": "^6.0.5",
|
"eslint-config-prettier": "^10.1.8",
|
||||||
"eslint": "^8.57.0",
|
"eslint-plugin-prettier": "^5.5.4",
|
||||||
"eslint-config-prettier": "^9.1.0",
|
"eslint-plugin-vue": "^10.5.1",
|
||||||
"eslint-define-config": "^2.1.0",
|
"gradient-string": "^3.0.0",
|
||||||
"eslint-plugin-prettier": "^5.1.3",
|
"husky": "^9.1.7",
|
||||||
"eslint-plugin-vue": "^9.22.0",
|
"lint-staged": "^16.2.6",
|
||||||
"gradient-string": "^2.0.2",
|
"postcss": "^8.5.6",
|
||||||
"husky": "^9.0.11",
|
"postcss-html": "^1.8.0",
|
||||||
"lint-staged": "^15.2.2",
|
"postcss-load-config": "^6.0.1",
|
||||||
"postcss": "^8.4.35",
|
|
||||||
"postcss-html": "^1.6.0",
|
|
||||||
"postcss-import": "^16.0.1",
|
|
||||||
"postcss-scss": "^4.0.9",
|
"postcss-scss": "^4.0.9",
|
||||||
"prettier": "^3.2.5",
|
"prettier": "^3.6.2",
|
||||||
"rimraf": "^5.0.5",
|
"rimraf": "^6.0.1",
|
||||||
"rollup-plugin-visualizer": "^5.12.0",
|
"rollup-plugin-visualizer": "^6.0.5",
|
||||||
"sass": "^1.71.1",
|
"sass": "^1.93.2",
|
||||||
"stylelint": "^16.2.1",
|
"stylelint": "^16.25.0",
|
||||||
"stylelint-config-recess-order": "^5.0.0",
|
"stylelint-config-recess-order": "^7.4.0",
|
||||||
"stylelint-config-recommended-vue": "^1.5.0",
|
"stylelint-config-recommended-vue": "^1.6.1",
|
||||||
"stylelint-config-standard-scss": "^13.0.0",
|
"stylelint-config-standard-scss": "^14.0.0",
|
||||||
"stylelint-prettier": "^5.0.0",
|
"stylelint-prettier": "^5.0.3",
|
||||||
"svgo": "^3.2.0",
|
"svgo": "^4.0.0",
|
||||||
"tailwindcss": "^3.4.1",
|
"tailwindcss": "^4.1.16",
|
||||||
"typescript": "^5.3.3",
|
"typescript": "^5.9.3",
|
||||||
"vite": "^5.1.5",
|
"typescript-eslint": "^8.46.2",
|
||||||
"vite-plugin-cdn-import": "^0.3.5",
|
"unplugin-icons": "^22.5.0",
|
||||||
|
"vite": "^7.1.12",
|
||||||
|
"vite-plugin-cdn-import": "^1.0.1",
|
||||||
"vite-plugin-compression": "^0.5.1",
|
"vite-plugin-compression": "^0.5.1",
|
||||||
"vite-plugin-fake-server": "^2.1.1",
|
"vite-plugin-fake-server": "^2.2.0",
|
||||||
"vite-plugin-remove-console": "^2.2.0",
|
"vite-plugin-remove-console": "^2.2.0",
|
||||||
"vite-plugin-router-warn": "^1.0.0",
|
"vite-plugin-router-warn": "^1.0.0",
|
||||||
"vite-svg-loader": "^5.1.0",
|
"vite-svg-loader": "^5.1.0",
|
||||||
"vue-eslint-parser": "^9.4.2",
|
"vue-eslint-parser": "^10.2.0",
|
||||||
"vue-tsc": "^1.8.27"
|
"vue-tsc": "^3.1.2"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0",
|
"node": "^20.19.0 || >=22.13.0",
|
||||||
"pnpm": ">=8.6.10"
|
"pnpm": ">=9"
|
||||||
},
|
},
|
||||||
"packageManager": "pnpm@8.6.10",
|
|
||||||
"pnpm": {
|
"pnpm": {
|
||||||
"allowedDeprecatedVersions": {
|
"allowedDeprecatedVersions": {
|
||||||
|
"are-we-there-yet": "*",
|
||||||
"sourcemap-codec": "*",
|
"sourcemap-codec": "*",
|
||||||
|
"lodash.isequal": "*",
|
||||||
"domexception": "*",
|
"domexception": "*",
|
||||||
"w3c-hr-time": "*",
|
"w3c-hr-time": "*",
|
||||||
|
"inflight": "*",
|
||||||
|
"npmlog": "*",
|
||||||
|
"rimraf": "*",
|
||||||
"stable": "*",
|
"stable": "*",
|
||||||
"abab": "*"
|
"gauge": "*",
|
||||||
}
|
"abab": "*",
|
||||||
|
"glob": "*"
|
||||||
|
},
|
||||||
|
"onlyBuiltDependencies": [
|
||||||
|
"@parcel/watcher",
|
||||||
|
"core-js",
|
||||||
|
"es5-ext",
|
||||||
|
"esbuild",
|
||||||
|
"typeit",
|
||||||
|
"vue-demi"
|
||||||
|
],
|
||||||
|
"ignoredBuiltDependencies": [
|
||||||
|
"@tailwindcss/oxide"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
11307
pnpm-lock.yaml
generated
@@ -3,10 +3,6 @@
|
|||||||
/** @type {import('postcss-load-config').Config} */
|
/** @type {import('postcss-load-config').Config} */
|
||||||
export default {
|
export default {
|
||||||
plugins: {
|
plugins: {
|
||||||
"postcss-import": {},
|
|
||||||
"tailwindcss/nesting": {},
|
|
||||||
tailwindcss: {},
|
|
||||||
autoprefixer: {},
|
|
||||||
...(process.env.NODE_ENV === "production" ? { cssnano: {} } : {})
|
...(process.env.NODE_ENV === "production" ? { cssnano: {} } : {})
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
{
|
{
|
||||||
"Version": "5.1.0",
|
"Version": "6.2.0",
|
||||||
"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": "light",
|
"Theme": "light",
|
||||||
"DarkMode": false,
|
"DarkMode": false,
|
||||||
@@ -13,6 +14,7 @@
|
|||||||
"Weak": false,
|
"Weak": false,
|
||||||
"HideTabs": false,
|
"HideTabs": false,
|
||||||
"HideFooter": false,
|
"HideFooter": false,
|
||||||
|
"Stretch": false,
|
||||||
"SidebarStatus": true,
|
"SidebarStatus": true,
|
||||||
"EpThemeColor": "#409EFF",
|
"EpThemeColor": "#409EFF",
|
||||||
"ShowLogo": true,
|
"ShowLogo": true,
|
||||||
|
|||||||
@@ -8,8 +8,10 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent } from "vue";
|
import { defineComponent } from "vue";
|
||||||
import { ElConfigProvider } from "element-plus";
|
import { ElConfigProvider } from "element-plus";
|
||||||
import zhCn from "element-plus/dist/locale/zh-cn.mjs";
|
|
||||||
import { ReDialog } from "@/components/ReDialog";
|
import { ReDialog } from "@/components/ReDialog";
|
||||||
|
import en from "element-plus/es/locale/lang/en";
|
||||||
|
import zhCn from "element-plus/es/locale/lang/zh-cn";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "app",
|
name: "app",
|
||||||
components: {
|
components: {
|
||||||
@@ -18,7 +20,7 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
currentLocale() {
|
currentLocale() {
|
||||||
return zhCn;
|
return this.$storage.locale?.locale === "zh" ? zhCn : en;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,10 +3,16 @@ import { http } from "@/utils/http";
|
|||||||
export type UserResult = {
|
export type UserResult = {
|
||||||
success: boolean;
|
success: boolean;
|
||||||
data: {
|
data: {
|
||||||
|
/** 头像 */
|
||||||
|
avatar: string;
|
||||||
/** 用户名 */
|
/** 用户名 */
|
||||||
username: string;
|
username: string;
|
||||||
/** 当前登陆用户的角色 */
|
/** 昵称 */
|
||||||
|
nickname: string;
|
||||||
|
/** 当前登录用户的角色 */
|
||||||
roles: Array<string>;
|
roles: Array<string>;
|
||||||
|
/** 按钮级别权限 */
|
||||||
|
permissions: Array<string>;
|
||||||
/** `token` */
|
/** `token` */
|
||||||
accessToken: string;
|
accessToken: string;
|
||||||
/** 用于调用刷新`accessToken`的接口时所需的`token` */
|
/** 用于调用刷新`accessToken`的接口时所需的`token` */
|
||||||
@@ -33,7 +39,7 @@ export const getLogin = (data?: object) => {
|
|||||||
return http.request<UserResult>("post", "/login", { data });
|
return http.request<UserResult>("post", "/login", { data });
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 刷新token */
|
/** 刷新`token` */
|
||||||
export const refreshTokenApi = (data?: object) => {
|
export const refreshTokenApi = (data?: object) => {
|
||||||
return http.request<RefreshTokenResult>("post", "/refresh-token", { data });
|
return http.request<RefreshTokenResult>("post", "/refresh-token", { data });
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
<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-8"/></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" 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-8"/></svg>
|
||||||
|
Before Width: | Height: | Size: 351 B After Width: | Height: | Size: 332 B |
@@ -1 +1 @@
|
|||||||
<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.5zM13 3V1h-1v2.5l.5.5H15V3zm-1 9.5V15h1v-2h2v-1h-2.5zM1 12v1h2v2h1v-2.5l-.5-.5zm11-1.5-.5.5h-7l-.5-.5v-5l.5-.5h7l.5.5zM10 7H6v2h4z"/></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" class="re-screen" color="#00000073" viewBox="0 0 16 16"><path fill="currentColor" d="M3.5 4H1V3h2V1h1v2.5zM13 3V1h-1v2.5l.5.5H15V3zm-1 9.5V15h1v-2h2v-1h-2.5zM1 12v1h2v2h1v-2.5l-.5-.5zm11-1.5-.5.5h-7l-.5-.5v-5l.5-.5h7l.5.5zM10 7H6v2h4z"/></svg>
|
||||||
|
Before Width: | Height: | Size: 327 B After Width: | Height: | Size: 308 B |
@@ -1 +1 @@
|
|||||||
<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 12h10V4H3zm2-6h6v4H5zM2 6H1V2.5l.5-.5H5v1H2zm13-3.5V6h-1V3h-3V2h3.5zM14 10h1v3.5l-.5.5H11v-1h3zM2 13h3v1H1.5l-.5-.5V10h1z"/></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" class="re-screen" color="#00000073" viewBox="0 0 16 16"><path fill="currentColor" d="M3 12h10V4H3zm2-6h6v4H5zM2 6H1V2.5l.5-.5H5v1H2zm13-3.5V6h-1V3h-3V2h3.5zM14 10h1v3.5l-.5.5H11v-1h3zM2 13h3v1H1.5l-.5-.5V10h1z"/></svg>
|
||||||
|
Before Width: | Height: | Size: 302 B After Width: | Height: | Size: 283 B |
1
src/assets/svg/globalization.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" class="globalization" viewBox="0 0 512 512"><path fill="currentColor" d="m478.33 433.6-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 362 368 281.65 401.17 362zm-66.99-19.08a22 22 0 0 0-4.89-30.7c-.2-.15-15-11.13-36.49-34.73 39.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.36-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.93.92 1.19 1.83 2.35 2.74 3.51-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.59 22.52 24.08 38 35.44 38.93 36.1a22 22 0 0 0 30.75-4.9z"/></svg>
|
||||||
|
After Width: | Height: | Size: 807 B |
@@ -1 +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 7h6v2H3v2h4v2H3v2h4v2H1zm10 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-2"/></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" class="iconify iconify--mdi" viewBox="0 0 24 24"><path fill="currentColor" d="M1 7h6v2H3v2h4v2H3v2h4v2H1zm10 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-2"/></svg>
|
||||||
|
Before Width: | Height: | Size: 379 B After Width: | Height: | Size: 360 B |
|
Before Width: | Height: | Size: 439 B After Width: | Height: | Size: 439 B |
1
src/assets/table-bar/drag.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<svg width="32" height="32" fill="currentColor" data-icon="holder" viewBox="64 64 896 896"><path d="M300 276.5a56 56 0 1 0 56-97 56 56 0 0 0-56 97m0 284a56 56 0 1 0 56-97 56 56 0 0 0-56 97M640 228a56 56 0 1 0 112 0 56 56 0 0 0-112 0m0 284a56 56 0 1 0 112 0 56 56 0 0 0-112 0M300 844.5a56 56 0 1 0 56-97 56 56 0 0 0-56 97M640 796a56 56 0 1 0 112 0 56 56 0 0 0-112 0"/></svg>
|
||||||
|
After Width: | Height: | Size: 373 B |
|
Before Width: | Height: | Size: 161 B After Width: | Height: | Size: 161 B |
|
Before Width: | Height: | Size: 235 B After Width: | Height: | Size: 235 B |
|
Before Width: | Height: | Size: 840 B After Width: | Height: | Size: 840 B |
@@ -29,9 +29,11 @@ const addDialog = (options: DialogOptions) => {
|
|||||||
const closeDialog = (options: DialogOptions, index: number, args?: any) => {
|
const closeDialog = (options: DialogOptions, index: number, args?: any) => {
|
||||||
dialogStore.value[index].visible = false;
|
dialogStore.value[index].visible = false;
|
||||||
options.closeCallBack && options.closeCallBack({ options, index, args });
|
options.closeCallBack && options.closeCallBack({ options, index, args });
|
||||||
|
|
||||||
|
const closeDelay = options?.closeDelay ?? 200;
|
||||||
useTimeoutFn(() => {
|
useTimeoutFn(() => {
|
||||||
dialogStore.value.splice(index, 1);
|
dialogStore.value.splice(index, 1);
|
||||||
}, 200);
|
}, closeDelay);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -51,8 +53,8 @@ const closeAllDialog = () => {
|
|||||||
|
|
||||||
/** 千万别忘了在下面这三处引入并注册下,放心注册,不使用`addDialog`调用就不会被挂载
|
/** 千万别忘了在下面这三处引入并注册下,放心注册,不使用`addDialog`调用就不会被挂载
|
||||||
* https://github.com/pure-admin/vue-pure-admin/blob/main/src/App.vue#L4
|
* https://github.com/pure-admin/vue-pure-admin/blob/main/src/App.vue#L4
|
||||||
* https://github.com/pure-admin/vue-pure-admin/blob/main/src/App.vue#L13
|
* https://github.com/pure-admin/vue-pure-admin/blob/main/src/App.vue#L12
|
||||||
* https://github.com/pure-admin/vue-pure-admin/blob/main/src/App.vue#L20
|
* https://github.com/pure-admin/vue-pure-admin/blob/main/src/App.vue#L22
|
||||||
*/
|
*/
|
||||||
const ReDialog = withInstall(reDialog);
|
const ReDialog = withInstall(reDialog);
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,21 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {
|
import {
|
||||||
closeDialog,
|
|
||||||
dialogStore,
|
|
||||||
type EventType,
|
type EventType,
|
||||||
type ButtonProps,
|
type ButtonProps,
|
||||||
type DialogOptions
|
type DialogOptions,
|
||||||
|
closeDialog,
|
||||||
|
dialogStore
|
||||||
} from "./index";
|
} from "./index";
|
||||||
import { ref, computed } from "vue";
|
import { ref, computed } from "vue";
|
||||||
import { isFunction } from "@pureadmin/utils";
|
import { isFunction } from "@pureadmin/utils";
|
||||||
import Fullscreen from "@iconify-icons/ri/fullscreen-fill";
|
import Fullscreen from "~icons/ri/fullscreen-fill";
|
||||||
import ExitFullscreen from "@iconify-icons/ri/fullscreen-exit-fill";
|
import ExitFullscreen from "~icons/ri/fullscreen-exit-fill";
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
name: "ReDialog"
|
||||||
|
});
|
||||||
|
|
||||||
|
const sureBtnMap = ref({});
|
||||||
const fullscreen = ref(false);
|
const fullscreen = ref(false);
|
||||||
|
|
||||||
const footerButtons = computed(() => {
|
const footerButtons = computed(() => {
|
||||||
@@ -37,11 +42,28 @@ const footerButtons = computed(() => {
|
|||||||
type: "primary",
|
type: "primary",
|
||||||
text: true,
|
text: true,
|
||||||
bg: true,
|
bg: true,
|
||||||
|
popconfirm: options?.popconfirm,
|
||||||
btnClick: ({ dialog: { options, index } }) => {
|
btnClick: ({ dialog: { options, index } }) => {
|
||||||
const done = () =>
|
if (options?.sureBtnLoading) {
|
||||||
|
sureBtnMap.value[index] = Object.assign(
|
||||||
|
{},
|
||||||
|
sureBtnMap.value[index],
|
||||||
|
{
|
||||||
|
loading: true
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
const closeLoading = () => {
|
||||||
|
if (options?.sureBtnLoading) {
|
||||||
|
sureBtnMap.value[index].loading = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const done = () => {
|
||||||
|
closeLoading();
|
||||||
closeDialog(options, index, { command: "sure" });
|
closeDialog(options, index, { command: "sure" });
|
||||||
|
};
|
||||||
if (options?.beforeSure && isFunction(options?.beforeSure)) {
|
if (options?.beforeSure && isFunction(options?.beforeSure)) {
|
||||||
options.beforeSure(done, { options, index });
|
options.beforeSure(done, { options, index, closeLoading });
|
||||||
} else {
|
} else {
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
@@ -57,16 +79,17 @@ const fullscreenClass = computed(() => {
|
|||||||
"el-dialog__close",
|
"el-dialog__close",
|
||||||
"-translate-x-2",
|
"-translate-x-2",
|
||||||
"cursor-pointer",
|
"cursor-pointer",
|
||||||
"hover:!text-[red]"
|
"hover:text-[red]!"
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
function eventsCallBack(
|
function eventsCallBack(
|
||||||
event: EventType,
|
event: EventType,
|
||||||
options: DialogOptions,
|
options: DialogOptions,
|
||||||
index: number
|
index: number,
|
||||||
|
isClickFullScreen = false
|
||||||
) {
|
) {
|
||||||
fullscreen.value = options?.fullscreen ?? false;
|
if (!isClickFullScreen) fullscreen.value = options?.fullscreen ?? false;
|
||||||
if (options?.[event] && isFunction(options?.[event])) {
|
if (options?.[event] && isFunction(options?.[event])) {
|
||||||
return options?.[event]({ options, index });
|
return options?.[event]({ options, index });
|
||||||
}
|
}
|
||||||
@@ -108,7 +131,17 @@ function handleClose(
|
|||||||
<i
|
<i
|
||||||
v-if="!options?.fullscreen"
|
v-if="!options?.fullscreen"
|
||||||
:class="fullscreenClass"
|
:class="fullscreenClass"
|
||||||
@click="fullscreen = !fullscreen"
|
@click="
|
||||||
|
() => {
|
||||||
|
fullscreen = !fullscreen;
|
||||||
|
eventsCallBack(
|
||||||
|
'fullscreenCallBack',
|
||||||
|
{ ...options, fullscreen },
|
||||||
|
index,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
}
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<IconifyIconOffline
|
<IconifyIconOffline
|
||||||
class="pure-dialog-svg"
|
class="pure-dialog-svg"
|
||||||
@@ -138,19 +171,35 @@ function handleClose(
|
|||||||
<component :is="options?.footerRenderer({ options, index })" />
|
<component :is="options?.footerRenderer({ options, index })" />
|
||||||
</template>
|
</template>
|
||||||
<span v-else>
|
<span v-else>
|
||||||
<el-button
|
<template v-for="(btn, key) in footerButtons(options)" :key="key">
|
||||||
v-for="(btn, key) in footerButtons(options)"
|
<el-popconfirm
|
||||||
:key="key"
|
v-if="btn.popconfirm"
|
||||||
v-bind="btn"
|
v-bind="btn.popconfirm"
|
||||||
@click="
|
@confirm="
|
||||||
btn.btnClick({
|
btn.btnClick({
|
||||||
dialog: { options, index },
|
dialog: { options, index },
|
||||||
button: { btn, index: key }
|
button: { btn, index: key }
|
||||||
})
|
})
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
{{ btn?.label }}
|
<template #reference>
|
||||||
</el-button>
|
<el-button v-bind="btn">{{ btn?.label }}</el-button>
|
||||||
|
</template>
|
||||||
|
</el-popconfirm>
|
||||||
|
<el-button
|
||||||
|
v-else
|
||||||
|
v-bind="btn"
|
||||||
|
:loading="key === 1 && sureBtnMap[index]?.loading"
|
||||||
|
@click="
|
||||||
|
btn.btnClick({
|
||||||
|
dialog: { options, index },
|
||||||
|
button: { btn, index: key }
|
||||||
|
})
|
||||||
|
"
|
||||||
|
>
|
||||||
|
{{ btn?.label }}
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|||||||
@@ -1,11 +1,23 @@
|
|||||||
import type { CSSProperties, VNode, Component } from "vue";
|
import type { CSSProperties, VNode, Component } from "vue";
|
||||||
|
|
||||||
type DoneFn = (cancel?: boolean) => void;
|
type DoneFn = (cancel?: boolean) => void;
|
||||||
type EventType = "open" | "close" | "openAutoFocus" | "closeAutoFocus";
|
type EventType =
|
||||||
|
| "open"
|
||||||
|
| "close"
|
||||||
|
| "openAutoFocus"
|
||||||
|
| "closeAutoFocus"
|
||||||
|
| "fullscreenCallBack";
|
||||||
type ArgsType = {
|
type ArgsType = {
|
||||||
/** `cancel` 点击取消按钮、`sure` 点击确定按钮、`close` 点击右上角关闭按钮或空白页或按下了esc键 */
|
/** `cancel` 点击取消按钮、`sure` 点击确定按钮、`close` 点击右上角关闭按钮或空白页或按下了esc键 */
|
||||||
command: "cancel" | "sure" | "close";
|
command: "cancel" | "sure" | "close";
|
||||||
};
|
};
|
||||||
|
type ButtonType =
|
||||||
|
| "primary"
|
||||||
|
| "success"
|
||||||
|
| "warning"
|
||||||
|
| "danger"
|
||||||
|
| "info"
|
||||||
|
| "text";
|
||||||
|
|
||||||
/** https://element-plus.org/zh-CN/component/dialog.html#attributes */
|
/** https://element-plus.org/zh-CN/component/dialog.html#attributes */
|
||||||
type DialogProps = {
|
type DialogProps = {
|
||||||
@@ -53,6 +65,34 @@ type DialogProps = {
|
|||||||
destroyOnClose?: boolean;
|
destroyOnClose?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//element-plus.org/zh-CN/component/popconfirm.html#attributes
|
||||||
|
type Popconfirm = {
|
||||||
|
/** 标题 */
|
||||||
|
title?: string;
|
||||||
|
/** 确定按钮文字 */
|
||||||
|
confirmButtonText?: string;
|
||||||
|
/** 取消按钮文字 */
|
||||||
|
cancelButtonText?: string;
|
||||||
|
/** 确定按钮类型,默认 `primary` */
|
||||||
|
confirmButtonType?: ButtonType;
|
||||||
|
/** 取消按钮类型,默认 `text` */
|
||||||
|
cancelButtonType?: ButtonType;
|
||||||
|
/** 自定义图标,默认 `QuestionFilled` */
|
||||||
|
icon?: string | Component;
|
||||||
|
/** `Icon` 颜色,默认 `#f90` */
|
||||||
|
iconColor?: string;
|
||||||
|
/** 是否隐藏 `Icon`,默认 `false` */
|
||||||
|
hideIcon?: boolean;
|
||||||
|
/** 关闭时的延迟,默认 `200` */
|
||||||
|
hideAfter?: number;
|
||||||
|
/** 是否将 `popover` 的下拉列表插入至 `body` 元素,默认 `true` */
|
||||||
|
teleported?: boolean;
|
||||||
|
/** 当 `popover` 组件长时间不触发且 `persistent` 属性设置为 `false` 时, `popover` 将会被删除,默认 `false` */
|
||||||
|
persistent?: boolean;
|
||||||
|
/** 弹层宽度,最小宽度 `150px`,默认 `150` */
|
||||||
|
width?: string | number;
|
||||||
|
};
|
||||||
|
|
||||||
type BtnClickDialog = {
|
type BtnClickDialog = {
|
||||||
options?: DialogOptions;
|
options?: DialogOptions;
|
||||||
index?: number;
|
index?: number;
|
||||||
@@ -81,6 +121,8 @@ type ButtonProps = {
|
|||||||
round?: boolean;
|
round?: boolean;
|
||||||
/** 是否为圆形按钮,默认 `false` */
|
/** 是否为圆形按钮,默认 `false` */
|
||||||
circle?: boolean;
|
circle?: boolean;
|
||||||
|
/** 确定按钮的 `Popconfirm` 气泡确认框相关配置 */
|
||||||
|
popconfirm?: Popconfirm;
|
||||||
/** 是否为加载中状态,默认 `false` */
|
/** 是否为加载中状态,默认 `false` */
|
||||||
loading?: boolean;
|
loading?: boolean;
|
||||||
/** 自定义加载中状态图标组件 */
|
/** 自定义加载中状态图标组件 */
|
||||||
@@ -118,6 +160,10 @@ interface DialogOptions extends DialogProps {
|
|||||||
props?: any;
|
props?: any;
|
||||||
/** 是否隐藏 `Dialog` 按钮操作区的内容 */
|
/** 是否隐藏 `Dialog` 按钮操作区的内容 */
|
||||||
hideFooter?: boolean;
|
hideFooter?: boolean;
|
||||||
|
/** 确定按钮的 `Popconfirm` 气泡确认框相关配置 */
|
||||||
|
popconfirm?: Popconfirm;
|
||||||
|
/** 点击确定按钮后是否开启 `loading` 加载动画 */
|
||||||
|
sureBtnLoading?: boolean;
|
||||||
/**
|
/**
|
||||||
* @description 自定义对话框标题的内容渲染器
|
* @description 自定义对话框标题的内容渲染器
|
||||||
* @see {@link https://element-plus.org/zh-CN/component/dialog.html#%E8%87%AA%E5%AE%9A%E4%B9%89%E5%A4%B4%E9%83%A8}
|
* @see {@link https://element-plus.org/zh-CN/component/dialog.html#%E8%87%AA%E5%AE%9A%E4%B9%89%E5%A4%B4%E9%83%A8}
|
||||||
@@ -175,6 +221,14 @@ interface DialogOptions extends DialogProps {
|
|||||||
index: number;
|
index: number;
|
||||||
args: any;
|
args: any;
|
||||||
}) => void;
|
}) => void;
|
||||||
|
/** 点击全屏按钮时的回调 */
|
||||||
|
fullscreenCallBack?: ({
|
||||||
|
options,
|
||||||
|
index
|
||||||
|
}: {
|
||||||
|
options: DialogOptions;
|
||||||
|
index: number;
|
||||||
|
}) => void;
|
||||||
/** 输入焦点聚焦在 `Dialog` 内容时的回调 */
|
/** 输入焦点聚焦在 `Dialog` 内容时的回调 */
|
||||||
openAutoFocus?: ({
|
openAutoFocus?: ({
|
||||||
options,
|
options,
|
||||||
@@ -207,10 +261,13 @@ interface DialogOptions extends DialogProps {
|
|||||||
done: Function,
|
done: Function,
|
||||||
{
|
{
|
||||||
options,
|
options,
|
||||||
index
|
index,
|
||||||
|
closeLoading
|
||||||
}: {
|
}: {
|
||||||
options: DialogOptions;
|
options: DialogOptions;
|
||||||
index: number;
|
index: number;
|
||||||
|
/** 关闭确定按钮的 `loading` 加载动画 */
|
||||||
|
closeLoading: Function;
|
||||||
}
|
}
|
||||||
) => void;
|
) => void;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import fontIcon from "./src/iconfont";
|
|||||||
const IconifyIconOffline = iconifyIconOffline;
|
const IconifyIconOffline = iconifyIconOffline;
|
||||||
/** 在线图标组件 */
|
/** 在线图标组件 */
|
||||||
const IconifyIconOnline = iconifyIconOnline;
|
const IconifyIconOnline = iconifyIconOnline;
|
||||||
/** iconfont组件 */
|
/** `iconfont`组件 */
|
||||||
const FontIcon = fontIcon;
|
const FontIcon = fontIcon;
|
||||||
|
|
||||||
export { IconifyIconOffline, IconifyIconOnline, FontIcon };
|
export { IconifyIconOffline, IconifyIconOnline, FontIcon };
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import type { iconType } from "./types";
|
import type { iconType } from "./types";
|
||||||
import { h, defineComponent, type Component } from "vue";
|
import { h, defineComponent, type Component } from "vue";
|
||||||
import { IconifyIconOnline, IconifyIconOffline, FontIcon } from "../index";
|
import { FontIcon, IconifyIconOnline, IconifyIconOffline } from "../index";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 支持 `iconfont`、自定义 `svg` 以及 `iconify` 中所有的图标
|
* 支持 `iconfont`、自定义 `svg` 以及 `iconify` 中所有的图标
|
||||||
* @see 点击查看文档图标篇 {@link https://yiming_chang.gitee.io/pure-admin-doc/pages/icon/}
|
* @see 点击查看文档图标篇 {@link https://pure-admin.cn/pages/icon/}
|
||||||
* @param icon 必传 图标
|
* @param icon 必传 图标
|
||||||
* @param attrs 可选 iconType 属性
|
* @param attrs 可选 iconType 属性
|
||||||
* @returns Component
|
* @returns Component
|
||||||
@@ -49,10 +49,12 @@ export function useRenderIcon(icon: any, attrs?: iconType): Component {
|
|||||||
return defineComponent({
|
return defineComponent({
|
||||||
name: "Icon",
|
name: "Icon",
|
||||||
render() {
|
render() {
|
||||||
const IconifyIcon =
|
if (!icon) return;
|
||||||
icon && icon.includes(":") ? IconifyIconOnline : IconifyIconOffline;
|
const IconifyIcon = icon.includes(":")
|
||||||
|
? IconifyIconOnline
|
||||||
|
: IconifyIconOffline;
|
||||||
return h(IconifyIcon, {
|
return h(IconifyIcon, {
|
||||||
icon: icon,
|
icon,
|
||||||
...attrs
|
...attrs
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,8 +27,7 @@ export default defineComponent({
|
|||||||
return h(
|
return h(
|
||||||
"svg",
|
"svg",
|
||||||
{
|
{
|
||||||
class: "icon-svg",
|
class: "icon-svg"
|
||||||
"aria-hidden": true
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
default: () => [
|
default: () => [
|
||||||
|
|||||||
@@ -13,18 +13,35 @@ export default defineComponent({
|
|||||||
render() {
|
render() {
|
||||||
if (typeof this.icon === "object") addIcon(this.icon, this.icon);
|
if (typeof this.icon === "object") addIcon(this.icon, this.icon);
|
||||||
const attrs = this.$attrs;
|
const attrs = this.$attrs;
|
||||||
return h(
|
if (typeof this.icon === "string") {
|
||||||
IconifyIcon,
|
return h(
|
||||||
{
|
IconifyIcon,
|
||||||
icon: this.icon,
|
{
|
||||||
style: attrs?.style
|
icon: this.icon,
|
||||||
? Object.assign(attrs.style, { outline: "none" })
|
"aria-hidden": false,
|
||||||
: { outline: "none" },
|
style: attrs?.style
|
||||||
...attrs
|
? Object.assign(attrs.style, { outline: "none" })
|
||||||
},
|
: { outline: "none" },
|
||||||
{
|
...attrs
|
||||||
default: () => []
|
},
|
||||||
}
|
{
|
||||||
);
|
default: () => []
|
||||||
|
}
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return h(
|
||||||
|
this.icon,
|
||||||
|
{
|
||||||
|
"aria-hidden": false,
|
||||||
|
style: attrs?.style
|
||||||
|
? Object.assign(attrs.style, { outline: "none" })
|
||||||
|
: { outline: "none" },
|
||||||
|
...attrs
|
||||||
|
},
|
||||||
|
{
|
||||||
|
default: () => []
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ export default defineComponent({
|
|||||||
IconifyIcon,
|
IconifyIcon,
|
||||||
{
|
{
|
||||||
icon: `${this.icon}`,
|
icon: `${this.icon}`,
|
||||||
|
"aria-hidden": false,
|
||||||
style: attrs?.style
|
style: attrs?.style
|
||||||
? Object.assign(attrs.style, { outline: "none" })
|
? Object.assign(attrs.style, { outline: "none" })
|
||||||
: { outline: "none" },
|
: { outline: "none" },
|
||||||
|
|||||||
@@ -1,14 +1,23 @@
|
|||||||
// 这里存放本地图标,在 src/layout/index.vue 文件中加载,避免在首启动加载
|
// 这里存放本地图标,在 src/layout/index.vue 文件中加载,避免在首启动加载
|
||||||
|
import { getSvgInfo } from "@pureadmin/utils";
|
||||||
import { addIcon } from "@iconify/vue/dist/offline";
|
import { addIcon } from "@iconify/vue/dist/offline";
|
||||||
|
|
||||||
|
// https://icon-sets.iconify.design/ep/?keyword=ep
|
||||||
|
import EpHomeFilled from "~icons/ep/home-filled?raw";
|
||||||
|
|
||||||
|
// https://icon-sets.iconify.design/ri/?keyword=ri
|
||||||
|
import RiSearchLine from "~icons/ri/search-line?raw";
|
||||||
|
import RiInformationLine from "~icons/ri/information-line?raw";
|
||||||
|
|
||||||
|
const icons = [
|
||||||
|
// Element Plus Icon: https://github.com/element-plus/element-plus-icons
|
||||||
|
["ep/home-filled", EpHomeFilled],
|
||||||
|
// Remix Icon: https://github.com/Remix-Design/RemixIcon
|
||||||
|
["ri/search-line", RiSearchLine],
|
||||||
|
["ri/information-line", RiInformationLine]
|
||||||
|
];
|
||||||
|
|
||||||
// 本地菜单图标,后端在路由的 icon 中返回对应的图标字符串并且前端在此处使用 addIcon 添加即可渲染菜单图标
|
// 本地菜单图标,后端在路由的 icon 中返回对应的图标字符串并且前端在此处使用 addIcon 添加即可渲染菜单图标
|
||||||
// @iconify-icons/ep
|
icons.forEach(([name, icon]) => {
|
||||||
import Lollipop from "@iconify-icons/ep/lollipop";
|
addIcon(name as string, getSvgInfo(icon as string));
|
||||||
import HomeFilled from "@iconify-icons/ep/home-filled";
|
});
|
||||||
addIcon("ep:lollipop", Lollipop);
|
|
||||||
addIcon("ep:home-filled", HomeFilled);
|
|
||||||
// @iconify-icons/ri
|
|
||||||
import Search from "@iconify-icons/ri/search-line";
|
|
||||||
import InformationLine from "@iconify-icons/ri/information-line";
|
|
||||||
addIcon("ri:search-line", Search);
|
|
||||||
addIcon("ri:information-line", InformationLine);
|
|
||||||
|
|||||||
5
src/components/RePerms/index.ts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
import perms from "./src/perms";
|
||||||
|
|
||||||
|
const Perms = perms;
|
||||||
|
|
||||||
|
export { Perms };
|
||||||
20
src/components/RePerms/src/perms.tsx
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import { defineComponent, Fragment } from "vue";
|
||||||
|
import { hasPerms } from "@/utils/auth";
|
||||||
|
|
||||||
|
export default defineComponent({
|
||||||
|
name: "Perms",
|
||||||
|
props: {
|
||||||
|
value: {
|
||||||
|
type: undefined,
|
||||||
|
default: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
setup(props, { slots }) {
|
||||||
|
return () => {
|
||||||
|
if (!slots) return null;
|
||||||
|
return hasPerms(props.value) ? (
|
||||||
|
<Fragment>{slots.default?.()}</Fragment>
|
||||||
|
) : null;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
@@ -1,5 +1,15 @@
|
|||||||
|
import Sortable from "sortablejs";
|
||||||
|
import { transformI18n } from "@/plugins/i18n";
|
||||||
import { useEpThemeStoreHook } from "@/store/modules/epTheme";
|
import { useEpThemeStoreHook } from "@/store/modules/epTheme";
|
||||||
import { defineComponent, ref, computed, type PropType, nextTick } from "vue";
|
import {
|
||||||
|
type PropType,
|
||||||
|
ref,
|
||||||
|
unref,
|
||||||
|
computed,
|
||||||
|
nextTick,
|
||||||
|
defineComponent,
|
||||||
|
getCurrentInstance
|
||||||
|
} from "vue";
|
||||||
import {
|
import {
|
||||||
delay,
|
delay,
|
||||||
cloneDeep,
|
cloneDeep,
|
||||||
@@ -8,12 +18,13 @@ import {
|
|||||||
getKeyList
|
getKeyList
|
||||||
} from "@pureadmin/utils";
|
} from "@pureadmin/utils";
|
||||||
|
|
||||||
import Sortable from "sortablejs";
|
import Fullscreen from "~icons/ri/fullscreen-fill";
|
||||||
import DragIcon from "./svg/drag.svg?component";
|
import ExitFullscreen from "~icons/ri/fullscreen-exit-fill";
|
||||||
import ExpandIcon from "./svg/expand.svg?component";
|
import DragIcon from "@/assets/table-bar/drag.svg?component";
|
||||||
import RefreshIcon from "./svg/refresh.svg?component";
|
import ExpandIcon from "@/assets/table-bar/expand.svg?component";
|
||||||
import SettingIcon from "./svg/settings.svg?component";
|
import RefreshIcon from "@/assets/table-bar/refresh.svg?component";
|
||||||
import CollapseIcon from "./svg/collapse.svg?component";
|
import SettingIcon from "@/assets/table-bar/settings.svg?component";
|
||||||
|
import CollapseIcon from "@/assets/table-bar/collapse.svg?component";
|
||||||
|
|
||||||
const props = {
|
const props = {
|
||||||
/** 头部最左边的标题 */
|
/** 头部最左边的标题 */
|
||||||
@@ -33,18 +44,24 @@ const props = {
|
|||||||
isExpandAll: {
|
isExpandAll: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true
|
||||||
|
},
|
||||||
|
tableKey: {
|
||||||
|
type: [String, Number] as PropType<string | number>,
|
||||||
|
default: "0"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "PureTableBar",
|
name: "PureTableBar",
|
||||||
props,
|
props,
|
||||||
emits: ["refresh"],
|
emits: ["refresh", "fullscreen"],
|
||||||
setup(props, { emit, slots, attrs }) {
|
setup(props, { emit, slots, attrs }) {
|
||||||
const size = ref("default");
|
const size = ref("default");
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const checkAll = ref(true);
|
const checkAll = ref(true);
|
||||||
|
const isFullscreen = ref(false);
|
||||||
const isIndeterminate = ref(false);
|
const isIndeterminate = ref(false);
|
||||||
|
const instance = getCurrentInstance()!;
|
||||||
const isExpandAll = ref(props.isExpandAll);
|
const isExpandAll = ref(props.isExpandAll);
|
||||||
const filterColumns = cloneDeep(props?.columns).filter(column =>
|
const filterColumns = cloneDeep(props?.columns).filter(column =>
|
||||||
isBoolean(column?.hide)
|
isBoolean(column?.hide)
|
||||||
@@ -70,9 +87,9 @@ export default defineComponent({
|
|||||||
"text-black",
|
"text-black",
|
||||||
"dark:text-white",
|
"dark:text-white",
|
||||||
"duration-100",
|
"duration-100",
|
||||||
"hover:!text-primary",
|
"hover:text-primary!",
|
||||||
"cursor-pointer",
|
"cursor-pointer",
|
||||||
"outline-none"
|
"outline-hidden"
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -100,6 +117,11 @@ export default defineComponent({
|
|||||||
toggleRowExpansionAll(props.tableRef.data, isExpandAll.value);
|
toggleRowExpansionAll(props.tableRef.data, isExpandAll.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onFullscreen() {
|
||||||
|
isFullscreen.value = !isFullscreen.value;
|
||||||
|
emit("fullscreen", isFullscreen.value);
|
||||||
|
}
|
||||||
|
|
||||||
function toggleRowExpansionAll(data, isExpansion) {
|
function toggleRowExpansionAll(data, isExpansion) {
|
||||||
data.forEach(item => {
|
data.forEach(item => {
|
||||||
props.tableRef.toggleRowExpansion(item, isExpansion);
|
props.tableRef.toggleRowExpansion(item, isExpansion);
|
||||||
@@ -118,6 +140,7 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleCheckedColumnsChange(value: string[]) {
|
function handleCheckedColumnsChange(value: string[]) {
|
||||||
|
checkedColumns.value = value;
|
||||||
const checkedCount = value.length;
|
const checkedCount = value.length;
|
||||||
checkAll.value = checkedCount === checkColumnList.length;
|
checkAll.value = checkedCount === checkColumnList.length;
|
||||||
isIndeterminate.value =
|
isIndeterminate.value =
|
||||||
@@ -125,7 +148,9 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleCheckColumnListChange(val: boolean, label: string) {
|
function handleCheckColumnListChange(val: boolean, label: string) {
|
||||||
dynamicColumns.value.filter(item => item.label === label)[0].hide = !val;
|
dynamicColumns.value.filter(
|
||||||
|
item => transformI18n(item.label) === transformI18n(label)
|
||||||
|
)[0].hide = !val;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function onReset() {
|
async function onReset() {
|
||||||
@@ -166,9 +191,9 @@ export default defineComponent({
|
|||||||
const rowDrop = (event: { preventDefault: () => void }) => {
|
const rowDrop = (event: { preventDefault: () => void }) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
const wrapper: HTMLElement = document.querySelector(
|
const wrapper: HTMLElement = (
|
||||||
".el-checkbox-group>div"
|
instance?.proxy?.$refs[`GroupRef${unref(props.tableKey)}`] as any
|
||||||
);
|
).$el.firstElementChild;
|
||||||
Sortable.create(wrapper, {
|
Sortable.create(wrapper, {
|
||||||
animation: 300,
|
animation: 300,
|
||||||
handle: ".drag-btn",
|
handle: ".drag-btn",
|
||||||
@@ -198,7 +223,9 @@ export default defineComponent({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const isFixedColumn = (label: string) => {
|
const isFixedColumn = (label: string) => {
|
||||||
return dynamicColumns.value.filter(item => item.label === label)[0].fixed
|
return dynamicColumns.value.filter(
|
||||||
|
item => transformI18n(item.label) === transformI18n(label)
|
||||||
|
)[0].fixed
|
||||||
? true
|
? true
|
||||||
: false;
|
: false;
|
||||||
};
|
};
|
||||||
@@ -225,7 +252,18 @@ export default defineComponent({
|
|||||||
|
|
||||||
return () => (
|
return () => (
|
||||||
<>
|
<>
|
||||||
<div {...attrs} class="w-[99/100] mt-2 px-2 pb-2 bg-bg_color">
|
<div
|
||||||
|
{...attrs}
|
||||||
|
class={[
|
||||||
|
"w-full",
|
||||||
|
"px-2",
|
||||||
|
"pb-2",
|
||||||
|
"bg-bg_color",
|
||||||
|
isFullscreen.value
|
||||||
|
? ["h-full!", "z-2002", "fixed", "inset-0"]
|
||||||
|
: "mt-2"
|
||||||
|
]}
|
||||||
|
>
|
||||||
<div class="flex justify-between w-full h-[60px] p-4">
|
<div class="flex justify-between w-full h-[60px] p-4">
|
||||||
{slots?.title ? (
|
{slots?.title ? (
|
||||||
slots.title()
|
slots.title()
|
||||||
@@ -279,7 +317,7 @@ export default defineComponent({
|
|||||||
>
|
>
|
||||||
<div class={[topClass.value]}>
|
<div class={[topClass.value]}>
|
||||||
<el-checkbox
|
<el-checkbox
|
||||||
class="!-mr-1"
|
class="-mr-1!"
|
||||||
label="列展示"
|
label="列展示"
|
||||||
v-model={checkAll.value}
|
v-model={checkAll.value}
|
||||||
indeterminate={isIndeterminate.value}
|
indeterminate={isIndeterminate.value}
|
||||||
@@ -293,7 +331,8 @@ export default defineComponent({
|
|||||||
<div class="pt-[6px] pl-[11px]">
|
<div class="pt-[6px] pl-[11px]">
|
||||||
<el-scrollbar max-height="36vh">
|
<el-scrollbar max-height="36vh">
|
||||||
<el-checkbox-group
|
<el-checkbox-group
|
||||||
v-model={checkedColumns.value}
|
ref={`GroupRef${unref(props.tableKey)}`}
|
||||||
|
modelValue={checkedColumns.value}
|
||||||
onChange={value => handleCheckedColumnsChange(value)}
|
onChange={value => handleCheckedColumnsChange(value)}
|
||||||
>
|
>
|
||||||
<el-space
|
<el-space
|
||||||
@@ -301,32 +340,33 @@ export default defineComponent({
|
|||||||
alignment="flex-start"
|
alignment="flex-start"
|
||||||
size={0}
|
size={0}
|
||||||
>
|
>
|
||||||
{checkColumnList.map(item => {
|
{checkColumnList.map((item, index) => {
|
||||||
return (
|
return (
|
||||||
<div class="flex items-center">
|
<div class="flex items-center">
|
||||||
<DragIcon
|
<DragIcon
|
||||||
class={[
|
class={[
|
||||||
"drag-btn w-[16px] mr-2",
|
"drag-btn w-[16px] mr-2",
|
||||||
isFixedColumn(item)
|
isFixedColumn(item)
|
||||||
? "!cursor-no-drop"
|
? "cursor-no-drop!"
|
||||||
: "!cursor-grab"
|
: "cursor-grab!"
|
||||||
]}
|
]}
|
||||||
onMouseenter={(event: {
|
onMouseenter={(event: {
|
||||||
preventDefault: () => void;
|
preventDefault: () => void;
|
||||||
}) => rowDrop(event)}
|
}) => rowDrop(event)}
|
||||||
/>
|
/>
|
||||||
<el-checkbox
|
<el-checkbox
|
||||||
key={item}
|
key={index}
|
||||||
|
label={item}
|
||||||
value={item}
|
value={item}
|
||||||
onChange={value =>
|
onChange={value =>
|
||||||
handleCheckColumnListChange(value, item)
|
handleCheckColumnListChange(value, item)
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
title={item}
|
title={transformI18n(item)}
|
||||||
class="inline-block w-[120px] truncate hover:text-text_color_primary"
|
class="inline-block w-[120px] truncate hover:text-text_color_primary"
|
||||||
>
|
>
|
||||||
{item}
|
{transformI18n(item)}
|
||||||
</span>
|
</span>
|
||||||
</el-checkbox>
|
</el-checkbox>
|
||||||
</div>
|
</div>
|
||||||
@@ -337,6 +377,14 @@ export default defineComponent({
|
|||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
</div>
|
</div>
|
||||||
</el-popover>
|
</el-popover>
|
||||||
|
<el-divider direction="vertical" />
|
||||||
|
|
||||||
|
<iconifyIconOffline
|
||||||
|
class={["w-[16px]", iconClass.value]}
|
||||||
|
icon={isFullscreen.value ? ExitFullscreen : Fullscreen}
|
||||||
|
v-tippy={isFullscreen.value ? "退出全屏" : "全屏"}
|
||||||
|
onClick={() => onFullscreen()}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{slots.default({
|
{slots.default({
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
<svg width="32" height="32" fill="currentColor" aria-hidden="true" data-icon="holder" viewBox="64 64 896 896"><path d="M300 276.5a56 56 0 1 0 56-97 56 56 0 0 0-56 97m0 284a56 56 0 1 0 56-97 56 56 0 0 0-56 97M640 228a56 56 0 1 0 112 0 56 56 0 0 0-112 0m0 284a56 56 0 1 0 112 0 56 56 0 0 0-112 0M300 844.5a56 56 0 1 0 56-97 56 56 0 0 0-56 97M640 796a56 56 0 1 0 112 0 56 56 0 0 0-112 0"/></svg>
|
|
||||||
|
Before Width: | Height: | Size: 392 B |
@@ -1,11 +1,103 @@
|
|||||||
.pure-segmented {
|
.pure-segmented {
|
||||||
|
--pure-control-padding-horizontal: 12px;
|
||||||
|
--pure-control-padding-horizontal-sm: 8px;
|
||||||
|
--pure-segmented-track-padding: 2px;
|
||||||
|
--pure-segmented-line-width: 1px;
|
||||||
|
|
||||||
|
--pure-segmented-border-radius-small: 4px;
|
||||||
|
--pure-segmented-border-radius-base: 6px;
|
||||||
|
--pure-segmented-border-radius-large: 8px;
|
||||||
|
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
padding: 2px;
|
padding: var(--pure-segmented-track-padding);
|
||||||
font-size: 14px;
|
font-size: var(--el-font-size-base);
|
||||||
color: rgba(0, 0, 0, 0.65);
|
color: rgba(0, 0, 0, 0.65);
|
||||||
background-color: rgb(0 0 0 / 4%);
|
background-color: rgb(0 0 0 / 4%);
|
||||||
border-radius: 2px;
|
border-radius: var(--pure-segmented-border-radius-base);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pure-segmented-block {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pure-segmented-block .pure-segmented-item {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pure-segmented-block .pure-segmented-item > .pure-segmented-item-label > span {
|
||||||
|
overflow: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* small */
|
||||||
|
.pure-segmented.pure-segmented--small {
|
||||||
|
border-radius: var(--pure-segmented-border-radius-small);
|
||||||
|
}
|
||||||
|
.pure-segmented.pure-segmented--small .pure-segmented-item {
|
||||||
|
border-radius: var(--el-border-radius-small);
|
||||||
|
}
|
||||||
|
.pure-segmented.pure-segmented--small .pure-segmented-item > div {
|
||||||
|
min-height: calc(
|
||||||
|
var(--el-component-size-small) - var(--pure-segmented-track-padding) * 2
|
||||||
|
);
|
||||||
|
line-height: calc(
|
||||||
|
var(--el-component-size-small) - var(--pure-segmented-track-padding) * 2
|
||||||
|
);
|
||||||
|
padding: 0
|
||||||
|
calc(
|
||||||
|
var(--pure-control-padding-horizontal-sm) -
|
||||||
|
var(--pure-segmented-line-width)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* large */
|
||||||
|
.pure-segmented.pure-segmented--large {
|
||||||
|
border-radius: var(--pure-segmented-border-radius-large);
|
||||||
|
}
|
||||||
|
.pure-segmented.pure-segmented--large .pure-segmented-item {
|
||||||
|
border-radius: calc(
|
||||||
|
var(--el-border-radius-base) + var(--el-border-radius-small)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
.pure-segmented.pure-segmented--large .pure-segmented-item > div {
|
||||||
|
min-height: calc(
|
||||||
|
var(--el-component-size-large) - var(--pure-segmented-track-padding) * 2
|
||||||
|
);
|
||||||
|
line-height: calc(
|
||||||
|
var(--el-component-size-large) - var(--pure-segmented-track-padding) * 2
|
||||||
|
);
|
||||||
|
padding: 0
|
||||||
|
calc(
|
||||||
|
var(--pure-control-padding-horizontal) - var(--pure-segmented-line-width)
|
||||||
|
);
|
||||||
|
font-size: var(--el-font-size-medium);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* default */
|
||||||
|
.pure-segmented-item {
|
||||||
|
position: relative;
|
||||||
|
text-align: center;
|
||||||
|
cursor: pointer;
|
||||||
|
border-radius: var(--el-border-radius-base);
|
||||||
|
transition: all 0.1s cubic-bezier(0.645, 0.045, 0.355, 1);
|
||||||
|
}
|
||||||
|
.pure-segmented .pure-segmented-item > div {
|
||||||
|
min-height: calc(
|
||||||
|
var(--el-component-size) - var(--pure-segmented-track-padding) * 2
|
||||||
|
);
|
||||||
|
line-height: calc(
|
||||||
|
var(--el-component-size) - var(--pure-segmented-track-padding) * 2
|
||||||
|
);
|
||||||
|
padding: 0
|
||||||
|
calc(
|
||||||
|
var(--pure-control-padding-horizontal) - var(--pure-segmented-line-width)
|
||||||
|
);
|
||||||
|
overflow: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pure-segmented-group {
|
.pure-segmented-group {
|
||||||
@@ -37,23 +129,6 @@
|
|||||||
will-change: transform, width;
|
will-change: transform, width;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pure-segmented-item {
|
|
||||||
position: relative;
|
|
||||||
text-align: center;
|
|
||||||
cursor: pointer;
|
|
||||||
border-radius: 4px;
|
|
||||||
transition: all 0.1s cubic-bezier(0.645, 0.045, 0.355, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.pure-segmented-item > div {
|
|
||||||
min-height: 28px;
|
|
||||||
line-height: 28px;
|
|
||||||
padding: 0 11px;
|
|
||||||
overflow: hidden;
|
|
||||||
white-space: nowrap;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pure-segmented-item > input {
|
.pure-segmented-item > input {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
inset-block-start: 0;
|
inset-block-start: 0;
|
||||||
@@ -67,6 +142,7 @@
|
|||||||
.pure-segmented-item-label {
|
.pure-segmented-item-label {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pure-segmented-item-icon svg {
|
.pure-segmented-item-icon svg {
|
||||||
|
|||||||
@@ -1,5 +1,14 @@
|
|||||||
import "./index.css";
|
import "./index.css";
|
||||||
|
import type { OptionsType } from "./type";
|
||||||
|
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
|
||||||
import {
|
import {
|
||||||
|
useDark,
|
||||||
|
isNumber,
|
||||||
|
isFunction,
|
||||||
|
useResizeObserver
|
||||||
|
} from "@pureadmin/utils";
|
||||||
|
import {
|
||||||
|
type PropType,
|
||||||
h,
|
h,
|
||||||
ref,
|
ref,
|
||||||
toRef,
|
toRef,
|
||||||
@@ -8,9 +17,6 @@ import {
|
|||||||
defineComponent,
|
defineComponent,
|
||||||
getCurrentInstance
|
getCurrentInstance
|
||||||
} from "vue";
|
} from "vue";
|
||||||
import type { OptionsType } from "./type";
|
|
||||||
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
|
|
||||||
import { isFunction, isNumber, useDark } from "@pureadmin/utils";
|
|
||||||
|
|
||||||
const props = {
|
const props = {
|
||||||
options: {
|
options: {
|
||||||
@@ -22,6 +28,25 @@ const props = {
|
|||||||
type: undefined,
|
type: undefined,
|
||||||
require: false,
|
require: false,
|
||||||
default: "0"
|
default: "0"
|
||||||
|
},
|
||||||
|
/** 将宽度调整为父元素宽度 */
|
||||||
|
block: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
/** 控件尺寸 */
|
||||||
|
size: {
|
||||||
|
type: String as PropType<"small" | "default" | "large">
|
||||||
|
},
|
||||||
|
/** 是否全局禁用,默认 `false` */
|
||||||
|
disabled: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
/** 当内容发生变化时,设置 `resize` 可使其自适应容器位置 */
|
||||||
|
resize: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -42,7 +67,7 @@ export default defineComponent({
|
|||||||
: ref(0);
|
: ref(0);
|
||||||
|
|
||||||
function handleChange({ option, index }, event: Event) {
|
function handleChange({ option, index }, event: Event) {
|
||||||
if (option.disabled) return;
|
if (props.disabled || option.disabled) return;
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
isNumber(props.modelValue)
|
isNumber(props.modelValue)
|
||||||
? emit("update:modelValue", index)
|
? emit("update:modelValue", index)
|
||||||
@@ -52,6 +77,7 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleMouseenter({ option, index }, event: Event) {
|
function handleMouseenter({ option, index }, event: Event) {
|
||||||
|
if (props.disabled) return;
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
curMouseActive.value = index;
|
curMouseActive.value = index;
|
||||||
if (option.disabled || curIndex.value === index) {
|
if (option.disabled || curIndex.value === index) {
|
||||||
@@ -64,6 +90,7 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleMouseleave(_, event: Event) {
|
function handleMouseleave(_, event: Event) {
|
||||||
|
if (props.disabled) return;
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
curMouseActive.value = -1;
|
curMouseActive.value = -1;
|
||||||
}
|
}
|
||||||
@@ -71,12 +98,23 @@ export default defineComponent({
|
|||||||
function handleInit(index = curIndex.value) {
|
function handleInit(index = curIndex.value) {
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
const curLabelRef = instance?.proxy?.$refs[`labelRef${index}`] as ElRef;
|
const curLabelRef = instance?.proxy?.$refs[`labelRef${index}`] as ElRef;
|
||||||
|
if (!curLabelRef) return;
|
||||||
width.value = curLabelRef.clientWidth;
|
width.value = curLabelRef.clientWidth;
|
||||||
translateX.value = curLabelRef.offsetLeft;
|
translateX.value = curLabelRef.offsetLeft;
|
||||||
initStatus.value = true;
|
initStatus.value = true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleResizeInit() {
|
||||||
|
useResizeObserver(".pure-segmented", () => {
|
||||||
|
nextTick(() => {
|
||||||
|
handleInit(curIndex.value);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
(props.block || props.resize) && handleResizeInit();
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => curIndex.value,
|
() => curIndex.value,
|
||||||
index => {
|
index => {
|
||||||
@@ -85,11 +123,14 @@ export default defineComponent({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
deep: true,
|
|
||||||
immediate: true
|
immediate: true
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
watch(() => props.size, handleResizeInit, {
|
||||||
|
immediate: true
|
||||||
|
});
|
||||||
|
|
||||||
const rendLabel = () => {
|
const rendLabel = () => {
|
||||||
return props.options.map((option, index) => {
|
return props.options.map((option, index) => {
|
||||||
return (
|
return (
|
||||||
@@ -97,14 +138,16 @@ export default defineComponent({
|
|||||||
ref={`labelRef${index}`}
|
ref={`labelRef${index}`}
|
||||||
class={[
|
class={[
|
||||||
"pure-segmented-item",
|
"pure-segmented-item",
|
||||||
option?.disabled && "pure-segmented-item-disabled"
|
(props.disabled || option?.disabled) &&
|
||||||
|
"pure-segmented-item-disabled"
|
||||||
]}
|
]}
|
||||||
style={{
|
style={{
|
||||||
background:
|
background:
|
||||||
curMouseActive.value === index ? segmentedItembg.value : "",
|
curMouseActive.value === index ? segmentedItembg.value : "",
|
||||||
color:
|
color: props.disabled
|
||||||
!option.disabled &&
|
? null
|
||||||
(curIndex.value === index || curMouseActive.value === index)
|
: !option.disabled &&
|
||||||
|
(curIndex.value === index || curMouseActive.value === index)
|
||||||
? isDark.value
|
? isDark.value
|
||||||
? "rgba(255, 255, 255, 0.85)"
|
? "rgba(255, 255, 255, 0.85)"
|
||||||
: "rgba(0,0,0,.88)"
|
: "rgba(0,0,0,.88)"
|
||||||
@@ -148,7 +191,14 @@ export default defineComponent({
|
|||||||
};
|
};
|
||||||
|
|
||||||
return () => (
|
return () => (
|
||||||
<div class="pure-segmented">
|
<div
|
||||||
|
class={{
|
||||||
|
"pure-segmented": true,
|
||||||
|
"pure-segmented-block": props.block,
|
||||||
|
"pure-segmented--large": props.size === "large",
|
||||||
|
"pure-segmented--small": props.size === "small"
|
||||||
|
}}
|
||||||
|
>
|
||||||
<div class="pure-segmented-group">
|
<div class="pure-segmented-group">
|
||||||
<div
|
<div
|
||||||
class="pure-segmented-item-selected"
|
class="pure-segmented-item-selected"
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ export interface OptionsType {
|
|||||||
label?: string | (() => VNode | Component);
|
label?: string | (() => VNode | Component);
|
||||||
/**
|
/**
|
||||||
* @description 图标,采用平台内置的 `useRenderIcon` 函数渲染
|
* @description 图标,采用平台内置的 `useRenderIcon` 函数渲染
|
||||||
* @see {@link 用法参考 https://yiming_chang.gitee.io/pure-admin-doc/pages/icon/#%E9%80%9A%E7%94%A8%E5%9B%BE%E6%A0%87-userendericon-hooks }
|
* @see {@link 用法参考 https://pure-admin.cn/pages/icon/#%E9%80%9A%E7%94%A8%E5%9B%BE%E6%A0%87-userendericon-hooks }
|
||||||
*/
|
*/
|
||||||
icon?: string | Component;
|
icon?: string | Component;
|
||||||
/** 图标属性、样式配置 */
|
/** 图标属性、样式配置 */
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
<script lang="ts" setup>
|
<script setup lang="ts">
|
||||||
import { h, onMounted, ref, useSlots } from "vue";
|
import { h, onMounted, ref } from "vue";
|
||||||
import { useTippy, type TippyOptions } from "vue-tippy";
|
import { type TippyOptions, type TippyContent, useTippy } from "vue-tippy";
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
name: "ReText"
|
||||||
|
});
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
// 行数
|
// 行数
|
||||||
@@ -13,7 +17,10 @@ const props = defineProps({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const $slots = useSlots();
|
const slots = defineSlots<{
|
||||||
|
content: () => TippyContent;
|
||||||
|
default: () => any;
|
||||||
|
}>();
|
||||||
|
|
||||||
const textRef = ref();
|
const textRef = ref();
|
||||||
const tippyFunc = ref();
|
const tippyFunc = ref();
|
||||||
@@ -29,7 +36,7 @@ const isTextEllipsis = (el: HTMLElement) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const getTippyProps = () => ({
|
const getTippyProps = () => ({
|
||||||
content: h($slots.content || $slots.default),
|
content: h(slots.content || slots.default),
|
||||||
...props.tippyProps
|
...props.tippyProps
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { App } from "vue";
|
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
import type { App } from "vue";
|
||||||
|
|
||||||
let config: object = {};
|
let config: object = {};
|
||||||
const { VITE_PUBLIC_PATH } = import.meta.env;
|
const { VITE_PUBLIC_PATH } = import.meta.env;
|
||||||
@@ -35,7 +35,7 @@ export const getPlatformConfig = async (app: App): Promise<undefined> => {
|
|||||||
})
|
})
|
||||||
.then(({ data: config }) => {
|
.then(({ data: config }) => {
|
||||||
let $config = app.config.globalProperties.$config;
|
let $config = app.config.globalProperties.$config;
|
||||||
// 自动注入项目配置
|
// 自动注入系统配置
|
||||||
if (app && $config && typeof config === "object") {
|
if (app && $config && typeof config === "object") {
|
||||||
$config = Object.assign($config, config);
|
$config = Object.assign($config, config);
|
||||||
app.config.globalProperties.$config = $config;
|
app.config.globalProperties.$config = $config;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { hasAuth } from "@/router/utils";
|
|||||||
import type { Directive, DirectiveBinding } from "vue";
|
import type { Directive, DirectiveBinding } from "vue";
|
||||||
|
|
||||||
export const auth: Directive = {
|
export const auth: Directive = {
|
||||||
mounted(el: HTMLElement, binding: DirectiveBinding) {
|
mounted(el: HTMLElement, binding: DirectiveBinding<string | Array<string>>) {
|
||||||
const { value } = binding;
|
const { value } = binding;
|
||||||
if (value) {
|
if (value) {
|
||||||
!hasAuth(value) && el.parentNode?.removeChild(el);
|
!hasAuth(value) && el.parentNode?.removeChild(el);
|
||||||
|
|||||||
@@ -3,13 +3,13 @@ import { useEventListener } from "@vueuse/core";
|
|||||||
import { copyTextToClipboard } from "@pureadmin/utils";
|
import { copyTextToClipboard } from "@pureadmin/utils";
|
||||||
import type { Directive, DirectiveBinding } from "vue";
|
import type { Directive, DirectiveBinding } from "vue";
|
||||||
|
|
||||||
interface CopyEl extends HTMLElement {
|
export interface CopyEl extends HTMLElement {
|
||||||
copyValue: string;
|
copyValue: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 文本复制指令(默认双击复制) */
|
/** 文本复制指令(默认双击复制) */
|
||||||
export const copy: Directive = {
|
export const copy: Directive = {
|
||||||
mounted(el: CopyEl, binding: DirectiveBinding) {
|
mounted(el: CopyEl, binding: DirectiveBinding<string>) {
|
||||||
const { value } = binding;
|
const { value } = binding;
|
||||||
if (value) {
|
if (value) {
|
||||||
el.copyValue = value;
|
el.copyValue = value;
|
||||||
|
|||||||
@@ -2,4 +2,5 @@ export * from "./auth";
|
|||||||
export * from "./copy";
|
export * from "./copy";
|
||||||
export * from "./longpress";
|
export * from "./longpress";
|
||||||
export * from "./optimize";
|
export * from "./optimize";
|
||||||
|
export * from "./perms";
|
||||||
export * from "./ripple";
|
export * from "./ripple";
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import type { Directive, DirectiveBinding } from "vue";
|
|||||||
import { subBefore, subAfter, isFunction } from "@pureadmin/utils";
|
import { subBefore, subAfter, isFunction } from "@pureadmin/utils";
|
||||||
|
|
||||||
export const longpress: Directive = {
|
export const longpress: Directive = {
|
||||||
mounted(el: HTMLElement, binding: DirectiveBinding) {
|
mounted(el: HTMLElement, binding: DirectiveBinding<Function>) {
|
||||||
const cb = binding.value;
|
const cb = binding.value;
|
||||||
if (cb && isFunction(cb)) {
|
if (cb && isFunction(cb)) {
|
||||||
let timer = null;
|
let timer = null;
|
||||||
|
|||||||
@@ -1,16 +1,29 @@
|
|||||||
import {
|
import {
|
||||||
isFunction,
|
|
||||||
isObject,
|
|
||||||
isArray,
|
isArray,
|
||||||
|
throttle,
|
||||||
debounce,
|
debounce,
|
||||||
throttle
|
isObject,
|
||||||
|
isFunction
|
||||||
} from "@pureadmin/utils";
|
} from "@pureadmin/utils";
|
||||||
import { useEventListener } from "@vueuse/core";
|
import { useEventListener } from "@vueuse/core";
|
||||||
import type { Directive, DirectiveBinding } from "vue";
|
import type { Directive, DirectiveBinding } from "vue";
|
||||||
|
|
||||||
|
export interface OptimizeOptions {
|
||||||
|
/** 事件名 */
|
||||||
|
event: string;
|
||||||
|
/** 事件触发的方法 */
|
||||||
|
fn: (...params: any) => any;
|
||||||
|
/** 是否立即执行 */
|
||||||
|
immediate?: boolean;
|
||||||
|
/** 防抖或节流的延迟时间(防抖默认:`200`毫秒、节流默认:`1000`毫秒) */
|
||||||
|
timeout?: number;
|
||||||
|
/** 传递的参数 */
|
||||||
|
params?: any;
|
||||||
|
}
|
||||||
|
|
||||||
/** 防抖(v-optimize或v-optimize:debounce)、节流(v-optimize:throttle)指令 */
|
/** 防抖(v-optimize或v-optimize:debounce)、节流(v-optimize:throttle)指令 */
|
||||||
export const optimize: Directive = {
|
export const optimize: Directive = {
|
||||||
mounted(el: HTMLElement, binding: DirectiveBinding) {
|
mounted(el: HTMLElement, binding: DirectiveBinding<OptimizeOptions>) {
|
||||||
const { value } = binding;
|
const { value } = binding;
|
||||||
const optimizeType = binding.arg ?? "debounce";
|
const optimizeType = binding.arg ?? "debounce";
|
||||||
const type = ["debounce", "throttle"].find(t => t === optimizeType);
|
const type = ["debounce", "throttle"].find(t => t === optimizeType);
|
||||||
|
|||||||
15
src/directives/perms/index.ts
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import { hasPerms } from "@/utils/auth";
|
||||||
|
import type { Directive, DirectiveBinding } from "vue";
|
||||||
|
|
||||||
|
export const perms: Directive = {
|
||||||
|
mounted(el: HTMLElement, binding: DirectiveBinding<string | Array<string>>) {
|
||||||
|
const { value } = binding;
|
||||||
|
if (value) {
|
||||||
|
!hasPerms(value) && el.parentNode?.removeChild(el);
|
||||||
|
} else {
|
||||||
|
throw new Error(
|
||||||
|
"[Directive: perms]: need perms! Like v-perms=\"['btn.add','btn.edit']\""
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -13,10 +13,10 @@ $ripple-animation-visible-opacity: 0.25 !default;
|
|||||||
z-index: 0;
|
z-index: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
contain: strict;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
border-radius: inherit;
|
border-radius: inherit;
|
||||||
contain: strict;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&__animation {
|
&__animation {
|
||||||
|
|||||||
@@ -2,8 +2,10 @@ import "./index.scss";
|
|||||||
import { isObject } from "@pureadmin/utils";
|
import { isObject } from "@pureadmin/utils";
|
||||||
import type { Directive, DirectiveBinding } from "vue";
|
import type { Directive, DirectiveBinding } from "vue";
|
||||||
|
|
||||||
interface RippleOptions {
|
export interface RippleOptions {
|
||||||
|
/** 自定义`ripple`颜色,支持`tailwindcss` */
|
||||||
class?: string;
|
class?: string;
|
||||||
|
/** 是否从中心扩散 */
|
||||||
center?: boolean;
|
center?: boolean;
|
||||||
circle?: boolean;
|
circle?: boolean;
|
||||||
}
|
}
|
||||||
@@ -30,8 +32,8 @@ const calculate = (
|
|||||||
const offset = el.getBoundingClientRect();
|
const offset = el.getBoundingClientRect();
|
||||||
|
|
||||||
// 获取点击位置距离 el 的垂直和水平距离
|
// 获取点击位置距离 el 的垂直和水平距离
|
||||||
let localX = e.clientX - offset.left;
|
const localX = e.clientX - offset.left;
|
||||||
let localY = e.clientY - offset.top;
|
const localY = e.clientY - offset.top;
|
||||||
|
|
||||||
let radius = 0;
|
let radius = 0;
|
||||||
let scale = 0.3;
|
let scale = 0.3;
|
||||||
@@ -220,13 +222,6 @@ function updated(el: HTMLElement, binding: RippleDirectiveBinding) {
|
|||||||
updateRipple(el, binding, wasEnabled);
|
updateRipple(el, binding, wasEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 指令 v-ripple
|
|
||||||
* @use 用法如下
|
|
||||||
* 1. v-ripple 代表启用基本的 ripple 功能
|
|
||||||
* 2. v-ripple="{ class: 'text-red' }" 代表自定义 ripple 颜色,支持 tailwindcss,生效样式是 color
|
|
||||||
* 3. v-ripple.center 代表从中心扩散
|
|
||||||
*/
|
|
||||||
export const Ripple: Directive = {
|
export const Ripple: Directive = {
|
||||||
mounted,
|
mounted,
|
||||||
unmounted,
|
unmounted,
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import Footer from "./footer/index.vue";
|
import { useI18n } from "vue-i18n";
|
||||||
import { useGlobal } from "@pureadmin/utils";
|
import LayFrame from "../lay-frame/index.vue";
|
||||||
import KeepAliveFrame from "./keepAliveFrame/index.vue";
|
import LayFooter from "../lay-footer/index.vue";
|
||||||
import backTop from "@/assets/svg/back_top.svg?component";
|
import { useTags } from "@/layout/hooks/useTag";
|
||||||
|
import { useGlobal, isNumber } from "@pureadmin/utils";
|
||||||
|
import BackTopIcon 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";
|
||||||
|
|
||||||
@@ -10,6 +12,8 @@ const props = defineProps({
|
|||||||
fixedHeader: Boolean
|
fixedHeader: Boolean
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
|
const { showModel } = useTags();
|
||||||
const { $storage, $config } = useGlobal<GlobalPropertiesApi>();
|
const { $storage, $config } = useGlobal<GlobalPropertiesApi>();
|
||||||
|
|
||||||
const isKeepAlive = computed(() => {
|
const isKeepAlive = computed(() => {
|
||||||
@@ -30,16 +34,36 @@ const hideFooter = computed(() => {
|
|||||||
return $storage?.configure.hideFooter;
|
return $storage?.configure.hideFooter;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const stretch = computed(() => {
|
||||||
|
return $storage?.configure.stretch;
|
||||||
|
});
|
||||||
|
|
||||||
const layout = computed(() => {
|
const layout = computed(() => {
|
||||||
return $storage?.layout.layout === "vertical";
|
return $storage?.layout.layout === "vertical";
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const getMainWidth = computed(() => {
|
||||||
|
return isNumber(stretch.value)
|
||||||
|
? stretch.value + "px"
|
||||||
|
: stretch.value
|
||||||
|
? "1440px"
|
||||||
|
: "100%";
|
||||||
|
});
|
||||||
|
|
||||||
const getSectionStyle = computed(() => {
|
const getSectionStyle = computed(() => {
|
||||||
return [
|
return [
|
||||||
hideTabs.value && layout ? "padding-top: 48px;" : "",
|
hideTabs.value && layout ? "padding-top: 48px;" : "",
|
||||||
!hideTabs.value && layout ? "padding-top: 85px;" : "",
|
!hideTabs.value && layout
|
||||||
|
? showModel.value == "chrome"
|
||||||
|
? "padding-top: 85px;"
|
||||||
|
: "padding-top: 81px;"
|
||||||
|
: "",
|
||||||
hideTabs.value && !layout.value ? "padding-top: 48px;" : "",
|
hideTabs.value && !layout.value ? "padding-top: 48px;" : "",
|
||||||
!hideTabs.value && !layout.value ? "padding-top: 85px;" : "",
|
!hideTabs.value && !layout.value
|
||||||
|
? showModel.value == "chrome"
|
||||||
|
? "padding-top: 85px;"
|
||||||
|
: "padding-top: 81px;"
|
||||||
|
: "",
|
||||||
props.fixedHeader
|
props.fixedHeader
|
||||||
? ""
|
? ""
|
||||||
: `padding-top: 0;${
|
: `padding-top: 0;${
|
||||||
@@ -85,31 +109,34 @@ const transitionMain = defineComponent({
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<section
|
<section
|
||||||
:class="[props.fixedHeader ? 'app-main' : 'app-main-nofixed-header']"
|
:class="[fixedHeader ? 'app-main' : 'app-main-nofixed-header']"
|
||||||
:style="getSectionStyle"
|
:style="getSectionStyle"
|
||||||
>
|
>
|
||||||
<router-view>
|
<router-view>
|
||||||
<template #default="{ Component, route }">
|
<template #default="{ Component, route }">
|
||||||
<KeepAliveFrame :currComp="Component" :currRoute="route">
|
<LayFrame :currComp="Component" :currRoute="route">
|
||||||
<template #default="{ Comp, fullPath, frameInfo }">
|
<template #default="{ Comp, fullPath, frameInfo }">
|
||||||
<el-scrollbar
|
<el-scrollbar
|
||||||
v-if="props.fixedHeader"
|
v-if="fixedHeader"
|
||||||
:wrap-style="{
|
:wrap-style="{
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
'flex-wrap': 'wrap'
|
'flex-wrap': 'wrap',
|
||||||
|
'max-width': getMainWidth,
|
||||||
|
margin: '0 auto',
|
||||||
|
transition: 'all 300ms cubic-bezier(0.4, 0, 0.2, 1)'
|
||||||
}"
|
}"
|
||||||
:view-style="{
|
:view-style="{
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
flex: 'auto',
|
flex: 'auto',
|
||||||
overflow: 'auto',
|
overflow: 'hidden',
|
||||||
'flex-direction': 'column'
|
'flex-direction': 'column'
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<el-backtop
|
<el-backtop
|
||||||
title="回到顶部"
|
:title="t('buttons.pureBackTop')"
|
||||||
target=".app-main .el-scrollbar__wrap"
|
target=".app-main .el-scrollbar__wrap"
|
||||||
>
|
>
|
||||||
<backTop />
|
<BackTopIcon />
|
||||||
</el-backtop>
|
</el-backtop>
|
||||||
<div class="grow">
|
<div class="grow">
|
||||||
<transitionMain :route="route">
|
<transitionMain :route="route">
|
||||||
@@ -133,7 +160,7 @@ const transitionMain = defineComponent({
|
|||||||
/>
|
/>
|
||||||
</transitionMain>
|
</transitionMain>
|
||||||
</div>
|
</div>
|
||||||
<Footer v-if="!hideFooter" />
|
<LayFooter v-if="!hideFooter" />
|
||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
<div v-else class="grow">
|
<div v-else class="grow">
|
||||||
<transitionMain :route="route">
|
<transitionMain :route="route">
|
||||||
@@ -158,12 +185,12 @@ const transitionMain = defineComponent({
|
|||||||
</transitionMain>
|
</transitionMain>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</KeepAliveFrame>
|
</LayFrame>
|
||||||
</template>
|
</template>
|
||||||
</router-view>
|
</router-view>
|
||||||
|
|
||||||
<!-- 页脚 -->
|
<!-- 页脚 -->
|
||||||
<Footer v-if="!hideFooter && !props.fixedHeader" />
|
<LayFooter v-if="!hideFooter && !fixedHeader" />
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<script lang="ts" setup>
|
<script setup lang="ts">
|
||||||
import { getConfig } from "@/config";
|
import { getConfig } from "@/config";
|
||||||
|
|
||||||
const TITLE = getConfig("Title");
|
const TITLE = getConfig("Title");
|
||||||
@@ -10,7 +10,7 @@ const TITLE = getConfig("Title");
|
|||||||
>
|
>
|
||||||
Copyright © 2020-present
|
Copyright © 2020-present
|
||||||
<a
|
<a
|
||||||
class="hover:text-primary"
|
class="hover:text-primary!"
|
||||||
href="https://github.com/pure-admin"
|
href="https://github.com/pure-admin"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
>
|
>
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { getConfig } from "@/config";
|
import { getConfig } from "@/config";
|
||||||
|
import { useMultiFrame } from "@/layout/hooks/useMultiFrame";
|
||||||
import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
|
import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
|
||||||
import { type Component, shallowRef, watch, computed } from "vue";
|
import { type Component, shallowRef, watch, computed } from "vue";
|
||||||
import { type RouteRecordRaw, RouteLocationNormalizedLoaded } from "vue-router";
|
import { type RouteRecordRaw, RouteLocationNormalizedLoaded } from "vue-router";
|
||||||
import { useMultiFrame } from "@/layout/components/keepAliveFrame/useMultiFrame";
|
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
currRoute: RouteLocationNormalizedLoaded;
|
currRoute: RouteLocationNormalizedLoaded;
|
||||||
@@ -20,7 +20,7 @@ const keep = computed(() => {
|
|||||||
!!props.currRoute.meta?.frameSrc
|
!!props.currRoute.meta?.frameSrc
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
// 避免重新渲染 frameView
|
// 避免重新渲染 LayFrame
|
||||||
const normalComp = computed(() => !keep.value && props.currComp);
|
const normalComp = computed(() => !keep.value && props.currComp);
|
||||||
|
|
||||||
watch(useMultiTagsStoreHook().multiTags, (tags: any) => {
|
watch(useMultiTagsStoreHook().multiTags, (tags: any) => {
|
||||||
@@ -63,10 +63,9 @@ watch(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<template v-for="[fullPath, Comp] in compList" :key="fullPath">
|
<template v-for="[fullPath, Comp] in compList" :key="fullPath">
|
||||||
<div v-show="fullPath === props.currRoute.fullPath" class="w-full h-full">
|
<div v-show="fullPath === currRoute.fullPath" class="w-full h-full">
|
||||||
<slot
|
<slot
|
||||||
:fullPath="fullPath"
|
:fullPath="fullPath"
|
||||||
:Comp="Comp"
|
:Comp="Comp"
|
||||||
@@ -75,6 +74,6 @@ watch(
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<div v-show="!keep" class="w-full h-full">
|
<div v-show="!keep" class="w-full h-full">
|
||||||
<slot :Comp="normalComp" :fullPath="props.currRoute.fullPath" frameInfo />
|
<slot :Comp="normalComp" :fullPath="currRoute.fullPath" frameInfo />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
190
src/layout/components/lay-navbar/index.vue
Normal file
@@ -0,0 +1,190 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { useNav } from "@/layout/hooks/useNav";
|
||||||
|
import LaySearch from "../lay-search/index.vue";
|
||||||
|
import LayNotice from "../lay-notice/index.vue";
|
||||||
|
import LayNavMix from "../lay-sidebar/NavMix.vue";
|
||||||
|
import { useTranslationLang } from "@/layout/hooks/useTranslationLang";
|
||||||
|
import LaySidebarFullScreen from "../lay-sidebar/components/SidebarFullScreen.vue";
|
||||||
|
import LaySidebarBreadCrumb from "../lay-sidebar/components/SidebarBreadCrumb.vue";
|
||||||
|
import LaySidebarTopCollapse from "../lay-sidebar/components/SidebarTopCollapse.vue";
|
||||||
|
|
||||||
|
import GlobalizationIcon from "@/assets/svg/globalization.svg?component";
|
||||||
|
import LogoutCircleRLine from "~icons/ri/logout-circle-r-line";
|
||||||
|
import Setting from "~icons/ri/settings-3-line";
|
||||||
|
import Check from "~icons/ep/check";
|
||||||
|
|
||||||
|
const {
|
||||||
|
layout,
|
||||||
|
device,
|
||||||
|
logout,
|
||||||
|
onPanel,
|
||||||
|
pureApp,
|
||||||
|
username,
|
||||||
|
userAvatar,
|
||||||
|
avatarsStyle,
|
||||||
|
toggleSideBar,
|
||||||
|
getDropdownItemStyle,
|
||||||
|
getDropdownItemClass
|
||||||
|
} = useNav();
|
||||||
|
|
||||||
|
const { t, locale, translationCh, translationEn } = useTranslationLang();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="navbar bg-[#fff] shadow-xs shadow-[rgba(0,21,41,0.08)]">
|
||||||
|
<LaySidebarTopCollapse
|
||||||
|
v-if="device === 'mobile'"
|
||||||
|
class="hamburger-container"
|
||||||
|
:is-active="pureApp.sidebar.opened"
|
||||||
|
@toggleClick="toggleSideBar"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<LaySidebarBreadCrumb
|
||||||
|
v-if="layout !== 'mix' && device !== 'mobile'"
|
||||||
|
class="breadcrumb-container"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<LayNavMix v-if="layout === 'mix'" />
|
||||||
|
|
||||||
|
<div v-if="layout === 'vertical'" class="vertical-header-right">
|
||||||
|
<!-- 菜单搜索 -->
|
||||||
|
<LaySearch id="header-search" />
|
||||||
|
<!-- 国际化 -->
|
||||||
|
<el-dropdown id="header-translation" trigger="click">
|
||||||
|
<GlobalizationIcon
|
||||||
|
class="navbar-bg-hover w-[40px] h-[48px] p-[11px] cursor-pointer outline-hidden"
|
||||||
|
/>
|
||||||
|
<template #dropdown>
|
||||||
|
<el-dropdown-menu class="translation">
|
||||||
|
<el-dropdown-item
|
||||||
|
:style="getDropdownItemStyle(locale, 'zh')"
|
||||||
|
:class="['dark:text-white!', getDropdownItemClass(locale, 'zh')]"
|
||||||
|
@click="translationCh"
|
||||||
|
>
|
||||||
|
<IconifyIconOffline
|
||||||
|
v-show="locale === 'zh'"
|
||||||
|
class="check-zh"
|
||||||
|
:icon="Check"
|
||||||
|
/>
|
||||||
|
简体中文
|
||||||
|
</el-dropdown-item>
|
||||||
|
<el-dropdown-item
|
||||||
|
:style="getDropdownItemStyle(locale, 'en')"
|
||||||
|
:class="['dark:text-white!', getDropdownItemClass(locale, 'en')]"
|
||||||
|
@click="translationEn"
|
||||||
|
>
|
||||||
|
<span v-show="locale === 'en'" class="check-en">
|
||||||
|
<IconifyIconOffline :icon="Check" />
|
||||||
|
</span>
|
||||||
|
English
|
||||||
|
</el-dropdown-item>
|
||||||
|
</el-dropdown-menu>
|
||||||
|
</template>
|
||||||
|
</el-dropdown>
|
||||||
|
<!-- 全屏 -->
|
||||||
|
<LaySidebarFullScreen id="full-screen" />
|
||||||
|
<!-- 消息通知 -->
|
||||||
|
<LayNotice id="header-notice" />
|
||||||
|
<!-- 退出登录 -->
|
||||||
|
<el-dropdown trigger="click">
|
||||||
|
<span class="el-dropdown-link navbar-bg-hover select-none">
|
||||||
|
<img :src="userAvatar" :style="avatarsStyle" />
|
||||||
|
<p v-if="username" class="dark:text-white">{{ username }}</p>
|
||||||
|
</span>
|
||||||
|
<template #dropdown>
|
||||||
|
<el-dropdown-menu class="logout">
|
||||||
|
<el-dropdown-item @click="logout">
|
||||||
|
<IconifyIconOffline
|
||||||
|
:icon="LogoutCircleRLine"
|
||||||
|
style="margin: 5px"
|
||||||
|
/>
|
||||||
|
{{ t("buttons.pureLoginOut") }}
|
||||||
|
</el-dropdown-item>
|
||||||
|
</el-dropdown-menu>
|
||||||
|
</template>
|
||||||
|
</el-dropdown>
|
||||||
|
<span
|
||||||
|
class="set-icon navbar-bg-hover"
|
||||||
|
:title="t('buttons.pureOpenSystemSet')"
|
||||||
|
@click="onPanel"
|
||||||
|
>
|
||||||
|
<IconifyIconOffline :icon="Setting" />
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.navbar {
|
||||||
|
width: 100%;
|
||||||
|
height: 48px;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
.hamburger-container {
|
||||||
|
float: left;
|
||||||
|
height: 100%;
|
||||||
|
line-height: 48px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.vertical-header-right {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-end;
|
||||||
|
min-width: 280px;
|
||||||
|
height: 48px;
|
||||||
|
color: #000000d9;
|
||||||
|
|
||||||
|
.el-dropdown-link {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-around;
|
||||||
|
height: 48px;
|
||||||
|
padding: 10px;
|
||||||
|
color: #000000d9;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
p {
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
img {
|
||||||
|
width: 22px;
|
||||||
|
height: 22px;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.breadcrumb-container {
|
||||||
|
float: left;
|
||||||
|
margin-left: 16px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.translation {
|
||||||
|
::v-deep(.el-dropdown-menu__item) {
|
||||||
|
padding: 5px 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.check-zh {
|
||||||
|
position: absolute;
|
||||||
|
left: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.check-en {
|
||||||
|
position: absolute;
|
||||||
|
left: 20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.logout {
|
||||||
|
width: 120px;
|
||||||
|
|
||||||
|
::v-deep(.el-dropdown-menu__item) {
|
||||||
|
display: inline-flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
min-width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
<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";
|
import { useNav } from "@/layout/hooks/useNav";
|
||||||
import { deviceDetection } from "@pureadmin/utils";
|
import { deviceDetection } from "@pureadmin/utils";
|
||||||
|
|
||||||
const props = defineProps({
|
defineProps({
|
||||||
noticeItem: {
|
noticeItem: {
|
||||||
type: Object as PropType<ListItem>,
|
type: Object as PropType<ListItem>,
|
||||||
default: () => {}
|
default: () => {}
|
||||||
@@ -49,12 +49,12 @@ function hoverDescription(event, description) {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
class="notice-container border-b-[1px] border-solid border-[#f0f0f0] dark:border-[#303030]"
|
class="notice-container border-0 border-b-[1px] border-solid border-[#f0f0f0] dark:border-[#303030]"
|
||||||
>
|
>
|
||||||
<el-avatar
|
<el-avatar
|
||||||
v-if="props.noticeItem.avatar"
|
v-if="noticeItem.avatar"
|
||||||
:size="30"
|
:size="30"
|
||||||
:src="props.noticeItem.avatar"
|
:src="noticeItem.avatar"
|
||||||
class="notice-container-avatar"
|
class="notice-container-avatar"
|
||||||
/>
|
/>
|
||||||
<div class="notice-container-text">
|
<div class="notice-container-text">
|
||||||
@@ -63,7 +63,7 @@ function hoverDescription(event, description) {
|
|||||||
popper-class="notice-title-popper"
|
popper-class="notice-title-popper"
|
||||||
:effect="tooltipEffect"
|
:effect="tooltipEffect"
|
||||||
:disabled="!titleTooltip"
|
:disabled="!titleTooltip"
|
||||||
:content="props.noticeItem.title"
|
:content="noticeItem.title"
|
||||||
placement="top-start"
|
placement="top-start"
|
||||||
:enterable="!isMobile"
|
:enterable="!isMobile"
|
||||||
>
|
>
|
||||||
@@ -72,16 +72,16 @@ function hoverDescription(event, description) {
|
|||||||
class="notice-title-content"
|
class="notice-title-content"
|
||||||
@mouseover="hoverTitle"
|
@mouseover="hoverTitle"
|
||||||
>
|
>
|
||||||
{{ props.noticeItem.title }}
|
{{ noticeItem.title }}
|
||||||
</div>
|
</div>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<el-tag
|
<el-tag
|
||||||
v-if="props.noticeItem?.extra"
|
v-if="noticeItem?.extra"
|
||||||
:type="props.noticeItem?.status"
|
:type="noticeItem?.status"
|
||||||
size="small"
|
size="small"
|
||||||
class="notice-title-extra"
|
class="notice-title-extra"
|
||||||
>
|
>
|
||||||
{{ props.noticeItem?.extra }}
|
{{ noticeItem?.extra }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -89,19 +89,19 @@ function hoverDescription(event, description) {
|
|||||||
popper-class="notice-title-popper"
|
popper-class="notice-title-popper"
|
||||||
:effect="tooltipEffect"
|
:effect="tooltipEffect"
|
||||||
:disabled="!descriptionTooltip"
|
:disabled="!descriptionTooltip"
|
||||||
:content="props.noticeItem.description"
|
:content="noticeItem.description"
|
||||||
placement="top-start"
|
placement="top-start"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
ref="descriptionRef"
|
ref="descriptionRef"
|
||||||
class="notice-text-description"
|
class="notice-text-description"
|
||||||
@mouseover="hoverDescription($event, props.noticeItem.description)"
|
@mouseover="hoverDescription($event, noticeItem.description)"
|
||||||
>
|
>
|
||||||
{{ props.noticeItem.description }}
|
{{ noticeItem.description }}
|
||||||
</div>
|
</div>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<div class="notice-text-datetime text-[#00000073] dark:text-white">
|
<div class="notice-text-datetime text-[#00000073] dark:text-white">
|
||||||
{{ props.noticeItem.datetime }}
|
{{ noticeItem.datetime }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -112,7 +112,7 @@ function hoverDescription(event, description) {
|
|||||||
max-width: 238px;
|
max-width: 238px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<style scoped lang="scss">
|
<style lang="scss" scoped>
|
||||||
.notice-container {
|
.notice-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
24
src/layout/components/lay-notice/components/NoticeList.vue
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { PropType } from "vue";
|
||||||
|
import { ListItem } from "../data";
|
||||||
|
import NoticeItem from "./NoticeItem.vue";
|
||||||
|
import { transformI18n } from "@/plugins/i18n";
|
||||||
|
|
||||||
|
defineProps({
|
||||||
|
list: {
|
||||||
|
type: Array as PropType<Array<ListItem>>,
|
||||||
|
default: () => []
|
||||||
|
},
|
||||||
|
emptyText: {
|
||||||
|
type: String,
|
||||||
|
default: ""
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div v-if="list.length">
|
||||||
|
<NoticeItem v-for="(item, index) in list" :key="index" :noticeItem="item" />
|
||||||
|
</div>
|
||||||
|
<el-empty v-else :description="transformI18n(emptyText)" />
|
||||||
|
</template>
|
||||||
99
src/layout/components/lay-notice/data.ts
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
import { $t } from "@/plugins/i18n";
|
||||||
|
|
||||||
|
export interface ListItem {
|
||||||
|
avatar: string;
|
||||||
|
title: string;
|
||||||
|
datetime: string;
|
||||||
|
type: string;
|
||||||
|
description: string;
|
||||||
|
status?: "primary" | "success" | "warning" | "info" | "danger";
|
||||||
|
extra?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TabItem {
|
||||||
|
key: string;
|
||||||
|
name: string;
|
||||||
|
list: ListItem[];
|
||||||
|
emptyText: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const noticesData: TabItem[] = [
|
||||||
|
{
|
||||||
|
key: "1",
|
||||||
|
name: $t("status.pureNotify"),
|
||||||
|
list: [],
|
||||||
|
emptyText: $t("status.pureNoNotify")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "2",
|
||||||
|
name: $t("status.pureMessage"),
|
||||||
|
list: [
|
||||||
|
{
|
||||||
|
avatar: "https://xiaoxian521.github.io/hyperlink/svg/smile1.svg",
|
||||||
|
title: "小铭 评论了你",
|
||||||
|
description: "诚在于心,信在于行,诚信在于心行合一。",
|
||||||
|
datetime: "今天",
|
||||||
|
type: "2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
avatar: "https://xiaoxian521.github.io/hyperlink/svg/smile2.svg",
|
||||||
|
title: "李白 回复了你",
|
||||||
|
description: "长风破浪会有时,直挂云帆济沧海。",
|
||||||
|
datetime: "昨天",
|
||||||
|
type: "2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
avatar: "https://xiaoxian521.github.io/hyperlink/svg/smile5.svg",
|
||||||
|
title: "标题",
|
||||||
|
description:
|
||||||
|
"请将鼠标移动到此处,以便测试超长的消息在此处将如何处理。本例中设置的描述最大行数为2,超过2行的描述内容将被省略并且可以通过tooltip查看完整内容",
|
||||||
|
datetime: "时间",
|
||||||
|
type: "2"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
emptyText: $t("status.pureNoMessage")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "3",
|
||||||
|
name: $t("status.pureTodo"),
|
||||||
|
list: [
|
||||||
|
{
|
||||||
|
avatar: "",
|
||||||
|
title: "第三方紧急代码变更",
|
||||||
|
description:
|
||||||
|
"小林提交于 2024-05-10,需在 2024-05-11 前完成代码变更任务",
|
||||||
|
datetime: "",
|
||||||
|
extra: "马上到期",
|
||||||
|
status: "danger",
|
||||||
|
type: "3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
avatar: "",
|
||||||
|
title: "版本发布",
|
||||||
|
description: "指派小铭于 2024-06-18 前完成更新并发布",
|
||||||
|
datetime: "",
|
||||||
|
extra: "已耗时 8 天",
|
||||||
|
status: "warning",
|
||||||
|
type: "3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
avatar: "",
|
||||||
|
title: "新功能开发",
|
||||||
|
description: "开发多租户管理",
|
||||||
|
datetime: "",
|
||||||
|
extra: "进行中",
|
||||||
|
type: "3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
avatar: "",
|
||||||
|
title: "任务名称",
|
||||||
|
description: "任务需要在 2030-10-30 10:00 前启动",
|
||||||
|
datetime: "",
|
||||||
|
extra: "未开始",
|
||||||
|
status: "info",
|
||||||
|
type: "3"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
emptyText: $t("status.pureNoTodo")
|
||||||
|
}
|
||||||
|
];
|
||||||
@@ -1,22 +1,36 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from "vue";
|
import { useI18n } from "vue-i18n";
|
||||||
|
import { ref, computed } from "vue";
|
||||||
import { noticesData } from "./data";
|
import { noticesData } from "./data";
|
||||||
import NoticeList from "./noticeList.vue";
|
import NoticeList from "./components/NoticeList.vue";
|
||||||
import Bell from "@iconify-icons/ep/bell";
|
import BellIcon from "~icons/ep/bell";
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
const noticesNum = ref(0);
|
const noticesNum = ref(0);
|
||||||
const notices = ref(noticesData);
|
const notices = ref(noticesData);
|
||||||
const activeKey = ref(noticesData[0].key);
|
const activeKey = ref(noticesData[0]?.key);
|
||||||
|
|
||||||
notices.value.map(v => (noticesNum.value += v.list.length));
|
notices.value.map(v => (noticesNum.value += v.list.length));
|
||||||
|
|
||||||
|
const getLabel = computed(
|
||||||
|
() => item =>
|
||||||
|
t(item.name) + (item.list.length > 0 ? `(${item.list.length})` : "")
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<el-dropdown trigger="click" placement="bottom-end">
|
<el-dropdown trigger="click" placement="bottom-end">
|
||||||
<span class="dropdown-badge navbar-bg-hover select-none">
|
<span
|
||||||
<el-badge :value="noticesNum" :max="99">
|
:class="[
|
||||||
|
'dropdown-badge',
|
||||||
|
'navbar-bg-hover',
|
||||||
|
'select-none',
|
||||||
|
Number(noticesNum) !== 0 && 'mr-[10px]'
|
||||||
|
]"
|
||||||
|
>
|
||||||
|
<el-badge :value="Number(noticesNum) === 0 ? '' : noticesNum" :max="99">
|
||||||
<span class="header-notice-icon">
|
<span class="header-notice-icon">
|
||||||
<IconifyIconOffline :icon="Bell" />
|
<IconifyIconOffline :icon="BellIcon" />
|
||||||
</span>
|
</span>
|
||||||
</el-badge>
|
</el-badge>
|
||||||
</span>
|
</span>
|
||||||
@@ -30,18 +44,15 @@ notices.value.map(v => (noticesNum.value += v.list.length));
|
|||||||
>
|
>
|
||||||
<el-empty
|
<el-empty
|
||||||
v-if="notices.length === 0"
|
v-if="notices.length === 0"
|
||||||
description="暂无消息"
|
:description="t('status.pureNoMessage')"
|
||||||
:image-size="60"
|
:image-size="60"
|
||||||
/>
|
/>
|
||||||
<span v-else>
|
<span v-else>
|
||||||
<template v-for="item in notices" :key="item.key">
|
<template v-for="item in notices" :key="item.key">
|
||||||
<el-tab-pane
|
<el-tab-pane :label="getLabel(item)" :name="`${item.key}`">
|
||||||
: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" :emptyText="item.emptyText" />
|
||||||
</div>
|
</div>
|
||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
@@ -60,7 +71,6 @@ notices.value.map(v => (noticesNum.value += v.list.length));
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
width: 40px;
|
width: 40px;
|
||||||
height: 48px;
|
height: 48px;
|
||||||
margin-right: 10px;
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
.header-notice-icon {
|
.header-notice-icon {
|
||||||
@@ -1,9 +1,10 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { useI18n } from "vue-i18n";
|
||||||
import { emitter } from "@/utils/mitt";
|
import { emitter } from "@/utils/mitt";
|
||||||
import { onClickOutside } from "@vueuse/core";
|
import { onClickOutside } from "@vueuse/core";
|
||||||
import { ref, computed, onMounted, onBeforeUnmount } from "vue";
|
import { ref, computed, onMounted, onBeforeUnmount } from "vue";
|
||||||
import { useDataThemeChange } from "@/layout/hooks/useDataThemeChange";
|
import { useDataThemeChange } from "@/layout/hooks/useDataThemeChange";
|
||||||
import Close from "@iconify-icons/ep/close";
|
import CloseIcon from "~icons/ep/close";
|
||||||
|
|
||||||
const target = ref(null);
|
const target = ref(null);
|
||||||
const show = ref<Boolean>(false);
|
const show = ref<Boolean>(false);
|
||||||
@@ -15,7 +16,7 @@ const iconClass = computed(() => {
|
|||||||
"flex",
|
"flex",
|
||||||
"justify-center",
|
"justify-center",
|
||||||
"items-center",
|
"items-center",
|
||||||
"outline-none",
|
"outline-hidden",
|
||||||
"rounded-[4px]",
|
"rounded-[4px]",
|
||||||
"cursor-pointer",
|
"cursor-pointer",
|
||||||
"transition-colors",
|
"transition-colors",
|
||||||
@@ -25,6 +26,7 @@ const iconClass = computed(() => {
|
|||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
const { onReset } = useDataThemeChange();
|
const { onReset } = useDataThemeChange();
|
||||||
|
|
||||||
onClickOutside(target, (event: any) => {
|
onClickOutside(target, (event: any) => {
|
||||||
@@ -49,12 +51,14 @@ onBeforeUnmount(() => {
|
|||||||
<div class="right-panel-background" />
|
<div class="right-panel-background" />
|
||||||
<div ref="target" class="right-panel bg-bg_color">
|
<div ref="target" class="right-panel bg-bg_color">
|
||||||
<div
|
<div
|
||||||
class="project-configuration border-b-[1px] border-solid border-[var(--pure-border-color)]"
|
class="project-configuration border-0 border-b-[1px] border-solid border-[var(--pure-border-color)]"
|
||||||
>
|
>
|
||||||
<h4 class="dark:text-white">项目配置</h4>
|
<h4 class="dark:text-white">
|
||||||
|
{{ t("panel.pureSystemSet") }}
|
||||||
|
</h4>
|
||||||
<span
|
<span
|
||||||
v-tippy="{
|
v-tippy="{
|
||||||
content: '关闭配置',
|
content: t('panel.pureCloseSystemSet'),
|
||||||
placement: 'bottom-start',
|
placement: 'bottom-start',
|
||||||
zIndex: 41000
|
zIndex: 41000
|
||||||
}"
|
}"
|
||||||
@@ -64,7 +68,7 @@ onBeforeUnmount(() => {
|
|||||||
class="dark:text-white"
|
class="dark:text-white"
|
||||||
width="18px"
|
width="18px"
|
||||||
height="18px"
|
height="18px"
|
||||||
:icon="Close"
|
:icon="CloseIcon"
|
||||||
@click="show = !show"
|
@click="show = !show"
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
@@ -74,11 +78,11 @@ onBeforeUnmount(() => {
|
|||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="flex justify-end p-3 border-t-[1px] border-solid border-[var(--pure-border-color)]"
|
class="flex justify-end p-3 border-0 border-t-[1px] border-solid border-[var(--pure-border-color)]"
|
||||||
>
|
>
|
||||||
<el-button
|
<el-button
|
||||||
v-tippy="{
|
v-tippy="{
|
||||||
content: '清空缓存并返回登录页',
|
content: t('panel.pureClearCacheAndToLogin'),
|
||||||
placement: 'left-start',
|
placement: 'left-start',
|
||||||
zIndex: 41000
|
zIndex: 41000
|
||||||
}"
|
}"
|
||||||
@@ -87,7 +91,7 @@ onBeforeUnmount(() => {
|
|||||||
bg
|
bg
|
||||||
@click="onReset"
|
@click="onReset"
|
||||||
>
|
>
|
||||||
清空缓存
|
{{ t("panel.pureClearCache") }}
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -117,8 +121,8 @@ onBeforeUnmount(() => {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 280px;
|
max-width: 280px;
|
||||||
box-shadow: 0 0 15px 0 rgb(0 0 0 / 5%);
|
box-shadow: 0 0 15px 0 rgb(0 0 0 / 5%);
|
||||||
transition: all 0.25s cubic-bezier(0.7, 0.3, 0.1, 1);
|
|
||||||
transform: translate(100%);
|
transform: translate(100%);
|
||||||
|
transition: all 0.25s cubic-bezier(0.7, 0.3, 0.1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.show {
|
.show {
|
||||||
@@ -1,37 +1,36 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { useI18n } from "vue-i18n";
|
||||||
import { useNav } from "@/layout/hooks/useNav";
|
import { useNav } from "@/layout/hooks/useNav";
|
||||||
import mdiKeyboardEsc from "@/assets/svg/keyboard_esc.svg?component";
|
import MdiKeyboardEsc from "@/assets/svg/keyboard_esc.svg?component";
|
||||||
import enterOutlined from "@/assets/svg/enter_outlined.svg?component";
|
import EnterOutlined from "@/assets/svg/enter_outlined.svg?component";
|
||||||
import ArrowUpLine from "@iconify-icons/ri/arrow-up-line";
|
import ArrowUpLine from "~icons/ri/arrow-up-line";
|
||||||
import ArrowDownLine from "@iconify-icons/ri/arrow-down-line";
|
import ArrowDownLine from "~icons/ri/arrow-down-line";
|
||||||
|
|
||||||
const props = withDefaults(defineProps<{ total: number }>(), {
|
withDefaults(defineProps<{ total?: number }>(), {
|
||||||
total: 0
|
total: 0
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
const { device } = useNav();
|
const { device } = useNav();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="search-footer text-[#333] dark:text-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" />
|
||||||
确认
|
{{ t("buttons.pureConfirm") }}
|
||||||
</span>
|
</span>
|
||||||
<span class="search-footer-item">
|
<span class="search-footer-item">
|
||||||
<IconifyIconOffline :icon="ArrowUpLine" class="icon" />
|
<IconifyIconOffline :icon="ArrowUpLine" class="icon" />
|
||||||
<IconifyIconOffline :icon="ArrowDownLine" class="icon" />
|
<IconifyIconOffline :icon="ArrowDownLine" class="icon" />
|
||||||
切换
|
{{ t("buttons.pureSwitch") }}
|
||||||
</span>
|
</span>
|
||||||
<span class="search-footer-item">
|
<span class="search-footer-item">
|
||||||
<mdiKeyboardEsc class="icon" />
|
<MdiKeyboardEsc class="icon" />
|
||||||
关闭
|
{{ t("buttons.pureClose") }}
|
||||||
</span>
|
</span>
|
||||||
<p
|
<p v-if="device !== 'mobile' && total > 0" class="search-footer-total">
|
||||||
v-if="device !== 'mobile' && props.total > 0"
|
{{ `${t("search.pureTotal")} ${total}` }}
|
||||||
class="search-footer-total"
|
|
||||||
>
|
|
||||||
共{{ props.total }}项
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import Sortable from "sortablejs";
|
import Sortable from "sortablejs";
|
||||||
|
import { useI18n } from "vue-i18n";
|
||||||
import SearchHistoryItem from "./SearchHistoryItem.vue";
|
import SearchHistoryItem from "./SearchHistoryItem.vue";
|
||||||
import type { optionsItem, dragItem, Props } from "../types";
|
import type { optionsItem, dragItem, Props } from "../types";
|
||||||
import { useEpThemeStoreHook } from "@/store/modules/epTheme";
|
import { useEpThemeStoreHook } from "@/store/modules/epTheme";
|
||||||
@@ -19,6 +20,7 @@ const innerHeight = ref();
|
|||||||
/** 判断是否停止鼠标移入事件处理 */
|
/** 判断是否停止鼠标移入事件处理 */
|
||||||
const stopMouseEvent = ref(false);
|
const stopMouseEvent = ref(false);
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
const emit = defineEmits<Emits>();
|
const emit = defineEmits<Emits>();
|
||||||
const instance = getCurrentInstance()!;
|
const instance = getCurrentInstance()!;
|
||||||
const props = withDefaults(defineProps<Props>(), {});
|
const props = withDefaults(defineProps<Props>(), {});
|
||||||
@@ -141,7 +143,9 @@ defineExpose({ handleScroll });
|
|||||||
<template>
|
<template>
|
||||||
<div ref="historyRef" class="history">
|
<div ref="historyRef" class="history">
|
||||||
<template v-if="historyList.length">
|
<template v-if="historyList.length">
|
||||||
<div :style="titleStyle">搜索历史</div>
|
<div :style="titleStyle">
|
||||||
|
{{ t("search.pureHistory") }}
|
||||||
|
</div>
|
||||||
<div
|
<div
|
||||||
v-for="(item, index) in historyList"
|
v-for="(item, index) in historyList"
|
||||||
:key="item.path"
|
:key="item.path"
|
||||||
@@ -160,7 +164,9 @@ defineExpose({ handleScroll });
|
|||||||
</template>
|
</template>
|
||||||
<template v-if="collectList.length">
|
<template v-if="collectList.length">
|
||||||
<div :style="titleStyle">
|
<div :style="titleStyle">
|
||||||
收藏{{ collectList.length > 1 ? "(可拖拽排序)" : "" }}
|
{{
|
||||||
|
`${t("search.pureCollect")}${collectList.length > 1 ? t("search.pureDragSort") : ""}`
|
||||||
|
}}
|
||||||
</div>
|
</div>
|
||||||
<div class="collect-container">
|
<div class="collect-container">
|
||||||
<div
|
<div
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { optionsItem } from "../types";
|
import type { optionsItem } from "../types";
|
||||||
|
import { transformI18n } from "@/plugins/i18n";
|
||||||
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
|
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
|
||||||
import Star from "@iconify-icons/ep/star";
|
import StarIcon from "~icons/ep/star";
|
||||||
import Close from "@iconify-icons/ep/close";
|
import CloseIcon from "~icons/ep/close";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
item: optionsItem;
|
item: optionsItem;
|
||||||
@@ -28,16 +29,16 @@ function handleDelete(item) {
|
|||||||
<template>
|
<template>
|
||||||
<component :is="useRenderIcon(item.meta?.icon)" />
|
<component :is="useRenderIcon(item.meta?.icon)" />
|
||||||
<span class="history-item-title">
|
<span class="history-item-title">
|
||||||
{{ item.meta?.title }}
|
{{ transformI18n(item.meta?.title) }}
|
||||||
</span>
|
</span>
|
||||||
<IconifyIconOffline
|
<IconifyIconOffline
|
||||||
v-show="item.type === 'history'"
|
v-show="item.type === 'history'"
|
||||||
:icon="Star"
|
:icon="StarIcon"
|
||||||
class="w-[18px] h-[18px] mr-2 hover:text-[#d7d5d4]"
|
class="w-[18px] h-[18px] mr-2 hover:text-[#d7d5d4]"
|
||||||
@click.stop="handleCollect(item)"
|
@click.stop="handleCollect(item)"
|
||||||
/>
|
/>
|
||||||
<IconifyIconOffline
|
<IconifyIconOffline
|
||||||
:icon="Close"
|
:icon="CloseIcon"
|
||||||
class="w-[18px] h-[18px] hover:text-[#d7d5d4] cursor-pointer"
|
class="w-[18px] h-[18px] hover:text-[#d7d5d4] cursor-pointer"
|
||||||
@click.stop="handleDelete(item)"
|
@click.stop="handleDelete(item)"
|
||||||
/>
|
/>
|
||||||
@@ -1,17 +1,19 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { match } from "pinyin-pro";
|
import { match } from "pinyin-pro";
|
||||||
|
import { useI18n } from "vue-i18n";
|
||||||
import { getConfig } from "@/config";
|
import { getConfig } from "@/config";
|
||||||
import { useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
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 { useNav } from "@/layout/hooks/useNav";
|
||||||
|
import { transformI18n } from "@/plugins/i18n";
|
||||||
import SearchHistory from "./SearchHistory.vue";
|
import SearchHistory from "./SearchHistory.vue";
|
||||||
import type { optionsItem, dragItem } from "../types";
|
import type { optionsItem, dragItem } from "../types";
|
||||||
import { ref, computed, shallowRef, watch } from "vue";
|
import { ref, computed, shallowRef, watch } from "vue";
|
||||||
import { useDebounceFn, onKeyStroke } from "@vueuse/core";
|
import { useDebounceFn, onKeyStroke } from "@vueuse/core";
|
||||||
import { usePermissionStoreHook } from "@/store/modules/permission";
|
import { usePermissionStoreHook } from "@/store/modules/permission";
|
||||||
import { cloneDeep, isAllEmpty, storageLocal } from "@pureadmin/utils";
|
import { cloneDeep, isAllEmpty, storageLocal } from "@pureadmin/utils";
|
||||||
import Search from "@iconify-icons/ri/search-line";
|
import SearchIcon from "~icons/ri/search-line";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
/** 弹窗显隐 */
|
/** 弹窗显隐 */
|
||||||
@@ -27,6 +29,7 @@ const emit = defineEmits<Emits>();
|
|||||||
const props = withDefaults(defineProps<Props>(), {});
|
const props = withDefaults(defineProps<Props>(), {});
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { t, locale } = useI18n();
|
||||||
|
|
||||||
const HISTORY_TYPE = "history";
|
const HISTORY_TYPE = "history";
|
||||||
const COLLECT_TYPE = "collect";
|
const COLLECT_TYPE = "collect";
|
||||||
@@ -107,15 +110,16 @@ function search() {
|
|||||||
const flatMenusData = flatTree(menusData.value);
|
const flatMenusData = flatTree(menusData.value);
|
||||||
resultOptions.value = flatMenusData.filter(menu =>
|
resultOptions.value = flatMenusData.filter(menu =>
|
||||||
keyword.value
|
keyword.value
|
||||||
? menu.meta?.title
|
? transformI18n(menu.meta?.title)
|
||||||
.toLocaleLowerCase()
|
.toLocaleLowerCase()
|
||||||
.includes(keyword.value.toLocaleLowerCase().trim()) ||
|
.includes(keyword.value.toLocaleLowerCase().trim()) ||
|
||||||
!isAllEmpty(
|
(locale.value === "zh" &&
|
||||||
match(
|
!isAllEmpty(
|
||||||
menu.meta?.title.toLocaleLowerCase(),
|
match(
|
||||||
keyword.value.toLocaleLowerCase().trim()
|
transformI18n(menu.meta?.title).toLocaleLowerCase(),
|
||||||
)
|
keyword.value.toLocaleLowerCase().trim()
|
||||||
)
|
)
|
||||||
|
))
|
||||||
: false
|
: false
|
||||||
);
|
);
|
||||||
activePath.value =
|
activePath.value =
|
||||||
@@ -289,19 +293,19 @@ onKeyStroke("ArrowDown", handleDown);
|
|||||||
v-model="keyword"
|
v-model="keyword"
|
||||||
size="large"
|
size="large"
|
||||||
clearable
|
clearable
|
||||||
placeholder="搜索菜单(支持拼音搜索)"
|
:placeholder="t('search.purePlaceholder')"
|
||||||
@input="handleSearch"
|
@input="handleSearch"
|
||||||
>
|
>
|
||||||
<template #prefix>
|
<template #prefix>
|
||||||
<IconifyIconOffline
|
<IconifyIconOffline
|
||||||
:icon="Search"
|
:icon="SearchIcon"
|
||||||
class="text-primary w-[24px] h-[24px]"
|
class="text-primary w-[24px] h-[24px]"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
<div class="search-content">
|
<div class="search-content">
|
||||||
<el-scrollbar ref="scrollbarRef" max-height="calc(90vh - 140px)">
|
<el-scrollbar ref="scrollbarRef" max-height="calc(90vh - 140px)">
|
||||||
<el-empty v-if="showEmpty" description="暂无搜索结果" />
|
<el-empty v-if="showEmpty" :description="t('search.pureEmpty')" />
|
||||||
<SearchHistory
|
<SearchHistory
|
||||||
v-if="showSearchHistory"
|
v-if="showSearchHistory"
|
||||||
ref="historyRef"
|
ref="historyRef"
|
||||||
@@ -1,10 +1,11 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { Props } from "../types";
|
import type { Props } from "../types";
|
||||||
|
import { transformI18n } from "@/plugins/i18n";
|
||||||
import { useResizeObserver } from "@pureadmin/utils";
|
import { useResizeObserver } from "@pureadmin/utils";
|
||||||
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 { ref, computed, getCurrentInstance, onMounted } from "vue";
|
import { ref, computed, getCurrentInstance, onMounted } from "vue";
|
||||||
import enterOutlined from "@/assets/svg/enter_outlined.svg?component";
|
import EnterOutlined from "@/assets/svg/enter_outlined.svg?component";
|
||||||
|
|
||||||
interface Emits {
|
interface Emits {
|
||||||
(e: "update:value", val: string): void;
|
(e: "update:value", val: string): void;
|
||||||
@@ -81,9 +82,9 @@ defineExpose({ handleScroll });
|
|||||||
>
|
>
|
||||||
<component :is="useRenderIcon(item.meta?.icon)" />
|
<component :is="useRenderIcon(item.meta?.icon)" />
|
||||||
<span class="result-item-title">
|
<span class="result-item-title">
|
||||||
{{ item.meta?.title }}
|
{{ transformI18n(item.meta?.title) }}
|
||||||
</span>
|
</span>
|
||||||
<enterOutlined />
|
<EnterOutlined />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { SearchModal } from "./components";
|
|
||||||
import { useBoolean } from "../../hooks/useBoolean";
|
import { useBoolean } from "../../hooks/useBoolean";
|
||||||
|
import SearchModal from "./components/SearchModal.vue";
|
||||||
|
|
||||||
const { bool: show, toggle } = useBoolean();
|
const { bool: show, toggle } = useBoolean();
|
||||||
function handleSearch() {
|
function handleSearch() {
|
||||||
@@ -14,7 +14,7 @@ function handleSearch() {
|
|||||||
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="ri:search-line" />
|
<IconifyIconOffline icon="ri/search-line" />
|
||||||
</div>
|
</div>
|
||||||
<SearchModal v-model:value="show" />
|
<SearchModal v-model:value="show" />
|
||||||
</div>
|
</div>
|
||||||
@@ -9,21 +9,24 @@ import {
|
|||||||
onUnmounted,
|
onUnmounted,
|
||||||
onBeforeMount
|
onBeforeMount
|
||||||
} from "vue";
|
} from "vue";
|
||||||
import panel from "../panel/index.vue";
|
import { useI18n } from "vue-i18n";
|
||||||
import { emitter } from "@/utils/mitt";
|
import { emitter } from "@/utils/mitt";
|
||||||
|
import LayPanel from "../lay-panel/index.vue";
|
||||||
import { useNav } from "@/layout/hooks/useNav";
|
import { useNav } from "@/layout/hooks/useNav";
|
||||||
import { useAppStoreHook } from "@/store/modules/app";
|
import { useAppStoreHook } from "@/store/modules/app";
|
||||||
import { useDark, useGlobal, debounce } from "@pureadmin/utils";
|
|
||||||
import { toggleTheme } from "@pureadmin/theme/dist/browser-utils";
|
|
||||||
import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
|
import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
|
||||||
import Segmented, { type OptionsType } from "@/components/ReSegmented";
|
import Segmented, { type OptionsType } from "@/components/ReSegmented";
|
||||||
import { useDataThemeChange } from "@/layout/hooks/useDataThemeChange";
|
import { useDataThemeChange } from "@/layout/hooks/useDataThemeChange";
|
||||||
|
import { useDark, useGlobal, debounce, isNumber } from "@pureadmin/utils";
|
||||||
|
|
||||||
import Check from "@iconify-icons/ep/check";
|
import Check from "~icons/ep/check";
|
||||||
import dayIcon from "@/assets/svg/day.svg?component";
|
import LeftArrow from "~icons/ri/arrow-left-s-line?width=20&height=20";
|
||||||
import darkIcon from "@/assets/svg/dark.svg?component";
|
import RightArrow from "~icons/ri/arrow-right-s-line?width=20&height=20";
|
||||||
import systemIcon from "@/assets/svg/system.svg?component";
|
import DayIcon from "@/assets/svg/day.svg?component";
|
||||||
|
import DarkIcon from "@/assets/svg/dark.svg?component";
|
||||||
|
import SystemIcon from "@/assets/svg/system.svg?component";
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
const { device } = useNav();
|
const { device } = useNav();
|
||||||
const { isDark } = useDark();
|
const { isDark } = useDark();
|
||||||
const { $storage } = useGlobal<GlobalPropertiesApi>();
|
const { $storage } = useGlobal<GlobalPropertiesApi>();
|
||||||
@@ -46,9 +49,7 @@ const {
|
|||||||
if (unref(layoutTheme)) {
|
if (unref(layoutTheme)) {
|
||||||
const layout = unref(layoutTheme).layout;
|
const layout = unref(layoutTheme).layout;
|
||||||
const theme = unref(layoutTheme).theme;
|
const theme = unref(layoutTheme).theme;
|
||||||
toggleTheme({
|
document.documentElement.setAttribute("data-theme", theme);
|
||||||
scopeName: `layout-theme-${theme}`
|
|
||||||
});
|
|
||||||
setLayoutModel(layout);
|
setLayoutModel(layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,7 +65,8 @@ const settings = reactive({
|
|||||||
showLogo: $storage.configure.showLogo,
|
showLogo: $storage.configure.showLogo,
|
||||||
showModel: $storage.configure.showModel,
|
showModel: $storage.configure.showModel,
|
||||||
hideFooter: $storage.configure.hideFooter,
|
hideFooter: $storage.configure.hideFooter,
|
||||||
multiTagsCache: $storage.configure.multiTagsCache
|
multiTagsCache: $storage.configure.multiTagsCache,
|
||||||
|
stretch: $storage.configure.stretch
|
||||||
});
|
});
|
||||||
|
|
||||||
const getThemeColorStyle = computed(() => {
|
const getThemeColorStyle = computed(() => {
|
||||||
@@ -141,6 +143,32 @@ function setFalse(Doms): any {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 页宽 */
|
||||||
|
const stretchTypeOptions = computed<Array<OptionsType>>(() => {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
label: t("panel.pureStretchFixed"),
|
||||||
|
tip: t("panel.pureStretchFixedTip"),
|
||||||
|
value: "fixed"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: t("panel.pureStretchCustom"),
|
||||||
|
tip: t("panel.pureStretchCustomTip"),
|
||||||
|
value: "custom"
|
||||||
|
}
|
||||||
|
];
|
||||||
|
});
|
||||||
|
|
||||||
|
const setStretch = value => {
|
||||||
|
settings.stretch = value;
|
||||||
|
storageConfigureChange("stretch", value);
|
||||||
|
};
|
||||||
|
|
||||||
|
const stretchTypeChange = ({ option }) => {
|
||||||
|
const { value } = option;
|
||||||
|
value === "custom" ? setStretch(1440) : setStretch(false);
|
||||||
|
};
|
||||||
|
|
||||||
/** 主题色 激活选择项 */
|
/** 主题色 激活选择项 */
|
||||||
const getThemeColor = computed(() => {
|
const getThemeColor = computed(() => {
|
||||||
return current => {
|
return current => {
|
||||||
@@ -160,44 +188,55 @@ const getThemeColor = computed(() => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const pClass = computed(() => {
|
||||||
|
return ["mb-[12px]!", "font-medium", "text-sm", "dark:text-white"];
|
||||||
|
});
|
||||||
|
|
||||||
const themeOptions = computed<Array<OptionsType>>(() => {
|
const themeOptions = computed<Array<OptionsType>>(() => {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
label: "浅色",
|
label: t("panel.pureOverallStyleLight"),
|
||||||
icon: dayIcon,
|
icon: DayIcon,
|
||||||
theme: "light",
|
theme: "light",
|
||||||
tip: "清新启航,点亮舒适的工作界面",
|
tip: t("panel.pureOverallStyleLightTip"),
|
||||||
iconAttrs: { fill: isDark.value ? "#fff" : "#000" }
|
iconAttrs: { fill: isDark.value ? "#fff" : "#000" }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "深色",
|
label: t("panel.pureOverallStyleDark"),
|
||||||
icon: darkIcon,
|
icon: DarkIcon,
|
||||||
theme: "dark",
|
theme: "dark",
|
||||||
tip: "月光序曲,沉醉于夜的静谧雅致",
|
tip: t("panel.pureOverallStyleDarkTip"),
|
||||||
iconAttrs: { fill: isDark.value ? "#fff" : "#000" }
|
iconAttrs: { fill: isDark.value ? "#fff" : "#000" }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "自动",
|
label: t("panel.pureOverallStyleSystem"),
|
||||||
icon: systemIcon,
|
icon: SystemIcon,
|
||||||
theme: "system",
|
theme: "system",
|
||||||
tip: "同步时光,界面随晨昏自然呼应",
|
tip: t("panel.pureOverallStyleSystemTip"),
|
||||||
iconAttrs: { fill: isDark.value ? "#fff" : "#000" }
|
iconAttrs: { fill: isDark.value ? "#fff" : "#000" }
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
const markOptions: Array<OptionsType> = [
|
const markOptions = computed<Array<OptionsType>>(() => {
|
||||||
{
|
return [
|
||||||
label: "灵动",
|
{
|
||||||
tip: "灵动标签,添趣生辉",
|
label: t("panel.pureTagsStyleSmart"),
|
||||||
value: "smart"
|
tip: t("panel.pureTagsStyleSmartTip"),
|
||||||
},
|
value: "smart"
|
||||||
{
|
},
|
||||||
label: "卡片",
|
{
|
||||||
tip: "卡片标签,高效浏览",
|
label: t("panel.pureTagsStyleCard"),
|
||||||
value: "card"
|
tip: t("panel.pureTagsStyleCardTip"),
|
||||||
}
|
value: "card"
|
||||||
];
|
},
|
||||||
|
{
|
||||||
|
label: t("panel.pureTagsStyleChrome"),
|
||||||
|
tip: t("panel.pureTagsStyleChromeTip"),
|
||||||
|
value: "chrome"
|
||||||
|
}
|
||||||
|
];
|
||||||
|
});
|
||||||
|
|
||||||
/** 设置导航模式 */
|
/** 设置导航模式 */
|
||||||
function setLayoutModel(layout: string) {
|
function setLayoutModel(layout: string) {
|
||||||
@@ -260,7 +299,7 @@ function watchSystemThemeChange() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
/* 初始化项目配置 */
|
/* 初始化系统配置 */
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
watchSystemThemeChange();
|
watchSystemThemeChange();
|
||||||
settings.greyVal &&
|
settings.greyVal &&
|
||||||
@@ -276,10 +315,11 @@ onUnmounted(() => removeMatchMedia);
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<panel>
|
<LayPanel>
|
||||||
<div class="p-6">
|
<div class="p-5">
|
||||||
<p class="mb-3 font-medium text-sm dark:text-white">整体风格</p>
|
<p :class="pClass">{{ t("panel.pureOverallStyle") }}</p>
|
||||||
<Segmented
|
<Segmented
|
||||||
|
resize
|
||||||
class="select-none"
|
class="select-none"
|
||||||
:modelValue="overallStyle === 'system' ? 2 : dataTheme ? 1 : 0"
|
:modelValue="overallStyle === 'system' ? 2 : dataTheme ? 1 : 0"
|
||||||
:options="themeOptions"
|
:options="themeOptions"
|
||||||
@@ -295,7 +335,7 @@ onUnmounted(() => removeMatchMedia);
|
|||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<p class="mt-5 mb-3 font-medium text-sm dark:text-white">主题色</p>
|
<p :class="['mt-5!', pClass]">{{ t("panel.pureThemeColor") }}</p>
|
||||||
<ul class="theme-color">
|
<ul class="theme-color">
|
||||||
<li
|
<li
|
||||||
v-for="(item, index) in themeColors"
|
v-for="(item, index) in themeColors"
|
||||||
@@ -314,12 +354,12 @@ onUnmounted(() => removeMatchMedia);
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<p class="mt-5 mb-3 font-medium text-sm dark:text-white">导航模式</p>
|
<p :class="['mt-5!', pClass]">{{ t("panel.pureLayoutModel") }}</p>
|
||||||
<ul class="pure-theme">
|
<ul class="pure-theme">
|
||||||
<li
|
<li
|
||||||
ref="verticalRef"
|
ref="verticalRef"
|
||||||
v-tippy="{
|
v-tippy="{
|
||||||
content: '左侧菜单,亲切熟悉',
|
content: t('panel.pureVerticalTip'),
|
||||||
zIndex: 41000
|
zIndex: 41000
|
||||||
}"
|
}"
|
||||||
:class="layoutTheme.layout === 'vertical' ? 'is-select' : ''"
|
:class="layoutTheme.layout === 'vertical' ? 'is-select' : ''"
|
||||||
@@ -332,7 +372,7 @@ onUnmounted(() => removeMatchMedia);
|
|||||||
v-if="device !== 'mobile'"
|
v-if="device !== 'mobile'"
|
||||||
ref="horizontalRef"
|
ref="horizontalRef"
|
||||||
v-tippy="{
|
v-tippy="{
|
||||||
content: '顶部菜单,简洁概览',
|
content: t('panel.pureHorizontalTip'),
|
||||||
zIndex: 41000
|
zIndex: 41000
|
||||||
}"
|
}"
|
||||||
:class="layoutTheme.layout === 'horizontal' ? 'is-select' : ''"
|
:class="layoutTheme.layout === 'horizontal' ? 'is-select' : ''"
|
||||||
@@ -345,7 +385,7 @@ onUnmounted(() => removeMatchMedia);
|
|||||||
v-if="device !== 'mobile'"
|
v-if="device !== 'mobile'"
|
||||||
ref="mixRef"
|
ref="mixRef"
|
||||||
v-tippy="{
|
v-tippy="{
|
||||||
content: '混合菜单,灵活多变',
|
content: t('panel.pureMixTip'),
|
||||||
zIndex: 41000
|
zIndex: 41000
|
||||||
}"
|
}"
|
||||||
:class="layoutTheme.layout === 'mix' ? 'is-select' : ''"
|
:class="layoutTheme.layout === 'mix' ? 'is-select' : ''"
|
||||||
@@ -356,53 +396,98 @@ onUnmounted(() => removeMatchMedia);
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<p class="mt-5 mb-3 font-medium text-base dark:text-white">页签风格</p>
|
<span v-if="useAppStoreHook().getViewportWidth > 1280">
|
||||||
|
<p :class="['mt-5!', pClass]">{{ t("panel.pureStretch") }}</p>
|
||||||
|
<Segmented
|
||||||
|
resize
|
||||||
|
class="mb-2 select-none"
|
||||||
|
:modelValue="isNumber(settings.stretch) ? 1 : 0"
|
||||||
|
:options="stretchTypeOptions"
|
||||||
|
@change="stretchTypeChange"
|
||||||
|
/>
|
||||||
|
<el-input-number
|
||||||
|
v-if="isNumber(settings.stretch)"
|
||||||
|
v-model="settings.stretch as number"
|
||||||
|
:min="1280"
|
||||||
|
:max="1600"
|
||||||
|
controls-position="right"
|
||||||
|
@change="value => setStretch(value)"
|
||||||
|
/>
|
||||||
|
<button
|
||||||
|
v-else
|
||||||
|
v-ripple="{ class: 'text-gray-300' }"
|
||||||
|
class="bg-transparent flex-c w-full h-20 rounded-md border border-[var(--pure-border-color)]"
|
||||||
|
@click="setStretch(!settings.stretch)"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="flex-bc transition-all duration-300"
|
||||||
|
:class="[settings.stretch ? 'w-[24%]' : 'w-[50%]']"
|
||||||
|
style="color: var(--el-color-primary)"
|
||||||
|
>
|
||||||
|
<IconifyIconOffline
|
||||||
|
:icon="settings.stretch ? RightArrow : LeftArrow"
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
class="grow border-0 border-b border-dashed"
|
||||||
|
style="border-color: var(--el-color-primary)"
|
||||||
|
/>
|
||||||
|
<IconifyIconOffline
|
||||||
|
:icon="settings.stretch ? LeftArrow : RightArrow"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</button>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<p :class="['mt-4!', pClass]">{{ t("panel.pureTagsStyle") }}</p>
|
||||||
<Segmented
|
<Segmented
|
||||||
|
resize
|
||||||
class="select-none"
|
class="select-none"
|
||||||
:modelValue="markValue === 'smart' ? 0 : 1"
|
:modelValue="markValue === 'smart' ? 0 : markValue === 'card' ? 1 : 2"
|
||||||
:options="markOptions"
|
:options="markOptions"
|
||||||
@change="onChange"
|
@change="onChange"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<p class="mt-5 mb-1 font-medium text-sm dark:text-white">界面显示</p>
|
<p class="mt-5! font-medium text-sm dark:text-white">
|
||||||
|
{{ t("panel.pureInterfaceDisplay") }}
|
||||||
|
</p>
|
||||||
<ul class="setting">
|
<ul class="setting">
|
||||||
<li>
|
<li>
|
||||||
<span class="dark:text-white">灰色模式</span>
|
<span class="dark:text-white">{{ t("panel.pureGreyModel") }}</span>
|
||||||
<el-switch
|
<el-switch
|
||||||
v-model="settings.greyVal"
|
v-model="settings.greyVal"
|
||||||
inline-prompt
|
inline-prompt
|
||||||
active-text="开"
|
:active-text="t('buttons.pureOpenText')"
|
||||||
inactive-text="关"
|
:inactive-text="t('buttons.pureCloseText')"
|
||||||
@change="greyChange"
|
@change="greyChange"
|
||||||
/>
|
/>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<span class="dark:text-white">色弱模式</span>
|
<span class="dark:text-white">{{ t("panel.pureWeakModel") }}</span>
|
||||||
<el-switch
|
<el-switch
|
||||||
v-model="settings.weakVal"
|
v-model="settings.weakVal"
|
||||||
inline-prompt
|
inline-prompt
|
||||||
active-text="开"
|
:active-text="t('buttons.pureOpenText')"
|
||||||
inactive-text="关"
|
:inactive-text="t('buttons.pureCloseText')"
|
||||||
@change="weekChange"
|
@change="weekChange"
|
||||||
/>
|
/>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<span class="dark:text-white">隐藏标签页</span>
|
<span class="dark:text-white">{{ t("panel.pureHiddenTags") }}</span>
|
||||||
<el-switch
|
<el-switch
|
||||||
v-model="settings.tabsVal"
|
v-model="settings.tabsVal"
|
||||||
inline-prompt
|
inline-prompt
|
||||||
active-text="开"
|
:active-text="t('buttons.pureOpenText')"
|
||||||
inactive-text="关"
|
:inactive-text="t('buttons.pureCloseText')"
|
||||||
@change="tagsChange"
|
@change="tagsChange"
|
||||||
/>
|
/>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<span class="dark:text-white">隐藏页脚</span>
|
<span class="dark:text-white">{{ t("panel.pureHiddenFooter") }}</span>
|
||||||
<el-switch
|
<el-switch
|
||||||
v-model="settings.hideFooter"
|
v-model="settings.hideFooter"
|
||||||
inline-prompt
|
inline-prompt
|
||||||
active-text="开"
|
:active-text="t('buttons.pureOpenText')"
|
||||||
inactive-text="关"
|
:inactive-text="t('buttons.pureCloseText')"
|
||||||
@change="hideFooterChange"
|
@change="hideFooterChange"
|
||||||
/>
|
/>
|
||||||
</li>
|
</li>
|
||||||
@@ -413,24 +498,26 @@ onUnmounted(() => removeMatchMedia);
|
|||||||
inline-prompt
|
inline-prompt
|
||||||
:active-value="true"
|
:active-value="true"
|
||||||
:inactive-value="false"
|
:inactive-value="false"
|
||||||
active-text="开"
|
:active-text="t('buttons.pureOpenText')"
|
||||||
inactive-text="关"
|
:inactive-text="t('buttons.pureCloseText')"
|
||||||
@change="logoChange"
|
@change="logoChange"
|
||||||
/>
|
/>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<span class="dark:text-white">页签持久化</span>
|
<span class="dark:text-white">
|
||||||
|
{{ t("panel.pureMultiTagsCache") }}
|
||||||
|
</span>
|
||||||
<el-switch
|
<el-switch
|
||||||
v-model="settings.multiTagsCache"
|
v-model="settings.multiTagsCache"
|
||||||
inline-prompt
|
inline-prompt
|
||||||
active-text="开"
|
:active-text="t('buttons.pureOpenText')"
|
||||||
inactive-text="关"
|
:inactive-text="t('buttons.pureCloseText')"
|
||||||
@change="multiTagsCacheChange"
|
@change="multiTagsCacheChange"
|
||||||
/>
|
/>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</panel>
|
</LayPanel>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@@ -543,7 +630,7 @@ onUnmounted(() => removeMatchMedia);
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
padding: 4px 0;
|
padding: 3px 0;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
175
src/layout/components/lay-sidebar/NavHorizontal.vue
Normal file
@@ -0,0 +1,175 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { emitter } from "@/utils/mitt";
|
||||||
|
import { useNav } from "@/layout/hooks/useNav";
|
||||||
|
import LaySearch from "../lay-search/index.vue";
|
||||||
|
import LayNotice from "../lay-notice/index.vue";
|
||||||
|
import { responsiveStorageNameSpace } from "@/config";
|
||||||
|
import { ref, nextTick, computed, onMounted } from "vue";
|
||||||
|
import { storageLocal, isAllEmpty } from "@pureadmin/utils";
|
||||||
|
import { useTranslationLang } from "../../hooks/useTranslationLang";
|
||||||
|
import { usePermissionStoreHook } from "@/store/modules/permission";
|
||||||
|
import LaySidebarItem from "../lay-sidebar/components/SidebarItem.vue";
|
||||||
|
import LaySidebarFullScreen from "../lay-sidebar/components/SidebarFullScreen.vue";
|
||||||
|
|
||||||
|
import GlobalizationIcon from "@/assets/svg/globalization.svg?component";
|
||||||
|
import LogoutCircleRLine from "~icons/ri/logout-circle-r-line";
|
||||||
|
import Setting from "~icons/ri/settings-3-line";
|
||||||
|
import Check from "~icons/ep/check";
|
||||||
|
|
||||||
|
const menuRef = ref();
|
||||||
|
const showLogo = ref(
|
||||||
|
storageLocal().getItem<StorageConfigs>(
|
||||||
|
`${responsiveStorageNameSpace()}configure`
|
||||||
|
)?.showLogo ?? true
|
||||||
|
);
|
||||||
|
|
||||||
|
const { t, route, locale, translationCh, translationEn } =
|
||||||
|
useTranslationLang(menuRef);
|
||||||
|
const {
|
||||||
|
title,
|
||||||
|
logout,
|
||||||
|
onPanel,
|
||||||
|
getLogo,
|
||||||
|
username,
|
||||||
|
userAvatar,
|
||||||
|
backTopMenu,
|
||||||
|
avatarsStyle,
|
||||||
|
getDropdownItemStyle,
|
||||||
|
getDropdownItemClass
|
||||||
|
} = useNav();
|
||||||
|
|
||||||
|
const defaultActive = computed(() =>
|
||||||
|
!isAllEmpty(route.meta?.activePath) ? route.meta.activePath : route.path
|
||||||
|
);
|
||||||
|
|
||||||
|
nextTick(() => {
|
||||||
|
menuRef.value?.handleResize();
|
||||||
|
});
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
emitter.on("logoChange", key => {
|
||||||
|
showLogo.value = key;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div
|
||||||
|
v-loading="usePermissionStoreHook().wholeMenus.length === 0"
|
||||||
|
class="horizontal-header"
|
||||||
|
>
|
||||||
|
<div v-if="showLogo" class="horizontal-header-left" @click="backTopMenu">
|
||||||
|
<img :src="getLogo()" alt="logo" />
|
||||||
|
<span>{{ title }}</span>
|
||||||
|
</div>
|
||||||
|
<el-menu
|
||||||
|
ref="menuRef"
|
||||||
|
mode="horizontal"
|
||||||
|
popper-class="pure-scrollbar"
|
||||||
|
class="horizontal-header-menu"
|
||||||
|
:default-active="defaultActive"
|
||||||
|
>
|
||||||
|
<LaySidebarItem
|
||||||
|
v-for="route in usePermissionStoreHook().wholeMenus"
|
||||||
|
:key="route.path"
|
||||||
|
:item="route"
|
||||||
|
:base-path="route.path"
|
||||||
|
/>
|
||||||
|
</el-menu>
|
||||||
|
<div class="horizontal-header-right">
|
||||||
|
<!-- 菜单搜索 -->
|
||||||
|
<LaySearch id="header-search" />
|
||||||
|
<!-- 国际化 -->
|
||||||
|
<el-dropdown id="header-translation" trigger="click">
|
||||||
|
<GlobalizationIcon
|
||||||
|
class="navbar-bg-hover w-[40px] h-[48px] p-[11px] cursor-pointer outline-hidden"
|
||||||
|
/>
|
||||||
|
<template #dropdown>
|
||||||
|
<el-dropdown-menu class="translation">
|
||||||
|
<el-dropdown-item
|
||||||
|
:style="getDropdownItemStyle(locale, 'zh')"
|
||||||
|
:class="['dark:text-white!', getDropdownItemClass(locale, 'zh')]"
|
||||||
|
@click="translationCh"
|
||||||
|
>
|
||||||
|
<span v-show="locale === 'zh'" class="check-zh">
|
||||||
|
<IconifyIconOffline :icon="Check" />
|
||||||
|
</span>
|
||||||
|
简体中文
|
||||||
|
</el-dropdown-item>
|
||||||
|
<el-dropdown-item
|
||||||
|
:style="getDropdownItemStyle(locale, 'en')"
|
||||||
|
:class="['dark:text-white!', getDropdownItemClass(locale, 'en')]"
|
||||||
|
@click="translationEn"
|
||||||
|
>
|
||||||
|
<span v-show="locale === 'en'" class="check-en">
|
||||||
|
<IconifyIconOffline :icon="Check" />
|
||||||
|
</span>
|
||||||
|
English
|
||||||
|
</el-dropdown-item>
|
||||||
|
</el-dropdown-menu>
|
||||||
|
</template>
|
||||||
|
</el-dropdown>
|
||||||
|
<!-- 全屏 -->
|
||||||
|
<LaySidebarFullScreen id="full-screen" />
|
||||||
|
<!-- 消息通知 -->
|
||||||
|
<LayNotice id="header-notice" />
|
||||||
|
<!-- 退出登录 -->
|
||||||
|
<el-dropdown trigger="click">
|
||||||
|
<span class="el-dropdown-link navbar-bg-hover">
|
||||||
|
<img :src="userAvatar" :style="avatarsStyle" />
|
||||||
|
<p v-if="username" class="dark:text-white">{{ username }}</p>
|
||||||
|
</span>
|
||||||
|
<template #dropdown>
|
||||||
|
<el-dropdown-menu class="logout">
|
||||||
|
<el-dropdown-item @click="logout">
|
||||||
|
<IconifyIconOffline
|
||||||
|
:icon="LogoutCircleRLine"
|
||||||
|
style="margin: 5px"
|
||||||
|
/>
|
||||||
|
{{ t("buttons.pureLoginOut") }}
|
||||||
|
</el-dropdown-item>
|
||||||
|
</el-dropdown-menu>
|
||||||
|
</template>
|
||||||
|
</el-dropdown>
|
||||||
|
<span
|
||||||
|
class="set-icon navbar-bg-hover"
|
||||||
|
:title="t('buttons.pureOpenSystemSet')"
|
||||||
|
@click="onPanel"
|
||||||
|
>
|
||||||
|
<IconifyIconOffline :icon="Setting" />
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
:deep(.el-loading-mask) {
|
||||||
|
opacity: 0.45;
|
||||||
|
}
|
||||||
|
|
||||||
|
.translation {
|
||||||
|
::v-deep(.el-dropdown-menu__item) {
|
||||||
|
padding: 5px 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.check-zh {
|
||||||
|
position: absolute;
|
||||||
|
left: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.check-en {
|
||||||
|
position: absolute;
|
||||||
|
left: 20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.logout {
|
||||||
|
width: 120px;
|
||||||
|
|
||||||
|
::v-deep(.el-dropdown-menu__item) {
|
||||||
|
display: inline-flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
min-width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,21 +1,28 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import extraIcon from "./extraIcon.vue";
|
|
||||||
import Search from "../search/index.vue";
|
|
||||||
import Notice from "../notice/index.vue";
|
|
||||||
import { isAllEmpty } from "@pureadmin/utils";
|
import { isAllEmpty } from "@pureadmin/utils";
|
||||||
import { useNav } from "@/layout/hooks/useNav";
|
import { useNav } from "@/layout/hooks/useNav";
|
||||||
|
import { transformI18n } from "@/plugins/i18n";
|
||||||
|
import LaySearch from "../lay-search/index.vue";
|
||||||
|
import LayNotice from "../lay-notice/index.vue";
|
||||||
import { ref, toRaw, watch, onMounted, nextTick } from "vue";
|
import { ref, toRaw, watch, onMounted, nextTick } from "vue";
|
||||||
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
|
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
|
||||||
import { getParentPaths, findRouteByPath } from "@/router/utils";
|
import { getParentPaths, findRouteByPath } from "@/router/utils";
|
||||||
|
import { useTranslationLang } from "../../hooks/useTranslationLang";
|
||||||
import { usePermissionStoreHook } from "@/store/modules/permission";
|
import { usePermissionStoreHook } from "@/store/modules/permission";
|
||||||
import LogoutCircleRLine from "@iconify-icons/ri/logout-circle-r-line";
|
import LaySidebarExtraIcon from "../lay-sidebar/components/SidebarExtraIcon.vue";
|
||||||
import Setting from "@iconify-icons/ri/settings-3-line";
|
import LaySidebarFullScreen from "../lay-sidebar/components/SidebarFullScreen.vue";
|
||||||
|
|
||||||
|
import GlobalizationIcon from "@/assets/svg/globalization.svg?component";
|
||||||
|
import LogoutCircleRLine from "~icons/ri/logout-circle-r-line";
|
||||||
|
import Setting from "~icons/ri/settings-3-line";
|
||||||
|
import Check from "~icons/ep/check";
|
||||||
|
|
||||||
const menuRef = ref();
|
const menuRef = ref();
|
||||||
const defaultActive = ref(null);
|
const defaultActive = ref(null);
|
||||||
|
|
||||||
|
const { t, route, locale, translationCh, translationEn } =
|
||||||
|
useTranslationLang(menuRef);
|
||||||
const {
|
const {
|
||||||
route,
|
|
||||||
device,
|
device,
|
||||||
logout,
|
logout,
|
||||||
onPanel,
|
onPanel,
|
||||||
@@ -23,7 +30,9 @@ const {
|
|||||||
username,
|
username,
|
||||||
userAvatar,
|
userAvatar,
|
||||||
getDivStyle,
|
getDivStyle,
|
||||||
avatarsStyle
|
avatarsStyle,
|
||||||
|
getDropdownItemStyle,
|
||||||
|
getDropdownItemClass
|
||||||
} = useNav();
|
} = useNav();
|
||||||
|
|
||||||
function getDefaultActive(routePath) {
|
function getDefaultActive(routePath) {
|
||||||
@@ -81,18 +90,50 @@ watch(
|
|||||||
</div>
|
</div>
|
||||||
<div :style="getDivStyle">
|
<div :style="getDivStyle">
|
||||||
<span class="select-none">
|
<span class="select-none">
|
||||||
{{ route.meta.title }}
|
{{ transformI18n(route.meta.title) }}
|
||||||
</span>
|
</span>
|
||||||
<extraIcon :extraIcon="route.meta.extraIcon" />
|
<LaySidebarExtraIcon :extraIcon="route.meta.extraIcon" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
</el-menu>
|
</el-menu>
|
||||||
<div class="horizontal-header-right">
|
<div class="horizontal-header-right">
|
||||||
<!-- 菜单搜索 -->
|
<!-- 菜单搜索 -->
|
||||||
<Search id="header-search" />
|
<LaySearch id="header-search" />
|
||||||
<!-- 通知 -->
|
<!-- 国际化 -->
|
||||||
<Notice id="header-notice" />
|
<el-dropdown id="header-translation" trigger="click">
|
||||||
|
<GlobalizationIcon
|
||||||
|
class="navbar-bg-hover w-[40px] h-[48px] p-[11px] cursor-pointer outline-hidden"
|
||||||
|
/>
|
||||||
|
<template #dropdown>
|
||||||
|
<el-dropdown-menu class="translation">
|
||||||
|
<el-dropdown-item
|
||||||
|
:style="getDropdownItemStyle(locale, 'zh')"
|
||||||
|
:class="['dark:text-white!', getDropdownItemClass(locale, 'zh')]"
|
||||||
|
@click="translationCh"
|
||||||
|
>
|
||||||
|
<span v-show="locale === 'zh'" class="check-zh">
|
||||||
|
<IconifyIconOffline :icon="Check" />
|
||||||
|
</span>
|
||||||
|
简体中文
|
||||||
|
</el-dropdown-item>
|
||||||
|
<el-dropdown-item
|
||||||
|
:style="getDropdownItemStyle(locale, 'en')"
|
||||||
|
:class="['dark:text-white!', getDropdownItemClass(locale, 'en')]"
|
||||||
|
@click="translationEn"
|
||||||
|
>
|
||||||
|
<span v-show="locale === 'en'" class="check-en">
|
||||||
|
<IconifyIconOffline :icon="Check" />
|
||||||
|
</span>
|
||||||
|
English
|
||||||
|
</el-dropdown-item>
|
||||||
|
</el-dropdown-menu>
|
||||||
|
</template>
|
||||||
|
</el-dropdown>
|
||||||
|
<!-- 全屏 -->
|
||||||
|
<LaySidebarFullScreen id="full-screen" />
|
||||||
|
<!-- 消息通知 -->
|
||||||
|
<LayNotice id="header-notice" />
|
||||||
<!-- 退出登录 -->
|
<!-- 退出登录 -->
|
||||||
<el-dropdown trigger="click">
|
<el-dropdown trigger="click">
|
||||||
<span class="el-dropdown-link navbar-bg-hover select-none">
|
<span class="el-dropdown-link navbar-bg-hover select-none">
|
||||||
@@ -106,14 +147,14 @@ watch(
|
|||||||
:icon="LogoutCircleRLine"
|
:icon="LogoutCircleRLine"
|
||||||
style="margin: 5px"
|
style="margin: 5px"
|
||||||
/>
|
/>
|
||||||
退出系统
|
{{ t("buttons.pureLoginOut") }}
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</template>
|
</template>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
<span
|
<span
|
||||||
class="set-icon navbar-bg-hover"
|
class="set-icon navbar-bg-hover"
|
||||||
title="打开项目配置"
|
:title="t('buttons.pureOpenSystemSet')"
|
||||||
@click="onPanel"
|
@click="onPanel"
|
||||||
>
|
>
|
||||||
<IconifyIconOffline :icon="Setting" />
|
<IconifyIconOffline :icon="Setting" />
|
||||||
@@ -127,8 +168,24 @@ watch(
|
|||||||
opacity: 0.45;
|
opacity: 0.45;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.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;
|
width: 120px;
|
||||||
|
|
||||||
::v-deep(.el-dropdown-menu__item) {
|
::v-deep(.el-dropdown-menu__item) {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
@@ -1,17 +1,19 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
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 leftCollapse from "./leftCollapse.vue";
|
|
||||||
import { useNav } from "@/layout/hooks/useNav";
|
import { useNav } from "@/layout/hooks/useNav";
|
||||||
import { responsiveStorageNameSpace } from "@/config";
|
import { responsiveStorageNameSpace } from "@/config";
|
||||||
import { storageLocal, isAllEmpty } from "@pureadmin/utils";
|
import { storageLocal, isAllEmpty } from "@pureadmin/utils";
|
||||||
import { findRouteByPath, getParentPaths } from "@/router/utils";
|
import { findRouteByPath, getParentPaths } from "@/router/utils";
|
||||||
import { usePermissionStoreHook } from "@/store/modules/permission";
|
import { usePermissionStoreHook } from "@/store/modules/permission";
|
||||||
import { ref, computed, watch, onMounted, onBeforeUnmount } from "vue";
|
import { ref, computed, watch, onMounted, onBeforeUnmount } from "vue";
|
||||||
|
import LaySidebarLogo from "../lay-sidebar/components/SidebarLogo.vue";
|
||||||
|
import LaySidebarItem from "../lay-sidebar/components/SidebarItem.vue";
|
||||||
|
import LaySidebarLeftCollapse from "../lay-sidebar/components/SidebarLeftCollapse.vue";
|
||||||
|
import LaySidebarCenterCollapse from "../lay-sidebar/components/SidebarCenterCollapse.vue";
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
const isShow = ref(false);
|
||||||
const showLogo = ref(
|
const showLogo = ref(
|
||||||
storageLocal().getItem<StorageConfigs>(
|
storageLocal().getItem<StorageConfigs>(
|
||||||
`${responsiveStorageNameSpace()}configure`
|
`${responsiveStorageNameSpace()}configure`
|
||||||
@@ -88,14 +90,15 @@ onBeforeUnmount(() => {
|
|||||||
<div
|
<div
|
||||||
v-loading="loading"
|
v-loading="loading"
|
||||||
:class="['sidebar-container', showLogo ? 'has-logo' : 'no-logo']"
|
:class="['sidebar-container', showLogo ? 'has-logo' : 'no-logo']"
|
||||||
|
@mouseenter.prevent="isShow = true"
|
||||||
|
@mouseleave.prevent="isShow = false"
|
||||||
>
|
>
|
||||||
<Logo v-if="showLogo" :collapse="isCollapse" />
|
<LaySidebarLogo v-if="showLogo" :collapse="isCollapse" />
|
||||||
<el-scrollbar
|
<el-scrollbar
|
||||||
wrap-class="scrollbar-wrapper"
|
wrap-class="scrollbar-wrapper"
|
||||||
:class="[device === 'mobile' ? 'mobile' : 'pc']"
|
:class="[device === 'mobile' ? 'mobile' : 'pc']"
|
||||||
>
|
>
|
||||||
<el-menu
|
<el-menu
|
||||||
router
|
|
||||||
unique-opened
|
unique-opened
|
||||||
mode="vertical"
|
mode="vertical"
|
||||||
popper-class="pure-scrollbar"
|
popper-class="pure-scrollbar"
|
||||||
@@ -105,7 +108,7 @@ onBeforeUnmount(() => {
|
|||||||
:popper-effect="tooltipEffect"
|
:popper-effect="tooltipEffect"
|
||||||
:default-active="defaultActive"
|
:default-active="defaultActive"
|
||||||
>
|
>
|
||||||
<sidebar-item
|
<LaySidebarItem
|
||||||
v-for="routes in menuData"
|
v-for="routes in menuData"
|
||||||
:key="routes.path"
|
:key="routes.path"
|
||||||
:item="routes"
|
:item="routes"
|
||||||
@@ -114,7 +117,12 @@ onBeforeUnmount(() => {
|
|||||||
/>
|
/>
|
||||||
</el-menu>
|
</el-menu>
|
||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
<leftCollapse
|
<LaySidebarCenterCollapse
|
||||||
|
v-if="device !== 'mobile' && (isShow || isCollapse)"
|
||||||
|
:is-active="pureApp.sidebar.opened"
|
||||||
|
@toggleClick="toggleSideBar"
|
||||||
|
/>
|
||||||
|
<LaySidebarLeftCollapse
|
||||||
v-if="device !== 'mobile'"
|
v-if="device !== 'mobile'"
|
||||||
:is-active="pureApp.sidebar.opened"
|
:is-active="pureApp.sidebar.opened"
|
||||||
@toggleClick="toggleSideBar"
|
@toggleClick="toggleSideBar"
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { isEqual } from "@pureadmin/utils";
|
import { isEqual } from "@pureadmin/utils";
|
||||||
|
import { transformI18n } from "@/plugins/i18n";
|
||||||
import { useRoute, useRouter } from "vue-router";
|
import { useRoute, useRouter } from "vue-router";
|
||||||
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";
|
||||||
@@ -104,15 +105,15 @@ watch(
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<el-breadcrumb class="!leading-[50px] select-none" separator="/">
|
<el-breadcrumb class="leading-[50px]! select-none" separator="/">
|
||||||
<transition-group name="breadcrumb">
|
<transition-group name="breadcrumb">
|
||||||
<el-breadcrumb-item
|
<el-breadcrumb-item
|
||||||
v-for="item in levelList"
|
v-for="item in levelList"
|
||||||
:key="item.path"
|
:key="item.path"
|
||||||
class="!inline !items-stretch"
|
class="inline! items-stretch!"
|
||||||
>
|
>
|
||||||
<a @click.prevent="handleLink(item)">
|
<a @click.prevent="handleLink(item)">
|
||||||
{{ item.meta.title }}
|
{{ transformI18n(item.meta.title) }}
|
||||||
</a>
|
</a>
|
||||||
</el-breadcrumb-item>
|
</el-breadcrumb-item>
|
||||||
</transition-group>
|
</transition-group>
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { computed } from "vue";
|
||||||
|
import { useI18n } from "vue-i18n";
|
||||||
|
import { useGlobal } from "@pureadmin/utils";
|
||||||
|
import { useNav } from "@/layout/hooks/useNav";
|
||||||
|
|
||||||
|
import ArrowLeft from "~icons/ri/arrow-left-double-fill";
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
isActive?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
withDefaults(defineProps<Props>(), {
|
||||||
|
isActive: false
|
||||||
|
});
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
|
const { tooltipEffect } = useNav();
|
||||||
|
|
||||||
|
const iconClass = computed(() => {
|
||||||
|
return ["w-[16px]", "h-[16px]"];
|
||||||
|
});
|
||||||
|
|
||||||
|
const { $storage } = useGlobal<GlobalPropertiesApi>();
|
||||||
|
const themeColor = computed(() => $storage.layout?.themeColor);
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: "toggleClick"): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const toggleClick = () => {
|
||||||
|
emit("toggleClick");
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div
|
||||||
|
v-tippy="{
|
||||||
|
content: isActive
|
||||||
|
? t('buttons.pureClickCollapse')
|
||||||
|
: t('buttons.pureClickExpand'),
|
||||||
|
theme: tooltipEffect,
|
||||||
|
hideOnClick: 'toggle',
|
||||||
|
placement: 'right'
|
||||||
|
}"
|
||||||
|
class="center-collapse"
|
||||||
|
@click="toggleClick"
|
||||||
|
>
|
||||||
|
<IconifyIconOffline
|
||||||
|
:icon="ArrowLeft"
|
||||||
|
:class="[iconClass, themeColor === 'light' ? '' : 'text-primary']"
|
||||||
|
:style="{ transform: isActive ? 'none' : 'rotateY(180deg)' }"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.center-collapse {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
right: 2px;
|
||||||
|
z-index: 1002;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 24px;
|
||||||
|
height: 34px;
|
||||||
|
cursor: pointer;
|
||||||
|
background: var(--el-bg-color);
|
||||||
|
border: 1px solid var(--pure-border-color);
|
||||||
|
border-radius: 4px;
|
||||||
|
transform: translate(12px, -50%);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
import { toRaw } from "vue";
|
import { toRaw } from "vue";
|
||||||
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
|
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
|
||||||
|
|
||||||
const props = defineProps({
|
defineProps({
|
||||||
extraIcon: {
|
extraIcon: {
|
||||||
type: String,
|
type: String,
|
||||||
default: ""
|
default: ""
|
||||||
@@ -11,9 +11,9 @@ const props = defineProps({
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div v-if="props.extraIcon" class="flex justify-center items-center">
|
<div v-if="extraIcon" class="flex justify-center items-center">
|
||||||
<component
|
<component
|
||||||
:is="useRenderIcon(toRaw(props.extraIcon))"
|
:is="useRenderIcon(toRaw(extraIcon))"
|
||||||
class="w-[30px] h-[30px]"
|
class="w-[30px] h-[30px]"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, watch } from "vue";
|
||||||
|
import { useNav } from "@/layout/hooks/useNav";
|
||||||
|
|
||||||
|
const screenIcon = ref();
|
||||||
|
const { toggle, isFullscreen, Fullscreen, ExitFullscreen } = useNav();
|
||||||
|
|
||||||
|
isFullscreen.value = !!(
|
||||||
|
document.fullscreenElement ||
|
||||||
|
document.webkitFullscreenElement ||
|
||||||
|
document.mozFullScreenElement ||
|
||||||
|
document.msFullscreenElement
|
||||||
|
);
|
||||||
|
|
||||||
|
watch(
|
||||||
|
isFullscreen,
|
||||||
|
full => {
|
||||||
|
screenIcon.value = full ? ExitFullscreen : Fullscreen;
|
||||||
|
},
|
||||||
|
{
|
||||||
|
immediate: true
|
||||||
|
}
|
||||||
|
);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<span class="fullscreen-icon navbar-bg-hover" @click="toggle">
|
||||||
|
<IconifyIconOffline :icon="screenIcon" />
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
@@ -1,11 +1,12 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import path from "path";
|
|
||||||
import { getConfig } from "@/config";
|
import { getConfig } from "@/config";
|
||||||
import LinkItem from "./linkItem.vue";
|
import { posix } from "path-browserify";
|
||||||
import { menuType } from "../../types";
|
import { menuType } from "@/layout/types";
|
||||||
import extraIcon from "./extraIcon.vue";
|
|
||||||
import { ReText } from "@/components/ReText";
|
import { ReText } from "@/components/ReText";
|
||||||
import { useNav } from "@/layout/hooks/useNav";
|
import { useNav } from "@/layout/hooks/useNav";
|
||||||
|
import { transformI18n } from "@/plugins/i18n";
|
||||||
|
import SidebarLinkItem from "./SidebarLinkItem.vue";
|
||||||
|
import SidebarExtraIcon from "./SidebarExtraIcon.vue";
|
||||||
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
|
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
|
||||||
import {
|
import {
|
||||||
type PropType,
|
type PropType,
|
||||||
@@ -16,10 +17,10 @@ import {
|
|||||||
useAttrs
|
useAttrs
|
||||||
} from "vue";
|
} from "vue";
|
||||||
|
|
||||||
import ArrowUp from "@iconify-icons/ep/arrow-up-bold";
|
import ArrowUp from "~icons/ep/arrow-up-bold";
|
||||||
import EpArrowDown from "@iconify-icons/ep/arrow-down-bold";
|
import EpArrowDown from "~icons/ep/arrow-down-bold";
|
||||||
import ArrowLeft from "@iconify-icons/ep/arrow-left-bold";
|
import ArrowLeft from "~icons/ep/arrow-left-bold";
|
||||||
import ArrowRight from "@iconify-icons/ep/arrow-right-bold";
|
import ArrowRight from "~icons/ep/arrow-right-bold";
|
||||||
|
|
||||||
const attrs = useAttrs();
|
const attrs = useAttrs();
|
||||||
const { layout, isCollapse, tooltipEffect, getDivStyle } = useNav();
|
const { layout, isCollapse, tooltipEffect, getDivStyle } = useNav();
|
||||||
@@ -60,6 +61,21 @@ const getSubMenuIconStyle = computed((): CSSProperties => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const textClass = computed(() => {
|
||||||
|
const item = props.item;
|
||||||
|
const baseClass = "w-full! text-inherit!";
|
||||||
|
if (
|
||||||
|
layout.value !== "horizontal" &&
|
||||||
|
isCollapse.value &&
|
||||||
|
!toRaw(item.meta.icon) &&
|
||||||
|
((layout.value === "vertical" && item.parentId === null) ||
|
||||||
|
(layout.value === "mix" && item.pathList.length === 2))
|
||||||
|
) {
|
||||||
|
return `${baseClass} min-w-[54px]! text-center! px-3!`;
|
||||||
|
}
|
||||||
|
return baseClass;
|
||||||
|
});
|
||||||
|
|
||||||
const expandCloseIcon = computed(() => {
|
const expandCloseIcon = computed(() => {
|
||||||
if (!getConfig()?.MenuArrowIconNoTransition) return "";
|
if (!getConfig()?.MenuArrowIconNoTransition) return "";
|
||||||
return {
|
return {
|
||||||
@@ -98,16 +114,15 @@ function resolvePath(routePath) {
|
|||||||
if (httpReg.test(routePath) || httpReg.test(props.basePath)) {
|
if (httpReg.test(routePath) || httpReg.test(props.basePath)) {
|
||||||
return routePath || props.basePath;
|
return routePath || props.basePath;
|
||||||
} else {
|
} else {
|
||||||
// 使用path.posix.resolve替代path.resolve 避免windows环境下使用electron出现盘符问题
|
return posix.resolve(props.basePath, routePath);
|
||||||
return path.posix.resolve(props.basePath, routePath);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<link-item
|
<SidebarLinkItem
|
||||||
v-if="
|
v-if="
|
||||||
hasOneShowingChild(props.item.children, props.item) &&
|
hasOneShowingChild(item.children, item) &&
|
||||||
(!onlyOneChild.children || onlyOneChild.noShowingChildren)
|
(!onlyOneChild.children || onlyOneChild.noShowingChildren)
|
||||||
"
|
"
|
||||||
:to="item"
|
:to="item"
|
||||||
@@ -119,7 +134,7 @@ function resolvePath(routePath) {
|
|||||||
v-bind="attrs"
|
v-bind="attrs"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
v-if="toRaw(props.item.meta.icon)"
|
v-if="toRaw(item.meta.icon)"
|
||||||
class="sub-menu-icon"
|
class="sub-menu-icon"
|
||||||
:style="getSubMenuIconStyle"
|
:style="getSubMenuIconStyle"
|
||||||
>
|
>
|
||||||
@@ -127,26 +142,26 @@ function resolvePath(routePath) {
|
|||||||
:is="
|
:is="
|
||||||
useRenderIcon(
|
useRenderIcon(
|
||||||
toRaw(onlyOneChild.meta.icon) ||
|
toRaw(onlyOneChild.meta.icon) ||
|
||||||
(props.item.meta && toRaw(props.item.meta.icon))
|
(item.meta && toRaw(item.meta.icon))
|
||||||
)
|
)
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<el-text
|
<el-text
|
||||||
v-if="
|
v-if="
|
||||||
(!props.item?.meta.icon &&
|
(!item?.meta.icon &&
|
||||||
isCollapse &&
|
isCollapse &&
|
||||||
layout === 'vertical' &&
|
layout === 'vertical' &&
|
||||||
props.item?.pathList?.length === 1) ||
|
item?.pathList?.length === 1) ||
|
||||||
(!onlyOneChild.meta.icon &&
|
(!onlyOneChild.meta.icon &&
|
||||||
isCollapse &&
|
isCollapse &&
|
||||||
layout === 'mix' &&
|
layout === 'mix' &&
|
||||||
props.item?.pathList?.length === 2)
|
item?.pathList?.length === 2)
|
||||||
"
|
"
|
||||||
truncated
|
truncated
|
||||||
class="!px-4 !text-inherit"
|
class="w-full! px-3! min-w-[54px]! text-center! text-inherit!"
|
||||||
>
|
>
|
||||||
{{ onlyOneChild.meta.title }}
|
{{ transformI18n(onlyOneChild.meta.title) }}
|
||||||
</el-text>
|
</el-text>
|
||||||
|
|
||||||
<template #title>
|
<template #title>
|
||||||
@@ -156,61 +171,54 @@ function resolvePath(routePath) {
|
|||||||
offset: [0, -10],
|
offset: [0, -10],
|
||||||
theme: tooltipEffect
|
theme: tooltipEffect
|
||||||
}"
|
}"
|
||||||
class="!text-inherit"
|
class="w-full! text-inherit!"
|
||||||
>
|
>
|
||||||
{{ onlyOneChild.meta.title }}
|
{{ transformI18n(onlyOneChild.meta.title) }}
|
||||||
</ReText>
|
</ReText>
|
||||||
<extraIcon :extraIcon="onlyOneChild.meta.extraIcon" />
|
<SidebarExtraIcon :extraIcon="onlyOneChild.meta.extraIcon" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
</link-item>
|
</SidebarLinkItem>
|
||||||
<el-sub-menu
|
<el-sub-menu
|
||||||
v-else
|
v-else
|
||||||
ref="subMenu"
|
ref="subMenu"
|
||||||
teleported
|
teleported
|
||||||
:index="resolvePath(props.item.path)"
|
:index="resolvePath(item.path)"
|
||||||
v-bind="expandCloseIcon"
|
v-bind="expandCloseIcon"
|
||||||
>
|
>
|
||||||
<template #title>
|
<template #title>
|
||||||
<div
|
<div
|
||||||
v-if="toRaw(props.item.meta.icon)"
|
v-if="toRaw(item.meta.icon)"
|
||||||
:style="getSubMenuIconStyle"
|
:style="getSubMenuIconStyle"
|
||||||
class="sub-menu-icon"
|
class="sub-menu-icon"
|
||||||
>
|
>
|
||||||
<component
|
<component :is="useRenderIcon(item.meta && toRaw(item.meta.icon))" />
|
||||||
:is="useRenderIcon(props.item.meta && toRaw(props.item.meta.icon))"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
<ReText
|
<ReText
|
||||||
v-if="
|
v-if="
|
||||||
!(
|
layout === 'mix' && toRaw(item.meta.icon)
|
||||||
layout === 'vertical' &&
|
? !isCollapse || item?.pathList?.length !== 2
|
||||||
isCollapse &&
|
: !(
|
||||||
toRaw(props.item.meta.icon) &&
|
layout === 'vertical' &&
|
||||||
props.item.parentId === null
|
isCollapse &&
|
||||||
)
|
toRaw(item.meta.icon) &&
|
||||||
|
item.parentId === null
|
||||||
|
)
|
||||||
"
|
"
|
||||||
:tippyProps="{
|
:tippyProps="{
|
||||||
offset: [0, -10],
|
offset: [0, -10],
|
||||||
theme: tooltipEffect
|
theme: tooltipEffect
|
||||||
}"
|
}"
|
||||||
:class="{
|
:class="textClass"
|
||||||
'!text-inherit': true,
|
|
||||||
'!px-4':
|
|
||||||
layout !== 'horizontal' &&
|
|
||||||
isCollapse &&
|
|
||||||
!toRaw(props.item.meta.icon) &&
|
|
||||||
props.item.parentId === null
|
|
||||||
}"
|
|
||||||
>
|
>
|
||||||
{{ props.item.meta.title }}
|
{{ transformI18n(item.meta.title) }}
|
||||||
</ReText>
|
</ReText>
|
||||||
<extraIcon v-if="!isCollapse" :extraIcon="props.item.meta.extraIcon" />
|
<SidebarExtraIcon v-if="!isCollapse" :extraIcon="item.meta.extraIcon" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<sidebar-item
|
<sidebar-item
|
||||||
v-for="child in props.item.children"
|
v-for="child in item.children"
|
||||||
:key="child.path"
|
:key="child.path"
|
||||||
:is-nest="true"
|
:is-nest="true"
|
||||||
:item="child"
|
:item="child"
|
||||||
@@ -1,18 +1,20 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed } from "vue";
|
import { computed } from "vue";
|
||||||
|
import { useI18n } from "vue-i18n";
|
||||||
import { useGlobal } from "@pureadmin/utils";
|
import { useGlobal } from "@pureadmin/utils";
|
||||||
import { useNav } from "@/layout/hooks/useNav";
|
import { useNav } from "@/layout/hooks/useNav";
|
||||||
|
|
||||||
import MenuFold from "@iconify-icons/ri/menu-fold-fill";
|
import MenuFold from "~icons/ri/menu-fold-fill";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
isActive: boolean;
|
isActive?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = withDefaults(defineProps<Props>(), {
|
withDefaults(defineProps<Props>(), {
|
||||||
isActive: false
|
isActive: false
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
const { tooltipEffect } = useNav();
|
const { tooltipEffect } = useNav();
|
||||||
|
|
||||||
const iconClass = computed(() => {
|
const iconClass = computed(() => {
|
||||||
@@ -21,7 +23,7 @@ const iconClass = computed(() => {
|
|||||||
"mb-1",
|
"mb-1",
|
||||||
"w-[16px]",
|
"w-[16px]",
|
||||||
"h-[16px]",
|
"h-[16px]",
|
||||||
"inline-block",
|
"inline-block!",
|
||||||
"align-middle",
|
"align-middle",
|
||||||
"cursor-pointer",
|
"cursor-pointer",
|
||||||
"duration-[100ms]"
|
"duration-[100ms]"
|
||||||
@@ -41,24 +43,26 @@ const toggleClick = () => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="collapse-container">
|
<div class="left-collapse">
|
||||||
<IconifyIconOffline
|
<IconifyIconOffline
|
||||||
v-tippy="{
|
v-tippy="{
|
||||||
content: props.isActive ? '点击折叠' : '点击展开',
|
content: isActive
|
||||||
|
? t('buttons.pureClickCollapse')
|
||||||
|
: t('buttons.pureClickExpand'),
|
||||||
theme: tooltipEffect,
|
theme: tooltipEffect,
|
||||||
hideOnClick: 'toggle',
|
hideOnClick: 'toggle',
|
||||||
placement: 'right'
|
placement: 'right'
|
||||||
}"
|
}"
|
||||||
:icon="MenuFold"
|
:icon="MenuFold"
|
||||||
:class="[iconClass, themeColor === 'light' ? '' : 'text-primary']"
|
:class="[iconClass, themeColor === 'light' ? '' : 'text-primary']"
|
||||||
:style="{ transform: props.isActive ? 'none' : 'rotateY(180deg)' }"
|
:style="{ transform: isActive ? 'none' : 'rotateY(180deg)' }"
|
||||||
@click="toggleClick"
|
@click="toggleClick"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.collapse-container {
|
.left-collapse {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -3,10 +3,6 @@ import { computed } from "vue";
|
|||||||
import { isUrl } from "@pureadmin/utils";
|
import { isUrl } from "@pureadmin/utils";
|
||||||
import { menuType } from "@/layout/types";
|
import { menuType } from "@/layout/types";
|
||||||
|
|
||||||
defineOptions({
|
|
||||||
name: "LinkItem"
|
|
||||||
});
|
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
to: menuType;
|
to: menuType;
|
||||||
}>();
|
}>();
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
import { getTopMenu } from "@/router/utils";
|
import { getTopMenu } from "@/router/utils";
|
||||||
import { useNav } from "@/layout/hooks/useNav";
|
import { useNav } from "@/layout/hooks/useNav";
|
||||||
|
|
||||||
const props = defineProps({
|
defineProps({
|
||||||
collapse: Boolean
|
collapse: Boolean
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -10,11 +10,11 @@ const { title, getLogo } = useNav();
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="sidebar-logo-container" :class="{ collapses: props.collapse }">
|
<div class="sidebar-logo-container" :class="{ collapses: collapse }">
|
||||||
<transition name="sidebarLogoFade">
|
<transition name="sidebarLogoFade">
|
||||||
<router-link
|
<router-link
|
||||||
v-if="props.collapse"
|
v-if="collapse"
|
||||||
key="props.collapse"
|
key="collapse"
|
||||||
:title="title"
|
:title="title"
|
||||||
class="sidebar-logo-link"
|
class="sidebar-logo-link"
|
||||||
:to="getTopMenu()?.path ?? '/'"
|
:to="getTopMenu()?.path ?? '/'"
|
||||||
@@ -60,11 +60,11 @@ const { title, getLogo } = useNav();
|
|||||||
height: 32px;
|
height: 32px;
|
||||||
margin: 2px 0 0 12px;
|
margin: 2px 0 0 12px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
line-height: 32px;
|
line-height: 32px;
|
||||||
color: $subMenuActiveText;
|
color: var(--pure-theme-sub-menu-active-text);
|
||||||
text-overflow: ellipsis;
|
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { useI18n } from "vue-i18n";
|
||||||
|
import MenuFold from "~icons/ri/menu-fold-fill";
|
||||||
|
import MenuUnfold from "~icons/ri/menu-unfold-fill";
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
isActive?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
withDefaults(defineProps<Props>(), {
|
||||||
|
isActive: false
|
||||||
|
});
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: "toggleClick"): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const toggleClick = () => {
|
||||||
|
emit("toggleClick");
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div
|
||||||
|
class="px-3 mr-1 navbar-bg-hover"
|
||||||
|
:title="
|
||||||
|
isActive ? t('buttons.pureClickCollapse') : t('buttons.pureClickExpand')
|
||||||
|
"
|
||||||
|
@click="toggleClick"
|
||||||
|
>
|
||||||
|
<IconifyIconOffline
|
||||||
|
:icon="isActive ? MenuFold : MenuUnfold"
|
||||||
|
class="inline-block! align-middle hover:text-primary dark:hover:text-white!"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
33
src/layout/components/lay-tag/components/TagChrome.vue
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
<template>
|
||||||
|
<svg class="w-full h-full">
|
||||||
|
<defs>
|
||||||
|
<symbol id="geometry-left" viewBox="0 0 214 36">
|
||||||
|
<path d="M17 0h197v36H0v-2c4.5 0 9-3.5 9-8V8c0-4.5 3.5-8 8-8z" />
|
||||||
|
</symbol>
|
||||||
|
<symbol id="geometry-right" viewBox="0 0 214 36">
|
||||||
|
<use xlink:href="#geometry-left" />
|
||||||
|
</symbol>
|
||||||
|
<clipPath>
|
||||||
|
<rect width="100%" height="100%" x="0" />
|
||||||
|
</clipPath>
|
||||||
|
</defs>
|
||||||
|
<svg width="51%" height="100%">
|
||||||
|
<use
|
||||||
|
xlink:href="#geometry-left"
|
||||||
|
width="214"
|
||||||
|
height="36"
|
||||||
|
fill="currentColor"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
<g transform="scale(-1, 1)">
|
||||||
|
<svg width="51%" height="100%" x="-100%" y="0">
|
||||||
|
<use
|
||||||
|
xlink:href="#geometry-right"
|
||||||
|
width="214"
|
||||||
|
height="36"
|
||||||
|
fill="currentColor"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
</template>
|
||||||
@@ -41,6 +41,13 @@
|
|||||||
padding-right: 24px;
|
padding-right: 24px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.chrome-item {
|
||||||
|
padding-right: 0;
|
||||||
|
padding-left: 0;
|
||||||
|
margin-right: -18px;
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
|
||||||
.el-icon-close {
|
.el-icon-close {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
@@ -52,10 +59,10 @@
|
|||||||
color: var(--el-color-primary);
|
color: var(--el-color-primary);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
|
transform: translate(0, -50%);
|
||||||
transition:
|
transition:
|
||||||
background-color 0.12s,
|
background-color 0.12s,
|
||||||
color 0.12s;
|
color 0.12s;
|
||||||
transform: translate(0, -50%);
|
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
color: rgb(0 0 0 / 88%) !important;
|
color: rgb(0 0 0 / 88%) !important;
|
||||||
@@ -76,6 +83,14 @@
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
|
||||||
|
&.chrome-scroll-container {
|
||||||
|
padding-top: 4px;
|
||||||
|
|
||||||
|
.fixed-tag {
|
||||||
|
padding: 0 !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.tab {
|
.tab {
|
||||||
position: relative;
|
position: relative;
|
||||||
float: left;
|
float: left;
|
||||||
@@ -89,6 +104,16 @@
|
|||||||
&:nth-child(1) {
|
&:nth-child(1) {
|
||||||
padding: 0 12px;
|
padding: 0 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.chrome-item {
|
||||||
|
&:nth-child(1) {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.fixed-tag {
|
||||||
|
padding: 0 12px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -102,10 +127,10 @@
|
|||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
color: var(--el-text-color-primary);
|
color: var(--el-text-color-primary);
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
outline: 0;
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
outline: 0;
|
|
||||||
box-shadow: 0 2px 8px rgb(0 0 0 / 15%);
|
box-shadow: 0 2px 8px rgb(0 0 0 / 15%);
|
||||||
|
|
||||||
li {
|
li {
|
||||||
@@ -169,9 +194,29 @@
|
|||||||
color: #fff;
|
color: #fff;
|
||||||
box-shadow: 0 0 0.7px #888;
|
box-shadow: 0 0 0.7px #888;
|
||||||
|
|
||||||
|
.chrome-tab {
|
||||||
|
z-index: 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrome-tab__bg {
|
||||||
|
color: var(--el-color-primary-light-9) !important;
|
||||||
|
}
|
||||||
|
|
||||||
.tag-title {
|
.tag-title {
|
||||||
color: var(--el-color-primary) !important;
|
color: var(--el-color-primary) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.chrome-close-btn {
|
||||||
|
color: var(--el-color-primary);
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: var(--el-color-primary);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrome-tab-divider {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.arrow-left,
|
.arrow-left,
|
||||||
@@ -258,3 +303,69 @@
|
|||||||
background: var(--el-color-primary);
|
background: var(--el-color-primary);
|
||||||
animation: schedule-out-width 200ms ease-in;
|
animation: schedule-out-width 200ms ease-in;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 谷歌风格的页签 */
|
||||||
|
.chrome-tab {
|
||||||
|
position: relative;
|
||||||
|
display: inline-flex;
|
||||||
|
gap: 16px;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 0 24px;
|
||||||
|
white-space: nowrap;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
.tag-title {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrome-tab-divider {
|
||||||
|
position: absolute;
|
||||||
|
right: 7px;
|
||||||
|
width: 1px;
|
||||||
|
height: 14px;
|
||||||
|
background-color: #2b2d2f;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
z-index: 10;
|
||||||
|
|
||||||
|
.chrome-tab__bg {
|
||||||
|
color: #dee1e6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag-title {
|
||||||
|
color: #1f1f1f;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrome-tab-divider {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrome-tab__bg {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: -10;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
color: transparent;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrome-close-btn {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
color: #666;
|
||||||
|
border-radius: 50%;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
color: white;
|
||||||
|
background-color: #b1b3b8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,12 +1,16 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { $t } from "@/plugins/i18n";
|
||||||
import { emitter } from "@/utils/mitt";
|
import { emitter } from "@/utils/mitt";
|
||||||
|
import NProgress from "@/utils/progress";
|
||||||
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 { useFullscreen, onClickOutside } from "@vueuse/core";
|
import { onClickOutside } from "@vueuse/core";
|
||||||
|
import TagChrome from "./components/TagChrome.vue";
|
||||||
import { handleAliveRoute, getTopMenu } from "@/router/utils";
|
import { handleAliveRoute, getTopMenu } from "@/router/utils";
|
||||||
import { useSettingStoreHook } from "@/store/modules/settings";
|
import { useSettingStoreHook } from "@/store/modules/settings";
|
||||||
import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
|
import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
|
||||||
|
import { usePermissionStoreHook } from "@/store/modules/permission";
|
||||||
import { ref, watch, unref, toRaw, nextTick, onBeforeUnmount } from "vue";
|
import { ref, watch, unref, toRaw, nextTick, onBeforeUnmount } from "vue";
|
||||||
import {
|
import {
|
||||||
delay,
|
delay,
|
||||||
@@ -15,11 +19,11 @@ import {
|
|||||||
useResizeObserver
|
useResizeObserver
|
||||||
} from "@pureadmin/utils";
|
} from "@pureadmin/utils";
|
||||||
|
|
||||||
import ExitFullscreen from "@iconify-icons/ri/fullscreen-exit-fill";
|
import ExitFullscreen from "~icons/ri/fullscreen-exit-fill";
|
||||||
import Fullscreen from "@iconify-icons/ri/fullscreen-fill";
|
import Fullscreen from "~icons/ri/fullscreen-fill";
|
||||||
import ArrowDown from "@iconify-icons/ri/arrow-down-s-line";
|
import ArrowDown from "~icons/ri/arrow-down-s-line";
|
||||||
import ArrowRightSLine from "@iconify-icons/ri/arrow-right-s-line";
|
import ArrowRightSLine from "~icons/ri/arrow-right-s-line";
|
||||||
import ArrowLeftSLine from "@iconify-icons/ri/arrow-left-s-line";
|
import ArrowLeftSLine from "~icons/ri/arrow-left-s-line";
|
||||||
|
|
||||||
const {
|
const {
|
||||||
Close,
|
Close,
|
||||||
@@ -34,6 +38,7 @@ const {
|
|||||||
buttonLeft,
|
buttonLeft,
|
||||||
showModel,
|
showModel,
|
||||||
translateX,
|
translateX,
|
||||||
|
isFixedTag,
|
||||||
pureSetting,
|
pureSetting,
|
||||||
activeIndex,
|
activeIndex,
|
||||||
getTabStyle,
|
getTabStyle,
|
||||||
@@ -47,6 +52,7 @@ const {
|
|||||||
onMounted,
|
onMounted,
|
||||||
onMouseenter,
|
onMouseenter,
|
||||||
onMouseleave,
|
onMouseleave,
|
||||||
|
transformI18n,
|
||||||
onContentFullScreen
|
onContentFullScreen
|
||||||
} = useTags();
|
} = useTags();
|
||||||
|
|
||||||
@@ -57,7 +63,10 @@ const contextmenuRef = ref();
|
|||||||
const isShowArrow = ref(false);
|
const isShowArrow = ref(false);
|
||||||
const topPath = getTopMenu()?.path;
|
const topPath = getTopMenu()?.path;
|
||||||
const { VITE_HIDE_HOME } = import.meta.env;
|
const { VITE_HIDE_HOME } = import.meta.env;
|
||||||
const { isFullscreen, toggle } = useFullscreen();
|
const fixedTags = [
|
||||||
|
...routerArrays,
|
||||||
|
...usePermissionStoreHook().flatteningRoutes.filter(v => v?.meta?.fixedTag)
|
||||||
|
];
|
||||||
|
|
||||||
const dynamicTagView = async () => {
|
const dynamicTagView = async () => {
|
||||||
await nextTick();
|
await nextTick();
|
||||||
@@ -198,12 +207,14 @@ function dynamicRouteTag(value: string): void {
|
|||||||
|
|
||||||
/** 刷新路由 */
|
/** 刷新路由 */
|
||||||
function onFresh() {
|
function onFresh() {
|
||||||
|
NProgress.start();
|
||||||
const { fullPath, query } = unref(route);
|
const { fullPath, query } = unref(route);
|
||||||
router.replace({
|
router.replace({
|
||||||
path: "/redirect" + fullPath,
|
path: "/redirect" + fullPath,
|
||||||
query
|
query
|
||||||
});
|
});
|
||||||
handleAliveRoute(route as ToRouteType, "refresh");
|
handleAliveRoute(route as ToRouteType, "refresh");
|
||||||
|
NProgress.done();
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteDynamicTag(obj: any, current: any, tag?: string) {
|
function deleteDynamicTag(obj: any, current: any, tag?: string) {
|
||||||
@@ -227,10 +238,13 @@ function deleteDynamicTag(obj: any, current: any, tag?: string) {
|
|||||||
other?: boolean
|
other?: boolean
|
||||||
): void => {
|
): void => {
|
||||||
if (other) {
|
if (other) {
|
||||||
useMultiTagsStoreHook().handleTags("equal", [
|
useMultiTagsStoreHook().handleTags(
|
||||||
VITE_HIDE_HOME === "false" ? routerArrays[0] : toRaw(getTopMenu()),
|
"equal",
|
||||||
obj
|
[
|
||||||
]);
|
VITE_HIDE_HOME === "false" ? fixedTags : toRaw(getTopMenu()),
|
||||||
|
obj
|
||||||
|
].flat()
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
useMultiTagsStoreHook().handleTags("splice", "", {
|
useMultiTagsStoreHook().handleTags("splice", "", {
|
||||||
startIndex,
|
startIndex,
|
||||||
@@ -243,7 +257,7 @@ function deleteDynamicTag(obj: any, current: any, tag?: string) {
|
|||||||
if (tag === "other") {
|
if (tag === "other") {
|
||||||
spliceRoute(1, 1, true);
|
spliceRoute(1, 1, true);
|
||||||
} else if (tag === "left") {
|
} else if (tag === "left") {
|
||||||
spliceRoute(1, valueIndex - 1);
|
spliceRoute(fixedTags.length, valueIndex - fixedTags.length);
|
||||||
} else if (tag === "right") {
|
} else if (tag === "right") {
|
||||||
spliceRoute(valueIndex + 1, multiTags.value.length);
|
spliceRoute(valueIndex + 1, multiTags.value.length);
|
||||||
} else {
|
} else {
|
||||||
@@ -320,41 +334,29 @@ function onClickDrop(key, item, selectRoute?: RouteConfigs) {
|
|||||||
case 5:
|
case 5:
|
||||||
// 关闭全部标签页
|
// 关闭全部标签页
|
||||||
useMultiTagsStoreHook().handleTags("splice", "", {
|
useMultiTagsStoreHook().handleTags("splice", "", {
|
||||||
startIndex: 1,
|
startIndex: fixedTags.length,
|
||||||
length: multiTags.value.length
|
length: multiTags.value.length
|
||||||
});
|
});
|
||||||
router.push(topPath);
|
router.push(topPath);
|
||||||
|
// router.push(fixedTags[fixedTags.length - 1]?.path);
|
||||||
handleAliveRoute(route as ToRouteType);
|
handleAliveRoute(route as ToRouteType);
|
||||||
break;
|
break;
|
||||||
case 6:
|
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();
|
onContentFullScreen();
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (pureSetting.hiddenSideBar) {
|
if (pureSetting.hiddenSideBar) {
|
||||||
tagsViews[7].icon = ExitFullscreen;
|
tagsViews[6].icon = ExitFullscreen;
|
||||||
tagsViews[7].text = "内容区退出全屏";
|
tagsViews[6].text = $t("buttons.pureContentExitFullScreen");
|
||||||
} else {
|
} else {
|
||||||
tagsViews[7].icon = Fullscreen;
|
tagsViews[6].icon = Fullscreen;
|
||||||
tagsViews[7].text = "内容区全屏";
|
tagsViews[6].text = $t("buttons.pureContentFullScreen");
|
||||||
}
|
}
|
||||||
}, 100);
|
}, 100);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
showMenuModel(route.fullPath, route.query);
|
showMenuModel(route.fullPath, route.query, route.params);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -375,25 +377,39 @@ function showMenus(value: boolean) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function disabledMenus(value: boolean) {
|
function disabledMenus(value: boolean, fixedTag = false) {
|
||||||
Array.of(1, 2, 3, 4, 5).forEach(v => {
|
Array.of(1, 2, 3, 4, 5).forEach(v => {
|
||||||
tagsViews[v].disabled = value;
|
tagsViews[v].disabled = value;
|
||||||
});
|
});
|
||||||
|
if (fixedTag) {
|
||||||
|
tagsViews[2].show = false;
|
||||||
|
tagsViews[2].disabled = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 检查当前右键的菜单两边是否存在别的菜单,如果左侧的菜单是顶级菜单,则不显示关闭左侧标签页,如果右侧没有菜单,则不显示关闭右侧标签页 */
|
/** 检查当前右键的菜单两边是否存在别的菜单,如果左侧的菜单是顶级菜单,则不显示关闭左侧标签页,如果右侧没有菜单,则不显示关闭右侧标签页 */
|
||||||
function showMenuModel(
|
function showMenuModel(
|
||||||
currentPath: string,
|
currentPath: string,
|
||||||
query: object = {},
|
query: object = {},
|
||||||
|
params: object = {},
|
||||||
refresh = false
|
refresh = false
|
||||||
) {
|
) {
|
||||||
const allRoute = multiTags.value;
|
const allRoute = multiTags.value;
|
||||||
const routeLength = multiTags.value.length;
|
const routeLength = multiTags.value.length;
|
||||||
let currentIndex = -1;
|
let currentIndex = -1;
|
||||||
if (isAllEmpty(query)) {
|
if (!isAllEmpty(params)) {
|
||||||
currentIndex = allRoute.findIndex(v => v.path === currentPath);
|
currentIndex = allRoute.findIndex(v => isEqual(v.params, params));
|
||||||
} else {
|
} else if (!isAllEmpty(query)) {
|
||||||
currentIndex = allRoute.findIndex(v => isEqual(v.query, query));
|
currentIndex = allRoute.findIndex(v => isEqual(v.query, query));
|
||||||
|
} else {
|
||||||
|
currentIndex = allRoute.findIndex(v => v.path === currentPath);
|
||||||
|
}
|
||||||
|
function fixedTagDisabled() {
|
||||||
|
if (allRoute[currentIndex]?.meta?.fixedTag) {
|
||||||
|
Array.of(1, 2, 3, 4, 5).forEach(v => {
|
||||||
|
tagsViews[v].disabled = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
showMenus(true);
|
showMenus(true);
|
||||||
@@ -413,6 +429,7 @@ function showMenuModel(
|
|||||||
tagsViews[v].disabled = false;
|
tagsViews[v].disabled = false;
|
||||||
});
|
});
|
||||||
tagsViews[2].disabled = true;
|
tagsViews[2].disabled = true;
|
||||||
|
fixedTagDisabled();
|
||||||
} else if (currentIndex === 1 && routeLength === 2) {
|
} else if (currentIndex === 1 && routeLength === 2) {
|
||||||
disabledMenus(false);
|
disabledMenus(false);
|
||||||
// 左侧的菜单是顶级菜单,右侧不存在别的菜单
|
// 左侧的菜单是顶级菜单,右侧不存在别的菜单
|
||||||
@@ -420,6 +437,7 @@ function showMenuModel(
|
|||||||
tagsViews[v].show = false;
|
tagsViews[v].show = false;
|
||||||
tagsViews[v].disabled = true;
|
tagsViews[v].disabled = true;
|
||||||
});
|
});
|
||||||
|
fixedTagDisabled();
|
||||||
} else if (routeLength - 1 === currentIndex && currentIndex !== 0) {
|
} else if (routeLength - 1 === currentIndex && currentIndex !== 0) {
|
||||||
// 当前路由是所有路由中的最后一个
|
// 当前路由是所有路由中的最后一个
|
||||||
tagsViews[3].show = false;
|
tagsViews[3].show = false;
|
||||||
@@ -427,35 +445,37 @@ function showMenuModel(
|
|||||||
tagsViews[v].disabled = false;
|
tagsViews[v].disabled = false;
|
||||||
});
|
});
|
||||||
tagsViews[3].disabled = true;
|
tagsViews[3].disabled = true;
|
||||||
|
if (allRoute[currentIndex - 1]?.meta?.fixedTag) {
|
||||||
|
tagsViews[2].show = false;
|
||||||
|
tagsViews[2].disabled = true;
|
||||||
|
}
|
||||||
|
fixedTagDisabled();
|
||||||
} else if (currentIndex === 0 || currentPath === `/redirect${topPath}`) {
|
} else if (currentIndex === 0 || currentPath === `/redirect${topPath}`) {
|
||||||
// 当前路由为顶级菜单
|
// 当前路由为顶级菜单
|
||||||
disabledMenus(true);
|
disabledMenus(true);
|
||||||
} else {
|
} else {
|
||||||
disabledMenus(false);
|
disabledMenus(false, allRoute[currentIndex - 1]?.meta?.fixedTag);
|
||||||
|
fixedTagDisabled();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function openMenu(tag, e) {
|
function openMenu(tag, e) {
|
||||||
closeMenu();
|
closeMenu();
|
||||||
if (tag.path === topPath) {
|
if (tag.path === topPath || tag?.meta?.fixedTag) {
|
||||||
// 右键菜单为顶级菜单,只显示刷新
|
// 右键菜单为顶级菜单或拥有 fixedTag 属性,只显示刷新
|
||||||
showMenus(false);
|
showMenus(false);
|
||||||
tagsViews[0].show = true;
|
tagsViews[0].show = true;
|
||||||
} else if (route.path !== tag.path && route.name !== tag.name) {
|
} else if (route.path !== tag.path && route.name !== tag.name) {
|
||||||
// 右键菜单不匹配当前路由,隐藏刷新
|
// 右键菜单不匹配当前路由,隐藏刷新
|
||||||
tagsViews[0].show = false;
|
tagsViews[0].show = false;
|
||||||
showMenuModel(tag.path, tag.query);
|
showMenuModel(tag.path, tag.query, tag.params);
|
||||||
} else if (
|
} else if (multiTags.value.length === 2 && route.path !== tag.path) {
|
||||||
// eslint-disable-next-line no-dupe-else-if
|
|
||||||
multiTags.value.length === 2 &&
|
|
||||||
route.path !== tag.path
|
|
||||||
) {
|
|
||||||
showMenus(true);
|
showMenus(true);
|
||||||
// 只有两个标签时不显示关闭其他标签页
|
// 只有两个标签时不显示关闭其他标签页
|
||||||
tagsViews[4].show = false;
|
tagsViews[4].show = false;
|
||||||
} else if (route.path === tag.path) {
|
showMenuModel(tag.path, tag.query, tag.params);
|
||||||
// 右键当前激活的菜单
|
} else {
|
||||||
showMenuModel(tag.path, tag.query, true);
|
showMenuModel(tag.path, tag.query, tag.params, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
currentSelect.value = tag;
|
currentSelect.value = tag;
|
||||||
@@ -497,7 +517,7 @@ function tagOnClick(item) {
|
|||||||
} else {
|
} else {
|
||||||
router.push({ path });
|
router.push({ path });
|
||||||
}
|
}
|
||||||
// showMenuModel(item?.path, item?.query);
|
emitter.emit("tagOnClick", item);
|
||||||
}
|
}
|
||||||
|
|
||||||
onClickOutside(contextmenuRef, closeMenu, {
|
onClickOutside(contextmenuRef, closeMenu, {
|
||||||
@@ -509,11 +529,6 @@ watch(route, () => {
|
|||||||
dynamicTagView();
|
dynamicTagView();
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(isFullscreen, () => {
|
|
||||||
tagsViews[6].icon = Fullscreen;
|
|
||||||
tagsViews[6].text = "全屏";
|
|
||||||
});
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (!instance) return;
|
if (!instance) return;
|
||||||
|
|
||||||
@@ -559,6 +574,7 @@ onBeforeUnmount(() => {
|
|||||||
<div
|
<div
|
||||||
ref="scrollbarDom"
|
ref="scrollbarDom"
|
||||||
class="scroll-container"
|
class="scroll-container"
|
||||||
|
:class="showModel === 'chrome' && 'chrome-scroll-container'"
|
||||||
@wheel.prevent="handleWheel"
|
@wheel.prevent="handleWheel"
|
||||||
>
|
>
|
||||||
<div ref="tabDom" class="tab select-none" :style="getTabStyle">
|
<div ref="tabDom" class="tab select-none" :style="getTabStyle">
|
||||||
@@ -566,32 +582,57 @@ onBeforeUnmount(() => {
|
|||||||
v-for="(item, index) in multiTags"
|
v-for="(item, index) in multiTags"
|
||||||
:ref="'dynamic' + index"
|
:ref="'dynamic' + index"
|
||||||
:key="index"
|
:key="index"
|
||||||
:class="['scroll-item is-closable', linkIsActive(item)]"
|
:class="[
|
||||||
|
'scroll-item is-closable',
|
||||||
|
linkIsActive(item),
|
||||||
|
showModel === 'chrome' && 'chrome-item',
|
||||||
|
isFixedTag(item) && 'fixed-tag'
|
||||||
|
]"
|
||||||
@contextmenu.prevent="openMenu(item, $event)"
|
@contextmenu.prevent="openMenu(item, $event)"
|
||||||
@mouseenter.prevent="onMouseenter(index)"
|
@mouseenter.prevent="onMouseenter(index)"
|
||||||
@mouseleave.prevent="onMouseleave(index)"
|
@mouseleave.prevent="onMouseleave(index)"
|
||||||
@click="tagOnClick(item)"
|
@click="tagOnClick(item)"
|
||||||
>
|
>
|
||||||
<span
|
<template v-if="showModel !== 'chrome'">
|
||||||
class="tag-title dark:!text-text_color_primary dark:hover:!text-primary"
|
<span
|
||||||
>
|
class="tag-title dark:text-text_color_primary! dark:hover:text-primary!"
|
||||||
{{ item.meta.title }}
|
>
|
||||||
</span>
|
{{ transformI18n(item.meta.title) }}
|
||||||
<span
|
</span>
|
||||||
v-if="
|
<span
|
||||||
iconIsActive(item, index) ||
|
v-if="
|
||||||
(index === activeIndex && index !== 0)
|
isFixedTag(item)
|
||||||
"
|
? false
|
||||||
class="el-icon-close"
|
: iconIsActive(item, index) ||
|
||||||
@click.stop="deleteMenu(item)"
|
(index === activeIndex && index !== 0)
|
||||||
>
|
"
|
||||||
<IconifyIconOffline :icon="Close" />
|
class="el-icon-close"
|
||||||
</span>
|
@click.stop="deleteMenu(item)"
|
||||||
<span
|
>
|
||||||
v-if="showModel !== 'card'"
|
<IconifyIconOffline :icon="Close" />
|
||||||
:ref="'schedule' + index"
|
</span>
|
||||||
:class="[scheduleIsActive(item)]"
|
<span
|
||||||
/>
|
v-if="showModel !== 'card'"
|
||||||
|
:ref="'schedule' + index"
|
||||||
|
:class="[scheduleIsActive(item)]"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<div v-else class="chrome-tab">
|
||||||
|
<div class="chrome-tab__bg">
|
||||||
|
<TagChrome />
|
||||||
|
</div>
|
||||||
|
<span class="tag-title">
|
||||||
|
{{ transformI18n(item.meta.title) }}
|
||||||
|
</span>
|
||||||
|
<span
|
||||||
|
v-if="isFixedTag(item) ? false : index !== 0"
|
||||||
|
class="chrome-close-btn"
|
||||||
|
@click.stop="deleteMenu(item)"
|
||||||
|
>
|
||||||
|
<IconifyIconOffline :icon="Close" />
|
||||||
|
</span>
|
||||||
|
<span class="chrome-tab-divider" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -614,7 +655,7 @@ onBeforeUnmount(() => {
|
|||||||
>
|
>
|
||||||
<li v-if="item.show" @click="selectTag(key, item)">
|
<li v-if="item.show" @click="selectTag(key, item)">
|
||||||
<IconifyIconOffline :icon="item.icon" />
|
<IconifyIconOffline :icon="item.icon" />
|
||||||
{{ item.text }}
|
{{ transformI18n(item.text) }}
|
||||||
</li>
|
</li>
|
||||||
</div>
|
</div>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -638,7 +679,7 @@ onBeforeUnmount(() => {
|
|||||||
:disabled="item.disabled"
|
:disabled="item.disabled"
|
||||||
>
|
>
|
||||||
<IconifyIconOffline :icon="item.icon" />
|
<IconifyIconOffline :icon="item.icon" />
|
||||||
{{ item.text }}
|
{{ transformI18n(item.text) }}
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</template>
|
</template>
|
||||||
@@ -1,131 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import Search from "./search/index.vue";
|
|
||||||
import Notice from "./notice/index.vue";
|
|
||||||
import mixNav from "./sidebar/mixNav.vue";
|
|
||||||
import { useNav } from "@/layout/hooks/useNav";
|
|
||||||
import Breadcrumb from "./sidebar/breadCrumb.vue";
|
|
||||||
import topCollapse from "./sidebar/topCollapse.vue";
|
|
||||||
import LogoutCircleRLine from "@iconify-icons/ri/logout-circle-r-line";
|
|
||||||
import Setting from "@iconify-icons/ri/settings-3-line";
|
|
||||||
|
|
||||||
const {
|
|
||||||
layout,
|
|
||||||
device,
|
|
||||||
logout,
|
|
||||||
onPanel,
|
|
||||||
pureApp,
|
|
||||||
username,
|
|
||||||
userAvatar,
|
|
||||||
avatarsStyle,
|
|
||||||
toggleSideBar
|
|
||||||
} = useNav();
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div class="navbar bg-[#fff] shadow-sm shadow-[rgba(0,21,41,0.08)]">
|
|
||||||
<topCollapse
|
|
||||||
v-if="device === 'mobile'"
|
|
||||||
class="hamburger-container"
|
|
||||||
:is-active="pureApp.sidebar.opened"
|
|
||||||
@toggleClick="toggleSideBar"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Breadcrumb
|
|
||||||
v-if="layout !== 'mix' && device !== 'mobile'"
|
|
||||||
class="breadcrumb-container"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<mixNav v-if="layout === 'mix'" />
|
|
||||||
|
|
||||||
<div v-if="layout === 'vertical'" class="vertical-header-right">
|
|
||||||
<!-- 菜单搜索 -->
|
|
||||||
<Search id="header-search" />
|
|
||||||
<!-- 通知 -->
|
|
||||||
<Notice id="header-notice" />
|
|
||||||
<!-- 退出登录 -->
|
|
||||||
<el-dropdown trigger="click">
|
|
||||||
<span class="el-dropdown-link navbar-bg-hover select-none">
|
|
||||||
<img :src="userAvatar" :style="avatarsStyle" />
|
|
||||||
<p v-if="username" class="dark:text-white">{{ username }}</p>
|
|
||||||
</span>
|
|
||||||
<template #dropdown>
|
|
||||||
<el-dropdown-menu class="logout">
|
|
||||||
<el-dropdown-item @click="logout">
|
|
||||||
<IconifyIconOffline
|
|
||||||
:icon="LogoutCircleRLine"
|
|
||||||
style="margin: 5px"
|
|
||||||
/>
|
|
||||||
退出系统
|
|
||||||
</el-dropdown-item>
|
|
||||||
</el-dropdown-menu>
|
|
||||||
</template>
|
|
||||||
</el-dropdown>
|
|
||||||
<span
|
|
||||||
class="set-icon navbar-bg-hover"
|
|
||||||
title="打开项目配置"
|
|
||||||
@click="onPanel"
|
|
||||||
>
|
|
||||||
<IconifyIconOffline :icon="Setting" />
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.navbar {
|
|
||||||
width: 100%;
|
|
||||||
height: 48px;
|
|
||||||
overflow: hidden;
|
|
||||||
|
|
||||||
.hamburger-container {
|
|
||||||
float: left;
|
|
||||||
height: 100%;
|
|
||||||
line-height: 48px;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.vertical-header-right {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: flex-end;
|
|
||||||
min-width: 280px;
|
|
||||||
height: 48px;
|
|
||||||
color: #000000d9;
|
|
||||||
|
|
||||||
.el-dropdown-link {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-around;
|
|
||||||
height: 48px;
|
|
||||||
padding: 10px;
|
|
||||||
color: #000000d9;
|
|
||||||
cursor: pointer;
|
|
||||||
|
|
||||||
p {
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
|
|
||||||
img {
|
|
||||||
width: 22px;
|
|
||||||
height: 22px;
|
|
||||||
border-radius: 50%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.breadcrumb-container {
|
|
||||||
float: left;
|
|
||||||
margin-left: 16px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.logout {
|
|
||||||
max-width: 120px;
|
|
||||||
|
|
||||||
::v-deep(.el-dropdown-menu__item) {
|
|
||||||
display: inline-flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
min-width: 100%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,146 +0,0 @@
|
|||||||
export interface ListItem {
|
|
||||||
avatar: string;
|
|
||||||
title: string;
|
|
||||||
datetime: string;
|
|
||||||
type: string;
|
|
||||||
description: string;
|
|
||||||
status?: "primary" | "success" | "warning" | "info" | "danger";
|
|
||||||
extra?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TabItem {
|
|
||||||
key: string;
|
|
||||||
name: string;
|
|
||||||
list: ListItem[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export const noticesData: TabItem[] = [
|
|
||||||
{
|
|
||||||
key: "1",
|
|
||||||
name: "通知",
|
|
||||||
list: [
|
|
||||||
{
|
|
||||||
avatar:
|
|
||||||
"https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png",
|
|
||||||
title: "你收到了 12 份新周报",
|
|
||||||
datetime: "一年前",
|
|
||||||
description: "",
|
|
||||||
type: "1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
avatar:
|
|
||||||
"https://gw.alipayobjects.com/zos/rmsportal/OKJXDXrmkNshAMvwtvhu.png",
|
|
||||||
title: "你推荐的 前端高手 已通过第三轮面试",
|
|
||||||
datetime: "一年前",
|
|
||||||
description: "",
|
|
||||||
type: "1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
avatar:
|
|
||||||
"https://gw.alipayobjects.com/zos/rmsportal/kISTdvpyTAhtGxpovNWd.png",
|
|
||||||
title: "这种模板可以区分多种通知类型",
|
|
||||||
datetime: "一年前",
|
|
||||||
description: "",
|
|
||||||
type: "1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
avatar:
|
|
||||||
"https://gw.alipayobjects.com/zos/rmsportal/GvqBnKhFgObvnSGkDsje.png",
|
|
||||||
title:
|
|
||||||
"展示标题内容超过一行后的处理方式,如果内容超过1行将自动截断并支持tooltip显示完整标题。",
|
|
||||||
datetime: "一年前",
|
|
||||||
description: "",
|
|
||||||
type: "1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
avatar:
|
|
||||||
"https://gw.alipayobjects.com/zos/rmsportal/GvqBnKhFgObvnSGkDsje.png",
|
|
||||||
title: "左侧图标用于区分不同的类型",
|
|
||||||
datetime: "一年前",
|
|
||||||
description: "",
|
|
||||||
type: "1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
avatar:
|
|
||||||
"https://gw.alipayobjects.com/zos/rmsportal/GvqBnKhFgObvnSGkDsje.png",
|
|
||||||
title: "左侧图标用于区分不同的类型",
|
|
||||||
datetime: "一年前",
|
|
||||||
description: "",
|
|
||||||
type: "1"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "2",
|
|
||||||
name: "消息",
|
|
||||||
list: [
|
|
||||||
{
|
|
||||||
avatar:
|
|
||||||
"https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg",
|
|
||||||
title: "李白 评论了你",
|
|
||||||
description: "长风破浪会有时,直挂云帆济沧海",
|
|
||||||
datetime: "一年前",
|
|
||||||
type: "2"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
avatar:
|
|
||||||
"https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg",
|
|
||||||
title: "李白 回复了你",
|
|
||||||
description: "行路难,行路难,多歧路,今安在。",
|
|
||||||
datetime: "一年前",
|
|
||||||
type: "2"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
avatar:
|
|
||||||
"https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg",
|
|
||||||
title: "标题",
|
|
||||||
description:
|
|
||||||
"请将鼠标移动到此处,以便测试超长的消息在此处将如何处理。本例中设置的描述最大行数为2,超过2行的描述内容将被省略并且可以通过tooltip查看完整内容",
|
|
||||||
datetime: "一年前",
|
|
||||||
type: "2"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "3",
|
|
||||||
name: "待办",
|
|
||||||
list: [
|
|
||||||
{
|
|
||||||
avatar: "",
|
|
||||||
title: "任务名称",
|
|
||||||
description: "任务需要在 2022-11-16 20:00 前启动",
|
|
||||||
datetime: "",
|
|
||||||
extra: "未开始",
|
|
||||||
status: "info",
|
|
||||||
type: "3"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
avatar: "",
|
|
||||||
title: "第三方紧急代码变更",
|
|
||||||
description:
|
|
||||||
"一拳提交于 2022-11-16,需在 2022-11-18 前完成代码变更任务",
|
|
||||||
datetime: "",
|
|
||||||
extra: "马上到期",
|
|
||||||
status: "danger",
|
|
||||||
type: "3"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
avatar: "",
|
|
||||||
title: "信息安全考试",
|
|
||||||
description: "指派小仙于 2022-12-12 前完成更新并发布",
|
|
||||||
datetime: "",
|
|
||||||
extra: "已耗时 8 天",
|
|
||||||
status: "warning",
|
|
||||||
type: "3"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
avatar: "",
|
|
||||||
title: "vue-pure-admin 版本发布",
|
|
||||||
description: "vue-pure-admin 版本发布",
|
|
||||||
datetime: "",
|
|
||||||
extra: "进行中",
|
|
||||||
type: "3"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
];
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import { PropType } from "vue";
|
|
||||||
import { ListItem } from "./data";
|
|
||||||
import NoticeItem from "./noticeItem.vue";
|
|
||||||
|
|
||||||
const props = defineProps({
|
|
||||||
list: {
|
|
||||||
type: Array as PropType<Array<ListItem>>,
|
|
||||||
default: () => []
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div v-if="props.list.length">
|
|
||||||
<NoticeItem
|
|
||||||
v-for="(item, index) in props.list"
|
|
||||||
:key="index"
|
|
||||||
:noticeItem="item"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<el-empty v-else description="暂无消息" />
|
|
||||||
</template>
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
import SearchModal from "./SearchModal.vue";
|
|
||||||
|
|
||||||
export { SearchModal };
|
|
||||||