Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
d2543cf9d3 | ||
|
13a36c0acb | ||
|
85e5074665 | ||
|
a8a1f8d900 | ||
|
c0f3dcbbb7 | ||
|
c6b0aa2467 | ||
|
057fef9147 | ||
|
036459cb02 | ||
|
7640f97a36 | ||
|
0a57ad7920 |
1
.vscode/extensions.json
vendored
@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"recommendations": [
|
"recommendations": [
|
||||||
"christian-kohler.path-intellisense",
|
"christian-kohler.path-intellisense",
|
||||||
|
"warmthsea.vscode-custom-code-color",
|
||||||
"vscode-icons-team.vscode-icons",
|
"vscode-icons-team.vscode-icons",
|
||||||
"davidanson.vscode-markdownlint",
|
"davidanson.vscode-markdownlint",
|
||||||
"ms-azuretools.vscode-docker",
|
"ms-azuretools.vscode-docker",
|
||||||
|
14
.vscode/settings.json
vendored
@ -27,5 +27,17 @@
|
|||||||
"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-perms",
|
||||||
|
"v-ripple"
|
||||||
|
],
|
||||||
|
"vscodeCustomCodeColor.highlightValueColor": "#b392f0",
|
||||||
}
|
}
|
@ -1,8 +1,8 @@
|
|||||||
FROM node:18-alpine as build-stage
|
FROM node:20-alpine as build-stage
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
RUN corepack enable
|
RUN corepack enable
|
||||||
RUN corepack prepare pnpm@8.6.10 --activate
|
RUN corepack prepare pnpm@latest --activate
|
||||||
|
|
||||||
RUN npm config set registry https://registry.npmmirror.com
|
RUN npm config set registry https://registry.npmmirror.com
|
||||||
|
|
||||||
|
@ -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.cn/pages/js/)
|
||||||
|
|
||||||
|
## `max` version
|
||||||
|
|
||||||
|
[Click me to view the max version](https://pure-admin.cn/pages/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://pure-admin.github.io/pure-admin-doc)
|
[Click me to view vue-pure-admin documentation](https://pure-admin.cn/)
|
||||||
[Click me to view @pureadmin/utils documentation](https://pure-admin-utils.netlify.app)
|
[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://pure-admin.github.io/pure-admin-doc/pages/service/)
|
[Click me to view details](https://pure-admin.cn/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.cn/pages/js/)
|
||||||
|
|
||||||
|
## `max` 版本
|
||||||
|
|
||||||
|
[点我查看 max 版本](https://pure-admin.cn/pages/max/)
|
||||||
|
|
||||||
## 配套视频
|
## 配套视频
|
||||||
|
|
||||||
[点我查看 UI 设计](https://www.bilibili.com/video/BV17g411T7rq)
|
[点我查看 UI 设计](https://www.bilibili.com/video/BV17g411T7rq)
|
||||||
@ -19,12 +27,12 @@
|
|||||||
|
|
||||||
## 配套保姆级文档
|
## 配套保姆级文档
|
||||||
|
|
||||||
[点我查看 vue-pure-admin 文档](https://pure-admin.github.io/pure-admin-doc)
|
[点我查看 vue-pure-admin 文档](https://pure-admin.cn/)
|
||||||
[点我查看 @pureadmin/utils 文档](https://pure-admin-utils.netlify.app)
|
[点我查看 @pureadmin/utils 文档](https://pure-admin-utils.netlify.app)
|
||||||
|
|
||||||
## 优质服务、软件外包、赞助支持
|
## 优质服务、软件外包、赞助支持
|
||||||
|
|
||||||
[点我查看详情](https://pure-admin.github.io/pure-admin-doc/pages/service/)
|
[点我查看详情](https://pure-admin.cn/pages/service/)
|
||||||
|
|
||||||
## 预览
|
## 预览
|
||||||
|
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
import type { Plugin } from "vite";
|
import type { Plugin } from "vite";
|
||||||
|
import gradient from "gradient-string";
|
||||||
import { getPackageSize } from "./utils";
|
import { getPackageSize } from "./utils";
|
||||||
import dayjs, { type Dayjs } from "dayjs";
|
import dayjs, { type Dayjs } from "dayjs";
|
||||||
import duration from "dayjs/plugin/duration";
|
import duration from "dayjs/plugin/duration";
|
||||||
import gradientString from "gradient-string";
|
|
||||||
import boxen, { type Options as BoxenOptions } from "boxen";
|
import boxen, { type Options as BoxenOptions } from "boxen";
|
||||||
dayjs.extend(duration);
|
dayjs.extend(duration);
|
||||||
|
|
||||||
const welcomeMessage = gradientString("cyan", "magenta").multiline(
|
const welcomeMessage = gradient(["cyan", "magenta"]).multiline(
|
||||||
`您好! 欢迎使用 pure-admin 开源项目\n我们为您精心准备了下面两个贴心的保姆级文档\nhttps://pure-admin.github.io/pure-admin-doc\nhttps://pure-admin-utils.netlify.app`
|
`您好! 欢迎使用 pure-admin 开源项目\n我们为您精心准备了下面两个贴心的保姆级文档\nhttps://pure-admin.cn\nhttps://pure-admin-utils.netlify.app`
|
||||||
);
|
);
|
||||||
|
|
||||||
const boxenOptions: BoxenOptions = {
|
const boxenOptions: BoxenOptions = {
|
||||||
@ -41,7 +41,7 @@ export function viteBuildInfo(): Plugin {
|
|||||||
callback: (size: string) => {
|
callback: (size: string) => {
|
||||||
console.log(
|
console.log(
|
||||||
boxen(
|
boxen(
|
||||||
gradientString("cyan", "magenta").multiline(
|
gradient(["cyan", "magenta"]).multiline(
|
||||||
`🎉 恭喜打包完成(总用时${dayjs
|
`🎉 恭喜打包完成(总用时${dayjs
|
||||||
.duration(endTime.diff(startTime))
|
.duration(endTime.diff(startTime))
|
||||||
.format("mm分ss秒")},打包后的大小为${size})`
|
.format("mm分ss秒")},打包后的大小为${size})`
|
||||||
|
@ -22,12 +22,8 @@ const include = [
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 在预构建中强制排除的依赖项
|
* 在预构建中强制排除的依赖项
|
||||||
* 温馨提示:所有以 `@iconify-icons/` 开头引入的的本地图标模块,都应该加入到下面的 `exclude` 里,因为平台推荐的使用方式是哪里需要哪里引入而且都是单个的引入,不需要预构建,直接让浏览器加载就好
|
* 温馨提示:平台推荐的使用方式是哪里需要哪里引入而且都是单个的引入,不需要预构建,直接让浏览器加载就好
|
||||||
*/
|
*/
|
||||||
const exclude = [
|
const exclude = ["@iconify/json"];
|
||||||
"@iconify-icons/ep",
|
|
||||||
"@iconify-icons/ri",
|
|
||||||
"@pureadmin/theme/dist/browser-utils"
|
|
||||||
];
|
|
||||||
|
|
||||||
export { include, exclude };
|
export { include, exclude };
|
||||||
|
@ -2,14 +2,15 @@ import { cdn } from "./cdn";
|
|||||||
import vue from "@vitejs/plugin-vue";
|
import vue from "@vitejs/plugin-vue";
|
||||||
import { viteBuildInfo } from "./info";
|
import { viteBuildInfo } from "./info";
|
||||||
import svgLoader from "vite-svg-loader";
|
import svgLoader from "vite-svg-loader";
|
||||||
|
import Icons from "unplugin-icons/vite";
|
||||||
import type { PluginOption } from "vite";
|
import type { PluginOption } from "vite";
|
||||||
import vueJsx from "@vitejs/plugin-vue-jsx";
|
import vueJsx from "@vitejs/plugin-vue-jsx";
|
||||||
|
import tailwindcss from "@tailwindcss/vite";
|
||||||
import { configCompressPlugin } from "./compress";
|
import { configCompressPlugin } from "./compress";
|
||||||
import removeNoMatch from "vite-plugin-router-warn";
|
import removeNoMatch from "vite-plugin-router-warn";
|
||||||
import { visualizer } from "rollup-plugin-visualizer";
|
import { visualizer } from "rollup-plugin-visualizer";
|
||||||
import removeConsole from "vite-plugin-remove-console";
|
import removeConsole from "vite-plugin-remove-console";
|
||||||
import { themePreprocessorPlugin } from "@pureadmin/theme";
|
import { codeInspectorPlugin } from "code-inspector-plugin";
|
||||||
import { genScssMultipleScopeVars } from "../src/layout/theme";
|
|
||||||
import { vitePluginFakeServer } from "vite-plugin-fake-server";
|
import { vitePluginFakeServer } from "vite-plugin-fake-server";
|
||||||
|
|
||||||
export function getPluginsList(
|
export function getPluginsList(
|
||||||
@ -18,9 +19,20 @@ export function getPluginsList(
|
|||||||
): PluginOption[] {
|
): PluginOption[] {
|
||||||
const lifecycle = process.env.npm_lifecycle_event;
|
const lifecycle = process.env.npm_lifecycle_event;
|
||||||
return [
|
return [
|
||||||
|
tailwindcss(),
|
||||||
vue(),
|
vue(),
|
||||||
// jsx、tsx语法支持
|
// jsx、tsx语法支持
|
||||||
vueJsx(),
|
vueJsx(),
|
||||||
|
/**
|
||||||
|
* 在页面上按住组合键时,鼠标在页面移动即会在 DOM 上出现遮罩层并显示相关信息,点击一下将自动打开 IDE 并将光标定位到元素对应的代码位置
|
||||||
|
* Mac 默认组合键 Option + Shift
|
||||||
|
* Windows 默认组合键 Alt + Shift
|
||||||
|
* 更多用法看 https://inspector.fe-dev.cn/guide/start.html
|
||||||
|
*/
|
||||||
|
codeInspectorPlugin({
|
||||||
|
bundler: "vite",
|
||||||
|
hideConsole: true
|
||||||
|
}),
|
||||||
viteBuildInfo(),
|
viteBuildInfo(),
|
||||||
/**
|
/**
|
||||||
* 开发环境下移除非必要的vue-router动态路由警告No match found for location with path
|
* 开发环境下移除非必要的vue-router动态路由警告No match found for location with path
|
||||||
@ -35,15 +47,13 @@ export function getPluginsList(
|
|||||||
infixName: false,
|
infixName: false,
|
||||||
enableProd: true
|
enableProd: true
|
||||||
}),
|
}),
|
||||||
// 自定义主题
|
|
||||||
themePreprocessorPlugin({
|
|
||||||
scss: {
|
|
||||||
multipleScopeVars: genScssMultipleScopeVars(),
|
|
||||||
extract: true
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
// svg组件化支持
|
// svg组件化支持
|
||||||
svgLoader(),
|
svgLoader(),
|
||||||
|
// 自动按需加载图标
|
||||||
|
Icons({
|
||||||
|
compiler: "vue3",
|
||||||
|
scale: 1
|
||||||
|
}),
|
||||||
VITE_CDN ? cdn : null,
|
VITE_CDN ? cdn : null,
|
||||||
configCompressPlugin(VITE_COMPRESSION),
|
configCompressPlugin(VITE_COMPRESSION),
|
||||||
// 线上环境删除console
|
// 线上环境删除console
|
||||||
|
@ -1,26 +1,25 @@
|
|||||||
import js from "@eslint/js";
|
import js from "@eslint/js";
|
||||||
|
import tseslint from "typescript-eslint";
|
||||||
import pluginVue from "eslint-plugin-vue";
|
import pluginVue from "eslint-plugin-vue";
|
||||||
import * as parserVue from "vue-eslint-parser";
|
import * as parserVue from "vue-eslint-parser";
|
||||||
import configPrettier from "eslint-config-prettier";
|
import configPrettier from "eslint-config-prettier";
|
||||||
import pluginPrettier from "eslint-plugin-prettier";
|
import pluginPrettier from "eslint-plugin-prettier";
|
||||||
import { defineFlatConfig } from "eslint-define-config";
|
import { defineConfig, globalIgnores } from "eslint/config";
|
||||||
import * as parserTypeScript from "@typescript-eslint/parser";
|
|
||||||
import pluginTypeScript from "@typescript-eslint/eslint-plugin";
|
|
||||||
|
|
||||||
export default defineFlatConfig([
|
export default defineConfig([
|
||||||
{
|
globalIgnores([
|
||||||
...js.configs.recommended,
|
|
||||||
ignores: [
|
|
||||||
"**/.*",
|
"**/.*",
|
||||||
"dist/*",
|
"dist/*",
|
||||||
"*.d.ts",
|
"*.d.ts",
|
||||||
"public/*",
|
"public/*",
|
||||||
"src/assets/**",
|
"src/assets/**",
|
||||||
"src/**/iconfont/**"
|
"src/**/iconfont/**"
|
||||||
],
|
]),
|
||||||
|
{
|
||||||
|
...js.configs.recommended,
|
||||||
languageOptions: {
|
languageOptions: {
|
||||||
globals: {
|
globals: {
|
||||||
// index.d.ts
|
// types/index.d.ts
|
||||||
RefType: "readonly",
|
RefType: "readonly",
|
||||||
EmitType: "readonly",
|
EmitType: "readonly",
|
||||||
TargetContext: "readonly",
|
TargetContext: "readonly",
|
||||||
@ -73,26 +72,18 @@ export default defineFlatConfig([
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
...tseslint.config({
|
||||||
|
extends: [...tseslint.configs.recommended],
|
||||||
files: ["**/*.?([cm])ts", "**/*.?([cm])tsx"],
|
files: ["**/*.?([cm])ts", "**/*.?([cm])tsx"],
|
||||||
languageOptions: {
|
|
||||||
parser: parserTypeScript,
|
|
||||||
parserOptions: {
|
|
||||||
sourceType: "module"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
plugins: {
|
|
||||||
"@typescript-eslint": pluginTypeScript
|
|
||||||
},
|
|
||||||
rules: {
|
rules: {
|
||||||
...pluginTypeScript.configs.strict.rules,
|
|
||||||
"@typescript-eslint/ban-types": "off",
|
|
||||||
"@typescript-eslint/no-redeclare": "error",
|
"@typescript-eslint/no-redeclare": "error",
|
||||||
"@typescript-eslint/ban-ts-comment": "off",
|
"@typescript-eslint/ban-ts-comment": "off",
|
||||||
"@typescript-eslint/no-explicit-any": "off",
|
"@typescript-eslint/no-explicit-any": "off",
|
||||||
"@typescript-eslint/prefer-as-const": "warn",
|
"@typescript-eslint/prefer-as-const": "warn",
|
||||||
"@typescript-eslint/no-empty-function": "off",
|
"@typescript-eslint/no-empty-function": "off",
|
||||||
"@typescript-eslint/no-non-null-assertion": "off",
|
"@typescript-eslint/no-non-null-assertion": "off",
|
||||||
|
"@typescript-eslint/no-unused-expressions": "off",
|
||||||
|
"@typescript-eslint/no-unsafe-function-type": "off",
|
||||||
"@typescript-eslint/no-import-type-side-effects": "error",
|
"@typescript-eslint/no-import-type-side-effects": "error",
|
||||||
"@typescript-eslint/explicit-module-boundary-types": "off",
|
"@typescript-eslint/explicit-module-boundary-types": "off",
|
||||||
"@typescript-eslint/consistent-type-imports": [
|
"@typescript-eslint/consistent-type-imports": [
|
||||||
@ -111,20 +102,20 @@ export default defineFlatConfig([
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
}),
|
||||||
{
|
{
|
||||||
files: ["**/*.d.ts"],
|
files: ["**/*.d.ts"],
|
||||||
rules: {
|
rules: {
|
||||||
"eslint-comments/no-unlimited-disable": "off",
|
"eslint-comments/no-unlimited-disable": "off",
|
||||||
"import/no-duplicates": "off",
|
"import/no-duplicates": "off",
|
||||||
|
"no-restricted-syntax": "off",
|
||||||
"unused-imports/no-unused-vars": "off"
|
"unused-imports/no-unused-vars": "off"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
files: ["**/*.?([cm])js"],
|
files: ["**/*.?([cm])js"],
|
||||||
rules: {
|
rules: {
|
||||||
"@typescript-eslint/no-require-imports": "off",
|
"@typescript-eslint/no-require-imports": "off"
|
||||||
"@typescript-eslint/no-var-requires": "off"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -145,18 +136,19 @@ export default defineFlatConfig([
|
|||||||
jsx: true
|
jsx: true
|
||||||
},
|
},
|
||||||
extraFileExtensions: [".vue"],
|
extraFileExtensions: [".vue"],
|
||||||
parser: "@typescript-eslint/parser",
|
parser: tseslint.parser,
|
||||||
sourceType: "module"
|
sourceType: "module"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
plugins: {
|
plugins: {
|
||||||
|
"@typescript-eslint": tseslint.plugin,
|
||||||
vue: pluginVue
|
vue: pluginVue
|
||||||
},
|
},
|
||||||
processor: pluginVue.processors[".vue"],
|
processor: pluginVue.processors[".vue"],
|
||||||
rules: {
|
rules: {
|
||||||
...pluginVue.configs.base.rules,
|
...pluginVue.configs.base.rules,
|
||||||
...pluginVue.configs["vue3-essential"].rules,
|
...pluginVue.configs.essential.rules,
|
||||||
...pluginVue.configs["vue3-recommended"].rules,
|
...pluginVue.configs.recommended.rules,
|
||||||
"no-undef": "off",
|
"no-undef": "off",
|
||||||
"no-unused-vars": "off",
|
"no-unused-vars": "off",
|
||||||
"vue/no-v-html": "off",
|
"vue/no-v-html": "off",
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
@ -10,9 +10,6 @@
|
|||||||
/>
|
/>
|
||||||
<title>pure-admin-thin</title>
|
<title>pure-admin-thin</title>
|
||||||
<link rel="icon" href="/favicon.ico" />
|
<link rel="icon" href="/favicon.ico" />
|
||||||
<script>
|
|
||||||
window.process = {};
|
|
||||||
</script>
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
@ -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"]
|
||||||
|
},
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: "/permission/button/router",
|
||||||
|
component: "permission/button/index",
|
||||||
|
name: "PermissionButtonRouter",
|
||||||
|
meta: {
|
||||||
|
title: "路由返回按钮权限",
|
||||||
auths: [
|
auths: [
|
||||||
"permission:btn:add",
|
"permission:btn:add",
|
||||||
"permission:btn:edit",
|
"permission:btn:edit",
|
||||||
"permission:btn:delete"
|
"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"
|
||||||
|
148
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "pure-admin-thin",
|
"name": "pure-admin-thin",
|
||||||
"version": "5.6.0",
|
"version": "6.0.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@ -49,103 +49,111 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pureadmin/descriptions": "^1.2.1",
|
"@pureadmin/descriptions": "^1.2.1",
|
||||||
"@pureadmin/table": "^3.1.2",
|
"@pureadmin/table": "^3.2.1",
|
||||||
"@pureadmin/utils": "^2.4.7",
|
"@pureadmin/utils": "^2.6.0",
|
||||||
"@vueuse/core": "^10.9.0",
|
"@vueuse/core": "^13.1.0",
|
||||||
"@vueuse/motion": "^2.1.0",
|
"@vueuse/motion": "^3.0.3",
|
||||||
"animate.css": "^4.1.1",
|
"animate.css": "^4.1.1",
|
||||||
"axios": "^1.6.8",
|
"axios": "^1.9.0",
|
||||||
"dayjs": "^1.11.11",
|
"dayjs": "^1.11.13",
|
||||||
"echarts": "^5.5.0",
|
"echarts": "^5.6.0",
|
||||||
"element-plus": "^2.7.3",
|
"element-plus": "^2.9.8",
|
||||||
"js-cookie": "^3.0.5",
|
"js-cookie": "^3.0.5",
|
||||||
"localforage": "^1.10.0",
|
"localforage": "^1.10.0",
|
||||||
"mitt": "^3.0.1",
|
"mitt": "^3.0.1",
|
||||||
"nprogress": "^0.2.0",
|
"nprogress": "^0.2.0",
|
||||||
"path": "^0.12.7",
|
"path-browserify": "^1.0.1",
|
||||||
"pinia": "^2.1.7",
|
"pinia": "^3.0.2",
|
||||||
"pinyin-pro": "^3.20.4",
|
"pinyin-pro": "^3.26.0",
|
||||||
"qs": "^6.12.1",
|
"qs": "^6.14.0",
|
||||||
"responsive-storage": "^2.2.0",
|
"responsive-storage": "^2.2.0",
|
||||||
"sortablejs": "^1.15.2",
|
"sortablejs": "^1.15.6",
|
||||||
"vue": "^3.4.27",
|
"vue": "^3.5.13",
|
||||||
"vue-router": "^4.3.2",
|
"vue-router": "^4.5.0",
|
||||||
"vue-tippy": "^6.4.1",
|
"vue-tippy": "^6.7.0",
|
||||||
"vue-types": "^5.1.2"
|
"vue-types": "^6.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@commitlint/cli": "^19.3.0",
|
"@commitlint/cli": "^19.8.0",
|
||||||
"@commitlint/config-conventional": "^19.2.2",
|
"@commitlint/config-conventional": "^19.8.0",
|
||||||
"@commitlint/types": "^19.0.3",
|
"@commitlint/types": "^19.8.0",
|
||||||
"@eslint/js": "^9.2.0",
|
"@eslint/js": "^9.25.1",
|
||||||
"@faker-js/faker": "^8.4.1",
|
"@faker-js/faker": "^9.7.0",
|
||||||
"@iconify-icons/ep": "^1.2.12",
|
"@iconify/json": "^2.2.331",
|
||||||
"@iconify-icons/ri": "^1.2.10",
|
"@iconify/vue": "4.2.0",
|
||||||
"@iconify/vue": "^4.1.2",
|
"@tailwindcss/vite": "^4.1.4",
|
||||||
"@pureadmin/theme": "^3.2.0",
|
|
||||||
"@types/gradient-string": "^1.1.6",
|
|
||||||
"@types/js-cookie": "^3.0.6",
|
"@types/js-cookie": "^3.0.6",
|
||||||
"@types/node": "^20.12.11",
|
"@types/node": "^20.17.30",
|
||||||
"@types/nprogress": "^0.2.3",
|
"@types/nprogress": "^0.2.3",
|
||||||
"@types/qs": "^6.9.15",
|
"@types/path-browserify": "^1.0.3",
|
||||||
|
"@types/qs": "^6.9.18",
|
||||||
"@types/sortablejs": "^1.15.8",
|
"@types/sortablejs": "^1.15.8",
|
||||||
"@typescript-eslint/eslint-plugin": "^7.9.0",
|
"@vitejs/plugin-vue": "^5.2.3",
|
||||||
"@typescript-eslint/parser": "^7.9.0",
|
"@vitejs/plugin-vue-jsx": "^4.1.2",
|
||||||
"@vitejs/plugin-vue": "^5.0.4",
|
"boxen": "^8.0.1",
|
||||||
"@vitejs/plugin-vue-jsx": "^3.1.0",
|
"code-inspector-plugin": "^0.20.10",
|
||||||
"autoprefixer": "^10.4.19",
|
"cssnano": "^7.0.6",
|
||||||
"boxen": "^7.1.1",
|
"eslint": "^9.25.1",
|
||||||
"cssnano": "^7.0.1",
|
"eslint-config-prettier": "^10.1.2",
|
||||||
"eslint": "^9.2.0",
|
"eslint-plugin-prettier": "^5.2.6",
|
||||||
"eslint-config-prettier": "^9.1.0",
|
"eslint-plugin-vue": "^10.0.0",
|
||||||
"eslint-define-config": "^2.1.0",
|
"gradient-string": "^3.0.0",
|
||||||
"eslint-plugin-prettier": "^5.1.3",
|
"husky": "^9.1.7",
|
||||||
"eslint-plugin-vue": "^9.26.0",
|
"lint-staged": "^15.5.1",
|
||||||
"gradient-string": "^2.0.2",
|
"postcss": "^8.5.3",
|
||||||
"husky": "^9.0.11",
|
"postcss-html": "^1.8.0",
|
||||||
"lint-staged": "^15.2.2",
|
"postcss-load-config": "^6.0.1",
|
||||||
"postcss": "^8.4.38",
|
|
||||||
"postcss-html": "^1.7.0",
|
|
||||||
"postcss-import": "^16.1.0",
|
|
||||||
"postcss-scss": "^4.0.9",
|
"postcss-scss": "^4.0.9",
|
||||||
"prettier": "^3.2.5",
|
"prettier": "^3.5.3",
|
||||||
"rimraf": "^5.0.7",
|
"rimraf": "^6.0.1",
|
||||||
"rollup-plugin-visualizer": "^5.12.0",
|
"rollup-plugin-visualizer": "^5.14.0",
|
||||||
"sass": "^1.77.1",
|
"sass": "^1.87.0",
|
||||||
"stylelint": "^16.5.0",
|
"stylelint": "^16.19.0",
|
||||||
"stylelint-config-recess-order": "^5.0.1",
|
"stylelint-config-recess-order": "^6.0.0",
|
||||||
"stylelint-config-recommended-vue": "^1.5.0",
|
"stylelint-config-recommended-vue": "^1.6.0",
|
||||||
"stylelint-config-standard-scss": "^13.1.0",
|
"stylelint-config-standard-scss": "^14.0.0",
|
||||||
"stylelint-prettier": "^5.0.0",
|
"stylelint-prettier": "^5.0.3",
|
||||||
"svgo": "^3.3.2",
|
"svgo": "^3.3.2",
|
||||||
"tailwindcss": "^3.4.3",
|
"tailwindcss": "^4.1.4",
|
||||||
"typescript": "^5.4.5",
|
"typescript": "^5.8.3",
|
||||||
"vite": "^5.2.11",
|
"typescript-eslint": "^8.31.0",
|
||||||
|
"unplugin-icons": "^22.1.0",
|
||||||
|
"vite": "^6.3.3",
|
||||||
"vite-plugin-cdn-import": "^1.0.1",
|
"vite-plugin-cdn-import": "^1.0.1",
|
||||||
"vite-plugin-compression": "^0.5.1",
|
"vite-plugin-compression": "^0.5.1",
|
||||||
"vite-plugin-fake-server": "^2.1.1",
|
"vite-plugin-fake-server": "^2.2.0",
|
||||||
"vite-plugin-remove-console": "^2.2.0",
|
"vite-plugin-remove-console": "^2.2.0",
|
||||||
"vite-plugin-router-warn": "^1.0.0",
|
"vite-plugin-router-warn": "^1.0.0",
|
||||||
"vite-svg-loader": "^5.1.0",
|
"vite-svg-loader": "^5.1.0",
|
||||||
"vue-eslint-parser": "^9.4.2",
|
"vue-eslint-parser": "^10.1.3",
|
||||||
"vue-tsc": "^1.8.27"
|
"vue-tsc": "^2.2.10"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0",
|
"node": "^18.18.0 || ^20.9.0 || >=22.0.0",
|
||||||
"pnpm": ">=9"
|
"pnpm": ">=9"
|
||||||
},
|
},
|
||||||
"pnpm": {
|
"pnpm": {
|
||||||
"allowedDeprecatedVersions": {
|
"allowedDeprecatedVersions": {
|
||||||
|
"are-we-there-yet": "*",
|
||||||
"sourcemap-codec": "*",
|
"sourcemap-codec": "*",
|
||||||
|
"lodash.isequal": "*",
|
||||||
"domexception": "*",
|
"domexception": "*",
|
||||||
"w3c-hr-time": "*",
|
"w3c-hr-time": "*",
|
||||||
|
"inflight": "*",
|
||||||
|
"npmlog": "*",
|
||||||
|
"rimraf": "*",
|
||||||
"stable": "*",
|
"stable": "*",
|
||||||
"abab": "*"
|
"gauge": "*",
|
||||||
|
"abab": "*",
|
||||||
|
"glob": "*"
|
||||||
},
|
},
|
||||||
"peerDependencyRules": {
|
"onlyBuiltDependencies": [
|
||||||
"allowedVersions": {
|
"@parcel/watcher",
|
||||||
"eslint": "9"
|
"core-js",
|
||||||
}
|
"es5-ext",
|
||||||
}
|
"esbuild",
|
||||||
|
"typeit",
|
||||||
|
"vue-demi"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
6698
pnpm-lock.yaml
generated
@ -3,10 +3,6 @@
|
|||||||
/** @type {import('postcss-load-config').Config} */
|
/** @type {import('postcss-load-config').Config} */
|
||||||
export default {
|
export default {
|
||||||
plugins: {
|
plugins: {
|
||||||
"postcss-import": {},
|
|
||||||
"tailwindcss/nesting": {},
|
|
||||||
tailwindcss: {},
|
|
||||||
autoprefixer: {},
|
|
||||||
...(process.env.NODE_ENV === "production" ? { cssnano: {} } : {})
|
...(process.env.NODE_ENV === "production" ? { cssnano: {} } : {})
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"Version": "5.6.0",
|
"Version": "6.0.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` */
|
||||||
|
@ -28,8 +28,7 @@
|
|||||||
c = document.createElement("div");
|
c = document.createElement("div");
|
||||||
(c.innerHTML = e._iconfont_svg_string_2208059),
|
(c.innerHTML = e._iconfont_svg_string_2208059),
|
||||||
(c = c.getElementsByTagName("svg")[0]) &&
|
(c = c.getElementsByTagName("svg")[0]) &&
|
||||||
(c.setAttribute("aria-hidden", "true"),
|
((c.style.position = "absolute"),
|
||||||
(c.style.position = "absolute"),
|
|
||||||
(c.style.width = 0),
|
(c.style.width = 0),
|
||||||
(c.style.height = 0),
|
(c.style.height = 0),
|
||||||
(c.style.overflow = "hidden"),
|
(c.style.overflow = "hidden"),
|
||||||
|
@ -1 +1 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" aria-hidden="true" class="iconify iconify--ant-design" viewBox="0 0 1024 1024"><path fill="currentColor" d="M864 170h-60c-4.4 0-8 3.6-8 8v518H310v-73c0-6.7-7.8-10.5-13-6.3l-141.9 112a8 8 0 0 0 0 12.6l141.9 112c5.3 4.2 13 .4 13-6.3v-75h498c35.3 0 64-28.7 64-64V178c0-4.4-3.6-8-8-8"/></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" class="iconify iconify--ant-design" viewBox="0 0 1024 1024"><path fill="currentColor" d="M864 170h-60c-4.4 0-8 3.6-8 8v518H310v-73c0-6.7-7.8-10.5-13-6.3l-141.9 112a8 8 0 0 0 0 12.6l141.9 112c5.3 4.2 13 .4 13-6.3v-75h498c35.3 0 64-28.7 64-64V178c0-4.4-3.6-8-8-8"/></svg>
|
Before Width: | Height: | Size: 351 B After Width: | Height: | Size: 332 B |
@ -1 +1 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" aria-hidden="true" class="re-screen" color="#00000073" viewBox="0 0 16 16"><path fill="currentColor" d="M3.5 4H1V3h2V1h1v2.5zM13 3V1h-1v2.5l.5.5H15V3zm-1 9.5V15h1v-2h2v-1h-2.5zM1 12v1h2v2h1v-2.5l-.5-.5zm11-1.5-.5.5h-7l-.5-.5v-5l.5-.5h7l.5.5zM10 7H6v2h4z"/></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" class="re-screen" color="#00000073" viewBox="0 0 16 16"><path fill="currentColor" d="M3.5 4H1V3h2V1h1v2.5zM13 3V1h-1v2.5l.5.5H15V3zm-1 9.5V15h1v-2h2v-1h-2.5zM1 12v1h2v2h1v-2.5l-.5-.5zm11-1.5-.5.5h-7l-.5-.5v-5l.5-.5h7l.5.5zM10 7H6v2h4z"/></svg>
|
Before Width: | Height: | Size: 327 B After Width: | Height: | Size: 308 B |
@ -1 +1 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" aria-hidden="true" class="re-screen" color="#00000073" viewBox="0 0 16 16"><path fill="currentColor" d="M3 12h10V4H3zm2-6h6v4H5zM2 6H1V2.5l.5-.5H5v1H2zm13-3.5V6h-1V3h-3V2h3.5zM14 10h1v3.5l-.5.5H11v-1h3zM2 13h3v1H1.5l-.5-.5V10h1z"/></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" class="re-screen" color="#00000073" viewBox="0 0 16 16"><path fill="currentColor" d="M3 12h10V4H3zm2-6h6v4H5zM2 6H1V2.5l.5-.5H5v1H2zm13-3.5V6h-1V3h-3V2h3.5zM14 10h1v3.5l-.5.5H11v-1h3zM2 13h3v1H1.5l-.5-.5V10h1z"/></svg>
|
Before Width: | Height: | Size: 302 B After Width: | Height: | Size: 283 B |
@ -1 +1 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" aria-hidden="true" class="iconify iconify--mdi" viewBox="0 0 24 24"><path fill="currentColor" d="M1 7h6v2H3v2h4v2H3v2h4v2H1zm10 0h4v2h-4v2h2a2 2 0 0 1 2 2v2c0 1.11-.89 2-2 2H9v-2h4v-2h-2a2 2 0 0 1-2-2V9c0-1.1.9-2 2-2m8 0h2a2 2 0 0 1 2 2v1h-2V9h-2v6h2v-1h2v1c0 1.11-.89 2-2 2h-2a2 2 0 0 1-2-2V9c0-1.1.9-2 2-2"/></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" class="iconify iconify--mdi" viewBox="0 0 24 24"><path fill="currentColor" d="M1 7h6v2H3v2h4v2H3v2h4v2H1zm10 0h4v2h-4v2h2a2 2 0 0 1 2 2v2c0 1.11-.89 2-2 2H9v-2h4v-2h-2a2 2 0 0 1-2-2V9c0-1.1.9-2 2-2m8 0h2a2 2 0 0 1 2 2v1h-2V9h-2v6h2v-1h2v1c0 1.11-.89 2-2 2h-2a2 2 0 0 1-2-2V9c0-1.1.9-2 2-2"/></svg>
|
Before Width: | Height: | Size: 379 B After Width: | Height: | Size: 360 B |
@ -1 +1 @@
|
|||||||
<svg width="32" height="32" fill="currentColor" aria-hidden="true" data-icon="holder" viewBox="64 64 896 896"><path d="M300 276.5a56 56 0 1 0 56-97 56 56 0 0 0-56 97m0 284a56 56 0 1 0 56-97 56 56 0 0 0-56 97M640 228a56 56 0 1 0 112 0 56 56 0 0 0-112 0m0 284a56 56 0 1 0 112 0 56 56 0 0 0-112 0M300 844.5a56 56 0 1 0 56-97 56 56 0 0 0-56 97M640 796a56 56 0 1 0 112 0 56 56 0 0 0-112 0"/></svg>
|
<svg width="32" height="32" fill="currentColor" data-icon="holder" viewBox="64 64 896 896"><path d="M300 276.5a56 56 0 1 0 56-97 56 56 0 0 0-56 97m0 284a56 56 0 1 0 56-97 56 56 0 0 0-56 97M640 228a56 56 0 1 0 112 0 56 56 0 0 0-112 0m0 284a56 56 0 1 0 112 0 56 56 0 0 0-112 0M300 844.5a56 56 0 1 0 56-97 56 56 0 0 0-56 97M640 796a56 56 0 1 0 112 0 56 56 0 0 0-112 0"/></svg>
|
Before Width: | Height: | Size: 392 B After Width: | Height: | Size: 373 B |
@ -8,13 +8,14 @@ import {
|
|||||||
} from "./index";
|
} from "./index";
|
||||||
import { ref, computed } from "vue";
|
import { ref, computed } from "vue";
|
||||||
import { isFunction } from "@pureadmin/utils";
|
import { isFunction } from "@pureadmin/utils";
|
||||||
import Fullscreen from "@iconify-icons/ri/fullscreen-fill";
|
import Fullscreen from "~icons/ri/fullscreen-fill";
|
||||||
import ExitFullscreen from "@iconify-icons/ri/fullscreen-exit-fill";
|
import ExitFullscreen from "~icons/ri/fullscreen-exit-fill";
|
||||||
|
|
||||||
defineOptions({
|
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();
|
||||||
}
|
}
|
||||||
@ -62,7 +79,7 @@ const fullscreenClass = computed(() => {
|
|||||||
"el-dialog__close",
|
"el-dialog__close",
|
||||||
"-translate-x-2",
|
"-translate-x-2",
|
||||||
"cursor-pointer",
|
"cursor-pointer",
|
||||||
"hover:!text-[red]"
|
"hover:text-[red]!"
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import type { iconType } from "./types";
|
import type { iconType } from "./types";
|
||||||
import { h, defineComponent, type Component } from "vue";
|
import { h, defineComponent, type Component } from "vue";
|
||||||
import { IconifyIconOnline, IconifyIconOffline, FontIcon } from "../index";
|
import { FontIcon, IconifyIconOnline, IconifyIconOffline } from "../index";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 支持 `iconfont`、自定义 `svg` 以及 `iconify` 中所有的图标
|
* 支持 `iconfont`、自定义 `svg` 以及 `iconify` 中所有的图标
|
||||||
* @see 点击查看文档图标篇 {@link https://pure-admin.github.io/pure-admin-doc/pages/icon/}
|
* @see 点击查看文档图标篇 {@link https://pure-admin.cn/pages/icon/}
|
||||||
* @param icon 必传 图标
|
* @param icon 必传 图标
|
||||||
* @param attrs 可选 iconType 属性
|
* @param attrs 可选 iconType 属性
|
||||||
* @returns Component
|
* @returns Component
|
||||||
@ -49,10 +49,12 @@ export function useRenderIcon(icon: any, attrs?: iconType): Component {
|
|||||||
return defineComponent({
|
return defineComponent({
|
||||||
name: "Icon",
|
name: "Icon",
|
||||||
render() {
|
render() {
|
||||||
const IconifyIcon =
|
if (!icon) return;
|
||||||
icon && icon.includes(":") ? IconifyIconOnline : IconifyIconOffline;
|
const IconifyIcon = icon.includes(":")
|
||||||
|
? IconifyIconOnline
|
||||||
|
: IconifyIconOffline;
|
||||||
return h(IconifyIcon, {
|
return h(IconifyIcon, {
|
||||||
icon: icon,
|
icon,
|
||||||
...attrs
|
...attrs
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -27,8 +27,7 @@ export default defineComponent({
|
|||||||
return h(
|
return h(
|
||||||
"svg",
|
"svg",
|
||||||
{
|
{
|
||||||
class: "icon-svg",
|
class: "icon-svg"
|
||||||
"aria-hidden": true
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
default: () => [
|
default: () => [
|
||||||
|
@ -13,10 +13,26 @@ export default defineComponent({
|
|||||||
render() {
|
render() {
|
||||||
if (typeof this.icon === "object") addIcon(this.icon, this.icon);
|
if (typeof this.icon === "object") addIcon(this.icon, this.icon);
|
||||||
const attrs = this.$attrs;
|
const attrs = this.$attrs;
|
||||||
|
if (typeof this.icon === "string") {
|
||||||
return h(
|
return h(
|
||||||
IconifyIcon,
|
IconifyIcon,
|
||||||
{
|
{
|
||||||
icon: this.icon,
|
icon: this.icon,
|
||||||
|
"aria-hidden": false,
|
||||||
|
style: attrs?.style
|
||||||
|
? Object.assign(attrs.style, { outline: "none" })
|
||||||
|
: { outline: "none" },
|
||||||
|
...attrs
|
||||||
|
},
|
||||||
|
{
|
||||||
|
default: () => []
|
||||||
|
}
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return h(
|
||||||
|
this.icon,
|
||||||
|
{
|
||||||
|
"aria-hidden": false,
|
||||||
style: attrs?.style
|
style: attrs?.style
|
||||||
? Object.assign(attrs.style, { outline: "none" })
|
? Object.assign(attrs.style, { outline: "none" })
|
||||||
: { outline: "none" },
|
: { outline: "none" },
|
||||||
@ -27,4 +43,5 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
@ -17,6 +17,7 @@ export default defineComponent({
|
|||||||
IconifyIcon,
|
IconifyIcon,
|
||||||
{
|
{
|
||||||
icon: `${this.icon}`,
|
icon: `${this.icon}`,
|
||||||
|
"aria-hidden": false,
|
||||||
style: attrs?.style
|
style: attrs?.style
|
||||||
? Object.assign(attrs.style, { outline: "none" })
|
? Object.assign(attrs.style, { outline: "none" })
|
||||||
: { outline: "none" },
|
: { outline: "none" },
|
||||||
|
@ -1,14 +1,23 @@
|
|||||||
// 这里存放本地图标,在 src/layout/index.vue 文件中加载,避免在首启动加载
|
// 这里存放本地图标,在 src/layout/index.vue 文件中加载,避免在首启动加载
|
||||||
|
import { getSvgInfo } from "@pureadmin/utils";
|
||||||
import { addIcon } from "@iconify/vue/dist/offline";
|
import { addIcon } from "@iconify/vue/dist/offline";
|
||||||
|
|
||||||
|
// https://icon-sets.iconify.design/ep/?keyword=ep
|
||||||
|
import EpHomeFilled from "~icons/ep/home-filled?raw";
|
||||||
|
|
||||||
|
// https://icon-sets.iconify.design/ri/?keyword=ri
|
||||||
|
import RiSearchLine from "~icons/ri/search-line?raw";
|
||||||
|
import RiInformationLine from "~icons/ri/information-line?raw";
|
||||||
|
|
||||||
|
const icons = [
|
||||||
|
// Element Plus Icon: https://github.com/element-plus/element-plus-icons
|
||||||
|
["ep/home-filled", EpHomeFilled],
|
||||||
|
// Remix Icon: https://github.com/Remix-Design/RemixIcon
|
||||||
|
["ri/search-line", RiSearchLine],
|
||||||
|
["ri/information-line", RiInformationLine]
|
||||||
|
];
|
||||||
|
|
||||||
// 本地菜单图标,后端在路由的 icon 中返回对应的图标字符串并且前端在此处使用 addIcon 添加即可渲染菜单图标
|
// 本地菜单图标,后端在路由的 icon 中返回对应的图标字符串并且前端在此处使用 addIcon 添加即可渲染菜单图标
|
||||||
// @iconify-icons/ep
|
icons.forEach(([name, icon]) => {
|
||||||
import Lollipop from "@iconify-icons/ep/lollipop";
|
addIcon(name as string, getSvgInfo(icon as string));
|
||||||
import HomeFilled from "@iconify-icons/ep/home-filled";
|
});
|
||||||
addIcon("ep:lollipop", Lollipop);
|
|
||||||
addIcon("ep:home-filled", HomeFilled);
|
|
||||||
// @iconify-icons/ri
|
|
||||||
import Search from "@iconify-icons/ri/search-line";
|
|
||||||
import InformationLine from "@iconify-icons/ri/information-line";
|
|
||||||
addIcon("ri:search-line", Search);
|
|
||||||
addIcon("ri:information-line", InformationLine);
|
|
||||||
|
5
src/components/RePerms/index.ts
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import perms from "./src/perms";
|
||||||
|
|
||||||
|
const Perms = perms;
|
||||||
|
|
||||||
|
export { Perms };
|
20
src/components/RePerms/src/perms.tsx
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import { defineComponent, Fragment } from "vue";
|
||||||
|
import { hasPerms } from "@/utils/auth";
|
||||||
|
|
||||||
|
export default defineComponent({
|
||||||
|
name: "Perms",
|
||||||
|
props: {
|
||||||
|
value: {
|
||||||
|
type: undefined,
|
||||||
|
default: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
setup(props, { slots }) {
|
||||||
|
return () => {
|
||||||
|
if (!slots) return null;
|
||||||
|
return hasPerms(props.value) ? (
|
||||||
|
<Fragment>{slots.default?.()}</Fragment>
|
||||||
|
) : null;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
@ -17,6 +17,8 @@ import {
|
|||||||
getKeyList
|
getKeyList
|
||||||
} from "@pureadmin/utils";
|
} from "@pureadmin/utils";
|
||||||
|
|
||||||
|
import Fullscreen from "~icons/ri/fullscreen-fill";
|
||||||
|
import ExitFullscreen from "~icons/ri/fullscreen-exit-fill";
|
||||||
import DragIcon from "@/assets/table-bar/drag.svg?component";
|
import DragIcon from "@/assets/table-bar/drag.svg?component";
|
||||||
import ExpandIcon from "@/assets/table-bar/expand.svg?component";
|
import ExpandIcon from "@/assets/table-bar/expand.svg?component";
|
||||||
import RefreshIcon from "@/assets/table-bar/refresh.svg?component";
|
import RefreshIcon from "@/assets/table-bar/refresh.svg?component";
|
||||||
@ -51,11 +53,12 @@ const props = {
|
|||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "PureTableBar",
|
name: "PureTableBar",
|
||||||
props,
|
props,
|
||||||
emits: ["refresh"],
|
emits: ["refresh", "fullscreen"],
|
||||||
setup(props, { emit, slots, attrs }) {
|
setup(props, { emit, slots, attrs }) {
|
||||||
const size = ref("default");
|
const size = ref("default");
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const checkAll = ref(true);
|
const checkAll = ref(true);
|
||||||
|
const isFullscreen = ref(false);
|
||||||
const isIndeterminate = ref(false);
|
const isIndeterminate = ref(false);
|
||||||
const instance = getCurrentInstance()!;
|
const instance = getCurrentInstance()!;
|
||||||
const isExpandAll = ref(props.isExpandAll);
|
const isExpandAll = ref(props.isExpandAll);
|
||||||
@ -83,9 +86,9 @@ export default defineComponent({
|
|||||||
"text-black",
|
"text-black",
|
||||||
"dark:text-white",
|
"dark:text-white",
|
||||||
"duration-100",
|
"duration-100",
|
||||||
"hover:!text-primary",
|
"hover:text-primary!",
|
||||||
"cursor-pointer",
|
"cursor-pointer",
|
||||||
"outline-none"
|
"outline-hidden"
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -113,6 +116,11 @@ export default defineComponent({
|
|||||||
toggleRowExpansionAll(props.tableRef.data, isExpandAll.value);
|
toggleRowExpansionAll(props.tableRef.data, isExpandAll.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onFullscreen() {
|
||||||
|
isFullscreen.value = !isFullscreen.value;
|
||||||
|
emit("fullscreen", isFullscreen.value);
|
||||||
|
}
|
||||||
|
|
||||||
function toggleRowExpansionAll(data, isExpansion) {
|
function toggleRowExpansionAll(data, isExpansion) {
|
||||||
data.forEach(item => {
|
data.forEach(item => {
|
||||||
props.tableRef.toggleRowExpansion(item, isExpansion);
|
props.tableRef.toggleRowExpansion(item, isExpansion);
|
||||||
@ -239,7 +247,18 @@ export default defineComponent({
|
|||||||
|
|
||||||
return () => (
|
return () => (
|
||||||
<>
|
<>
|
||||||
<div {...attrs} class="w-[99/100] mt-2 px-2 pb-2 bg-bg_color">
|
<div
|
||||||
|
{...attrs}
|
||||||
|
class={[
|
||||||
|
"w-full",
|
||||||
|
"px-2",
|
||||||
|
"pb-2",
|
||||||
|
"bg-bg_color",
|
||||||
|
isFullscreen.value
|
||||||
|
? ["h-full!", "z-2002", "fixed", "inset-0"]
|
||||||
|
: "mt-2"
|
||||||
|
]}
|
||||||
|
>
|
||||||
<div class="flex justify-between w-full h-[60px] p-4">
|
<div class="flex justify-between w-full h-[60px] p-4">
|
||||||
{slots?.title ? (
|
{slots?.title ? (
|
||||||
slots.title()
|
slots.title()
|
||||||
@ -293,7 +312,7 @@ export default defineComponent({
|
|||||||
>
|
>
|
||||||
<div class={[topClass.value]}>
|
<div class={[topClass.value]}>
|
||||||
<el-checkbox
|
<el-checkbox
|
||||||
class="!-mr-1"
|
class="-mr-1!"
|
||||||
label="列展示"
|
label="列展示"
|
||||||
v-model={checkAll.value}
|
v-model={checkAll.value}
|
||||||
indeterminate={isIndeterminate.value}
|
indeterminate={isIndeterminate.value}
|
||||||
@ -323,8 +342,8 @@ export default defineComponent({
|
|||||||
class={[
|
class={[
|
||||||
"drag-btn w-[16px] mr-2",
|
"drag-btn w-[16px] mr-2",
|
||||||
isFixedColumn(item)
|
isFixedColumn(item)
|
||||||
? "!cursor-no-drop"
|
? "cursor-no-drop!"
|
||||||
: "!cursor-grab"
|
: "cursor-grab!"
|
||||||
]}
|
]}
|
||||||
onMouseenter={(event: {
|
onMouseenter={(event: {
|
||||||
preventDefault: () => void;
|
preventDefault: () => void;
|
||||||
@ -353,6 +372,14 @@ export default defineComponent({
|
|||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
</div>
|
</div>
|
||||||
</el-popover>
|
</el-popover>
|
||||||
|
<el-divider direction="vertical" />
|
||||||
|
|
||||||
|
<iconifyIconOffline
|
||||||
|
class={["w-[16px]", iconClass.value]}
|
||||||
|
icon={isFullscreen.value ? ExitFullscreen : Fullscreen}
|
||||||
|
v-tippy={isFullscreen.value ? "退出全屏" : "全屏"}
|
||||||
|
onClick={() => onFullscreen()}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{slots.default({
|
{slots.default({
|
||||||
|
@ -98,7 +98,6 @@
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
transition: 0.1s;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.pure-segmented-group {
|
.pure-segmented-group {
|
||||||
|
@ -6,7 +6,7 @@ export interface OptionsType {
|
|||||||
label?: string | (() => VNode | Component);
|
label?: string | (() => VNode | Component);
|
||||||
/**
|
/**
|
||||||
* @description 图标,采用平台内置的 `useRenderIcon` 函数渲染
|
* @description 图标,采用平台内置的 `useRenderIcon` 函数渲染
|
||||||
* @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 }
|
* @see {@link 用法参考 https://pure-admin.cn/pages/icon/#%E9%80%9A%E7%94%A8%E5%9B%BE%E6%A0%87-userendericon-hooks }
|
||||||
*/
|
*/
|
||||||
icon?: string | Component;
|
icon?: string | Component;
|
||||||
/** 图标属性、样式配置 */
|
/** 图标属性、样式配置 */
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<script lang="ts" setup>
|
<script setup lang="ts">
|
||||||
import { h, onMounted, ref, useSlots } from "vue";
|
import { h, onMounted, ref } from "vue";
|
||||||
import { type TippyOptions, useTippy } from "vue-tippy";
|
import { type TippyOptions, type TippyContent, useTippy } from "vue-tippy";
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: "ReText"
|
name: "ReText"
|
||||||
@ -17,7 +17,10 @@ const props = defineProps({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const $slots = useSlots();
|
const slots = defineSlots<{
|
||||||
|
content: () => TippyContent;
|
||||||
|
default: () => any;
|
||||||
|
}>();
|
||||||
|
|
||||||
const textRef = ref();
|
const textRef = ref();
|
||||||
const tippyFunc = ref();
|
const tippyFunc = ref();
|
||||||
@ -33,7 +36,7 @@ const isTextEllipsis = (el: HTMLElement) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const getTippyProps = () => ({
|
const getTippyProps = () => ({
|
||||||
content: h($slots.content || $slots.default),
|
content: h(slots.content || slots.default),
|
||||||
...props.tippyProps
|
...props.tippyProps
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
@ -30,8 +32,8 @@ const calculate = (
|
|||||||
const offset = el.getBoundingClientRect();
|
const offset = el.getBoundingClientRect();
|
||||||
|
|
||||||
// 获取点击位置距离 el 的垂直和水平距离
|
// 获取点击位置距离 el 的垂直和水平距离
|
||||||
let localX = e.clientX - offset.left;
|
const localX = e.clientX - offset.left;
|
||||||
let localY = e.clientY - offset.top;
|
const localY = e.clientY - offset.top;
|
||||||
|
|
||||||
let radius = 0;
|
let radius = 0;
|
||||||
let scale = 0.3;
|
let scale = 0.3;
|
||||||
@ -220,13 +222,6 @@ function updated(el: HTMLElement, binding: RippleDirectiveBinding) {
|
|||||||
updateRipple(el, binding, wasEnabled);
|
updateRipple(el, binding, wasEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 指令 v-ripple
|
|
||||||
* @use 用法如下
|
|
||||||
* 1. v-ripple 代表启用基本的 ripple 功能
|
|
||||||
* 2. v-ripple="{ class: 'text-red' }" 代表自定义 ripple 颜色,支持 tailwindcss,生效样式是 color
|
|
||||||
* 3. v-ripple.center 代表从中心扩散
|
|
||||||
*/
|
|
||||||
export const Ripple: Directive = {
|
export const Ripple: Directive = {
|
||||||
mounted,
|
mounted,
|
||||||
unmounted,
|
unmounted,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import LayFrame from "../lay-frame/index.vue";
|
import LayFrame from "../lay-frame/index.vue";
|
||||||
import LayFooter from "../lay-footer/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 BackTopIcon from "@/assets/svg/back_top.svg?component";
|
import BackTopIcon from "@/assets/svg/back_top.svg?component";
|
||||||
import { h, computed, Transition, defineComponent } from "vue";
|
import { h, computed, Transition, defineComponent } from "vue";
|
||||||
@ -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;${
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<script lang="ts" setup>
|
<script setup lang="ts">
|
||||||
import { getConfig } from "@/config";
|
import { getConfig } from "@/config";
|
||||||
|
|
||||||
const TITLE = getConfig("Title");
|
const TITLE = getConfig("Title");
|
||||||
|
@ -7,8 +7,8 @@ import LaySidebarFullScreen from "../lay-sidebar/components/SidebarFullScreen.vu
|
|||||||
import LaySidebarBreadCrumb from "../lay-sidebar/components/SidebarBreadCrumb.vue";
|
import LaySidebarBreadCrumb from "../lay-sidebar/components/SidebarBreadCrumb.vue";
|
||||||
import LaySidebarTopCollapse from "../lay-sidebar/components/SidebarTopCollapse.vue";
|
import LaySidebarTopCollapse from "../lay-sidebar/components/SidebarTopCollapse.vue";
|
||||||
|
|
||||||
import LogoutCircleRLine from "@iconify-icons/ri/logout-circle-r-line";
|
import LogoutCircleRLine from "~icons/ri/logout-circle-r-line";
|
||||||
import Setting from "@iconify-icons/ri/settings-3-line";
|
import Setting from "~icons/ri/settings-3-line";
|
||||||
|
|
||||||
const {
|
const {
|
||||||
layout,
|
layout,
|
||||||
@ -24,7 +24,7 @@ const {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="navbar bg-[#fff] shadow-sm shadow-[rgba(0,21,41,0.08)]">
|
<div class="navbar bg-[#fff] shadow-xs shadow-[rgba(0,21,41,0.08)]">
|
||||||
<LaySidebarTopCollapse
|
<LaySidebarTopCollapse
|
||||||
v-if="device === 'mobile'"
|
v-if="device === 'mobile'"
|
||||||
class="hamburger-container"
|
class="hamburger-container"
|
||||||
|
@ -49,7 +49,7 @@ function hoverDescription(event, description) {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
class="notice-container border-b-[1px] border-solid border-[#f0f0f0] dark:border-[#303030]"
|
class="notice-container border-0 border-b-[1px] border-solid border-[#f0f0f0] dark:border-[#303030]"
|
||||||
>
|
>
|
||||||
<el-avatar
|
<el-avatar
|
||||||
v-if="noticeItem.avatar"
|
v-if="noticeItem.avatar"
|
||||||
@ -112,7 +112,7 @@ function hoverDescription(event, description) {
|
|||||||
max-width: 238px;
|
max-width: 238px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<style scoped lang="scss">
|
<style lang="scss" scoped>
|
||||||
.notice-container {
|
.notice-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
import { ref, computed } from "vue";
|
import { ref, computed } from "vue";
|
||||||
import { noticesData } from "./data";
|
import { noticesData } from "./data";
|
||||||
import NoticeList from "./components/NoticeList.vue";
|
import NoticeList from "./components/NoticeList.vue";
|
||||||
import BellIcon from "@iconify-icons/ep/bell";
|
import BellIcon from "~icons/ep/bell";
|
||||||
|
|
||||||
const noticesNum = ref(0);
|
const noticesNum = ref(0);
|
||||||
const notices = ref(noticesData);
|
const notices = ref(noticesData);
|
||||||
|
@ -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 CloseIcon from "@iconify-icons/ep/close";
|
import CloseIcon from "~icons/ep/close";
|
||||||
|
|
||||||
const target = ref(null);
|
const target = ref(null);
|
||||||
const show = ref<Boolean>(false);
|
const show = ref<Boolean>(false);
|
||||||
@ -15,7 +15,7 @@ const iconClass = computed(() => {
|
|||||||
"flex",
|
"flex",
|
||||||
"justify-center",
|
"justify-center",
|
||||||
"items-center",
|
"items-center",
|
||||||
"outline-none",
|
"outline-hidden",
|
||||||
"rounded-[4px]",
|
"rounded-[4px]",
|
||||||
"cursor-pointer",
|
"cursor-pointer",
|
||||||
"transition-colors",
|
"transition-colors",
|
||||||
@ -49,7 +49,7 @@ onBeforeUnmount(() => {
|
|||||||
<div class="right-panel-background" />
|
<div class="right-panel-background" />
|
||||||
<div ref="target" class="right-panel bg-bg_color">
|
<div ref="target" class="right-panel bg-bg_color">
|
||||||
<div
|
<div
|
||||||
class="project-configuration border-b-[1px] border-solid border-[var(--pure-border-color)]"
|
class="project-configuration border-0 border-b-[1px] border-solid border-[var(--pure-border-color)]"
|
||||||
>
|
>
|
||||||
<h4 class="dark:text-white">系统配置</h4>
|
<h4 class="dark:text-white">系统配置</h4>
|
||||||
<span
|
<span
|
||||||
@ -74,7 +74,7 @@ onBeforeUnmount(() => {
|
|||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="flex justify-end p-3 border-t-[1px] border-solid border-[var(--pure-border-color)]"
|
class="flex justify-end p-3 border-0 border-t-[1px] border-solid border-[var(--pure-border-color)]"
|
||||||
>
|
>
|
||||||
<el-button
|
<el-button
|
||||||
v-tippy="{
|
v-tippy="{
|
||||||
@ -117,8 +117,8 @@ onBeforeUnmount(() => {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 280px;
|
max-width: 280px;
|
||||||
box-shadow: 0 0 15px 0 rgb(0 0 0 / 5%);
|
box-shadow: 0 0 15px 0 rgb(0 0 0 / 5%);
|
||||||
transition: all 0.25s cubic-bezier(0.7, 0.3, 0.1, 1);
|
|
||||||
transform: translate(100%);
|
transform: translate(100%);
|
||||||
|
transition: all 0.25s cubic-bezier(0.7, 0.3, 0.1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.show {
|
.show {
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
import { useNav } from "@/layout/hooks/useNav";
|
import { useNav } from "@/layout/hooks/useNav";
|
||||||
import MdiKeyboardEsc from "@/assets/svg/keyboard_esc.svg?component";
|
import MdiKeyboardEsc from "@/assets/svg/keyboard_esc.svg?component";
|
||||||
import EnterOutlined from "@/assets/svg/enter_outlined.svg?component";
|
import EnterOutlined from "@/assets/svg/enter_outlined.svg?component";
|
||||||
import ArrowUpLine from "@iconify-icons/ri/arrow-up-line";
|
import ArrowUpLine from "~icons/ri/arrow-up-line";
|
||||||
import ArrowDownLine from "@iconify-icons/ri/arrow-down-line";
|
import ArrowDownLine from "~icons/ri/arrow-down-line";
|
||||||
|
|
||||||
withDefaults(defineProps<{ total: number }>(), {
|
withDefaults(defineProps<{ total?: number }>(), {
|
||||||
total: 0
|
total: 0
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -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 StarIcon from "@iconify-icons/ep/star";
|
import StarIcon from "~icons/ep/star";
|
||||||
import CloseIcon from "@iconify-icons/ep/close";
|
import CloseIcon from "~icons/ep/close";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
item: optionsItem;
|
item: optionsItem;
|
||||||
|
@ -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 SearchIcon from "@iconify-icons/ri/search-line";
|
import SearchIcon from "~icons/ri/search-line";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
/** 弹窗显隐 */
|
/** 弹窗显隐 */
|
||||||
|
@ -14,7 +14,7 @@ function handleSearch() {
|
|||||||
class="search-container w-[40px] h-[48px] flex-c cursor-pointer navbar-bg-hover"
|
class="search-container w-[40px] h-[48px] flex-c cursor-pointer navbar-bg-hover"
|
||||||
@click="handleSearch"
|
@click="handleSearch"
|
||||||
>
|
>
|
||||||
<IconifyIconOffline icon="ri:search-line" />
|
<IconifyIconOffline icon="ri/search-line" />
|
||||||
</div>
|
</div>
|
||||||
<SearchModal v-model:value="show" />
|
<SearchModal v-model:value="show" />
|
||||||
</div>
|
</div>
|
||||||
|
@ -13,15 +13,14 @@ import { emitter } from "@/utils/mitt";
|
|||||||
import LayPanel from "../lay-panel/index.vue";
|
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 { useMultiTagsStoreHook } from "@/store/modules/multiTags";
|
import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
|
||||||
import Segmented, { type OptionsType } from "@/components/ReSegmented";
|
import Segmented, { type OptionsType } from "@/components/ReSegmented";
|
||||||
import { useDataThemeChange } from "@/layout/hooks/useDataThemeChange";
|
import { useDataThemeChange } from "@/layout/hooks/useDataThemeChange";
|
||||||
import { useDark, useGlobal, debounce, isNumber } from "@pureadmin/utils";
|
import { useDark, useGlobal, debounce, isNumber } from "@pureadmin/utils";
|
||||||
|
|
||||||
import Check from "@iconify-icons/ep/check";
|
import Check from "~icons/ep/check";
|
||||||
import LeftArrow from "@iconify-icons/ri/arrow-left-s-line";
|
import LeftArrow from "~icons/ri/arrow-left-s-line?width=20&height=20";
|
||||||
import RightArrow from "@iconify-icons/ri/arrow-right-s-line";
|
import RightArrow from "~icons/ri/arrow-right-s-line?width=20&height=20";
|
||||||
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";
|
||||||
@ -48,9 +47,7 @@ const {
|
|||||||
if (unref(layoutTheme)) {
|
if (unref(layoutTheme)) {
|
||||||
const layout = unref(layoutTheme).layout;
|
const layout = unref(layoutTheme).layout;
|
||||||
const theme = unref(layoutTheme).theme;
|
const theme = unref(layoutTheme).theme;
|
||||||
toggleTheme({
|
document.documentElement.setAttribute("data-theme", theme);
|
||||||
scopeName: `layout-theme-${theme}`
|
|
||||||
});
|
|
||||||
setLayoutModel(layout);
|
setLayoutModel(layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,7 +187,7 @@ const getThemeColor = computed(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const pClass = computed(() => {
|
const pClass = computed(() => {
|
||||||
return ["mb-[12px]", "font-medium", "text-sm", "dark:text-white"];
|
return ["mb-[12px]!", "font-medium", "text-sm", "dark:text-white"];
|
||||||
});
|
});
|
||||||
|
|
||||||
const themeOptions = computed<Array<OptionsType>>(() => {
|
const themeOptions = computed<Array<OptionsType>>(() => {
|
||||||
@ -230,6 +227,11 @@ const markOptions = computed<Array<OptionsType>>(() => {
|
|||||||
label: "卡片",
|
label: "卡片",
|
||||||
tip: "卡片标签,高效浏览",
|
tip: "卡片标签,高效浏览",
|
||||||
value: "card"
|
value: "card"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "谷歌",
|
||||||
|
tip: "谷歌风格,经典美观",
|
||||||
|
value: "chrome"
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
@ -331,7 +333,7 @@ onUnmounted(() => removeMatchMedia);
|
|||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<p :class="['mt-5', pClass]">主题色</p>
|
<p :class="['mt-5!', pClass]">主题色</p>
|
||||||
<ul class="theme-color">
|
<ul class="theme-color">
|
||||||
<li
|
<li
|
||||||
v-for="(item, index) in themeColors"
|
v-for="(item, index) in themeColors"
|
||||||
@ -350,7 +352,7 @@ onUnmounted(() => removeMatchMedia);
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<p :class="['mt-5', pClass]">导航模式</p>
|
<p :class="['mt-5!', pClass]">导航模式</p>
|
||||||
<ul class="pure-theme">
|
<ul class="pure-theme">
|
||||||
<li
|
<li
|
||||||
ref="verticalRef"
|
ref="verticalRef"
|
||||||
@ -393,7 +395,7 @@ onUnmounted(() => removeMatchMedia);
|
|||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<span v-if="useAppStoreHook().getViewportWidth > 1280">
|
<span v-if="useAppStoreHook().getViewportWidth > 1280">
|
||||||
<p :class="['mt-5', pClass]">页宽</p>
|
<p :class="['mt-5!', pClass]">页宽</p>
|
||||||
<Segmented
|
<Segmented
|
||||||
resize
|
resize
|
||||||
class="mb-2 select-none"
|
class="mb-2 select-none"
|
||||||
@ -422,30 +424,28 @@ onUnmounted(() => removeMatchMedia);
|
|||||||
>
|
>
|
||||||
<IconifyIconOffline
|
<IconifyIconOffline
|
||||||
:icon="settings.stretch ? RightArrow : LeftArrow"
|
:icon="settings.stretch ? RightArrow : LeftArrow"
|
||||||
height="20"
|
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
class="flex-grow border-b border-dashed"
|
class="grow border-0 border-b border-dashed"
|
||||||
style="border-color: var(--el-color-primary)"
|
style="border-color: var(--el-color-primary)"
|
||||||
/>
|
/>
|
||||||
<IconifyIconOffline
|
<IconifyIconOffline
|
||||||
:icon="settings.stretch ? LeftArrow : RightArrow"
|
:icon="settings.stretch ? LeftArrow : RightArrow"
|
||||||
height="20"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<p :class="['mt-4', pClass]">页签风格</p>
|
<p :class="['mt-4!', pClass]">页签风格</p>
|
||||||
<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"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<p class="mt-5 font-medium text-sm dark:text-white">界面显示</p>
|
<p class="mt-5! font-medium text-sm dark:text-white">界面显示</p>
|
||||||
<ul class="setting">
|
<ul class="setting">
|
||||||
<li>
|
<li>
|
||||||
<span class="dark:text-white">灰色模式</span>
|
<span class="dark:text-white">灰色模式</span>
|
||||||
|
@ -1,17 +1,24 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { isAllEmpty } from "@pureadmin/utils";
|
import { emitter } from "@/utils/mitt";
|
||||||
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 LaySearch from "../lay-search/index.vue";
|
||||||
import LayNotice from "../lay-notice/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 LaySidebarItem from "../lay-sidebar/components/SidebarItem.vue";
|
||||||
import LaySidebarFullScreen from "../lay-sidebar/components/SidebarFullScreen.vue";
|
import LaySidebarFullScreen from "../lay-sidebar/components/SidebarFullScreen.vue";
|
||||||
|
|
||||||
import LogoutCircleRLine from "@iconify-icons/ri/logout-circle-r-line";
|
import LogoutCircleRLine from "~icons/ri/logout-circle-r-line";
|
||||||
import Setting from "@iconify-icons/ri/settings-3-line";
|
import Setting from "~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,
|
||||||
@ -32,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>
|
||||||
@ -39,7 +52,7 @@ 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>
|
||||||
|
@ -10,8 +10,8 @@ import { usePermissionStoreHook } from "@/store/modules/permission";
|
|||||||
import LaySidebarExtraIcon from "../lay-sidebar/components/SidebarExtraIcon.vue";
|
import LaySidebarExtraIcon from "../lay-sidebar/components/SidebarExtraIcon.vue";
|
||||||
import LaySidebarFullScreen from "../lay-sidebar/components/SidebarFullScreen.vue";
|
import LaySidebarFullScreen from "../lay-sidebar/components/SidebarFullScreen.vue";
|
||||||
|
|
||||||
import LogoutCircleRLine from "@iconify-icons/ri/logout-circle-r-line";
|
import LogoutCircleRLine from "~icons/ri/logout-circle-r-line";
|
||||||
import Setting from "@iconify-icons/ri/settings-3-line";
|
import Setting from "~icons/ri/settings-3-line";
|
||||||
|
|
||||||
const menuRef = ref();
|
const menuRef = ref();
|
||||||
const defaultActive = ref(null);
|
const defaultActive = ref(null);
|
||||||
|
@ -104,12 +104,12 @@ watch(
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<el-breadcrumb class="!leading-[50px] select-none" separator="/">
|
<el-breadcrumb class="leading-[50px]! select-none" separator="/">
|
||||||
<transition-group name="breadcrumb">
|
<transition-group name="breadcrumb">
|
||||||
<el-breadcrumb-item
|
<el-breadcrumb-item
|
||||||
v-for="item in levelList"
|
v-for="item in levelList"
|
||||||
:key="item.path"
|
:key="item.path"
|
||||||
class="!inline !items-stretch"
|
class="inline! items-stretch!"
|
||||||
>
|
>
|
||||||
<a @click.prevent="handleLink(item)">
|
<a @click.prevent="handleLink(item)">
|
||||||
{{ item.meta.title }}
|
{{ item.meta.title }}
|
||||||
|
@ -3,10 +3,10 @@ import { computed } from "vue";
|
|||||||
import { useGlobal } from "@pureadmin/utils";
|
import { useGlobal } from "@pureadmin/utils";
|
||||||
import { useNav } from "@/layout/hooks/useNav";
|
import { useNav } from "@/layout/hooks/useNav";
|
||||||
|
|
||||||
import ArrowLeft from "@iconify-icons/ri/arrow-left-double-fill";
|
import ArrowLeft from "~icons/ri/arrow-left-double-fill";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
isActive: boolean;
|
isActive?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
withDefaults(defineProps<Props>(), {
|
withDefaults(defineProps<Props>(), {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import path from "path";
|
|
||||||
import { getConfig } from "@/config";
|
import { getConfig } from "@/config";
|
||||||
|
import { posix } from "path-browserify";
|
||||||
import { menuType } from "@/layout/types";
|
import { menuType } from "@/layout/types";
|
||||||
import { ReText } from "@/components/ReText";
|
import { ReText } from "@/components/ReText";
|
||||||
import { useNav } from "@/layout/hooks/useNav";
|
import { useNav } from "@/layout/hooks/useNav";
|
||||||
@ -16,10 +16,10 @@ import {
|
|||||||
useAttrs
|
useAttrs
|
||||||
} from "vue";
|
} from "vue";
|
||||||
|
|
||||||
import ArrowUp from "@iconify-icons/ep/arrow-up-bold";
|
import ArrowUp from "~icons/ep/arrow-up-bold";
|
||||||
import EpArrowDown from "@iconify-icons/ep/arrow-down-bold";
|
import EpArrowDown from "~icons/ep/arrow-down-bold";
|
||||||
import ArrowLeft from "@iconify-icons/ep/arrow-left-bold";
|
import ArrowLeft from "~icons/ep/arrow-left-bold";
|
||||||
import ArrowRight from "@iconify-icons/ep/arrow-right-bold";
|
import ArrowRight from "~icons/ep/arrow-right-bold";
|
||||||
|
|
||||||
const attrs = useAttrs();
|
const attrs = useAttrs();
|
||||||
const { layout, isCollapse, tooltipEffect, getDivStyle } = useNav();
|
const { layout, isCollapse, tooltipEffect, getDivStyle } = useNav();
|
||||||
@ -60,6 +60,21 @@ const getSubMenuIconStyle = computed((): CSSProperties => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const textClass = computed(() => {
|
||||||
|
const item = props.item;
|
||||||
|
const baseClass = "w-full! text-inherit!";
|
||||||
|
if (
|
||||||
|
layout.value !== "horizontal" &&
|
||||||
|
isCollapse.value &&
|
||||||
|
!toRaw(item.meta.icon) &&
|
||||||
|
((layout.value === "vertical" && item.parentId === null) ||
|
||||||
|
(layout.value === "mix" && item.pathList.length === 2))
|
||||||
|
) {
|
||||||
|
return `${baseClass} min-w-[54px]! text-center! px-3!`;
|
||||||
|
}
|
||||||
|
return baseClass;
|
||||||
|
});
|
||||||
|
|
||||||
const expandCloseIcon = computed(() => {
|
const expandCloseIcon = computed(() => {
|
||||||
if (!getConfig()?.MenuArrowIconNoTransition) return "";
|
if (!getConfig()?.MenuArrowIconNoTransition) return "";
|
||||||
return {
|
return {
|
||||||
@ -98,8 +113,7 @@ function resolvePath(routePath) {
|
|||||||
if (httpReg.test(routePath) || httpReg.test(props.basePath)) {
|
if (httpReg.test(routePath) || httpReg.test(props.basePath)) {
|
||||||
return routePath || props.basePath;
|
return routePath || props.basePath;
|
||||||
} else {
|
} else {
|
||||||
// 使用path.posix.resolve替代path.resolve 避免windows环境下使用electron出现盘符问题
|
return posix.resolve(props.basePath, routePath);
|
||||||
return path.posix.resolve(props.basePath, routePath);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@ -144,7 +158,7 @@ function resolvePath(routePath) {
|
|||||||
item?.pathList?.length === 2)
|
item?.pathList?.length === 2)
|
||||||
"
|
"
|
||||||
truncated
|
truncated
|
||||||
class="!w-full !px-4 !text-inherit"
|
class="w-full! px-3! min-w-[54px]! text-center! text-inherit!"
|
||||||
>
|
>
|
||||||
{{ onlyOneChild.meta.title }}
|
{{ onlyOneChild.meta.title }}
|
||||||
</el-text>
|
</el-text>
|
||||||
@ -156,7 +170,7 @@ function resolvePath(routePath) {
|
|||||||
offset: [0, -10],
|
offset: [0, -10],
|
||||||
theme: tooltipEffect
|
theme: tooltipEffect
|
||||||
}"
|
}"
|
||||||
class="!w-full !text-inherit"
|
class="w-full! text-inherit!"
|
||||||
>
|
>
|
||||||
{{ onlyOneChild.meta.title }}
|
{{ onlyOneChild.meta.title }}
|
||||||
</ReText>
|
</ReText>
|
||||||
@ -195,15 +209,7 @@ function resolvePath(routePath) {
|
|||||||
offset: [0, -10],
|
offset: [0, -10],
|
||||||
theme: tooltipEffect
|
theme: tooltipEffect
|
||||||
}"
|
}"
|
||||||
:class="{
|
:class="textClass"
|
||||||
'!w-full': true,
|
|
||||||
'!text-inherit': true,
|
|
||||||
'!px-4':
|
|
||||||
layout !== 'horizontal' &&
|
|
||||||
isCollapse &&
|
|
||||||
!toRaw(item.meta.icon) &&
|
|
||||||
item.parentId === null
|
|
||||||
}"
|
|
||||||
>
|
>
|
||||||
{{ item.meta.title }}
|
{{ item.meta.title }}
|
||||||
</ReText>
|
</ReText>
|
||||||
|
@ -3,10 +3,10 @@ import { computed } from "vue";
|
|||||||
import { useGlobal } from "@pureadmin/utils";
|
import { useGlobal } from "@pureadmin/utils";
|
||||||
import { useNav } from "@/layout/hooks/useNav";
|
import { useNav } from "@/layout/hooks/useNav";
|
||||||
|
|
||||||
import MenuFold from "@iconify-icons/ri/menu-fold-fill";
|
import MenuFold from "~icons/ri/menu-fold-fill";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
isActive: boolean;
|
isActive?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
withDefaults(defineProps<Props>(), {
|
withDefaults(defineProps<Props>(), {
|
||||||
@ -21,7 +21,7 @@ const iconClass = computed(() => {
|
|||||||
"mb-1",
|
"mb-1",
|
||||||
"w-[16px]",
|
"w-[16px]",
|
||||||
"h-[16px]",
|
"h-[16px]",
|
||||||
"inline-block",
|
"inline-block!",
|
||||||
"align-middle",
|
"align-middle",
|
||||||
"cursor-pointer",
|
"cursor-pointer",
|
||||||
"duration-[100ms]"
|
"duration-[100ms]"
|
||||||
|
@ -60,11 +60,11 @@ const { title, getLogo } = useNav();
|
|||||||
height: 32px;
|
height: 32px;
|
||||||
margin: 2px 0 0 12px;
|
margin: 2px 0 0 12px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
line-height: 32px;
|
line-height: 32px;
|
||||||
color: $subMenuActiveText;
|
color: var(--pure-theme-sub-menu-active-text);
|
||||||
text-overflow: ellipsis;
|
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import MenuFold from "@iconify-icons/ri/menu-fold-fill";
|
import MenuFold from "~icons/ri/menu-fold-fill";
|
||||||
import MenuUnfold from "@iconify-icons/ri/menu-unfold-fill";
|
import MenuUnfold from "~icons/ri/menu-unfold-fill";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
isActive: boolean;
|
isActive?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
withDefaults(defineProps<Props>(), {
|
withDefaults(defineProps<Props>(), {
|
||||||
@ -27,7 +27,7 @@ const toggleClick = () => {
|
|||||||
>
|
>
|
||||||
<IconifyIconOffline
|
<IconifyIconOffline
|
||||||
:icon="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>
|
||||||
</template>
|
</template>
|
||||||
|
33
src/layout/components/lay-tag/components/TagChrome.vue
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<template>
|
||||||
|
<svg class="w-full h-full">
|
||||||
|
<defs>
|
||||||
|
<symbol id="geometry-left" viewBox="0 0 214 36">
|
||||||
|
<path d="M17 0h197v36H0v-2c4.5 0 9-3.5 9-8V8c0-4.5 3.5-8 8-8z" />
|
||||||
|
</symbol>
|
||||||
|
<symbol id="geometry-right" viewBox="0 0 214 36">
|
||||||
|
<use xlink:href="#geometry-left" />
|
||||||
|
</symbol>
|
||||||
|
<clipPath>
|
||||||
|
<rect width="100%" height="100%" x="0" />
|
||||||
|
</clipPath>
|
||||||
|
</defs>
|
||||||
|
<svg width="51%" height="100%">
|
||||||
|
<use
|
||||||
|
xlink:href="#geometry-left"
|
||||||
|
width="214"
|
||||||
|
height="36"
|
||||||
|
fill="currentColor"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
<g transform="scale(-1, 1)">
|
||||||
|
<svg width="51%" height="100%" x="-100%" y="0">
|
||||||
|
<use
|
||||||
|
xlink:href="#geometry-right"
|
||||||
|
width="214"
|
||||||
|
height="36"
|
||||||
|
fill="currentColor"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
</template>
|
@ -41,6 +41,13 @@
|
|||||||
padding-right: 24px;
|
padding-right: 24px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.chrome-item {
|
||||||
|
padding-right: 0;
|
||||||
|
padding-left: 0;
|
||||||
|
margin-right: -18px;
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
|
||||||
.el-icon-close {
|
.el-icon-close {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
@ -52,10 +59,10 @@
|
|||||||
color: var(--el-color-primary);
|
color: var(--el-color-primary);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
|
transform: translate(0, -50%);
|
||||||
transition:
|
transition:
|
||||||
background-color 0.12s,
|
background-color 0.12s,
|
||||||
color 0.12s;
|
color 0.12s;
|
||||||
transform: translate(0, -50%);
|
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
color: rgb(0 0 0 / 88%) !important;
|
color: rgb(0 0 0 / 88%) !important;
|
||||||
@ -76,6 +83,14 @@
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
|
||||||
|
&.chrome-scroll-container {
|
||||||
|
padding-top: 4px;
|
||||||
|
|
||||||
|
.fixed-tag {
|
||||||
|
padding: 0 !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.tab {
|
.tab {
|
||||||
position: relative;
|
position: relative;
|
||||||
float: left;
|
float: left;
|
||||||
@ -89,6 +104,12 @@
|
|||||||
&:nth-child(1) {
|
&:nth-child(1) {
|
||||||
padding: 0 12px;
|
padding: 0 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.chrome-item {
|
||||||
|
&:nth-child(1) {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.fixed-tag {
|
.fixed-tag {
|
||||||
@ -106,10 +127,10 @@
|
|||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
color: var(--el-text-color-primary);
|
color: var(--el-text-color-primary);
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
outline: 0;
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
outline: 0;
|
|
||||||
box-shadow: 0 2px 8px rgb(0 0 0 / 15%);
|
box-shadow: 0 2px 8px rgb(0 0 0 / 15%);
|
||||||
|
|
||||||
li {
|
li {
|
||||||
@ -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";
|
||||||
@ -16,11 +17,11 @@ import {
|
|||||||
useResizeObserver
|
useResizeObserver
|
||||||
} from "@pureadmin/utils";
|
} from "@pureadmin/utils";
|
||||||
|
|
||||||
import ExitFullscreen from "@iconify-icons/ri/fullscreen-exit-fill";
|
import ExitFullscreen from "~icons/ri/fullscreen-exit-fill";
|
||||||
import Fullscreen from "@iconify-icons/ri/fullscreen-fill";
|
import Fullscreen from "~icons/ri/fullscreen-fill";
|
||||||
import ArrowDown from "@iconify-icons/ri/arrow-down-s-line";
|
import ArrowDown from "~icons/ri/arrow-down-s-line";
|
||||||
import ArrowRightSLine from "@iconify-icons/ri/arrow-right-s-line";
|
import ArrowRightSLine from "~icons/ri/arrow-right-s-line";
|
||||||
import ArrowLeftSLine from "@iconify-icons/ri/arrow-left-s-line";
|
import ArrowLeftSLine from "~icons/ri/arrow-left-s-line";
|
||||||
|
|
||||||
const {
|
const {
|
||||||
Close,
|
Close,
|
||||||
@ -35,6 +36,7 @@ const {
|
|||||||
buttonLeft,
|
buttonLeft,
|
||||||
showModel,
|
showModel,
|
||||||
translateX,
|
translateX,
|
||||||
|
isFixedTag,
|
||||||
pureSetting,
|
pureSetting,
|
||||||
activeIndex,
|
activeIndex,
|
||||||
getTabStyle,
|
getTabStyle,
|
||||||
@ -507,6 +509,7 @@ function tagOnClick(item) {
|
|||||||
} else {
|
} else {
|
||||||
router.push({ path });
|
router.push({ path });
|
||||||
}
|
}
|
||||||
|
emitter.emit("tagOnClick", item);
|
||||||
}
|
}
|
||||||
|
|
||||||
onClickOutside(contextmenuRef, closeMenu, {
|
onClickOutside(contextmenuRef, closeMenu, {
|
||||||
@ -563,6 +566,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,24 +577,26 @@ 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)"
|
||||||
>
|
>
|
||||||
|
<template v-if="showModel !== 'chrome'">
|
||||||
<span
|
<span
|
||||||
class="tag-title dark:!text-text_color_primary dark:hover:!text-primary"
|
class="tag-title dark:text-text_color_primary! dark:hover:text-primary!"
|
||||||
>
|
>
|
||||||
{{ item.meta.title }}
|
{{ item.meta.title }}
|
||||||
</span>
|
</span>
|
||||||
<span
|
<span
|
||||||
v-if="
|
v-if="
|
||||||
isAllEmpty(item?.meta?.fixedTag)
|
isFixedTag(item)
|
||||||
? iconIsActive(item, index) ||
|
? false
|
||||||
|
: iconIsActive(item, index) ||
|
||||||
(index === activeIndex && index !== 0)
|
(index === activeIndex && index !== 0)
|
||||||
: false
|
|
||||||
"
|
"
|
||||||
class="el-icon-close"
|
class="el-icon-close"
|
||||||
@click.stop="deleteMenu(item)"
|
@click.stop="deleteMenu(item)"
|
||||||
@ -602,6 +608,23 @@ onBeforeUnmount(() => {
|
|||||||
:ref="'schedule' + index"
|
:ref="'schedule' + index"
|
||||||
:class="[scheduleIsActive(item)]"
|
: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>
|
||||||
|
@ -6,14 +6,9 @@ import { routerArrays } from "@/layout/types";
|
|||||||
import { router, resetRouter } from "@/router";
|
import { router, resetRouter } from "@/router";
|
||||||
import type { themeColorsType } from "../types";
|
import type { themeColorsType } from "../types";
|
||||||
import { useAppStoreHook } from "@/store/modules/app";
|
import { useAppStoreHook } from "@/store/modules/app";
|
||||||
import { useGlobal, storageLocal } from "@pureadmin/utils";
|
|
||||||
import { useEpThemeStoreHook } from "@/store/modules/epTheme";
|
import { useEpThemeStoreHook } from "@/store/modules/epTheme";
|
||||||
import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
|
import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
|
||||||
import {
|
import { darken, lighten, useGlobal, storageLocal } from "@pureadmin/utils";
|
||||||
darken,
|
|
||||||
lighten,
|
|
||||||
toggleTheme
|
|
||||||
} from "@pureadmin/theme/dist/browser-utils";
|
|
||||||
|
|
||||||
export function useDataThemeChange() {
|
export function useDataThemeChange() {
|
||||||
const { layoutTheme, layout } = useLayout();
|
const { layoutTheme, layout } = useLayout();
|
||||||
@ -54,9 +49,7 @@ export function useDataThemeChange() {
|
|||||||
isClick = true
|
isClick = true
|
||||||
) {
|
) {
|
||||||
layoutTheme.value.theme = theme;
|
layoutTheme.value.theme = theme;
|
||||||
toggleTheme({
|
document.documentElement.setAttribute("data-theme", theme);
|
||||||
scopeName: `layout-theme-${theme}`
|
|
||||||
});
|
|
||||||
// 如果非isClick,保留之前的themeColor
|
// 如果非isClick,保留之前的themeColor
|
||||||
const storageThemeColor = $storage.layout.themeColor;
|
const storageThemeColor = $storage.layout.themeColor;
|
||||||
$storage.layout = {
|
$storage.layout = {
|
||||||
|
@ -12,8 +12,8 @@ import { useAppStoreHook } from "@/store/modules/app";
|
|||||||
import { useUserStoreHook } from "@/store/modules/user";
|
import { useUserStoreHook } from "@/store/modules/user";
|
||||||
import { useGlobal, isAllEmpty } from "@pureadmin/utils";
|
import { useGlobal, isAllEmpty } from "@pureadmin/utils";
|
||||||
import { usePermissionStoreHook } from "@/store/modules/permission";
|
import { usePermissionStoreHook } from "@/store/modules/permission";
|
||||||
import ExitFullscreen from "@iconify-icons/ri/fullscreen-exit-fill";
|
import ExitFullscreen from "~icons/ri/fullscreen-exit-fill";
|
||||||
import Fullscreen from "@iconify-icons/ri/fullscreen-fill";
|
import Fullscreen from "~icons/ri/fullscreen-fill";
|
||||||
|
|
||||||
const errorInfo =
|
const errorInfo =
|
||||||
"The current routing configuration is incorrect, please check the configuration";
|
"The current routing configuration is incorrect, please check the configuration";
|
||||||
|
@ -20,13 +20,13 @@ import {
|
|||||||
hasClass
|
hasClass
|
||||||
} from "@pureadmin/utils";
|
} from "@pureadmin/utils";
|
||||||
|
|
||||||
import Fullscreen from "@iconify-icons/ri/fullscreen-fill";
|
import Fullscreen from "~icons/ri/fullscreen-fill";
|
||||||
import CloseAllTags from "@iconify-icons/ri/subtract-line";
|
import CloseAllTags from "~icons/ri/subtract-line";
|
||||||
import CloseOtherTags from "@iconify-icons/ri/text-spacing";
|
import CloseOtherTags from "~icons/ri/text-spacing";
|
||||||
import CloseRightTags from "@iconify-icons/ri/text-direction-l";
|
import CloseRightTags from "~icons/ri/text-direction-l";
|
||||||
import CloseLeftTags from "@iconify-icons/ri/text-direction-r";
|
import CloseLeftTags from "~icons/ri/text-direction-r";
|
||||||
import RefreshRight from "@iconify-icons/ep/refresh-right";
|
import RefreshRight from "~icons/ep/refresh-right";
|
||||||
import Close from "@iconify-icons/ep/close";
|
import Close from "~icons/ep/close";
|
||||||
|
|
||||||
export function useTags() {
|
export function useTags() {
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
@ -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,
|
||||||
|
@ -208,8 +208,8 @@ const LayHeader = defineComponent({
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
|
|
||||||
&::after {
|
&::after {
|
||||||
display: table;
|
|
||||||
clear: both;
|
clear: both;
|
||||||
|
display: table;
|
||||||
content: "";
|
content: "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,7 +222,7 @@ const LayHeader = 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;
|
||||||
|
@ -1,129 +0,0 @@
|
|||||||
/**
|
|
||||||
* @description ⚠️:此文件仅供主题插件使用,请不要在此文件中导出别的工具函数(仅在页面加载前运行)
|
|
||||||
*/
|
|
||||||
|
|
||||||
import type { multipleScopeVarsOptions } from "@pureadmin/theme";
|
|
||||||
|
|
||||||
/** 预设主题色 */
|
|
||||||
const themeColors = {
|
|
||||||
/* 亮白色 */
|
|
||||||
light: {
|
|
||||||
subMenuActiveText: "#000000d9",
|
|
||||||
menuBg: "#fff",
|
|
||||||
menuHover: "#f6f6f6",
|
|
||||||
subMenuBg: "#fff",
|
|
||||||
subMenuActiveBg: "#e0ebf6",
|
|
||||||
menuText: "rgb(0 0 0 / 60%)",
|
|
||||||
sidebarLogo: "#fff",
|
|
||||||
menuTitleHover: "#000",
|
|
||||||
menuActiveBefore: "#4091f7"
|
|
||||||
},
|
|
||||||
/* 道奇蓝 */
|
|
||||||
default: {
|
|
||||||
subMenuActiveText: "#fff",
|
|
||||||
menuBg: "#001529",
|
|
||||||
menuHover: "rgb(64 145 247 / 15%)",
|
|
||||||
subMenuBg: "#0f0303",
|
|
||||||
subMenuActiveBg: "#4091f7",
|
|
||||||
menuText: "rgb(254 254 254 / 65%)",
|
|
||||||
sidebarLogo: "#002140",
|
|
||||||
menuTitleHover: "#fff",
|
|
||||||
menuActiveBefore: "#4091f7"
|
|
||||||
},
|
|
||||||
/* 深紫罗兰色 */
|
|
||||||
saucePurple: {
|
|
||||||
subMenuActiveText: "#fff",
|
|
||||||
menuBg: "#130824",
|
|
||||||
menuHover: "rgb(105 58 201 / 15%)",
|
|
||||||
subMenuBg: "#000",
|
|
||||||
subMenuActiveBg: "#693ac9",
|
|
||||||
menuText: "#7a80b4",
|
|
||||||
sidebarLogo: "#1f0c38",
|
|
||||||
menuTitleHover: "#fff",
|
|
||||||
menuActiveBefore: "#693ac9"
|
|
||||||
},
|
|
||||||
/* 深粉色 */
|
|
||||||
pink: {
|
|
||||||
subMenuActiveText: "#fff",
|
|
||||||
menuBg: "#28081a",
|
|
||||||
menuHover: "rgb(216 68 147 / 15%)",
|
|
||||||
subMenuBg: "#000",
|
|
||||||
subMenuActiveBg: "#d84493",
|
|
||||||
menuText: "#7a80b4",
|
|
||||||
sidebarLogo: "#3f0d29",
|
|
||||||
menuTitleHover: "#fff",
|
|
||||||
menuActiveBefore: "#d84493"
|
|
||||||
},
|
|
||||||
/* 猩红色 */
|
|
||||||
dusk: {
|
|
||||||
subMenuActiveText: "#fff",
|
|
||||||
menuBg: "#2a0608",
|
|
||||||
menuHover: "rgb(225 60 57 / 15%)",
|
|
||||||
subMenuBg: "#000",
|
|
||||||
subMenuActiveBg: "#e13c39",
|
|
||||||
menuText: "rgb(254 254 254 / 65.1%)",
|
|
||||||
sidebarLogo: "#42090c",
|
|
||||||
menuTitleHover: "#fff",
|
|
||||||
menuActiveBefore: "#e13c39"
|
|
||||||
},
|
|
||||||
/* 橙红色 */
|
|
||||||
volcano: {
|
|
||||||
subMenuActiveText: "#fff",
|
|
||||||
menuBg: "#2b0e05",
|
|
||||||
menuHover: "rgb(232 95 51 / 15%)",
|
|
||||||
subMenuBg: "#0f0603",
|
|
||||||
subMenuActiveBg: "#e85f33",
|
|
||||||
menuText: "rgb(254 254 254 / 65%)",
|
|
||||||
sidebarLogo: "#441708",
|
|
||||||
menuTitleHover: "#fff",
|
|
||||||
menuActiveBefore: "#e85f33"
|
|
||||||
},
|
|
||||||
/* 绿宝石 */
|
|
||||||
mingQing: {
|
|
||||||
subMenuActiveText: "#fff",
|
|
||||||
menuBg: "#032121",
|
|
||||||
menuHover: "rgb(89 191 193 / 15%)",
|
|
||||||
subMenuBg: "#000",
|
|
||||||
subMenuActiveBg: "#59bfc1",
|
|
||||||
menuText: "#7a80b4",
|
|
||||||
sidebarLogo: "#053434",
|
|
||||||
menuTitleHover: "#fff",
|
|
||||||
menuActiveBefore: "#59bfc1"
|
|
||||||
},
|
|
||||||
/* 酸橙绿 */
|
|
||||||
auroraGreen: {
|
|
||||||
subMenuActiveText: "#fff",
|
|
||||||
menuBg: "#0b1e15",
|
|
||||||
menuHover: "rgb(96 172 128 / 15%)",
|
|
||||||
subMenuBg: "#000",
|
|
||||||
subMenuActiveBg: "#60ac80",
|
|
||||||
menuText: "#7a80b4",
|
|
||||||
sidebarLogo: "#112f21",
|
|
||||||
menuTitleHover: "#fff",
|
|
||||||
menuActiveBefore: "#60ac80"
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 将预设主题色处理成主题插件所需格式
|
|
||||||
*/
|
|
||||||
export const genScssMultipleScopeVars = (): multipleScopeVarsOptions[] => {
|
|
||||||
const result = [] as multipleScopeVarsOptions[];
|
|
||||||
Object.keys(themeColors).forEach(key => {
|
|
||||||
result.push({
|
|
||||||
scopeName: `layout-theme-${key}`,
|
|
||||||
varsContent: `
|
|
||||||
$subMenuActiveText: ${themeColors[key].subMenuActiveText} !default;
|
|
||||||
$menuBg: ${themeColors[key].menuBg} !default;
|
|
||||||
$menuHover: ${themeColors[key].menuHover} !default;
|
|
||||||
$subMenuBg: ${themeColors[key].subMenuBg} !default;
|
|
||||||
$subMenuActiveBg: ${themeColors[key].subMenuActiveBg} !default;
|
|
||||||
$menuText: ${themeColors[key].menuText} !default;
|
|
||||||
$sidebarLogo: ${themeColors[key].sidebarLogo} !default;
|
|
||||||
$menuTitleHover: ${themeColors[key].menuTitleHover} !default;
|
|
||||||
$menuActiveBefore: ${themeColors[key].menuActiveBefore} !default;
|
|
||||||
`
|
|
||||||
} as multipleScopeVarsOptions);
|
|
||||||
});
|
|
||||||
return result;
|
|
||||||
};
|
|
@ -1,4 +1,4 @@
|
|||||||
import type { IconifyIcon } from "@iconify/vue";
|
import type { FunctionalComponent } from "vue";
|
||||||
const { VITE_HIDE_HOME } = import.meta.env;
|
const { VITE_HIDE_HOME } = import.meta.env;
|
||||||
|
|
||||||
export const routerArrays: Array<RouteConfigs> =
|
export const routerArrays: Array<RouteConfigs> =
|
||||||
@ -8,7 +8,7 @@ export const routerArrays: Array<RouteConfigs> =
|
|||||||
path: "/welcome",
|
path: "/welcome",
|
||||||
meta: {
|
meta: {
|
||||||
title: "首页",
|
title: "首页",
|
||||||
icon: "ep:home-filled"
|
icon: "ep/home-filled"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -16,7 +16,7 @@ export const routerArrays: Array<RouteConfigs> =
|
|||||||
|
|
||||||
export type routeMetaType = {
|
export type routeMetaType = {
|
||||||
title?: string;
|
title?: string;
|
||||||
icon?: string | IconifyIcon;
|
icon?: string | FunctionalComponent;
|
||||||
showLink?: boolean;
|
showLink?: boolean;
|
||||||
savedPosition?: boolean;
|
savedPosition?: boolean;
|
||||||
auths?: Array<string>;
|
auths?: Array<string>;
|
||||||
@ -36,7 +36,7 @@ export type multiTagsType = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export type tagsViewsType = {
|
export type tagsViewsType = {
|
||||||
icon: string | IconifyIcon;
|
icon: string | FunctionalComponent;
|
||||||
text: string;
|
text: string;
|
||||||
divided: boolean;
|
divided: boolean;
|
||||||
disabled: boolean;
|
disabled: boolean;
|
||||||
|
@ -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 = [
|
||||||
|
@ -6,7 +6,13 @@ import { buildHierarchyTree } from "@/utils/tree";
|
|||||||
import remainingRouter from "./modules/remaining";
|
import remainingRouter from "./modules/remaining";
|
||||||
import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
|
import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
|
||||||
import { usePermissionStoreHook } from "@/store/modules/permission";
|
import { usePermissionStoreHook } from "@/store/modules/permission";
|
||||||
import { isUrl, openLink, storageLocal, isAllEmpty } from "@pureadmin/utils";
|
import {
|
||||||
|
isUrl,
|
||||||
|
openLink,
|
||||||
|
cloneDeep,
|
||||||
|
isAllEmpty,
|
||||||
|
storageLocal
|
||||||
|
} from "@pureadmin/utils";
|
||||||
import {
|
import {
|
||||||
ascending,
|
ascending,
|
||||||
getTopMenu,
|
getTopMenu,
|
||||||
@ -20,9 +26,9 @@ import {
|
|||||||
} from "./utils";
|
} from "./utils";
|
||||||
import {
|
import {
|
||||||
type Router,
|
type Router,
|
||||||
createRouter,
|
|
||||||
type RouteRecordRaw,
|
type RouteRecordRaw,
|
||||||
type RouteComponent
|
type RouteComponent,
|
||||||
|
createRouter
|
||||||
} from "vue-router";
|
} from "vue-router";
|
||||||
import {
|
import {
|
||||||
type DataInfo,
|
type DataInfo,
|
||||||
@ -54,6 +60,9 @@ export const constantRoutes: Array<RouteRecordRaw> = formatTwoStageRoutes(
|
|||||||
formatFlatteningRoutes(buildHierarchyTree(ascending(routes.flat(Infinity))))
|
formatFlatteningRoutes(buildHierarchyTree(ascending(routes.flat(Infinity))))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/** 初始的静态路由,用于退出登录时重置路由 */
|
||||||
|
const initConstantRoutes: Array<RouteRecordRaw> = cloneDeep(constantRoutes);
|
||||||
|
|
||||||
/** 用于渲染菜单,保持原始层级 */
|
/** 用于渲染菜单,保持原始层级 */
|
||||||
export const constantMenus: Array<RouteComponent> = ascending(
|
export const constantMenus: Array<RouteComponent> = ascending(
|
||||||
routes.flat(Infinity)
|
routes.flat(Infinity)
|
||||||
@ -86,17 +95,13 @@ export const router: Router = createRouter({
|
|||||||
|
|
||||||
/** 重置路由 */
|
/** 重置路由 */
|
||||||
export function resetRouter() {
|
export function resetRouter() {
|
||||||
router.getRoutes().forEach(route => {
|
router.clearRoutes();
|
||||||
const { name, meta } = route;
|
for (const route of initConstantRoutes.concat(...(remainingRouter as any))) {
|
||||||
if (name && router.hasRoute(name) && meta?.backstage) {
|
router.addRoute(route);
|
||||||
router.removeRoute(name);
|
|
||||||
router.options.routes = formatTwoStageRoutes(
|
|
||||||
formatFlatteningRoutes(
|
|
||||||
buildHierarchyTree(ascending(routes.flat(Infinity)))
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
});
|
router.options.routes = formatTwoStageRoutes(
|
||||||
|
formatFlatteningRoutes(buildHierarchyTree(ascending(routes.flat(Infinity))))
|
||||||
|
);
|
||||||
usePermissionStoreHook().clearAllCachePage();
|
usePermissionStoreHook().clearAllCachePage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ export default {
|
|||||||
path: "/error",
|
path: "/error",
|
||||||
redirect: "/error/403",
|
redirect: "/error/403",
|
||||||
meta: {
|
meta: {
|
||||||
icon: "ri:information-line",
|
icon: "ri/information-line",
|
||||||
// showLink: false,
|
// showLink: false,
|
||||||
title: "异常页面",
|
title: "异常页面",
|
||||||
rank: 9
|
rank: 9
|
||||||
|
@ -7,7 +7,7 @@ export default {
|
|||||||
component: Layout,
|
component: Layout,
|
||||||
redirect: "/welcome",
|
redirect: "/welcome",
|
||||||
meta: {
|
meta: {
|
||||||
icon: "ep:home-filled",
|
icon: "ep/home-filled",
|
||||||
title: "首页",
|
title: "首页",
|
||||||
rank: 0
|
rank: 0
|
||||||
},
|
},
|
||||||
|
@ -172,6 +172,8 @@ function handleAsyncRoutes(routeList) {
|
|||||||
const flattenRouters: any = router
|
const flattenRouters: any = router
|
||||||
.getRoutes()
|
.getRoutes()
|
||||||
.find(n => n.path === "/");
|
.find(n => n.path === "/");
|
||||||
|
// 保持router.options.routes[0].children与path为"/"的children一致,防止数据不一致导致异常
|
||||||
|
flattenRouters.children = router.options.routes[0].children;
|
||||||
router.addRoute(flattenRouters);
|
router.addRoute(flattenRouters);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -355,7 +357,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`值 */
|
||||||
|
@ -8,8 +8,7 @@ import {
|
|||||||
responsiveStorageNameSpace
|
responsiveStorageNameSpace
|
||||||
} from "../utils";
|
} from "../utils";
|
||||||
|
|
||||||
export const useAppStore = defineStore({
|
export const useAppStore = defineStore("pure-app", {
|
||||||
id: "pure-app",
|
|
||||||
state: (): appType => ({
|
state: (): appType => ({
|
||||||
sidebar: {
|
sidebar: {
|
||||||
opened:
|
opened:
|
||||||
@ -77,9 +76,6 @@ export const useAppStore = defineStore({
|
|||||||
},
|
},
|
||||||
setViewportSize(size) {
|
setViewportSize(size) {
|
||||||
this.viewportSize = size;
|
this.viewportSize = size;
|
||||||
},
|
|
||||||
setSortSwap(val) {
|
|
||||||
this.sortSwap = val;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -6,8 +6,7 @@ import {
|
|||||||
responsiveStorageNameSpace
|
responsiveStorageNameSpace
|
||||||
} from "../utils";
|
} from "../utils";
|
||||||
|
|
||||||
export const useEpThemeStore = defineStore({
|
export const useEpThemeStore = defineStore("pure-epTheme", {
|
||||||
id: "pure-epTheme",
|
|
||||||
state: () => ({
|
state: () => ({
|
||||||
epThemeColor:
|
epThemeColor:
|
||||||
storageLocal().getItem<StorageConfigs>(
|
storageLocal().getItem<StorageConfigs>(
|
||||||
|
@ -14,8 +14,7 @@ import {
|
|||||||
} from "../utils";
|
} from "../utils";
|
||||||
import { usePermissionStoreHook } from "./permission";
|
import { usePermissionStoreHook } from "./permission";
|
||||||
|
|
||||||
export const useMultiTagsStore = defineStore({
|
export const useMultiTagsStore = defineStore("pure-multiTags", {
|
||||||
id: "pure-multiTags",
|
|
||||||
state: () => ({
|
state: () => ({
|
||||||
// 存储标签页信息(路由信息)
|
// 存储标签页信息(路由信息)
|
||||||
multiTags: storageLocal().getItem<StorageConfigs>(
|
multiTags: storageLocal().getItem<StorageConfigs>(
|
||||||
@ -24,12 +23,12 @@ export const useMultiTagsStore = defineStore({
|
|||||||
? storageLocal().getItem<StorageConfigs>(
|
? storageLocal().getItem<StorageConfigs>(
|
||||||
`${responsiveStorageNameSpace()}tags`
|
`${responsiveStorageNameSpace()}tags`
|
||||||
)
|
)
|
||||||
: [
|
: ([
|
||||||
...routerArrays,
|
...routerArrays,
|
||||||
...usePermissionStoreHook().flatteningRoutes.filter(
|
...usePermissionStoreHook().flatteningRoutes.filter(
|
||||||
v => v?.meta?.fixedTag
|
v => v?.meta?.fixedTag
|
||||||
)
|
)
|
||||||
],
|
] as any),
|
||||||
multiTagsCache: storageLocal().getItem<StorageConfigs>(
|
multiTagsCache: storageLocal().getItem<StorageConfigs>(
|
||||||
`${responsiveStorageNameSpace()}configure`
|
`${responsiveStorageNameSpace()}configure`
|
||||||
)?.multiTagsCache
|
)?.multiTagsCache
|
||||||
|
@ -12,8 +12,7 @@ import {
|
|||||||
} from "../utils";
|
} from "../utils";
|
||||||
import { useMultiTagsStoreHook } from "./multiTags";
|
import { useMultiTagsStoreHook } from "./multiTags";
|
||||||
|
|
||||||
export const usePermissionStore = defineStore({
|
export const usePermissionStore = defineStore("pure-permission", {
|
||||||
id: "pure-permission",
|
|
||||||
state: () => ({
|
state: () => ({
|
||||||
// 静态路由生成的菜单
|
// 静态路由生成的菜单
|
||||||
constantMenus,
|
constantMenus,
|
||||||
@ -31,7 +30,7 @@ export const usePermissionStore = defineStore({
|
|||||||
filterTree(ascending(this.constantMenus.concat(routes)))
|
filterTree(ascending(this.constantMenus.concat(routes)))
|
||||||
);
|
);
|
||||||
this.flatteningRoutes = formatFlatteningRoutes(
|
this.flatteningRoutes = formatFlatteningRoutes(
|
||||||
this.constantMenus.concat(routes)
|
this.constantMenus.concat(routes) as any
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
cacheOperate({ mode, name }: cacheType) {
|
cacheOperate({ mode, name }: cacheType) {
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
import { type setType, store, getConfig } from "../utils";
|
import { type setType, store, getConfig } from "../utils";
|
||||||
|
|
||||||
export const useSettingStore = defineStore({
|
export const useSettingStore = defineStore("pure-setting", {
|
||||||
id: "pure-setting",
|
|
||||||
state: (): setType => ({
|
state: (): setType => ({
|
||||||
title: getConfig().Title,
|
title: getConfig().Title,
|
||||||
fixedHeader: getConfig().FixedHeader,
|
fixedHeader: getConfig().FixedHeader,
|
||||||
|
@ -16,8 +16,7 @@ import {
|
|||||||
import { useMultiTagsStoreHook } from "./multiTags";
|
import { useMultiTagsStoreHook } from "./multiTags";
|
||||||
import { type DataInfo, setToken, removeToken, userKey } from "@/utils/auth";
|
import { type DataInfo, setToken, removeToken, userKey } from "@/utils/auth";
|
||||||
|
|
||||||
export const useUserStore = defineStore({
|
export const useUserStore = defineStore("pure-user", {
|
||||||
id: "pure-user",
|
|
||||||
state: (): userType => ({
|
state: (): userType => ({
|
||||||
// 头像
|
// 头像
|
||||||
avatar: storageLocal().getItem<DataInfo<number>>(userKey)?.avatar ?? "",
|
avatar: storageLocal().getItem<DataInfo<number>>(userKey)?.avatar ?? "",
|
||||||
@ -27,6 +26,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 +51,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 +80,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;
|
||||||
};
|
};
|
||||||
|
@ -49,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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,8 +83,8 @@
|
|||||||
.el-upload-list__item.is-ready &.el-icon--close {
|
.el-upload-list__item.is-ready &.el-icon--close {
|
||||||
width: 24px;
|
width: 24px;
|
||||||
height: 24px;
|
height: 24px;
|
||||||
border-radius: 4px;
|
|
||||||
outline: none;
|
outline: none;
|
||||||
|
border-radius: 4px;
|
||||||
transition:
|
transition:
|
||||||
background-color 0.2s,
|
background-color 0.2s,
|
||||||
color 0.2s;
|
color 0.2s;
|
||||||
@ -117,8 +117,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
& .el-message__closeBtn {
|
& .el-message__closeBtn {
|
||||||
border-radius: 4px;
|
|
||||||
outline: none;
|
outline: none;
|
||||||
|
border-radius: 4px;
|
||||||
transition:
|
transition:
|
||||||
background-color 0.2s,
|
background-color 0.2s,
|
||||||
color 0.2s;
|
color 0.2s;
|
||||||
@ -163,9 +163,10 @@
|
|||||||
|
|
||||||
/* 仿 el-scrollbar 滚动条样式,支持大多数浏览器,如Chrome、Edge、Firefox、Safari等。整体暗色风格在 src/style/dark.scss 文件进行了适配 */
|
/* 仿 el-scrollbar 滚动条样式,支持大多数浏览器,如Chrome、Edge、Firefox、Safari等。整体暗色风格在 src/style/dark.scss 文件进行了适配 */
|
||||||
.pure-scrollbar {
|
.pure-scrollbar {
|
||||||
|
scrollbar-color: rgb(221 222 224) transparent; /* 滑块颜色、轨道颜色 */
|
||||||
|
|
||||||
/* Firefox */
|
/* Firefox */
|
||||||
scrollbar-width: thin; /* 可选值为 'auto', 'thin', 'none' */
|
scrollbar-width: thin; /* 可选值为 'auto', 'thin', 'none' */
|
||||||
scrollbar-color: rgb(221 222 224) transparent; /* 滑块颜色、轨道颜色 */
|
|
||||||
::-webkit-scrollbar {
|
::-webkit-scrollbar {
|
||||||
width: 6px; /* 滚动条宽度 */
|
width: 6px; /* 滚动条宽度 */
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
@import "./transition";
|
@use "theme";
|
||||||
@import "./element-plus";
|
@use "transition";
|
||||||
@import "./sidebar";
|
@use "element-plus";
|
||||||
@import "./dark";
|
@use "sidebar";
|
||||||
|
@use "dark";
|
||||||
|
|
||||||
/* 自定义全局 CssVar */
|
/* 自定义全局 CssVar */
|
||||||
:root {
|
:root {
|
||||||
@ -13,6 +14,16 @@
|
|||||||
|
|
||||||
/* switch关闭状态下的color 需要时可取用 */
|
/* switch关闭状态下的color 需要时可取用 */
|
||||||
--pure-switch-off-color: #a6a6a6;
|
--pure-switch-off-color: #a6a6a6;
|
||||||
|
|
||||||
|
/** 主题色 */
|
||||||
|
--pure-theme-sub-menu-active-text: initial;
|
||||||
|
--pure-theme-menu-bg: none;
|
||||||
|
--pure-theme-menu-hover: none;
|
||||||
|
--pure-theme-sub-menu-bg: transparent;
|
||||||
|
--pure-theme-menu-text: initial;
|
||||||
|
--pure-theme-sidebar-logo: none;
|
||||||
|
--pure-theme-menu-title-hover: initial;
|
||||||
|
--pure-theme-menu-active-before: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 灰色模式 */
|
/* 灰色模式 */
|
||||||
|
@ -1,12 +1,3 @@
|
|||||||
*,
|
|
||||||
::before,
|
|
||||||
::after {
|
|
||||||
box-sizing: border-box;
|
|
||||||
border-color: currentColor;
|
|
||||||
border-style: solid;
|
|
||||||
border-width: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#app {
|
#app {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
@ -25,7 +16,8 @@ body {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB",
|
font-family:
|
||||||
|
"Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB",
|
||||||
"Microsoft YaHei", "微软雅黑", Arial, sans-serif;
|
"Microsoft YaHei", "微软雅黑", Arial, sans-serif;
|
||||||
line-height: inherit;
|
line-height: inherit;
|
||||||
-moz-osx-font-smoothing: grayscale;
|
-moz-osx-font-smoothing: grayscale;
|
||||||
@ -57,8 +49,9 @@ code,
|
|||||||
kbd,
|
kbd,
|
||||||
samp,
|
samp,
|
||||||
pre {
|
pre {
|
||||||
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
|
font-family:
|
||||||
"Liberation Mono", "Courier New", monospace;
|
ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
|
||||||
|
"Courier New", monospace;
|
||||||
font-size: 1em;
|
font-size: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
/* $sideBarWidth: vertical 模式下主体内容距离网页文档左侧的距离 */
|
/* $sideBarWidth: vertical 模式下主体内容距离网页文档左侧的距离 */
|
||||||
@mixin merge-style($sideBarWidth) {
|
@mixin merge-style($sideBarWidth) {
|
||||||
$menuActiveText: #7a80b4;
|
|
||||||
|
|
||||||
@media screen and (width >= 150px) and (width <= 420px) {
|
@media screen and (width >= 150px) and (width <= 420px) {
|
||||||
.app-main-nofixed-header {
|
.app-main-nofixed-header {
|
||||||
overflow-y: hidden;
|
overflow-y: hidden;
|
||||||
@ -94,7 +92,7 @@
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
overflow: visible;
|
overflow: visible;
|
||||||
font-size: 0;
|
font-size: 0;
|
||||||
background: $menuBg;
|
background: var(--pure-theme-menu-bg) !important;
|
||||||
border-right: 1px solid var(--pure-border-color);
|
border-right: 1px solid var(--pure-border-color);
|
||||||
|
|
||||||
/* 展开动画 */
|
/* 展开动画 */
|
||||||
@ -150,11 +148,11 @@
|
|||||||
.el-menu-item,
|
.el-menu-item,
|
||||||
.el-sub-menu__title {
|
.el-sub-menu__title {
|
||||||
height: 50px;
|
height: 50px;
|
||||||
color: $menuText;
|
color: var(--pure-theme-menu-text);
|
||||||
background-color: transparent !important;
|
background-color: transparent !important;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
color: $menuTitleHover !important;
|
color: var(--pure-theme-menu-title-hover) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
div,
|
div,
|
||||||
@ -173,15 +171,15 @@
|
|||||||
|
|
||||||
.is-active > .el-sub-menu__title,
|
.is-active > .el-sub-menu__title,
|
||||||
.is-active.submenu-title-noDropdown {
|
.is-active.submenu-title-noDropdown {
|
||||||
color: $subMenuActiveText !important;
|
color: var(--pure-theme-sub-menu-active-text) !important;
|
||||||
|
|
||||||
i {
|
i {
|
||||||
color: $subMenuActiveText !important;
|
color: var(--pure-theme-sub-menu-active-text) !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.is-active {
|
.is-active {
|
||||||
color: $subMenuActiveText !important;
|
color: var(--pure-theme-sub-menu-active-text) !important;
|
||||||
transition: color 0.3s;
|
transition: color 0.3s;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,8 +191,8 @@
|
|||||||
.el-menu-item.is-active.nest-menu::before {
|
.el-menu-item.is-active.nest-menu::before {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
inset: 0 8px;
|
inset: 0 8px;
|
||||||
margin: 4px 0;
|
|
||||||
clear: both;
|
clear: both;
|
||||||
|
margin: 4px 0;
|
||||||
content: "";
|
content: "";
|
||||||
background: var(--el-color-primary) !important;
|
background: var(--el-color-primary) !important;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
@ -204,7 +202,7 @@
|
|||||||
& .el-sub-menu .el-menu-item {
|
& .el-sub-menu .el-menu-item {
|
||||||
min-width: $sideBarWidth !important;
|
min-width: $sideBarWidth !important;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
background-color: $subMenuBg !important;
|
background-color: var(--pure-theme-sub-menu-bg) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 有子集的激活菜单左侧小竖条 */
|
/* 有子集的激活菜单左侧小竖条 */
|
||||||
@ -214,13 +212,13 @@
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
|
clear: both;
|
||||||
width: 2px;
|
width: 2px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
clear: both;
|
|
||||||
content: "";
|
content: "";
|
||||||
background-color: $menuActiveBefore;
|
background-color: var(--pure-theme-menu-active-before);
|
||||||
transition: all var(--pure-transition-duration) ease-in-out;
|
|
||||||
transform: translateY(0);
|
transform: translateY(0);
|
||||||
|
transition: all var(--pure-transition-duration) ease-in-out;
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-menu--collapse .outer-most.el-sub-menu > .el-sub-menu__title::before {
|
.el-menu--collapse .outer-most.el-sub-menu > .el-sub-menu__title::before {
|
||||||
@ -242,8 +240,8 @@
|
|||||||
.is-active.submenu-title-noDropdown.outer-most::before {
|
.is-active.submenu-title-noDropdown.outer-most::before {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
inset: 0 8px;
|
inset: 0 8px;
|
||||||
margin: 4px 0;
|
|
||||||
clear: both;
|
clear: both;
|
||||||
|
margin: 4px 0;
|
||||||
content: "";
|
content: "";
|
||||||
background: var(--el-color-primary) !important;
|
background: var(--el-color-primary) !important;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
@ -253,7 +251,7 @@
|
|||||||
/* vertical 菜单折叠 */
|
/* vertical 菜单折叠 */
|
||||||
.el-menu--vertical {
|
.el-menu--vertical {
|
||||||
.el-menu--popup {
|
.el-menu--popup {
|
||||||
background-color: $subMenuBg !important;
|
background-color: var(--pure-theme-sub-menu-bg) !important;
|
||||||
|
|
||||||
.el-menu-item {
|
.el-menu-item {
|
||||||
span {
|
span {
|
||||||
@ -271,10 +269,10 @@
|
|||||||
|
|
||||||
.is-active > .el-sub-menu__title,
|
.is-active > .el-sub-menu__title,
|
||||||
.is-active.submenu-title-noDropdown {
|
.is-active.submenu-title-noDropdown {
|
||||||
color: $subMenuActiveText !important;
|
color: var(--pure-theme-sub-menu-active-text) !important;
|
||||||
|
|
||||||
i {
|
i {
|
||||||
color: $subMenuActiveText !important;
|
color: var(--pure-theme-sub-menu-active-text) !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -282,23 +280,23 @@
|
|||||||
.el-menu .el-sub-menu__title {
|
.el-menu .el-sub-menu__title {
|
||||||
min-width: $sideBarWidth !important;
|
min-width: $sideBarWidth !important;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
background-color: $subMenuBg !important;
|
background-color: var(--pure-theme-sub-menu-bg) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-menu-item,
|
.el-menu-item,
|
||||||
.el-sub-menu__title {
|
.el-sub-menu__title {
|
||||||
height: 50px;
|
height: 50px;
|
||||||
line-height: 50px;
|
line-height: 50px;
|
||||||
color: $menuText;
|
color: var(--pure-theme-menu-text);
|
||||||
background-color: $subMenuBg;
|
background-color: var(--pure-theme-sub-menu-bg);
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
color: $menuTitleHover !important;
|
color: var(--pure-theme-menu-title-hover) !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.is-active {
|
.is-active {
|
||||||
color: $subMenuActiveText !important;
|
color: var(--pure-theme-sub-menu-active-text) !important;
|
||||||
transition: color 0.3s;
|
transition: color 0.3s;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -342,15 +340,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.el-menu--popup {
|
.el-menu--popup {
|
||||||
background-color: $subMenuBg !important;
|
background-color: var(--pure-theme-sub-menu-bg) !important;
|
||||||
|
|
||||||
a > .is-active.submenu-title-noDropdown {
|
a > .is-active.submenu-title-noDropdown {
|
||||||
border-bottom: none;
|
border-bottom: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-menu-item {
|
.el-menu-item {
|
||||||
color: $menuText;
|
color: var(--pure-theme-menu-text);
|
||||||
background-color: $subMenuBg;
|
background-color: var(--pure-theme-sub-menu-bg);
|
||||||
|
|
||||||
span {
|
span {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
@ -358,7 +356,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.el-sub-menu__title {
|
.el-sub-menu__title {
|
||||||
color: $menuText;
|
color: var(--pure-theme-menu-text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -366,31 +364,31 @@
|
|||||||
.el-menu .el-sub-menu__title {
|
.el-menu .el-sub-menu__title {
|
||||||
min-width: $sideBarWidth !important;
|
min-width: $sideBarWidth !important;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
background-color: $subMenuBg !important;
|
background-color: var(--pure-theme-sub-menu-bg) !important;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
color: $menuTitleHover !important;
|
color: var(--pure-theme-menu-title-hover) !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.is-active > .el-sub-menu__title,
|
.is-active > .el-sub-menu__title,
|
||||||
.is-active.submenu-title-noDropdown {
|
.is-active.submenu-title-noDropdown {
|
||||||
color: $subMenuActiveText !important;
|
color: var(--pure-theme-sub-menu-active-text) !important;
|
||||||
|
|
||||||
i {
|
i {
|
||||||
color: $subMenuActiveText !important;
|
color: var(--pure-theme-sub-menu-active-text) !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.nest-menu .el-sub-menu > .el-sub-menu__title,
|
.nest-menu .el-sub-menu > .el-sub-menu__title,
|
||||||
.el-menu-item {
|
.el-menu-item {
|
||||||
&:hover {
|
&:hover {
|
||||||
color: $menuTitleHover !important;
|
color: var(--pure-theme-menu-title-hover) !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-menu-item.is-active {
|
.el-menu-item.is-active {
|
||||||
color: $subMenuActiveText !important;
|
color: var(--pure-theme-sub-menu-active-text) !important;
|
||||||
transition: color 0.3s;
|
transition: color 0.3s;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -415,7 +413,7 @@
|
|||||||
justify-content: space-around;
|
justify-content: space-around;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 48px;
|
height: 48px;
|
||||||
background: $menuBg;
|
background: var(--pure-theme-menu-bg) !important;
|
||||||
|
|
||||||
.horizontal-header-left {
|
.horizontal-header-left {
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -437,11 +435,11 @@
|
|||||||
height: 32px;
|
height: 32px;
|
||||||
margin: 2px 0 0 12px;
|
margin: 2px 0 0 12px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
line-height: 32px;
|
line-height: 32px;
|
||||||
color: $subMenuActiveText;
|
color: var(--pure-theme-sub-menu-active-text);
|
||||||
text-overflow: ellipsis;
|
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -458,7 +456,7 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
min-width: 340px;
|
min-width: 340px;
|
||||||
color: $subMenuActiveText;
|
color: var(--pure-theme-sub-menu-active-text);
|
||||||
|
|
||||||
/* 搜索 */
|
/* 搜索 */
|
||||||
.search-container,
|
.search-container,
|
||||||
@ -471,13 +469,13 @@
|
|||||||
/* 设置 */
|
/* 设置 */
|
||||||
.set-icon {
|
.set-icon {
|
||||||
&:hover {
|
&:hover {
|
||||||
background: $menuHover;
|
background: var(--pure-theme-menu-hover);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.dropdown-badge {
|
.dropdown-badge {
|
||||||
height: 48px;
|
height: 48px;
|
||||||
color: $subMenuActiveText;
|
color: var(--pure-theme-sub-menu-active-text);
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-dropdown-link {
|
.el-dropdown-link {
|
||||||
@ -486,7 +484,7 @@
|
|||||||
justify-content: space-around;
|
justify-content: space-around;
|
||||||
height: 48px;
|
height: 48px;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
color: $subMenuActiveText;
|
color: var(--pure-theme-sub-menu-active-text);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
p {
|
p {
|
||||||
@ -511,10 +509,10 @@
|
|||||||
.el-menu-item,
|
.el-menu-item,
|
||||||
.el-sub-menu__title {
|
.el-sub-menu__title {
|
||||||
padding-right: var(--el-menu-base-level-padding);
|
padding-right: var(--el-menu-base-level-padding);
|
||||||
color: $menuText;
|
color: var(--pure-theme-menu-text);
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
color: $menuTitleHover !important;
|
color: var(--pure-theme-menu-title-hover) !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -522,7 +520,7 @@
|
|||||||
.el-sub-menu__title {
|
.el-sub-menu__title {
|
||||||
height: 48px;
|
height: 48px;
|
||||||
line-height: 48px;
|
line-height: 48px;
|
||||||
background: $menuBg;
|
background: var(--pure-theme-menu-bg) !important;
|
||||||
|
|
||||||
svg {
|
svg {
|
||||||
position: static !important;
|
position: static !important;
|
||||||
@ -531,15 +529,15 @@
|
|||||||
|
|
||||||
.is-active > .el-sub-menu__title,
|
.is-active > .el-sub-menu__title,
|
||||||
.is-active.submenu-title-noDropdown {
|
.is-active.submenu-title-noDropdown {
|
||||||
color: $subMenuActiveText !important;
|
color: var(--pure-theme-sub-menu-active-text) !important;
|
||||||
|
|
||||||
i {
|
i {
|
||||||
color: $subMenuActiveText !important;
|
color: var(--pure-theme-sub-menu-active-text) !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.is-active {
|
.is-active {
|
||||||
color: $subMenuActiveText !important;
|
color: var(--pure-theme-sub-menu-active-text) !important;
|
||||||
transition: color 0.3s;
|
transition: color 0.3s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -560,6 +558,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.sidebar-container {
|
.sidebar-container {
|
||||||
|
z-index: 2001;
|
||||||
width: $sideBarWidth;
|
width: $sideBarWidth;
|
||||||
transition: transform var(--pure-transition-duration);
|
transition: transform var(--pure-transition-duration);
|
||||||
}
|
}
|
||||||
@ -567,8 +566,8 @@
|
|||||||
&.hideSidebar {
|
&.hideSidebar {
|
||||||
.sidebar-container {
|
.sidebar-container {
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
transition-duration: 0.3s;
|
|
||||||
transform: translate3d(-$sideBarWidth, 0, 0);
|
transform: translate3d(-$sideBarWidth, 0, 0);
|
||||||
|
transition-duration: 0.3s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -584,7 +583,7 @@ body[layout="vertical"] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.sidebar-logo-container {
|
.sidebar-logo-container {
|
||||||
background: $sidebarLogo;
|
background: var(--pure-theme-sidebar-logo);
|
||||||
}
|
}
|
||||||
|
|
||||||
.hideSidebar {
|
.hideSidebar {
|
||||||
@ -611,10 +610,10 @@ body[layout="vertical"] {
|
|||||||
.el-sub-menu {
|
.el-sub-menu {
|
||||||
& > .el-sub-menu__title {
|
& > .el-sub-menu__title {
|
||||||
& > span {
|
& > span {
|
||||||
|
visibility: visible;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
visibility: visible;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -654,6 +653,10 @@ body[layout="horizontal"] {
|
|||||||
|
|
||||||
@include merge-style($sideBarWidth);
|
@include merge-style($sideBarWidth);
|
||||||
|
|
||||||
|
.el-menu {
|
||||||
|
--el-menu-hover-text-color: var(--pure-theme-menu-text) !important;
|
||||||
|
}
|
||||||
|
|
||||||
.fixed-header,
|
.fixed-header,
|
||||||
.main-container {
|
.main-container {
|
||||||
transition: none !important;
|
transition: none !important;
|
||||||
@ -675,6 +678,7 @@ body[layout="mix"] {
|
|||||||
|
|
||||||
.el-menu {
|
.el-menu {
|
||||||
--el-menu-hover-bg-color: transparent !important;
|
--el-menu-hover-bg-color: transparent !important;
|
||||||
|
--el-menu-hover-text-color: var(--pure-theme-menu-text) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hideSidebar {
|
.hideSidebar {
|
||||||
@ -703,10 +707,10 @@ body[layout="mix"] {
|
|||||||
padding: 0;
|
padding: 0;
|
||||||
|
|
||||||
& > span {
|
& > span {
|
||||||
|
visibility: visible;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
visibility: visible;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,46 @@
|
|||||||
@tailwind base;
|
@layer theme, base, components, utilities;
|
||||||
@tailwind components;
|
@import "tailwindcss/theme.css" layer(theme);
|
||||||
@tailwind utilities;
|
@import "tailwindcss/utilities.css" layer(utilities);
|
||||||
|
|
||||||
@layer components {
|
@custom-variant dark (&:is(.dark *));
|
||||||
.flex-c {
|
|
||||||
@apply flex justify-center items-center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.flex-ac {
|
@theme {
|
||||||
@apply flex justify-around items-center;
|
--color-bg_color: var(--el-bg-color);
|
||||||
}
|
--color-primary: var(--el-color-primary);
|
||||||
|
--color-text_color_primary: var(--el-text-color-primary);
|
||||||
|
--color-text_color_regular: var(--el-text-color-regular);
|
||||||
|
}
|
||||||
|
|
||||||
.flex-bc {
|
/*
|
||||||
@apply flex justify-between items-center;
|
The default border color has changed to `currentColor` in Tailwind CSS v4,
|
||||||
}
|
so we've added these compatibility styles to make sure everything still
|
||||||
|
looks the same as it did with Tailwind CSS v3.
|
||||||
|
|
||||||
.navbar-bg-hover {
|
If we ever want to remove these styles, we need to add an explicit border
|
||||||
@apply dark:text-white dark:hover:!bg-[#242424];
|
color utility to any element that depends on these defaults.
|
||||||
|
*/
|
||||||
|
@layer base {
|
||||||
|
*,
|
||||||
|
::after,
|
||||||
|
::before,
|
||||||
|
::backdrop,
|
||||||
|
::file-selector-button {
|
||||||
|
border-color: var(--color-gray-200, currentColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@utility flex-c {
|
||||||
|
@apply flex justify-center items-center;
|
||||||
|
}
|
||||||
|
|
||||||
|
@utility flex-ac {
|
||||||
|
@apply flex justify-around items-center;
|
||||||
|
}
|
||||||
|
|
||||||
|
@utility flex-bc {
|
||||||
|
@apply flex justify-between items-center;
|
||||||
|
}
|
||||||
|
|
||||||
|
@utility navbar-bg-hover {
|
||||||
|
@apply dark:text-white dark:hover:bg-[#242424]!;
|
||||||
|
}
|
||||||
|
95
src/style/theme.scss
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
/* 亮白色 */
|
||||||
|
html[data-theme="light"] {
|
||||||
|
--pure-theme-sub-menu-active-text: #000000d9;
|
||||||
|
--pure-theme-menu-bg: #fff;
|
||||||
|
--pure-theme-menu-hover: #f6f6f6;
|
||||||
|
--pure-theme-sub-menu-bg: #fff;
|
||||||
|
--pure-theme-menu-text: rgb(0 0 0 / 60%);
|
||||||
|
--pure-theme-sidebar-logo: #fff;
|
||||||
|
--pure-theme-menu-title-hover: #000;
|
||||||
|
--pure-theme-menu-active-before: #4091f7;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 道奇蓝 */
|
||||||
|
html[data-theme="default"] {
|
||||||
|
--pure-theme-sub-menu-active-text: #fff;
|
||||||
|
--pure-theme-menu-bg: #001529;
|
||||||
|
--pure-theme-menu-hover: rgb(64 145 247 / 15%);
|
||||||
|
--pure-theme-sub-menu-bg: #0f0303;
|
||||||
|
--pure-theme-menu-text: rgb(254 254 254 / 65%);
|
||||||
|
--pure-theme-sidebar-logo: #002140;
|
||||||
|
--pure-theme-menu-title-hover: #fff;
|
||||||
|
--pure-theme-menu-active-before: #4091f7;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 深紫罗兰色 */
|
||||||
|
html[data-theme="saucePurple"] {
|
||||||
|
--pure-theme-sub-menu-active-text: #fff;
|
||||||
|
--pure-theme-menu-bg: #130824;
|
||||||
|
--pure-theme-menu-hover: rgb(105 58 201 / 15%);
|
||||||
|
--pure-theme-sub-menu-bg: #000;
|
||||||
|
--pure-theme-menu-text: #7a80b4;
|
||||||
|
--pure-theme-sidebar-logo: #1f0c38;
|
||||||
|
--pure-theme-menu-title-hover: #fff;
|
||||||
|
--pure-theme-menu-active-before: #693ac9;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 深粉色 */
|
||||||
|
html[data-theme="pink"] {
|
||||||
|
--pure-theme-sub-menu-active-text: #fff;
|
||||||
|
--pure-theme-menu-bg: #28081a;
|
||||||
|
--pure-theme-menu-hover: rgb(216 68 147 / 15%);
|
||||||
|
--pure-theme-sub-menu-bg: #000;
|
||||||
|
--pure-theme-menu-text: #7a80b4;
|
||||||
|
--pure-theme-sidebar-logo: #3f0d29;
|
||||||
|
--pure-theme-menu-title-hover: #fff;
|
||||||
|
--pure-theme-menu-active-before: #d84493;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 猩红色 */
|
||||||
|
html[data-theme="dusk"] {
|
||||||
|
--pure-theme-sub-menu-active-text: #fff;
|
||||||
|
--pure-theme-menu-bg: #2a0608;
|
||||||
|
--pure-theme-menu-hover: rgb(225 60 57 / 15%);
|
||||||
|
--pure-theme-sub-menu-bg: #000;
|
||||||
|
--pure-theme-menu-text: rgb(254 254 254 / 65.1%);
|
||||||
|
--pure-theme-sidebar-logo: #42090c;
|
||||||
|
--pure-theme-menu-title-hover: #fff;
|
||||||
|
--pure-theme-menu-active-before: #e13c39;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 橙红色 */
|
||||||
|
html[data-theme="volcano"] {
|
||||||
|
--pure-theme-sub-menu-active-text: #fff;
|
||||||
|
--pure-theme-menu-bg: #2b0e05;
|
||||||
|
--pure-theme-menu-hover: rgb(232 95 51 / 15%);
|
||||||
|
--pure-theme-sub-menu-bg: #0f0603;
|
||||||
|
--pure-theme-menu-text: rgb(254 254 254 / 65%);
|
||||||
|
--pure-theme-sidebar-logo: #441708;
|
||||||
|
--pure-theme-menu-title-hover: #fff;
|
||||||
|
--pure-theme-menu-active-before: #e85f33;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 绿宝石 */
|
||||||
|
html[data-theme="mingQing"] {
|
||||||
|
--pure-theme-sub-menu-active-text: #fff;
|
||||||
|
--pure-theme-menu-bg: #032121;
|
||||||
|
--pure-theme-menu-hover: rgb(89 191 193 / 15%);
|
||||||
|
--pure-theme-sub-menu-bg: #000;
|
||||||
|
--pure-theme-menu-text: #7a80b4;
|
||||||
|
--pure-theme-sidebar-logo: #053434;
|
||||||
|
--pure-theme-menu-title-hover: #fff;
|
||||||
|
--pure-theme-menu-active-before: #59bfc1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 酸橙绿 */
|
||||||
|
html[data-theme="auroraGreen"] {
|
||||||
|
--pure-theme-sub-menu-active-text: #fff;
|
||||||
|
--pure-theme-menu-bg: #0b1e15;
|
||||||
|
--pure-theme-menu-hover: rgb(96 172 128 / 15%);
|
||||||
|
--pure-theme-sub-menu-bg: #000;
|
||||||
|
--pure-theme-menu-text: #7a80b4;
|
||||||
|
--pure-theme-sidebar-logo: #112f21;
|
||||||
|
--pure-theme-menu-title-hover: #fff;
|
||||||
|
--pure-theme-menu-active-before: #60ac80;
|
||||||
|
}
|
@ -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>;
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,8 @@ type messageTypes = "info" | "success" | "warning" | "error";
|
|||||||
interface MessageParams {
|
interface MessageParams {
|
||||||
/** 消息类型,可选 `info` 、`success` 、`warning` 、`error` ,默认 `info` */
|
/** 消息类型,可选 `info` 、`success` 、`warning` 、`error` ,默认 `info` */
|
||||||
type?: messageTypes;
|
type?: messageTypes;
|
||||||
|
/** 是否纯色,默认 `false` */
|
||||||
|
plain?: boolean;
|
||||||
/** 自定义图标,该属性会覆盖 `type` 的图标 */
|
/** 自定义图标,该属性会覆盖 `type` 的图标 */
|
||||||
icon?: any;
|
icon?: any;
|
||||||
/** 是否将 `message` 属性作为 `HTML` 片段处理,默认 `false` */
|
/** 是否将 `message` 属性作为 `HTML` 片段处理,默认 `false` */
|
||||||
@ -18,14 +20,14 @@ interface MessageParams {
|
|||||||
duration?: number;
|
duration?: number;
|
||||||
/** 是否显示关闭按钮,默认值 `false` */
|
/** 是否显示关闭按钮,默认值 `false` */
|
||||||
showClose?: boolean;
|
showClose?: boolean;
|
||||||
/** 文字是否居中,默认值 `false` */
|
/** `Message` 距离窗口顶部的偏移量,默认 `16` */
|
||||||
center?: boolean;
|
|
||||||
/** `Message` 距离窗口顶部的偏移量,默认 `20` */
|
|
||||||
offset?: number;
|
offset?: number;
|
||||||
/** 设置组件的根元素,默认 `document.body` */
|
/** 设置组件的根元素,默认 `document.body` */
|
||||||
appendTo?: string | HTMLElement;
|
appendTo?: string | HTMLElement;
|
||||||
/** 合并内容相同的消息,不支持 `VNode` 类型的消息,默认值 `false` */
|
/** 合并内容相同的消息,不支持 `VNode` 类型的消息,默认值 `false` */
|
||||||
grouping?: boolean;
|
grouping?: boolean;
|
||||||
|
/** 重复次数,类似于 `Badge` 。当和 `grouping` 属性一起使用时作为初始数量使用,默认值 `1` */
|
||||||
|
repeatNum?: number;
|
||||||
/** 关闭时的回调函数, 参数为被关闭的 `message` 实例 */
|
/** 关闭时的回调函数, 参数为被关闭的 `message` 实例 */
|
||||||
onClose?: Function | null;
|
onClose?: Function | null;
|
||||||
}
|
}
|
||||||
@ -48,28 +50,30 @@ const message = (
|
|||||||
const {
|
const {
|
||||||
icon,
|
icon,
|
||||||
type = "info",
|
type = "info",
|
||||||
|
plain = false,
|
||||||
dangerouslyUseHTMLString = false,
|
dangerouslyUseHTMLString = false,
|
||||||
customClass = "antd",
|
customClass = "antd",
|
||||||
duration = 2000,
|
duration = 2000,
|
||||||
showClose = false,
|
showClose = false,
|
||||||
center = false,
|
offset = 16,
|
||||||
offset = 20,
|
|
||||||
appendTo = document.body,
|
appendTo = document.body,
|
||||||
grouping = false,
|
grouping = false,
|
||||||
|
repeatNum = 1,
|
||||||
onClose
|
onClose
|
||||||
} = params;
|
} = params;
|
||||||
|
|
||||||
return ElMessage({
|
return ElMessage({
|
||||||
message,
|
message,
|
||||||
type,
|
|
||||||
icon,
|
icon,
|
||||||
|
type,
|
||||||
|
plain,
|
||||||
dangerouslyUseHTMLString,
|
dangerouslyUseHTMLString,
|
||||||
duration,
|
duration,
|
||||||
showClose,
|
showClose,
|
||||||
center,
|
|
||||||
offset,
|
offset,
|
||||||
appendTo,
|
appendTo,
|
||||||
grouping,
|
grouping,
|
||||||
|
repeatNum,
|
||||||
// 全局搜 pure-message 即可知道该类的样式位置
|
// 全局搜 pure-message 即可知道该类的样式位置
|
||||||
customClass: customClass === "antd" ? "pure-message" : "",
|
customClass: customClass === "antd" ? "pure-message" : "",
|
||||||
onClose: () => (isFunction(onClose) ? onClose() : null)
|
onClose: () => (isFunction(onClose) ? onClose() : null)
|
||||||
|
@ -4,10 +4,11 @@ import mitt from "mitt";
|
|||||||
/** 全局公共事件需要在此处添加类型 */
|
/** 全局公共事件需要在此处添加类型 */
|
||||||
type Events = {
|
type Events = {
|
||||||
openPanel: string;
|
openPanel: string;
|
||||||
tagViewsChange: string;
|
tagOnClick: string;
|
||||||
tagViewsShowModel: string;
|
|
||||||
logoChange: boolean;
|
logoChange: boolean;
|
||||||
|
tagViewsChange: string;
|
||||||
changLayoutRoute: string;
|
changLayoutRoute: string;
|
||||||
|
tagViewsShowModel: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const emitter: Emitter<Events> = mitt<Events>();
|
export const emitter: Emitter<Events> = mitt<Events>();
|
||||||
|
@ -9,6 +9,7 @@ const Print = function (dom, options?: object): PrintFunction {
|
|||||||
options = options || {};
|
options = options || {};
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
if (!(this instanceof Print)) return new Print(dom, options);
|
if (!(this instanceof Print)) return new Print(dom, options);
|
||||||
|
// @ts-expect-error
|
||||||
this.conf = {
|
this.conf = {
|
||||||
styleStr: "",
|
styleStr: "",
|
||||||
// Elements that need to dynamically get and set the height
|
// Elements that need to dynamically get and set the height
|
||||||
@ -18,19 +19,26 @@ const Print = function (dom, options?: object): PrintFunction {
|
|||||||
// Callback after printing
|
// Callback after printing
|
||||||
printDoneCallBack: null
|
printDoneCallBack: null
|
||||||
};
|
};
|
||||||
|
// @ts-expect-error
|
||||||
for (const key in this.conf) {
|
for (const key in this.conf) {
|
||||||
if (key && options.hasOwnProperty(key)) {
|
if (key && options.hasOwnProperty(key)) {
|
||||||
|
// @ts-expect-error
|
||||||
this.conf[key] = options[key];
|
this.conf[key] = options[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (typeof dom === "string") {
|
if (typeof dom === "string") {
|
||||||
|
// @ts-expect-error
|
||||||
this.dom = document.querySelector(dom);
|
this.dom = document.querySelector(dom);
|
||||||
} else {
|
} else {
|
||||||
|
// @ts-expect-error
|
||||||
this.dom = this.isDOM(dom) ? dom : dom.$el;
|
this.dom = this.isDOM(dom) ? dom : dom.$el;
|
||||||
}
|
}
|
||||||
|
// @ts-expect-error
|
||||||
if (this.conf.setDomHeightArr && this.conf.setDomHeightArr.length) {
|
if (this.conf.setDomHeightArr && this.conf.setDomHeightArr.length) {
|
||||||
|
// @ts-expect-error
|
||||||
this.setDomHeight(this.conf.setDomHeightArr);
|
this.setDomHeight(this.conf.setDomHeightArr);
|
||||||
}
|
}
|
||||||
|
// @ts-expect-error
|
||||||
this.init();
|
this.init();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -132,8 +140,10 @@ Print.prototype = {
|
|||||||
"position:absolute;width:0;height:0;top:-10px;left:-10px;"
|
"position:absolute;width:0;height:0;top:-10px;left:-10px;"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// eslint-disable-next-line prefer-const
|
||||||
w = f.contentWindow || f.contentDocument;
|
w = f.contentWindow || f.contentDocument;
|
||||||
|
|
||||||
|
// eslint-disable-next-line prefer-const
|
||||||
doc = f.contentDocument || f.contentWindow.document;
|
doc = f.contentDocument || f.contentWindow.document;
|
||||||
doc.open();
|
doc.open();
|
||||||
doc.write(content);
|
doc.write(content);
|
||||||
@ -172,7 +182,7 @@ Print.prototype = {
|
|||||||
if (!frameWindow.document.execCommand("print", false, null)) {
|
if (!frameWindow.document.execCommand("print", false, null)) {
|
||||||
frameWindow.print();
|
frameWindow.print();
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch {
|
||||||
frameWindow.print();
|
frameWindow.print();
|
||||||
}
|
}
|
||||||
frameWindow.close();
|
frameWindow.close();
|
||||||
|
@ -15,7 +15,7 @@ const router = useRouter();
|
|||||||
<div class="ml-12">
|
<div class="ml-12">
|
||||||
<p
|
<p
|
||||||
v-motion
|
v-motion
|
||||||
class="font-medium text-4xl mb-4 dark:text-white"
|
class="font-medium text-4xl mb-4! dark:text-white"
|
||||||
:initial="{
|
:initial="{
|
||||||
opacity: 0,
|
opacity: 0,
|
||||||
y: 100
|
y: 100
|
||||||
@ -32,7 +32,7 @@ const router = useRouter();
|
|||||||
</p>
|
</p>
|
||||||
<p
|
<p
|
||||||
v-motion
|
v-motion
|
||||||
class="mb-4 text-gray-500"
|
class="mb-4! text-gray-500"
|
||||||
:initial="{
|
:initial="{
|
||||||
opacity: 0,
|
opacity: 0,
|
||||||
y: 100
|
y: 100
|
||||||
|
@ -15,7 +15,7 @@ const router = useRouter();
|
|||||||
<div class="ml-12">
|
<div class="ml-12">
|
||||||
<p
|
<p
|
||||||
v-motion
|
v-motion
|
||||||
class="font-medium text-4xl mb-4 dark:text-white"
|
class="font-medium text-4xl mb-4! dark:text-white"
|
||||||
:initial="{
|
:initial="{
|
||||||
opacity: 0,
|
opacity: 0,
|
||||||
y: 100
|
y: 100
|
||||||
@ -32,7 +32,7 @@ const router = useRouter();
|
|||||||
</p>
|
</p>
|
||||||
<p
|
<p
|
||||||
v-motion
|
v-motion
|
||||||
class="mb-4 text-gray-500"
|
class="mb-4! text-gray-500"
|
||||||
:initial="{
|
:initial="{
|
||||||
opacity: 0,
|
opacity: 0,
|
||||||
y: 100
|
y: 100
|
||||||
|
@ -15,7 +15,7 @@ const router = useRouter();
|
|||||||
<div class="ml-12">
|
<div class="ml-12">
|
||||||
<p
|
<p
|
||||||
v-motion
|
v-motion
|
||||||
class="font-medium text-4xl mb-4 dark:text-white"
|
class="font-medium text-4xl mb-4! dark:text-white"
|
||||||
:initial="{
|
:initial="{
|
||||||
opacity: 0,
|
opacity: 0,
|
||||||
y: 100
|
y: 100
|
||||||
@ -32,7 +32,7 @@ const router = useRouter();
|
|||||||
</p>
|
</p>
|
||||||
<p
|
<p
|
||||||
v-motion
|
v-motion
|
||||||
class="mb-4 text-gray-500"
|
class="mb-4! text-gray-500"
|
||||||
:initial="{
|
:initial="{
|
||||||
opacity: 0,
|
opacity: 0,
|
||||||
y: 100
|
y: 100
|
||||||
|