Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a8a1f8d900 | ||
|
|
c0f3dcbbb7 | ||
|
|
c6b0aa2467 | ||
|
|
057fef9147 | ||
|
|
036459cb02 | ||
|
|
7640f97a36 | ||
|
|
0a57ad7920 | ||
|
|
a4f857124f | ||
|
|
0d8f6b314b | ||
|
|
923fdd9ff1 |
@@ -3,7 +3,7 @@
|
|||||||
"prettier --cache --ignore-unknown --write",
|
"prettier --cache --ignore-unknown --write",
|
||||||
"eslint --cache --fix"
|
"eslint --cache --fix"
|
||||||
],
|
],
|
||||||
"{!(package)*.json,*.code-snippets,.!({browserslist,nvm})*rc}": [
|
"{!(package)*.json,*.code-snippets,.!({browserslist,npm,nvm})*rc}": [
|
||||||
"prettier --cache --write--parser json"
|
"prettier --cache --write--parser json"
|
||||||
],
|
],
|
||||||
"package.json": ["prettier --cache --write"],
|
"package.json": ["prettier --cache --write"],
|
||||||
|
|||||||
5
.npmrc
@@ -1,3 +1,4 @@
|
|||||||
|
shell-emulator=true
|
||||||
shamefully-hoist=true
|
shamefully-hoist=true
|
||||||
strict-peer-dependencies=false
|
enable-pre-post-scripts=false
|
||||||
shell-emulator=true
|
strict-peer-dependencies=false
|
||||||
3
.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",
|
||||||
@@ -15,4 +16,4 @@
|
|||||||
"antfu.iconify",
|
"antfu.iconify",
|
||||||
"Vue.volar"
|
"Vue.volar"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
15
.vscode/settings.json
vendored
@@ -27,5 +27,16 @@
|
|||||||
"editor.codeActionsOnSave": {
|
"editor.codeActionsOnSave": {
|
||||||
"source.fixAll.eslint": "explicit"
|
"source.fixAll.eslint": "explicit"
|
||||||
},
|
},
|
||||||
"iconify.excludes": ["el"]
|
"iconify.excludes": [
|
||||||
}
|
"el"
|
||||||
|
],
|
||||||
|
"vscodeCustomCodeColor.highlightValue": [
|
||||||
|
"v-loading",
|
||||||
|
"v-auth",
|
||||||
|
"v-copy",
|
||||||
|
"v-longpress",
|
||||||
|
"v-optimize",
|
||||||
|
"v-ripple"
|
||||||
|
],
|
||||||
|
"vscodeCustomCodeColor.highlightValueColor": "#b392f0",
|
||||||
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
FROM node:18-alpine as build-stage
|
FROM node:20-alpine as build-stage
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
RUN corepack enable
|
RUN corepack enable
|
||||||
RUN corepack prepare pnpm@8.6.10 --activate
|
RUN corepack prepare pnpm@latest --activate
|
||||||
|
|
||||||
RUN npm config set registry https://registry.npmmirror.com
|
RUN npm config set registry https://registry.npmmirror.com
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,14 @@
|
|||||||
|
|
||||||
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`
|
||||||
|
|
||||||
|
## `js` version
|
||||||
|
|
||||||
|
[Click me to view js version](https://pure-admin.github.io/pure-admin-doc/pages/js/)
|
||||||
|
|
||||||
|
## `max` version
|
||||||
|
|
||||||
|
[Click me to view the max version](https://github.com/pure-admin/vue-pure-admin-max)
|
||||||
|
|
||||||
## Supporting video
|
## Supporting video
|
||||||
|
|
||||||
[Click me to view UI design](https://www.bilibili.com/video/BV17g411T7rq)
|
[Click me to view UI design](https://www.bilibili.com/video/BV17g411T7rq)
|
||||||
@@ -15,12 +23,12 @@ The simplified version is based on the shelf extracted from [vue-pure-admin](htt
|
|||||||
|
|
||||||
## Nanny-level documents
|
## Nanny-level documents
|
||||||
|
|
||||||
[Click me to view vue-pure-admin documentation](https://yiming_chang.gitee.io/pure-admin-doc)
|
[Click me to view vue-pure-admin documentation](https://pure-admin.github.io/pure-admin-doc)
|
||||||
[Click me to view @pureadmin/utils documentation](https://pure-admin-utils.netlify.app)
|
[Click me to view @pureadmin/utils documentation](https://pure-admin-utils.netlify.app)
|
||||||
|
|
||||||
## Quality service, software outsourcing, sponsorship support
|
## Quality service, software outsourcing, sponsorship support
|
||||||
|
|
||||||
[Click me to view details](https://yiming_chang.gitee.io/pure-admin-doc/pages/service/)
|
[Click me to view details](https://pure-admin.github.io/pure-admin-doc/pages/service/)
|
||||||
|
|
||||||
## Preview
|
## Preview
|
||||||
|
|
||||||
|
|||||||
12
README.md
@@ -12,6 +12,14 @@
|
|||||||
|
|
||||||
当前是非国际化版本,如果您需要国际化版本 [请点击](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.github.io/pure-admin-doc/pages/js/)
|
||||||
|
|
||||||
|
## `max` 版本
|
||||||
|
|
||||||
|
[点我查看 max 版本](https://github.com/pure-admin/vue-pure-admin-max)
|
||||||
|
|
||||||
## 配套视频
|
## 配套视频
|
||||||
|
|
||||||
[点我查看 UI 设计](https://www.bilibili.com/video/BV17g411T7rq)
|
[点我查看 UI 设计](https://www.bilibili.com/video/BV17g411T7rq)
|
||||||
@@ -19,12 +27,12 @@
|
|||||||
|
|
||||||
## 配套保姆级文档
|
## 配套保姆级文档
|
||||||
|
|
||||||
[点我查看 vue-pure-admin 文档](https://yiming_chang.gitee.io/pure-admin-doc)
|
[点我查看 vue-pure-admin 文档](https://pure-admin.github.io/pure-admin-doc)
|
||||||
[点我查看 @pureadmin/utils 文档](https://pure-admin-utils.netlify.app)
|
[点我查看 @pureadmin/utils 文档](https://pure-admin-utils.netlify.app)
|
||||||
|
|
||||||
## 优质服务、软件外包、赞助支持
|
## 优质服务、软件外包、赞助支持
|
||||||
|
|
||||||
[点我查看详情](https://yiming_chang.gitee.io/pure-admin-doc/pages/service/)
|
[点我查看详情](https://pure-admin.github.io/pure-admin-doc/pages/service/)
|
||||||
|
|
||||||
## 预览
|
## 预览
|
||||||
|
|
||||||
|
|||||||
@@ -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({
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import boxen, { type Options as BoxenOptions } from "boxen";
|
|||||||
dayjs.extend(duration);
|
dayjs.extend(duration);
|
||||||
|
|
||||||
const welcomeMessage = gradientString("cyan", "magenta").multiline(
|
const welcomeMessage = gradientString("cyan", "magenta").multiline(
|
||||||
`您好! 欢迎使用 pure-admin 开源项目\n我们为您精心准备了下面两个贴心的保姆级文档\nhttps://yiming_chang.gitee.io/pure-admin-doc\nhttps://pure-admin-utils.netlify.app`
|
`您好! 欢迎使用 pure-admin 开源项目\n我们为您精心准备了下面两个贴心的保姆级文档\nhttps://pure-admin.github.io/pure-admin-doc\nhttps://pure-admin-utils.netlify.app`
|
||||||
);
|
);
|
||||||
|
|
||||||
const boxenOptions: BoxenOptions = {
|
const boxenOptions: BoxenOptions = {
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
import { cdn } from "./cdn";
|
import { cdn } from "./cdn";
|
||||||
import vue from "@vitejs/plugin-vue";
|
import vue from "@vitejs/plugin-vue";
|
||||||
|
import { pathResolve } from "./utils";
|
||||||
import { viteBuildInfo } from "./info";
|
import { viteBuildInfo } from "./info";
|
||||||
import svgLoader from "vite-svg-loader";
|
import svgLoader from "vite-svg-loader";
|
||||||
import type { PluginOption } from "vite";
|
import type { PluginOption } from "vite";
|
||||||
|
import checker from "vite-plugin-checker";
|
||||||
import vueJsx from "@vitejs/plugin-vue-jsx";
|
import vueJsx from "@vitejs/plugin-vue-jsx";
|
||||||
|
import Inspector from "vite-plugin-vue-inspector";
|
||||||
import { configCompressPlugin } from "./compress";
|
import { configCompressPlugin } from "./compress";
|
||||||
import removeNoMatch from "vite-plugin-router-warn";
|
import removeNoMatch from "vite-plugin-router-warn";
|
||||||
import { visualizer } from "rollup-plugin-visualizer";
|
import { visualizer } from "rollup-plugin-visualizer";
|
||||||
@@ -21,6 +24,18 @@ export function getPluginsList(
|
|||||||
vue(),
|
vue(),
|
||||||
// jsx、tsx语法支持
|
// jsx、tsx语法支持
|
||||||
vueJsx(),
|
vueJsx(),
|
||||||
|
checker({
|
||||||
|
typescript: true,
|
||||||
|
vueTsc: true,
|
||||||
|
eslint: {
|
||||||
|
lintCommand: `eslint ${pathResolve("../{src,mock,build}/**/*.{vue,js,ts,tsx}")}`,
|
||||||
|
useFlatConfig: true
|
||||||
|
},
|
||||||
|
terminal: false,
|
||||||
|
enableBuild: false
|
||||||
|
}),
|
||||||
|
// 按下Command(⌘)+Shift(⇧),然后点击页面元素会自动打开本地IDE并跳转到对应的代码位置
|
||||||
|
Inspector(),
|
||||||
viteBuildInfo(),
|
viteBuildInfo(),
|
||||||
/**
|
/**
|
||||||
* 开发环境下移除非必要的vue-router动态路由警告No match found for location with path
|
* 开发环境下移除非必要的vue-router动态路由警告No match found for location with path
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ const __APP_INFO__ = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** 处理环境变量 */
|
/** 处理环境变量 */
|
||||||
const warpperEnv = (envConf: Recordable): ViteEnv => {
|
const wrapperEnv = (envConf: Recordable): ViteEnv => {
|
||||||
// 默认值
|
// 默认值
|
||||||
const ret: ViteEnv = {
|
const ret: ViteEnv = {
|
||||||
VITE_PORT: 8848,
|
VITE_PORT: 8848,
|
||||||
@@ -107,4 +107,4 @@ const getPackageSize = options => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export { root, pathResolve, alias, __APP_INFO__, warpperEnv, getPackageSize };
|
export { root, pathResolve, alias, __APP_INFO__, wrapperEnv, getPackageSize };
|
||||||
|
|||||||
@@ -23,17 +23,34 @@ const permissionRouter = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/permission/button/index",
|
path: "/permission/button",
|
||||||
name: "PermissionButton",
|
|
||||||
meta: {
|
meta: {
|
||||||
title: "按钮权限",
|
title: "按钮权限",
|
||||||
roles: ["admin", "common"],
|
roles: ["admin", "common"]
|
||||||
auths: [
|
},
|
||||||
"permission:btn:add",
|
children: [
|
||||||
"permission:btn:edit",
|
{
|
||||||
"permission:btn:delete"
|
path: "/permission/button/router",
|
||||||
]
|
component: "permission/button/index",
|
||||||
}
|
name: "PermissionButtonRouter",
|
||||||
|
meta: {
|
||||||
|
title: "路由返回按钮权限",
|
||||||
|
auths: [
|
||||||
|
"permission:btn:add",
|
||||||
|
"permission:btn:edit",
|
||||||
|
"permission:btn:delete"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/permission/button/login",
|
||||||
|
component: "permission/button/perms",
|
||||||
|
name: "PermissionButtonLogin",
|
||||||
|
meta: {
|
||||||
|
title: "登录接口返回按钮权限"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ export default defineFakeRoute([
|
|||||||
nickname: "小铭",
|
nickname: "小铭",
|
||||||
// 一个用户可能有多个角色
|
// 一个用户可能有多个角色
|
||||||
roles: ["admin"],
|
roles: ["admin"],
|
||||||
|
// 按钮级别权限
|
||||||
|
permissions: ["*:*:*"],
|
||||||
accessToken: "eyJhbGciOiJIUzUxMiJ9.admin",
|
accessToken: "eyJhbGciOiJIUzUxMiJ9.admin",
|
||||||
refreshToken: "eyJhbGciOiJIUzUxMiJ9.adminRefresh",
|
refreshToken: "eyJhbGciOiJIUzUxMiJ9.adminRefresh",
|
||||||
expires: "2030/10/30 00:00:00"
|
expires: "2030/10/30 00:00:00"
|
||||||
@@ -28,6 +30,7 @@ export default defineFakeRoute([
|
|||||||
username: "common",
|
username: "common",
|
||||||
nickname: "小林",
|
nickname: "小林",
|
||||||
roles: ["common"],
|
roles: ["common"],
|
||||||
|
permissions: ["permission:btn:add", "permission:btn:edit"],
|
||||||
accessToken: "eyJhbGciOiJIUzUxMiJ9.common",
|
accessToken: "eyJhbGciOiJIUzUxMiJ9.common",
|
||||||
refreshToken: "eyJhbGciOiJIUzUxMiJ9.commonRefresh",
|
refreshToken: "eyJhbGciOiJIUzUxMiJ9.commonRefresh",
|
||||||
expires: "2030/10/30 00:00:00"
|
expires: "2030/10/30 00:00:00"
|
||||||
|
|||||||
104
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "pure-admin-thin",
|
"name": "pure-admin-thin",
|
||||||
"version": "5.4.0",
|
"version": "5.8.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -22,6 +22,7 @@
|
|||||||
"preinstall": "npx only-allow pnpm"
|
"preinstall": "npx only-allow pnpm"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
"pure-admin-thin",
|
||||||
"vue-pure-admin",
|
"vue-pure-admin",
|
||||||
"element-plus",
|
"element-plus",
|
||||||
"tailwindcss",
|
"tailwindcss",
|
||||||
@@ -38,7 +39,7 @@
|
|||||||
"url": "git+https://github.com/pure-admin/pure-admin-thin.git"
|
"url": "git+https://github.com/pure-admin/pure-admin-thin.git"
|
||||||
},
|
},
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/pure-admin/pure-admin-thin/issues"
|
"url": "https://github.com/pure-admin/vue-pure-admin/issues"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"author": {
|
"author": {
|
||||||
@@ -48,35 +49,35 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pureadmin/descriptions": "^1.2.1",
|
"@pureadmin/descriptions": "^1.2.1",
|
||||||
"@pureadmin/table": "^3.1.2",
|
"@pureadmin/table": "^3.2.0",
|
||||||
"@pureadmin/utils": "^2.4.7",
|
"@pureadmin/utils": "^2.4.8",
|
||||||
"@vueuse/core": "^10.9.0",
|
"@vueuse/core": "^10.11.1",
|
||||||
"@vueuse/motion": "^2.1.0",
|
"@vueuse/motion": "^2.2.3",
|
||||||
"animate.css": "^4.1.1",
|
"animate.css": "^4.1.1",
|
||||||
"axios": "^1.6.8",
|
"axios": "^1.7.4",
|
||||||
"dayjs": "^1.11.10",
|
"dayjs": "^1.11.12",
|
||||||
"echarts": "^5.5.0",
|
"echarts": "^5.5.1",
|
||||||
"element-plus": "^2.7.1",
|
"element-plus": "^2.8.0",
|
||||||
"js-cookie": "^3.0.5",
|
"js-cookie": "^3.0.5",
|
||||||
"localforage": "^1.10.0",
|
"localforage": "^1.10.0",
|
||||||
"mitt": "^3.0.1",
|
"mitt": "^3.0.1",
|
||||||
"nprogress": "^0.2.0",
|
"nprogress": "^0.2.0",
|
||||||
"path": "^0.12.7",
|
"path": "^0.12.7",
|
||||||
"pinia": "^2.1.7",
|
"pinia": "^2.2.2",
|
||||||
"pinyin-pro": "^3.20.2",
|
"pinyin-pro": "^3.24.2",
|
||||||
"qs": "^6.12.1",
|
"qs": "^6.13.0",
|
||||||
"responsive-storage": "^2.2.0",
|
"responsive-storage": "^2.2.0",
|
||||||
"sortablejs": "^1.15.2",
|
"sortablejs": "^1.15.2",
|
||||||
"vue": "^3.4.24",
|
"vue": "^3.4.38",
|
||||||
"vue-router": "^4.3.2",
|
"vue-router": "^4.4.3",
|
||||||
"vue-tippy": "^6.4.1",
|
"vue-tippy": "^6.4.4",
|
||||||
"vue-types": "^5.1.1"
|
"vue-types": "^5.1.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@commitlint/cli": "^19.2.2",
|
"@commitlint/cli": "^19.4.0",
|
||||||
"@commitlint/config-conventional": "^19.2.2",
|
"@commitlint/config-conventional": "^19.2.2",
|
||||||
"@commitlint/types": "^19.0.3",
|
"@commitlint/types": "^19.0.3",
|
||||||
"@eslint/js": "^9.1.1",
|
"@eslint/js": "^9.9.0",
|
||||||
"@faker-js/faker": "^8.4.1",
|
"@faker-js/faker": "^8.4.1",
|
||||||
"@iconify-icons/ep": "^1.2.12",
|
"@iconify-icons/ep": "^1.2.12",
|
||||||
"@iconify-icons/ri": "^1.2.10",
|
"@iconify-icons/ri": "^1.2.10",
|
||||||
@@ -84,63 +85,70 @@
|
|||||||
"@pureadmin/theme": "^3.2.0",
|
"@pureadmin/theme": "^3.2.0",
|
||||||
"@types/gradient-string": "^1.1.6",
|
"@types/gradient-string": "^1.1.6",
|
||||||
"@types/js-cookie": "^3.0.6",
|
"@types/js-cookie": "^3.0.6",
|
||||||
"@types/node": "^20.12.7",
|
"@types/node": "^20.16.1",
|
||||||
"@types/nprogress": "^0.2.3",
|
"@types/nprogress": "^0.2.3",
|
||||||
"@types/qs": "^6.9.15",
|
"@types/qs": "^6.9.15",
|
||||||
"@types/sortablejs": "^1.15.8",
|
"@types/sortablejs": "^1.15.8",
|
||||||
"@typescript-eslint/eslint-plugin": "^7.7.1",
|
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
||||||
"@typescript-eslint/parser": "^7.7.1",
|
"@typescript-eslint/parser": "^7.18.0",
|
||||||
"@vitejs/plugin-vue": "^5.0.4",
|
"@vitejs/plugin-vue": "^5.1.2",
|
||||||
"@vitejs/plugin-vue-jsx": "^3.1.0",
|
"@vitejs/plugin-vue-jsx": "^4.0.1",
|
||||||
"autoprefixer": "^10.4.19",
|
"autoprefixer": "^10.4.20",
|
||||||
"boxen": "^7.1.1",
|
"boxen": "^7.1.1",
|
||||||
"cssnano": "^6.1.2",
|
"cssnano": "^7.0.5",
|
||||||
"eslint": "^9.1.1",
|
"eslint": "^9.9.0",
|
||||||
"eslint-config-prettier": "^9.1.0",
|
"eslint-config-prettier": "^9.1.0",
|
||||||
"eslint-define-config": "^2.1.0",
|
"eslint-define-config": "^2.1.0",
|
||||||
"eslint-plugin-prettier": "^5.1.3",
|
"eslint-plugin-prettier": "^5.2.1",
|
||||||
"eslint-plugin-vue": "^9.25.0",
|
"eslint-plugin-vue": "^9.27.0",
|
||||||
"gradient-string": "^2.0.2",
|
"gradient-string": "^2.0.2",
|
||||||
"husky": "^9.0.11",
|
"husky": "^9.1.4",
|
||||||
"lint-staged": "^15.2.2",
|
"lint-staged": "^15.2.9",
|
||||||
"postcss": "^8.4.38",
|
"postcss": "^8.4.41",
|
||||||
"postcss-html": "^1.6.0",
|
"postcss-html": "^1.7.0",
|
||||||
"postcss-import": "^16.1.0",
|
"postcss-import": "^16.1.0",
|
||||||
"postcss-scss": "^4.0.9",
|
"postcss-scss": "^4.0.9",
|
||||||
"prettier": "^3.2.5",
|
"prettier": "^3.3.3",
|
||||||
"rimraf": "^5.0.5",
|
"rimraf": "^5.0.10",
|
||||||
"rollup-plugin-visualizer": "^5.12.0",
|
"rollup-plugin-visualizer": "^5.12.0",
|
||||||
"sass": "^1.75.0",
|
"sass": "^1.77.8",
|
||||||
"stylelint": "^16.3.1",
|
"stylelint": "^16.8.2",
|
||||||
"stylelint-config-recess-order": "^5.0.1",
|
"stylelint-config-recess-order": "^5.0.1",
|
||||||
"stylelint-config-recommended-vue": "^1.5.0",
|
"stylelint-config-recommended-vue": "^1.5.0",
|
||||||
"stylelint-config-standard-scss": "^13.1.0",
|
"stylelint-config-standard-scss": "^13.1.0",
|
||||||
"stylelint-prettier": "^5.0.0",
|
"stylelint-prettier": "^5.0.2",
|
||||||
"svgo": "^3.2.0",
|
"svgo": "^3.3.2",
|
||||||
"tailwindcss": "^3.4.3",
|
"tailwindcss": "^3.4.10",
|
||||||
"typescript": "^5.4.5",
|
"typescript": "^5.5.4",
|
||||||
"vite": "^5.2.10",
|
"vite": "^5.4.1",
|
||||||
"vite-plugin-cdn-import": "^0.3.5",
|
"vite-plugin-cdn-import": "^1.0.1",
|
||||||
|
"vite-plugin-checker": "^0.7.2",
|
||||||
"vite-plugin-compression": "^0.5.1",
|
"vite-plugin-compression": "^0.5.1",
|
||||||
"vite-plugin-fake-server": "^2.1.1",
|
"vite-plugin-fake-server": "^2.1.1",
|
||||||
"vite-plugin-remove-console": "^2.2.0",
|
"vite-plugin-remove-console": "^2.2.0",
|
||||||
"vite-plugin-router-warn": "^1.0.0",
|
"vite-plugin-router-warn": "^1.0.0",
|
||||||
|
"vite-plugin-vue-inspector": "^5.1.3",
|
||||||
"vite-svg-loader": "^5.1.0",
|
"vite-svg-loader": "^5.1.0",
|
||||||
"vue-eslint-parser": "^9.4.2",
|
"vue-eslint-parser": "^9.4.3",
|
||||||
"vue-tsc": "^1.8.27"
|
"vue-tsc": "^2.0.29"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0",
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0",
|
||||||
"pnpm": ">=8.6.10"
|
"pnpm": ">=9"
|
||||||
},
|
},
|
||||||
"packageManager": "pnpm@8.6.10",
|
|
||||||
"pnpm": {
|
"pnpm": {
|
||||||
"allowedDeprecatedVersions": {
|
"allowedDeprecatedVersions": {
|
||||||
|
"are-we-there-yet": "*",
|
||||||
"sourcemap-codec": "*",
|
"sourcemap-codec": "*",
|
||||||
"domexception": "*",
|
"domexception": "*",
|
||||||
"w3c-hr-time": "*",
|
"w3c-hr-time": "*",
|
||||||
|
"inflight": "*",
|
||||||
|
"npmlog": "*",
|
||||||
|
"rimraf": "*",
|
||||||
"stable": "*",
|
"stable": "*",
|
||||||
"abab": "*"
|
"gauge": "*",
|
||||||
|
"abab": "*",
|
||||||
|
"glob": "*"
|
||||||
},
|
},
|
||||||
"peerDependencyRules": {
|
"peerDependencyRules": {
|
||||||
"allowedVersions": {
|
"allowedVersions": {
|
||||||
|
|||||||
9858
pnpm-lock.yaml
generated
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"Version": "5.4.0",
|
"Version": "5.8.0",
|
||||||
"Title": "PureAdmin",
|
"Title": "PureAdmin",
|
||||||
"FixedHeader": true,
|
"FixedHeader": true,
|
||||||
"HiddenSideBar": false,
|
"HiddenSideBar": false,
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ export type UserResult = {
|
|||||||
nickname: string;
|
nickname: string;
|
||||||
/** 当前登录用户的角色 */
|
/** 当前登录用户的角色 */
|
||||||
roles: Array<string>;
|
roles: Array<string>;
|
||||||
|
/** 按钮级别权限 */
|
||||||
|
permissions: Array<string>;
|
||||||
/** `token` */
|
/** `token` */
|
||||||
accessToken: string;
|
accessToken: string;
|
||||||
/** 用于调用刷新`accessToken`的接口时所需的`token` */
|
/** 用于调用刷新`accessToken`的接口时所需的`token` */
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 439 B After Width: | Height: | Size: 439 B |
|
Before Width: | Height: | Size: 392 B After Width: | Height: | Size: 392 B |
|
Before Width: | Height: | Size: 161 B After Width: | Height: | Size: 161 B |
|
Before Width: | Height: | Size: 235 B After Width: | Height: | Size: 235 B |
|
Before Width: | Height: | Size: 840 B After Width: | Height: | Size: 840 B |
@@ -29,9 +29,11 @@ const addDialog = (options: DialogOptions) => {
|
|||||||
const closeDialog = (options: DialogOptions, index: number, args?: any) => {
|
const closeDialog = (options: DialogOptions, index: number, args?: any) => {
|
||||||
dialogStore.value[index].visible = false;
|
dialogStore.value[index].visible = false;
|
||||||
options.closeCallBack && options.closeCallBack({ options, index, args });
|
options.closeCallBack && options.closeCallBack({ options, index, args });
|
||||||
|
|
||||||
|
const closeDelay = options?.closeDelay ?? 200;
|
||||||
useTimeoutFn(() => {
|
useTimeoutFn(() => {
|
||||||
dialogStore.value.splice(index, 1);
|
dialogStore.value.splice(index, 1);
|
||||||
}, 200);
|
}, closeDelay);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ defineOptions({
|
|||||||
name: "ReDialog"
|
name: "ReDialog"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const sureBtnMap = ref({});
|
||||||
const fullscreen = ref(false);
|
const fullscreen = ref(false);
|
||||||
|
|
||||||
const footerButtons = computed(() => {
|
const footerButtons = computed(() => {
|
||||||
@@ -43,10 +44,26 @@ const footerButtons = computed(() => {
|
|||||||
bg: true,
|
bg: true,
|
||||||
popconfirm: options?.popconfirm,
|
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();
|
||||||
}
|
}
|
||||||
@@ -172,6 +189,7 @@ function handleClose(
|
|||||||
<el-button
|
<el-button
|
||||||
v-else
|
v-else
|
||||||
v-bind="btn"
|
v-bind="btn"
|
||||||
|
:loading="key === 1 && sureBtnMap[index]?.loading"
|
||||||
@click="
|
@click="
|
||||||
btn.btnClick({
|
btn.btnClick({
|
||||||
dialog: { options, index },
|
dialog: { options, index },
|
||||||
|
|||||||
@@ -69,11 +69,11 @@ type DialogProps = {
|
|||||||
type Popconfirm = {
|
type Popconfirm = {
|
||||||
/** 标题 */
|
/** 标题 */
|
||||||
title?: string;
|
title?: string;
|
||||||
/** 确认按钮文字 */
|
/** 确定按钮文字 */
|
||||||
confirmButtonText?: string;
|
confirmButtonText?: string;
|
||||||
/** 取消按钮文字 */
|
/** 取消按钮文字 */
|
||||||
cancelButtonText?: string;
|
cancelButtonText?: string;
|
||||||
/** 确认按钮类型,默认 `primary` */
|
/** 确定按钮类型,默认 `primary` */
|
||||||
confirmButtonType?: ButtonType;
|
confirmButtonType?: ButtonType;
|
||||||
/** 取消按钮类型,默认 `text` */
|
/** 取消按钮类型,默认 `text` */
|
||||||
cancelButtonType?: ButtonType;
|
cancelButtonType?: ButtonType;
|
||||||
@@ -121,7 +121,7 @@ type ButtonProps = {
|
|||||||
round?: boolean;
|
round?: boolean;
|
||||||
/** 是否为圆形按钮,默认 `false` */
|
/** 是否为圆形按钮,默认 `false` */
|
||||||
circle?: boolean;
|
circle?: boolean;
|
||||||
/** 确认按钮的 `Popconfirm` 气泡确认框相关配置 */
|
/** 确定按钮的 `Popconfirm` 气泡确认框相关配置 */
|
||||||
popconfirm?: Popconfirm;
|
popconfirm?: Popconfirm;
|
||||||
/** 是否为加载中状态,默认 `false` */
|
/** 是否为加载中状态,默认 `false` */
|
||||||
loading?: boolean;
|
loading?: boolean;
|
||||||
@@ -160,8 +160,10 @@ interface DialogOptions extends DialogProps {
|
|||||||
props?: any;
|
props?: any;
|
||||||
/** 是否隐藏 `Dialog` 按钮操作区的内容 */
|
/** 是否隐藏 `Dialog` 按钮操作区的内容 */
|
||||||
hideFooter?: boolean;
|
hideFooter?: boolean;
|
||||||
/** 确认按钮的 `Popconfirm` 气泡确认框相关配置 */
|
/** 确定按钮的 `Popconfirm` 气泡确认框相关配置 */
|
||||||
popconfirm?: 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}
|
||||||
@@ -259,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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { IconifyIconOnline, IconifyIconOffline, FontIcon } 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.github.io/pure-admin-doc/pages/icon/}
|
||||||
* @param icon 必传 图标
|
* @param icon 必传 图标
|
||||||
* @param attrs 可选 iconType 属性
|
* @param attrs 可选 iconType 属性
|
||||||
* @returns Component
|
* @returns Component
|
||||||
|
|||||||
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;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
@@ -17,11 +17,13 @@ import {
|
|||||||
getKeyList
|
getKeyList
|
||||||
} from "@pureadmin/utils";
|
} from "@pureadmin/utils";
|
||||||
|
|
||||||
import DragIcon from "./svg/drag.svg?component";
|
import Fullscreen from "@iconify-icons/ri/fullscreen-fill";
|
||||||
import ExpandIcon from "./svg/expand.svg?component";
|
import ExitFullscreen from "@iconify-icons/ri/fullscreen-exit-fill";
|
||||||
import RefreshIcon from "./svg/refresh.svg?component";
|
import DragIcon from "@/assets/table-bar/drag.svg?component";
|
||||||
import SettingIcon from "./svg/settings.svg?component";
|
import ExpandIcon from "@/assets/table-bar/expand.svg?component";
|
||||||
import CollapseIcon from "./svg/collapse.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 = {
|
||||||
/** 头部最左边的标题 */
|
/** 头部最左边的标题 */
|
||||||
@@ -56,6 +58,7 @@ export default defineComponent({
|
|||||||
const size = ref("default");
|
const size = ref("default");
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const checkAll = ref(true);
|
const checkAll = ref(true);
|
||||||
|
const isFullscreen = ref(false);
|
||||||
const isIndeterminate = ref(false);
|
const isIndeterminate = ref(false);
|
||||||
const instance = getCurrentInstance()!;
|
const instance = getCurrentInstance()!;
|
||||||
const isExpandAll = ref(props.isExpandAll);
|
const isExpandAll = ref(props.isExpandAll);
|
||||||
@@ -239,7 +242,18 @@ export default defineComponent({
|
|||||||
|
|
||||||
return () => (
|
return () => (
|
||||||
<>
|
<>
|
||||||
<div {...attrs} class="w-[99/100] mt-2 px-2 pb-2 bg-bg_color">
|
<div
|
||||||
|
{...attrs}
|
||||||
|
class={[
|
||||||
|
"w-[99/100]",
|
||||||
|
"px-2",
|
||||||
|
"pb-2",
|
||||||
|
"bg-bg_color",
|
||||||
|
isFullscreen.value
|
||||||
|
? ["!w-full", "!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()
|
||||||
@@ -353,6 +367,14 @@ export default defineComponent({
|
|||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
</div>
|
</div>
|
||||||
</el-popover>
|
</el-popover>
|
||||||
|
<el-divider direction="vertical" />
|
||||||
|
|
||||||
|
<iconifyIconOffline
|
||||||
|
class={["w-[16px]", iconClass.value]}
|
||||||
|
icon={isFullscreen.value ? ExitFullscreen : Fullscreen}
|
||||||
|
v-tippy={isFullscreen.value ? "退出全屏" : "全屏"}
|
||||||
|
onClick={() => (isFullscreen.value = !isFullscreen.value)}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{slots.default({
|
{slots.default({
|
||||||
|
|||||||
@@ -127,7 +127,9 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
watch(() => props.size, handleResizeInit);
|
watch(() => props.size, handleResizeInit, {
|
||||||
|
immediate: true
|
||||||
|
});
|
||||||
|
|
||||||
const rendLabel = () => {
|
const rendLabel = () => {
|
||||||
return props.options.map((option, index) => {
|
return props.options.map((option, index) => {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ export interface OptionsType {
|
|||||||
label?: string | (() => VNode | Component);
|
label?: string | (() => VNode | Component);
|
||||||
/**
|
/**
|
||||||
* @description 图标,采用平台内置的 `useRenderIcon` 函数渲染
|
* @description 图标,采用平台内置的 `useRenderIcon` 函数渲染
|
||||||
* @see {@link 用法参考 https://yiming_chang.gitee.io/pure-admin-doc/pages/icon/#%E9%80%9A%E7%94%A8%E5%9B%BE%E6%A0%87-userendericon-hooks }
|
* @see {@link 用法参考 https://pure-admin.github.io/pure-admin-doc/pages/icon/#%E9%80%9A%E7%94%A8%E5%9B%BE%E6%A0%87-userendericon-hooks }
|
||||||
*/
|
*/
|
||||||
icon?: string | Component;
|
icon?: string | Component;
|
||||||
/** 图标属性、样式配置 */
|
/** 图标属性、样式配置 */
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { hasAuth } from "@/router/utils";
|
|||||||
import type { Directive, DirectiveBinding } from "vue";
|
import type { Directive, DirectiveBinding } from "vue";
|
||||||
|
|
||||||
export const auth: Directive = {
|
export const auth: Directive = {
|
||||||
mounted(el: HTMLElement, binding: DirectiveBinding) {
|
mounted(el: HTMLElement, binding: DirectiveBinding<string | Array<string>>) {
|
||||||
const { value } = binding;
|
const { value } = binding;
|
||||||
if (value) {
|
if (value) {
|
||||||
!hasAuth(value) && el.parentNode?.removeChild(el);
|
!hasAuth(value) && el.parentNode?.removeChild(el);
|
||||||
|
|||||||
@@ -3,13 +3,13 @@ import { useEventListener } from "@vueuse/core";
|
|||||||
import { copyTextToClipboard } from "@pureadmin/utils";
|
import { copyTextToClipboard } from "@pureadmin/utils";
|
||||||
import type { Directive, DirectiveBinding } from "vue";
|
import type { Directive, DirectiveBinding } from "vue";
|
||||||
|
|
||||||
interface CopyEl extends HTMLElement {
|
export interface CopyEl extends HTMLElement {
|
||||||
copyValue: string;
|
copyValue: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 文本复制指令(默认双击复制) */
|
/** 文本复制指令(默认双击复制) */
|
||||||
export const copy: Directive = {
|
export const copy: Directive = {
|
||||||
mounted(el: CopyEl, binding: DirectiveBinding) {
|
mounted(el: CopyEl, binding: DirectiveBinding<string>) {
|
||||||
const { value } = binding;
|
const { value } = binding;
|
||||||
if (value) {
|
if (value) {
|
||||||
el.copyValue = value;
|
el.copyValue = value;
|
||||||
|
|||||||
@@ -2,4 +2,5 @@ export * from "./auth";
|
|||||||
export * from "./copy";
|
export * from "./copy";
|
||||||
export * from "./longpress";
|
export * from "./longpress";
|
||||||
export * from "./optimize";
|
export * from "./optimize";
|
||||||
|
export * from "./perms";
|
||||||
export * from "./ripple";
|
export * from "./ripple";
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import type { Directive, DirectiveBinding } from "vue";
|
|||||||
import { subBefore, subAfter, isFunction } from "@pureadmin/utils";
|
import { subBefore, subAfter, isFunction } from "@pureadmin/utils";
|
||||||
|
|
||||||
export const longpress: Directive = {
|
export const longpress: Directive = {
|
||||||
mounted(el: HTMLElement, binding: DirectiveBinding) {
|
mounted(el: HTMLElement, binding: DirectiveBinding<Function>) {
|
||||||
const cb = binding.value;
|
const cb = binding.value;
|
||||||
if (cb && isFunction(cb)) {
|
if (cb && isFunction(cb)) {
|
||||||
let timer = null;
|
let timer = null;
|
||||||
|
|||||||
@@ -8,9 +8,22 @@ import {
|
|||||||
import { useEventListener } from "@vueuse/core";
|
import { useEventListener } from "@vueuse/core";
|
||||||
import type { Directive, DirectiveBinding } from "vue";
|
import type { Directive, DirectiveBinding } from "vue";
|
||||||
|
|
||||||
|
export interface OptimizeOptions {
|
||||||
|
/** 事件名 */
|
||||||
|
event: string;
|
||||||
|
/** 事件触发的方法 */
|
||||||
|
fn: (...params: any) => any;
|
||||||
|
/** 是否立即执行 */
|
||||||
|
immediate?: boolean;
|
||||||
|
/** 防抖或节流的延迟时间(防抖默认:`200`毫秒、节流默认:`1000`毫秒) */
|
||||||
|
timeout?: number;
|
||||||
|
/** 传递的参数 */
|
||||||
|
params?: any;
|
||||||
|
}
|
||||||
|
|
||||||
/** 防抖(v-optimize或v-optimize:debounce)、节流(v-optimize:throttle)指令 */
|
/** 防抖(v-optimize或v-optimize:debounce)、节流(v-optimize:throttle)指令 */
|
||||||
export const optimize: Directive = {
|
export const optimize: Directive = {
|
||||||
mounted(el: HTMLElement, binding: DirectiveBinding) {
|
mounted(el: HTMLElement, binding: DirectiveBinding<OptimizeOptions>) {
|
||||||
const { value } = binding;
|
const { value } = binding;
|
||||||
const optimizeType = binding.arg ?? "debounce";
|
const optimizeType = binding.arg ?? "debounce";
|
||||||
const type = ["debounce", "throttle"].find(t => t === optimizeType);
|
const type = ["debounce", "throttle"].find(t => t === optimizeType);
|
||||||
|
|||||||
15
src/directives/perms/index.ts
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import { hasPerms } from "@/utils/auth";
|
||||||
|
import type { Directive, DirectiveBinding } from "vue";
|
||||||
|
|
||||||
|
export const perms: Directive = {
|
||||||
|
mounted(el: HTMLElement, binding: DirectiveBinding<string | Array<string>>) {
|
||||||
|
const { value } = binding;
|
||||||
|
if (value) {
|
||||||
|
!hasPerms(value) && el.parentNode?.removeChild(el);
|
||||||
|
} else {
|
||||||
|
throw new Error(
|
||||||
|
"[Directive: perms]: need perms! Like v-perms=\"['btn.add','btn.edit']\""
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -2,8 +2,10 @@ import "./index.scss";
|
|||||||
import { isObject } from "@pureadmin/utils";
|
import { isObject } from "@pureadmin/utils";
|
||||||
import type { Directive, DirectiveBinding } from "vue";
|
import type { Directive, DirectiveBinding } from "vue";
|
||||||
|
|
||||||
interface RippleOptions {
|
export interface RippleOptions {
|
||||||
|
/** 自定义`ripple`颜色,支持`tailwindcss` */
|
||||||
class?: string;
|
class?: string;
|
||||||
|
/** 是否从中心扩散 */
|
||||||
center?: boolean;
|
center?: boolean;
|
||||||
circle?: boolean;
|
circle?: boolean;
|
||||||
}
|
}
|
||||||
@@ -220,13 +222,6 @@ function updated(el: HTMLElement, binding: RippleDirectiveBinding) {
|
|||||||
updateRipple(el, binding, wasEnabled);
|
updateRipple(el, binding, wasEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 指令 v-ripple
|
|
||||||
* @use 用法如下
|
|
||||||
* 1. v-ripple 代表启用基本的 ripple 功能
|
|
||||||
* 2. v-ripple="{ class: 'text-red' }" 代表自定义 ripple 颜色,支持 tailwindcss,生效样式是 color
|
|
||||||
* 3. v-ripple.center 代表从中心扩散
|
|
||||||
*/
|
|
||||||
export const Ripple: Directive = {
|
export const Ripple: Directive = {
|
||||||
mounted,
|
mounted,
|
||||||
unmounted,
|
unmounted,
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import Footer from "./footer/index.vue";
|
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 { useGlobal, isNumber } from "@pureadmin/utils";
|
||||||
import KeepAliveFrame from "./keepAliveFrame/index.vue";
|
import BackTopIcon from "@/assets/svg/back_top.svg?component";
|
||||||
import backTop from "@/assets/svg/back_top.svg?component";
|
|
||||||
import { h, computed, Transition, defineComponent } from "vue";
|
import { h, computed, Transition, defineComponent } from "vue";
|
||||||
import { usePermissionStoreHook } from "@/store/modules/permission";
|
import { usePermissionStoreHook } from "@/store/modules/permission";
|
||||||
|
|
||||||
@@ -10,6 +11,7 @@ const props = defineProps({
|
|||||||
fixedHeader: Boolean
|
fixedHeader: Boolean
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const { showModel } = useTags();
|
||||||
const { $storage, $config } = useGlobal<GlobalPropertiesApi>();
|
const { $storage, $config } = useGlobal<GlobalPropertiesApi>();
|
||||||
|
|
||||||
const isKeepAlive = computed(() => {
|
const isKeepAlive = computed(() => {
|
||||||
@@ -49,9 +51,17 @@ const getMainWidth = computed(() => {
|
|||||||
const getSectionStyle = computed(() => {
|
const getSectionStyle = computed(() => {
|
||||||
return [
|
return [
|
||||||
hideTabs.value && layout ? "padding-top: 48px;" : "",
|
hideTabs.value && layout ? "padding-top: 48px;" : "",
|
||||||
!hideTabs.value && layout ? "padding-top: 81px;" : "",
|
!hideTabs.value && layout
|
||||||
|
? showModel.value == "chrome"
|
||||||
|
? "padding-top: 85px;"
|
||||||
|
: "padding-top: 81px;"
|
||||||
|
: "",
|
||||||
hideTabs.value && !layout.value ? "padding-top: 48px;" : "",
|
hideTabs.value && !layout.value ? "padding-top: 48px;" : "",
|
||||||
!hideTabs.value && !layout.value ? "padding-top: 81px;" : "",
|
!hideTabs.value && !layout.value
|
||||||
|
? showModel.value == "chrome"
|
||||||
|
? "padding-top: 85px;"
|
||||||
|
: "padding-top: 81px;"
|
||||||
|
: "",
|
||||||
props.fixedHeader
|
props.fixedHeader
|
||||||
? ""
|
? ""
|
||||||
: `padding-top: 0;${
|
: `padding-top: 0;${
|
||||||
@@ -97,15 +107,15 @@ const transitionMain = defineComponent({
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<section
|
<section
|
||||||
:class="[props.fixedHeader ? 'app-main' : 'app-main-nofixed-header']"
|
:class="[fixedHeader ? 'app-main' : 'app-main-nofixed-header']"
|
||||||
:style="getSectionStyle"
|
:style="getSectionStyle"
|
||||||
>
|
>
|
||||||
<router-view>
|
<router-view>
|
||||||
<template #default="{ Component, route }">
|
<template #default="{ Component, route }">
|
||||||
<KeepAliveFrame :currComp="Component" :currRoute="route">
|
<LayFrame :currComp="Component" :currRoute="route">
|
||||||
<template #default="{ Comp, fullPath, frameInfo }">
|
<template #default="{ Comp, fullPath, frameInfo }">
|
||||||
<el-scrollbar
|
<el-scrollbar
|
||||||
v-if="props.fixedHeader"
|
v-if="fixedHeader"
|
||||||
:wrap-style="{
|
:wrap-style="{
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
'flex-wrap': 'wrap',
|
'flex-wrap': 'wrap',
|
||||||
@@ -124,7 +134,7 @@ const transitionMain = defineComponent({
|
|||||||
title="回到顶部"
|
title="回到顶部"
|
||||||
target=".app-main .el-scrollbar__wrap"
|
target=".app-main .el-scrollbar__wrap"
|
||||||
>
|
>
|
||||||
<backTop />
|
<BackTopIcon />
|
||||||
</el-backtop>
|
</el-backtop>
|
||||||
<div class="grow">
|
<div class="grow">
|
||||||
<transitionMain :route="route">
|
<transitionMain :route="route">
|
||||||
@@ -148,7 +158,7 @@ const transitionMain = defineComponent({
|
|||||||
/>
|
/>
|
||||||
</transitionMain>
|
</transitionMain>
|
||||||
</div>
|
</div>
|
||||||
<Footer v-if="!hideFooter" />
|
<LayFooter v-if="!hideFooter" />
|
||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
<div v-else class="grow">
|
<div v-else class="grow">
|
||||||
<transitionMain :route="route">
|
<transitionMain :route="route">
|
||||||
@@ -173,12 +183,12 @@ const transitionMain = defineComponent({
|
|||||||
</transitionMain>
|
</transitionMain>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</KeepAliveFrame>
|
</LayFrame>
|
||||||
</template>
|
</template>
|
||||||
</router-view>
|
</router-view>
|
||||||
|
|
||||||
<!-- 页脚 -->
|
<!-- 页脚 -->
|
||||||
<Footer v-if="!hideFooter && !props.fixedHeader" />
|
<LayFooter v-if="!hideFooter && !fixedHeader" />
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { getConfig } from "@/config";
|
import { getConfig } from "@/config";
|
||||||
|
import { useMultiFrame } from "@/layout/hooks/useMultiFrame";
|
||||||
import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
|
import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
|
||||||
import { type Component, shallowRef, watch, computed } from "vue";
|
import { type Component, shallowRef, watch, computed } from "vue";
|
||||||
import { type RouteRecordRaw, RouteLocationNormalizedLoaded } from "vue-router";
|
import { type RouteRecordRaw, RouteLocationNormalizedLoaded } from "vue-router";
|
||||||
import { useMultiFrame } from "@/layout/components/keepAliveFrame/useMultiFrame";
|
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
currRoute: RouteLocationNormalizedLoaded;
|
currRoute: RouteLocationNormalizedLoaded;
|
||||||
@@ -20,7 +20,7 @@ const keep = computed(() => {
|
|||||||
!!props.currRoute.meta?.frameSrc
|
!!props.currRoute.meta?.frameSrc
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
// 避免重新渲染 frameView
|
// 避免重新渲染 LayFrame
|
||||||
const normalComp = computed(() => !keep.value && props.currComp);
|
const normalComp = computed(() => !keep.value && props.currComp);
|
||||||
|
|
||||||
watch(useMultiTagsStoreHook().multiTags, (tags: any) => {
|
watch(useMultiTagsStoreHook().multiTags, (tags: any) => {
|
||||||
@@ -65,7 +65,7 @@ watch(
|
|||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<template v-for="[fullPath, Comp] in compList" :key="fullPath">
|
<template v-for="[fullPath, Comp] in compList" :key="fullPath">
|
||||||
<div v-show="fullPath === props.currRoute.fullPath" class="w-full h-full">
|
<div v-show="fullPath === currRoute.fullPath" class="w-full h-full">
|
||||||
<slot
|
<slot
|
||||||
:fullPath="fullPath"
|
:fullPath="fullPath"
|
||||||
:Comp="Comp"
|
:Comp="Comp"
|
||||||
@@ -74,6 +74,6 @@ watch(
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<div v-show="!keep" class="w-full h-full">
|
<div v-show="!keep" class="w-full h-full">
|
||||||
<slot :Comp="normalComp" :fullPath="props.currRoute.fullPath" frameInfo />
|
<slot :Comp="normalComp" :fullPath="currRoute.fullPath" frameInfo />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -1,11 +1,12 @@
|
|||||||
<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 FullScreen from "./sidebar/fullScreen.vue";
|
import LaySearch from "../lay-search/index.vue";
|
||||||
import Breadcrumb from "./sidebar/breadCrumb.vue";
|
import LayNotice from "../lay-notice/index.vue";
|
||||||
import topCollapse from "./sidebar/topCollapse.vue";
|
import LayNavMix from "../lay-sidebar/NavMix.vue";
|
||||||
|
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 "@iconify-icons/ri/logout-circle-r-line";
|
import LogoutCircleRLine from "@iconify-icons/ri/logout-circle-r-line";
|
||||||
import Setting from "@iconify-icons/ri/settings-3-line";
|
import Setting from "@iconify-icons/ri/settings-3-line";
|
||||||
|
|
||||||
@@ -24,27 +25,27 @@ const {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="navbar bg-[#fff] shadow-sm shadow-[rgba(0,21,41,0.08)]">
|
<div class="navbar bg-[#fff] shadow-sm shadow-[rgba(0,21,41,0.08)]">
|
||||||
<topCollapse
|
<LaySidebarTopCollapse
|
||||||
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 id="header-search" />
|
<LaySearch id="header-search" />
|
||||||
<!-- 全屏 -->
|
<!-- 全屏 -->
|
||||||
<FullScreen id="full-screen" />
|
<LaySidebarFullScreen id="full-screen" />
|
||||||
<!-- 消息通知 -->
|
<!-- 消息通知 -->
|
||||||
<Notice id="header-notice" />
|
<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">
|
||||||
@@ -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: () => {}
|
||||||
@@ -52,9 +52,9 @@ function hoverDescription(event, description) {
|
|||||||
class="notice-container border-b-[1px] border-solid border-[#f0f0f0] dark:border-[#303030]"
|
class="notice-container border-b-[1px] border-solid border-[#f0f0f0] dark:border-[#303030]"
|
||||||
>
|
>
|
||||||
<el-avatar
|
<el-avatar
|
||||||
v-if="props.noticeItem.avatar"
|
v-if="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>
|
||||||
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,22 +1,34 @@
|
|||||||
<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 "@iconify-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>
|
||||||
@@ -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 {
|
||||||
@@ -3,7 +3,7 @@ import { emitter } from "@/utils/mitt";
|
|||||||
import { onClickOutside } from "@vueuse/core";
|
import { onClickOutside } from "@vueuse/core";
|
||||||
import { ref, computed, onMounted, onBeforeUnmount } from "vue";
|
import { ref, computed, onMounted, onBeforeUnmount } from "vue";
|
||||||
import { useDataThemeChange } from "@/layout/hooks/useDataThemeChange";
|
import { useDataThemeChange } from "@/layout/hooks/useDataThemeChange";
|
||||||
import Close from "@iconify-icons/ep/close";
|
import CloseIcon from "@iconify-icons/ep/close";
|
||||||
|
|
||||||
const target = ref(null);
|
const target = ref(null);
|
||||||
const show = ref<Boolean>(false);
|
const show = ref<Boolean>(false);
|
||||||
@@ -64,7 +64,7 @@ onBeforeUnmount(() => {
|
|||||||
class="dark:text-white"
|
class="dark:text-white"
|
||||||
width="18px"
|
width="18px"
|
||||||
height="18px"
|
height="18px"
|
||||||
:icon="Close"
|
:icon="CloseIcon"
|
||||||
@click="show = !show"
|
@click="show = !show"
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useNav } from "@/layout/hooks/useNav";
|
import { useNav } from "@/layout/hooks/useNav";
|
||||||
import mdiKeyboardEsc from "@/assets/svg/keyboard_esc.svg?component";
|
import MdiKeyboardEsc from "@/assets/svg/keyboard_esc.svg?component";
|
||||||
import enterOutlined from "@/assets/svg/enter_outlined.svg?component";
|
import EnterOutlined from "@/assets/svg/enter_outlined.svg?component";
|
||||||
import ArrowUpLine from "@iconify-icons/ri/arrow-up-line";
|
import ArrowUpLine from "@iconify-icons/ri/arrow-up-line";
|
||||||
import ArrowDownLine from "@iconify-icons/ri/arrow-down-line";
|
import ArrowDownLine from "@iconify-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>
|
||||||
@@ -160,7 +160,7 @@ defineExpose({ handleScroll });
|
|||||||
</template>
|
</template>
|
||||||
<template v-if="collectList.length">
|
<template v-if="collectList.length">
|
||||||
<div :style="titleStyle">
|
<div :style="titleStyle">
|
||||||
收藏{{ collectList.length > 1 ? "(可拖拽排序)" : "" }}
|
{{ `收藏${collectList.length > 1 ? "(可拖拽排序)" : ""}` }}
|
||||||
</div>
|
</div>
|
||||||
<div class="collect-container">
|
<div class="collect-container">
|
||||||
<div
|
<div
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { optionsItem } from "../types";
|
import type { optionsItem } from "../types";
|
||||||
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
|
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
|
||||||
import Star from "@iconify-icons/ep/star";
|
import StarIcon from "@iconify-icons/ep/star";
|
||||||
import Close from "@iconify-icons/ep/close";
|
import CloseIcon from "@iconify-icons/ep/close";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
item: optionsItem;
|
item: optionsItem;
|
||||||
@@ -32,12 +32,12 @@ function handleDelete(item) {
|
|||||||
</span>
|
</span>
|
||||||
<IconifyIconOffline
|
<IconifyIconOffline
|
||||||
v-show="item.type === 'history'"
|
v-show="item.type === 'history'"
|
||||||
:icon="Star"
|
:icon="StarIcon"
|
||||||
class="w-[18px] h-[18px] mr-2 hover:text-[#d7d5d4]"
|
class="w-[18px] h-[18px] mr-2 hover:text-[#d7d5d4]"
|
||||||
@click.stop="handleCollect(item)"
|
@click.stop="handleCollect(item)"
|
||||||
/>
|
/>
|
||||||
<IconifyIconOffline
|
<IconifyIconOffline
|
||||||
:icon="Close"
|
:icon="CloseIcon"
|
||||||
class="w-[18px] h-[18px] hover:text-[#d7d5d4] cursor-pointer"
|
class="w-[18px] h-[18px] hover:text-[#d7d5d4] cursor-pointer"
|
||||||
@click.stop="handleDelete(item)"
|
@click.stop="handleDelete(item)"
|
||||||
/>
|
/>
|
||||||
@@ -11,7 +11,7 @@ import { ref, computed, shallowRef, watch } from "vue";
|
|||||||
import { useDebounceFn, onKeyStroke } from "@vueuse/core";
|
import { useDebounceFn, onKeyStroke } from "@vueuse/core";
|
||||||
import { usePermissionStoreHook } from "@/store/modules/permission";
|
import { usePermissionStoreHook } from "@/store/modules/permission";
|
||||||
import { cloneDeep, isAllEmpty, storageLocal } from "@pureadmin/utils";
|
import { cloneDeep, isAllEmpty, storageLocal } from "@pureadmin/utils";
|
||||||
import Search from "@iconify-icons/ri/search-line";
|
import SearchIcon from "@iconify-icons/ri/search-line";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
/** 弹窗显隐 */
|
/** 弹窗显隐 */
|
||||||
@@ -294,7 +294,7 @@ onKeyStroke("ArrowDown", handleDown);
|
|||||||
>
|
>
|
||||||
<template #prefix>
|
<template #prefix>
|
||||||
<IconifyIconOffline
|
<IconifyIconOffline
|
||||||
:icon="Search"
|
:icon="SearchIcon"
|
||||||
class="text-primary w-[24px] h-[24px]"
|
class="text-primary w-[24px] h-[24px]"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
@@ -4,7 +4,7 @@ import { useResizeObserver } from "@pureadmin/utils";
|
|||||||
import { useEpThemeStoreHook } from "@/store/modules/epTheme";
|
import { useEpThemeStoreHook } from "@/store/modules/epTheme";
|
||||||
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
|
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
|
||||||
import { ref, computed, getCurrentInstance, onMounted } from "vue";
|
import { ref, computed, getCurrentInstance, onMounted } from "vue";
|
||||||
import enterOutlined from "@/assets/svg/enter_outlined.svg?component";
|
import EnterOutlined from "@/assets/svg/enter_outlined.svg?component";
|
||||||
|
|
||||||
interface Emits {
|
interface Emits {
|
||||||
(e: "update:value", val: string): void;
|
(e: "update:value", val: string): void;
|
||||||
@@ -83,7 +83,7 @@ defineExpose({ handleScroll });
|
|||||||
<span class="result-item-title">
|
<span class="result-item-title">
|
||||||
{{ item.meta?.title }}
|
{{ item.meta?.title }}
|
||||||
</span>
|
</span>
|
||||||
<enterOutlined />
|
<EnterOutlined />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { SearchModal } from "./components";
|
|
||||||
import { useBoolean } from "../../hooks/useBoolean";
|
import { useBoolean } from "../../hooks/useBoolean";
|
||||||
|
import SearchModal from "./components/SearchModal.vue";
|
||||||
|
|
||||||
const { bool: show, toggle } = useBoolean();
|
const { bool: show, toggle } = useBoolean();
|
||||||
function handleSearch() {
|
function handleSearch() {
|
||||||
@@ -9,8 +9,8 @@ import {
|
|||||||
onUnmounted,
|
onUnmounted,
|
||||||
onBeforeMount
|
onBeforeMount
|
||||||
} from "vue";
|
} from "vue";
|
||||||
import panel from "../panel/index.vue";
|
|
||||||
import { emitter } from "@/utils/mitt";
|
import { emitter } from "@/utils/mitt";
|
||||||
|
import LayPanel from "../lay-panel/index.vue";
|
||||||
import { useNav } from "@/layout/hooks/useNav";
|
import { useNav } from "@/layout/hooks/useNav";
|
||||||
import { useAppStoreHook } from "@/store/modules/app";
|
import { useAppStoreHook } from "@/store/modules/app";
|
||||||
import { toggleTheme } from "@pureadmin/theme/dist/browser-utils";
|
import { toggleTheme } from "@pureadmin/theme/dist/browser-utils";
|
||||||
@@ -22,9 +22,9 @@ import { useDark, useGlobal, debounce, isNumber } from "@pureadmin/utils";
|
|||||||
import Check from "@iconify-icons/ep/check";
|
import Check from "@iconify-icons/ep/check";
|
||||||
import LeftArrow from "@iconify-icons/ri/arrow-left-s-line";
|
import LeftArrow from "@iconify-icons/ri/arrow-left-s-line";
|
||||||
import RightArrow from "@iconify-icons/ri/arrow-right-s-line";
|
import RightArrow from "@iconify-icons/ri/arrow-right-s-line";
|
||||||
import dayIcon from "@/assets/svg/day.svg?component";
|
import DayIcon from "@/assets/svg/day.svg?component";
|
||||||
import darkIcon from "@/assets/svg/dark.svg?component";
|
import DarkIcon from "@/assets/svg/dark.svg?component";
|
||||||
import systemIcon from "@/assets/svg/system.svg?component";
|
import SystemIcon from "@/assets/svg/system.svg?component";
|
||||||
|
|
||||||
const { device } = useNav();
|
const { device } = useNav();
|
||||||
const { isDark } = useDark();
|
const { isDark } = useDark();
|
||||||
@@ -197,21 +197,21 @@ const themeOptions = computed<Array<OptionsType>>(() => {
|
|||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
label: "浅色",
|
label: "浅色",
|
||||||
icon: dayIcon,
|
icon: DayIcon,
|
||||||
theme: "light",
|
theme: "light",
|
||||||
tip: "清新启航,点亮舒适的工作界面",
|
tip: "清新启航,点亮舒适的工作界面",
|
||||||
iconAttrs: { fill: isDark.value ? "#fff" : "#000" }
|
iconAttrs: { fill: isDark.value ? "#fff" : "#000" }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "深色",
|
label: "深色",
|
||||||
icon: darkIcon,
|
icon: DarkIcon,
|
||||||
theme: "dark",
|
theme: "dark",
|
||||||
tip: "月光序曲,沉醉于夜的静谧雅致",
|
tip: "月光序曲,沉醉于夜的静谧雅致",
|
||||||
iconAttrs: { fill: isDark.value ? "#fff" : "#000" }
|
iconAttrs: { fill: isDark.value ? "#fff" : "#000" }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "自动",
|
label: "自动",
|
||||||
icon: systemIcon,
|
icon: SystemIcon,
|
||||||
theme: "system",
|
theme: "system",
|
||||||
tip: "同步时光,界面随晨昏自然呼应",
|
tip: "同步时光,界面随晨昏自然呼应",
|
||||||
iconAttrs: { fill: isDark.value ? "#fff" : "#000" }
|
iconAttrs: { fill: isDark.value ? "#fff" : "#000" }
|
||||||
@@ -230,6 +230,11 @@ const markOptions = computed<Array<OptionsType>>(() => {
|
|||||||
label: "卡片",
|
label: "卡片",
|
||||||
tip: "卡片标签,高效浏览",
|
tip: "卡片标签,高效浏览",
|
||||||
value: "card"
|
value: "card"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "谷歌",
|
||||||
|
tip: "谷歌风格,经典美观",
|
||||||
|
value: "chrome"
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
@@ -311,7 +316,7 @@ onUnmounted(() => removeMatchMedia);
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<panel>
|
<LayPanel>
|
||||||
<div class="p-5">
|
<div class="p-5">
|
||||||
<p :class="pClass">整体风格</p>
|
<p :class="pClass">整体风格</p>
|
||||||
<Segmented
|
<Segmented
|
||||||
@@ -440,7 +445,7 @@ onUnmounted(() => removeMatchMedia);
|
|||||||
<Segmented
|
<Segmented
|
||||||
resize
|
resize
|
||||||
class="select-none"
|
class="select-none"
|
||||||
:modelValue="markValue === 'smart' ? 0 : 1"
|
:modelValue="markValue === 'smart' ? 0 : markValue === 'card' ? 1 : 2"
|
||||||
:options="markOptions"
|
:options="markOptions"
|
||||||
@change="onChange"
|
@change="onChange"
|
||||||
/>
|
/>
|
||||||
@@ -511,7 +516,7 @@ onUnmounted(() => removeMatchMedia);
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</panel>
|
</LayPanel>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@@ -1,26 +1,34 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import Search from "../search/index.vue";
|
import { emitter } from "@/utils/mitt";
|
||||||
import Notice from "../notice/index.vue";
|
|
||||||
import FullScreen from "./fullScreen.vue";
|
|
||||||
import SidebarItem from "./sidebarItem.vue";
|
|
||||||
import { isAllEmpty } from "@pureadmin/utils";
|
|
||||||
import { ref, nextTick, computed } from "vue";
|
|
||||||
import { useNav } from "@/layout/hooks/useNav";
|
import { useNav } from "@/layout/hooks/useNav";
|
||||||
|
import LaySearch from "../lay-search/index.vue";
|
||||||
|
import LayNotice from "../lay-notice/index.vue";
|
||||||
|
import { responsiveStorageNameSpace } from "@/config";
|
||||||
|
import { ref, nextTick, computed, onMounted } from "vue";
|
||||||
|
import { storageLocal, isAllEmpty } from "@pureadmin/utils";
|
||||||
import { usePermissionStoreHook } from "@/store/modules/permission";
|
import { usePermissionStoreHook } from "@/store/modules/permission";
|
||||||
|
import LaySidebarItem from "../lay-sidebar/components/SidebarItem.vue";
|
||||||
|
import LaySidebarFullScreen from "../lay-sidebar/components/SidebarFullScreen.vue";
|
||||||
|
|
||||||
import LogoutCircleRLine from "@iconify-icons/ri/logout-circle-r-line";
|
import LogoutCircleRLine from "@iconify-icons/ri/logout-circle-r-line";
|
||||||
import Setting from "@iconify-icons/ri/settings-3-line";
|
import Setting from "@iconify-icons/ri/settings-3-line";
|
||||||
|
|
||||||
const menuRef = ref();
|
const menuRef = ref();
|
||||||
|
const showLogo = ref(
|
||||||
|
storageLocal().getItem<StorageConfigs>(
|
||||||
|
`${responsiveStorageNameSpace()}configure`
|
||||||
|
)?.showLogo ?? true
|
||||||
|
);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
route,
|
route,
|
||||||
title,
|
title,
|
||||||
logout,
|
logout,
|
||||||
backTopMenu,
|
|
||||||
onPanel,
|
onPanel,
|
||||||
getLogo,
|
getLogo,
|
||||||
username,
|
username,
|
||||||
userAvatar,
|
userAvatar,
|
||||||
|
backTopMenu,
|
||||||
avatarsStyle
|
avatarsStyle
|
||||||
} = useNav();
|
} = useNav();
|
||||||
|
|
||||||
@@ -31,6 +39,12 @@ const defaultActive = computed(() =>
|
|||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
menuRef.value?.handleResize();
|
menuRef.value?.handleResize();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
emitter.on("logoChange", key => {
|
||||||
|
showLogo.value = key;
|
||||||
|
});
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -38,19 +52,18 @@ nextTick(() => {
|
|||||||
v-loading="usePermissionStoreHook().wholeMenus.length === 0"
|
v-loading="usePermissionStoreHook().wholeMenus.length === 0"
|
||||||
class="horizontal-header"
|
class="horizontal-header"
|
||||||
>
|
>
|
||||||
<div class="horizontal-header-left" @click="backTopMenu">
|
<div v-if="showLogo" class="horizontal-header-left" @click="backTopMenu">
|
||||||
<img :src="getLogo()" alt="logo" />
|
<img :src="getLogo()" alt="logo" />
|
||||||
<span>{{ title }}</span>
|
<span>{{ title }}</span>
|
||||||
</div>
|
</div>
|
||||||
<el-menu
|
<el-menu
|
||||||
ref="menuRef"
|
ref="menuRef"
|
||||||
router
|
|
||||||
mode="horizontal"
|
mode="horizontal"
|
||||||
popper-class="pure-scrollbar"
|
popper-class="pure-scrollbar"
|
||||||
class="horizontal-header-menu"
|
class="horizontal-header-menu"
|
||||||
:default-active="defaultActive"
|
:default-active="defaultActive"
|
||||||
>
|
>
|
||||||
<sidebar-item
|
<LaySidebarItem
|
||||||
v-for="route in usePermissionStoreHook().wholeMenus"
|
v-for="route in usePermissionStoreHook().wholeMenus"
|
||||||
:key="route.path"
|
:key="route.path"
|
||||||
:item="route"
|
:item="route"
|
||||||
@@ -59,11 +72,11 @@ nextTick(() => {
|
|||||||
</el-menu>
|
</el-menu>
|
||||||
<div class="horizontal-header-right">
|
<div class="horizontal-header-right">
|
||||||
<!-- 菜单搜索 -->
|
<!-- 菜单搜索 -->
|
||||||
<Search id="header-search" />
|
<LaySearch id="header-search" />
|
||||||
<!-- 全屏 -->
|
<!-- 全屏 -->
|
||||||
<FullScreen id="full-screen" />
|
<LaySidebarFullScreen id="full-screen" />
|
||||||
<!-- 消息通知 -->
|
<!-- 消息通知 -->
|
||||||
<Notice id="header-notice" />
|
<LayNotice id="header-notice" />
|
||||||
<!-- 退出登录 -->
|
<!-- 退出登录 -->
|
||||||
<el-dropdown trigger="click">
|
<el-dropdown trigger="click">
|
||||||
<span class="el-dropdown-link navbar-bg-hover">
|
<span class="el-dropdown-link navbar-bg-hover">
|
||||||
@@ -1,14 +1,15 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import extraIcon from "./extraIcon.vue";
|
|
||||||
import Search from "../search/index.vue";
|
|
||||||
import Notice from "../notice/index.vue";
|
|
||||||
import FullScreen from "./fullScreen.vue";
|
|
||||||
import { isAllEmpty } from "@pureadmin/utils";
|
import { isAllEmpty } from "@pureadmin/utils";
|
||||||
import { useNav } from "@/layout/hooks/useNav";
|
import { useNav } from "@/layout/hooks/useNav";
|
||||||
|
import LaySearch from "../lay-search/index.vue";
|
||||||
|
import LayNotice from "../lay-notice/index.vue";
|
||||||
import { ref, toRaw, watch, onMounted, nextTick } from "vue";
|
import { ref, toRaw, watch, onMounted, nextTick } from "vue";
|
||||||
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
|
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
|
||||||
import { getParentPaths, findRouteByPath } from "@/router/utils";
|
import { getParentPaths, findRouteByPath } from "@/router/utils";
|
||||||
import { usePermissionStoreHook } from "@/store/modules/permission";
|
import { usePermissionStoreHook } from "@/store/modules/permission";
|
||||||
|
import LaySidebarExtraIcon from "../lay-sidebar/components/SidebarExtraIcon.vue";
|
||||||
|
import LaySidebarFullScreen from "../lay-sidebar/components/SidebarFullScreen.vue";
|
||||||
|
|
||||||
import LogoutCircleRLine from "@iconify-icons/ri/logout-circle-r-line";
|
import LogoutCircleRLine from "@iconify-icons/ri/logout-circle-r-line";
|
||||||
import Setting from "@iconify-icons/ri/settings-3-line";
|
import Setting from "@iconify-icons/ri/settings-3-line";
|
||||||
|
|
||||||
@@ -84,18 +85,18 @@ watch(
|
|||||||
<span class="select-none">
|
<span class="select-none">
|
||||||
{{ route.meta.title }}
|
{{ route.meta.title }}
|
||||||
</span>
|
</span>
|
||||||
<extraIcon :extraIcon="route.meta.extraIcon" />
|
<LaySidebarExtraIcon :extraIcon="route.meta.extraIcon" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
</el-menu>
|
</el-menu>
|
||||||
<div class="horizontal-header-right">
|
<div class="horizontal-header-right">
|
||||||
<!-- 菜单搜索 -->
|
<!-- 菜单搜索 -->
|
||||||
<Search id="header-search" />
|
<LaySearch id="header-search" />
|
||||||
<!-- 全屏 -->
|
<!-- 全屏 -->
|
||||||
<FullScreen id="full-screen" />
|
<LaySidebarFullScreen id="full-screen" />
|
||||||
<!-- 消息通知 -->
|
<!-- 消息通知 -->
|
||||||
<Notice id="header-notice" />
|
<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">
|
||||||
@@ -1,16 +1,16 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import Logo from "./logo.vue";
|
|
||||||
import { useRoute } from "vue-router";
|
import { useRoute } from "vue-router";
|
||||||
import { emitter } from "@/utils/mitt";
|
import { emitter } from "@/utils/mitt";
|
||||||
import SidebarItem from "./sidebarItem.vue";
|
|
||||||
import LeftCollapse from "./leftCollapse.vue";
|
|
||||||
import { useNav } from "@/layout/hooks/useNav";
|
import { useNav } from "@/layout/hooks/useNav";
|
||||||
import CenterCollapse from "./centerCollapse.vue";
|
|
||||||
import { responsiveStorageNameSpace } from "@/config";
|
import { responsiveStorageNameSpace } from "@/config";
|
||||||
import { storageLocal, isAllEmpty } from "@pureadmin/utils";
|
import { storageLocal, isAllEmpty } from "@pureadmin/utils";
|
||||||
import { findRouteByPath, getParentPaths } from "@/router/utils";
|
import { findRouteByPath, getParentPaths } from "@/router/utils";
|
||||||
import { usePermissionStoreHook } from "@/store/modules/permission";
|
import { usePermissionStoreHook } from "@/store/modules/permission";
|
||||||
import { ref, computed, watch, onMounted, onBeforeUnmount } from "vue";
|
import { ref, computed, watch, onMounted, onBeforeUnmount } from "vue";
|
||||||
|
import LaySidebarLogo from "../lay-sidebar/components/SidebarLogo.vue";
|
||||||
|
import LaySidebarItem from "../lay-sidebar/components/SidebarItem.vue";
|
||||||
|
import LaySidebarLeftCollapse from "../lay-sidebar/components/SidebarLeftCollapse.vue";
|
||||||
|
import LaySidebarCenterCollapse from "../lay-sidebar/components/SidebarCenterCollapse.vue";
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const isShow = ref(false);
|
const isShow = ref(false);
|
||||||
@@ -93,13 +93,12 @@ onBeforeUnmount(() => {
|
|||||||
@mouseenter.prevent="isShow = true"
|
@mouseenter.prevent="isShow = true"
|
||||||
@mouseleave.prevent="isShow = false"
|
@mouseleave.prevent="isShow = false"
|
||||||
>
|
>
|
||||||
<Logo v-if="showLogo" :collapse="isCollapse" />
|
<LaySidebarLogo v-if="showLogo" :collapse="isCollapse" />
|
||||||
<el-scrollbar
|
<el-scrollbar
|
||||||
wrap-class="scrollbar-wrapper"
|
wrap-class="scrollbar-wrapper"
|
||||||
:class="[device === 'mobile' ? 'mobile' : 'pc']"
|
:class="[device === 'mobile' ? 'mobile' : 'pc']"
|
||||||
>
|
>
|
||||||
<el-menu
|
<el-menu
|
||||||
router
|
|
||||||
unique-opened
|
unique-opened
|
||||||
mode="vertical"
|
mode="vertical"
|
||||||
popper-class="pure-scrollbar"
|
popper-class="pure-scrollbar"
|
||||||
@@ -109,7 +108,7 @@ onBeforeUnmount(() => {
|
|||||||
:popper-effect="tooltipEffect"
|
:popper-effect="tooltipEffect"
|
||||||
:default-active="defaultActive"
|
:default-active="defaultActive"
|
||||||
>
|
>
|
||||||
<sidebar-item
|
<LaySidebarItem
|
||||||
v-for="routes in menuData"
|
v-for="routes in menuData"
|
||||||
:key="routes.path"
|
:key="routes.path"
|
||||||
:item="routes"
|
:item="routes"
|
||||||
@@ -118,12 +117,12 @@ onBeforeUnmount(() => {
|
|||||||
/>
|
/>
|
||||||
</el-menu>
|
</el-menu>
|
||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
<CenterCollapse
|
<LaySidebarCenterCollapse
|
||||||
v-if="device !== 'mobile' && (isShow || isCollapse)"
|
v-if="device !== 'mobile' && (isShow || isCollapse)"
|
||||||
:is-active="pureApp.sidebar.opened"
|
:is-active="pureApp.sidebar.opened"
|
||||||
@toggleClick="toggleSideBar"
|
@toggleClick="toggleSideBar"
|
||||||
/>
|
/>
|
||||||
<LeftCollapse
|
<LaySidebarLeftCollapse
|
||||||
v-if="device !== 'mobile'"
|
v-if="device !== 'mobile'"
|
||||||
:is-active="pureApp.sidebar.opened"
|
:is-active="pureApp.sidebar.opened"
|
||||||
@toggleClick="toggleSideBar"
|
@toggleClick="toggleSideBar"
|
||||||
@@ -9,7 +9,7 @@ interface Props {
|
|||||||
isActive: boolean;
|
isActive: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = withDefaults(defineProps<Props>(), {
|
withDefaults(defineProps<Props>(), {
|
||||||
isActive: false
|
isActive: false
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ const toggleClick = () => {
|
|||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
v-tippy="{
|
v-tippy="{
|
||||||
content: props.isActive ? '点击折叠' : '点击展开',
|
content: isActive ? '点击折叠' : '点击展开',
|
||||||
theme: tooltipEffect,
|
theme: tooltipEffect,
|
||||||
hideOnClick: 'toggle',
|
hideOnClick: 'toggle',
|
||||||
placement: 'right'
|
placement: 'right'
|
||||||
@@ -45,7 +45,7 @@ const toggleClick = () => {
|
|||||||
<IconifyIconOffline
|
<IconifyIconOffline
|
||||||
:icon="ArrowLeft"
|
:icon="ArrowLeft"
|
||||||
:class="[iconClass, themeColor === 'light' ? '' : 'text-primary']"
|
:class="[iconClass, themeColor === 'light' ? '' : 'text-primary']"
|
||||||
:style="{ transform: props.isActive ? 'none' : 'rotateY(180deg)' }"
|
:style="{ transform: isActive ? 'none' : 'rotateY(180deg)' }"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
import { toRaw } from "vue";
|
import { toRaw } from "vue";
|
||||||
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
|
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
|
||||||
|
|
||||||
const props = defineProps({
|
defineProps({
|
||||||
extraIcon: {
|
extraIcon: {
|
||||||
type: String,
|
type: String,
|
||||||
default: ""
|
default: ""
|
||||||
@@ -11,9 +11,9 @@ const props = defineProps({
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div v-if="props.extraIcon" class="flex justify-center items-center">
|
<div v-if="extraIcon" class="flex justify-center items-center">
|
||||||
<component
|
<component
|
||||||
:is="useRenderIcon(toRaw(props.extraIcon))"
|
:is="useRenderIcon(toRaw(extraIcon))"
|
||||||
class="w-[30px] h-[30px]"
|
class="w-[30px] h-[30px]"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import { getConfig } from "@/config";
|
import { getConfig } from "@/config";
|
||||||
import LinkItem from "./linkItem.vue";
|
import { menuType } from "@/layout/types";
|
||||||
import { menuType } from "../../types";
|
|
||||||
import extraIcon from "./extraIcon.vue";
|
|
||||||
import { ReText } from "@/components/ReText";
|
import { ReText } from "@/components/ReText";
|
||||||
import { useNav } from "@/layout/hooks/useNav";
|
import { useNav } from "@/layout/hooks/useNav";
|
||||||
|
import SidebarLinkItem from "./SidebarLinkItem.vue";
|
||||||
|
import SidebarExtraIcon from "./SidebarExtraIcon.vue";
|
||||||
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
|
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
|
||||||
import {
|
import {
|
||||||
type PropType,
|
type PropType,
|
||||||
@@ -105,9 +105,9 @@ function resolvePath(routePath) {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<link-item
|
<SidebarLinkItem
|
||||||
v-if="
|
v-if="
|
||||||
hasOneShowingChild(props.item.children, props.item) &&
|
hasOneShowingChild(item.children, item) &&
|
||||||
(!onlyOneChild.children || onlyOneChild.noShowingChildren)
|
(!onlyOneChild.children || onlyOneChild.noShowingChildren)
|
||||||
"
|
"
|
||||||
:to="item"
|
:to="item"
|
||||||
@@ -119,7 +119,7 @@ function resolvePath(routePath) {
|
|||||||
v-bind="attrs"
|
v-bind="attrs"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
v-if="toRaw(props.item.meta.icon)"
|
v-if="toRaw(item.meta.icon)"
|
||||||
class="sub-menu-icon"
|
class="sub-menu-icon"
|
||||||
:style="getSubMenuIconStyle"
|
:style="getSubMenuIconStyle"
|
||||||
>
|
>
|
||||||
@@ -127,24 +127,24 @@ function resolvePath(routePath) {
|
|||||||
:is="
|
:is="
|
||||||
useRenderIcon(
|
useRenderIcon(
|
||||||
toRaw(onlyOneChild.meta.icon) ||
|
toRaw(onlyOneChild.meta.icon) ||
|
||||||
(props.item.meta && toRaw(props.item.meta.icon))
|
(item.meta && toRaw(item.meta.icon))
|
||||||
)
|
)
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<el-text
|
<el-text
|
||||||
v-if="
|
v-if="
|
||||||
(!props.item?.meta.icon &&
|
(!item?.meta.icon &&
|
||||||
isCollapse &&
|
isCollapse &&
|
||||||
layout === 'vertical' &&
|
layout === 'vertical' &&
|
||||||
props.item?.pathList?.length === 1) ||
|
item?.pathList?.length === 1) ||
|
||||||
(!onlyOneChild.meta.icon &&
|
(!onlyOneChild.meta.icon &&
|
||||||
isCollapse &&
|
isCollapse &&
|
||||||
layout === 'mix' &&
|
layout === 'mix' &&
|
||||||
props.item?.pathList?.length === 2)
|
item?.pathList?.length === 2)
|
||||||
"
|
"
|
||||||
truncated
|
truncated
|
||||||
class="!w-full !px-4 !text-inherit"
|
class="!w-full !pl-4 !text-inherit"
|
||||||
>
|
>
|
||||||
{{ onlyOneChild.meta.title }}
|
{{ onlyOneChild.meta.title }}
|
||||||
</el-text>
|
</el-text>
|
||||||
@@ -160,37 +160,35 @@ function resolvePath(routePath) {
|
|||||||
>
|
>
|
||||||
{{ onlyOneChild.meta.title }}
|
{{ onlyOneChild.meta.title }}
|
||||||
</ReText>
|
</ReText>
|
||||||
<extraIcon :extraIcon="onlyOneChild.meta.extraIcon" />
|
<SidebarExtraIcon :extraIcon="onlyOneChild.meta.extraIcon" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
</link-item>
|
</SidebarLinkItem>
|
||||||
<el-sub-menu
|
<el-sub-menu
|
||||||
v-else
|
v-else
|
||||||
ref="subMenu"
|
ref="subMenu"
|
||||||
teleported
|
teleported
|
||||||
:index="resolvePath(props.item.path)"
|
:index="resolvePath(item.path)"
|
||||||
v-bind="expandCloseIcon"
|
v-bind="expandCloseIcon"
|
||||||
>
|
>
|
||||||
<template #title>
|
<template #title>
|
||||||
<div
|
<div
|
||||||
v-if="toRaw(props.item.meta.icon)"
|
v-if="toRaw(item.meta.icon)"
|
||||||
:style="getSubMenuIconStyle"
|
:style="getSubMenuIconStyle"
|
||||||
class="sub-menu-icon"
|
class="sub-menu-icon"
|
||||||
>
|
>
|
||||||
<component
|
<component :is="useRenderIcon(item.meta && toRaw(item.meta.icon))" />
|
||||||
:is="useRenderIcon(props.item.meta && toRaw(props.item.meta.icon))"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
<ReText
|
<ReText
|
||||||
v-if="
|
v-if="
|
||||||
layout === 'mix' && toRaw(props.item.meta.icon)
|
layout === 'mix' && toRaw(item.meta.icon)
|
||||||
? !isCollapse || props.item?.pathList?.length !== 2
|
? !isCollapse || item?.pathList?.length !== 2
|
||||||
: !(
|
: !(
|
||||||
layout === 'vertical' &&
|
layout === 'vertical' &&
|
||||||
isCollapse &&
|
isCollapse &&
|
||||||
toRaw(props.item.meta.icon) &&
|
toRaw(item.meta.icon) &&
|
||||||
props.item.parentId === null
|
item.parentId === null
|
||||||
)
|
)
|
||||||
"
|
"
|
||||||
:tippyProps="{
|
:tippyProps="{
|
||||||
@@ -200,20 +198,20 @@ function resolvePath(routePath) {
|
|||||||
:class="{
|
:class="{
|
||||||
'!w-full': true,
|
'!w-full': true,
|
||||||
'!text-inherit': true,
|
'!text-inherit': true,
|
||||||
'!px-4':
|
'!pl-4':
|
||||||
layout !== 'horizontal' &&
|
layout !== 'horizontal' &&
|
||||||
isCollapse &&
|
isCollapse &&
|
||||||
!toRaw(props.item.meta.icon) &&
|
!toRaw(item.meta.icon) &&
|
||||||
props.item.parentId === null
|
item.parentId === null
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
{{ props.item.meta.title }}
|
{{ item.meta.title }}
|
||||||
</ReText>
|
</ReText>
|
||||||
<extraIcon v-if="!isCollapse" :extraIcon="props.item.meta.extraIcon" />
|
<SidebarExtraIcon v-if="!isCollapse" :extraIcon="item.meta.extraIcon" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<sidebar-item
|
<sidebar-item
|
||||||
v-for="child in props.item.children"
|
v-for="child in item.children"
|
||||||
:key="child.path"
|
:key="child.path"
|
||||||
:is-nest="true"
|
:is-nest="true"
|
||||||
:item="child"
|
:item="child"
|
||||||
@@ -9,7 +9,7 @@ interface Props {
|
|||||||
isActive: boolean;
|
isActive: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = withDefaults(defineProps<Props>(), {
|
withDefaults(defineProps<Props>(), {
|
||||||
isActive: false
|
isActive: false
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -44,14 +44,14 @@ const toggleClick = () => {
|
|||||||
<div class="left-collapse">
|
<div class="left-collapse">
|
||||||
<IconifyIconOffline
|
<IconifyIconOffline
|
||||||
v-tippy="{
|
v-tippy="{
|
||||||
content: props.isActive ? '点击折叠' : '点击展开',
|
content: isActive ? '点击折叠' : '点击展开',
|
||||||
theme: tooltipEffect,
|
theme: tooltipEffect,
|
||||||
hideOnClick: 'toggle',
|
hideOnClick: 'toggle',
|
||||||
placement: 'right'
|
placement: 'right'
|
||||||
}"
|
}"
|
||||||
:icon="MenuFold"
|
:icon="MenuFold"
|
||||||
:class="[iconClass, themeColor === 'light' ? '' : 'text-primary']"
|
:class="[iconClass, themeColor === 'light' ? '' : 'text-primary']"
|
||||||
:style="{ transform: props.isActive ? 'none' : 'rotateY(180deg)' }"
|
:style="{ transform: isActive ? 'none' : 'rotateY(180deg)' }"
|
||||||
@click="toggleClick"
|
@click="toggleClick"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -3,10 +3,6 @@ import { computed } from "vue";
|
|||||||
import { isUrl } from "@pureadmin/utils";
|
import { isUrl } from "@pureadmin/utils";
|
||||||
import { menuType } from "@/layout/types";
|
import { menuType } from "@/layout/types";
|
||||||
|
|
||||||
defineOptions({
|
|
||||||
name: "LinkItem"
|
|
||||||
});
|
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
to: menuType;
|
to: menuType;
|
||||||
}>();
|
}>();
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
import { getTopMenu } from "@/router/utils";
|
import { getTopMenu } from "@/router/utils";
|
||||||
import { useNav } from "@/layout/hooks/useNav";
|
import { useNav } from "@/layout/hooks/useNav";
|
||||||
|
|
||||||
const props = defineProps({
|
defineProps({
|
||||||
collapse: Boolean
|
collapse: Boolean
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -10,11 +10,11 @@ const { title, getLogo } = useNav();
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="sidebar-logo-container" :class="{ collapses: props.collapse }">
|
<div class="sidebar-logo-container" :class="{ collapses: collapse }">
|
||||||
<transition name="sidebarLogoFade">
|
<transition name="sidebarLogoFade">
|
||||||
<router-link
|
<router-link
|
||||||
v-if="props.collapse"
|
v-if="collapse"
|
||||||
key="props.collapse"
|
key="collapse"
|
||||||
:title="title"
|
:title="title"
|
||||||
class="sidebar-logo-link"
|
class="sidebar-logo-link"
|
||||||
:to="getTopMenu()?.path ?? '/'"
|
:to="getTopMenu()?.path ?? '/'"
|
||||||
@@ -6,7 +6,7 @@ interface Props {
|
|||||||
isActive: boolean;
|
isActive: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = withDefaults(defineProps<Props>(), {
|
withDefaults(defineProps<Props>(), {
|
||||||
isActive: false
|
isActive: false
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -22,11 +22,11 @@ const toggleClick = () => {
|
|||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
class="px-3 mr-1 navbar-bg-hover"
|
class="px-3 mr-1 navbar-bg-hover"
|
||||||
:title="props.isActive ? '点击折叠' : '点击展开'"
|
:title="isActive ? '点击折叠' : '点击展开'"
|
||||||
@click="toggleClick"
|
@click="toggleClick"
|
||||||
>
|
>
|
||||||
<IconifyIconOffline
|
<IconifyIconOffline
|
||||||
:icon="props.isActive ? MenuFold : MenuUnfold"
|
:icon="isActive ? MenuFold : MenuUnfold"
|
||||||
class="inline-block align-middle hover:text-primary dark:hover:!text-white"
|
class="inline-block align-middle hover:text-primary dark:hover:!text-white"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
33
src/layout/components/lay-tag/components/TagChrome.vue
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
<template>
|
||||||
|
<svg class="w-full h-full">
|
||||||
|
<defs>
|
||||||
|
<symbol id="geometry-left" viewBox="0 0 214 36">
|
||||||
|
<path d="M17 0h197v36H0v-2c4.5 0 9-3.5 9-8V8c0-4.5 3.5-8 8-8z" />
|
||||||
|
</symbol>
|
||||||
|
<symbol id="geometry-right" viewBox="0 0 214 36">
|
||||||
|
<use xlink:href="#geometry-left" />
|
||||||
|
</symbol>
|
||||||
|
<clipPath>
|
||||||
|
<rect width="100%" height="100%" x="0" />
|
||||||
|
</clipPath>
|
||||||
|
</defs>
|
||||||
|
<svg width="51%" height="100%">
|
||||||
|
<use
|
||||||
|
xlink:href="#geometry-left"
|
||||||
|
width="214"
|
||||||
|
height="36"
|
||||||
|
fill="currentColor"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
<g transform="scale(-1, 1)">
|
||||||
|
<svg width="51%" height="100%" x="-100%" y="0">
|
||||||
|
<use
|
||||||
|
xlink:href="#geometry-right"
|
||||||
|
width="214"
|
||||||
|
height="36"
|
||||||
|
fill="currentColor"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
</template>
|
||||||
@@ -41,6 +41,13 @@
|
|||||||
padding-right: 24px;
|
padding-right: 24px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.chrome-item {
|
||||||
|
padding-right: 0;
|
||||||
|
padding-left: 0;
|
||||||
|
margin-right: -18px;
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
|
||||||
.el-icon-close {
|
.el-icon-close {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
@@ -76,6 +83,14 @@
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
|
||||||
|
&.chrome-scroll-container {
|
||||||
|
padding-top: 4px;
|
||||||
|
|
||||||
|
.fixed-tag {
|
||||||
|
padding: 0 !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.tab {
|
.tab {
|
||||||
position: relative;
|
position: relative;
|
||||||
float: left;
|
float: left;
|
||||||
@@ -89,6 +104,12 @@
|
|||||||
&:nth-child(1) {
|
&:nth-child(1) {
|
||||||
padding: 0 12px;
|
padding: 0 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.chrome-item {
|
||||||
|
&:nth-child(1) {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.fixed-tag {
|
.fixed-tag {
|
||||||
@@ -173,9 +194,29 @@
|
|||||||
color: #fff;
|
color: #fff;
|
||||||
box-shadow: 0 0 0.7px #888;
|
box-shadow: 0 0 0.7px #888;
|
||||||
|
|
||||||
|
.chrome-tab {
|
||||||
|
z-index: 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrome-tab__bg {
|
||||||
|
color: var(--el-color-primary-light-9) !important;
|
||||||
|
}
|
||||||
|
|
||||||
.tag-title {
|
.tag-title {
|
||||||
color: var(--el-color-primary) !important;
|
color: var(--el-color-primary) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.chrome-close-btn {
|
||||||
|
color: var(--el-color-primary);
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: var(--el-color-primary);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrome-tab-divider {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.arrow-left,
|
.arrow-left,
|
||||||
@@ -262,3 +303,69 @@
|
|||||||
background: var(--el-color-primary);
|
background: var(--el-color-primary);
|
||||||
animation: schedule-out-width 200ms ease-in;
|
animation: schedule-out-width 200ms ease-in;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 谷歌风格的页签 */
|
||||||
|
.chrome-tab {
|
||||||
|
position: relative;
|
||||||
|
display: inline-flex;
|
||||||
|
gap: 16px;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 0 24px;
|
||||||
|
white-space: nowrap;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
.tag-title {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrome-tab-divider {
|
||||||
|
position: absolute;
|
||||||
|
right: 7px;
|
||||||
|
width: 1px;
|
||||||
|
height: 14px;
|
||||||
|
background-color: #2b2d2f;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
z-index: 10;
|
||||||
|
|
||||||
|
.chrome-tab__bg {
|
||||||
|
color: #dee1e6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag-title {
|
||||||
|
color: #1f1f1f;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrome-tab-divider {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrome-tab__bg {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: -10;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
color: transparent;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrome-close-btn {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
color: #666;
|
||||||
|
border-radius: 50%;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
color: white;
|
||||||
|
background-color: #b1b3b8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ import { RouteConfigs } from "../../types";
|
|||||||
import { useTags } from "../../hooks/useTag";
|
import { useTags } from "../../hooks/useTag";
|
||||||
import { routerArrays } from "@/layout/types";
|
import { routerArrays } from "@/layout/types";
|
||||||
import { onClickOutside } from "@vueuse/core";
|
import { onClickOutside } from "@vueuse/core";
|
||||||
|
import TagChrome from "./components/TagChrome.vue";
|
||||||
import { handleAliveRoute, getTopMenu } from "@/router/utils";
|
import { handleAliveRoute, getTopMenu } from "@/router/utils";
|
||||||
import { useSettingStoreHook } from "@/store/modules/settings";
|
import { useSettingStoreHook } from "@/store/modules/settings";
|
||||||
import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
|
import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
|
||||||
@@ -35,6 +36,7 @@ const {
|
|||||||
buttonLeft,
|
buttonLeft,
|
||||||
showModel,
|
showModel,
|
||||||
translateX,
|
translateX,
|
||||||
|
isFixedTag,
|
||||||
pureSetting,
|
pureSetting,
|
||||||
activeIndex,
|
activeIndex,
|
||||||
getTabStyle,
|
getTabStyle,
|
||||||
@@ -563,6 +565,7 @@ onBeforeUnmount(() => {
|
|||||||
<div
|
<div
|
||||||
ref="scrollbarDom"
|
ref="scrollbarDom"
|
||||||
class="scroll-container"
|
class="scroll-container"
|
||||||
|
:class="showModel === 'chrome' && 'chrome-scroll-container'"
|
||||||
@wheel.prevent="handleWheel"
|
@wheel.prevent="handleWheel"
|
||||||
>
|
>
|
||||||
<div ref="tabDom" class="tab select-none" :style="getTabStyle">
|
<div ref="tabDom" class="tab select-none" :style="getTabStyle">
|
||||||
@@ -573,35 +576,54 @@ onBeforeUnmount(() => {
|
|||||||
:class="[
|
:class="[
|
||||||
'scroll-item is-closable',
|
'scroll-item is-closable',
|
||||||
linkIsActive(item),
|
linkIsActive(item),
|
||||||
!isAllEmpty(item?.meta?.fixedTag) && 'fixed-tag'
|
showModel === 'chrome' && 'chrome-item',
|
||||||
|
isFixedTag(item) && 'fixed-tag'
|
||||||
]"
|
]"
|
||||||
@contextmenu.prevent="openMenu(item, $event)"
|
@contextmenu.prevent="openMenu(item, $event)"
|
||||||
@mouseenter.prevent="onMouseenter(index)"
|
@mouseenter.prevent="onMouseenter(index)"
|
||||||
@mouseleave.prevent="onMouseleave(index)"
|
@mouseleave.prevent="onMouseleave(index)"
|
||||||
@click="tagOnClick(item)"
|
@click="tagOnClick(item)"
|
||||||
>
|
>
|
||||||
<span
|
<template v-if="showModel !== 'chrome'">
|
||||||
class="tag-title dark:!text-text_color_primary dark:hover:!text-primary"
|
<span
|
||||||
>
|
class="tag-title dark:!text-text_color_primary dark:hover:!text-primary"
|
||||||
{{ item.meta.title }}
|
>
|
||||||
</span>
|
{{ item.meta.title }}
|
||||||
<span
|
</span>
|
||||||
v-if="
|
<span
|
||||||
isAllEmpty(item?.meta?.fixedTag)
|
v-if="
|
||||||
? iconIsActive(item, index) ||
|
isFixedTag(item)
|
||||||
(index === activeIndex && index !== 0)
|
? false
|
||||||
: false
|
: iconIsActive(item, index) ||
|
||||||
"
|
(index === activeIndex && index !== 0)
|
||||||
class="el-icon-close"
|
"
|
||||||
@click.stop="deleteMenu(item)"
|
class="el-icon-close"
|
||||||
>
|
@click.stop="deleteMenu(item)"
|
||||||
<IconifyIconOffline :icon="Close" />
|
>
|
||||||
</span>
|
<IconifyIconOffline :icon="Close" />
|
||||||
<span
|
</span>
|
||||||
v-if="showModel !== 'card'"
|
<span
|
||||||
:ref="'schedule' + index"
|
v-if="showModel !== 'card'"
|
||||||
:class="[scheduleIsActive(item)]"
|
:ref="'schedule' + index"
|
||||||
/>
|
:class="[scheduleIsActive(item)]"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<div v-else class="chrome-tab">
|
||||||
|
<div class="chrome-tab__bg">
|
||||||
|
<TagChrome />
|
||||||
|
</div>
|
||||||
|
<span class="tag-title">
|
||||||
|
{{ item.meta.title }}
|
||||||
|
</span>
|
||||||
|
<span
|
||||||
|
v-if="isFixedTag(item) ? false : index !== 0"
|
||||||
|
class="chrome-close-btn"
|
||||||
|
@click.stop="deleteMenu(item)"
|
||||||
|
>
|
||||||
|
<IconifyIconOffline :icon="Close" />
|
||||||
|
</span>
|
||||||
|
<span class="chrome-tab-divider" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1,146 +0,0 @@
|
|||||||
export interface ListItem {
|
|
||||||
avatar: string;
|
|
||||||
title: string;
|
|
||||||
datetime: string;
|
|
||||||
type: string;
|
|
||||||
description: string;
|
|
||||||
status?: "primary" | "success" | "warning" | "info" | "danger";
|
|
||||||
extra?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TabItem {
|
|
||||||
key: string;
|
|
||||||
name: string;
|
|
||||||
list: ListItem[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export const noticesData: TabItem[] = [
|
|
||||||
{
|
|
||||||
key: "1",
|
|
||||||
name: "通知",
|
|
||||||
list: [
|
|
||||||
{
|
|
||||||
avatar:
|
|
||||||
"https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png",
|
|
||||||
title: "你收到了 12 份新周报",
|
|
||||||
datetime: "一年前",
|
|
||||||
description: "",
|
|
||||||
type: "1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
avatar:
|
|
||||||
"https://gw.alipayobjects.com/zos/rmsportal/OKJXDXrmkNshAMvwtvhu.png",
|
|
||||||
title: "你推荐的 前端高手 已通过第三轮面试",
|
|
||||||
datetime: "一年前",
|
|
||||||
description: "",
|
|
||||||
type: "1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
avatar:
|
|
||||||
"https://gw.alipayobjects.com/zos/rmsportal/kISTdvpyTAhtGxpovNWd.png",
|
|
||||||
title: "这种模板可以区分多种通知类型",
|
|
||||||
datetime: "一年前",
|
|
||||||
description: "",
|
|
||||||
type: "1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
avatar:
|
|
||||||
"https://gw.alipayobjects.com/zos/rmsportal/GvqBnKhFgObvnSGkDsje.png",
|
|
||||||
title:
|
|
||||||
"展示标题内容超过一行后的处理方式,如果内容超过1行将自动截断并支持tooltip显示完整标题。",
|
|
||||||
datetime: "一年前",
|
|
||||||
description: "",
|
|
||||||
type: "1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
avatar:
|
|
||||||
"https://gw.alipayobjects.com/zos/rmsportal/GvqBnKhFgObvnSGkDsje.png",
|
|
||||||
title: "左侧图标用于区分不同的类型",
|
|
||||||
datetime: "一年前",
|
|
||||||
description: "",
|
|
||||||
type: "1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
avatar:
|
|
||||||
"https://gw.alipayobjects.com/zos/rmsportal/GvqBnKhFgObvnSGkDsje.png",
|
|
||||||
title: "左侧图标用于区分不同的类型",
|
|
||||||
datetime: "一年前",
|
|
||||||
description: "",
|
|
||||||
type: "1"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "2",
|
|
||||||
name: "消息",
|
|
||||||
list: [
|
|
||||||
{
|
|
||||||
avatar:
|
|
||||||
"https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg",
|
|
||||||
title: "李白 评论了你",
|
|
||||||
description: "长风破浪会有时,直挂云帆济沧海",
|
|
||||||
datetime: "一年前",
|
|
||||||
type: "2"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
avatar:
|
|
||||||
"https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg",
|
|
||||||
title: "李白 回复了你",
|
|
||||||
description: "行路难,行路难,多歧路,今安在。",
|
|
||||||
datetime: "一年前",
|
|
||||||
type: "2"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
avatar:
|
|
||||||
"https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg",
|
|
||||||
title: "标题",
|
|
||||||
description:
|
|
||||||
"请将鼠标移动到此处,以便测试超长的消息在此处将如何处理。本例中设置的描述最大行数为2,超过2行的描述内容将被省略并且可以通过tooltip查看完整内容",
|
|
||||||
datetime: "一年前",
|
|
||||||
type: "2"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "3",
|
|
||||||
name: "待办",
|
|
||||||
list: [
|
|
||||||
{
|
|
||||||
avatar: "",
|
|
||||||
title: "任务名称",
|
|
||||||
description: "任务需要在 2022-11-16 20:00 前启动",
|
|
||||||
datetime: "",
|
|
||||||
extra: "未开始",
|
|
||||||
status: "info",
|
|
||||||
type: "3"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
avatar: "",
|
|
||||||
title: "第三方紧急代码变更",
|
|
||||||
description:
|
|
||||||
"一拳提交于 2022-11-16,需在 2022-11-18 前完成代码变更任务",
|
|
||||||
datetime: "",
|
|
||||||
extra: "马上到期",
|
|
||||||
status: "danger",
|
|
||||||
type: "3"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
avatar: "",
|
|
||||||
title: "信息安全考试",
|
|
||||||
description: "指派小仙于 2022-12-12 前完成更新并发布",
|
|
||||||
datetime: "",
|
|
||||||
extra: "已耗时 8 天",
|
|
||||||
status: "warning",
|
|
||||||
type: "3"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
avatar: "",
|
|
||||||
title: "vue-pure-admin 版本发布",
|
|
||||||
description: "vue-pure-admin 版本发布",
|
|
||||||
datetime: "",
|
|
||||||
extra: "进行中",
|
|
||||||
type: "3"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
];
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import { PropType } from "vue";
|
|
||||||
import { ListItem } from "./data";
|
|
||||||
import NoticeItem from "./noticeItem.vue";
|
|
||||||
|
|
||||||
const props = defineProps({
|
|
||||||
list: {
|
|
||||||
type: Array as PropType<Array<ListItem>>,
|
|
||||||
default: () => []
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div v-if="props.list.length">
|
|
||||||
<NoticeItem
|
|
||||||
v-for="(item, index) in props.list"
|
|
||||||
:key="index"
|
|
||||||
:noticeItem="item"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<el-empty v-else description="暂无消息" />
|
|
||||||
</template>
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
import SearchModal from "./SearchModal.vue";
|
|
||||||
|
|
||||||
export { SearchModal };
|
|
||||||
@@ -3,7 +3,7 @@ import { useRoute } from "vue-router";
|
|||||||
import { ref, unref, watch, onMounted, nextTick } from "vue";
|
import { ref, unref, watch, onMounted, nextTick } from "vue";
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: "FrameView"
|
name: "LayFrame"
|
||||||
});
|
});
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
@@ -124,6 +124,12 @@ export function useTags() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isFixedTag = computed(() => {
|
||||||
|
return item => {
|
||||||
|
return isBoolean(item?.meta?.fixedTag) && item?.meta?.fixedTag === true;
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
const iconIsActive = computed(() => {
|
const iconIsActive = computed(() => {
|
||||||
return (item, index) => {
|
return (item, index) => {
|
||||||
if (index === 0) return;
|
if (index === 0) return;
|
||||||
@@ -220,6 +226,7 @@ export function useTags() {
|
|||||||
buttonTop,
|
buttonTop,
|
||||||
buttonLeft,
|
buttonLeft,
|
||||||
translateX,
|
translateX,
|
||||||
|
isFixedTag,
|
||||||
pureSetting,
|
pureSetting,
|
||||||
activeIndex,
|
activeIndex,
|
||||||
getTabStyle,
|
getTabStyle,
|
||||||
|
|||||||
@@ -23,13 +23,13 @@ import {
|
|||||||
useResizeObserver
|
useResizeObserver
|
||||||
} from "@pureadmin/utils";
|
} from "@pureadmin/utils";
|
||||||
|
|
||||||
import navbar from "./components/navbar.vue";
|
import LayTag from "./components/lay-tag/index.vue";
|
||||||
import tag from "./components/tag/index.vue";
|
import LayNavbar from "./components/lay-navbar/index.vue";
|
||||||
import appMain from "./components/appMain.vue";
|
import LayContent from "./components/lay-content/index.vue";
|
||||||
import setting from "./components/setting/index.vue";
|
import LaySetting from "./components/lay-setting/index.vue";
|
||||||
import Vertical from "./components/sidebar/vertical.vue";
|
import NavVertical from "./components/lay-sidebar/NavVertical.vue";
|
||||||
import Horizontal from "./components/sidebar/horizontal.vue";
|
import NavHorizontal from "./components/lay-sidebar/NavHorizontal.vue";
|
||||||
import backTop from "@/assets/svg/back_top.svg?component";
|
import BackTopIcon from "@/assets/svg/back_top.svg?component";
|
||||||
|
|
||||||
const appWrapperRef = ref();
|
const appWrapperRef = ref();
|
||||||
const { isDark } = useDark();
|
const { isDark } = useDark();
|
||||||
@@ -124,7 +124,8 @@ onBeforeMount(() => {
|
|||||||
useDataThemeChange().dataThemeChange($storage.layout?.overallStyle);
|
useDataThemeChange().dataThemeChange($storage.layout?.overallStyle);
|
||||||
});
|
});
|
||||||
|
|
||||||
const layoutHeader = defineComponent({
|
const LayHeader = defineComponent({
|
||||||
|
name: "LayHeader",
|
||||||
render() {
|
render() {
|
||||||
return h(
|
return h(
|
||||||
"div",
|
"div",
|
||||||
@@ -142,12 +143,12 @@ const layoutHeader = defineComponent({
|
|||||||
default: () => [
|
default: () => [
|
||||||
!pureSetting.hiddenSideBar &&
|
!pureSetting.hiddenSideBar &&
|
||||||
(layout.value.includes("vertical") || layout.value.includes("mix"))
|
(layout.value.includes("vertical") || layout.value.includes("mix"))
|
||||||
? h(navbar)
|
? h(LayNavbar)
|
||||||
: null,
|
: null,
|
||||||
!pureSetting.hiddenSideBar && layout.value.includes("horizontal")
|
!pureSetting.hiddenSideBar && layout.value.includes("horizontal")
|
||||||
? h(Horizontal)
|
? h(NavHorizontal)
|
||||||
: null,
|
: null,
|
||||||
h(tag)
|
h(LayTag)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -166,7 +167,7 @@ const layoutHeader = defineComponent({
|
|||||||
class="app-mask"
|
class="app-mask"
|
||||||
@click="useAppStoreHook().toggleSideBar()"
|
@click="useAppStoreHook().toggleSideBar()"
|
||||||
/>
|
/>
|
||||||
<Vertical
|
<NavVertical
|
||||||
v-show="
|
v-show="
|
||||||
!pureSetting.hiddenSideBar &&
|
!pureSetting.hiddenSideBar &&
|
||||||
(layout.includes('vertical') || layout.includes('mix'))
|
(layout.includes('vertical') || layout.includes('mix'))
|
||||||
@@ -179,24 +180,24 @@ const layoutHeader = defineComponent({
|
|||||||
]"
|
]"
|
||||||
>
|
>
|
||||||
<div v-if="set.fixedHeader">
|
<div v-if="set.fixedHeader">
|
||||||
<layout-header />
|
<LayHeader />
|
||||||
<!-- 主体内容 -->
|
<!-- 主体内容 -->
|
||||||
<app-main :fixed-header="set.fixedHeader" />
|
<LayContent :fixed-header="set.fixedHeader" />
|
||||||
</div>
|
</div>
|
||||||
<el-scrollbar v-else>
|
<el-scrollbar v-else>
|
||||||
<el-backtop
|
<el-backtop
|
||||||
title="回到顶部"
|
title="回到顶部"
|
||||||
target=".main-container .el-scrollbar__wrap"
|
target=".main-container .el-scrollbar__wrap"
|
||||||
>
|
>
|
||||||
<backTop />
|
<BackTopIcon />
|
||||||
</el-backtop>
|
</el-backtop>
|
||||||
<layout-header />
|
<LayHeader />
|
||||||
<!-- 主体内容 -->
|
<!-- 主体内容 -->
|
||||||
<app-main :fixed-header="set.fixedHeader" />
|
<LayContent :fixed-header="set.fixedHeader" />
|
||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
</div>
|
</div>
|
||||||
<!-- 系统设置 -->
|
<!-- 系统设置 -->
|
||||||
<setting />
|
<LaySetting />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -221,7 +222,7 @@ const layoutHeader = defineComponent({
|
|||||||
.app-mask {
|
.app-mask {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
z-index: 999;
|
z-index: 2001;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background: #000;
|
background: #000;
|
||||||
|
|||||||
@@ -42,7 +42,9 @@ app.component("FontIcon", FontIcon);
|
|||||||
|
|
||||||
// 全局注册按钮级别权限组件
|
// 全局注册按钮级别权限组件
|
||||||
import { Auth } from "@/components/ReAuth";
|
import { Auth } from "@/components/ReAuth";
|
||||||
|
import { Perms } from "@/components/RePerms";
|
||||||
app.component("Auth", Auth);
|
app.component("Auth", Auth);
|
||||||
|
app.component("Perms", Perms);
|
||||||
|
|
||||||
// 全局注册vue-tippy
|
// 全局注册vue-tippy
|
||||||
import "tippy.js/dist/tippy.css";
|
import "tippy.js/dist/tippy.css";
|
||||||
|
|||||||
@@ -107,6 +107,7 @@ import {
|
|||||||
ElWatermark,
|
ElWatermark,
|
||||||
ElTour,
|
ElTour,
|
||||||
ElTourStep,
|
ElTourStep,
|
||||||
|
ElSegmented,
|
||||||
/**
|
/**
|
||||||
* 为了方便演示平台将 element-plus 导出的所有插件引入,实际使用中如果你没用到哪个插件,将其注释掉就行
|
* 为了方便演示平台将 element-plus 导出的所有插件引入,实际使用中如果你没用到哪个插件,将其注释掉就行
|
||||||
* 导出来源:https://github.com/element-plus/element-plus/blob/dev/packages/element-plus/plugin.ts#L11-L16
|
* 导出来源:https://github.com/element-plus/element-plus/blob/dev/packages/element-plus/plugin.ts#L11-L16
|
||||||
@@ -221,7 +222,8 @@ const components = [
|
|||||||
ElUpload,
|
ElUpload,
|
||||||
ElWatermark,
|
ElWatermark,
|
||||||
ElTour,
|
ElTour,
|
||||||
ElTourStep
|
ElTourStep,
|
||||||
|
ElSegmented
|
||||||
];
|
];
|
||||||
|
|
||||||
const plugins = [
|
const plugins = [
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import { userKey, type DataInfo } from "@/utils/auth";
|
|||||||
import { type menuType, routerArrays } from "@/layout/types";
|
import { type menuType, routerArrays } from "@/layout/types";
|
||||||
import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
|
import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
|
||||||
import { usePermissionStoreHook } from "@/store/modules/permission";
|
import { usePermissionStoreHook } from "@/store/modules/permission";
|
||||||
const IFrame = () => import("@/layout/frameView.vue");
|
const IFrame = () => import("@/layout/frame.vue");
|
||||||
// https://cn.vitejs.dev/guide/features.html#glob-import
|
// https://cn.vitejs.dev/guide/features.html#glob-import
|
||||||
const modulesRoutes = import.meta.glob("/src/views/**/*.{vue,tsx}");
|
const modulesRoutes = import.meta.glob("/src/views/**/*.{vue,tsx}");
|
||||||
|
|
||||||
@@ -355,7 +355,7 @@ function getAuths(): Array<string> {
|
|||||||
return router.currentRoute.value.meta.auths as Array<string>;
|
return router.currentRoute.value.meta.auths as Array<string>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 是否有按钮级别的权限 */
|
/** 是否有按钮级别的权限(根据路由`meta`中的`auths`字段进行判断)*/
|
||||||
function hasAuth(value: string | Array<string>): boolean {
|
function hasAuth(value: string | Array<string>): boolean {
|
||||||
if (!value) return false;
|
if (!value) return false;
|
||||||
/** 从当前路由的`meta`字段里获取按钮级别的所有自定义`code`值 */
|
/** 从当前路由的`meta`字段里获取按钮级别的所有自定义`code`值 */
|
||||||
|
|||||||
@@ -27,6 +27,9 @@ export const useUserStore = defineStore({
|
|||||||
nickname: storageLocal().getItem<DataInfo<number>>(userKey)?.nickname ?? "",
|
nickname: storageLocal().getItem<DataInfo<number>>(userKey)?.nickname ?? "",
|
||||||
// 页面级别权限
|
// 页面级别权限
|
||||||
roles: storageLocal().getItem<DataInfo<number>>(userKey)?.roles ?? [],
|
roles: storageLocal().getItem<DataInfo<number>>(userKey)?.roles ?? [],
|
||||||
|
// 按钮级别权限
|
||||||
|
permissions:
|
||||||
|
storageLocal().getItem<DataInfo<number>>(userKey)?.permissions ?? [],
|
||||||
// 是否勾选了登录页的免登录
|
// 是否勾选了登录页的免登录
|
||||||
isRemembered: false,
|
isRemembered: false,
|
||||||
// 登录页的免登录存储几天,默认7天
|
// 登录页的免登录存储几天,默认7天
|
||||||
@@ -49,6 +52,10 @@ export const useUserStore = defineStore({
|
|||||||
SET_ROLES(roles: Array<string>) {
|
SET_ROLES(roles: Array<string>) {
|
||||||
this.roles = roles;
|
this.roles = roles;
|
||||||
},
|
},
|
||||||
|
/** 存储按钮级别权限 */
|
||||||
|
SET_PERMS(permissions: Array<string>) {
|
||||||
|
this.permissions = permissions;
|
||||||
|
},
|
||||||
/** 存储是否勾选了登录页的免登录 */
|
/** 存储是否勾选了登录页的免登录 */
|
||||||
SET_ISREMEMBERED(bool: boolean) {
|
SET_ISREMEMBERED(bool: boolean) {
|
||||||
this.isRemembered = bool;
|
this.isRemembered = bool;
|
||||||
@@ -74,6 +81,7 @@ export const useUserStore = defineStore({
|
|||||||
logOut() {
|
logOut() {
|
||||||
this.username = "";
|
this.username = "";
|
||||||
this.roles = [];
|
this.roles = [];
|
||||||
|
this.permissions = [];
|
||||||
removeToken();
|
removeToken();
|
||||||
useMultiTagsStoreHook().handleTags("equal", [...routerArrays]);
|
useMultiTagsStoreHook().handleTags("equal", [...routerArrays]);
|
||||||
resetRouter();
|
resetRouter();
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ export type userType = {
|
|||||||
username?: string;
|
username?: string;
|
||||||
nickname?: string;
|
nickname?: string;
|
||||||
roles?: Array<string>;
|
roles?: Array<string>;
|
||||||
|
permissions?: Array<string>;
|
||||||
isRemembered?: boolean;
|
isRemembered?: boolean;
|
||||||
loginDay?: number;
|
loginDay?: number;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -25,7 +25,8 @@ html.dark {
|
|||||||
background: var(--el-bg-color) !important;
|
background: var(--el-bg-color) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.app-main {
|
.app-main,
|
||||||
|
.app-main-nofixed-header {
|
||||||
background: #020409 !important;
|
background: #020409 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,6 +49,22 @@ html.dark {
|
|||||||
background-color: rgb(255 255 255 / 12%);
|
background-color: rgb(255 255 255 / 12%);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.chrome-tab {
|
||||||
|
.tag-title {
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
.chrome-tab__bg {
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag-title {
|
||||||
|
color: #adadad;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -560,6 +560,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.sidebar-container {
|
.sidebar-container {
|
||||||
|
z-index: 2001;
|
||||||
width: $sideBarWidth;
|
width: $sideBarWidth;
|
||||||
transition: transform var(--pure-transition-duration);
|
transition: transform var(--pure-transition-duration);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import Cookies from "js-cookie";
|
import Cookies from "js-cookie";
|
||||||
import { storageLocal } from "@pureadmin/utils";
|
|
||||||
import { useUserStoreHook } from "@/store/modules/user";
|
import { useUserStoreHook } from "@/store/modules/user";
|
||||||
|
import { storageLocal, isString, isIncludeAllChildren } from "@pureadmin/utils";
|
||||||
|
|
||||||
export interface DataInfo<T> {
|
export interface DataInfo<T> {
|
||||||
/** token */
|
/** token */
|
||||||
@@ -17,6 +17,8 @@ export interface DataInfo<T> {
|
|||||||
nickname?: string;
|
nickname?: string;
|
||||||
/** 当前登录用户的角色 */
|
/** 当前登录用户的角色 */
|
||||||
roles?: Array<string>;
|
roles?: Array<string>;
|
||||||
|
/** 当前登录用户的按钮级别权限 */
|
||||||
|
permissions?: Array<string>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const userKey = "user-info";
|
export const userKey = "user-info";
|
||||||
@@ -41,7 +43,7 @@ export function getToken(): DataInfo<number> {
|
|||||||
* @description 设置`token`以及一些必要信息并采用无感刷新`token`方案
|
* @description 设置`token`以及一些必要信息并采用无感刷新`token`方案
|
||||||
* 无感刷新:后端返回`accessToken`(访问接口使用的`token`)、`refreshToken`(用于调用刷新`accessToken`的接口时所需的`token`,`refreshToken`的过期时间(比如30天)应大于`accessToken`的过期时间(比如2小时))、`expires`(`accessToken`的过期时间)
|
* 无感刷新:后端返回`accessToken`(访问接口使用的`token`)、`refreshToken`(用于调用刷新`accessToken`的接口时所需的`token`,`refreshToken`的过期时间(比如30天)应大于`accessToken`的过期时间(比如2小时))、`expires`(`accessToken`的过期时间)
|
||||||
* 将`accessToken`、`expires`、`refreshToken`这三条信息放在key值为authorized-token的cookie里(过期自动销毁)
|
* 将`accessToken`、`expires`、`refreshToken`这三条信息放在key值为authorized-token的cookie里(过期自动销毁)
|
||||||
* 将`avatar`、`username`、`nickname`、`roles`、`refreshToken`、`expires`这六条信息放在key值为`user-info`的localStorage里(利用`multipleTabsKey`当浏览器完全关闭后自动销毁)
|
* 将`avatar`、`username`、`nickname`、`roles`、`permissions`、`refreshToken`、`expires`这七条信息放在key值为`user-info`的localStorage里(利用`multipleTabsKey`当浏览器完全关闭后自动销毁)
|
||||||
*/
|
*/
|
||||||
export function setToken(data: DataInfo<Date>) {
|
export function setToken(data: DataInfo<Date>) {
|
||||||
let expires = 0;
|
let expires = 0;
|
||||||
@@ -66,18 +68,20 @@ export function setToken(data: DataInfo<Date>) {
|
|||||||
: {}
|
: {}
|
||||||
);
|
);
|
||||||
|
|
||||||
function setUserKey({ avatar, username, nickname, roles }) {
|
function setUserKey({ avatar, username, nickname, roles, permissions }) {
|
||||||
useUserStoreHook().SET_AVATAR(avatar);
|
useUserStoreHook().SET_AVATAR(avatar);
|
||||||
useUserStoreHook().SET_USERNAME(username);
|
useUserStoreHook().SET_USERNAME(username);
|
||||||
useUserStoreHook().SET_NICKNAME(nickname);
|
useUserStoreHook().SET_NICKNAME(nickname);
|
||||||
useUserStoreHook().SET_ROLES(roles);
|
useUserStoreHook().SET_ROLES(roles);
|
||||||
|
useUserStoreHook().SET_PERMS(permissions);
|
||||||
storageLocal().setItem(userKey, {
|
storageLocal().setItem(userKey, {
|
||||||
refreshToken,
|
refreshToken,
|
||||||
expires,
|
expires,
|
||||||
avatar,
|
avatar,
|
||||||
username,
|
username,
|
||||||
nickname,
|
nickname,
|
||||||
roles
|
roles,
|
||||||
|
permissions
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,7 +91,8 @@ export function setToken(data: DataInfo<Date>) {
|
|||||||
avatar: data?.avatar ?? "",
|
avatar: data?.avatar ?? "",
|
||||||
username,
|
username,
|
||||||
nickname: data?.nickname ?? "",
|
nickname: data?.nickname ?? "",
|
||||||
roles
|
roles,
|
||||||
|
permissions: data?.permissions ?? []
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
const avatar =
|
const avatar =
|
||||||
@@ -98,11 +103,14 @@ export function setToken(data: DataInfo<Date>) {
|
|||||||
storageLocal().getItem<DataInfo<number>>(userKey)?.nickname ?? "";
|
storageLocal().getItem<DataInfo<number>>(userKey)?.nickname ?? "";
|
||||||
const roles =
|
const roles =
|
||||||
storageLocal().getItem<DataInfo<number>>(userKey)?.roles ?? [];
|
storageLocal().getItem<DataInfo<number>>(userKey)?.roles ?? [];
|
||||||
|
const permissions =
|
||||||
|
storageLocal().getItem<DataInfo<number>>(userKey)?.permissions ?? [];
|
||||||
setUserKey({
|
setUserKey({
|
||||||
avatar,
|
avatar,
|
||||||
username,
|
username,
|
||||||
nickname,
|
nickname,
|
||||||
roles
|
roles,
|
||||||
|
permissions
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -118,3 +126,16 @@ export function removeToken() {
|
|||||||
export const formatToken = (token: string): string => {
|
export const formatToken = (token: string): string => {
|
||||||
return "Bearer " + token;
|
return "Bearer " + token;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** 是否有按钮级别的权限(根据登录接口返回的`permissions`字段进行判断)*/
|
||||||
|
export const hasPerms = (value: string | Array<string>): boolean => {
|
||||||
|
if (!value) return false;
|
||||||
|
const allPerms = "*:*:*";
|
||||||
|
const { permissions } = useUserStoreHook();
|
||||||
|
if (!permissions) return false;
|
||||||
|
if (permissions.length === 1 && permissions[0] === allPerms) return true;
|
||||||
|
const isAuths = isString(value)
|
||||||
|
? permissions.includes(value)
|
||||||
|
: isIncludeAllChildren(value, permissions);
|
||||||
|
return isAuths ? true : false;
|
||||||
|
};
|
||||||
|
|||||||
8
src/utils/http/types.d.ts
vendored
@@ -36,12 +36,12 @@ export default class PureHttp {
|
|||||||
): Promise<T>;
|
): Promise<T>;
|
||||||
post<T, P>(
|
post<T, P>(
|
||||||
url: string,
|
url: string,
|
||||||
params?: T,
|
params?: P,
|
||||||
config?: PureHttpRequestConfig
|
config?: PureHttpRequestConfig
|
||||||
): Promise<P>;
|
): Promise<T>;
|
||||||
get<T, P>(
|
get<T, P>(
|
||||||
url: string,
|
url: string,
|
||||||
params?: T,
|
params?: P,
|
||||||
config?: PureHttpRequestConfig
|
config?: PureHttpRequestConfig
|
||||||
): Promise<P>;
|
): Promise<T>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ const ruleFormRef = ref<FormInstance>();
|
|||||||
const { initStorage } = useLayout();
|
const { initStorage } = useLayout();
|
||||||
initStorage();
|
initStorage();
|
||||||
|
|
||||||
const { dataTheme, dataThemeChange } = useDataThemeChange();
|
const { dataTheme, overallStyle, dataThemeChange } = useDataThemeChange();
|
||||||
dataThemeChange();
|
dataThemeChange(overallStyle.value);
|
||||||
const { title } = useNav();
|
const { title } = useNav();
|
||||||
|
|
||||||
const ruleForm = reactive({
|
const ruleForm = reactive({
|
||||||
@@ -57,15 +57,13 @@ const onLogin = async (formEl: FormInstance | undefined) => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.finally(() => (loading.value = false));
|
.finally(() => (loading.value = false));
|
||||||
} else {
|
|
||||||
return fields;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 使用公共函数,避免`removeEventListener`失效 */
|
/** 使用公共函数,避免`removeEventListener`失效 */
|
||||||
function onkeypress({ code }: KeyboardEvent) {
|
function onkeypress({ code }: KeyboardEvent) {
|
||||||
if (code === "Enter") {
|
if (["Enter", "NumpadEnter"].includes(code)) {
|
||||||
onLogin(ruleFormRef.value);
|
onLogin(ruleFormRef.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import { hasAuth, getAuths } from "@/router/utils";
|
import { hasAuth, getAuths } from "@/router/utils";
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: "PermissionButton"
|
name: "PermissionButtonRouter"
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
109
src/views/permission/button/perms.vue
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { hasPerms } from "@/utils/auth";
|
||||||
|
import { useUserStoreHook } from "@/store/modules/user";
|
||||||
|
|
||||||
|
const { permissions } = useUserStoreHook();
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
name: "PermissionButtonLogin"
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<p class="mb-2">当前拥有的code列表:{{ permissions }}</p>
|
||||||
|
<p v-show="permissions?.[0] === '*:*:*'" class="mb-2">
|
||||||
|
*:*:* 代表拥有全部按钮级别权限
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<el-card shadow="never" class="mb-2">
|
||||||
|
<template #header>
|
||||||
|
<div class="card-header">组件方式判断权限</div>
|
||||||
|
</template>
|
||||||
|
<el-space wrap>
|
||||||
|
<Perms value="permission:btn:add">
|
||||||
|
<el-button plain type="warning">
|
||||||
|
拥有code:'permission:btn:add' 权限可见
|
||||||
|
</el-button>
|
||||||
|
</Perms>
|
||||||
|
<Perms :value="['permission:btn:edit']">
|
||||||
|
<el-button plain type="primary">
|
||||||
|
拥有code:['permission:btn:edit'] 权限可见
|
||||||
|
</el-button>
|
||||||
|
</Perms>
|
||||||
|
<Perms
|
||||||
|
:value="[
|
||||||
|
'permission:btn:add',
|
||||||
|
'permission:btn:edit',
|
||||||
|
'permission:btn:delete'
|
||||||
|
]"
|
||||||
|
>
|
||||||
|
<el-button plain type="danger">
|
||||||
|
拥有code:['permission:btn:add', 'permission:btn:edit',
|
||||||
|
'permission:btn:delete'] 权限可见
|
||||||
|
</el-button>
|
||||||
|
</Perms>
|
||||||
|
</el-space>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
<el-card shadow="never" class="mb-2">
|
||||||
|
<template #header>
|
||||||
|
<div class="card-header">函数方式判断权限</div>
|
||||||
|
</template>
|
||||||
|
<el-space wrap>
|
||||||
|
<el-button v-if="hasPerms('permission:btn:add')" plain type="warning">
|
||||||
|
拥有code:'permission:btn:add' 权限可见
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
v-if="hasPerms(['permission:btn:edit'])"
|
||||||
|
plain
|
||||||
|
type="primary"
|
||||||
|
>
|
||||||
|
拥有code:['permission:btn:edit'] 权限可见
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
v-if="
|
||||||
|
hasPerms([
|
||||||
|
'permission:btn:add',
|
||||||
|
'permission:btn:edit',
|
||||||
|
'permission:btn:delete'
|
||||||
|
])
|
||||||
|
"
|
||||||
|
plain
|
||||||
|
type="danger"
|
||||||
|
>
|
||||||
|
拥有code:['permission:btn:add', 'permission:btn:edit',
|
||||||
|
'permission:btn:delete'] 权限可见
|
||||||
|
</el-button>
|
||||||
|
</el-space>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
<el-card shadow="never">
|
||||||
|
<template #header>
|
||||||
|
<div class="card-header">
|
||||||
|
指令方式判断权限(该方式不能动态修改权限)
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<el-space wrap>
|
||||||
|
<el-button v-perms="'permission:btn:add'" plain type="warning">
|
||||||
|
拥有code:'permission:btn:add' 权限可见
|
||||||
|
</el-button>
|
||||||
|
<el-button v-perms="['permission:btn:edit']" plain type="primary">
|
||||||
|
拥有code:['permission:btn:edit'] 权限可见
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
v-perms="[
|
||||||
|
'permission:btn:add',
|
||||||
|
'permission:btn:edit',
|
||||||
|
'permission:btn:delete'
|
||||||
|
]"
|
||||||
|
plain
|
||||||
|
type="danger"
|
||||||
|
>
|
||||||
|
拥有code:['permission:btn:add', 'permission:btn:edit',
|
||||||
|
'permission:btn:delete'] 权限可见
|
||||||
|
</el-button>
|
||||||
|
</el-space>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
28
types/directives.d.ts
vendored
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
import type { Directive } from "vue";
|
||||||
|
import type { CopyEl, OptimizeOptions, RippleOptions } from "@/directives";
|
||||||
|
|
||||||
|
declare module "vue" {
|
||||||
|
export interface ComponentCustomProperties {
|
||||||
|
/** `Loading` 动画加载指令,具体看:https://element-plus.org/zh-CN/component/loading.html#%E6%8C%87%E4%BB%A4 */
|
||||||
|
vLoading: Directive<Element, boolean>;
|
||||||
|
/** 按钮权限指令(根据路由`meta`中的`auths`字段进行判断)*/
|
||||||
|
vAuth: Directive<HTMLElement, string | Array<string>>;
|
||||||
|
/** 文本复制指令(默认双击复制) */
|
||||||
|
vCopy: Directive<CopyEl, string>;
|
||||||
|
/** 长按指令 */
|
||||||
|
vLongpress: Directive<HTMLElement, Function>;
|
||||||
|
/** 防抖、节流指令 */
|
||||||
|
vOptimize: Directive<HTMLElement, OptimizeOptions>;
|
||||||
|
/** 按钮权限指令(根据登录接口返回的`permissions`字段进行判断)*/
|
||||||
|
vPerms: Directive<HTMLElement, string | Array<string>>;
|
||||||
|
/**
|
||||||
|
* `v-ripple`指令,用法如下:
|
||||||
|
* 1. `v-ripple`代表启用基本的`ripple`功能
|
||||||
|
* 2. `v-ripple="{ class: 'text-red' }"`代表自定义`ripple`颜色,支持`tailwindcss`,生效样式是`color`
|
||||||
|
* 3. `v-ripple.center`代表从中心扩散
|
||||||
|
*/
|
||||||
|
vRipple: Directive<HTMLElement, RippleOptions>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export {};
|
||||||
2
types/global-components.d.ts
vendored
@@ -7,6 +7,7 @@ declare module "vue" {
|
|||||||
IconifyIconOnline: (typeof import("../src/components/ReIcon"))["IconifyIconOnline"];
|
IconifyIconOnline: (typeof import("../src/components/ReIcon"))["IconifyIconOnline"];
|
||||||
FontIcon: (typeof import("../src/components/ReIcon"))["FontIcon"];
|
FontIcon: (typeof import("../src/components/ReIcon"))["FontIcon"];
|
||||||
Auth: (typeof import("../src/components/ReAuth"))["Auth"];
|
Auth: (typeof import("../src/components/ReAuth"))["Auth"];
|
||||||
|
Perms: (typeof import("../src/components/RePerms"))["Perms"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,6 +116,7 @@ declare module "vue" {
|
|||||||
ElWatermark: (typeof import("element-plus"))["ElWatermark"];
|
ElWatermark: (typeof import("element-plus"))["ElWatermark"];
|
||||||
ElTour: (typeof import("element-plus"))["ElTour"];
|
ElTour: (typeof import("element-plus"))["ElTour"];
|
||||||
ElTourStep: (typeof import("element-plus"))["ElTourStep"];
|
ElTourStep: (typeof import("element-plus"))["ElTourStep"];
|
||||||
|
ElSegmented: (typeof import("element-plus"))["ElSegmented"];
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ComponentCustomProperties {
|
interface ComponentCustomProperties {
|
||||||
|
|||||||
6
types/global.d.ts
vendored
@@ -61,7 +61,7 @@ declare global {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 全局自定义环境变量的类型声明
|
* 全局自定义环境变量的类型声明
|
||||||
* @see {@link https://yiming_chang.gitee.io/pure-admin-doc/pages/config/#%E5%85%B7%E4%BD%93%E9%85%8D%E7%BD%AE}
|
* @see {@link https://pure-admin.github.io/pure-admin-doc/pages/config/#%E5%85%B7%E4%BD%93%E9%85%8D%E7%BD%AE}
|
||||||
*/
|
*/
|
||||||
interface ViteEnv {
|
interface ViteEnv {
|
||||||
VITE_PORT: number;
|
VITE_PORT: number;
|
||||||
@@ -79,7 +79,7 @@ declare global {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 对应 `public/platform-config.json` 文件的类型声明
|
* 对应 `public/platform-config.json` 文件的类型声明
|
||||||
* @see {@link https://yiming_chang.gitee.io/pure-admin-doc/pages/config/#platform-config-json}
|
* @see {@link https://pure-admin.github.io/pure-admin-doc/pages/config/#platform-config-json}
|
||||||
*/
|
*/
|
||||||
interface PlatformConfigs {
|
interface PlatformConfigs {
|
||||||
Version?: string;
|
Version?: string;
|
||||||
@@ -112,7 +112,7 @@ declare global {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 与 `PlatformConfigs` 类型不同,这里是缓存到浏览器本地存储的类型声明
|
* 与 `PlatformConfigs` 类型不同,这里是缓存到浏览器本地存储的类型声明
|
||||||
* @see {@link https://yiming_chang.gitee.io/pure-admin-doc/pages/config/#platform-config-json}
|
* @see {@link https://pure-admin.github.io/pure-admin-doc/pages/config/#platform-config-json}
|
||||||
*/
|
*/
|
||||||
interface StorageConfigs {
|
interface StorageConfigs {
|
||||||
version?: string;
|
version?: string;
|
||||||
|
|||||||
2
types/index.d.ts
vendored
@@ -75,6 +75,8 @@ interface ComponentElRef<T extends HTMLElement = HTMLDivElement> {
|
|||||||
$el: T;
|
$el: T;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
function parseInt(s: string | number, radix?: number): number;
|
function parseInt(s: string | number, radix?: number): number;
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
function parseFloat(string: string | number): number;
|
function parseFloat(string: string | number): number;
|
||||||
|
|||||||
@@ -4,14 +4,14 @@ import { type UserConfigExport, type ConfigEnv, loadEnv } from "vite";
|
|||||||
import {
|
import {
|
||||||
root,
|
root,
|
||||||
alias,
|
alias,
|
||||||
warpperEnv,
|
wrapperEnv,
|
||||||
pathResolve,
|
pathResolve,
|
||||||
__APP_INFO__
|
__APP_INFO__
|
||||||
} from "./build/utils";
|
} from "./build/utils";
|
||||||
|
|
||||||
export default ({ mode }: ConfigEnv): UserConfigExport => {
|
export default ({ mode }: ConfigEnv): UserConfigExport => {
|
||||||
const { VITE_CDN, VITE_PORT, VITE_COMPRESSION, VITE_PUBLIC_PATH } =
|
const { VITE_CDN, VITE_PORT, VITE_COMPRESSION, VITE_PUBLIC_PATH } =
|
||||||
warpperEnv(loadEnv(mode, root));
|
wrapperEnv(loadEnv(mode, root));
|
||||||
return {
|
return {
|
||||||
base: VITE_PUBLIC_PATH,
|
base: VITE_PUBLIC_PATH,
|
||||||
root,
|
root,
|
||||||
|
|||||||