Compare commits
31 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
d2543cf9d3 | ||
|
13a36c0acb | ||
|
85e5074665 | ||
|
a8a1f8d900 | ||
|
c0f3dcbbb7 | ||
|
c6b0aa2467 | ||
|
057fef9147 | ||
|
036459cb02 | ||
|
7640f97a36 | ||
|
0a57ad7920 | ||
|
a4f857124f | ||
|
0d8f6b314b | ||
|
923fdd9ff1 | ||
|
e29340422a | ||
|
e25f4bcf39 | ||
|
270df1b17a | ||
|
fda66ee37c | ||
|
dcd687fe86 | ||
|
1f2116c6b9 | ||
|
23db7512d0 | ||
|
03d68a24d9 | ||
|
51a4a6d246 | ||
|
f64cd466eb | ||
|
e87134a635 | ||
|
ef184a8636 | ||
|
afc9ad0273 | ||
|
1121c5a2b5 | ||
|
ff27074ebd | ||
|
1f27d6cd9e | ||
|
4b435d0e0f | ||
|
872e0bbd5b |
4
.browserslistrc
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
> 1%
|
||||||
|
last 2 versions
|
||||||
|
not dead
|
||||||
|
not ie 11
|
@ -1,11 +0,0 @@
|
|||||||
public
|
|
||||||
dist
|
|
||||||
*.d.ts
|
|
||||||
/src/assets
|
|
||||||
package.json
|
|
||||||
.eslintrc.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"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
};
|
|
1
.gitignore
vendored
@ -5,6 +5,7 @@ dist-ssr
|
|||||||
*.local
|
*.local
|
||||||
.eslintcache
|
.eslintcache
|
||||||
report.html
|
report.html
|
||||||
|
vite.config.*.timestamp*
|
||||||
|
|
||||||
yarn.lock
|
yarn.lock
|
||||||
npm-debug.log*
|
npm-debug.log*
|
||||||
|
@ -3,4 +3,6 @@
|
|||||||
# shellcheck source=./_/husky.sh
|
# shellcheck source=./_/husky.sh
|
||||||
. "$(dirname "$0")/_/husky.sh"
|
. "$(dirname "$0")/_/husky.sh"
|
||||||
|
|
||||||
|
PATH="/usr/local/bin:$PATH"
|
||||||
|
|
||||||
npx --no-install commitlint --edit "$1"
|
npx --no-install commitlint --edit "$1"
|
@ -1,8 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
"*.{js,jsx,ts,tsx}": ["eslint --fix", "prettier --write"],
|
|
||||||
"{!(package)*.json}": ["prettier --write--parser json"],
|
|
||||||
"package.json": ["prettier --write"],
|
|
||||||
"*.vue": ["eslint --fix", "prettier --write", "stylelint --fix"],
|
|
||||||
"*.{vue,css,scss,postcss,less}": ["stylelint --fix", "prettier --write"],
|
|
||||||
"*.md": ["prettier --write"]
|
|
||||||
};
|
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
[ -n "$CI" ] && exit 0
|
[ -n "$CI" ] && exit 0
|
||||||
|
|
||||||
# Format and submit code according to lintstagedrc.js configuration
|
PATH="/usr/local/bin:$PATH"
|
||||||
npm run lint:lint-staged
|
|
||||||
|
|
||||||
npm run lint:pretty
|
# Perform lint check on files in the staging area through .lintstagedrc configuration
|
||||||
|
pnpm exec lint-staged
|
20
.lintstagedrc
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"*.{js,jsx,ts,tsx}": [
|
||||||
|
"prettier --cache --ignore-unknown --write",
|
||||||
|
"eslint --cache --fix"
|
||||||
|
],
|
||||||
|
"{!(package)*.json,*.code-snippets,.!({browserslist,npm,nvm})*rc}": [
|
||||||
|
"prettier --cache --write--parser json"
|
||||||
|
],
|
||||||
|
"package.json": ["prettier --cache --write"],
|
||||||
|
"*.vue": [
|
||||||
|
"prettier --write",
|
||||||
|
"eslint --cache --fix",
|
||||||
|
"stylelint --fix --allow-empty-input"
|
||||||
|
],
|
||||||
|
"*.{css,scss,html}": [
|
||||||
|
"prettier --cache --ignore-unknown --write",
|
||||||
|
"stylelint --fix --allow-empty-input"
|
||||||
|
],
|
||||||
|
"*.md": ["prettier --cache --ignore-unknown --write"]
|
||||||
|
}
|
5
.npmrc
@ -1,3 +1,4 @@
|
|||||||
shamefully-hoist=true
|
|
||||||
strict-peer-dependencies=false
|
|
||||||
shell-emulator=true
|
shell-emulator=true
|
||||||
|
shamefully-hoist=true
|
||||||
|
enable-pre-post-scripts=false
|
||||||
|
strict-peer-dependencies=false
|
@ -1,4 +1,7 @@
|
|||||||
module.exports = {
|
// @ts-check
|
||||||
|
|
||||||
|
/** @type {import("prettier").Config} */
|
||||||
|
export default {
|
||||||
bracketSpacing: true,
|
bracketSpacing: true,
|
||||||
singleQuote: false,
|
singleQuote: false,
|
||||||
arrowParens: "avoid",
|
arrowParens: "avoid",
|
||||||
|
1
.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",
|
||||||
|
16
.vscode/settings.json
vendored
@ -25,7 +25,19 @@
|
|||||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||||
},
|
},
|
||||||
"editor.codeActionsOnSave": {
|
"editor.codeActionsOnSave": {
|
||||||
"source.fixAll.eslint": true
|
"source.fixAll.eslint": "explicit"
|
||||||
},
|
},
|
||||||
"iconify.excludes": ["el"]
|
"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:16-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@7.32.1 --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
|
||||||
|
|
||||||
|
@ -8,18 +8,31 @@
|
|||||||
|
|
||||||
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
|
## `js` version
|
||||||
|
|
||||||
- [Click Watch Tutorial](https://www.bilibili.com/video/BV1kg411v7QT)
|
[Click me to view js version](https://pure-admin.cn/pages/js/)
|
||||||
- [Click Watch UI Design](https://www.bilibili.com/video/BV17g411T7rq)
|
|
||||||
|
|
||||||
## Docs
|
## `max` version
|
||||||
|
|
||||||
- [documentation site](https://yiming_chang.gitee.io/pure-admin-doc)
|
[Click me to view the max version](https://pure-admin.cn/pages/max/)
|
||||||
|
|
||||||
|
## Supporting video
|
||||||
|
|
||||||
|
[Click me to view UI design](https://www.bilibili.com/video/BV17g411T7rq)
|
||||||
|
[Click me to view the rapid development tutorial](https://www.bilibili.com/video/BV1kg411v7QT)
|
||||||
|
|
||||||
|
## Nanny-level documents
|
||||||
|
|
||||||
|
[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)
|
||||||
|
|
||||||
|
## Quality service, software outsourcing, sponsorship support
|
||||||
|
|
||||||
|
[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,10 +40,8 @@ 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
|
||||||
|
|
||||||
In principle, no fees and copyrights are charged, and it is commercially available, but if you need secondary open source (such as using this platform for secondary development and open source, the front-end code must be open source and free), please contact the author for permission! (Free, just take a record)
|
|
||||||
|
|
||||||
[MIT © 2020-present, pure-admin](./LICENSE)
|
[MIT © 2020-present, pure-admin](./LICENSE)
|
||||||
|
25
README.md
@ -12,18 +12,31 @@
|
|||||||
|
|
||||||
当前是非国际化版本,如果您需要国际化版本 [请点击](https://github.com/pure-admin/pure-admin-thin/tree/i18n)
|
当前是非国际化版本,如果您需要国际化版本 [请点击](https://github.com/pure-admin/pure-admin-thin/tree/i18n)
|
||||||
|
|
||||||
|
## `js` 版本
|
||||||
|
|
||||||
|
[点我查看 js 版本](https://pure-admin.cn/pages/js/)
|
||||||
|
|
||||||
|
## `max` 版本
|
||||||
|
|
||||||
|
[点我查看 max 版本](https://pure-admin.cn/pages/max/)
|
||||||
|
|
||||||
## 配套视频
|
## 配套视频
|
||||||
|
|
||||||
- [点我查看教程](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,10 +44,8 @@
|
|||||||
|
|
||||||
## ⚠️ 注意
|
## ⚠️ 注意
|
||||||
|
|
||||||
- 精简版不接受任何 `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) 去提,谢谢!
|
||||||
|
|
||||||
## 许可证
|
## 许可证
|
||||||
|
|
||||||
原则上不收取任何费用及版权,可商用,不过如需二次开源(比如用此平台二次开发并开源,要求前端代码必须开源免费)请联系作者获取许可!(免费,走个记录而已)
|
|
||||||
|
|
||||||
[MIT © 2020-present, pure-admin](./LICENSE)
|
[MIT © 2020-present, pure-admin](./LICENSE)
|
||||||
|
@ -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({
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
/** 处理环境变量 */
|
|
||||||
const warpperEnv = (envConf: Recordable): ViteEnv => {
|
|
||||||
/** 此处为默认值 */
|
|
||||||
const ret: ViteEnv = {
|
|
||||||
VITE_PORT: 8848,
|
|
||||||
VITE_PUBLIC_PATH: "",
|
|
||||||
VITE_ROUTER_HISTORY: "",
|
|
||||||
VITE_CDN: false,
|
|
||||||
VITE_HIDE_HOME: "false",
|
|
||||||
VITE_COMPRESSION: "none"
|
|
||||||
};
|
|
||||||
|
|
||||||
for (const envName of Object.keys(envConf)) {
|
|
||||||
let realName = envConf[envName].replace(/\\n/g, "\n");
|
|
||||||
realName =
|
|
||||||
realName === "true" ? true : realName === "false" ? false : realName;
|
|
||||||
|
|
||||||
if (envName === "VITE_PORT") {
|
|
||||||
realName = Number(realName);
|
|
||||||
}
|
|
||||||
ret[envName] = realName;
|
|
||||||
if (typeof realName === "string") {
|
|
||||||
process.env[envName] = realName;
|
|
||||||
} else if (typeof realName === "object") {
|
|
||||||
process.env[envName] = JSON.stringify(realName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
};
|
|
||||||
|
|
||||||
export { warpperEnv };
|
|
@ -1,10 +1,21 @@
|
|||||||
import type { Plugin } from "vite";
|
import type { Plugin } from "vite";
|
||||||
import dayjs, { Dayjs } from "dayjs";
|
import gradient from "gradient-string";
|
||||||
import utils from "@pureadmin/utils";
|
import { getPackageSize } from "./utils";
|
||||||
|
import dayjs, { type Dayjs } from "dayjs";
|
||||||
import duration from "dayjs/plugin/duration";
|
import duration from "dayjs/plugin/duration";
|
||||||
import { green, blue, bold } from "picocolors";
|
import boxen, { type Options as BoxenOptions } from "boxen";
|
||||||
dayjs.extend(duration);
|
dayjs.extend(duration);
|
||||||
|
|
||||||
|
const welcomeMessage = gradient(["cyan", "magenta"]).multiline(
|
||||||
|
`您好! 欢迎使用 pure-admin 开源项目\n我们为您精心准备了下面两个贴心的保姆级文档\nhttps://pure-admin.cn\nhttps://pure-admin-utils.netlify.app`
|
||||||
|
);
|
||||||
|
|
||||||
|
const boxenOptions: BoxenOptions = {
|
||||||
|
padding: 0.5,
|
||||||
|
borderColor: "cyan",
|
||||||
|
borderStyle: "round"
|
||||||
|
};
|
||||||
|
|
||||||
export function viteBuildInfo(): Plugin {
|
export function viteBuildInfo(): Plugin {
|
||||||
let config: { command: string };
|
let config: { command: string };
|
||||||
let startTime: Dayjs;
|
let startTime: Dayjs;
|
||||||
@ -17,15 +28,7 @@ export function viteBuildInfo(): Plugin {
|
|||||||
outDir = resolvedConfig.build?.outDir ?? "dist";
|
outDir = resolvedConfig.build?.outDir ?? "dist";
|
||||||
},
|
},
|
||||||
buildStart() {
|
buildStart() {
|
||||||
console.log(
|
console.log(boxen(welcomeMessage, boxenOptions));
|
||||||
bold(
|
|
||||||
green(
|
|
||||||
`👏欢迎使用${blue(
|
|
||||||
"[vue-pure-admin]"
|
|
||||||
)},如果您感觉不错,记得点击后面链接给个star哦💖 https://github.com/pure-admin/vue-pure-admin`
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
if (config.command === "build") {
|
if (config.command === "build") {
|
||||||
startTime = dayjs(new Date());
|
startTime = dayjs(new Date());
|
||||||
}
|
}
|
||||||
@ -33,16 +36,17 @@ export function viteBuildInfo(): Plugin {
|
|||||||
closeBundle() {
|
closeBundle() {
|
||||||
if (config.command === "build") {
|
if (config.command === "build") {
|
||||||
endTime = dayjs(new Date());
|
endTime = dayjs(new Date());
|
||||||
utils.getPackageSize({
|
getPackageSize({
|
||||||
folder: outDir,
|
folder: outDir,
|
||||||
callback: (size: string) => {
|
callback: (size: string) => {
|
||||||
console.log(
|
console.log(
|
||||||
bold(
|
boxen(
|
||||||
green(
|
gradient(["cyan", "magenta"]).multiline(
|
||||||
`🎉恭喜打包完成(总用时${dayjs
|
`🎉 恭喜打包完成(总用时${dayjs
|
||||||
.duration(endTime.diff(startTime))
|
.duration(endTime.diff(startTime))
|
||||||
.format("mm分ss秒")},打包后的大小为${size})`
|
.format("mm分ss秒")},打包后的大小为${size})`
|
||||||
)
|
),
|
||||||
|
boxenOptions
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,10 @@ const include = [
|
|||||||
"dayjs",
|
"dayjs",
|
||||||
"axios",
|
"axios",
|
||||||
"pinia",
|
"pinia",
|
||||||
|
"vue-types",
|
||||||
"js-cookie",
|
"js-cookie",
|
||||||
|
"vue-tippy",
|
||||||
|
"pinyin-pro",
|
||||||
"sortablejs",
|
"sortablejs",
|
||||||
"@vueuse/core",
|
"@vueuse/core",
|
||||||
"@pureadmin/utils",
|
"@pureadmin/utils",
|
||||||
@ -19,12 +22,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 };
|
||||||
|
@ -2,55 +2,65 @@ import { cdn } from "./cdn";
|
|||||||
import vue from "@vitejs/plugin-vue";
|
import vue from "@vitejs/plugin-vue";
|
||||||
import { viteBuildInfo } from "./info";
|
import { viteBuildInfo } from "./info";
|
||||||
import svgLoader from "vite-svg-loader";
|
import svgLoader from "vite-svg-loader";
|
||||||
|
import Icons from "unplugin-icons/vite";
|
||||||
|
import type { PluginOption } from "vite";
|
||||||
import vueJsx from "@vitejs/plugin-vue-jsx";
|
import vueJsx from "@vitejs/plugin-vue-jsx";
|
||||||
import { viteMockServe } from "vite-plugin-mock";
|
import tailwindcss from "@tailwindcss/vite";
|
||||||
import { configCompressPlugin } from "./compress";
|
import { configCompressPlugin } from "./compress";
|
||||||
// import ElementPlus from "unplugin-element-plus/vite";
|
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 { codeInspectorPlugin } from "code-inspector-plugin";
|
||||||
import { genScssMultipleScopeVars } from "../src/layout/theme";
|
import { vitePluginFakeServer } from "vite-plugin-fake-server";
|
||||||
|
|
||||||
export function getPluginsList(
|
export function getPluginsList(
|
||||||
command: string,
|
|
||||||
VITE_CDN: boolean,
|
VITE_CDN: boolean,
|
||||||
VITE_COMPRESSION: ViteCompression
|
VITE_COMPRESSION: ViteCompression
|
||||||
) {
|
): PluginOption[] {
|
||||||
const prodMock = true;
|
|
||||||
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(),
|
||||||
|
/**
|
||||||
|
* 在页面上按住组合键时,鼠标在页面移动即会在 DOM 上出现遮罩层并显示相关信息,点击一下将自动打开 IDE 并将光标定位到元素对应的代码位置
|
||||||
|
* Mac 默认组合键 Option + Shift
|
||||||
|
* Windows 默认组合键 Alt + Shift
|
||||||
|
* 更多用法看 https://inspector.fe-dev.cn/guide/start.html
|
||||||
|
*/
|
||||||
|
codeInspectorPlugin({
|
||||||
|
bundler: "vite",
|
||||||
|
hideConsole: true
|
||||||
|
}),
|
||||||
|
viteBuildInfo(),
|
||||||
|
/**
|
||||||
|
* 开发环境下移除非必要的vue-router动态路由警告No match found for location with path
|
||||||
|
* 非必要具体看 https://github.com/vuejs/router/issues/521 和 https://github.com/vuejs/router/issues/359
|
||||||
|
* vite-plugin-router-warn只在开发环境下启用,只处理vue-router文件并且只在服务启动或重启时运行一次,性能消耗可忽略不计
|
||||||
|
*/
|
||||||
|
removeNoMatch(),
|
||||||
|
// mock支持
|
||||||
|
vitePluginFakeServer({
|
||||||
|
logger: false,
|
||||||
|
include: "mock",
|
||||||
|
infixName: false,
|
||||||
|
enableProd: true
|
||||||
|
}),
|
||||||
|
// svg组件化支持
|
||||||
|
svgLoader(),
|
||||||
|
// 自动按需加载图标
|
||||||
|
Icons({
|
||||||
|
compiler: "vue3",
|
||||||
|
scale: 1
|
||||||
|
}),
|
||||||
VITE_CDN ? cdn : null,
|
VITE_CDN ? cdn : null,
|
||||||
configCompressPlugin(VITE_COMPRESSION),
|
configCompressPlugin(VITE_COMPRESSION),
|
||||||
// 线上环境删除console
|
// 线上环境删除console
|
||||||
removeConsole({ external: ["src/assets/iconfont/iconfont.js"] }),
|
removeConsole({ external: ["src/assets/iconfont/iconfont.js"] }),
|
||||||
viteBuildInfo(),
|
|
||||||
// 自定义主题
|
|
||||||
themePreprocessorPlugin({
|
|
||||||
scss: {
|
|
||||||
multipleScopeVars: genScssMultipleScopeVars(),
|
|
||||||
extract: true
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
// svg组件化支持
|
|
||||||
svgLoader(),
|
|
||||||
// ElementPlus({}),
|
|
||||||
// mock支持
|
|
||||||
viteMockServe({
|
|
||||||
mockPath: "mock",
|
|
||||||
localEnabled: command === "serve",
|
|
||||||
prodEnabled: command !== "serve" && prodMock,
|
|
||||||
injectCode: `
|
|
||||||
import { setupProdMockServer } from './mockProdServer';
|
|
||||||
setupProdMockServer();
|
|
||||||
`,
|
|
||||||
logger: false
|
|
||||||
}),
|
|
||||||
// 打包分析
|
// 打包分析
|
||||||
lifecycle === "report"
|
lifecycle === "report"
|
||||||
? visualizer({ open: true, brotliSize: true, filename: "report.html" })
|
? visualizer({ open: true, brotliSize: true, filename: "report.html" })
|
||||||
: null
|
: (null as any)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
110
build/utils.ts
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
import dayjs from "dayjs";
|
||||||
|
import { readdir, stat } from "node:fs";
|
||||||
|
import { fileURLToPath } from "node:url";
|
||||||
|
import { dirname, resolve } from "node:path";
|
||||||
|
import { sum, formatBytes } from "@pureadmin/utils";
|
||||||
|
import {
|
||||||
|
name,
|
||||||
|
version,
|
||||||
|
engines,
|
||||||
|
dependencies,
|
||||||
|
devDependencies
|
||||||
|
} from "../package.json";
|
||||||
|
|
||||||
|
/** 启动`node`进程时所在工作目录的绝对路径 */
|
||||||
|
const root: string = process.cwd();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 根据可选的路径片段生成一个新的绝对路径
|
||||||
|
* @param dir 路径片段,默认`build`
|
||||||
|
* @param metaUrl 模块的完整`url`,如果在`build`目录外调用必传`import.meta.url`
|
||||||
|
*/
|
||||||
|
const pathResolve = (dir = ".", metaUrl = import.meta.url) => {
|
||||||
|
// 当前文件目录的绝对路径
|
||||||
|
const currentFileDir = dirname(fileURLToPath(metaUrl));
|
||||||
|
// build 目录的绝对路径
|
||||||
|
const buildDir = resolve(currentFileDir, "build");
|
||||||
|
// 解析的绝对路径
|
||||||
|
const resolvedPath = resolve(currentFileDir, dir);
|
||||||
|
// 检查解析的绝对路径是否在 build 目录内
|
||||||
|
if (resolvedPath.startsWith(buildDir)) {
|
||||||
|
// 在 build 目录内,返回当前文件路径
|
||||||
|
return fileURLToPath(metaUrl);
|
||||||
|
}
|
||||||
|
// 不在 build 目录内,返回解析后的绝对路径
|
||||||
|
return resolvedPath;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 设置别名 */
|
||||||
|
const alias: Record<string, string> = {
|
||||||
|
"@": pathResolve("../src"),
|
||||||
|
"@build": pathResolve()
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 平台的名称、版本、运行所需的`node`和`pnpm`版本、依赖、最后构建时间的类型提示 */
|
||||||
|
const __APP_INFO__ = {
|
||||||
|
pkg: { name, version, engines, dependencies, devDependencies },
|
||||||
|
lastBuildTime: dayjs(new Date()).format("YYYY-MM-DD HH:mm:ss")
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 处理环境变量 */
|
||||||
|
const wrapperEnv = (envConf: Recordable): ViteEnv => {
|
||||||
|
// 默认值
|
||||||
|
const ret: ViteEnv = {
|
||||||
|
VITE_PORT: 8848,
|
||||||
|
VITE_PUBLIC_PATH: "",
|
||||||
|
VITE_ROUTER_HISTORY: "",
|
||||||
|
VITE_CDN: false,
|
||||||
|
VITE_HIDE_HOME: "false",
|
||||||
|
VITE_COMPRESSION: "none"
|
||||||
|
};
|
||||||
|
|
||||||
|
for (const envName of Object.keys(envConf)) {
|
||||||
|
let realName = envConf[envName].replace(/\\n/g, "\n");
|
||||||
|
realName =
|
||||||
|
realName === "true" ? true : realName === "false" ? false : realName;
|
||||||
|
|
||||||
|
if (envName === "VITE_PORT") {
|
||||||
|
realName = Number(realName);
|
||||||
|
}
|
||||||
|
ret[envName] = realName;
|
||||||
|
if (typeof realName === "string") {
|
||||||
|
process.env[envName] = realName;
|
||||||
|
} else if (typeof realName === "object") {
|
||||||
|
process.env[envName] = JSON.stringify(realName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
};
|
||||||
|
|
||||||
|
const fileListTotal: number[] = [];
|
||||||
|
|
||||||
|
/** 获取指定文件夹中所有文件的总大小 */
|
||||||
|
const getPackageSize = options => {
|
||||||
|
const { folder = "dist", callback, format = true } = options;
|
||||||
|
readdir(folder, (err, files: string[]) => {
|
||||||
|
if (err) throw err;
|
||||||
|
let count = 0;
|
||||||
|
const checkEnd = () => {
|
||||||
|
++count == files.length &&
|
||||||
|
callback(format ? formatBytes(sum(fileListTotal)) : sum(fileListTotal));
|
||||||
|
};
|
||||||
|
files.forEach((item: string) => {
|
||||||
|
stat(`${folder}/${item}`, async (err, stats) => {
|
||||||
|
if (err) throw err;
|
||||||
|
if (stats.isFile()) {
|
||||||
|
fileListTotal.push(stats.size);
|
||||||
|
checkEnd();
|
||||||
|
} else if (stats.isDirectory()) {
|
||||||
|
getPackageSize({
|
||||||
|
folder: `${folder}/${item}/`,
|
||||||
|
callback: checkEnd
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
files.length === 0 && callback(0);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export { root, pathResolve, alias, __APP_INFO__, wrapperEnv, getPackageSize };
|
@ -1,4 +1,7 @@
|
|||||||
module.exports = {
|
// @ts-check
|
||||||
|
|
||||||
|
/** @type {import("@commitlint/types").UserConfig} */
|
||||||
|
export default {
|
||||||
ignores: [commit => commit.includes("init")],
|
ignores: [commit => commit.includes("init")],
|
||||||
extends: ["@commitlint/config-conventional"],
|
extends: ["@commitlint/config-conventional"],
|
||||||
rules: {
|
rules: {
|
||||||
|
173
eslint.config.js
Normal file
@ -0,0 +1,173 @@
|
|||||||
|
import js from "@eslint/js";
|
||||||
|
import tseslint from "typescript-eslint";
|
||||||
|
import pluginVue from "eslint-plugin-vue";
|
||||||
|
import * as parserVue from "vue-eslint-parser";
|
||||||
|
import configPrettier from "eslint-config-prettier";
|
||||||
|
import pluginPrettier from "eslint-plugin-prettier";
|
||||||
|
import { defineConfig, globalIgnores } from "eslint/config";
|
||||||
|
|
||||||
|
export default defineConfig([
|
||||||
|
globalIgnores([
|
||||||
|
"**/.*",
|
||||||
|
"dist/*",
|
||||||
|
"*.d.ts",
|
||||||
|
"public/*",
|
||||||
|
"src/assets/**",
|
||||||
|
"src/**/iconfont/**"
|
||||||
|
]),
|
||||||
|
{
|
||||||
|
...js.configs.recommended,
|
||||||
|
languageOptions: {
|
||||||
|
globals: {
|
||||||
|
// types/index.d.ts
|
||||||
|
RefType: "readonly",
|
||||||
|
EmitType: "readonly",
|
||||||
|
TargetContext: "readonly",
|
||||||
|
ComponentRef: "readonly",
|
||||||
|
ElRef: "readonly",
|
||||||
|
ForDataType: "readonly",
|
||||||
|
AnyFunction: "readonly",
|
||||||
|
PropType: "readonly",
|
||||||
|
Writable: "readonly",
|
||||||
|
Nullable: "readonly",
|
||||||
|
NonNullable: "readonly",
|
||||||
|
Recordable: "readonly",
|
||||||
|
ReadonlyRecordable: "readonly",
|
||||||
|
Indexable: "readonly",
|
||||||
|
DeepPartial: "readonly",
|
||||||
|
Without: "readonly",
|
||||||
|
Exclusive: "readonly",
|
||||||
|
TimeoutHandle: "readonly",
|
||||||
|
IntervalHandle: "readonly",
|
||||||
|
Effect: "readonly",
|
||||||
|
ChangeEvent: "readonly",
|
||||||
|
WheelEvent: "readonly",
|
||||||
|
ImportMetaEnv: "readonly",
|
||||||
|
Fn: "readonly",
|
||||||
|
PromiseFn: "readonly",
|
||||||
|
ComponentElRef: "readonly",
|
||||||
|
parseInt: "readonly",
|
||||||
|
parseFloat: "readonly"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
plugins: {
|
||||||
|
prettier: pluginPrettier
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
...configPrettier.rules,
|
||||||
|
...pluginPrettier.configs.recommended.rules,
|
||||||
|
"no-debugger": "off",
|
||||||
|
"no-unused-vars": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
argsIgnorePattern: "^_",
|
||||||
|
varsIgnorePattern: "^_"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"prettier/prettier": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
endOfLine: "auto"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
...tseslint.config({
|
||||||
|
extends: [...tseslint.configs.recommended],
|
||||||
|
files: ["**/*.?([cm])ts", "**/*.?([cm])tsx"],
|
||||||
|
rules: {
|
||||||
|
"@typescript-eslint/no-redeclare": "error",
|
||||||
|
"@typescript-eslint/ban-ts-comment": "off",
|
||||||
|
"@typescript-eslint/no-explicit-any": "off",
|
||||||
|
"@typescript-eslint/prefer-as-const": "warn",
|
||||||
|
"@typescript-eslint/no-empty-function": "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/explicit-module-boundary-types": "off",
|
||||||
|
"@typescript-eslint/consistent-type-imports": [
|
||||||
|
"error",
|
||||||
|
{ disallowTypeAnnotations: false, fixStyle: "inline-type-imports" }
|
||||||
|
],
|
||||||
|
"@typescript-eslint/prefer-literal-enum-member": [
|
||||||
|
"error",
|
||||||
|
{ allowBitwiseExpressions: true }
|
||||||
|
],
|
||||||
|
"@typescript-eslint/no-unused-vars": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
argsIgnorePattern: "^_",
|
||||||
|
varsIgnorePattern: "^_"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
{
|
||||||
|
files: ["**/*.d.ts"],
|
||||||
|
rules: {
|
||||||
|
"eslint-comments/no-unlimited-disable": "off",
|
||||||
|
"import/no-duplicates": "off",
|
||||||
|
"no-restricted-syntax": "off",
|
||||||
|
"unused-imports/no-unused-vars": "off"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
files: ["**/*.?([cm])js"],
|
||||||
|
rules: {
|
||||||
|
"@typescript-eslint/no-require-imports": "off"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
files: ["**/*.vue"],
|
||||||
|
languageOptions: {
|
||||||
|
globals: {
|
||||||
|
$: "readonly",
|
||||||
|
$$: "readonly",
|
||||||
|
$computed: "readonly",
|
||||||
|
$customRef: "readonly",
|
||||||
|
$ref: "readonly",
|
||||||
|
$shallowRef: "readonly",
|
||||||
|
$toRef: "readonly"
|
||||||
|
},
|
||||||
|
parser: parserVue,
|
||||||
|
parserOptions: {
|
||||||
|
ecmaFeatures: {
|
||||||
|
jsx: true
|
||||||
|
},
|
||||||
|
extraFileExtensions: [".vue"],
|
||||||
|
parser: tseslint.parser,
|
||||||
|
sourceType: "module"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
plugins: {
|
||||||
|
"@typescript-eslint": tseslint.plugin,
|
||||||
|
vue: pluginVue
|
||||||
|
},
|
||||||
|
processor: pluginVue.processors[".vue"],
|
||||||
|
rules: {
|
||||||
|
...pluginVue.configs.base.rules,
|
||||||
|
...pluginVue.configs.essential.rules,
|
||||||
|
...pluginVue.configs.recommended.rules,
|
||||||
|
"no-undef": "off",
|
||||||
|
"no-unused-vars": "off",
|
||||||
|
"vue/no-v-html": "off",
|
||||||
|
"vue/require-default-prop": "off",
|
||||||
|
"vue/require-explicit-emits": "off",
|
||||||
|
"vue/multi-word-component-names": "off",
|
||||||
|
"vue/no-setup-props-reactivity-loss": "off",
|
||||||
|
"vue/html-self-closing": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
html: {
|
||||||
|
void: "always",
|
||||||
|
normal: "always",
|
||||||
|
component: "always"
|
||||||
|
},
|
||||||
|
svg: "always",
|
||||||
|
math: "always"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]);
|
@ -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>
|
||||||
|
@ -1,17 +1,16 @@
|
|||||||
// 模拟后端动态生成路由
|
// 模拟后端动态生成路由
|
||||||
import { MockMethod } from "vite-plugin-mock";
|
import { defineFakeRoute } from "vite-plugin-fake-server/client";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* roles:页面级别权限,这里模拟二种 "admin"、"common"
|
* roles:页面级别权限,这里模拟二种 "admin"、"common"
|
||||||
* admin:管理员角色
|
* admin:管理员角色
|
||||||
* common:普通角色
|
* common:普通角色
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const permissionRouter = {
|
const permissionRouter = {
|
||||||
path: "/permission",
|
path: "/permission",
|
||||||
meta: {
|
meta: {
|
||||||
title: "权限管理",
|
title: "权限管理",
|
||||||
icon: "lollipop",
|
icon: "ep:lollipop",
|
||||||
rank: 10
|
rank: 10
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
@ -24,20 +23,41 @@ const permissionRouter = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/permission/button/index",
|
path: "/permission/button",
|
||||||
name: "PermissionButton",
|
|
||||||
meta: {
|
meta: {
|
||||||
title: "按钮权限",
|
title: "按钮权限",
|
||||||
roles: ["admin", "common"],
|
roles: ["admin", "common"]
|
||||||
auths: ["btn_add", "btn_edit", "btn_delete"]
|
},
|
||||||
}
|
children: [
|
||||||
|
{
|
||||||
|
path: "/permission/button/router",
|
||||||
|
component: "permission/button/index",
|
||||||
|
name: "PermissionButtonRouter",
|
||||||
|
meta: {
|
||||||
|
title: "路由返回按钮权限",
|
||||||
|
auths: [
|
||||||
|
"permission:btn:add",
|
||||||
|
"permission:btn:edit",
|
||||||
|
"permission:btn:delete"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/permission/button/login",
|
||||||
|
component: "permission/button/perms",
|
||||||
|
name: "PermissionButtonLogin",
|
||||||
|
meta: {
|
||||||
|
title: "登录接口返回按钮权限"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
export default [
|
export default defineFakeRoute([
|
||||||
{
|
{
|
||||||
url: "/getAsyncRoutes",
|
url: "/get-async-routes",
|
||||||
method: "get",
|
method: "get",
|
||||||
response: () => {
|
response: () => {
|
||||||
return {
|
return {
|
||||||
@ -46,4 +66,4 @@ export default [
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
] as MockMethod[];
|
]);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// 根据角色动态生成路由
|
// 根据角色动态生成路由
|
||||||
import { MockMethod } from "vite-plugin-mock";
|
import { defineFakeRoute } from "vite-plugin-fake-server/client";
|
||||||
|
|
||||||
export default [
|
export default defineFakeRoute([
|
||||||
{
|
{
|
||||||
url: "/login",
|
url: "/login",
|
||||||
method: "post",
|
method: "post",
|
||||||
@ -10,27 +10,33 @@ export default [
|
|||||||
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: "2023/10/30 00:00:00"
|
expires: "2030/10/30 00:00:00"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
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: "2023/10/30 00:00:00"
|
expires: "2030/10/30 00:00:00"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
] as MockMethod[];
|
]);
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { MockMethod } from "vite-plugin-mock";
|
import { defineFakeRoute } from "vite-plugin-fake-server/client";
|
||||||
|
|
||||||
// 模拟刷新token接口
|
// 模拟刷新token接口
|
||||||
export default [
|
export default defineFakeRoute([
|
||||||
{
|
{
|
||||||
url: "/refreshToken",
|
url: "/refresh-token",
|
||||||
method: "post",
|
method: "post",
|
||||||
response: ({ body }) => {
|
response: ({ body }) => {
|
||||||
if (body.refreshToken) {
|
if (body.refreshToken) {
|
||||||
@ -13,7 +13,7 @@ export default [
|
|||||||
accessToken: "eyJhbGciOiJIUzUxMiJ9.newAdmin",
|
accessToken: "eyJhbGciOiJIUzUxMiJ9.newAdmin",
|
||||||
refreshToken: "eyJhbGciOiJIUzUxMiJ9.newAdminRefresh",
|
refreshToken: "eyJhbGciOiJIUzUxMiJ9.newAdminRefresh",
|
||||||
// `expires`选择这种日期格式是为了方便调试,后端直接设置时间戳或许更方便(每次都应该递增)。如果后端返回的是时间戳格式,前端开发请来到这个目录`src/utils/auth.ts`,把第`38`行的代码换成expires = data.expires即可。
|
// `expires`选择这种日期格式是为了方便调试,后端直接设置时间戳或许更方便(每次都应该递增)。如果后端返回的是时间戳格式,前端开发请来到这个目录`src/utils/auth.ts`,把第`38`行的代码换成expires = data.expires即可。
|
||||||
expires: "2023/10/30 23:59:59"
|
expires: "2030/10/30 23:59:59"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
@ -24,4 +24,4 @@ export default [
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
] as MockMethod[];
|
]);
|
||||||
|
229
package.json
@ -1,7 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": "pure-admin-thin",
|
"name": "pure-admin-thin",
|
||||||
"version": "4.4.0",
|
"version": "6.0.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "NODE_OPTIONS=--max-old-space-size=4096 vite",
|
"dev": "NODE_OPTIONS=--max-old-space-size=4096 vite",
|
||||||
"serve": "pnpm dev",
|
"serve": "pnpm dev",
|
||||||
@ -11,124 +12,148 @@
|
|||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"preview:build": "pnpm build && vite preview",
|
"preview:build": "pnpm build && vite preview",
|
||||||
"typecheck": "tsc --noEmit && vue-tsc --noEmit --skipLibCheck",
|
"typecheck": "tsc --noEmit && vue-tsc --noEmit --skipLibCheck",
|
||||||
"svgo": "svgo -f src/assets/svg -o src/assets/svg",
|
"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 node_modules && rimraf .eslintcache && 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}\"",
|
||||||
"lint:stylelint": "stylelint \"**/*.{html,vue,css,scss}\" --fix --cache --cache-location node_modules/.cache/stylelint/",
|
"lint:stylelint": "stylelint --cache --fix \"**/*.{html,vue,css,scss}\" --cache-location node_modules/.cache/stylelint/",
|
||||||
"lint:lint-staged": "lint-staged -c ./.husky/lintstagedrc.js",
|
|
||||||
"lint:pretty": "pretty-quick --staged",
|
|
||||||
"lint": "pnpm lint:eslint && pnpm lint:prettier && pnpm lint:stylelint",
|
"lint": "pnpm lint:eslint && pnpm lint:prettier && pnpm lint:stylelint",
|
||||||
"prepare": "husky install",
|
"prepare": "husky",
|
||||||
"preinstall": "npx only-allow pnpm"
|
"preinstall": "npx only-allow pnpm"
|
||||||
},
|
},
|
||||||
"browserslist": [
|
"keywords": [
|
||||||
"> 1%",
|
"pure-admin-thin",
|
||||||
"not ie 11",
|
"vue-pure-admin",
|
||||||
"not op_mini all"
|
"element-plus",
|
||||||
|
"tailwindcss",
|
||||||
|
"pure-admin",
|
||||||
|
"typescript",
|
||||||
|
"pinia",
|
||||||
|
"vue3",
|
||||||
|
"vite",
|
||||||
|
"esm"
|
||||||
],
|
],
|
||||||
|
"homepage": "https://github.com/pure-admin/pure-admin-thin",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/pure-admin/pure-admin-thin.git"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/pure-admin/vue-pure-admin/issues"
|
||||||
|
},
|
||||||
|
"license": "MIT",
|
||||||
|
"author": {
|
||||||
|
"name": "xiaoxian521",
|
||||||
|
"email": "pureadmin@163.com",
|
||||||
|
"url": "https://github.com/xiaoxian521"
|
||||||
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pureadmin/descriptions": "^1.1.1",
|
"@pureadmin/descriptions": "^1.2.1",
|
||||||
"@pureadmin/table": "^2.3.2",
|
"@pureadmin/table": "^3.2.1",
|
||||||
"@pureadmin/utils": "^1.9.3",
|
"@pureadmin/utils": "^2.6.0",
|
||||||
"@vueuse/core": "^10.1.2",
|
"@vueuse/core": "^13.1.0",
|
||||||
"@vueuse/motion": "^2.0.0",
|
"@vueuse/motion": "^3.0.3",
|
||||||
"animate.css": "^4.1.1",
|
"animate.css": "^4.1.1",
|
||||||
"axios": "^1.4.0",
|
"axios": "^1.9.0",
|
||||||
"dayjs": "^1.11.8",
|
"dayjs": "^1.11.13",
|
||||||
"echarts": "^5.4.2",
|
"echarts": "^5.6.0",
|
||||||
"element-plus": "^2.3.6",
|
"element-plus": "^2.9.8",
|
||||||
"js-cookie": "^3.0.5",
|
"js-cookie": "^3.0.5",
|
||||||
"mitt": "^3.0.0",
|
"localforage": "^1.10.0",
|
||||||
"mockjs": "^1.1.0",
|
"mitt": "^3.0.1",
|
||||||
"nprogress": "^0.2.0",
|
"nprogress": "^0.2.0",
|
||||||
"path": "^0.12.7",
|
"path-browserify": "^1.0.1",
|
||||||
"pinia": "^2.1.3",
|
"pinia": "^3.0.2",
|
||||||
"qs": "^6.11.2",
|
"pinyin-pro": "^3.26.0",
|
||||||
|
"qs": "^6.14.0",
|
||||||
"responsive-storage": "^2.2.0",
|
"responsive-storage": "^2.2.0",
|
||||||
"sortablejs": "^1.15.0",
|
"sortablejs": "^1.15.6",
|
||||||
"vue": "^3.3.4",
|
"vue": "^3.5.13",
|
||||||
"vue-router": "^4.2.2",
|
"vue-router": "^4.5.0",
|
||||||
"vue-types": "^5.0.3"
|
"vue-tippy": "^6.7.0",
|
||||||
|
"vue-types": "^6.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@commitlint/cli": "^17.6.5",
|
"@commitlint/cli": "^19.8.0",
|
||||||
"@commitlint/config-conventional": "^17.6.5",
|
"@commitlint/config-conventional": "^19.8.0",
|
||||||
"@iconify-icons/ep": "^1.2.11",
|
"@commitlint/types": "^19.8.0",
|
||||||
"@iconify-icons/ri": "^1.2.8",
|
"@eslint/js": "^9.25.1",
|
||||||
"@iconify/vue": "^4.1.1",
|
"@faker-js/faker": "^9.7.0",
|
||||||
"@pureadmin/theme": "^3.0.0",
|
"@iconify/json": "^2.2.331",
|
||||||
"@types/js-cookie": "^3.0.3",
|
"@iconify/vue": "4.2.0",
|
||||||
"@types/mockjs": "^1.0.7",
|
"@tailwindcss/vite": "^4.1.4",
|
||||||
"@types/node": "^20.3.1",
|
"@types/js-cookie": "^3.0.6",
|
||||||
"@types/nprogress": "0.2.0",
|
"@types/node": "^20.17.30",
|
||||||
"@types/qs": "^6.9.7",
|
"@types/nprogress": "^0.2.3",
|
||||||
"@types/sortablejs": "^1.15.1",
|
"@types/path-browserify": "^1.0.3",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.59.11",
|
"@types/qs": "^6.9.18",
|
||||||
"@typescript-eslint/parser": "^5.59.11",
|
"@types/sortablejs": "^1.15.8",
|
||||||
"@vitejs/plugin-vue": "^4.2.3",
|
"@vitejs/plugin-vue": "^5.2.3",
|
||||||
"@vitejs/plugin-vue-jsx": "^3.0.1",
|
"@vitejs/plugin-vue-jsx": "^4.1.2",
|
||||||
"@vue/eslint-config-prettier": "^7.1.0",
|
"boxen": "^8.0.1",
|
||||||
"@vue/eslint-config-typescript": "^11.0.3",
|
"code-inspector-plugin": "^0.20.10",
|
||||||
"autoprefixer": "^10.4.14",
|
"cssnano": "^7.0.6",
|
||||||
"cloc": "^2.11.0",
|
"eslint": "^9.25.1",
|
||||||
"cssnano": "^6.0.1",
|
"eslint-config-prettier": "^10.1.2",
|
||||||
"eslint": "^8.42.0",
|
"eslint-plugin-prettier": "^5.2.6",
|
||||||
"eslint-plugin-prettier": "^4.2.1",
|
"eslint-plugin-vue": "^10.0.0",
|
||||||
"eslint-plugin-vue": "^9.14.1",
|
"gradient-string": "^3.0.0",
|
||||||
"husky": "^8.0.3",
|
"husky": "^9.1.7",
|
||||||
"lint-staged": "^13.2.2",
|
"lint-staged": "^15.5.1",
|
||||||
"picocolors": "^1.0.0",
|
"postcss": "^8.5.3",
|
||||||
"postcss": "^8.4.24",
|
"postcss-html": "^1.8.0",
|
||||||
"postcss-html": "^1.5.0",
|
"postcss-load-config": "^6.0.1",
|
||||||
"postcss-import": "^15.1.0",
|
"postcss-scss": "^4.0.9",
|
||||||
"postcss-scss": "^4.0.6",
|
"prettier": "^3.5.3",
|
||||||
"prettier": "^2.8.8",
|
"rimraf": "^6.0.1",
|
||||||
"pretty-quick": "^3.1.3",
|
"rollup-plugin-visualizer": "^5.14.0",
|
||||||
"rimraf": "^5.0.1",
|
"sass": "^1.87.0",
|
||||||
"rollup-plugin-visualizer": "^5.9.2",
|
"stylelint": "^16.19.0",
|
||||||
"sass": "^1.63.3",
|
"stylelint-config-recess-order": "^6.0.0",
|
||||||
"sass-loader": "^13.3.2",
|
"stylelint-config-recommended-vue": "^1.6.0",
|
||||||
"stylelint": "^15.7.0",
|
"stylelint-config-standard-scss": "^14.0.0",
|
||||||
"stylelint-config-html": "^1.1.0",
|
"stylelint-prettier": "^5.0.3",
|
||||||
"stylelint-config-recess-order": "^4.2.0",
|
"svgo": "^3.3.2",
|
||||||
"stylelint-config-recommended": "^12.0.0",
|
"tailwindcss": "^4.1.4",
|
||||||
"stylelint-config-recommended-scss": "^12.0.0",
|
"typescript": "^5.8.3",
|
||||||
"stylelint-config-recommended-vue": "^1.4.0",
|
"typescript-eslint": "^8.31.0",
|
||||||
"stylelint-config-standard": "^33.0.0",
|
"unplugin-icons": "^22.1.0",
|
||||||
"stylelint-config-standard-scss": "^9.0.0",
|
"vite": "^6.3.3",
|
||||||
"stylelint-order": "^6.0.3",
|
"vite-plugin-cdn-import": "^1.0.1",
|
||||||
"stylelint-prettier": "^3.0.0",
|
|
||||||
"stylelint-scss": "^5.0.1",
|
|
||||||
"svgo": "^3.0.2",
|
|
||||||
"tailwindcss": "^3.3.2",
|
|
||||||
"terser": "^5.18.0",
|
|
||||||
"typescript": "5.0.4",
|
|
||||||
"vite": "^4.3.9",
|
|
||||||
"vite-plugin-cdn-import": "^0.3.5",
|
|
||||||
"vite-plugin-compression": "^0.5.1",
|
"vite-plugin-compression": "^0.5.1",
|
||||||
"vite-plugin-mock": "2.9.6",
|
"vite-plugin-fake-server": "^2.2.0",
|
||||||
"vite-plugin-remove-console": "^2.1.1",
|
"vite-plugin-remove-console": "^2.2.0",
|
||||||
"vite-svg-loader": "^4.0.0",
|
"vite-plugin-router-warn": "^1.0.0",
|
||||||
"vue-eslint-parser": "^9.3.1",
|
"vite-svg-loader": "^5.1.0",
|
||||||
"vue-tsc": "^1.6.5"
|
"vue-eslint-parser": "^10.1.3",
|
||||||
|
"vue-tsc": "^2.2.10"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^18.18.0 || ^20.9.0 || >=22.0.0",
|
||||||
|
"pnpm": ">=9"
|
||||||
},
|
},
|
||||||
"pnpm": {
|
"pnpm": {
|
||||||
"peerDependencyRules": {
|
|
||||||
"ignoreMissing": [
|
|
||||||
"rollup",
|
|
||||||
"webpack",
|
|
||||||
"core-js"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"allowedDeprecatedVersions": {
|
"allowedDeprecatedVersions": {
|
||||||
|
"are-we-there-yet": "*",
|
||||||
"sourcemap-codec": "*",
|
"sourcemap-codec": "*",
|
||||||
|
"lodash.isequal": "*",
|
||||||
|
"domexception": "*",
|
||||||
"w3c-hr-time": "*",
|
"w3c-hr-time": "*",
|
||||||
"stable": "*"
|
"inflight": "*",
|
||||||
}
|
"npmlog": "*",
|
||||||
},
|
"rimraf": "*",
|
||||||
"repository": "git@github.com:pure-admin/pure-admin-thin.git",
|
"stable": "*",
|
||||||
"author": "xiaoxian521",
|
"gauge": "*",
|
||||||
"license": "MIT"
|
"abab": "*",
|
||||||
|
"glob": "*"
|
||||||
|
},
|
||||||
|
"onlyBuiltDependencies": [
|
||||||
|
"@parcel/watcher",
|
||||||
|
"core-js",
|
||||||
|
"es5-ext",
|
||||||
|
"esbuild",
|
||||||
|
"typeit",
|
||||||
|
"vue-demi"
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
15535
pnpm-lock.yaml
generated
@ -1,9 +1,8 @@
|
|||||||
module.exports = {
|
// @ts-check
|
||||||
|
|
||||||
|
/** @type {import('postcss-load-config').Config} */
|
||||||
|
export default {
|
||||||
plugins: {
|
plugins: {
|
||||||
"postcss-import": {},
|
|
||||||
"tailwindcss/nesting": {},
|
|
||||||
tailwindcss: {},
|
|
||||||
autoprefixer: {},
|
|
||||||
...(process.env.NODE_ENV === "production" ? { cssnano: {} } : {})
|
...(process.env.NODE_ENV === "production" ? { cssnano: {} } : {})
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1 +1 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" class="icon" viewBox="0 0 1024 1024"><path fill="#386BF3" d="M410.558.109c0 210.974-300.876 361.752-300.876 633.548 0 174.943 134.704 316.787 300.876 316.787s300.877-141.817 300.877-316.787C711.408 361.752 410.558 210.974 410.558.109z"/><path fill="#C3D2FB" d="M613.469 73.665c0 211.055-300.877 361.914-300.877 633.547C312.592 882.156 447.296 1024 613.47 1024s300.876-141.817 300.876-316.788C914.29 435.58 613.469 284.72 613.469 73.665z"/><path fill="#303F5B" d="M312.592 707.212c0-183.713 137.636-312.171 226.723-441.39 81.702 106.112 172.12 218.74 172.12 367.726A309.755 309.755 0 0 1 420.36 950.064a323.114 323.114 0 0 1-107.769-242.852z"/></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" class="icon" viewBox="0 0 1024 1024"><path fill="#386BF3" d="M410.558.109c0 210.974-300.876 361.752-300.876 633.548 0 174.943 134.704 316.787 300.876 316.787s300.877-141.817 300.877-316.787C711.408 361.752 410.558 210.974 410.558.109"/><path fill="#C3D2FB" d="M613.469 73.665c0 211.055-300.877 361.914-300.877 633.547C312.592 882.156 447.296 1024 613.47 1024s300.876-141.817 300.876-316.788C914.29 435.58 613.469 284.72 613.469 73.665"/><path fill="#303F5B" d="M312.592 707.212c0-183.713 137.636-312.171 226.723-441.39 81.702 106.112 172.12 218.74 172.12 367.726A309.755 309.755 0 0 1 420.36 950.064a323.1 323.1 0 0 1-107.769-242.852z"/></svg>
|
Before Width: | Height: | Size: 712 B After Width: | Height: | Size: 706 B |
@ -1,22 +1,26 @@
|
|||||||
{
|
{
|
||||||
"Version": "4.4.0",
|
"Version": "6.0.0",
|
||||||
"Title": "PureAdmin",
|
"Title": "PureAdmin",
|
||||||
"FixedHeader": true,
|
"FixedHeader": true,
|
||||||
"HiddenSideBar": false,
|
"HiddenSideBar": false,
|
||||||
"MultiTagsCache": false,
|
"MultiTagsCache": false,
|
||||||
"KeepAlive": true,
|
"KeepAlive": true,
|
||||||
"Layout": "vertical",
|
"Layout": "vertical",
|
||||||
"Theme": "default",
|
"Theme": "light",
|
||||||
"DarkMode": false,
|
"DarkMode": false,
|
||||||
|
"OverallStyle": "light",
|
||||||
"Grey": false,
|
"Grey": false,
|
||||||
"Weak": false,
|
"Weak": false,
|
||||||
"HideTabs": false,
|
"HideTabs": false,
|
||||||
|
"HideFooter": false,
|
||||||
|
"Stretch": false,
|
||||||
"SidebarStatus": true,
|
"SidebarStatus": true,
|
||||||
"EpThemeColor": "#409EFF",
|
"EpThemeColor": "#409EFF",
|
||||||
"ShowLogo": true,
|
"ShowLogo": true,
|
||||||
"ShowModel": "smart",
|
"ShowModel": "smart",
|
||||||
"MenuArrowIconNoTransition": true,
|
"MenuArrowIconNoTransition": false,
|
||||||
"CachingAsyncRoutes": false,
|
"CachingAsyncRoutes": false,
|
||||||
"TooltipEffect": "light",
|
"TooltipEffect": "light",
|
||||||
"ResponsiveStorageNameSpace": "responsive-"
|
"ResponsiveStorageNameSpace": "responsive-",
|
||||||
|
"MenuSearchHistory": 6
|
||||||
}
|
}
|
@ -8,8 +8,9 @@
|
|||||||
<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/lib/locale/lang/zh-cn";
|
|
||||||
import { ReDialog } from "@/components/ReDialog";
|
import { ReDialog } from "@/components/ReDialog";
|
||||||
|
import zhCn from "element-plus/es/locale/lang/zh-cn";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "app",
|
name: "app",
|
||||||
components: {
|
components: {
|
||||||
|
@ -6,5 +6,5 @@ type Result = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getAsyncRoutes = () => {
|
export const getAsyncRoutes = () => {
|
||||||
return http.request<Result>("get", "/getAsyncRoutes");
|
return http.request<Result>("get", "/get-async-routes");
|
||||||
};
|
};
|
||||||
|
@ -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", "/refreshToken", { data });
|
return http.request<RefreshTokenResult>("post", "/refresh-token", { data });
|
||||||
};
|
};
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
@font-face {
|
@font-face {
|
||||||
font-family: "iconfont"; /* Project id 2208059 */
|
font-family: "iconfont"; /* Project id 2208059 */
|
||||||
src: url("iconfont.woff2?t=1671895108120") format("woff2"),
|
src:
|
||||||
|
url("iconfont.woff2?t=1671895108120") format("woff2"),
|
||||||
url("iconfont.woff?t=1671895108120") format("woff"),
|
url("iconfont.woff?t=1671895108120") format("woff"),
|
||||||
url("iconfont.ttf?t=1671895108120") format("truetype");
|
url("iconfont.ttf?t=1671895108120") format("truetype");
|
||||||
}
|
}
|
||||||
|
@ -28,8 +28,7 @@
|
|||||||
c = document.createElement("div");
|
c = document.createElement("div");
|
||||||
(c.innerHTML = e._iconfont_svg_string_2208059),
|
(c.innerHTML = e._iconfont_svg_string_2208059),
|
||||||
(c = c.getElementsByTagName("svg")[0]) &&
|
(c = c.getElementsByTagName("svg")[0]) &&
|
||||||
(c.setAttribute("aria-hidden", "true"),
|
((c.style.position = "absolute"),
|
||||||
(c.style.position = "absolute"),
|
|
||||||
(c.style.width = 0),
|
(c.style.width = 0),
|
||||||
(c.style.height = 0),
|
(c.style.height = 0),
|
||||||
(c.style.overflow = "hidden"),
|
(c.style.overflow = "hidden"),
|
||||||
|
@ -1 +1 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" class="icon" viewBox="0 0 1024 1024"><path fill="#386BF3" d="M410.558.109c0 210.974-300.876 361.752-300.876 633.548 0 174.943 134.704 316.787 300.876 316.787s300.877-141.817 300.877-316.787C711.408 361.752 410.558 210.974 410.558.109z"/><path fill="#C3D2FB" d="M613.469 73.665c0 211.055-300.877 361.914-300.877 633.547C312.592 882.156 447.296 1024 613.47 1024s300.876-141.817 300.876-316.788C914.29 435.58 613.469 284.72 613.469 73.665z"/><path fill="#303F5B" d="M312.592 707.212c0-183.713 137.636-312.171 226.723-441.39 81.702 106.112 172.12 218.74 172.12 367.726A309.755 309.755 0 0 1 420.36 950.064a323.114 323.114 0 0 1-107.769-242.852z"/></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" class="icon" viewBox="0 0 1024 1024"><path fill="#386BF3" d="M410.558.109c0 210.974-300.876 361.752-300.876 633.548 0 174.943 134.704 316.787 300.876 316.787s300.877-141.817 300.877-316.787C711.408 361.752 410.558 210.974 410.558.109"/><path fill="#C3D2FB" d="M613.469 73.665c0 211.055-300.877 361.914-300.877 633.547C312.592 882.156 447.296 1024 613.47 1024s300.876-141.817 300.876-316.788C914.29 435.58 613.469 284.72 613.469 73.665"/><path fill="#303F5B" d="M312.592 707.212c0-183.713 137.636-312.171 226.723-441.39 81.702 106.112 172.12 218.74 172.12 367.726A309.755 309.755 0 0 1 420.36 950.064a323.1 323.1 0 0 1-107.769-242.852z"/></svg>
|
Before Width: | Height: | Size: 712 B After Width: | Height: | Size: 706 B |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
@ -1 +1 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path fill="none" d="M0 0h24v24H0z"/><path d="M2.88 18.054a35.897 35.897 0 0 1 8.531-16.32.8.8 0 0 1 1.178 0c.166.18.304.332.413.455a35.897 35.897 0 0 1 8.118 15.865c-2.141.451-4.34.747-6.584.874l-2.089 4.178a.5.5 0 0 1-.894 0l-2.089-4.178a44.019 44.019 0 0 1-6.584-.874zm6.698-1.123 1.157.066L12 19.527l1.265-2.53 1.157-.066a42.137 42.137 0 0 0 4.227-.454A33.913 33.913 0 0 0 12 4.09a33.913 33.913 0 0 0-6.649 12.387c1.395.222 2.805.374 4.227.454zM12 15a3 3 0 1 1 0-6 3 3 0 0 1 0 6zm0-2a1 1 0 1 0 0-2 1 1 0 0 0 0 2z"/></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path fill="none" d="M0 0h24v24H0z"/><path d="M2.88 18.054a35.9 35.9 0 0 1 8.531-16.32.8.8 0 0 1 1.178 0q.25.27.413.455a35.9 35.9 0 0 1 8.118 15.865c-2.141.451-4.34.747-6.584.874l-2.089 4.178a.5.5 0 0 1-.894 0l-2.089-4.178a44 44 0 0 1-6.584-.874m6.698-1.123 1.157.066L12 19.527l1.265-2.53 1.157-.066a42 42 0 0 0 4.227-.454A33.9 33.9 0 0 0 12 4.09a33.9 33.9 0 0 0-6.649 12.387q2.093.334 4.227.454M12 15a3 3 0 1 1 0-6 3 3 0 0 1 0 6m0-2a1 1 0 1 0 0-2 1 1 0 0 0 0 2"/></svg>
|
Before Width: | Height: | Size: 588 B After Width: | Height: | Size: 533 B |
@ -1 +1 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M11.38 2.019a7.5 7.5 0 1 0 10.6 10.6C21.662 17.854 17.316 22 12.001 22 6.477 22 2 17.523 2 12c0-5.315 4.146-9.661 9.38-9.981z"/></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M11.38 2.019a7.5 7.5 0 1 0 10.6 10.6C21.662 17.854 17.316 22 12.001 22 6.477 22 2 17.523 2 12c0-5.315 4.146-9.661 9.38-9.981"/></svg>
|
Before Width: | Height: | Size: 263 B After Width: | Height: | Size: 262 B |
@ -1 +1 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M12 18a6 6 0 1 1 0-12 6 6 0 0 1 0 12zM11 1h2v3h-2V1zm0 19h2v3h-2v-3zM3.515 4.929l1.414-1.414L7.05 5.636 5.636 7.05 3.515 4.93zM16.95 18.364l1.414-1.414 2.121 2.121-1.414 1.414-2.121-2.121zm2.121-14.85 1.414 1.415-2.121 2.121-1.414-1.414 2.121-2.121zM5.636 16.95l1.414 1.414-2.121 2.121-1.414-1.414 2.121-2.121zM23 11v2h-3v-2h3zM4 11v2H1v-2h3z"/></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M12 18a6 6 0 1 1 0-12 6 6 0 0 1 0 12M11 1h2v3h-2zm0 19h2v3h-2zM3.515 4.929l1.414-1.414L7.05 5.636 5.636 7.05zM16.95 18.364l1.414-1.414 2.121 2.121-1.414 1.414zm2.121-14.85 1.414 1.415-2.121 2.121-1.414-1.414 2.121-2.121zM5.636 16.95l1.414 1.414-2.121 2.121-1.414-1.414zM23 11v2h-3v-2zM4 11v2H1v-2z"/></svg>
|
Before Width: | Height: | Size: 480 B After Width: | Height: | Size: 435 B |
@ -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-8z"/></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: 352 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.5l-.5.5zM13 3V1h-1v2.5l.5.5H15V3h-2zm-1 9.5V15h1v-2h2v-1h-2.5l-.5.5zM1 12v1h2v2h1v-2.5l-.5-.5H1zm11-1.5-.5.5h-7l-.5-.5v-5l.5-.5h7l.5.5v5zM10 7H6v2h4V7z"/></svg>
|
<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: 348 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 12h10V4H3v8zm2-6h6v4H5V6zM2 6H1V2.5l.5-.5H5v1H2v3zm13-3.5V6h-1V3h-3V2h3.5l.5.5zM14 10h1v3.5l-.5.5H11v-1h3v-3zM2 13h3v1H1.5l-.5-.5V10h1v3z"/></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: 318 B After Width: | Height: | Size: 283 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 7h6v2H3v2h4v2H3v2h4v2H1V7m10 0h4v2h-4v2h2a2 2 0 0 1 2 2v2c0 1.11-.89 2-2 2H9v-2h4v-2h-2a2 2 0 0 1-2-2V9c0-1.1.9-2 2-2m8 0h2a2 2 0 0 1 2 2v1h-2V9h-2v6h2v-1h2v1c0 1.11-.89 2-2 2h-2a2 2 0 0 1-2-2V9c0-1.1.9-2 2-2Z"/></svg>
|
<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: 381 B After Width: | Height: | Size: 360 B |
1
src/assets/svg/system.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" class="icon" viewBox="0 0 1024 1024"><path d="M554 849.574c0 23.365-18.635 42.307-42 42.307s-42-18.941-42-42.307V662.719c0-23.365 18.635-42.307 42-42.307v-7.051c23.365 0 42 25.993 42 49.358z"/><path d="M893 888.5c0 17.397-14.103 31.5-31.5 31.5h-700c-17.397 0-31.5-14.103-31.5-31.5s14.103-31.5 31.5-31.5h700c17.397 0 31.5 14.103 31.5 31.5m33-714.074C926 135.484 894.686 105 855.744 105H168.256C129.314 105 98 135.484 98 174.426V533h828zM98 630.988C98 669.931 129.314 702 168.256 702h687.488C894.686 702 926 669.931 926 630.988V596H98z"/></svg>
|
After Width: | Height: | Size: 605 B |
@ -1 +1 @@
|
|||||||
<svg width="32" height="32" viewBox="0 0 24 24"><path fill="currentColor" d="M13.79 10.21a1 1 0 0 0 1.42 0 1 1 0 0 0 0-1.42l-2.5-2.5a1 1 0 0 0-.33-.21 1 1 0 0 0-.76 0 1 1 0 0 0-.33.21l-2.5 2.5a1 1 0 0 0 1.42 1.42l.79-.8v5.18l-.79-.8a1 1 0 0 0-1.42 1.42l2.5 2.5a1 1 0 0 0 .33.21.94.94 0 0 0 .76 0 1 1 0 0 0 .33-.21l2.5-2.5a1 1 0 0 0-1.42-1.42l-.79.8V9.41ZM7 4h10a1 1 0 0 0 0-2H7a1 1 0 0 0 0 2Zm10 16H7a1 1 0 0 0 0 2h10a1 1 0 0 0 0-2Z"/></svg>
|
<svg width="32" height="32" viewBox="0 0 24 24"><path fill="currentColor" d="M13.79 10.21a1 1 0 0 0 1.42 0 1 1 0 0 0 0-1.42l-2.5-2.5a1 1 0 0 0-.33-.21 1 1 0 0 0-.76 0 1 1 0 0 0-.33.21l-2.5 2.5a1 1 0 0 0 1.42 1.42l.79-.8v5.18l-.79-.8a1 1 0 0 0-1.42 1.42l2.5 2.5a1 1 0 0 0 .33.21.94.94 0 0 0 .76 0 1 1 0 0 0 .33-.21l2.5-2.5a1 1 0 0 0-1.42-1.42l-.79.8V9.41ZM7 4h10a1 1 0 0 0 0-2H7a1 1 0 0 0 0 2m10 16H7a1 1 0 0 0 0 2h10a1 1 0 0 0 0-2"/></svg>
|
Before Width: | Height: | Size: 441 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 |
@ -1 +1 @@
|
|||||||
<svg width="32" height="32" viewBox="0 0 24 24"><path fill="currentColor" d="M22 4V2H2v2h9v14.17l-5.5-5.5-1.42 1.41L12 22l7.92-7.92-1.42-1.41-5.5 5.5V4h9Z"/></svg>
|
<svg width="32" height="32" viewBox="0 0 24 24"><path fill="currentColor" d="M22 4V2H2v2h9v14.17l-5.5-5.5-1.42 1.41L12 22l7.92-7.92-1.42-1.41-5.5 5.5V4z"/></svg>
|
Before Width: | Height: | Size: 163 B After Width: | Height: | Size: 161 B |
Before Width: | Height: | Size: 235 B After Width: | Height: | Size: 235 B |
1
src/assets/table-bar/settings.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<svg width="32" height="32" viewBox="0 0 24 24"><path fill="currentColor" d="M3.34 17a10 10 0 0 1-.978-2.326 3 3 0 0 0 .002-5.347A10 10 0 0 1 4.865 4.99a3 3 0 0 0 4.631-2.674 10 10 0 0 1 5.007.002 3 3 0 0 0 4.632 2.672A10 10 0 0 1 20.66 7c.433.749.757 1.53.978 2.326a3 3 0 0 0-.002 5.347 10 10 0 0 1-2.501 4.337 3 3 0 0 0-4.631 2.674 10 10 0 0 1-5.007-.002 3 3 0 0 0-4.632-2.672A10 10 0 0 1 3.34 17m5.66.196a5 5 0 0 1 2.25 2.77q.75.071 1.499.001A5 5 0 0 1 15 17.197a5 5 0 0 1 3.525-.565q.435-.614.748-1.298A5 5 0 0 1 18 12c0-1.26.47-2.437 1.273-3.334a8 8 0 0 0-.75-1.298A5 5 0 0 1 15 6.804a5 5 0 0 1-2.25-2.77q-.75-.071-1.499-.001A5 5 0 0 1 9 6.803a5 5 0 0 1-3.525.565 8 8 0 0 0-.748 1.298A5 5 0 0 1 6 12a5 5 0 0 1-1.273 3.334 8 8 0 0 0 .75 1.298A5 5 0 0 1 9 17.196M12 15a3 3 0 1 1 0-6 3 3 0 0 1 0 6m0-2a1 1 0 1 0 0-2 1 1 0 0 0 0 2"/></svg>
|
After Width: | Height: | Size: 840 B |
@ -27,8 +27,13 @@ const addDialog = (options: DialogOptions) => {
|
|||||||
|
|
||||||
/** 关闭弹框 */
|
/** 关闭弹框 */
|
||||||
const closeDialog = (options: DialogOptions, index: number, args?: any) => {
|
const closeDialog = (options: DialogOptions, index: number, args?: any) => {
|
||||||
dialogStore.value.splice(index, 1);
|
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(() => {
|
||||||
|
dialogStore.value.splice(index, 1);
|
||||||
|
}, closeDelay);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -48,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#L18
|
* 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 });
|
||||||
}
|
}
|
||||||
@ -84,13 +107,13 @@ function handleClose(
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<el-dialog
|
<el-dialog
|
||||||
class="pure-dialog"
|
|
||||||
v-for="(options, index) in dialogStore"
|
v-for="(options, index) in dialogStore"
|
||||||
:key="index"
|
:key="index"
|
||||||
v-bind="options"
|
v-bind="options"
|
||||||
v-model="options.visible"
|
v-model="options.visible"
|
||||||
|
class="pure-dialog"
|
||||||
:fullscreen="fullscreen ? true : options?.fullscreen ? true : false"
|
:fullscreen="fullscreen ? true : options?.fullscreen ? true : false"
|
||||||
@close="handleClose(options, index)"
|
@closed="handleClose(options, index)"
|
||||||
@opened="eventsCallBack('open', options, index)"
|
@opened="eventsCallBack('open', options, index)"
|
||||||
@openAutoFocus="eventsCallBack('openAutoFocus', options, index)"
|
@openAutoFocus="eventsCallBack('openAutoFocus', options, index)"
|
||||||
@closeAutoFocus="eventsCallBack('closeAutoFocus', options, index)"
|
@closeAutoFocus="eventsCallBack('closeAutoFocus', 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"
|
||||||
@ -116,15 +149,15 @@ function handleClose(
|
|||||||
options?.fullscreen
|
options?.fullscreen
|
||||||
? ExitFullscreen
|
? ExitFullscreen
|
||||||
: fullscreen
|
: fullscreen
|
||||||
? ExitFullscreen
|
? ExitFullscreen
|
||||||
: Fullscreen
|
: Fullscreen
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
</i>
|
</i>
|
||||||
</div>
|
</div>
|
||||||
<component
|
<component
|
||||||
v-else
|
|
||||||
:is="options?.headerRenderer({ close, titleId, titleClass })"
|
:is="options?.headerRenderer({ close, titleId, titleClass })"
|
||||||
|
v-else
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<component
|
<component
|
||||||
@ -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` 点击右上角关闭按钮或者空白页 */
|
/** `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}
|
||||||
@ -157,7 +203,7 @@ interface DialogOptions extends DialogProps {
|
|||||||
options: DialogOptions;
|
options: DialogOptions;
|
||||||
index: number;
|
index: number;
|
||||||
}) => void;
|
}) => void;
|
||||||
/** `Dialog` 关闭后的回调(只有点击右上角关闭按钮或者空白页关闭页面时才会触发) */
|
/** `Dialog` 关闭后的回调(只有点击右上角关闭按钮或空白页或按下了esc键关闭页面时才会触发) */
|
||||||
close?: ({
|
close?: ({
|
||||||
options,
|
options,
|
||||||
index
|
index
|
||||||
@ -165,7 +211,7 @@ interface DialogOptions extends DialogProps {
|
|||||||
options: DialogOptions;
|
options: DialogOptions;
|
||||||
index: number;
|
index: number;
|
||||||
}) => void;
|
}) => void;
|
||||||
/** `Dialog` 关闭后的回调。 `args` 返回的 `command` 值解析:`cancel` 点击取消按钮、`sure` 点击确定按钮、`close` 点击右上角关闭按钮或者空白页 */
|
/** `Dialog` 关闭后的回调。 `args` 返回的 `command` 值解析:`cancel` 点击取消按钮、`sure` 点击确定按钮、`close` 点击右上角关闭按钮或空白页或按下了esc键 */
|
||||||
closeCallBack?: ({
|
closeCallBack?: ({
|
||||||
options,
|
options,
|
||||||
index,
|
index,
|
||||||
@ -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 { iconType } from "./types";
|
import type { iconType } from "./types";
|
||||||
import { h, defineComponent, 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
|
||||||
@ -33,7 +33,7 @@ export function useRenderIcon(icon: any, attrs?: iconType): Component {
|
|||||||
});
|
});
|
||||||
} else if (typeof icon === "function" || typeof icon?.render === "function") {
|
} else if (typeof icon === "function" || typeof icon?.render === "function") {
|
||||||
// svg
|
// svg
|
||||||
return icon;
|
return attrs ? h(icon, { ...attrs }) : icon;
|
||||||
} else if (typeof icon === "object") {
|
} else if (typeof icon === "object") {
|
||||||
return defineComponent({
|
return defineComponent({
|
||||||
name: "OfflineIcon",
|
name: "OfflineIcon",
|
||||||
@ -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: () => [
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { h, defineComponent } from "vue";
|
import { h, defineComponent } from "vue";
|
||||||
import { Icon as IconifyIcon, addIcon } from "@iconify/vue/dist/offline";
|
import { Icon as IconifyIcon, addIcon } from "@iconify/vue/dist/offline";
|
||||||
|
|
||||||
// Iconify Icon在Vue里本地使用(用于内网环境)https://docs.iconify.design/icon-components/vue/offline.html
|
// Iconify Icon在Vue里本地使用(用于内网环境)
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "IconifyIconOffline",
|
name: "IconifyIconOffline",
|
||||||
components: { IconifyIcon },
|
components: { IconifyIcon },
|
||||||
@ -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 文件中加载,避免在首启动加载
|
||||||
|
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
|
||||||
* 这里存放本地图标,在 src/layout/index.vue 文件中加载,避免在首启动加载
|
import EpHomeFilled from "~icons/ep/home-filled?raw";
|
||||||
*/
|
|
||||||
|
|
||||||
// 本地菜单图标,后端在路由的icon中返回对应的图标字符串并且前端在此处使用addIcon添加即可渲染菜单图标
|
// https://icon-sets.iconify.design/ri/?keyword=ri
|
||||||
import HomeFilled from "@iconify-icons/ep/home-filled";
|
import RiSearchLine from "~icons/ri/search-line?raw";
|
||||||
import InformationLine from "@iconify-icons/ri/information-line";
|
import RiInformationLine from "~icons/ri/information-line?raw";
|
||||||
import Lollipop from "@iconify-icons/ep/lollipop";
|
|
||||||
|
|
||||||
addIcon("homeFilled", HomeFilled);
|
const icons = [
|
||||||
addIcon("informationLine", InformationLine);
|
// Element Plus Icon: https://github.com/element-plus/element-plus-icons
|
||||||
addIcon("lollipop", Lollipop);
|
["ep/home-filled", EpHomeFilled],
|
||||||
|
// Remix Icon: https://github.com/Remix-Design/RemixIcon
|
||||||
|
["ri/search-line", RiSearchLine],
|
||||||
|
["ri/information-line", RiInformationLine]
|
||||||
|
];
|
||||||
|
|
||||||
|
// 本地菜单图标,后端在路由的 icon 中返回对应的图标字符串并且前端在此处使用 addIcon 添加即可渲染菜单图标
|
||||||
|
icons.forEach(([name, icon]) => {
|
||||||
|
addIcon(name as string, getSvgInfo(icon as string));
|
||||||
|
});
|
||||||
|
@ -13,7 +13,8 @@ export interface iconType {
|
|||||||
align?: string;
|
align?: string;
|
||||||
onLoad?: Function;
|
onLoad?: Function;
|
||||||
includes?: Function;
|
includes?: Function;
|
||||||
|
// svg 需要什么SVG属性自行添加
|
||||||
// all icon
|
fill?: string;
|
||||||
|
// all icon
|
||||||
style?: object;
|
style?: object;
|
||||||
}
|
}
|
||||||
|
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,13 +1,29 @@
|
|||||||
import { useEpThemeStoreHook } from "@/store/modules/epTheme";
|
|
||||||
import { delay, getKeyList, cloneDeep } from "@pureadmin/utils";
|
|
||||||
import { defineComponent, ref, computed, type PropType, nextTick } from "vue";
|
|
||||||
|
|
||||||
import Sortable from "sortablejs";
|
import Sortable from "sortablejs";
|
||||||
import DragIcon from "./svg/drag.svg?component";
|
import { useEpThemeStoreHook } from "@/store/modules/epTheme";
|
||||||
import ExpandIcon from "./svg/expand.svg?component";
|
import {
|
||||||
import RefreshIcon from "./svg/refresh.svg?component";
|
type PropType,
|
||||||
import SettingIcon from "./svg/settings.svg?component";
|
ref,
|
||||||
import CollapseIcon from "./svg/collapse.svg?component";
|
unref,
|
||||||
|
computed,
|
||||||
|
nextTick,
|
||||||
|
defineComponent,
|
||||||
|
getCurrentInstance
|
||||||
|
} from "vue";
|
||||||
|
import {
|
||||||
|
delay,
|
||||||
|
cloneDeep,
|
||||||
|
isBoolean,
|
||||||
|
isFunction,
|
||||||
|
getKeyList
|
||||||
|
} from "@pureadmin/utils";
|
||||||
|
|
||||||
|
import Fullscreen from "~icons/ri/fullscreen-fill";
|
||||||
|
import ExitFullscreen from "~icons/ri/fullscreen-exit-fill";
|
||||||
|
import DragIcon from "@/assets/table-bar/drag.svg?component";
|
||||||
|
import ExpandIcon from "@/assets/table-bar/expand.svg?component";
|
||||||
|
import RefreshIcon from "@/assets/table-bar/refresh.svg?component";
|
||||||
|
import SettingIcon from "@/assets/table-bar/settings.svg?component";
|
||||||
|
import CollapseIcon from "@/assets/table-bar/collapse.svg?component";
|
||||||
|
|
||||||
const props = {
|
const props = {
|
||||||
/** 头部最左边的标题 */
|
/** 头部最左边的标题 */
|
||||||
@ -23,22 +39,36 @@ const props = {
|
|||||||
columns: {
|
columns: {
|
||||||
type: Array as PropType<TableColumnList>,
|
type: Array as PropType<TableColumnList>,
|
||||||
default: () => []
|
default: () => []
|
||||||
|
},
|
||||||
|
isExpandAll: {
|
||||||
|
type: Boolean,
|
||||||
|
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 buttonRef = ref();
|
|
||||||
const size = ref("default");
|
const size = ref("default");
|
||||||
const isExpandAll = ref(true);
|
|
||||||
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 filterColumns = cloneDeep(props?.columns).filter(column =>
|
||||||
|
isBoolean(column?.hide)
|
||||||
|
? !column.hide
|
||||||
|
: !(isFunction(column?.hide) && column?.hide())
|
||||||
|
);
|
||||||
let checkColumnList = getKeyList(cloneDeep(props?.columns), "label");
|
let checkColumnList = getKeyList(cloneDeep(props?.columns), "label");
|
||||||
const checkedColumns = ref(checkColumnList);
|
const checkedColumns = ref(getKeyList(cloneDeep(filterColumns), "label"));
|
||||||
const dynamicColumns = ref(cloneDeep(props?.columns));
|
const dynamicColumns = ref(cloneDeep(props?.columns));
|
||||||
|
|
||||||
const getDropdownItemStyle = computed(() => {
|
const getDropdownItemStyle = computed(() => {
|
||||||
@ -56,9 +86,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"
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -86,6 +116,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);
|
||||||
@ -104,6 +139,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 =
|
||||||
@ -120,7 +156,7 @@ export default defineComponent({
|
|||||||
dynamicColumns.value = cloneDeep(props?.columns);
|
dynamicColumns.value = cloneDeep(props?.columns);
|
||||||
checkColumnList = [];
|
checkColumnList = [];
|
||||||
checkColumnList = await getKeyList(cloneDeep(props?.columns), "label");
|
checkColumnList = await getKeyList(cloneDeep(props?.columns), "label");
|
||||||
checkedColumns.value = checkColumnList;
|
checkedColumns.value = getKeyList(cloneDeep(filterColumns), "label");
|
||||||
}
|
}
|
||||||
|
|
||||||
const dropdown = {
|
const dropdown = {
|
||||||
@ -152,9 +188,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",
|
||||||
@ -189,18 +225,40 @@ export default defineComponent({
|
|||||||
: false;
|
: false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const rendTippyProps = (content: string) => {
|
||||||
|
// https://vue-tippy.netlify.app/props
|
||||||
|
return {
|
||||||
|
content,
|
||||||
|
offset: [0, 18],
|
||||||
|
duration: [300, 0],
|
||||||
|
followCursor: true,
|
||||||
|
hideOnClick: "toggle"
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
const reference = {
|
const reference = {
|
||||||
reference: () => (
|
reference: () => (
|
||||||
<SettingIcon
|
<SettingIcon
|
||||||
class={["w-[16px]", iconClass.value]}
|
class={["w-[16px]", iconClass.value]}
|
||||||
onMouseover={e => (buttonRef.value = e.currentTarget)}
|
v-tippy={rendTippyProps("列设置")}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
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()
|
||||||
@ -213,50 +271,48 @@ export default defineComponent({
|
|||||||
) : null}
|
) : null}
|
||||||
{props.tableRef?.size ? (
|
{props.tableRef?.size ? (
|
||||||
<>
|
<>
|
||||||
<el-tooltip
|
<ExpandIcon
|
||||||
effect="dark"
|
class={["w-[16px]", iconClass.value]}
|
||||||
content={isExpandAll.value ? "折叠" : "展开"}
|
style={{
|
||||||
placement="top"
|
transform: isExpandAll.value ? "none" : "rotate(-90deg)"
|
||||||
>
|
}}
|
||||||
<ExpandIcon
|
v-tippy={rendTippyProps(
|
||||||
class={["w-[16px]", iconClass.value]}
|
isExpandAll.value ? "折叠" : "展开"
|
||||||
style={{
|
)}
|
||||||
transform: isExpandAll.value ? "none" : "rotate(-90deg)"
|
onClick={() => onExpand()}
|
||||||
}}
|
/>
|
||||||
onClick={() => onExpand()}
|
|
||||||
/>
|
|
||||||
</el-tooltip>
|
|
||||||
<el-divider direction="vertical" />
|
<el-divider direction="vertical" />
|
||||||
</>
|
</>
|
||||||
) : null}
|
) : null}
|
||||||
<el-tooltip effect="dark" content="刷新" placement="top">
|
<RefreshIcon
|
||||||
<RefreshIcon
|
class={[
|
||||||
class={[
|
"w-[16px]",
|
||||||
"w-[16px]",
|
iconClass.value,
|
||||||
iconClass.value,
|
loading.value ? "animate-spin" : ""
|
||||||
loading.value ? "animate-spin" : ""
|
]}
|
||||||
]}
|
v-tippy={rendTippyProps("刷新")}
|
||||||
onClick={() => onReFresh()}
|
onClick={() => onReFresh()}
|
||||||
/>
|
/>
|
||||||
</el-tooltip>
|
|
||||||
<el-divider direction="vertical" />
|
<el-divider direction="vertical" />
|
||||||
<el-tooltip effect="dark" content="密度" placement="top">
|
<el-dropdown
|
||||||
<el-dropdown v-slots={dropdown} trigger="click">
|
v-slots={dropdown}
|
||||||
<CollapseIcon class={["w-[16px]", iconClass.value]} />
|
trigger="click"
|
||||||
</el-dropdown>
|
v-tippy={rendTippyProps("密度")}
|
||||||
</el-tooltip>
|
>
|
||||||
|
<CollapseIcon class={["w-[16px]", iconClass.value]} />
|
||||||
|
</el-dropdown>
|
||||||
<el-divider direction="vertical" />
|
<el-divider direction="vertical" />
|
||||||
|
|
||||||
<el-popover
|
<el-popover
|
||||||
v-slots={reference}
|
v-slots={reference}
|
||||||
placement="bottom-start"
|
placement="bottom-start"
|
||||||
popper-style={{ padding: 0 }}
|
popper-style={{ padding: 0 }}
|
||||||
width="160"
|
width="200"
|
||||||
trigger="click"
|
trigger="click"
|
||||||
>
|
>
|
||||||
<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}
|
||||||
@ -268,70 +324,63 @@ export default defineComponent({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="pt-[6px] pl-[11px]">
|
<div class="pt-[6px] pl-[11px]">
|
||||||
<el-checkbox-group
|
<el-scrollbar max-height="36vh">
|
||||||
v-model={checkedColumns.value}
|
<el-checkbox-group
|
||||||
onChange={value => handleCheckedColumnsChange(value)}
|
ref={`GroupRef${unref(props.tableKey)}`}
|
||||||
>
|
modelValue={checkedColumns.value}
|
||||||
<el-space
|
onChange={value => handleCheckedColumnsChange(value)}
|
||||||
direction="vertical"
|
|
||||||
alignment="flex-start"
|
|
||||||
size={0}
|
|
||||||
>
|
>
|
||||||
{checkColumnList.map(item => {
|
<el-space
|
||||||
return (
|
direction="vertical"
|
||||||
<div class="flex items-center">
|
alignment="flex-start"
|
||||||
<DragIcon
|
size={0}
|
||||||
class={[
|
>
|
||||||
"drag-btn w-[16px] mr-2",
|
{checkColumnList.map((item, index) => {
|
||||||
isFixedColumn(item)
|
return (
|
||||||
? "!cursor-no-drop"
|
<div class="flex items-center">
|
||||||
: "!cursor-grab"
|
<DragIcon
|
||||||
]}
|
class={[
|
||||||
onMouseenter={(event: {
|
"drag-btn w-[16px] mr-2",
|
||||||
preventDefault: () => void;
|
isFixedColumn(item)
|
||||||
}) => rowDrop(event)}
|
? "cursor-no-drop!"
|
||||||
/>
|
: "cursor-grab!"
|
||||||
<el-checkbox
|
]}
|
||||||
key={item}
|
onMouseenter={(event: {
|
||||||
label={item}
|
preventDefault: () => void;
|
||||||
onChange={value =>
|
}) => rowDrop(event)}
|
||||||
handleCheckColumnListChange(value, item)
|
/>
|
||||||
}
|
<el-checkbox
|
||||||
>
|
key={index}
|
||||||
<span
|
label={item}
|
||||||
title={item}
|
value={item}
|
||||||
class="inline-block w-[120px] truncate hover:text-text_color_primary"
|
onChange={value =>
|
||||||
|
handleCheckColumnListChange(value, item)
|
||||||
|
}
|
||||||
>
|
>
|
||||||
{item}
|
<span
|
||||||
</span>
|
title={item}
|
||||||
</el-checkbox>
|
class="inline-block w-[120px] truncate hover:text-text_color_primary"
|
||||||
</div>
|
>
|
||||||
);
|
{item}
|
||||||
})}
|
</span>
|
||||||
</el-space>
|
</el-checkbox>
|
||||||
</el-checkbox-group>
|
</div>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</el-space>
|
||||||
|
</el-checkbox-group>
|
||||||
|
</el-scrollbar>
|
||||||
</div>
|
</div>
|
||||||
</el-popover>
|
</el-popover>
|
||||||
</div>
|
<el-divider direction="vertical" />
|
||||||
|
|
||||||
<el-tooltip
|
<iconifyIconOffline
|
||||||
popper-options={{
|
class={["w-[16px]", iconClass.value]}
|
||||||
modifiers: [
|
icon={isFullscreen.value ? ExitFullscreen : Fullscreen}
|
||||||
{
|
v-tippy={isFullscreen.value ? "退出全屏" : "全屏"}
|
||||||
name: "computeStyles",
|
onClick={() => onFullscreen()}
|
||||||
options: {
|
/>
|
||||||
adaptive: false,
|
</div>
|
||||||
enabled: false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}}
|
|
||||||
placement="top"
|
|
||||||
virtual-ref={buttonRef.value}
|
|
||||||
virtual-triggering
|
|
||||||
trigger="hover"
|
|
||||||
content="列设置"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
{slots.default({
|
{slots.default({
|
||||||
size: size.value,
|
size: size.value,
|
||||||
|
@ -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 97zm0 284a56 56 0 1 0 56-97 56 56 0 0 0-56 97zM640 228a56 56 0 1 0 112 0 56 56 0 0 0-112 0zm0 284a56 56 0 1 0 112 0 56 56 0 0 0-112 0zM300 844.5a56 56 0 1 0 56-97 56 56 0 0 0-56 97zM640 796a56 56 0 1 0 112 0 56 56 0 0 0-112 0z"/></svg>
|
|
Before Width: | Height: | Size: 398 B |
@ -1 +0,0 @@
|
|||||||
<svg width="32" height="32" viewBox="0 0 24 24"><path fill="currentColor" d="M3.34 17a10.018 10.018 0 0 1-.978-2.326 3 3 0 0 0 .002-5.347A9.99 9.99 0 0 1 4.865 4.99a3 3 0 0 0 4.631-2.674 9.99 9.99 0 0 1 5.007.002 3 3 0 0 0 4.632 2.672A9.99 9.99 0 0 1 20.66 7c.433.749.757 1.53.978 2.326a3 3 0 0 0-.002 5.347 9.99 9.99 0 0 1-2.501 4.337 3 3 0 0 0-4.631 2.674 9.99 9.99 0 0 1-5.007-.002 3 3 0 0 0-4.632-2.672A10.018 10.018 0 0 1 3.34 17zm5.66.196a4.993 4.993 0 0 1 2.25 2.77c.499.047 1 .048 1.499.001A4.993 4.993 0 0 1 15 17.197a4.993 4.993 0 0 1 3.525-.565c.29-.408.54-.843.748-1.298A4.993 4.993 0 0 1 18 12c0-1.26.47-2.437 1.273-3.334a8.126 8.126 0 0 0-.75-1.298A4.993 4.993 0 0 1 15 6.804a4.993 4.993 0 0 1-2.25-2.77c-.499-.047-1-.048-1.499-.001A4.993 4.993 0 0 1 9 6.803a4.993 4.993 0 0 1-3.525.565 7.99 7.99 0 0 0-.748 1.298A4.993 4.993 0 0 1 6 12a4.99 4.99 0 0 1-1.273 3.334 8.126 8.126 0 0 0 .75 1.298A4.993 4.993 0 0 1 9 17.196zM12 15a3 3 0 1 1 0-6 3 3 0 0 1 0 6zm0-2a1 1 0 1 0 0-2 1 1 0 0 0 0 2z"/></svg>
|
|
Before Width: | Height: | Size: 1011 B |
8
src/components/ReSegmented/index.ts
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
import reSegmented from "./src/index";
|
||||||
|
import { withInstall } from "@pureadmin/utils";
|
||||||
|
|
||||||
|
/** 分段控制器组件 */
|
||||||
|
export const ReSegmented = withInstall(reSegmented);
|
||||||
|
|
||||||
|
export default ReSegmented;
|
||||||
|
export type { OptionsType } from "./src/type";
|
156
src/components/ReSegmented/src/index.css
Normal file
@ -0,0 +1,156 @@
|
|||||||
|
.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;
|
||||||
|
display: inline-block;
|
||||||
|
padding: var(--pure-segmented-track-padding);
|
||||||
|
font-size: var(--el-font-size-base);
|
||||||
|
color: rgba(0, 0, 0, 0.65);
|
||||||
|
background-color: rgb(0 0 0 / 4%);
|
||||||
|
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 {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
align-items: stretch;
|
||||||
|
justify-items: flex-start;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pure-segmented-item-selected {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
display: none;
|
||||||
|
width: 0;
|
||||||
|
height: 100%;
|
||||||
|
padding: 4px 0;
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 4px;
|
||||||
|
box-shadow:
|
||||||
|
0 2px 8px -2px rgb(0 0 0 / 5%),
|
||||||
|
0 1px 4px -1px rgb(0 0 0 / 7%),
|
||||||
|
0 0 1px rgb(0 0 0 / 7%);
|
||||||
|
transition:
|
||||||
|
transform 0.5s cubic-bezier(0.645, 0.045, 0.355, 1),
|
||||||
|
width 0.5s cubic-bezier(0.645, 0.045, 0.355, 1);
|
||||||
|
will-change: transform, width;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pure-segmented-item > input {
|
||||||
|
position: absolute;
|
||||||
|
inset-block-start: 0;
|
||||||
|
inset-inline-start: 0;
|
||||||
|
width: 0;
|
||||||
|
height: 0;
|
||||||
|
opacity: 0;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pure-segmented-item-label {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pure-segmented-item-icon svg {
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pure-segmented-item-disabled {
|
||||||
|
color: rgba(0, 0, 0, 0.25);
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
216
src/components/ReSegmented/src/index.tsx
Normal file
@ -0,0 +1,216 @@
|
|||||||
|
import "./index.css";
|
||||||
|
import type { OptionsType } from "./type";
|
||||||
|
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
|
||||||
|
import {
|
||||||
|
useDark,
|
||||||
|
isNumber,
|
||||||
|
isFunction,
|
||||||
|
useResizeObserver
|
||||||
|
} from "@pureadmin/utils";
|
||||||
|
import {
|
||||||
|
type PropType,
|
||||||
|
h,
|
||||||
|
ref,
|
||||||
|
toRef,
|
||||||
|
watch,
|
||||||
|
nextTick,
|
||||||
|
defineComponent,
|
||||||
|
getCurrentInstance
|
||||||
|
} from "vue";
|
||||||
|
|
||||||
|
const props = {
|
||||||
|
options: {
|
||||||
|
type: Array<OptionsType>,
|
||||||
|
default: () => []
|
||||||
|
},
|
||||||
|
/** 默认选中,按照第一个索引为 `0` 的模式,可选(`modelValue`只有传`number`类型时才为响应式) */
|
||||||
|
modelValue: {
|
||||||
|
type: undefined,
|
||||||
|
require: false,
|
||||||
|
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
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export default defineComponent({
|
||||||
|
name: "ReSegmented",
|
||||||
|
props,
|
||||||
|
emits: ["change", "update:modelValue"],
|
||||||
|
setup(props, { emit }) {
|
||||||
|
const width = ref(0);
|
||||||
|
const translateX = ref(0);
|
||||||
|
const { isDark } = useDark();
|
||||||
|
const initStatus = ref(false);
|
||||||
|
const curMouseActive = ref(-1);
|
||||||
|
const segmentedItembg = ref("");
|
||||||
|
const instance = getCurrentInstance()!;
|
||||||
|
const curIndex = isNumber(props.modelValue)
|
||||||
|
? toRef(props, "modelValue")
|
||||||
|
: ref(0);
|
||||||
|
|
||||||
|
function handleChange({ option, index }, event: Event) {
|
||||||
|
if (props.disabled || option.disabled) return;
|
||||||
|
event.preventDefault();
|
||||||
|
isNumber(props.modelValue)
|
||||||
|
? emit("update:modelValue", index)
|
||||||
|
: (curIndex.value = index);
|
||||||
|
segmentedItembg.value = "";
|
||||||
|
emit("change", { index, option });
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleMouseenter({ option, index }, event: Event) {
|
||||||
|
if (props.disabled) return;
|
||||||
|
event.preventDefault();
|
||||||
|
curMouseActive.value = index;
|
||||||
|
if (option.disabled || curIndex.value === index) {
|
||||||
|
segmentedItembg.value = "";
|
||||||
|
} else {
|
||||||
|
segmentedItembg.value = isDark.value
|
||||||
|
? "#1f1f1f"
|
||||||
|
: "rgba(0, 0, 0, 0.06)";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleMouseleave(_, event: Event) {
|
||||||
|
if (props.disabled) return;
|
||||||
|
event.preventDefault();
|
||||||
|
curMouseActive.value = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleInit(index = curIndex.value) {
|
||||||
|
nextTick(() => {
|
||||||
|
const curLabelRef = instance?.proxy?.$refs[`labelRef${index}`] as ElRef;
|
||||||
|
if (!curLabelRef) return;
|
||||||
|
width.value = curLabelRef.clientWidth;
|
||||||
|
translateX.value = curLabelRef.offsetLeft;
|
||||||
|
initStatus.value = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleResizeInit() {
|
||||||
|
useResizeObserver(".pure-segmented", () => {
|
||||||
|
nextTick(() => {
|
||||||
|
handleInit(curIndex.value);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
(props.block || props.resize) && handleResizeInit();
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => curIndex.value,
|
||||||
|
index => {
|
||||||
|
nextTick(() => {
|
||||||
|
handleInit(index);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
{
|
||||||
|
immediate: true
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
watch(() => props.size, handleResizeInit, {
|
||||||
|
immediate: true
|
||||||
|
});
|
||||||
|
|
||||||
|
const rendLabel = () => {
|
||||||
|
return props.options.map((option, index) => {
|
||||||
|
return (
|
||||||
|
<label
|
||||||
|
ref={`labelRef${index}`}
|
||||||
|
class={[
|
||||||
|
"pure-segmented-item",
|
||||||
|
(props.disabled || option?.disabled) &&
|
||||||
|
"pure-segmented-item-disabled"
|
||||||
|
]}
|
||||||
|
style={{
|
||||||
|
background:
|
||||||
|
curMouseActive.value === index ? segmentedItembg.value : "",
|
||||||
|
color: props.disabled
|
||||||
|
? null
|
||||||
|
: !option.disabled &&
|
||||||
|
(curIndex.value === index || curMouseActive.value === index)
|
||||||
|
? isDark.value
|
||||||
|
? "rgba(255, 255, 255, 0.85)"
|
||||||
|
: "rgba(0,0,0,.88)"
|
||||||
|
: ""
|
||||||
|
}}
|
||||||
|
onMouseenter={event => handleMouseenter({ option, index }, event)}
|
||||||
|
onMouseleave={event => handleMouseleave({ option, index }, event)}
|
||||||
|
onClick={event => handleChange({ option, index }, event)}
|
||||||
|
>
|
||||||
|
<input type="radio" name="segmented" />
|
||||||
|
<div
|
||||||
|
class="pure-segmented-item-label"
|
||||||
|
v-tippy={{
|
||||||
|
content: option?.tip,
|
||||||
|
zIndex: 41000
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{option.icon && !isFunction(option.label) ? (
|
||||||
|
<span
|
||||||
|
class="pure-segmented-item-icon"
|
||||||
|
style={{ marginRight: option.label ? "6px" : 0 }}
|
||||||
|
>
|
||||||
|
{h(
|
||||||
|
useRenderIcon(option.icon, {
|
||||||
|
...option?.iconAttrs
|
||||||
|
})
|
||||||
|
)}
|
||||||
|
</span>
|
||||||
|
) : null}
|
||||||
|
{option.label ? (
|
||||||
|
isFunction(option.label) ? (
|
||||||
|
h(option.label)
|
||||||
|
) : (
|
||||||
|
<span>{option.label}</span>
|
||||||
|
)
|
||||||
|
) : null}
|
||||||
|
</div>
|
||||||
|
</label>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
return () => (
|
||||||
|
<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-item-selected"
|
||||||
|
style={{
|
||||||
|
width: `${width.value}px`,
|
||||||
|
transform: `translateX(${translateX.value}px)`,
|
||||||
|
display: initStatus.value ? "block" : "none"
|
||||||
|
}}
|
||||||
|
></div>
|
||||||
|
{rendLabel()}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
20
src/components/ReSegmented/src/type.ts
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import type { VNode, Component } from "vue";
|
||||||
|
import type { iconType } from "@/components/ReIcon/src/types.ts";
|
||||||
|
|
||||||
|
export interface OptionsType {
|
||||||
|
/** 文字 */
|
||||||
|
label?: string | (() => VNode | Component);
|
||||||
|
/**
|
||||||
|
* @description 图标,采用平台内置的 `useRenderIcon` 函数渲染
|
||||||
|
* @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;
|
||||||
|
/** 图标属性、样式配置 */
|
||||||
|
iconAttrs?: iconType;
|
||||||
|
/** 值 */
|
||||||
|
value?: any;
|
||||||
|
/** 是否禁用 */
|
||||||
|
disabled?: boolean;
|
||||||
|
/** `tooltip` 提示 */
|
||||||
|
tip?: string;
|
||||||
|
}
|
7
src/components/ReText/index.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import reText from "./src/index.vue";
|
||||||
|
import { withInstall } from "@pureadmin/utils";
|
||||||
|
|
||||||
|
/** 支持`Tooltip`提示的文本省略组件 */
|
||||||
|
export const ReText = withInstall(reText);
|
||||||
|
|
||||||
|
export default ReText;
|
69
src/components/ReText/src/index.vue
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { h, onMounted, ref } from "vue";
|
||||||
|
import { type TippyOptions, type TippyContent, useTippy } from "vue-tippy";
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
name: "ReText"
|
||||||
|
});
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
// 行数
|
||||||
|
lineClamp: {
|
||||||
|
type: [String, Number]
|
||||||
|
},
|
||||||
|
tippyProps: {
|
||||||
|
type: Object as PropType<TippyOptions>,
|
||||||
|
default: () => ({})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const slots = defineSlots<{
|
||||||
|
content: () => TippyContent;
|
||||||
|
default: () => any;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const textRef = ref();
|
||||||
|
const tippyFunc = ref();
|
||||||
|
|
||||||
|
const isTextEllipsis = (el: HTMLElement) => {
|
||||||
|
if (!props.lineClamp) {
|
||||||
|
// 单行省略判断
|
||||||
|
return el.scrollWidth > el.clientWidth;
|
||||||
|
} else {
|
||||||
|
// 多行省略判断
|
||||||
|
return el.scrollHeight > el.clientHeight;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const getTippyProps = () => ({
|
||||||
|
content: h(slots.content || slots.default),
|
||||||
|
...props.tippyProps
|
||||||
|
});
|
||||||
|
|
||||||
|
function handleHover(event: MouseEvent) {
|
||||||
|
if (isTextEllipsis(event.target as HTMLElement)) {
|
||||||
|
tippyFunc.value.setProps(getTippyProps());
|
||||||
|
tippyFunc.value.enable();
|
||||||
|
} else {
|
||||||
|
tippyFunc.value.disable();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
tippyFunc.value = useTippy(textRef.value?.$el, getTippyProps());
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<el-text
|
||||||
|
v-bind="{
|
||||||
|
truncated: !lineClamp,
|
||||||
|
lineClamp,
|
||||||
|
...$attrs
|
||||||
|
}"
|
||||||
|
ref="textRef"
|
||||||
|
@mouseover.self="handleHover"
|
||||||
|
>
|
||||||
|
<slot />
|
||||||
|
</el-text>
|
||||||
|
</template>
|
@ -1,5 +1,5 @@
|
|||||||
import { 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;
|
||||||
@ -8,7 +8,7 @@ const setConfig = (cfg?: unknown) => {
|
|||||||
config = Object.assign(config, cfg);
|
config = Object.assign(config, cfg);
|
||||||
};
|
};
|
||||||
|
|
||||||
const getConfig = (key?: string): ServerConfigs => {
|
const getConfig = (key?: string): PlatformConfigs => {
|
||||||
if (typeof key === "string") {
|
if (typeof key === "string") {
|
||||||
const arr = key.split(".");
|
const arr = key.split(".");
|
||||||
if (arr && arr.length) {
|
if (arr && arr.length) {
|
||||||
@ -27,15 +27,15 @@ const getConfig = (key?: string): ServerConfigs => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** 获取项目动态全局配置 */
|
/** 获取项目动态全局配置 */
|
||||||
export const getServerConfig = async (app: App): Promise<undefined> => {
|
export const getPlatformConfig = async (app: App): Promise<undefined> => {
|
||||||
app.config.globalProperties.$config = getConfig();
|
app.config.globalProperties.$config = getConfig();
|
||||||
return axios({
|
return axios({
|
||||||
method: "get",
|
method: "get",
|
||||||
url: `${VITE_PUBLIC_PATH}serverConfig.json`
|
url: `${VITE_PUBLIC_PATH}platform-config.json`
|
||||||
})
|
})
|
||||||
.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;
|
||||||
@ -45,7 +45,7 @@ export const getServerConfig = async (app: App): Promise<undefined> => {
|
|||||||
return $config;
|
return $config;
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
throw "请在public文件夹下添加serverConfig.json配置文件";
|
throw "请在public文件夹下添加platform-config.json配置文件";
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { hasAuth } from "@/router/utils";
|
import { hasAuth } from "@/router/utils";
|
||||||
import { Directive, type 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);
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
import { message } from "@/utils/message";
|
import { message } from "@/utils/message";
|
||||||
import { useEventListener } from "@vueuse/core";
|
import { useEventListener } from "@vueuse/core";
|
||||||
import { copyTextToClipboard } from "@pureadmin/utils";
|
import { copyTextToClipboard } from "@pureadmin/utils";
|
||||||
import { Directive, type 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;
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
export * from "./auth";
|
export * from "./auth";
|
||||||
export * from "./copy";
|
export * from "./copy";
|
||||||
|
export * from "./longpress";
|
||||||
export * from "./optimize";
|
export * from "./optimize";
|
||||||
|
export * from "./perms";
|
||||||
|
export * from "./ripple";
|
||||||
|
63
src/directives/longpress/index.ts
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
import { useEventListener } from "@vueuse/core";
|
||||||
|
import type { Directive, DirectiveBinding } from "vue";
|
||||||
|
import { subBefore, subAfter, isFunction } from "@pureadmin/utils";
|
||||||
|
|
||||||
|
export const longpress: Directive = {
|
||||||
|
mounted(el: HTMLElement, binding: DirectiveBinding<Function>) {
|
||||||
|
const cb = binding.value;
|
||||||
|
if (cb && isFunction(cb)) {
|
||||||
|
let timer = null;
|
||||||
|
let interTimer = null;
|
||||||
|
let num = 500;
|
||||||
|
let interNum = null;
|
||||||
|
const isInter = binding?.arg?.includes(":") ?? false;
|
||||||
|
|
||||||
|
if (isInter) {
|
||||||
|
num = Number(subBefore(binding.arg, ":"));
|
||||||
|
interNum = Number(subAfter(binding.arg, ":"));
|
||||||
|
} else if (binding.arg) {
|
||||||
|
num = Number(binding.arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
const clear = () => {
|
||||||
|
if (timer) {
|
||||||
|
clearTimeout(timer);
|
||||||
|
timer = null;
|
||||||
|
}
|
||||||
|
if (interTimer) {
|
||||||
|
clearInterval(interTimer);
|
||||||
|
interTimer = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const onDownInter = (ev: PointerEvent) => {
|
||||||
|
ev.preventDefault();
|
||||||
|
if (interTimer === null) {
|
||||||
|
interTimer = setInterval(() => cb(), interNum);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const onDown = (ev: PointerEvent) => {
|
||||||
|
clear();
|
||||||
|
ev.preventDefault();
|
||||||
|
if (timer === null) {
|
||||||
|
timer = isInter
|
||||||
|
? setTimeout(() => {
|
||||||
|
cb();
|
||||||
|
onDownInter(ev);
|
||||||
|
}, num)
|
||||||
|
: setTimeout(() => cb(), num);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Register using addEventListener on mounted, and removeEventListener automatically on unmounted
|
||||||
|
useEventListener(el, "pointerdown", onDown);
|
||||||
|
useEventListener(el, "pointerup", clear);
|
||||||
|
useEventListener(el, "pointerleave", clear);
|
||||||
|
} else {
|
||||||
|
throw new Error(
|
||||||
|
'[Directive: longpress]: need callback and callback must be a function! Like v-longpress="callback"'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
@ -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 { Directive, type 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']\""
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
48
src/directives/ripple/index.scss
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/* stylelint-disable-next-line scss/dollar-variable-colon-space-after */
|
||||||
|
$ripple-animation-transition-in:
|
||||||
|
transform 0.4s cubic-bezier(0, 0, 0.2, 1),
|
||||||
|
opacity 0.2s cubic-bezier(0, 0, 0.2, 1) !default;
|
||||||
|
$ripple-animation-transition-out: opacity 0.5s cubic-bezier(0, 0, 0.2, 1) !default;
|
||||||
|
$ripple-animation-visible-opacity: 0.25 !default;
|
||||||
|
|
||||||
|
.v-ripple {
|
||||||
|
&__container {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
pointer-events: none;
|
||||||
|
border-radius: inherit;
|
||||||
|
contain: strict;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__animation {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
pointer-events: none;
|
||||||
|
background: currentcolor;
|
||||||
|
border-radius: 50%;
|
||||||
|
opacity: 0;
|
||||||
|
will-change: transform, opacity;
|
||||||
|
|
||||||
|
&--enter {
|
||||||
|
opacity: 0;
|
||||||
|
transition: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
&--in {
|
||||||
|
opacity: $ripple-animation-visible-opacity;
|
||||||
|
transition: $ripple-animation-transition-in;
|
||||||
|
}
|
||||||
|
|
||||||
|
&--out {
|
||||||
|
opacity: 0;
|
||||||
|
transition: $ripple-animation-transition-out;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
229
src/directives/ripple/index.ts
Normal file
@ -0,0 +1,229 @@
|
|||||||
|
import "./index.scss";
|
||||||
|
import { isObject } from "@pureadmin/utils";
|
||||||
|
import type { Directive, DirectiveBinding } from "vue";
|
||||||
|
|
||||||
|
export interface RippleOptions {
|
||||||
|
/** 自定义`ripple`颜色,支持`tailwindcss` */
|
||||||
|
class?: string;
|
||||||
|
/** 是否从中心扩散 */
|
||||||
|
center?: boolean;
|
||||||
|
circle?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RippleDirectiveBinding
|
||||||
|
extends Omit<DirectiveBinding, "modifiers" | "value"> {
|
||||||
|
value?: boolean | { class: string };
|
||||||
|
modifiers: {
|
||||||
|
center?: boolean;
|
||||||
|
circle?: boolean;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function transform(el: HTMLElement, value: string) {
|
||||||
|
el.style.transform = value;
|
||||||
|
el.style.webkitTransform = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
const calculate = (
|
||||||
|
e: PointerEvent,
|
||||||
|
el: HTMLElement,
|
||||||
|
value: RippleOptions = {}
|
||||||
|
) => {
|
||||||
|
const offset = el.getBoundingClientRect();
|
||||||
|
|
||||||
|
// 获取点击位置距离 el 的垂直和水平距离
|
||||||
|
const localX = e.clientX - offset.left;
|
||||||
|
const localY = e.clientY - offset.top;
|
||||||
|
|
||||||
|
let radius = 0;
|
||||||
|
let scale = 0.3;
|
||||||
|
// 计算点击位置到 el 顶点最远距离,即为圆的最大半径(勾股定理)
|
||||||
|
if (el._ripple?.circle) {
|
||||||
|
scale = 0.15;
|
||||||
|
radius = el.clientWidth / 2;
|
||||||
|
radius = value.center
|
||||||
|
? radius
|
||||||
|
: radius + Math.sqrt((localX - radius) ** 2 + (localY - radius) ** 2) / 4;
|
||||||
|
} else {
|
||||||
|
radius = Math.sqrt(el.clientWidth ** 2 + el.clientHeight ** 2) / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 中心点坐标
|
||||||
|
const centerX = `${(el.clientWidth - radius * 2) / 2}px`;
|
||||||
|
const centerY = `${(el.clientHeight - radius * 2) / 2}px`;
|
||||||
|
|
||||||
|
// 点击位置坐标
|
||||||
|
const x = value.center ? centerX : `${localX - radius}px`;
|
||||||
|
const y = value.center ? centerY : `${localY - radius}px`;
|
||||||
|
|
||||||
|
return { radius, scale, x, y, centerX, centerY };
|
||||||
|
};
|
||||||
|
|
||||||
|
const ripples = {
|
||||||
|
show(e: PointerEvent, el: HTMLElement, value: RippleOptions = {}) {
|
||||||
|
if (!el?._ripple?.enabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建 ripple 元素和 ripple 父元素
|
||||||
|
const container = document.createElement("span");
|
||||||
|
const animation = document.createElement("span");
|
||||||
|
|
||||||
|
container.appendChild(animation);
|
||||||
|
container.className = "v-ripple__container";
|
||||||
|
|
||||||
|
if (value.class) {
|
||||||
|
container.className += ` ${value.class}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
const { radius, scale, x, y, centerX, centerY } = calculate(e, el, value);
|
||||||
|
|
||||||
|
// ripple 圆大小
|
||||||
|
const size = `${radius * 2}px`;
|
||||||
|
|
||||||
|
animation.className = "v-ripple__animation";
|
||||||
|
animation.style.width = size;
|
||||||
|
animation.style.height = size;
|
||||||
|
|
||||||
|
el.appendChild(container);
|
||||||
|
|
||||||
|
// 获取目标元素样式表
|
||||||
|
const computed = window.getComputedStyle(el);
|
||||||
|
// 防止 position 被覆盖导致 ripple 位置有问题
|
||||||
|
if (computed && computed.position === "static") {
|
||||||
|
el.style.position = "relative";
|
||||||
|
el.dataset.previousPosition = "static";
|
||||||
|
}
|
||||||
|
|
||||||
|
animation.classList.add("v-ripple__animation--enter");
|
||||||
|
animation.classList.add("v-ripple__animation--visible");
|
||||||
|
transform(
|
||||||
|
animation,
|
||||||
|
`translate(${x}, ${y}) scale3d(${scale},${scale},${scale})`
|
||||||
|
);
|
||||||
|
animation.dataset.activated = String(performance.now());
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
animation.classList.remove("v-ripple__animation--enter");
|
||||||
|
animation.classList.add("v-ripple__animation--in");
|
||||||
|
transform(animation, `translate(${centerX}, ${centerY}) scale3d(1,1,1)`);
|
||||||
|
}, 0);
|
||||||
|
},
|
||||||
|
|
||||||
|
hide(el: HTMLElement | null) {
|
||||||
|
if (!el?._ripple?.enabled) return;
|
||||||
|
|
||||||
|
const ripples = el.getElementsByClassName("v-ripple__animation");
|
||||||
|
|
||||||
|
if (ripples.length === 0) return;
|
||||||
|
const animation = ripples[ripples.length - 1] as HTMLElement;
|
||||||
|
|
||||||
|
if (animation.dataset.isHiding) return;
|
||||||
|
else animation.dataset.isHiding = "true";
|
||||||
|
|
||||||
|
const diff = performance.now() - Number(animation.dataset.activated);
|
||||||
|
const delay = Math.max(250 - diff, 0);
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
animation.classList.remove("v-ripple__animation--in");
|
||||||
|
animation.classList.add("v-ripple__animation--out");
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
const ripples = el.getElementsByClassName("v-ripple__animation");
|
||||||
|
if (ripples.length === 1 && el.dataset.previousPosition) {
|
||||||
|
el.style.position = el.dataset.previousPosition;
|
||||||
|
delete el.dataset.previousPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (animation.parentNode?.parentNode === el)
|
||||||
|
el.removeChild(animation.parentNode);
|
||||||
|
}, 300);
|
||||||
|
}, delay);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
function isRippleEnabled(value: any): value is true {
|
||||||
|
return typeof value === "undefined" || !!value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function rippleShow(e: PointerEvent) {
|
||||||
|
const value: RippleOptions = {};
|
||||||
|
const element = e.currentTarget as HTMLElement | undefined;
|
||||||
|
|
||||||
|
if (!element?._ripple || element._ripple.touched) return;
|
||||||
|
|
||||||
|
value.center = element._ripple.centered;
|
||||||
|
if (element._ripple.class) {
|
||||||
|
value.class = element._ripple.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
ripples.show(e, element, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
function rippleHide(e: Event) {
|
||||||
|
const element = e.currentTarget as HTMLElement | null;
|
||||||
|
if (!element?._ripple) return;
|
||||||
|
|
||||||
|
window.setTimeout(() => {
|
||||||
|
if (element._ripple) {
|
||||||
|
element._ripple.touched = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ripples.hide(element);
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateRipple(
|
||||||
|
el: HTMLElement,
|
||||||
|
binding: RippleDirectiveBinding,
|
||||||
|
wasEnabled: boolean
|
||||||
|
) {
|
||||||
|
const { value, modifiers } = binding;
|
||||||
|
const enabled = isRippleEnabled(value);
|
||||||
|
if (!enabled) {
|
||||||
|
ripples.hide(el);
|
||||||
|
}
|
||||||
|
|
||||||
|
el._ripple = el._ripple ?? {};
|
||||||
|
el._ripple.enabled = enabled;
|
||||||
|
el._ripple.centered = modifiers.center;
|
||||||
|
el._ripple.circle = modifiers.circle;
|
||||||
|
if (isObject(value) && value.class) {
|
||||||
|
el._ripple.class = value.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (enabled && !wasEnabled) {
|
||||||
|
el.addEventListener("pointerdown", rippleShow);
|
||||||
|
el.addEventListener("pointerup", rippleHide);
|
||||||
|
} else if (!enabled && wasEnabled) {
|
||||||
|
removeListeners(el);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeListeners(el: HTMLElement) {
|
||||||
|
el.removeEventListener("pointerdown", rippleShow);
|
||||||
|
el.removeEventListener("pointerup", rippleHide);
|
||||||
|
}
|
||||||
|
|
||||||
|
function mounted(el: HTMLElement, binding: RippleDirectiveBinding) {
|
||||||
|
updateRipple(el, binding, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
function unmounted(el: HTMLElement) {
|
||||||
|
delete el._ripple;
|
||||||
|
removeListeners(el);
|
||||||
|
}
|
||||||
|
|
||||||
|
function updated(el: HTMLElement, binding: RippleDirectiveBinding) {
|
||||||
|
if (binding.value === binding.oldValue) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const wasEnabled = isRippleEnabled(binding.oldValue);
|
||||||
|
updateRipple(el, binding, wasEnabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const Ripple: Directive = {
|
||||||
|
mounted,
|
||||||
|
unmounted,
|
||||||
|
updated
|
||||||
|
};
|
@ -1,148 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import { useGlobal } from "@pureadmin/utils";
|
|
||||||
import backTop from "@/assets/svg/back_top.svg?component";
|
|
||||||
import { h, computed, Transition, defineComponent } from "vue";
|
|
||||||
import { usePermissionStoreHook } from "@/store/modules/permission";
|
|
||||||
|
|
||||||
const props = defineProps({
|
|
||||||
fixedHeader: Boolean
|
|
||||||
});
|
|
||||||
|
|
||||||
const { $storage, $config } = useGlobal<GlobalPropertiesApi>();
|
|
||||||
|
|
||||||
const keepAlive = computed(() => {
|
|
||||||
return $config?.KeepAlive;
|
|
||||||
});
|
|
||||||
|
|
||||||
const transitions = computed(() => {
|
|
||||||
return route => {
|
|
||||||
return route.meta.transition;
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
const hideTabs = computed(() => {
|
|
||||||
return $storage?.configure.hideTabs;
|
|
||||||
});
|
|
||||||
|
|
||||||
const layout = computed(() => {
|
|
||||||
return $storage?.layout.layout === "vertical";
|
|
||||||
});
|
|
||||||
|
|
||||||
const getSectionStyle = computed(() => {
|
|
||||||
return [
|
|
||||||
hideTabs.value && layout ? "padding-top: 48px;" : "",
|
|
||||||
!hideTabs.value && layout ? "padding-top: 85px;" : "",
|
|
||||||
hideTabs.value && !layout.value ? "padding-top: 48px" : "",
|
|
||||||
!hideTabs.value && !layout.value ? "padding-top: 85px;" : "",
|
|
||||||
props.fixedHeader ? "" : "padding-top: 0;"
|
|
||||||
];
|
|
||||||
});
|
|
||||||
|
|
||||||
const transitionMain = defineComponent({
|
|
||||||
render() {
|
|
||||||
return h(
|
|
||||||
Transition,
|
|
||||||
{
|
|
||||||
name:
|
|
||||||
transitions.value(this.route) &&
|
|
||||||
this.route.meta.transition.enterTransition
|
|
||||||
? "pure-classes-transition"
|
|
||||||
: (transitions.value(this.route) &&
|
|
||||||
this.route.meta.transition.name) ||
|
|
||||||
"fade-transform",
|
|
||||||
enterActiveClass:
|
|
||||||
transitions.value(this.route) &&
|
|
||||||
`animate__animated ${this.route.meta.transition.enterTransition}`,
|
|
||||||
leaveActiveClass:
|
|
||||||
transitions.value(this.route) &&
|
|
||||||
`animate__animated ${this.route.meta.transition.leaveTransition}`,
|
|
||||||
mode: "out-in",
|
|
||||||
appear: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
default: () => [this.$slots.default()]
|
|
||||||
}
|
|
||||||
);
|
|
||||||
},
|
|
||||||
props: {
|
|
||||||
route: {
|
|
||||||
type: undefined,
|
|
||||||
required: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<section
|
|
||||||
:class="[props.fixedHeader ? 'app-main' : 'app-main-nofixed-header']"
|
|
||||||
:style="getSectionStyle"
|
|
||||||
>
|
|
||||||
<router-view>
|
|
||||||
<template #default="{ Component, route }">
|
|
||||||
<el-scrollbar v-if="props.fixedHeader">
|
|
||||||
<el-backtop title="回到顶部" target=".app-main .el-scrollbar__wrap">
|
|
||||||
<backTop />
|
|
||||||
</el-backtop>
|
|
||||||
<transitionMain :route="route">
|
|
||||||
<keep-alive
|
|
||||||
v-if="keepAlive"
|
|
||||||
:include="usePermissionStoreHook().cachePageList"
|
|
||||||
>
|
|
||||||
<component
|
|
||||||
:is="Component"
|
|
||||||
:key="route.fullPath"
|
|
||||||
class="main-content"
|
|
||||||
/>
|
|
||||||
</keep-alive>
|
|
||||||
<component
|
|
||||||
v-else
|
|
||||||
:is="Component"
|
|
||||||
:key="route.fullPath"
|
|
||||||
class="main-content"
|
|
||||||
/>
|
|
||||||
</transitionMain>
|
|
||||||
</el-scrollbar>
|
|
||||||
<div v-else>
|
|
||||||
<transitionMain :route="route">
|
|
||||||
<keep-alive
|
|
||||||
v-if="keepAlive"
|
|
||||||
:include="usePermissionStoreHook().cachePageList"
|
|
||||||
>
|
|
||||||
<component
|
|
||||||
:is="Component"
|
|
||||||
:key="route.fullPath"
|
|
||||||
class="main-content"
|
|
||||||
/>
|
|
||||||
</keep-alive>
|
|
||||||
<component
|
|
||||||
v-else
|
|
||||||
:is="Component"
|
|
||||||
:key="route.fullPath"
|
|
||||||
class="main-content"
|
|
||||||
/>
|
|
||||||
</transitionMain>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</router-view>
|
|
||||||
</section>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.app-main {
|
|
||||||
position: relative;
|
|
||||||
width: 100%;
|
|
||||||
height: 100vh;
|
|
||||||
overflow-x: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.app-main-nofixed-header {
|
|
||||||
position: relative;
|
|
||||||
width: 100%;
|
|
||||||
min-height: 100vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
.main-content {
|
|
||||||
margin: 24px;
|
|
||||||
}
|
|
||||||
</style>
|
|
213
src/layout/components/lay-content/index.vue
Normal file
@ -0,0 +1,213 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import LayFrame from "../lay-frame/index.vue";
|
||||||
|
import LayFooter from "../lay-footer/index.vue";
|
||||||
|
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 { usePermissionStoreHook } from "@/store/modules/permission";
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
fixedHeader: Boolean
|
||||||
|
});
|
||||||
|
|
||||||
|
const { showModel } = useTags();
|
||||||
|
const { $storage, $config } = useGlobal<GlobalPropertiesApi>();
|
||||||
|
|
||||||
|
const isKeepAlive = computed(() => {
|
||||||
|
return $config?.KeepAlive;
|
||||||
|
});
|
||||||
|
|
||||||
|
const transitions = computed(() => {
|
||||||
|
return route => {
|
||||||
|
return route.meta.transition;
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
const hideTabs = computed(() => {
|
||||||
|
return $storage?.configure.hideTabs;
|
||||||
|
});
|
||||||
|
|
||||||
|
const hideFooter = computed(() => {
|
||||||
|
return $storage?.configure.hideFooter;
|
||||||
|
});
|
||||||
|
|
||||||
|
const stretch = computed(() => {
|
||||||
|
return $storage?.configure.stretch;
|
||||||
|
});
|
||||||
|
|
||||||
|
const layout = computed(() => {
|
||||||
|
return $storage?.layout.layout === "vertical";
|
||||||
|
});
|
||||||
|
|
||||||
|
const getMainWidth = computed(() => {
|
||||||
|
return isNumber(stretch.value)
|
||||||
|
? stretch.value + "px"
|
||||||
|
: stretch.value
|
||||||
|
? "1440px"
|
||||||
|
: "100%";
|
||||||
|
});
|
||||||
|
|
||||||
|
const getSectionStyle = computed(() => {
|
||||||
|
return [
|
||||||
|
hideTabs.value && layout ? "padding-top: 48px;" : "",
|
||||||
|
!hideTabs.value && layout
|
||||||
|
? showModel.value == "chrome"
|
||||||
|
? "padding-top: 85px;"
|
||||||
|
: "padding-top: 81px;"
|
||||||
|
: "",
|
||||||
|
hideTabs.value && !layout.value ? "padding-top: 48px;" : "",
|
||||||
|
!hideTabs.value && !layout.value
|
||||||
|
? showModel.value == "chrome"
|
||||||
|
? "padding-top: 85px;"
|
||||||
|
: "padding-top: 81px;"
|
||||||
|
: "",
|
||||||
|
props.fixedHeader
|
||||||
|
? ""
|
||||||
|
: `padding-top: 0;${
|
||||||
|
hideTabs.value
|
||||||
|
? "min-height: calc(100vh - 48px);"
|
||||||
|
: "min-height: calc(100vh - 86px);"
|
||||||
|
}`
|
||||||
|
];
|
||||||
|
});
|
||||||
|
|
||||||
|
const transitionMain = defineComponent({
|
||||||
|
props: {
|
||||||
|
route: {
|
||||||
|
type: undefined,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
render() {
|
||||||
|
const transitionName =
|
||||||
|
transitions.value(this.route)?.name || "fade-transform";
|
||||||
|
const enterTransition = transitions.value(this.route)?.enterTransition;
|
||||||
|
const leaveTransition = transitions.value(this.route)?.leaveTransition;
|
||||||
|
return h(
|
||||||
|
Transition,
|
||||||
|
{
|
||||||
|
name: enterTransition ? "pure-classes-transition" : transitionName,
|
||||||
|
enterActiveClass: enterTransition
|
||||||
|
? `animate__animated ${enterTransition}`
|
||||||
|
: undefined,
|
||||||
|
leaveActiveClass: leaveTransition
|
||||||
|
? `animate__animated ${leaveTransition}`
|
||||||
|
: undefined,
|
||||||
|
mode: "out-in",
|
||||||
|
appear: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
default: () => [this.$slots.default()]
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<section
|
||||||
|
:class="[fixedHeader ? 'app-main' : 'app-main-nofixed-header']"
|
||||||
|
:style="getSectionStyle"
|
||||||
|
>
|
||||||
|
<router-view>
|
||||||
|
<template #default="{ Component, route }">
|
||||||
|
<LayFrame :currComp="Component" :currRoute="route">
|
||||||
|
<template #default="{ Comp, fullPath, frameInfo }">
|
||||||
|
<el-scrollbar
|
||||||
|
v-if="fixedHeader"
|
||||||
|
:wrap-style="{
|
||||||
|
display: 'flex',
|
||||||
|
'flex-wrap': 'wrap',
|
||||||
|
'max-width': getMainWidth,
|
||||||
|
margin: '0 auto',
|
||||||
|
transition: 'all 300ms cubic-bezier(0.4, 0, 0.2, 1)'
|
||||||
|
}"
|
||||||
|
:view-style="{
|
||||||
|
display: 'flex',
|
||||||
|
flex: 'auto',
|
||||||
|
overflow: 'hidden',
|
||||||
|
'flex-direction': 'column'
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
<el-backtop
|
||||||
|
title="回到顶部"
|
||||||
|
target=".app-main .el-scrollbar__wrap"
|
||||||
|
>
|
||||||
|
<BackTopIcon />
|
||||||
|
</el-backtop>
|
||||||
|
<div class="grow">
|
||||||
|
<transitionMain :route="route">
|
||||||
|
<keep-alive
|
||||||
|
v-if="isKeepAlive"
|
||||||
|
:include="usePermissionStoreHook().cachePageList"
|
||||||
|
>
|
||||||
|
<component
|
||||||
|
:is="Comp"
|
||||||
|
:key="fullPath"
|
||||||
|
:frameInfo="frameInfo"
|
||||||
|
class="main-content"
|
||||||
|
/>
|
||||||
|
</keep-alive>
|
||||||
|
<component
|
||||||
|
:is="Comp"
|
||||||
|
v-else
|
||||||
|
:key="fullPath"
|
||||||
|
:frameInfo="frameInfo"
|
||||||
|
class="main-content"
|
||||||
|
/>
|
||||||
|
</transitionMain>
|
||||||
|
</div>
|
||||||
|
<LayFooter v-if="!hideFooter" />
|
||||||
|
</el-scrollbar>
|
||||||
|
<div v-else class="grow">
|
||||||
|
<transitionMain :route="route">
|
||||||
|
<keep-alive
|
||||||
|
v-if="isKeepAlive"
|
||||||
|
:include="usePermissionStoreHook().cachePageList"
|
||||||
|
>
|
||||||
|
<component
|
||||||
|
:is="Comp"
|
||||||
|
:key="fullPath"
|
||||||
|
:frameInfo="frameInfo"
|
||||||
|
class="main-content"
|
||||||
|
/>
|
||||||
|
</keep-alive>
|
||||||
|
<component
|
||||||
|
:is="Comp"
|
||||||
|
v-else
|
||||||
|
:key="fullPath"
|
||||||
|
:frameInfo="frameInfo"
|
||||||
|
class="main-content"
|
||||||
|
/>
|
||||||
|
</transitionMain>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</LayFrame>
|
||||||
|
</template>
|
||||||
|
</router-view>
|
||||||
|
|
||||||
|
<!-- 页脚 -->
|
||||||
|
<LayFooter v-if="!hideFooter && !fixedHeader" />
|
||||||
|
</section>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.app-main {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
height: 100vh;
|
||||||
|
overflow-x: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.app-main-nofixed-header {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-content {
|
||||||
|
margin: 24px;
|
||||||
|
}
|
||||||
|
</style>
|
31
src/layout/components/lay-footer/index.vue
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { getConfig } from "@/config";
|
||||||
|
|
||||||
|
const TITLE = getConfig("Title");
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<footer
|
||||||
|
class="layout-footer text-[rgba(0,0,0,0.6)] dark:text-[rgba(220,220,242,0.8)]"
|
||||||
|
>
|
||||||
|
Copyright © 2020-present
|
||||||
|
<a
|
||||||
|
class="hover:text-primary"
|
||||||
|
href="https://github.com/pure-admin"
|
||||||
|
target="_blank"
|
||||||
|
>
|
||||||
|
{{ TITLE }}
|
||||||
|
</a>
|
||||||
|
</footer>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.layout-footer {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 100%;
|
||||||
|
padding: 0 0 8px;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
</style>
|
79
src/layout/components/lay-frame/index.vue
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { getConfig } from "@/config";
|
||||||
|
import { useMultiFrame } from "@/layout/hooks/useMultiFrame";
|
||||||
|
import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
|
||||||
|
import { type Component, shallowRef, watch, computed } from "vue";
|
||||||
|
import { type RouteRecordRaw, RouteLocationNormalizedLoaded } from "vue-router";
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
currRoute: RouteLocationNormalizedLoaded;
|
||||||
|
currComp: Component;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const compList = shallowRef([]);
|
||||||
|
const { setMap, getMap, MAP, delMap } = useMultiFrame();
|
||||||
|
|
||||||
|
const keep = computed(() => {
|
||||||
|
return (
|
||||||
|
getConfig().KeepAlive &&
|
||||||
|
props.currRoute.meta?.keepAlive &&
|
||||||
|
!!props.currRoute.meta?.frameSrc
|
||||||
|
);
|
||||||
|
});
|
||||||
|
// 避免重新渲染 LayFrame
|
||||||
|
const normalComp = computed(() => !keep.value && props.currComp);
|
||||||
|
|
||||||
|
watch(useMultiTagsStoreHook().multiTags, (tags: any) => {
|
||||||
|
if (!Array.isArray(tags) || !keep.value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const iframeTags = tags.filter(i => i.meta?.frameSrc);
|
||||||
|
// tags必须是小于MAP,才是做了关闭动作,因为MAP插入的顺序在tags变化后发生
|
||||||
|
if (iframeTags.length < MAP.size) {
|
||||||
|
for (const i of MAP.keys()) {
|
||||||
|
if (!tags.some(s => s.path === i)) {
|
||||||
|
delMap(i);
|
||||||
|
compList.value = getMap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.currRoute.fullPath,
|
||||||
|
path => {
|
||||||
|
const multiTags = useMultiTagsStoreHook().multiTags as RouteRecordRaw[];
|
||||||
|
const iframeTags = multiTags.filter(i => i.meta?.frameSrc);
|
||||||
|
if (keep.value) {
|
||||||
|
if (iframeTags.length !== MAP.size) {
|
||||||
|
const sameKey = [...MAP.keys()].find(i => path === i);
|
||||||
|
if (!sameKey) {
|
||||||
|
// 添加缓存
|
||||||
|
setMap(path, props.currComp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (MAP.size > 0) {
|
||||||
|
compList.value = getMap();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
immediate: true
|
||||||
|
}
|
||||||
|
);
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<template v-for="[fullPath, Comp] in compList" :key="fullPath">
|
||||||
|
<div v-show="fullPath === currRoute.fullPath" class="w-full h-full">
|
||||||
|
<slot
|
||||||
|
:fullPath="fullPath"
|
||||||
|
:Comp="Comp"
|
||||||
|
:frameInfo="{ frameSrc: currRoute.meta?.frameSrc, fullPath }"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<div v-show="!keep" class="w-full h-full">
|
||||||
|
<slot :Comp="normalComp" :fullPath="currRoute.fullPath" frameInfo />
|
||||||
|
</div>
|
||||||
|
</template>
|
@ -1,12 +1,14 @@
|
|||||||
<script setup lang="ts">
|
<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 { useNav } from "@/layout/hooks/useNav";
|
||||||
import Breadcrumb from "./sidebar/breadCrumb.vue";
|
import LaySearch from "../lay-search/index.vue";
|
||||||
import topCollapse from "./sidebar/topCollapse.vue";
|
import LayNotice from "../lay-notice/index.vue";
|
||||||
import LogoutCircleRLine from "@iconify-icons/ri/logout-circle-r-line";
|
import LayNavMix from "../lay-sidebar/NavMix.vue";
|
||||||
import Setting from "@iconify-icons/ri/settings-3-line";
|
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 LogoutCircleRLine from "~icons/ri/logout-circle-r-line";
|
||||||
|
import Setting from "~icons/ri/settings-3-line";
|
||||||
|
|
||||||
const {
|
const {
|
||||||
layout,
|
layout,
|
||||||
@ -22,28 +24,28 @@ const {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div class="navbar bg-[#fff] shadow-xs shadow-[rgba(0,21,41,0.08)]">
|
||||||
class="navbar bg-[#fff] shadow-sm shadow-[rgba(0, 21, 41, 0.08)] dark:shadow-[#0d0d0d]"
|
<LaySidebarTopCollapse
|
||||||
>
|
|
||||||
<topCollapse
|
|
||||||
v-if="device === 'mobile'"
|
v-if="device === 'mobile'"
|
||||||
class="hamburger-container"
|
class="hamburger-container"
|
||||||
:is-active="pureApp.sidebar.opened"
|
:is-active="pureApp.sidebar.opened"
|
||||||
@toggleClick="toggleSideBar"
|
@toggleClick="toggleSideBar"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Breadcrumb
|
<LaySidebarBreadCrumb
|
||||||
v-if="layout !== 'mix' && device !== 'mobile'"
|
v-if="layout !== 'mix' && device !== 'mobile'"
|
||||||
class="breadcrumb-container"
|
class="breadcrumb-container"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<mixNav v-if="layout === 'mix'" />
|
<LayNavMix v-if="layout === 'mix'" />
|
||||||
|
|
||||||
<div v-if="layout === 'vertical'" class="vertical-header-right">
|
<div v-if="layout === 'vertical'" class="vertical-header-right">
|
||||||
<!-- 菜单搜索 -->
|
<!-- 菜单搜索 -->
|
||||||
<Search />
|
<LaySearch id="header-search" />
|
||||||
<!-- 通知 -->
|
<!-- 全屏 -->
|
||||||
<Notice id="header-notice" />
|
<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">
|
||||||
@ -64,7 +66,7 @@ const {
|
|||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
<span
|
<span
|
||||||
class="set-icon navbar-bg-hover"
|
class="set-icon navbar-bg-hover"
|
||||||
title="打开项目配置"
|
title="打开系统配置"
|
||||||
@click="onPanel"
|
@click="onPanel"
|
||||||
>
|
>
|
||||||
<IconifyIconOffline :icon="Setting" />
|
<IconifyIconOffline :icon="Setting" />
|
||||||
@ -122,7 +124,7 @@ const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.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,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;
|
23
src/layout/components/lay-notice/components/NoticeList.vue
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { PropType } from "vue";
|
||||||
|
import { ListItem } from "../data";
|
||||||
|
import NoticeItem from "./NoticeItem.vue";
|
||||||
|
|
||||||
|
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="emptyText" />
|
||||||
|
</template>
|
97
src/layout/components/lay-notice/data.ts
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
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: "通知",
|
||||||
|
list: [],
|
||||||
|
emptyText: "暂无通知"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "2",
|
||||||
|
name: "消息",
|
||||||
|
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: "暂无消息"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "3",
|
||||||
|
name: "待办",
|
||||||
|
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: "暂无待办"
|
||||||
|
}
|
||||||
|
];
|
@ -1,30 +1,42 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from "vue";
|
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 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 =>
|
||||||
|
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>
|
||||||
<template #dropdown>
|
<template #dropdown>
|
||||||
<el-dropdown-menu>
|
<el-dropdown-menu>
|
||||||
<el-tabs
|
<el-tabs
|
||||||
:stretch="true"
|
|
||||||
v-model="activeKey"
|
v-model="activeKey"
|
||||||
|
:stretch="true"
|
||||||
class="dropdown-tabs"
|
class="dropdown-tabs"
|
||||||
:style="{ width: notices.length === 0 ? '200px' : '330px' }"
|
:style="{ width: notices.length === 0 ? '200px' : '330px' }"
|
||||||
>
|
>
|
||||||
@ -35,13 +47,10 @@ notices.value.map(v => (noticesNum.value += v.list.length));
|
|||||||
/>
|
/>
|
||||||
<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 +69,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 {
|
@ -2,17 +2,20 @@
|
|||||||
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 Close from "@iconify-icons/ep/close";
|
import { useDataThemeChange } from "@/layout/hooks/useDataThemeChange";
|
||||||
|
import CloseIcon from "~icons/ep/close";
|
||||||
|
|
||||||
const target = ref(null);
|
const target = ref(null);
|
||||||
const show = ref<Boolean>(false);
|
const show = ref<Boolean>(false);
|
||||||
|
|
||||||
const iconClass = computed(() => {
|
const iconClass = computed(() => {
|
||||||
return [
|
return [
|
||||||
"mr-[20px]",
|
"w-[22px]",
|
||||||
"outline-none",
|
"h-[22px]",
|
||||||
"width-[20px]",
|
"flex",
|
||||||
"height-[20px]",
|
"justify-center",
|
||||||
|
"items-center",
|
||||||
|
"outline-hidden",
|
||||||
"rounded-[4px]",
|
"rounded-[4px]",
|
||||||
"cursor-pointer",
|
"cursor-pointer",
|
||||||
"transition-colors",
|
"transition-colors",
|
||||||
@ -22,6 +25,8 @@ const iconClass = computed(() => {
|
|||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const { onReset } = useDataThemeChange();
|
||||||
|
|
||||||
onClickOutside(target, (event: any) => {
|
onClickOutside(target, (event: any) => {
|
||||||
if (event.clientX > target.value.offsetLeft) return;
|
if (event.clientX > target.value.offsetLeft) return;
|
||||||
show.value = false;
|
show.value = false;
|
||||||
@ -40,40 +45,60 @@ onBeforeUnmount(() => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div :class="{ show: show }" class="right-panel-container">
|
<div :class="{ show }">
|
||||||
<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 class="right-panel-items">
|
<div
|
||||||
<div class="project-configuration">
|
class="project-configuration border-0 border-b-[1px] border-solid border-[var(--pure-border-color)]"
|
||||||
<h4 class="dark:text-white">项目配置</h4>
|
>
|
||||||
<span title="关闭配置" :class="iconClass">
|
<h4 class="dark:text-white">系统配置</h4>
|
||||||
<IconifyIconOffline
|
<span
|
||||||
class="dark:text-white"
|
v-tippy="{
|
||||||
width="20px"
|
content: '关闭配置',
|
||||||
height="20px"
|
placement: 'bottom-start',
|
||||||
:icon="Close"
|
zIndex: 41000
|
||||||
@click="show = !show"
|
}"
|
||||||
/>
|
:class="iconClass"
|
||||||
</span>
|
>
|
||||||
</div>
|
<IconifyIconOffline
|
||||||
<div
|
class="dark:text-white"
|
||||||
class="border-b-[1px] border-solid border-[#dcdfe6] dark:border-[#303030]"
|
width="18px"
|
||||||
/>
|
height="18px"
|
||||||
|
:icon="CloseIcon"
|
||||||
|
@click="show = !show"
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<el-scrollbar>
|
||||||
<slot />
|
<slot />
|
||||||
|
</el-scrollbar>
|
||||||
|
|
||||||
|
<div
|
||||||
|
class="flex justify-end p-3 border-0 border-t-[1px] border-solid border-[var(--pure-border-color)]"
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
v-tippy="{
|
||||||
|
content: '清空缓存并返回登录页',
|
||||||
|
placement: 'left-start',
|
||||||
|
zIndex: 41000
|
||||||
|
}"
|
||||||
|
type="danger"
|
||||||
|
text
|
||||||
|
bg
|
||||||
|
@click="onReset"
|
||||||
|
>
|
||||||
|
清空缓存
|
||||||
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style>
|
|
||||||
.showright-panel {
|
|
||||||
position: relative;
|
|
||||||
width: calc(100% - 15px);
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
:deep(.el-scrollbar) {
|
||||||
|
height: calc(100vh - 110px);
|
||||||
|
}
|
||||||
|
|
||||||
.right-panel-background {
|
.right-panel-background {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
@ -90,11 +115,10 @@ onBeforeUnmount(() => {
|
|||||||
right: 0;
|
right: 0;
|
||||||
z-index: 40000;
|
z-index: 40000;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 315px;
|
max-width: 280px;
|
||||||
height: 100vh;
|
|
||||||
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 {
|
||||||
@ -112,47 +136,10 @@ onBeforeUnmount(() => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.handle-button {
|
|
||||||
position: absolute;
|
|
||||||
top: 45%;
|
|
||||||
left: -48px;
|
|
||||||
z-index: 0;
|
|
||||||
width: 48px;
|
|
||||||
height: 48px;
|
|
||||||
font-size: 24px;
|
|
||||||
line-height: 48px;
|
|
||||||
color: #fff;
|
|
||||||
text-align: center;
|
|
||||||
pointer-events: auto;
|
|
||||||
cursor: pointer;
|
|
||||||
background: rgb(24 144 255);
|
|
||||||
border-radius: 6px 0 0 6px !important;
|
|
||||||
|
|
||||||
i {
|
|
||||||
font-size: 24px;
|
|
||||||
line-height: 48px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.right-panel-items {
|
|
||||||
height: calc(100vh - 60px);
|
|
||||||
margin-top: 60px;
|
|
||||||
overflow-y: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.project-configuration {
|
.project-configuration {
|
||||||
position: fixed;
|
|
||||||
top: 15px;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
width: 100%;
|
padding: 14px 20px;
|
||||||
height: 30px;
|
|
||||||
margin-left: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.el-divider--horizontal) {
|
|
||||||
width: 90%;
|
|
||||||
margin: 20px auto 0;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
@ -1,11 +1,11 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import ArrowUpLine from "@iconify-icons/ri/arrow-up-line";
|
|
||||||
import ArrowDownLine from "@iconify-icons/ri/arrow-down-line";
|
|
||||||
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 "~icons/ri/arrow-up-line";
|
||||||
|
import ArrowDownLine from "~icons/ri/arrow-down-line";
|
||||||
|
|
||||||
const props = withDefaults(defineProps<{ total: number }>(), {
|
withDefaults(defineProps<{ total?: number }>(), {
|
||||||
total: 0
|
total: 0
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -15,7 +15,7 @@ const { device } = useNav();
|
|||||||
<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" />
|
||||||
确认
|
确认
|
||||||
</span>
|
</span>
|
||||||
<span class="search-footer-item">
|
<span class="search-footer-item">
|
||||||
@ -24,14 +24,11 @@ const { device } = useNav();
|
|||||||
切换
|
切换
|
||||||
</span>
|
</span>
|
||||||
<span class="search-footer-item">
|
<span class="search-footer-item">
|
||||||
<mdiKeyboardEsc class="icon" />
|
<MdiKeyboardEsc class="icon" />
|
||||||
关闭
|
关闭
|
||||||
</span>
|
</span>
|
||||||
<p
|
<p v-if="device !== 'mobile' && total > 0" class="search-footer-total">
|
||||||
v-if="device !== 'mobile' && props.total > 0"
|
{{ `共 ${total} 项` }}
|
||||||
class="search-footer-total"
|
|
||||||
>
|
|
||||||
共{{ props.total }}项
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -50,7 +47,9 @@ const { device } = useNav();
|
|||||||
padding: 2px;
|
padding: 2px;
|
||||||
margin-right: 3px;
|
margin-right: 3px;
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
box-shadow: inset 0 -2px #cdcde6, inset 0 0 1px 1px #fff,
|
box-shadow:
|
||||||
|
inset 0 -2px #cdcde6,
|
||||||
|
inset 0 0 1px 1px #fff,
|
||||||
0 1px 2px 1px #1e235a66;
|
0 1px 2px 1px #1e235a66;
|
||||||
}
|
}
|
||||||
|
|
198
src/layout/components/lay-search/components/SearchHistory.vue
Normal file
@ -0,0 +1,198 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import Sortable from "sortablejs";
|
||||||
|
import SearchHistoryItem from "./SearchHistoryItem.vue";
|
||||||
|
import type { optionsItem, dragItem, Props } from "../types";
|
||||||
|
import { useEpThemeStoreHook } from "@/store/modules/epTheme";
|
||||||
|
import { useResizeObserver, isArray, delay } from "@pureadmin/utils";
|
||||||
|
import { ref, watch, nextTick, computed, getCurrentInstance } from "vue";
|
||||||
|
|
||||||
|
interface Emits {
|
||||||
|
(e: "update:value", val: string): void;
|
||||||
|
(e: "enter"): void;
|
||||||
|
(e: "collect", val: optionsItem): void;
|
||||||
|
(e: "delete", val: optionsItem): void;
|
||||||
|
(e: "drag", val: dragItem): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const historyRef = ref();
|
||||||
|
const innerHeight = ref();
|
||||||
|
/** 判断是否停止鼠标移入事件处理 */
|
||||||
|
const stopMouseEvent = ref(false);
|
||||||
|
|
||||||
|
const emit = defineEmits<Emits>();
|
||||||
|
const instance = getCurrentInstance()!;
|
||||||
|
const props = withDefaults(defineProps<Props>(), {});
|
||||||
|
|
||||||
|
const itemStyle = computed(() => {
|
||||||
|
return item => {
|
||||||
|
return {
|
||||||
|
background:
|
||||||
|
item?.path === active.value ? useEpThemeStoreHook().epThemeColor : "",
|
||||||
|
color: item.path === active.value ? "#fff" : "",
|
||||||
|
fontSize: item.path === active.value ? "16px" : "14px"
|
||||||
|
};
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
const titleStyle = computed(() => {
|
||||||
|
return {
|
||||||
|
color: useEpThemeStoreHook().epThemeColor,
|
||||||
|
fontWeight: 500
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
const active = computed({
|
||||||
|
get() {
|
||||||
|
return props.value;
|
||||||
|
},
|
||||||
|
set(val: string) {
|
||||||
|
emit("update:value", val);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.value,
|
||||||
|
newValue => {
|
||||||
|
if (newValue) {
|
||||||
|
if (stopMouseEvent.value) {
|
||||||
|
delay(100).then(() => (stopMouseEvent.value = false));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
const historyList = computed(() => {
|
||||||
|
return props.options.filter(item => item.type === "history");
|
||||||
|
});
|
||||||
|
|
||||||
|
const collectList = computed(() => {
|
||||||
|
return props.options.filter(item => item.type === "collect");
|
||||||
|
});
|
||||||
|
|
||||||
|
function handleCollect(item) {
|
||||||
|
emit("collect", item);
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleDelete(item) {
|
||||||
|
stopMouseEvent.value = true;
|
||||||
|
emit("delete", item);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 鼠标移入 */
|
||||||
|
async function handleMouse(item) {
|
||||||
|
if (!stopMouseEvent.value) active.value = item.path;
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleTo() {
|
||||||
|
emit("enter");
|
||||||
|
}
|
||||||
|
|
||||||
|
function resizeResult() {
|
||||||
|
// el-scrollbar max-height="calc(90vh - 140px)"
|
||||||
|
innerHeight.value = window.innerHeight - window.innerHeight / 10 - 140;
|
||||||
|
}
|
||||||
|
|
||||||
|
useResizeObserver(historyRef, resizeResult);
|
||||||
|
|
||||||
|
function handleScroll(index: number) {
|
||||||
|
const curInstance = instance?.proxy?.$refs[`historyItemRef${index}`];
|
||||||
|
if (!curInstance) return 0;
|
||||||
|
const curRef = isArray(curInstance)
|
||||||
|
? (curInstance[0] as ElRef)
|
||||||
|
: (curInstance as ElRef);
|
||||||
|
const scrollTop = curRef.offsetTop + 128; // 128 两个history-item(56px+56px=112px)高度加上下margin(8px+8px=16px)
|
||||||
|
return scrollTop > innerHeight.value ? scrollTop - innerHeight.value : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleChangeIndex = (evt): void => {
|
||||||
|
emit("drag", { oldIndex: evt.oldIndex, newIndex: evt.newIndex });
|
||||||
|
};
|
||||||
|
|
||||||
|
let sortableInstance = null;
|
||||||
|
|
||||||
|
watch(
|
||||||
|
collectList,
|
||||||
|
val => {
|
||||||
|
if (val.length > 1) {
|
||||||
|
nextTick(() => {
|
||||||
|
const wrapper: HTMLElement =
|
||||||
|
document.querySelector(".collect-container");
|
||||||
|
if (!wrapper || sortableInstance) return;
|
||||||
|
sortableInstance = Sortable.create(wrapper, {
|
||||||
|
animation: 160,
|
||||||
|
onStart: event => {
|
||||||
|
event.item.style.cursor = "move";
|
||||||
|
},
|
||||||
|
onEnd: event => {
|
||||||
|
event.item.style.cursor = "pointer";
|
||||||
|
},
|
||||||
|
onUpdate: handleChangeIndex
|
||||||
|
});
|
||||||
|
resizeResult();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ deep: true, immediate: true }
|
||||||
|
);
|
||||||
|
|
||||||
|
defineExpose({ handleScroll });
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div ref="historyRef" class="history">
|
||||||
|
<template v-if="historyList.length">
|
||||||
|
<div :style="titleStyle">搜索历史</div>
|
||||||
|
<div
|
||||||
|
v-for="(item, index) in historyList"
|
||||||
|
:key="item.path"
|
||||||
|
:ref="'historyItemRef' + index"
|
||||||
|
class="history-item dark:bg-[#1d1d1d]"
|
||||||
|
:style="itemStyle(item)"
|
||||||
|
@click="handleTo"
|
||||||
|
@mouseenter="handleMouse(item)"
|
||||||
|
>
|
||||||
|
<SearchHistoryItem
|
||||||
|
:item="item"
|
||||||
|
@delete-item="handleDelete"
|
||||||
|
@collect-item="handleCollect"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template v-if="collectList.length">
|
||||||
|
<div :style="titleStyle">
|
||||||
|
{{ `收藏${collectList.length > 1 ? "(可拖拽排序)" : ""}` }}
|
||||||
|
</div>
|
||||||
|
<div class="collect-container">
|
||||||
|
<div
|
||||||
|
v-for="(item, index) in collectList"
|
||||||
|
:key="item.path"
|
||||||
|
:ref="'historyItemRef' + (index + historyList.length)"
|
||||||
|
class="history-item dark:bg-[#1d1d1d]"
|
||||||
|
:style="itemStyle(item)"
|
||||||
|
@click="handleTo"
|
||||||
|
@mouseenter="handleMouse(item)"
|
||||||
|
>
|
||||||
|
<SearchHistoryItem :item="item" @delete-item="handleDelete" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.history {
|
||||||
|
padding-bottom: 12px;
|
||||||
|
|
||||||
|
&-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
height: 56px;
|
||||||
|
padding: 14px;
|
||||||
|
margin: 8px auto 10px;
|
||||||
|
cursor: pointer;
|
||||||
|
border: 0.1px solid #ccc;
|
||||||
|
border-radius: 4px;
|
||||||
|
transition: font-size 0.16s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
@ -0,0 +1,52 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import type { optionsItem } from "../types";
|
||||||
|
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
|
||||||
|
import StarIcon from "~icons/ep/star";
|
||||||
|
import CloseIcon from "~icons/ep/close";
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
item: optionsItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Emits {
|
||||||
|
(e: "collectItem", val: optionsItem): void;
|
||||||
|
(e: "deleteItem", val: optionsItem): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const emit = defineEmits<Emits>();
|
||||||
|
withDefaults(defineProps<Props>(), {});
|
||||||
|
|
||||||
|
function handleCollect(item) {
|
||||||
|
emit("collectItem", item);
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleDelete(item) {
|
||||||
|
emit("deleteItem", item);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<component :is="useRenderIcon(item.meta?.icon)" />
|
||||||
|
<span class="history-item-title">
|
||||||
|
{{ item.meta?.title }}
|
||||||
|
</span>
|
||||||
|
<IconifyIconOffline
|
||||||
|
v-show="item.type === 'history'"
|
||||||
|
:icon="StarIcon"
|
||||||
|
class="w-[18px] h-[18px] mr-2 hover:text-[#d7d5d4]"
|
||||||
|
@click.stop="handleCollect(item)"
|
||||||
|
/>
|
||||||
|
<IconifyIconOffline
|
||||||
|
:icon="CloseIcon"
|
||||||
|
class="w-[18px] h-[18px] hover:text-[#d7d5d4] cursor-pointer"
|
||||||
|
@click.stop="handleDelete(item)"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.history-item-title {
|
||||||
|
display: flex;
|
||||||
|
flex: 1;
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
||||||
|
</style>
|
334
src/layout/components/lay-search/components/SearchModal.vue
Normal file
@ -0,0 +1,334 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { match } from "pinyin-pro";
|
||||||
|
import { getConfig } from "@/config";
|
||||||
|
import { useRouter } from "vue-router";
|
||||||
|
import SearchResult from "./SearchResult.vue";
|
||||||
|
import SearchFooter from "./SearchFooter.vue";
|
||||||
|
import { useNav } from "@/layout/hooks/useNav";
|
||||||
|
import SearchHistory from "./SearchHistory.vue";
|
||||||
|
import type { optionsItem, dragItem } from "../types";
|
||||||
|
import { ref, computed, shallowRef, watch } from "vue";
|
||||||
|
import { useDebounceFn, onKeyStroke } from "@vueuse/core";
|
||||||
|
import { usePermissionStoreHook } from "@/store/modules/permission";
|
||||||
|
import { cloneDeep, isAllEmpty, storageLocal } from "@pureadmin/utils";
|
||||||
|
import SearchIcon from "~icons/ri/search-line";
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
/** 弹窗显隐 */
|
||||||
|
value: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Emits {
|
||||||
|
(e: "update:value", val: boolean): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const { device } = useNav();
|
||||||
|
const emit = defineEmits<Emits>();
|
||||||
|
const props = withDefaults(defineProps<Props>(), {});
|
||||||
|
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
|
const HISTORY_TYPE = "history";
|
||||||
|
const COLLECT_TYPE = "collect";
|
||||||
|
const LOCALEHISTORYKEY = "menu-search-history";
|
||||||
|
const LOCALECOLLECTKEY = "menu-search-collect";
|
||||||
|
|
||||||
|
const keyword = ref("");
|
||||||
|
const resultRef = ref();
|
||||||
|
const historyRef = ref();
|
||||||
|
const scrollbarRef = ref();
|
||||||
|
const activePath = ref("");
|
||||||
|
const historyPath = ref("");
|
||||||
|
const resultOptions = shallowRef([]);
|
||||||
|
const historyOptions = shallowRef([]);
|
||||||
|
const handleSearch = useDebounceFn(search, 300);
|
||||||
|
const historyNum = getConfig().MenuSearchHistory;
|
||||||
|
const inputRef = ref<HTMLInputElement | null>(null);
|
||||||
|
|
||||||
|
/** 菜单树形结构 */
|
||||||
|
const menusData = computed(() => {
|
||||||
|
return cloneDeep(usePermissionStoreHook().wholeMenus);
|
||||||
|
});
|
||||||
|
|
||||||
|
const show = computed({
|
||||||
|
get() {
|
||||||
|
return props.value;
|
||||||
|
},
|
||||||
|
set(val: boolean) {
|
||||||
|
emit("update:value", val);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.value,
|
||||||
|
newValue => {
|
||||||
|
if (newValue) getHistory();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
const showSearchResult = computed(() => {
|
||||||
|
return keyword.value && resultOptions.value.length > 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
const showSearchHistory = computed(() => {
|
||||||
|
return !keyword.value && historyOptions.value.length > 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
const showEmpty = computed(() => {
|
||||||
|
return (
|
||||||
|
(!keyword.value && historyOptions.value.length === 0) ||
|
||||||
|
(keyword.value && resultOptions.value.length === 0)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
function getStorageItem(key) {
|
||||||
|
return storageLocal().getItem<optionsItem[]>(key) || [];
|
||||||
|
}
|
||||||
|
|
||||||
|
function setStorageItem(key, value) {
|
||||||
|
storageLocal().setItem(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 将菜单树形结构扁平化为一维数组,用于菜单查询 */
|
||||||
|
function flatTree(arr) {
|
||||||
|
const res = [];
|
||||||
|
function deep(arr) {
|
||||||
|
arr.forEach(item => {
|
||||||
|
res.push(item);
|
||||||
|
item.children && deep(item.children);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
deep(arr);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 查询 */
|
||||||
|
function search() {
|
||||||
|
const flatMenusData = flatTree(menusData.value);
|
||||||
|
resultOptions.value = flatMenusData.filter(menu =>
|
||||||
|
keyword.value
|
||||||
|
? menu.meta?.title
|
||||||
|
.toLocaleLowerCase()
|
||||||
|
.includes(keyword.value.toLocaleLowerCase().trim()) ||
|
||||||
|
!isAllEmpty(
|
||||||
|
match(
|
||||||
|
menu.meta?.title.toLocaleLowerCase(),
|
||||||
|
keyword.value.toLocaleLowerCase().trim()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
: false
|
||||||
|
);
|
||||||
|
activePath.value =
|
||||||
|
resultOptions.value?.length > 0 ? resultOptions.value[0].path : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleClose() {
|
||||||
|
show.value = false;
|
||||||
|
/** 延时处理防止用户看到某些操作 */
|
||||||
|
setTimeout(() => {
|
||||||
|
resultOptions.value = [];
|
||||||
|
historyPath.value = "";
|
||||||
|
keyword.value = "";
|
||||||
|
}, 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
function scrollTo(index) {
|
||||||
|
const ref = resultOptions.value.length ? resultRef.value : historyRef.value;
|
||||||
|
const scrollTop = ref.handleScroll(index);
|
||||||
|
scrollbarRef.value.setScrollTop(scrollTop);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取当前选项和路径 */
|
||||||
|
function getCurrentOptionsAndPath() {
|
||||||
|
const isResultOptions = resultOptions.value.length > 0;
|
||||||
|
const options = isResultOptions ? resultOptions.value : historyOptions.value;
|
||||||
|
const currentPath = isResultOptions ? activePath.value : historyPath.value;
|
||||||
|
return { options, currentPath, isResultOptions };
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 更新路径并滚动到指定项 */
|
||||||
|
function updatePathAndScroll(newIndex, isResultOptions) {
|
||||||
|
if (isResultOptions) {
|
||||||
|
activePath.value = resultOptions.value[newIndex].path;
|
||||||
|
} else {
|
||||||
|
historyPath.value = historyOptions.value[newIndex].path;
|
||||||
|
}
|
||||||
|
scrollTo(newIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** key up */
|
||||||
|
function handleUp() {
|
||||||
|
const { options, currentPath, isResultOptions } = getCurrentOptionsAndPath();
|
||||||
|
if (options.length === 0) return;
|
||||||
|
const index = options.findIndex(item => item.path === currentPath);
|
||||||
|
const prevIndex = (index - 1 + options.length) % options.length;
|
||||||
|
updatePathAndScroll(prevIndex, isResultOptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** key down */
|
||||||
|
function handleDown() {
|
||||||
|
const { options, currentPath, isResultOptions } = getCurrentOptionsAndPath();
|
||||||
|
if (options.length === 0) return;
|
||||||
|
const index = options.findIndex(item => item.path === currentPath);
|
||||||
|
const nextIndex = (index + 1) % options.length;
|
||||||
|
updatePathAndScroll(nextIndex, isResultOptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** key enter */
|
||||||
|
function handleEnter() {
|
||||||
|
const { options, currentPath, isResultOptions } = getCurrentOptionsAndPath();
|
||||||
|
if (options.length === 0 || currentPath === "") return;
|
||||||
|
const index = options.findIndex(item => item.path === currentPath);
|
||||||
|
if (index === -1) return;
|
||||||
|
if (isResultOptions) {
|
||||||
|
saveHistory();
|
||||||
|
} else {
|
||||||
|
updateHistory();
|
||||||
|
}
|
||||||
|
router.push(options[index].path);
|
||||||
|
handleClose();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 删除历史记录 */
|
||||||
|
function handleDelete(item) {
|
||||||
|
const key = item.type === HISTORY_TYPE ? LOCALEHISTORYKEY : LOCALECOLLECTKEY;
|
||||||
|
let list = getStorageItem(key);
|
||||||
|
list = list.filter(listItem => listItem.path !== item.path);
|
||||||
|
setStorageItem(key, list);
|
||||||
|
getHistory();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 收藏历史记录 */
|
||||||
|
function handleCollect(item) {
|
||||||
|
let searchHistoryList = getStorageItem(LOCALEHISTORYKEY);
|
||||||
|
let searchCollectList = getStorageItem(LOCALECOLLECTKEY);
|
||||||
|
searchHistoryList = searchHistoryList.filter(
|
||||||
|
historyItem => historyItem.path !== item.path
|
||||||
|
);
|
||||||
|
setStorageItem(LOCALEHISTORYKEY, searchHistoryList);
|
||||||
|
if (!searchCollectList.some(collectItem => collectItem.path === item.path)) {
|
||||||
|
searchCollectList.unshift({ ...item, type: COLLECT_TYPE });
|
||||||
|
setStorageItem(LOCALECOLLECTKEY, searchCollectList);
|
||||||
|
}
|
||||||
|
getHistory();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 存储搜索记录 */
|
||||||
|
function saveHistory() {
|
||||||
|
const { path, meta } = resultOptions.value.find(
|
||||||
|
item => item.path === activePath.value
|
||||||
|
);
|
||||||
|
const searchHistoryList = getStorageItem(LOCALEHISTORYKEY);
|
||||||
|
const searchCollectList = getStorageItem(LOCALECOLLECTKEY);
|
||||||
|
const isCollected = searchCollectList.some(item => item.path === path);
|
||||||
|
const existingIndex = searchHistoryList.findIndex(item => item.path === path);
|
||||||
|
if (!isCollected) {
|
||||||
|
if (existingIndex !== -1) searchHistoryList.splice(existingIndex, 1);
|
||||||
|
if (searchHistoryList.length >= historyNum) searchHistoryList.pop();
|
||||||
|
searchHistoryList.unshift({ path, meta, type: HISTORY_TYPE });
|
||||||
|
storageLocal().setItem(LOCALEHISTORYKEY, searchHistoryList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 更新存储的搜索记录 */
|
||||||
|
function updateHistory() {
|
||||||
|
let searchHistoryList = getStorageItem(LOCALEHISTORYKEY);
|
||||||
|
const historyIndex = searchHistoryList.findIndex(
|
||||||
|
item => item.path === historyPath.value
|
||||||
|
);
|
||||||
|
if (historyIndex !== -1) {
|
||||||
|
const [historyItem] = searchHistoryList.splice(historyIndex, 1);
|
||||||
|
searchHistoryList.unshift(historyItem);
|
||||||
|
setStorageItem(LOCALEHISTORYKEY, searchHistoryList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取本地历史记录 */
|
||||||
|
function getHistory() {
|
||||||
|
const searchHistoryList = getStorageItem(LOCALEHISTORYKEY);
|
||||||
|
const searchCollectList = getStorageItem(LOCALECOLLECTKEY);
|
||||||
|
historyOptions.value = [...searchHistoryList, ...searchCollectList];
|
||||||
|
historyPath.value = historyOptions.value[0]?.path;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 拖拽改变收藏顺序 */
|
||||||
|
function handleDrag(item: dragItem) {
|
||||||
|
const searchCollectList = getStorageItem(LOCALECOLLECTKEY);
|
||||||
|
const [reorderedItem] = searchCollectList.splice(item.oldIndex, 1);
|
||||||
|
searchCollectList.splice(item.newIndex, 0, reorderedItem);
|
||||||
|
storageLocal().setItem(LOCALECOLLECTKEY, searchCollectList);
|
||||||
|
historyOptions.value = [
|
||||||
|
...getStorageItem(LOCALEHISTORYKEY),
|
||||||
|
...getStorageItem(LOCALECOLLECTKEY)
|
||||||
|
];
|
||||||
|
historyPath.value = reorderedItem.path;
|
||||||
|
}
|
||||||
|
|
||||||
|
onKeyStroke("Enter", handleEnter);
|
||||||
|
onKeyStroke("ArrowUp", handleUp);
|
||||||
|
onKeyStroke("ArrowDown", handleDown);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<el-dialog
|
||||||
|
v-model="show"
|
||||||
|
top="5vh"
|
||||||
|
class="pure-search-dialog"
|
||||||
|
:show-close="false"
|
||||||
|
:width="device === 'mobile' ? '80vw' : '40vw'"
|
||||||
|
:before-close="handleClose"
|
||||||
|
:style="{
|
||||||
|
borderRadius: '6px'
|
||||||
|
}"
|
||||||
|
append-to-body
|
||||||
|
@opened="inputRef.focus()"
|
||||||
|
@closed="inputRef.blur()"
|
||||||
|
>
|
||||||
|
<el-input
|
||||||
|
ref="inputRef"
|
||||||
|
v-model="keyword"
|
||||||
|
size="large"
|
||||||
|
clearable
|
||||||
|
placeholder="搜索菜单(支持拼音搜索)"
|
||||||
|
@input="handleSearch"
|
||||||
|
>
|
||||||
|
<template #prefix>
|
||||||
|
<IconifyIconOffline
|
||||||
|
:icon="SearchIcon"
|
||||||
|
class="text-primary w-[24px] h-[24px]"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-input>
|
||||||
|
<div class="search-content">
|
||||||
|
<el-scrollbar ref="scrollbarRef" max-height="calc(90vh - 140px)">
|
||||||
|
<el-empty v-if="showEmpty" description="暂无搜索结果" />
|
||||||
|
<SearchHistory
|
||||||
|
v-if="showSearchHistory"
|
||||||
|
ref="historyRef"
|
||||||
|
v-model:value="historyPath"
|
||||||
|
:options="historyOptions"
|
||||||
|
@click="handleEnter"
|
||||||
|
@delete="handleDelete"
|
||||||
|
@collect="handleCollect"
|
||||||
|
@drag="handleDrag"
|
||||||
|
/>
|
||||||
|
<SearchResult
|
||||||
|
v-if="showSearchResult"
|
||||||
|
ref="resultRef"
|
||||||
|
v-model:value="activePath"
|
||||||
|
:options="resultOptions"
|
||||||
|
@click="handleEnter"
|
||||||
|
/>
|
||||||
|
</el-scrollbar>
|
||||||
|
</div>
|
||||||
|
<template #footer>
|
||||||
|
<SearchFooter :total="resultOptions.length" />
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.search-content {
|
||||||
|
margin-top: 12px;
|
||||||
|
}
|
||||||
|
</style>
|