Compare commits
27 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
707200c71d | ||
|
|
bc548d500c | ||
|
|
4d57c9e3d7 | ||
|
|
1bcf391513 | ||
|
|
30af2b78fe | ||
|
|
0b1bd19179 | ||
|
|
4ccf200059 | ||
|
|
27056e7560 | ||
|
|
132fbbade3 | ||
|
|
c6e25d6933 | ||
|
|
cabf1f85ef | ||
|
|
cb3d7cd552 | ||
|
|
80453ec4b1 | ||
|
|
8ca8bbcee0 | ||
|
|
2b67efe771 | ||
|
|
bbe23ce0a2 | ||
|
|
68492ec362 | ||
|
|
bc3b199860 | ||
|
|
4407dd5d10 | ||
|
|
b3cbdd6e87 | ||
|
|
b5f0ca52ce | ||
|
|
6110be29a1 | ||
|
|
d53496e495 | ||
|
|
1bafbeaab7 | ||
|
|
9a802296c7 | ||
|
|
e183ea75a0 | ||
|
|
969775c7cf |
@@ -1,14 +1,8 @@
|
|||||||
# 项目本地运行端口号
|
# 平台本地运行端口号
|
||||||
VITE_PORT = 8848
|
VITE_PORT = 8848
|
||||||
|
|
||||||
# 开发环境读取配置文件路径
|
# 开发环境读取配置文件路径
|
||||||
VITE_PUBLIC_PATH = /
|
VITE_PUBLIC_PATH = /
|
||||||
|
|
||||||
# 开发环境代理
|
# 开发环境路由历史模式(Hash模式传"hash"、HTML5模式传"h5"、Hash模式带base参数传"hash,base参数"、HTML5模式带base参数传"h5,base参数")
|
||||||
VITE_PROXY_DOMAIN = /api
|
|
||||||
|
|
||||||
# 开发环境路由历史模式
|
|
||||||
VITE_ROUTER_HISTORY = "hash"
|
VITE_ROUTER_HISTORY = "hash"
|
||||||
|
|
||||||
# 开发环境后端地址
|
|
||||||
VITE_PROXY_DOMAIN_REAL = "http://127.0.0.1:3000"
|
|
||||||
@@ -1,15 +1,9 @@
|
|||||||
# 线上环境项目打包路径
|
# 线上环境平台打包路径
|
||||||
VITE_PUBLIC_PATH = /
|
VITE_PUBLIC_PATH = /
|
||||||
|
|
||||||
# 线上环境路由历史模式
|
# 线上环境路由历史模式(Hash模式传"hash"、HTML5模式传"h5"、Hash模式带base参数传"hash,base参数"、HTML5模式带base参数传"h5,base参数")
|
||||||
VITE_ROUTER_HISTORY = "hash"
|
VITE_ROUTER_HISTORY = "hash"
|
||||||
|
|
||||||
# 线上环境后端地址
|
|
||||||
VITE_PROXY_DOMAIN_REAL = ""
|
|
||||||
|
|
||||||
# 是否为打包后的文件提供传统浏览器兼容性支持 支持 true 不支持 false
|
|
||||||
VITE_LEGACY = false
|
|
||||||
|
|
||||||
# 是否在打包时使用cdn替换本地库 替换 true 不替换 false
|
# 是否在打包时使用cdn替换本地库 替换 true 不替换 false
|
||||||
VITE_CDN = false
|
VITE_CDN = false
|
||||||
|
|
||||||
|
|||||||
12
.env.staging
@@ -4,19 +4,13 @@ NODE_ENV=production
|
|||||||
|
|
||||||
VITE_PUBLIC_PATH = /
|
VITE_PUBLIC_PATH = /
|
||||||
|
|
||||||
# 线上环境路由历史模式
|
# 预发布环境路由历史模式(Hash模式传"hash"、HTML5模式传"h5"、Hash模式带base参数传"hash,base参数"、HTML5模式带base参数传"h5,base参数")
|
||||||
VITE_ROUTER_HISTORY = "hash"
|
VITE_ROUTER_HISTORY = "hash"
|
||||||
|
|
||||||
# 线上环境后端地址
|
|
||||||
VITE_PROXY_DOMAIN_REAL = ""
|
|
||||||
|
|
||||||
# 是否为打包后的文件提供传统浏览器兼容性支持 支持 true 不支持 false
|
|
||||||
VITE_LEGACY = false
|
|
||||||
|
|
||||||
# 是否在打包时使用cdn替换本地库 替换 true 不替换 false
|
# 是否在打包时使用cdn替换本地库 替换 true 不替换 false
|
||||||
VITE_CDN = false
|
VITE_CDN = true
|
||||||
|
|
||||||
# 是否启用gzip压缩或brotli压缩(分两种情况,删除原始文件和不删除原始文件)
|
# 是否启用gzip压缩或brotli压缩(分两种情况,删除原始文件和不删除原始文件)
|
||||||
# 压缩时不删除原始文件的配置:gzip、brotli、both(同时开启 gzip 与 brotli 压缩)、none(不开启压缩,默认)
|
# 压缩时不删除原始文件的配置:gzip、brotli、both(同时开启 gzip 与 brotli 压缩)、none(不开启压缩,默认)
|
||||||
# 压缩时删除原始文件的配置:gzip-clear、brotli-clear、both-clear(同时开启 gzip 与 brotli 压缩)、none(不开启压缩,默认)
|
# 压缩时删除原始文件的配置:gzip-clear、brotli-clear、both-clear(同时开启 gzip 与 brotli 压缩)、none(不开启压缩,默认)
|
||||||
VITE_COMPRESSION = "none"
|
VITE_COMPRESSION = "both-clear"
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
public
|
public
|
||||||
dist
|
dist
|
||||||
*.d.ts
|
*.d.ts
|
||||||
|
/src/assets
|
||||||
package.json
|
package.json
|
||||||
.eslintrc.js
|
.eslintrc.js
|
||||||
.prettierrc.js
|
.prettierrc.js
|
||||||
|
|||||||
@@ -4,9 +4,9 @@
|
|||||||
|
|
||||||
**English** | [中文](./README.md)
|
**English** | [中文](./README.md)
|
||||||
|
|
||||||
## introduce
|
## Introduce
|
||||||
|
|
||||||
The Lite version is based on the shelf extracted from [vue-pure-admin](https://github.com/xiaoxian521/vue-pure-admin), including the main functions, which is more suitable for actual project development, and the packaged size is lower than ` 3MB`, and will permanently sync the full version of the code. After enabling `brotli` compression and `cdn` to replace the native library mode, the package size is less than `500kb`
|
The simplified version is based on the shelf extracted from [vue-pure-admin](https://github.com/xiaoxian521/vue-pure-admin), which contains main functions and is more suitable for actual project development. The packaged size is introduced globally [element-plus](https://element-plus.org) is still below `2.3MB`, and the full version of the code will be permanently synchronized. After enabling `brotli` compression and `cdn` to replace the local library mode, the package size is less than `350kb`
|
||||||
|
|
||||||
## Supporting Video
|
## Supporting Video
|
||||||
|
|
||||||
@@ -15,9 +15,8 @@ The Lite version is based on the shelf extracted from [vue-pure-admin](https://g
|
|||||||
|
|
||||||
## Docs
|
## Docs
|
||||||
|
|
||||||
- [Click me to view the domestic documentation site](http://yiming_chang.gitee.io/pure-admin-doc)
|
- [Click me to view the domestic documentation site](https://yiming_chang.gitee.io/pure-admin-doc)
|
||||||
- [Click me to view foreign document site 1](https://xiaoxian521.github.io/pure-admin-doc)
|
- [Click me to view foreign document site](https://xiaoxian521.github.io/pure-admin-doc)
|
||||||
- [Click me to view foreign document site 2](https://pure-admin-doc.vercel.app)
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
|||||||
11
README.md
@@ -6,7 +6,11 @@
|
|||||||
|
|
||||||
## 介绍
|
## 介绍
|
||||||
|
|
||||||
精简版是基于 [vue-pure-admin](https://github.com/xiaoxian521/vue-pure-admin) 提炼出的架子,包含主体功能,更适合实际项目开发,打包后的大小低于 `3MB`,并且会永久同步完整版的代码。开启 `brotli` 压缩和 `cdn` 替换本地库模式后,打包大小低于 `500kb`
|
精简版是基于 [vue-pure-admin](https://github.com/xiaoxian521/vue-pure-admin) 提炼出的架子,包含主体功能,更适合实际项目开发,打包后的大小在全局引入 [element-plus](https://element-plus.org) 的情况下仍然低于 `2.3MB`,并且会永久同步完整版的代码。开启 `brotli` 压缩和 `cdn` 替换本地库模式后,打包大小低于 `350kb`
|
||||||
|
|
||||||
|
## 版本选择
|
||||||
|
|
||||||
|
当前是非国际化版本哦,如果您需要国际化版本 [请点击](https://github.com/xiaoxian521/pure-admin-thin/tree/i18n)
|
||||||
|
|
||||||
## 配套视频
|
## 配套视频
|
||||||
|
|
||||||
@@ -15,9 +19,8 @@
|
|||||||
|
|
||||||
## 配套文档
|
## 配套文档
|
||||||
|
|
||||||
- [点我查看国内文档站](http://yiming_chang.gitee.io/pure-admin-doc)
|
- [点我查看国内文档站](https://yiming_chang.gitee.io/pure-admin-doc)
|
||||||
- [点我查看国外文档站 1](https://xiaoxian521.github.io/pure-admin-doc)
|
- [点我查看国外文档站](https://xiaoxian521.github.io/pure-admin-doc)
|
||||||
- [点我查看国外文档站 2](https://pure-admin-doc.vercel.app)
|
|
||||||
|
|
||||||
## 维护者
|
## 维护者
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { Plugin as importToCDN } from "vite-plugin-cdn-import";
|
|||||||
* 注意:上面提到的仅限外网使用也不是完全肯定的,如果你们公司内网部署的有相关js、css文件,也可以将下面配置对应改一下,整一套内网版cdn
|
* 注意:上面提到的仅限外网使用也不是完全肯定的,如果你们公司内网部署的有相关js、css文件,也可以将下面配置对应改一下,整一套内网版cdn
|
||||||
*/
|
*/
|
||||||
export const cdn = importToCDN({
|
export const cdn = importToCDN({
|
||||||
//(prodUrl解释: name: 对应下面modules的name,version: 自动读取本地package.json中dependencies依赖中对应包的版本号,path: 对应下面modules的path)
|
//(prodUrl解释: name: 对应下面modules的name,version: 自动读取本地package.json中dependencies依赖中对应包的版本号,path: 对应下面modules的path,当然也可写完整路径,会替换prodUrl)
|
||||||
prodUrl: "https://cdn.bootcdn.net/ajax/libs/{name}/{version}/{path}",
|
prodUrl: "https://cdn.bootcdn.net/ajax/libs/{name}/{version}/{path}",
|
||||||
modules: [
|
modules: [
|
||||||
{
|
{
|
||||||
@@ -51,12 +51,6 @@ export const cdn = importToCDN({
|
|||||||
name: "echarts",
|
name: "echarts",
|
||||||
var: "echarts",
|
var: "echarts",
|
||||||
path: "echarts.min.js"
|
path: "echarts.min.js"
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "lodash",
|
|
||||||
var: "lodash",
|
|
||||||
// 可写`完整路径`,会替换`prodUrl`
|
|
||||||
path: "https://cdn.bootcdn.net/ajax/libs/lodash.js/4.17.21/lodash.min.js"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,13 +1,10 @@
|
|||||||
/** 处理环境变量 */
|
/** 处理环境变量 */
|
||||||
const warpperEnv = (envConf: Recordable): ViteEnv => {
|
const warpperEnv = (envConf: Recordable): ViteEnv => {
|
||||||
/** 此处为默认值,无需修改 */
|
/** 此处为默认值 */
|
||||||
const ret: ViteEnv = {
|
const ret: ViteEnv = {
|
||||||
VITE_PORT: 8848,
|
VITE_PORT: 8848,
|
||||||
VITE_PUBLIC_PATH: "",
|
VITE_PUBLIC_PATH: "",
|
||||||
VITE_PROXY_DOMAIN: "",
|
|
||||||
VITE_PROXY_DOMAIN_REAL: "",
|
|
||||||
VITE_ROUTER_HISTORY: "",
|
VITE_ROUTER_HISTORY: "",
|
||||||
VITE_LEGACY: false,
|
|
||||||
VITE_CDN: false,
|
VITE_CDN: false,
|
||||||
VITE_COMPRESSION: "none"
|
VITE_COMPRESSION: "none"
|
||||||
};
|
};
|
||||||
@@ -30,14 +27,4 @@ const warpperEnv = (envConf: Recordable): ViteEnv => {
|
|||||||
return ret;
|
return ret;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 跨域代理重写 */
|
export { warpperEnv };
|
||||||
const regExps = (value: string, reg: string): string => {
|
|
||||||
return value.replace(new RegExp(`^${reg}`, "g"), "");
|
|
||||||
};
|
|
||||||
|
|
||||||
/** 环境变量 */
|
|
||||||
const loadEnv = (): ViteEnv => {
|
|
||||||
return import.meta.env;
|
|
||||||
};
|
|
||||||
|
|
||||||
export { warpperEnv, regExps, loadEnv };
|
|
||||||
|
|||||||
@@ -9,10 +9,12 @@ export function viteBuildInfo(): Plugin {
|
|||||||
let config: { command: string };
|
let config: { command: string };
|
||||||
let startTime: Dayjs;
|
let startTime: Dayjs;
|
||||||
let endTime: Dayjs;
|
let endTime: Dayjs;
|
||||||
|
let outDir: string;
|
||||||
return {
|
return {
|
||||||
name: "vite:buildInfo",
|
name: "vite:buildInfo",
|
||||||
configResolved(resolvedConfig: { command: string }) {
|
configResolved(resolvedConfig) {
|
||||||
config = resolvedConfig;
|
config = resolvedConfig;
|
||||||
|
outDir = resolvedConfig.build?.outDir ?? "dist";
|
||||||
},
|
},
|
||||||
buildStart() {
|
buildStart() {
|
||||||
console.log(
|
console.log(
|
||||||
@@ -32,6 +34,7 @@ export function viteBuildInfo(): Plugin {
|
|||||||
if (config.command === "build") {
|
if (config.command === "build") {
|
||||||
endTime = dayjs(new Date());
|
endTime = dayjs(new Date());
|
||||||
getPackageSize({
|
getPackageSize({
|
||||||
|
folder: outDir,
|
||||||
callback: (size: string) => {
|
callback: (size: string) => {
|
||||||
console.log(
|
console.log(
|
||||||
bold(
|
bold(
|
||||||
|
|||||||
31
build/optimize.ts
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
/**
|
||||||
|
* 此文件作用于 `vite.config.ts` 的 `optimizeDeps.include` 依赖预构建配置项
|
||||||
|
* 依赖预构建,`vite` 启动时会将下面 include 里的模块,编译成 esm 格式并缓存到 node_modules/.vite 文件夹,页面加载到对应模块时如果浏览器有缓存就读取浏览器缓存,如果没有会读取本地缓存并按需加载
|
||||||
|
* 尤其当您禁用浏览器缓存时(这种情况只应该发生在调试阶段)必须将对应模块加入到 include里,否则会遇到开发环境切换页面卡顿的问题(vite 会认为它是一个新的依赖包会重新加载并强制刷新页面),因为它既无法使用浏览器缓存,又没有在本地 node_modules/.vite 里缓存
|
||||||
|
* 温馨提示:如果您使用的第三方库是全局引入,也就是引入到 src/main.ts 文件里,就不需要再添加到 include 里了,因为 vite 会自动将它们缓存到 node_modules/.vite
|
||||||
|
*/
|
||||||
|
const include = [
|
||||||
|
"qs",
|
||||||
|
"mitt",
|
||||||
|
"dayjs",
|
||||||
|
"axios",
|
||||||
|
"pinia",
|
||||||
|
"echarts",
|
||||||
|
"js-cookie",
|
||||||
|
"@vueuse/core",
|
||||||
|
"@pureadmin/utils",
|
||||||
|
"responsive-storage",
|
||||||
|
"element-resize-detector"
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 在预构建中强制排除的依赖项
|
||||||
|
* 温馨提示:所有以 `@iconify-icons/` 开头引入的的本地图标模块,都应该加入到下面的 `exclude` 里,因为平台推荐的使用方式是哪里需要哪里引入而且都是单个的引入,不需要预构建,直接让浏览器加载就好
|
||||||
|
*/
|
||||||
|
const exclude = [
|
||||||
|
"@iconify-icons/ep",
|
||||||
|
"@iconify-icons/ri",
|
||||||
|
"@pureadmin/theme/dist/browser-utils"
|
||||||
|
];
|
||||||
|
|
||||||
|
export { include, exclude };
|
||||||
@@ -2,7 +2,6 @@ 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 legacy from "@vitejs/plugin-legacy";
|
|
||||||
import vueJsx from "@vitejs/plugin-vue-jsx";
|
import vueJsx from "@vitejs/plugin-vue-jsx";
|
||||||
import { viteMockServe } from "vite-plugin-mock";
|
import { viteMockServe } from "vite-plugin-mock";
|
||||||
import { configCompressPlugin } from "./compress";
|
import { configCompressPlugin } from "./compress";
|
||||||
@@ -15,7 +14,6 @@ import { genScssMultipleScopeVars } from "../src/layout/theme";
|
|||||||
|
|
||||||
export function getPluginsList(
|
export function getPluginsList(
|
||||||
command: string,
|
command: string,
|
||||||
VITE_LEGACY: boolean,
|
|
||||||
VITE_CDN: boolean,
|
VITE_CDN: boolean,
|
||||||
VITE_COMPRESSION: ViteCompression
|
VITE_COMPRESSION: ViteCompression
|
||||||
) {
|
) {
|
||||||
@@ -35,14 +33,7 @@ export function getPluginsList(
|
|||||||
themePreprocessorPlugin({
|
themePreprocessorPlugin({
|
||||||
scss: {
|
scss: {
|
||||||
multipleScopeVars: genScssMultipleScopeVars(),
|
multipleScopeVars: genScssMultipleScopeVars(),
|
||||||
// 在生产模式是否抽取独立的主题css文件,extract为true以下属性有效
|
extract: true
|
||||||
extract: true,
|
|
||||||
// 会选取defaultScopeName对应的主题css文件在html添加link
|
|
||||||
themeLinkTagId: "head",
|
|
||||||
// "head"||"head-prepend" || "body" ||"body-prepend"
|
|
||||||
themeLinkTagInjectTo: "head",
|
|
||||||
// 是否对抽取的css文件内对应scopeName的权重类名移除
|
|
||||||
removeCssScopeName: false
|
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
// svg组件化支持
|
// svg组件化支持
|
||||||
@@ -59,13 +50,6 @@ export function getPluginsList(
|
|||||||
`,
|
`,
|
||||||
logger: false
|
logger: false
|
||||||
}),
|
}),
|
||||||
// 是否为打包后的文件提供传统浏览器兼容性支持
|
|
||||||
VITE_LEGACY
|
|
||||||
? legacy({
|
|
||||||
targets: ["ie >= 11"],
|
|
||||||
additionalLegacyPolyfills: ["regenerator-runtime/runtime"]
|
|
||||||
})
|
|
||||||
: null,
|
|
||||||
// 打包分析
|
// 打包分析
|
||||||
lifecycle === "report"
|
lifecycle === "report"
|
||||||
? visualizer({ open: true, brotliSize: true, filename: "report.html" })
|
? visualizer({ open: true, brotliSize: true, filename: "report.html" })
|
||||||
|
|||||||
96
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "pure-admin-thin",
|
"name": "pure-admin-thin",
|
||||||
"version": "3.6.3",
|
"version": "3.9.6",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "NODE_OPTIONS=--max-old-space-size=4096 vite",
|
"dev": "NODE_OPTIONS=--max-old-space-size=4096 vite",
|
||||||
@@ -11,8 +11,9 @@
|
|||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"preview:build": "pnpm build && vite preview",
|
"preview:build": "pnpm build && vite preview",
|
||||||
"typecheck": "tsc --noEmit && vue-tsc --noEmit --skipLibCheck",
|
"typecheck": "tsc --noEmit && vue-tsc --noEmit --skipLibCheck",
|
||||||
|
"svgo": "svgo -f src/assets/svg -o src/assets/svg",
|
||||||
"cloc": "NODE_OPTIONS=--max-old-space-size=4096 cloc . --exclude-dir=node_modules --exclude-lang=YAML",
|
"cloc": "NODE_OPTIONS=--max-old-space-size=4096 cloc . --exclude-dir=node_modules --exclude-lang=YAML",
|
||||||
"clean:cache": "rm -rf node_modules && rm -rf .eslintcache && npm cache clean --force && pnpm install",
|
"clean:cache": "rm -rf node_modules && rm -rf .eslintcache && pnpm install",
|
||||||
"lint:eslint": "eslint --cache --max-warnings 0 \"{src,mock,build}/**/*.{vue,js,ts,tsx}\" --fix",
|
"lint:eslint": "eslint --cache --max-warnings 0 \"{src,mock,build}/**/*.{vue,js,ts,tsx}\" --fix",
|
||||||
"lint:prettier": "prettier --write \"src/**/*.{js,ts,json,tsx,css,less,scss,vue,html,md}\"",
|
"lint:prettier": "prettier --write \"src/**/*.{js,ts,json,tsx,css,less,scss,vue,html,md}\"",
|
||||||
"lint:stylelint": "stylelint --cache --fix \"**/*.{vue,css,scss,postcss,less}\" --cache --cache-location node_modules/.cache/stylelint/",
|
"lint:stylelint": "stylelint --cache --fix \"**/*.{vue,css,scss,postcss,less}\" --cache --cache-location node_modules/.cache/stylelint/",
|
||||||
@@ -28,99 +29,86 @@
|
|||||||
"not op_mini all"
|
"not op_mini all"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ctrl/tinycolor": "^3.4.1",
|
|
||||||
"@pureadmin/components": "^1.1.0",
|
|
||||||
"@pureadmin/descriptions": "^1.1.0",
|
"@pureadmin/descriptions": "^1.1.0",
|
||||||
"@pureadmin/table": "^1.2.0",
|
"@pureadmin/table": "^1.9.0",
|
||||||
"@pureadmin/utils": "^1.1.5",
|
"@pureadmin/utils": "^1.8.5",
|
||||||
"@vueuse/core": "^9.4.0",
|
"@vueuse/core": "^9.6.0",
|
||||||
"@vueuse/motion": "^2.0.0-beta.12",
|
"@vueuse/motion": "2.0.0-beta.12",
|
||||||
"@vueuse/shared": "^9.4.0",
|
|
||||||
"animate.css": "^4.1.1",
|
"animate.css": "^4.1.1",
|
||||||
"axios": "^1.1.3",
|
"axios": "^1.2.0",
|
||||||
"dayjs": "^1.11.4",
|
"dayjs": "^1.11.6",
|
||||||
"echarts": "^5.3.3",
|
"echarts": "^5.4.0",
|
||||||
"element-plus": "^2.2.16",
|
"element-plus": "^2.2.27",
|
||||||
"element-resize-detector": "^1.2.3",
|
"element-resize-detector": "^1.2.4",
|
||||||
"js-cookie": "^3.0.1",
|
"js-cookie": "^3.0.1",
|
||||||
"lodash": "^4.17.21",
|
|
||||||
"lodash-es": "^4.17.21",
|
|
||||||
"lodash-unified": "^1.0.2",
|
|
||||||
"mitt": "^3.0.0",
|
"mitt": "^3.0.0",
|
||||||
"mockjs": "^1.1.0",
|
"mockjs": "^1.1.0",
|
||||||
"nprogress": "^0.2.0",
|
"nprogress": "^0.2.0",
|
||||||
"path": "^0.12.7",
|
"path": "^0.12.7",
|
||||||
"pinia": "^2.0.21",
|
"pinia": "^2.0.28",
|
||||||
"qs": "^6.11.0",
|
"qs": "^6.11.0",
|
||||||
"resize-observer-polyfill": "^1.5.1",
|
|
||||||
"responsive-storage": "^2.1.0",
|
"responsive-storage": "^2.1.0",
|
||||||
"vue": "^3.2.40",
|
"vue": "^3.2.45",
|
||||||
"vue-router": "^4.1.6",
|
"vue-router": "^4.1.6",
|
||||||
"vue-types": "^4.2.1",
|
"vue-types": "^4.2.1"
|
||||||
"vxe-table": "^4.3.2",
|
|
||||||
"xe-utils": "^3.5.6"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@commitlint/cli": "13.1.0",
|
"@commitlint/cli": "13.1.0",
|
||||||
"@commitlint/config-conventional": "13.1.0",
|
"@commitlint/config-conventional": "13.1.0",
|
||||||
"@iconify-icons/ep": "^1.2.7",
|
"@iconify-icons/ep": "^1.2.7",
|
||||||
"@iconify-icons/ri": "^1.2.3",
|
"@iconify-icons/ri": "^1.2.3",
|
||||||
"@iconify/vue": "^3.2.1",
|
"@iconify/vue": "^4.0.0",
|
||||||
"@pureadmin/theme": "^2.4.0",
|
"@pureadmin/theme": "^3.0.0",
|
||||||
"@types/element-resize-detector": "1.1.3",
|
"@types/element-resize-detector": "1.1.3",
|
||||||
"@types/js-cookie": "^3.0.1",
|
"@types/js-cookie": "^3.0.1",
|
||||||
"@types/lodash": "^4.14.180",
|
"@types/mockjs": "^1.0.7",
|
||||||
"@types/lodash-es": "^4.17.6",
|
"@types/node": "^18.11.9",
|
||||||
"@types/mockjs": "1.0.3",
|
|
||||||
"@types/node": "14.14.14",
|
|
||||||
"@types/nprogress": "0.2.0",
|
"@types/nprogress": "0.2.0",
|
||||||
"@types/qs": "^6.9.7",
|
"@types/qs": "^6.9.7",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.10.2",
|
"@typescript-eslint/eslint-plugin": "^5.42.1",
|
||||||
"@typescript-eslint/parser": "^5.10.2",
|
"@typescript-eslint/parser": "^5.42.1",
|
||||||
"@vitejs/plugin-legacy": "^2.2.0",
|
"@vitejs/plugin-vue": "^4.0.0",
|
||||||
"@vitejs/plugin-vue": "^3.1.2",
|
"@vitejs/plugin-vue-jsx": "^3.0.0",
|
||||||
"@vitejs/plugin-vue-jsx": "^2.0.1",
|
|
||||||
"@vue/eslint-config-prettier": "^7.0.0",
|
"@vue/eslint-config-prettier": "^7.0.0",
|
||||||
"@vue/eslint-config-typescript": "^10.0.0",
|
"@vue/eslint-config-typescript": "^11.0.2",
|
||||||
"@vue/runtime-core": "^3.2.40",
|
"autoprefixer": "^10.4.13",
|
||||||
"autoprefixer": "^10.4.12",
|
|
||||||
"cloc": "^2.10.0",
|
"cloc": "^2.10.0",
|
||||||
"cssnano": "^5.1.13",
|
"cssnano": "^5.1.14",
|
||||||
"eslint": "^8.8.0",
|
"eslint": "^8.8.0",
|
||||||
"eslint-plugin-prettier": "^4.0.0",
|
"eslint-plugin-prettier": "^4.0.0",
|
||||||
"eslint-plugin-vue": "^8.4.1",
|
"eslint-plugin-vue": "^9.7.0",
|
||||||
"font-awesome": "^4.7.0",
|
|
||||||
"husky": "^7.0.4",
|
"husky": "^7.0.4",
|
||||||
"lint-staged": "11.1.2",
|
"lint-staged": "11.1.2",
|
||||||
"picocolors": "^1.0.0",
|
"picocolors": "^1.0.0",
|
||||||
"postcss": "^8.4.17",
|
"postcss": "^8.4.18",
|
||||||
"postcss-html": "^1.5.0",
|
"postcss-html": "^1.5.0",
|
||||||
"postcss-import": "^15.0.0",
|
"postcss-import": "^15.0.0",
|
||||||
"postcss-scss": "^4.0.5",
|
"postcss-scss": "^4.0.5",
|
||||||
"prettier": "^2.5.1",
|
"prettier": "^2.5.1",
|
||||||
"pretty-quick": "3.1.1",
|
"pretty-quick": "3.1.1",
|
||||||
"rimraf": "3.0.2",
|
"rimraf": "3.0.2",
|
||||||
"rollup-plugin-visualizer": "^5.8.2",
|
"rollup-plugin-visualizer": "^5.8.3",
|
||||||
"sass": "^1.53.0",
|
"sass": "^1.56.1",
|
||||||
"sass-loader": "^13.0.2",
|
"sass-loader": "^13.2.0",
|
||||||
"stylelint": "^14.3.0",
|
"stylelint": "^14.3.0",
|
||||||
"stylelint-config-html": "^1.0.0",
|
"stylelint-config-html": "^1.0.0",
|
||||||
"stylelint-config-prettier": "^9.0.3",
|
"stylelint-config-prettier": "^9.0.3",
|
||||||
"stylelint-config-recommended": "^6.0.0",
|
"stylelint-config-recommended": "^9.0.0",
|
||||||
"stylelint-config-standard": "^24.0.0",
|
"stylelint-config-standard": "^29.0.0",
|
||||||
"stylelint-order": "^5.0.0",
|
"stylelint-order": "^5.0.0",
|
||||||
"tailwindcss": "^3.2.1",
|
"svgo": "^3.0.2",
|
||||||
"terser": "^5.15.0",
|
"tailwindcss": "^3.2.4",
|
||||||
"typescript": "^4.7.4",
|
"terser": "^5.16.1",
|
||||||
"unplugin-vue-define-options": "0.7.3",
|
"typescript": "^4.9.3",
|
||||||
"vite": "^3.1.8",
|
"unplugin-vue-define-options": "^1.1.1",
|
||||||
|
"vite": "^4.0.2",
|
||||||
"vite-plugin-cdn-import": "^0.3.5",
|
"vite-plugin-cdn-import": "^0.3.5",
|
||||||
"vite-plugin-compression": "^0.5.1",
|
"vite-plugin-compression": "^0.5.1",
|
||||||
"vite-plugin-mock": "^2.9.6",
|
"vite-plugin-mock": "^2.9.6",
|
||||||
"vite-plugin-remove-console": "^1.1.0",
|
"vite-plugin-remove-console": "^1.3.0",
|
||||||
"vite-svg-loader": "^3.6.0",
|
"vite-svg-loader": "^3.6.0",
|
||||||
"vue-eslint-parser": "^8.2.0",
|
"vue-eslint-parser": "^9.1.0",
|
||||||
"vue-tsc": "^0.40.13"
|
"vue-tsc": "^1.0.9"
|
||||||
},
|
},
|
||||||
"pnpm": {
|
"pnpm": {
|
||||||
"peerDependencyRules": {
|
"peerDependencyRules": {
|
||||||
|
|||||||
2506
pnpm-lock.yaml
generated
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"Version": "3.6.3",
|
"Version": "3.9.6",
|
||||||
"Title": "PureAdmin",
|
"Title": "PureAdmin",
|
||||||
"FixedHeader": true,
|
"FixedHeader": true,
|
||||||
"HiddenSideBar": false,
|
"HiddenSideBar": false,
|
||||||
@@ -14,5 +14,8 @@
|
|||||||
"SidebarStatus": true,
|
"SidebarStatus": true,
|
||||||
"EpThemeColor": "#409EFF",
|
"EpThemeColor": "#409EFF",
|
||||||
"ShowLogo": true,
|
"ShowLogo": true,
|
||||||
"ShowModel": "smart"
|
"ShowModel": "smart",
|
||||||
|
"MenuArrowIconNoTransition": true,
|
||||||
|
"CachingAsyncRoutes": true,
|
||||||
|
"TooltipEffect": "light"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { http } from "../utils/http";
|
import { http } from "@/utils/http";
|
||||||
|
|
||||||
type Result = {
|
type Result = {
|
||||||
success: boolean;
|
success: boolean;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { http } from "../utils/http";
|
import { http } from "@/utils/http";
|
||||||
|
|
||||||
export type UserResult = {
|
export type UserResult = {
|
||||||
success: boolean;
|
success: boolean;
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
<svg t="1636193306629" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1847" width="32" height="32"><path d="M410.558481 0.10861C410.558481 211.083075 109.682285 361.860579 109.682285 633.656511c0 174.943176 134.703259 316.787527 300.876196 316.787527s300.876197-141.817198 300.876197-316.787527C711.407525 361.751969 410.558481 210.974465 410.558481 0.10861z" fill="#386BF3" p-id="1848"></path><path d="M613.468671 73.664572c0 211.055922-300.876197 361.914883-300.876196 633.547901 0 174.943176 134.703259 316.787527 300.876196 316.787527s300.876197-141.817198 300.876197-316.787527c-0.054305-271.633018-300.876197-422.491979-300.876197-633.547901z" fill="#C3D2FB" p-id="1849"></path><path d="M312.592475 707.212473c0-183.713414 137.635722-312.171612 226.72288-441.390078 81.701694 106.111739 172.119322 218.740063 172.119323 367.725506a309.755045 309.755045 0 0 1-291.074166 316.516003 323.114046 323.114046 0 0 1-107.768037-242.851431z" fill="#303F5B" p-id="1850"></path></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" class="icon" viewBox="0 0 1024 1024"><path fill="#386BF3" d="M410.558.109c0 210.974-300.876 361.752-300.876 633.548 0 174.943 134.704 316.787 300.876 316.787s300.877-141.817 300.877-316.787C711.408 361.752 410.558 210.974 410.558.109z"/><path fill="#C3D2FB" d="M613.469 73.665c0 211.055-300.877 361.914-300.877 633.547C312.592 882.156 447.296 1024 613.47 1024s300.876-141.817 300.876-316.788C914.29 435.58 613.469 284.72 613.469 73.665z"/><path fill="#303F5B" d="M312.592 707.212c0-183.713 137.636-312.171 226.723-441.39 81.702 106.112 172.12 218.74 172.12 367.726A309.755 309.755 0 0 1 420.36 950.064a323.114 323.114 0 0 1-107.769-242.852z"/></svg>
|
||||||
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 712 B |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 13 KiB |
@@ -1 +1 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="none" d="M0 0h24v24H0z"/><path d="M2.88 18.054a35.897 35.897 0 0 1 8.531-16.32.8.8 0 0 1 1.178 0c.166.18.304.332.413.455a35.897 35.897 0 0 1 8.118 15.865c-2.141.451-4.34.747-6.584.874l-2.089 4.178a.5.5 0 0 1-.894 0l-2.089-4.178a44.019 44.019 0 0 1-6.584-.874zm6.698-1.123l1.157.066L12 19.527l1.265-2.53 1.157-.066a42.137 42.137 0 0 0 4.227-.454A33.913 33.913 0 0 0 12 4.09a33.913 33.913 0 0 0-6.649 12.387c1.395.222 2.805.374 4.227.454zM12 15a3 3 0 1 1 0-6 3 3 0 0 1 0 6zm0-2a1 1 0 1 0 0-2 1 1 0 0 0 0 2z"/></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path fill="none" d="M0 0h24v24H0z"/><path d="M2.88 18.054a35.897 35.897 0 0 1 8.531-16.32.8.8 0 0 1 1.178 0c.166.18.304.332.413.455a35.897 35.897 0 0 1 8.118 15.865c-2.141.451-4.34.747-6.584.874l-2.089 4.178a.5.5 0 0 1-.894 0l-2.089-4.178a44.019 44.019 0 0 1-6.584-.874zm6.698-1.123 1.157.066L12 19.527l1.265-2.53 1.157-.066a42.137 42.137 0 0 0 4.227-.454A33.913 33.913 0 0 0 12 4.09a33.913 33.913 0 0 0-6.649 12.387c1.395.222 2.805.374 4.227.454zM12 15a3 3 0 1 1 0-6 3 3 0 0 1 0 6zm0-2a1 1 0 1 0 0-2 1 1 0 0 0 0 2z"/></svg>
|
||||||
|
Before Width: | Height: | Size: 608 B After Width: | Height: | Size: 588 B |
@@ -1 +1 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16"><path fill="none" d="M0 0h24v24H0z"/><path d="M11.38 2.019a7.5 7.5 0 1 0 10.6 10.6C21.662 17.854 17.316 22 12.001 22 6.477 22 2 17.523 2 12c0-5.315 4.146-9.661 9.38-9.981z"/></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M11.38 2.019a7.5 7.5 0 1 0 10.6 10.6C21.662 17.854 17.316 22 12.001 22 6.477 22 2 17.523 2 12c0-5.315 4.146-9.661 9.38-9.981z"/></svg>
|
||||||
|
Before Width: | Height: | Size: 263 B After Width: | Height: | Size: 263 B |
@@ -1 +1 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16"><path fill="none" d="M0 0h24v24H0z"/><path d="M12 18a6 6 0 1 1 0-12 6 6 0 0 1 0 12zM11 1h2v3h-2V1zm0 19h2v3h-2v-3zM3.515 4.929l1.414-1.414L7.05 5.636 5.636 7.05 3.515 4.93zM16.95 18.364l1.414-1.414 2.121 2.121-1.414 1.414-2.121-2.121zm2.121-14.85l1.414 1.415-2.121 2.121-1.414-1.414 2.121-2.121zM5.636 16.95l1.414 1.414-2.121 2.121-1.414-1.414 2.121-2.121zM23 11v2h-3v-2h3zM4 11v2H1v-2h3z"/></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M12 18a6 6 0 1 1 0-12 6 6 0 0 1 0 12zM11 1h2v3h-2V1zm0 19h2v3h-2v-3zM3.515 4.929l1.414-1.414L7.05 5.636 5.636 7.05 3.515 4.93zM16.95 18.364l1.414-1.414 2.121 2.121-1.414 1.414-2.121-2.121zm2.121-14.85 1.414 1.415-2.121 2.121-1.414-1.414 2.121-2.121zM5.636 16.95l1.414 1.414-2.121 2.121-1.414-1.414 2.121-2.121zM23 11v2h-3v-2h3zM4 11v2H1v-2h3z"/></svg>
|
||||||
|
Before Width: | Height: | Size: 480 B After Width: | Height: | Size: 480 B |
@@ -1 +1 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--ant-design" width="20" height="20" preserveAspectRatio="xMidYMid meet" viewBox="0 0 1024 1024"><path fill="currentColor" d="M864 170h-60c-4.4 0-8 3.6-8 8v518H310v-73c0-6.7-7.8-10.5-13-6.3l-141.9 112a8 8 0 0 0 0 12.6l141.9 112c5.3 4.2 13 .4 13-6.3v-75h498c35.3 0 64-28.7 64-64V178c0-4.4-3.6-8-8-8z"></path></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" aria-hidden="true" class="iconify iconify--ant-design" viewBox="0 0 1024 1024"><path fill="currentColor" d="M864 170h-60c-4.4 0-8 3.6-8 8v518H310v-73c0-6.7-7.8-10.5-13-6.3l-141.9 112a8 8 0 0 0 0 12.6l141.9 112c5.3 4.2 13 .4 13-6.3v-75h498c35.3 0 64-28.7 64-64V178c0-4.4-3.6-8-8-8z"/></svg>
|
||||||
|
Before Width: | Height: | Size: 448 B After Width: | Height: | Size: 352 B |
@@ -1 +1 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" class="re-screen" color="#00000073" preserveAspectRatio="xMidYMid meet" viewBox="0 0 16 16"><g fill="currentColor"><path d="M3.5 4H1V3h2V1h1v2.5l-.5.5zM13 3V1h-1v2.5l.5.5H15V3h-2zm-1 9.5V15h1v-2h2v-1h-2.5l-.5.5zM1 12v1h2v2h1v-2.5l-.5-.5H1zm11-1.5l-.5.5h-7l-.5-.5v-5l.5-.5h7l.5.5v5zM10 7H6v2h4V7z"></path></g></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" aria-hidden="true" class="re-screen" color="#00000073" viewBox="0 0 16 16"><path fill="currentColor" d="M3.5 4H1V3h2V1h1v2.5l-.5.5zM13 3V1h-1v2.5l.5.5H15V3h-2zm-1 9.5V15h1v-2h2v-1h-2.5l-.5.5zM1 12v1h2v2h1v-2.5l-.5-.5H1zm11-1.5-.5.5h-7l-.5-.5v-5l.5-.5h7l.5.5v5zM10 7H6v2h4V7z"/></svg>
|
||||||
|
Before Width: | Height: | Size: 452 B After Width: | Height: | Size: 348 B |
@@ -1 +1 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" class="re-screen" color="#00000073" preserveAspectRatio="xMidYMid meet" viewBox="0 0 16 16"><g fill="currentColor"><path d="M3 12h10V4H3v8zm2-6h6v4H5V6zM2 6H1V2.5l.5-.5H5v1H2v3zm13-3.5V6h-1V3h-3V2h3.5l.5.5zM14 10h1v3.5l-.5.5H11v-1h3v-3zM2 13h3v1H1.5l-.5-.5V10h1v3z"></path></g></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" aria-hidden="true" class="re-screen" color="#00000073" viewBox="0 0 16 16"><path fill="currentColor" d="M3 12h10V4H3v8zm2-6h6v4H5V6zM2 6H1V2.5l.5-.5H5v1H2v3zm13-3.5V6h-1V3h-3V2h3.5l.5.5zM14 10h1v3.5l-.5.5H11v-1h3v-3zM2 13h3v1H1.5l-.5-.5V10h1v3z"/></svg>
|
||||||
|
Before Width: | Height: | Size: 421 B After Width: | Height: | Size: 318 B |
@@ -1 +1 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--mdi" width="20" height="20" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M1 7h6v2H3v2h4v2H3v2h4v2H1V7m10 0h4v2h-4v2h2a2 2 0 0 1 2 2v2c0 1.11-.89 2-2 2H9v-2h4v-2h-2a2 2 0 0 1-2-2V9c0-1.1.9-2 2-2m8 0h2a2 2 0 0 1 2 2v1h-2V9h-2v6h2v-1h2v1c0 1.11-.89 2-2 2h-2a2 2 0 0 1-2-2V9c0-1.1.9-2 2-2Z"></path></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" aria-hidden="true" class="iconify iconify--mdi" viewBox="0 0 24 24"><path fill="currentColor" d="M1 7h6v2H3v2h4v2H3v2h4v2H1V7m10 0h4v2h-4v2h2a2 2 0 0 1 2 2v2c0 1.11-.89 2-2 2H9v-2h4v-2h-2a2 2 0 0 1-2-2V9c0-1.1.9-2 2-2m8 0h2a2 2 0 0 1 2 2v1h-2V9h-2v6h2v-1h2v1c0 1.11-.89 2-2 2h-2a2 2 0 0 1-2-2V9c0-1.1.9-2 2-2Z"/></svg>
|
||||||
|
Before Width: | Height: | Size: 477 B After Width: | Height: | Size: 381 B |
@@ -2,7 +2,7 @@ import iconifyIconOffline from "./src/iconifyIconOffline";
|
|||||||
import iconifyIconOnline from "./src/iconifyIconOnline";
|
import iconifyIconOnline from "./src/iconifyIconOnline";
|
||||||
import fontIcon from "./src/iconfont";
|
import fontIcon from "./src/iconfont";
|
||||||
|
|
||||||
/** 离线图标组件 */
|
/** 本地图标组件 */
|
||||||
const IconifyIconOffline = iconifyIconOffline;
|
const IconifyIconOffline = iconifyIconOffline;
|
||||||
/** 在线图标组件 */
|
/** 在线图标组件 */
|
||||||
const IconifyIconOnline = iconifyIconOnline;
|
const IconifyIconOnline = iconifyIconOnline;
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ import { h, defineComponent, Component } from "vue";
|
|||||||
import { IconifyIconOnline, IconifyIconOffline, FontIcon } from "../index";
|
import { IconifyIconOnline, IconifyIconOffline, FontIcon } from "../index";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 支持fontawesome4、5+、iconfont、remixicon、element-plus的icons、自定义svg
|
* 支持 `iconfont`、自定义 `svg` 以及 `iconify` 中所有的图标
|
||||||
|
* @see 点击查看文档图标篇 {@link https://yiming_chang.gitee.io/pure-admin-doc/pages/icon/}
|
||||||
* @param icon 必传 图标
|
* @param icon 必传 图标
|
||||||
* @param attrs 可选 iconType 属性
|
* @param attrs 可选 iconType 属性
|
||||||
* @returns Component
|
* @returns Component
|
||||||
@@ -33,12 +34,23 @@ export function useRenderIcon(icon: any, attrs?: iconType): Component {
|
|||||||
} else if (typeof icon === "function" || typeof icon?.render === "function") {
|
} else if (typeof icon === "function" || typeof icon?.render === "function") {
|
||||||
// svg
|
// svg
|
||||||
return icon;
|
return icon;
|
||||||
|
} else if (typeof icon === "object") {
|
||||||
|
return defineComponent({
|
||||||
|
name: "OfflineIcon",
|
||||||
|
render() {
|
||||||
|
return h(IconifyIconOffline, {
|
||||||
|
icon: icon,
|
||||||
|
...attrs
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
|
// 通过是否存在 : 符号来判断是在线还是本地图标,存在即是在线图标,反之
|
||||||
return defineComponent({
|
return defineComponent({
|
||||||
name: "Icon",
|
name: "Icon",
|
||||||
render() {
|
render() {
|
||||||
const IconifyIcon =
|
const IconifyIcon =
|
||||||
attrs && attrs["online"] ? IconifyIconOnline : IconifyIconOffline;
|
icon && icon.includes(":") ? IconifyIconOnline : IconifyIconOffline;
|
||||||
return h(IconifyIcon, {
|
return h(IconifyIcon, {
|
||||||
icon: icon,
|
icon: icon,
|
||||||
...attrs
|
...attrs
|
||||||
|
|||||||
@@ -1,80 +1,22 @@
|
|||||||
import { h, defineComponent } from "vue";
|
import { h, defineComponent } from "vue";
|
||||||
import { Icon as IconifyIcon, addIcon } from "@iconify/vue/dist/offline";
|
import { Icon as IconifyIcon, addIcon } from "@iconify/vue/dist/offline";
|
||||||
|
|
||||||
// element-plus icon
|
// Iconify Icon在Vue里本地使用(用于内网环境)https://docs.iconify.design/icon-components/vue/offline.html
|
||||||
import Check from "@iconify-icons/ep/check";
|
|
||||||
import HomeFilled from "@iconify-icons/ep/home-filled";
|
|
||||||
import Lollipop from "@iconify-icons/ep/lollipop";
|
|
||||||
import RefreshRight from "@iconify-icons/ep/refresh-right";
|
|
||||||
import Close from "@iconify-icons/ep/close";
|
|
||||||
import CloseBold from "@iconify-icons/ep/close-bold";
|
|
||||||
import Bell from "@iconify-icons/ep/bell";
|
|
||||||
import Search from "@iconify-icons/ep/search";
|
|
||||||
addIcon("check", Check);
|
|
||||||
addIcon("home-filled", HomeFilled);
|
|
||||||
addIcon("lollipop", Lollipop);
|
|
||||||
addIcon("refresh-right", RefreshRight);
|
|
||||||
addIcon("close", Close);
|
|
||||||
addIcon("close-bold", CloseBold);
|
|
||||||
addIcon("bell", Bell);
|
|
||||||
addIcon("search", Search);
|
|
||||||
|
|
||||||
// remixicon
|
|
||||||
import ArrowRightSLine from "@iconify-icons/ri/arrow-right-s-line";
|
|
||||||
import ArrowLeftSLine from "@iconify-icons/ri/arrow-left-s-line";
|
|
||||||
import LogoutCircleRLine from "@iconify-icons/ri/logout-circle-r-line";
|
|
||||||
import InformationLine from "@iconify-icons/ri/information-line";
|
|
||||||
import ArrowUpLine from "@iconify-icons/ri/arrow-up-line";
|
|
||||||
import ArrowDownLine from "@iconify-icons/ri/arrow-down-line";
|
|
||||||
import Bookmark2Line from "@iconify-icons/ri/bookmark-2-line";
|
|
||||||
import User from "@iconify-icons/ri/user-3-fill";
|
|
||||||
import Lock from "@iconify-icons/ri/lock-fill";
|
|
||||||
import MenuUnfold from "@iconify-icons/ri/menu-unfold-fill";
|
|
||||||
import MenuFold from "@iconify-icons/ri/menu-fold-fill";
|
|
||||||
import Setting from "@iconify-icons/ri/settings-3-line";
|
|
||||||
import ArrowDown from "@iconify-icons/ri/arrow-down-s-line";
|
|
||||||
import CloseLeftTags from "@iconify-icons/ri/text-direction-r";
|
|
||||||
import CloseRightTags from "@iconify-icons/ri/text-direction-l";
|
|
||||||
import CloseOtherTags from "@iconify-icons/ri/text-spacing";
|
|
||||||
import CloseAllTags from "@iconify-icons/ri/subtract-line";
|
|
||||||
import Fullscreen from "@iconify-icons/ri/fullscreen-fill";
|
|
||||||
import ExitFullscreen from "@iconify-icons/ri/fullscreen-exit-fill";
|
|
||||||
addIcon("arrow-right-s-line", ArrowRightSLine);
|
|
||||||
addIcon("arrow-left-s-line", ArrowLeftSLine);
|
|
||||||
addIcon("logout-circle-r-line", LogoutCircleRLine);
|
|
||||||
addIcon("information-line", InformationLine);
|
|
||||||
addIcon("arrow-up-line", ArrowUpLine);
|
|
||||||
addIcon("arrow-down-line", ArrowDownLine);
|
|
||||||
addIcon("bookmark-2-line", Bookmark2Line);
|
|
||||||
addIcon("user", User);
|
|
||||||
addIcon("lock", Lock);
|
|
||||||
addIcon("menu-unfold", MenuUnfold);
|
|
||||||
addIcon("menu-fold", MenuFold);
|
|
||||||
addIcon("setting", Setting);
|
|
||||||
addIcon("arrow-down", ArrowDown);
|
|
||||||
addIcon("close-left-tags", CloseLeftTags);
|
|
||||||
addIcon("close-right-tags", CloseRightTags);
|
|
||||||
addIcon("close-other-tags", CloseOtherTags);
|
|
||||||
addIcon("close-all-tags", CloseAllTags);
|
|
||||||
addIcon("fullscreen", Fullscreen);
|
|
||||||
addIcon("exit-fullscreen", ExitFullscreen);
|
|
||||||
|
|
||||||
// Iconify Icon在Vue里离线使用(用于内网环境)https://docs.iconify.design/icon-components/vue/offline.html
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "IconifyIconOffline",
|
name: "IconifyIconOffline",
|
||||||
components: { IconifyIcon },
|
components: { IconifyIcon },
|
||||||
props: {
|
props: {
|
||||||
icon: {
|
icon: {
|
||||||
type: String,
|
default: null
|
||||||
default: ""
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
render() {
|
render() {
|
||||||
|
if (typeof this.icon === "object") addIcon(this.icon, this.icon);
|
||||||
const attrs = this.$attrs;
|
const attrs = this.$attrs;
|
||||||
return h(
|
return h(
|
||||||
IconifyIcon,
|
IconifyIcon,
|
||||||
{
|
{
|
||||||
icon: `${this.icon}`,
|
icon: this.icon,
|
||||||
style: attrs?.style
|
style: attrs?.style
|
||||||
? Object.assign(attrs.style, { outline: "none" })
|
? Object.assign(attrs.style, { outline: "none" })
|
||||||
: { outline: "none" },
|
: { outline: "none" },
|
||||||
|
|||||||
14
src/components/ReIcon/src/offlineIcon.ts
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import { addIcon } from "@iconify/vue/dist/offline";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 这里存放本地图标,在 src/layout/index.vue 文件中加载,避免在首启动加载
|
||||||
|
*/
|
||||||
|
|
||||||
|
// 本地菜单图标,后端在路由的icon中返回对应的图标字符串并且前端在此处使用addIcon添加即可渲染菜单图标
|
||||||
|
import HomeFilled from "@iconify-icons/ep/home-filled";
|
||||||
|
import InformationLine from "@iconify-icons/ri/information-line";
|
||||||
|
import Lollipop from "@iconify-icons/ep/lollipop";
|
||||||
|
|
||||||
|
addIcon("homeFilled", HomeFilled);
|
||||||
|
addIcon("informationLine", InformationLine);
|
||||||
|
addIcon("lollipop", Lollipop);
|
||||||
@@ -11,7 +11,6 @@ export interface iconType {
|
|||||||
horizontalAlign?: boolean;
|
horizontalAlign?: boolean;
|
||||||
verticalAlign?: boolean;
|
verticalAlign?: boolean;
|
||||||
align?: string;
|
align?: string;
|
||||||
online?: boolean;
|
|
||||||
onLoad?: Function;
|
onLoad?: Function;
|
||||||
includes?: Function;
|
includes?: Function;
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
import { App } from "vue";
|
import { App } from "vue";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { loadEnv } from "@build/index";
|
|
||||||
|
|
||||||
let config: object = {};
|
let config: object = {};
|
||||||
const { VITE_PUBLIC_PATH } = loadEnv();
|
const { VITE_PUBLIC_PATH } = import.meta.env;
|
||||||
|
|
||||||
const setConfig = (cfg?: unknown) => {
|
const setConfig = (cfg?: unknown) => {
|
||||||
config = Object.assign(config, cfg);
|
config = Object.assign(config, cfg);
|
||||||
@@ -31,7 +30,6 @@ const getConfig = (key?: string): ServerConfigs => {
|
|||||||
export const getServerConfig = async (app: App): Promise<undefined> => {
|
export const getServerConfig = async (app: App): Promise<undefined> => {
|
||||||
app.config.globalProperties.$config = getConfig();
|
app.config.globalProperties.$config = getConfig();
|
||||||
return axios({
|
return axios({
|
||||||
baseURL: "",
|
|
||||||
method: "get",
|
method: "get",
|
||||||
url: `${VITE_PUBLIC_PATH}serverConfig.json`
|
url: `${VITE_PUBLIC_PATH}serverConfig.json`
|
||||||
})
|
})
|
||||||
@@ -44,8 +42,6 @@ export const getServerConfig = async (app: App): Promise<undefined> => {
|
|||||||
// 设置全局配置
|
// 设置全局配置
|
||||||
setConfig($config);
|
setConfig($config);
|
||||||
}
|
}
|
||||||
// 设置全局baseURL
|
|
||||||
app.config.globalProperties.$baseUrl = $config.baseURL;
|
|
||||||
return $config;
|
return $config;
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ export const auth: Directive = {
|
|||||||
mounted(el: HTMLElement, binding: DirectiveBinding) {
|
mounted(el: HTMLElement, binding: DirectiveBinding) {
|
||||||
const { value } = binding;
|
const { value } = binding;
|
||||||
if (value) {
|
if (value) {
|
||||||
!hasAuth(value) && el.parentNode.removeChild(el);
|
!hasAuth(value) && el.parentNode?.removeChild(el);
|
||||||
} else {
|
} else {
|
||||||
throw new Error("need auths! Like v-auth=\"['btn.add','btn.edit']\"");
|
throw new Error("need auths! Like v-auth=\"['btn.add','btn.edit']\"");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import mixNav from "./sidebar/mixNav.vue";
|
|||||||
import { useNav } from "@/layout/hooks/useNav";
|
import { useNav } from "@/layout/hooks/useNav";
|
||||||
import Breadcrumb from "./sidebar/breadCrumb.vue";
|
import Breadcrumb from "./sidebar/breadCrumb.vue";
|
||||||
import topCollapse from "./sidebar/topCollapse.vue";
|
import topCollapse from "./sidebar/topCollapse.vue";
|
||||||
|
import LogoutCircleRLine from "@iconify-icons/ri/logout-circle-r-line";
|
||||||
|
import Setting from "@iconify-icons/ri/settings-3-line";
|
||||||
|
|
||||||
const {
|
const {
|
||||||
layout,
|
layout,
|
||||||
@@ -54,7 +56,7 @@ const {
|
|||||||
<el-dropdown-menu class="logout">
|
<el-dropdown-menu class="logout">
|
||||||
<el-dropdown-item @click="logout">
|
<el-dropdown-item @click="logout">
|
||||||
<IconifyIconOffline
|
<IconifyIconOffline
|
||||||
icon="logout-circle-r-line"
|
:icon="LogoutCircleRLine"
|
||||||
style="margin: 5px"
|
style="margin: 5px"
|
||||||
/>
|
/>
|
||||||
退出系统
|
退出系统
|
||||||
@@ -67,7 +69,7 @@ const {
|
|||||||
title="打开项目配置"
|
title="打开项目配置"
|
||||||
@click="onPanel"
|
@click="onPanel"
|
||||||
>
|
>
|
||||||
<IconifyIconOffline icon="setting" />
|
<IconifyIconOffline :icon="Setting" />
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,61 +2,45 @@
|
|||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import { noticesData } from "./data";
|
import { noticesData } from "./data";
|
||||||
import NoticeList from "./noticeList.vue";
|
import NoticeList from "./noticeList.vue";
|
||||||
import { templateRef } from "@vueuse/core";
|
import Bell from "@iconify-icons/ep/bell";
|
||||||
import { Tabs, TabPane } from "@pureadmin/components";
|
|
||||||
|
|
||||||
const dropdownDom = templateRef<ElRef | null>("dropdownDom", null);
|
const noticesNum = ref(0);
|
||||||
const activeName = ref(noticesData[0].name);
|
|
||||||
const notices = ref(noticesData);
|
const notices = ref(noticesData);
|
||||||
|
const activeKey = ref(noticesData[0].key);
|
||||||
|
|
||||||
let noticesNum = ref(0);
|
notices.value.map(v => (noticesNum.value += v.list.length));
|
||||||
notices.value.forEach(notice => {
|
|
||||||
noticesNum.value += notice.list.length;
|
|
||||||
});
|
|
||||||
|
|
||||||
function tabClick() {
|
|
||||||
(dropdownDom as any).value.handleOpen();
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<el-dropdown ref="dropdownDom" trigger="click" placement="bottom-end">
|
<el-dropdown trigger="click" placement="bottom-end">
|
||||||
<span class="dropdown-badge navbar-bg-hover select-none">
|
<span class="dropdown-badge navbar-bg-hover select-none">
|
||||||
<el-badge :value="noticesNum" :max="99">
|
<el-badge :value="noticesNum" :max="99">
|
||||||
<span class="header-notice-icon">
|
<span class="header-notice-icon">
|
||||||
<IconifyIconOffline icon="bell" />
|
<IconifyIconOffline :icon="Bell" />
|
||||||
</span>
|
</span>
|
||||||
</el-badge>
|
</el-badge>
|
||||||
</span>
|
</span>
|
||||||
<template #dropdown>
|
<template #dropdown>
|
||||||
<el-dropdown-menu>
|
<el-dropdown-menu>
|
||||||
<Tabs
|
<el-tabs :stretch="true" v-model="activeKey" class="dropdown-tabs">
|
||||||
centered
|
|
||||||
class="dropdown-tabs"
|
|
||||||
v-model:activeName="activeName"
|
|
||||||
@tabClick="tabClick"
|
|
||||||
>
|
|
||||||
<template v-for="item in notices" :key="item.key">
|
<template v-for="item in notices" :key="item.key">
|
||||||
<TabPane :tab="`${item.name}(${item.list.length})`">
|
<el-tab-pane
|
||||||
|
:label="`${item.name}(${item.list.length})`"
|
||||||
|
:name="`${item.key}`"
|
||||||
|
>
|
||||||
<el-scrollbar max-height="330px">
|
<el-scrollbar max-height="330px">
|
||||||
<div class="noticeList-container">
|
<div class="noticeList-container">
|
||||||
<NoticeList :list="item.list" />
|
<NoticeList :list="item.list" />
|
||||||
</div>
|
</div>
|
||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
</TabPane>
|
</el-tab-pane>
|
||||||
</template>
|
</template>
|
||||||
</Tabs>
|
</el-tabs>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</template>
|
</template>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style>
|
|
||||||
.ant-tabs-dropdown {
|
|
||||||
z-index: 2900 !important;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.dropdown-badge {
|
.dropdown-badge {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -72,30 +56,22 @@ function tabClick() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.dropdown-tabs {
|
.dropdown-tabs {
|
||||||
width: 336px;
|
width: 330px;
|
||||||
background-color: #fff;
|
|
||||||
box-shadow: 0 2px 8px rgb(0 0 0 / 15%);
|
.noticeList-container {
|
||||||
border-radius: 4px;
|
padding: 15px 24px 0 24px;
|
||||||
|
}
|
||||||
|
|
||||||
:deep(.el-tabs__header) {
|
:deep(.el-tabs__header) {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.el-tabs__nav-scroll) {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.el-tabs__nav-wrap)::after {
|
:deep(.el-tabs__nav-wrap)::after {
|
||||||
height: 1px;
|
height: 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.noticeList-container) {
|
:deep(.el-tabs__nav-wrap) {
|
||||||
padding: 15px 24px 0 24px;
|
padding: 0 36px 0 36px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.ant-tabs-nav) {
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ListItem } from "./data";
|
import { ListItem } from "./data";
|
||||||
import { ref, PropType, nextTick } from "vue";
|
import { ref, PropType, nextTick } from "vue";
|
||||||
|
import { useNav } from "@/layout/hooks/useNav";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
noticeItem: {
|
noticeItem: {
|
||||||
@@ -13,6 +14,7 @@ const titleRef = ref(null);
|
|||||||
const titleTooltip = ref(false);
|
const titleTooltip = ref(false);
|
||||||
const descriptionRef = ref(null);
|
const descriptionRef = ref(null);
|
||||||
const descriptionTooltip = ref(false);
|
const descriptionTooltip = ref(false);
|
||||||
|
const { tooltipEffect } = useNav();
|
||||||
|
|
||||||
function hoverTitle() {
|
function hoverTitle() {
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
@@ -24,11 +26,11 @@ function hoverTitle() {
|
|||||||
|
|
||||||
function hoverDescription(event, description) {
|
function hoverDescription(event, description) {
|
||||||
// currentWidth 为文本在页面中所占的宽度,创建标签,加入到页面,获取currentWidth ,最后在移除
|
// currentWidth 为文本在页面中所占的宽度,创建标签,加入到页面,获取currentWidth ,最后在移除
|
||||||
let tempTag = document.createElement("span");
|
const tempTag = document.createElement("span");
|
||||||
tempTag.innerText = description;
|
tempTag.innerText = description;
|
||||||
tempTag.className = "getDescriptionWidth";
|
tempTag.className = "getDescriptionWidth";
|
||||||
document.querySelector("body").appendChild(tempTag);
|
document.querySelector("body").appendChild(tempTag);
|
||||||
let currentWidth = (
|
const currentWidth = (
|
||||||
document.querySelector(".getDescriptionWidth") as HTMLSpanElement
|
document.querySelector(".getDescriptionWidth") as HTMLSpanElement
|
||||||
).offsetWidth;
|
).offsetWidth;
|
||||||
document.querySelector(".getDescriptionWidth").remove();
|
document.querySelector(".getDescriptionWidth").remove();
|
||||||
@@ -57,6 +59,7 @@ function hoverDescription(event, description) {
|
|||||||
<div class="notice-text-title text-[#000000d9] dark:text-white">
|
<div class="notice-text-title text-[#000000d9] dark:text-white">
|
||||||
<el-tooltip
|
<el-tooltip
|
||||||
popper-class="notice-title-popper"
|
popper-class="notice-title-popper"
|
||||||
|
:effect="tooltipEffect"
|
||||||
:disabled="!titleTooltip"
|
:disabled="!titleTooltip"
|
||||||
:content="props.noticeItem.title"
|
:content="props.noticeItem.title"
|
||||||
placement="top-start"
|
placement="top-start"
|
||||||
@@ -81,6 +84,7 @@ function hoverDescription(event, description) {
|
|||||||
|
|
||||||
<el-tooltip
|
<el-tooltip
|
||||||
popper-class="notice-title-popper"
|
popper-class="notice-title-popper"
|
||||||
|
:effect="tooltipEffect"
|
||||||
:disabled="!descriptionTooltip"
|
:disabled="!descriptionTooltip"
|
||||||
:content="props.noticeItem.description"
|
:content="props.noticeItem.description"
|
||||||
placement="top-start"
|
placement="top-start"
|
||||||
|
|||||||
@@ -1,10 +1,27 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from "vue";
|
import { ref, computed } from "vue";
|
||||||
import { onClickOutside } from "@vueuse/core";
|
|
||||||
import { emitter } from "@/utils/mitt";
|
import { emitter } from "@/utils/mitt";
|
||||||
|
import { onClickOutside } from "@vueuse/core";
|
||||||
|
import Close from "@iconify-icons/ep/close";
|
||||||
|
|
||||||
let show = ref<Boolean>(false);
|
|
||||||
const target = ref(null);
|
const target = ref(null);
|
||||||
|
const show = ref<Boolean>(false);
|
||||||
|
|
||||||
|
const iconClass = computed(() => {
|
||||||
|
return [
|
||||||
|
"mr-[20px]",
|
||||||
|
"outline-none",
|
||||||
|
"width-[20px]",
|
||||||
|
"height-[20px]",
|
||||||
|
"rounded-[4px]",
|
||||||
|
"cursor-pointer",
|
||||||
|
"transition-colors",
|
||||||
|
"hover:bg-[#0000000f]",
|
||||||
|
"dark:hover:bg-[#ffffff1f]",
|
||||||
|
"dark:hover:text-[#ffffffd9]"
|
||||||
|
];
|
||||||
|
});
|
||||||
|
|
||||||
onClickOutside(target, (event: any) => {
|
onClickOutside(target, (event: any) => {
|
||||||
if (event.clientX > target.value.offsetLeft) return;
|
if (event.clientX > target.value.offsetLeft) return;
|
||||||
show.value = false;
|
show.value = false;
|
||||||
@@ -21,11 +38,13 @@ emitter.on("openPanel", () => {
|
|||||||
<div ref="target" class="right-panel bg-bg_color">
|
<div ref="target" class="right-panel bg-bg_color">
|
||||||
<div class="right-panel-items">
|
<div class="right-panel-items">
|
||||||
<div class="project-configuration">
|
<div class="project-configuration">
|
||||||
<h3 class="dark:text-white">项目配置</h3>
|
<h4 class="dark:text-white">项目配置</h4>
|
||||||
<span title="关闭配置">
|
<span title="关闭配置" :class="iconClass">
|
||||||
<IconifyIconOffline
|
<IconifyIconOffline
|
||||||
class="dark:text-white"
|
class="dark:text-white"
|
||||||
icon="close"
|
width="20px"
|
||||||
|
height="20px"
|
||||||
|
:icon="Close"
|
||||||
@click="show = !show"
|
@click="show = !show"
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
@@ -68,7 +87,6 @@ emitter.on("openPanel", () => {
|
|||||||
box-shadow: 0 0 15px 0 rgba(0, 0, 0, 0.05);
|
box-shadow: 0 0 15px 0 rgba(0, 0, 0, 0.05);
|
||||||
transition: all 0.25s cubic-bezier(0.7, 0.3, 0.1, 1);
|
transition: all 0.25s cubic-bezier(0.7, 0.3, 0.1, 1);
|
||||||
transform: translate(100%);
|
transform: translate(100%);
|
||||||
// background: #fff;
|
|
||||||
z-index: 40000;
|
z-index: 40000;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,16 +142,6 @@ emitter.on("openPanel", () => {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
top: 15px;
|
top: 15px;
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
|
|
||||||
svg {
|
|
||||||
font-size: 20px;
|
|
||||||
margin-right: 20px;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
cursor: pointer;
|
|
||||||
color: var(--el-color-primary);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.el-divider--horizontal) {
|
:deep(.el-divider--horizontal) {
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
确认
|
确认
|
||||||
</span>
|
</span>
|
||||||
<span class="search-footer-item">
|
<span class="search-footer-item">
|
||||||
<IconifyIconOffline icon="arrow-up-line" class="icon" />
|
<IconifyIconOffline :icon="ArrowUpLine" class="icon" />
|
||||||
<IconifyIconOffline icon="arrow-down-line" class="icon" />
|
<IconifyIconOffline :icon="ArrowDownLine" class="icon" />
|
||||||
切换
|
切换
|
||||||
</span>
|
</span>
|
||||||
<span class="search-footer-item">
|
<span class="search-footer-item">
|
||||||
@@ -16,10 +16,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script setup lang="ts">
|
||||||
import enterOutlined from "@/assets/svg/enter_outlined.svg?component";
|
import ArrowUpLine from "@iconify-icons/ri/arrow-up-line";
|
||||||
|
import ArrowDownLine from "@iconify-icons/ri/arrow-down-line";
|
||||||
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";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.search-footer {
|
.search-footer {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
<script lang="ts" setup>
|
<script setup lang="ts">
|
||||||
import { useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
import { cloneDeep } from "lodash-unified";
|
import { cloneDeep } from "@pureadmin/utils";
|
||||||
import SearchResult from "./SearchResult.vue";
|
import SearchResult from "./SearchResult.vue";
|
||||||
import SearchFooter from "./SearchFooter.vue";
|
import SearchFooter from "./SearchFooter.vue";
|
||||||
|
import { deleteChildren } from "@/utils/tree";
|
||||||
import { useNav } from "@/layout/hooks/useNav";
|
import { useNav } from "@/layout/hooks/useNav";
|
||||||
import { deleteChildren } from "@pureadmin/utils";
|
|
||||||
import { useDebounceFn, onKeyStroke } from "@vueuse/core";
|
import { useDebounceFn, onKeyStroke } from "@vueuse/core";
|
||||||
import { ref, watch, computed, nextTick, shallowRef } from "vue";
|
import { ref, watch, computed, nextTick, shallowRef } from "vue";
|
||||||
import { usePermissionStoreHook } from "@/store/modules/permission";
|
import { usePermissionStoreHook } from "@/store/modules/permission";
|
||||||
|
import Search from "@iconify-icons/ep/search";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
/** 弹窗显隐 */
|
/** 弹窗显隐 */
|
||||||
@@ -147,7 +148,7 @@ onKeyStroke("ArrowDown", handleDown);
|
|||||||
>
|
>
|
||||||
<template #prefix>
|
<template #prefix>
|
||||||
<span class="el-input__icon">
|
<span class="el-input__icon">
|
||||||
<IconifyIconOffline icon="search" />
|
<IconifyIconOffline :icon="Search" />
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
<script lang="ts" setup>
|
<script setup lang="ts">
|
||||||
import { computed } from "vue";
|
import { computed } from "vue";
|
||||||
import { useEpThemeStoreHook } from "@/store/modules/epTheme";
|
import { useEpThemeStoreHook } from "@/store/modules/epTheme";
|
||||||
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
|
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
|
||||||
import enterOutlined from "@/assets/svg/enter_outlined.svg?component";
|
import enterOutlined from "@/assets/svg/enter_outlined.svg?component";
|
||||||
|
import Bookmark2Line from "@iconify-icons/ri/bookmark-2-line";
|
||||||
|
|
||||||
interface optionsItem {
|
interface optionsItem {
|
||||||
path: string;
|
path: string;
|
||||||
@@ -64,7 +65,7 @@ function handleTo() {
|
|||||||
@click="handleTo"
|
@click="handleTo"
|
||||||
@mouseenter="handleMouse(item)"
|
@mouseenter="handleMouse(item)"
|
||||||
>
|
>
|
||||||
<component :is="useRenderIcon(item.meta?.icon ?? 'bookmark-2-line')" />
|
<component :is="useRenderIcon(item.meta?.icon ?? Bookmark2Line)" />
|
||||||
<span class="result-item-title">{{ item.meta?.title }}</span>
|
<span class="result-item-title">{{ item.meta?.title }}</span>
|
||||||
<enterOutlined />
|
<enterOutlined />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
<script lang="ts" setup>
|
<script setup lang="ts">
|
||||||
import { SearchModal } from "./components";
|
import { SearchModal } from "./components";
|
||||||
import { useBoolean } from "../../hooks/useBoolean";
|
import { useBoolean } from "../../hooks/useBoolean";
|
||||||
|
import Search from "@iconify-icons/ep/search";
|
||||||
|
|
||||||
const { bool: show, toggle } = useBoolean();
|
const { bool: show, toggle } = useBoolean();
|
||||||
function handleSearch() {
|
function handleSearch() {
|
||||||
toggle();
|
toggle();
|
||||||
@@ -12,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="search" />
|
<IconifyIconOffline :icon="Search" />
|
||||||
</div>
|
</div>
|
||||||
<SearchModal v-model:value="show" />
|
<SearchModal v-model:value="show" />
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -6,20 +6,8 @@ import {
|
|||||||
reactive,
|
reactive,
|
||||||
computed,
|
computed,
|
||||||
nextTick,
|
nextTick,
|
||||||
useCssModule
|
onBeforeMount
|
||||||
} from "vue";
|
} from "vue";
|
||||||
import { getConfig } from "@/config";
|
|
||||||
import { useRouter } from "vue-router";
|
|
||||||
import panel from "../panel/index.vue";
|
|
||||||
import { emitter } from "@/utils/mitt";
|
|
||||||
import { resetRouter } from "@/router";
|
|
||||||
import { templateRef } from "@vueuse/core";
|
|
||||||
import { removeToken } from "@/utils/auth";
|
|
||||||
import { routerArrays } from "@/layout/types";
|
|
||||||
import { useNav } from "@/layout/hooks/useNav";
|
|
||||||
import { useAppStoreHook } from "@/store/modules/app";
|
|
||||||
import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
|
|
||||||
import { useDataThemeChange } from "@/layout/hooks/useDataThemeChange";
|
|
||||||
import {
|
import {
|
||||||
useDark,
|
useDark,
|
||||||
debounce,
|
debounce,
|
||||||
@@ -27,23 +15,34 @@ import {
|
|||||||
storageLocal,
|
storageLocal,
|
||||||
storageSession
|
storageSession
|
||||||
} from "@pureadmin/utils";
|
} from "@pureadmin/utils";
|
||||||
|
import { getConfig } from "@/config";
|
||||||
|
import { useRouter } from "vue-router";
|
||||||
|
import panel from "../panel/index.vue";
|
||||||
|
import { emitter } from "@/utils/mitt";
|
||||||
|
import { resetRouter } from "@/router";
|
||||||
|
import { removeToken } from "@/utils/auth";
|
||||||
|
import { routerArrays } from "@/layout/types";
|
||||||
|
import { useNav } from "@/layout/hooks/useNav";
|
||||||
|
import { useAppStoreHook } from "@/store/modules/app";
|
||||||
import { toggleTheme } from "@pureadmin/theme/dist/browser-utils";
|
import { toggleTheme } from "@pureadmin/theme/dist/browser-utils";
|
||||||
|
import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
|
||||||
|
import { useDataThemeChange } from "@/layout/hooks/useDataThemeChange";
|
||||||
|
|
||||||
import dayIcon from "@/assets/svg/day.svg?component";
|
import dayIcon from "@/assets/svg/day.svg?component";
|
||||||
import darkIcon from "@/assets/svg/dark.svg?component";
|
import darkIcon from "@/assets/svg/dark.svg?component";
|
||||||
|
import Check from "@iconify-icons/ep/check";
|
||||||
|
import Logout from "@iconify-icons/ri/logout-circle-r-line";
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { device } = useNav();
|
|
||||||
const { isDark } = useDark();
|
const { isDark } = useDark();
|
||||||
const { isSelect } = useCssModule();
|
const { device, tooltipEffect } = useNav();
|
||||||
const { $storage } = useGlobal<GlobalPropertiesApi>();
|
const { $storage } = useGlobal<GlobalPropertiesApi>();
|
||||||
|
|
||||||
const mixRef = templateRef<HTMLElement | null>("mixRef", null);
|
const mixRef = ref();
|
||||||
const verticalRef = templateRef<HTMLElement | null>("verticalRef", null);
|
const verticalRef = ref();
|
||||||
const horizontalRef = templateRef<HTMLElement | null>("horizontalRef", null);
|
const horizontalRef = ref();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
body,
|
|
||||||
dataTheme,
|
dataTheme,
|
||||||
layoutTheme,
|
layoutTheme,
|
||||||
themeColors,
|
themeColors,
|
||||||
@@ -54,8 +53,8 @@ const {
|
|||||||
|
|
||||||
/* body添加layout属性,作用于src/style/sidebar.scss */
|
/* body添加layout属性,作用于src/style/sidebar.scss */
|
||||||
if (unref(layoutTheme)) {
|
if (unref(layoutTheme)) {
|
||||||
let layout = unref(layoutTheme).layout;
|
const layout = unref(layoutTheme).layout;
|
||||||
let theme = unref(layoutTheme).theme;
|
const theme = unref(layoutTheme).theme;
|
||||||
toggleTheme({
|
toggleTheme({
|
||||||
scopeName: `layout-theme-${theme}`
|
scopeName: `layout-theme-${theme}`
|
||||||
});
|
});
|
||||||
@@ -119,13 +118,13 @@ const weekChange = (value): void => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const tagsChange = () => {
|
const tagsChange = () => {
|
||||||
let showVal = settings.tabsVal;
|
const showVal = settings.tabsVal;
|
||||||
storageConfigureChange("hideTabs", showVal);
|
storageConfigureChange("hideTabs", showVal);
|
||||||
emitter.emit("tagViewsChange", showVal as unknown as string);
|
emitter.emit("tagViewsChange", showVal as unknown as string);
|
||||||
};
|
};
|
||||||
|
|
||||||
const multiTagsCacheChange = () => {
|
const multiTagsCacheChange = () => {
|
||||||
let multiTagsCache = settings.multiTagsCache;
|
const multiTagsCache = settings.multiTagsCache;
|
||||||
storageConfigureChange("multiTagsCache", multiTagsCache);
|
storageConfigureChange("multiTagsCache", multiTagsCache);
|
||||||
useMultiTagsStoreHook().multiTagsCacheChange(multiTagsCache);
|
useMultiTagsStoreHook().multiTagsCacheChange(multiTagsCache);
|
||||||
};
|
};
|
||||||
@@ -133,8 +132,8 @@ const multiTagsCacheChange = () => {
|
|||||||
/** 清空缓存并返回登录页 */
|
/** 清空缓存并返回登录页 */
|
||||||
function onReset() {
|
function onReset() {
|
||||||
removeToken();
|
removeToken();
|
||||||
storageLocal.clear();
|
storageLocal().clear();
|
||||||
storageSession.clear();
|
storageSession().clear();
|
||||||
const { Grey, Weak, MultiTagsCache, EpThemeColor, Layout } = getConfig();
|
const { Grey, Weak, MultiTagsCache, EpThemeColor, Layout } = getConfig();
|
||||||
useAppStoreHook().setLayout(Layout);
|
useAppStoreHook().setLayout(Layout);
|
||||||
setEpThemeColor(EpThemeColor);
|
setEpThemeColor(EpThemeColor);
|
||||||
@@ -161,32 +160,10 @@ function logoChange() {
|
|||||||
|
|
||||||
function setFalse(Doms): any {
|
function setFalse(Doms): any {
|
||||||
Doms.forEach(v => {
|
Doms.forEach(v => {
|
||||||
toggleClass(false, isSelect, unref(v));
|
toggleClass(false, "is-select", unref(v));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
watch($storage, ({ layout }) => {
|
|
||||||
/* 设置wangeditorV5主题色 */
|
|
||||||
body.style.setProperty("--w-e-toolbar-active-color", layout["epThemeColor"]);
|
|
||||||
switch (layout["layout"]) {
|
|
||||||
case "vertical":
|
|
||||||
toggleClass(true, isSelect, unref(verticalRef));
|
|
||||||
debounce(setFalse([horizontalRef]), 50);
|
|
||||||
debounce(setFalse([mixRef]), 50);
|
|
||||||
break;
|
|
||||||
case "horizontal":
|
|
||||||
toggleClass(true, isSelect, unref(horizontalRef));
|
|
||||||
debounce(setFalse([verticalRef]), 50);
|
|
||||||
debounce(setFalse([mixRef]), 50);
|
|
||||||
break;
|
|
||||||
case "mix":
|
|
||||||
toggleClass(true, isSelect, unref(mixRef));
|
|
||||||
debounce(setFalse([verticalRef]), 50);
|
|
||||||
debounce(setFalse([horizontalRef]), 50);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
/** 主题色 激活选择项 */
|
/** 主题色 激活选择项 */
|
||||||
const getThemeColor = computed(() => {
|
const getThemeColor = computed(() => {
|
||||||
return current => {
|
return current => {
|
||||||
@@ -220,14 +197,36 @@ function setLayoutModel(layout: string) {
|
|||||||
useAppStoreHook().setLayout(layout);
|
useAppStoreHook().setLayout(layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 初始化项目配置 */
|
watch($storage, ({ layout }) => {
|
||||||
nextTick(() => {
|
switch (layout["layout"]) {
|
||||||
settings.greyVal &&
|
case "vertical":
|
||||||
document.querySelector("html")?.setAttribute("class", "html-grey");
|
toggleClass(true, "is-select", unref(verticalRef));
|
||||||
settings.weakVal &&
|
debounce(setFalse([horizontalRef]), 50);
|
||||||
document.querySelector("html")?.setAttribute("class", "html-weakness");
|
debounce(setFalse([mixRef]), 50);
|
||||||
settings.tabsVal && tagsChange();
|
break;
|
||||||
|
case "horizontal":
|
||||||
|
toggleClass(true, "is-select", unref(horizontalRef));
|
||||||
|
debounce(setFalse([verticalRef]), 50);
|
||||||
|
debounce(setFalse([mixRef]), 50);
|
||||||
|
break;
|
||||||
|
case "mix":
|
||||||
|
toggleClass(true, "is-select", unref(mixRef));
|
||||||
|
debounce(setFalse([verticalRef]), 50);
|
||||||
|
debounce(setFalse([horizontalRef]), 50);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
onBeforeMount(() => {
|
||||||
dataThemeChange();
|
dataThemeChange();
|
||||||
|
/* 初始化项目配置 */
|
||||||
|
nextTick(() => {
|
||||||
|
settings.greyVal &&
|
||||||
|
document.querySelector("html")?.setAttribute("class", "html-grey");
|
||||||
|
settings.weakVal &&
|
||||||
|
document.querySelector("html")?.setAttribute("class", "html-weakness");
|
||||||
|
settings.tabsVal && tagsChange();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -245,9 +244,15 @@ nextTick(() => {
|
|||||||
|
|
||||||
<el-divider>导航栏模式</el-divider>
|
<el-divider>导航栏模式</el-divider>
|
||||||
<ul class="pure-theme">
|
<ul class="pure-theme">
|
||||||
<el-tooltip class="item" content="左侧模式" placement="bottom">
|
<el-tooltip
|
||||||
|
:effect="tooltipEffect"
|
||||||
|
class="item"
|
||||||
|
content="左侧模式"
|
||||||
|
placement="bottom"
|
||||||
|
popper-class="pure-tooltip"
|
||||||
|
>
|
||||||
<li
|
<li
|
||||||
:class="layoutTheme.layout === 'vertical' ? $style.isSelect : ''"
|
:class="layoutTheme.layout === 'vertical' ? 'is-select' : ''"
|
||||||
ref="verticalRef"
|
ref="verticalRef"
|
||||||
@click="setLayoutModel('vertical')"
|
@click="setLayoutModel('vertical')"
|
||||||
>
|
>
|
||||||
@@ -258,12 +263,14 @@ nextTick(() => {
|
|||||||
|
|
||||||
<el-tooltip
|
<el-tooltip
|
||||||
v-if="device !== 'mobile'"
|
v-if="device !== 'mobile'"
|
||||||
|
:effect="tooltipEffect"
|
||||||
class="item"
|
class="item"
|
||||||
content="顶部模式"
|
content="顶部模式"
|
||||||
placement="bottom"
|
placement="bottom"
|
||||||
|
popper-class="pure-tooltip"
|
||||||
>
|
>
|
||||||
<li
|
<li
|
||||||
:class="layoutTheme.layout === 'horizontal' ? $style.isSelect : ''"
|
:class="layoutTheme.layout === 'horizontal' ? 'is-select' : ''"
|
||||||
ref="horizontalRef"
|
ref="horizontalRef"
|
||||||
@click="setLayoutModel('horizontal')"
|
@click="setLayoutModel('horizontal')"
|
||||||
>
|
>
|
||||||
@@ -274,12 +281,14 @@ nextTick(() => {
|
|||||||
|
|
||||||
<el-tooltip
|
<el-tooltip
|
||||||
v-if="device !== 'mobile'"
|
v-if="device !== 'mobile'"
|
||||||
|
:effect="tooltipEffect"
|
||||||
class="item"
|
class="item"
|
||||||
content="混合模式"
|
content="混合模式"
|
||||||
placement="bottom"
|
placement="bottom"
|
||||||
|
popper-class="pure-tooltip"
|
||||||
>
|
>
|
||||||
<li
|
<li
|
||||||
:class="layoutTheme.layout === 'mix' ? $style.isSelect : ''"
|
:class="layoutTheme.layout === 'mix' ? 'is-select' : ''"
|
||||||
ref="mixRef"
|
ref="mixRef"
|
||||||
@click="setLayoutModel('mix')"
|
@click="setLayoutModel('mix')"
|
||||||
>
|
>
|
||||||
@@ -303,7 +312,7 @@ nextTick(() => {
|
|||||||
:size="17"
|
:size="17"
|
||||||
:color="getThemeColor(item.themeColor)"
|
:color="getThemeColor(item.themeColor)"
|
||||||
>
|
>
|
||||||
<IconifyIconOffline icon="check" />
|
<IconifyIconOffline :icon="Check" />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -384,7 +393,7 @@ nextTick(() => {
|
|||||||
@click="onReset"
|
@click="onReset"
|
||||||
>
|
>
|
||||||
<IconifyIconOffline
|
<IconifyIconOffline
|
||||||
icon="fa-sign-out"
|
:icon="Logout"
|
||||||
width="15"
|
width="15"
|
||||||
height="15"
|
height="15"
|
||||||
style="margin-right: 4px"
|
style="margin-right: 4px"
|
||||||
@@ -394,13 +403,16 @@ nextTick(() => {
|
|||||||
</panel>
|
</panel>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped module>
|
<style lang="scss" scoped>
|
||||||
.isSelect {
|
:deep(.el-divider__text) {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.is-select {
|
||||||
border: 2px solid var(--el-color-primary);
|
border: 2px solid var(--el-color-primary);
|
||||||
}
|
}
|
||||||
</style>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.setting {
|
.setting {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
@@ -412,11 +424,6 @@ nextTick(() => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.el-divider__text) {
|
|
||||||
font-size: 16px;
|
|
||||||
font-weight: 700;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pure-datatheme {
|
.pure-datatheme {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 50px;
|
height: 50px;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { isEqual } from "lodash-unified";
|
import { isEqual } from "@pureadmin/utils";
|
||||||
import { ref, watch, onMounted, toRaw } from "vue";
|
import { ref, watch, onMounted, toRaw } from "vue";
|
||||||
import { getParentPaths, findRouteByPath } from "@/router/utils";
|
import { getParentPaths, findRouteByPath } from "@/router/utils";
|
||||||
import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
|
import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
|
||||||
@@ -96,8 +96,12 @@ watch(
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<el-breadcrumb class="!leading-[50px] select-none" separator="/">
|
<el-breadcrumb class="!leading-[50px] select-none" separator="/">
|
||||||
<transition-group appear name="breadcrumb">
|
<transition-group name="breadcrumb">
|
||||||
<el-breadcrumb-item v-for="item in levelList" :key="item.path">
|
<el-breadcrumb-item
|
||||||
|
class="!inline !items-stretch"
|
||||||
|
v-for="item in levelList"
|
||||||
|
:key="item.path"
|
||||||
|
>
|
||||||
<a @click.prevent="handleLink(item)">
|
<a @click.prevent="handleLink(item)">
|
||||||
{{ item.meta.title }}
|
{{ item.meta.title }}
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import { ref, watch, nextTick } from "vue";
|
|||||||
import SidebarItem from "./sidebarItem.vue";
|
import SidebarItem from "./sidebarItem.vue";
|
||||||
import { useNav } from "@/layout/hooks/useNav";
|
import { useNav } from "@/layout/hooks/useNav";
|
||||||
import { usePermissionStoreHook } from "@/store/modules/permission";
|
import { usePermissionStoreHook } from "@/store/modules/permission";
|
||||||
|
import LogoutCircleRLine from "@iconify-icons/ri/logout-circle-r-line";
|
||||||
|
import Setting from "@iconify-icons/ri/settings-3-line";
|
||||||
|
|
||||||
const menuRef = ref();
|
const menuRef = ref();
|
||||||
|
|
||||||
@@ -33,7 +35,10 @@ watch(
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="horizontal-header">
|
<div
|
||||||
|
v-loading="usePermissionStoreHook().wholeMenus.length === 0"
|
||||||
|
class="horizontal-header"
|
||||||
|
>
|
||||||
<div class="horizontal-header-left" @click="backHome">
|
<div class="horizontal-header-left" @click="backHome">
|
||||||
<FontIcon icon="team-iconlogo" svg style="width: 35px; height: 35px" />
|
<FontIcon icon="team-iconlogo" svg style="width: 35px; height: 35px" />
|
||||||
<h4>{{ title }}</h4>
|
<h4>{{ title }}</h4>
|
||||||
@@ -71,7 +76,7 @@ watch(
|
|||||||
<el-dropdown-menu class="logout">
|
<el-dropdown-menu class="logout">
|
||||||
<el-dropdown-item @click="logout">
|
<el-dropdown-item @click="logout">
|
||||||
<IconifyIconOffline
|
<IconifyIconOffline
|
||||||
icon="logout-circle-r-line"
|
:icon="LogoutCircleRLine"
|
||||||
style="margin: 5px"
|
style="margin: 5px"
|
||||||
/>
|
/>
|
||||||
退出系统
|
退出系统
|
||||||
@@ -84,13 +89,17 @@ watch(
|
|||||||
title="打开项目配置"
|
title="打开项目配置"
|
||||||
@click="onPanel"
|
@click="onPanel"
|
||||||
>
|
>
|
||||||
<IconifyIconOffline icon="setting" />
|
<IconifyIconOffline :icon="Setting" />
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
:deep(.el-loading-mask) {
|
||||||
|
opacity: 0.45;
|
||||||
|
}
|
||||||
|
|
||||||
.logout {
|
.logout {
|
||||||
max-width: 120px;
|
max-width: 120px;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useDark } from "@pureadmin/utils";
|
import { ref, computed } from "vue";
|
||||||
|
import { useNav } from "@/layout/hooks/useNav";
|
||||||
|
import MenuFold from "@iconify-icons/ri/menu-fold-fill";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
isActive: boolean;
|
isActive: boolean;
|
||||||
@@ -8,7 +10,25 @@ interface Props {
|
|||||||
const props = withDefaults(defineProps<Props>(), {
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
isActive: false
|
isActive: false
|
||||||
});
|
});
|
||||||
const { isDark } = useDark();
|
|
||||||
|
const visible = ref(false);
|
||||||
|
const { tooltipEffect } = useNav();
|
||||||
|
|
||||||
|
const iconClass = computed(() => {
|
||||||
|
return [
|
||||||
|
"ml-4",
|
||||||
|
"mb-1",
|
||||||
|
"w-[16px]",
|
||||||
|
"h-[16px]",
|
||||||
|
"inline-block",
|
||||||
|
"align-middle",
|
||||||
|
"text-primary",
|
||||||
|
"cursor-pointer",
|
||||||
|
"duration-[360ms]",
|
||||||
|
"hover:text-primary",
|
||||||
|
"dark:hover:!text-white"
|
||||||
|
];
|
||||||
|
});
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: "toggleClick"): void;
|
(e: "toggleClick"): void;
|
||||||
@@ -23,13 +43,17 @@ const toggleClick = () => {
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
<el-tooltip
|
<el-tooltip
|
||||||
placement="right"
|
placement="right"
|
||||||
:effect="isDark ? 'dark' : 'light'"
|
:visible="visible"
|
||||||
|
:effect="tooltipEffect"
|
||||||
:content="props.isActive ? '点击折叠' : '点击展开'"
|
:content="props.isActive ? '点击折叠' : '点击展开'"
|
||||||
>
|
>
|
||||||
<IconifyIconOffline
|
<IconifyIconOffline
|
||||||
:icon="props.isActive ? 'menu-fold' : 'menu-unfold'"
|
:icon="MenuFold"
|
||||||
class="cursor-pointer inline-block align-middle text-primary hover:text-primary dark:hover:!text-white w-[16px] h-[16px] ml-4 mb-1"
|
:class="iconClass"
|
||||||
|
:style="{ transform: props.isActive ? 'none' : 'rotateY(180deg)' }"
|
||||||
@click="toggleClick"
|
@click="toggleClick"
|
||||||
|
@mouseenter="visible = true"
|
||||||
|
@mouseleave="visible = false"
|
||||||
/>
|
/>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -6,9 +6,11 @@ import { ref, toRaw, watch, onMounted, nextTick } from "vue";
|
|||||||
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
|
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
|
||||||
import { getParentPaths, findRouteByPath } from "@/router/utils";
|
import { getParentPaths, findRouteByPath } from "@/router/utils";
|
||||||
import { usePermissionStoreHook } from "@/store/modules/permission";
|
import { usePermissionStoreHook } from "@/store/modules/permission";
|
||||||
|
import LogoutCircleRLine from "@iconify-icons/ri/logout-circle-r-line";
|
||||||
|
import Setting from "@iconify-icons/ri/settings-3-line";
|
||||||
|
|
||||||
const menuRef = ref();
|
const menuRef = ref();
|
||||||
let defaultActive = ref(null);
|
const defaultActive = ref(null);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
route,
|
route,
|
||||||
@@ -49,7 +51,11 @@ watch(
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div v-if="device !== 'mobile'" class="horizontal-header">
|
<div
|
||||||
|
v-if="device !== 'mobile'"
|
||||||
|
class="horizontal-header"
|
||||||
|
v-loading="usePermissionStoreHook().wholeMenus.length === 0"
|
||||||
|
>
|
||||||
<el-menu
|
<el-menu
|
||||||
router
|
router
|
||||||
ref="menuRef"
|
ref="menuRef"
|
||||||
@@ -102,7 +108,7 @@ watch(
|
|||||||
<el-dropdown-menu class="logout">
|
<el-dropdown-menu class="logout">
|
||||||
<el-dropdown-item @click="logout">
|
<el-dropdown-item @click="logout">
|
||||||
<IconifyIconOffline
|
<IconifyIconOffline
|
||||||
icon="logout-circle-r-line"
|
:icon="LogoutCircleRLine"
|
||||||
style="margin: 5px"
|
style="margin: 5px"
|
||||||
/>
|
/>
|
||||||
退出系统
|
退出系统
|
||||||
@@ -115,13 +121,17 @@ watch(
|
|||||||
title="打开项目配置"
|
title="打开项目配置"
|
||||||
@click="onPanel"
|
@click="onPanel"
|
||||||
>
|
>
|
||||||
<IconifyIconOffline icon="setting" />
|
<IconifyIconOffline :icon="Setting" />
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
:deep(.el-loading-mask) {
|
||||||
|
opacity: 0.45;
|
||||||
|
}
|
||||||
|
|
||||||
.logout {
|
.logout {
|
||||||
max-width: 120px;
|
max-width: 120px;
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,17 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import path from "path";
|
import path from "path";
|
||||||
|
import { getConfig } from "@/config";
|
||||||
import { childrenType } from "../../types";
|
import { childrenType } from "../../types";
|
||||||
import { useNav } from "@/layout/hooks/useNav";
|
import { useNav } from "@/layout/hooks/useNav";
|
||||||
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
|
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
|
||||||
import { ref, toRaw, PropType, nextTick, computed, CSSProperties } from "vue";
|
import { ref, toRaw, PropType, nextTick, computed, CSSProperties } from "vue";
|
||||||
|
|
||||||
const { layout, isCollapse } = useNav();
|
import ArrowUp from "@iconify-icons/ep/arrow-up";
|
||||||
|
import EpArrowDown from "@iconify-icons/ep/arrow-down";
|
||||||
|
import ArrowLeft from "@iconify-icons/ep/arrow-left";
|
||||||
|
import ArrowRight from "@iconify-icons/ep/arrow-right";
|
||||||
|
|
||||||
|
const { layout, isCollapse, tooltipEffect } = useNav();
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
item: {
|
item: {
|
||||||
@@ -75,6 +81,16 @@ const getSpanStyle = computed(() => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const expandCloseIcon = computed(() => {
|
||||||
|
if (!getConfig()?.MenuArrowIconNoTransition) return "";
|
||||||
|
return {
|
||||||
|
"expand-close-icon": useRenderIcon(EpArrowDown),
|
||||||
|
"expand-open-icon": useRenderIcon(ArrowUp),
|
||||||
|
"collapse-close-icon": useRenderIcon(ArrowRight),
|
||||||
|
"collapse-open-icon": useRenderIcon(ArrowLeft)
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
const onlyOneChild: childrenType = ref(null);
|
const onlyOneChild: childrenType = ref(null);
|
||||||
// 存放菜单是否存在showTooltip属性标识
|
// 存放菜单是否存在showTooltip属性标识
|
||||||
const hoverMenuMap = new WeakMap();
|
const hoverMenuMap = new WeakMap();
|
||||||
@@ -184,6 +200,7 @@ function resolvePath(routePath) {
|
|||||||
<el-tooltip
|
<el-tooltip
|
||||||
v-else
|
v-else
|
||||||
placement="top"
|
placement="top"
|
||||||
|
:effect="tooltipEffect"
|
||||||
:offset="-10"
|
:offset="-10"
|
||||||
:disabled="!onlyOneChild.showTooltip"
|
:disabled="!onlyOneChild.showTooltip"
|
||||||
>
|
>
|
||||||
@@ -211,7 +228,12 @@ function resolvePath(routePath) {
|
|||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<el-sub-menu v-else ref="subMenu" :index="resolvePath(props.item.path)">
|
<el-sub-menu
|
||||||
|
v-else
|
||||||
|
ref="subMenu"
|
||||||
|
v-bind="expandCloseIcon"
|
||||||
|
:index="resolvePath(props.item.path)"
|
||||||
|
>
|
||||||
<template #title>
|
<template #title>
|
||||||
<div v-if="toRaw(props.item.meta.icon)" class="sub-menu-icon">
|
<div v-if="toRaw(props.item.meta.icon)" class="sub-menu-icon">
|
||||||
<component
|
<component
|
||||||
@@ -224,8 +246,9 @@ function resolvePath(routePath) {
|
|||||||
<el-tooltip
|
<el-tooltip
|
||||||
v-else
|
v-else
|
||||||
placement="top"
|
placement="top"
|
||||||
|
:effect="tooltipEffect"
|
||||||
:offset="-10"
|
:offset="-10"
|
||||||
:disabled="!isCollapse || !props.item.showTooltip"
|
:disabled="!props.item.showTooltip"
|
||||||
>
|
>
|
||||||
<template #content>
|
<template #content>
|
||||||
{{ props.item.meta.title }}
|
{{ props.item.meta.title }}
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import MenuFold from "@iconify-icons/ri/menu-fold-fill";
|
||||||
|
import MenuUnfold from "@iconify-icons/ri/menu-unfold-fill";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
isActive: boolean;
|
isActive: boolean;
|
||||||
}
|
}
|
||||||
@@ -23,7 +26,7 @@ const toggleClick = () => {
|
|||||||
@click="toggleClick"
|
@click="toggleClick"
|
||||||
>
|
>
|
||||||
<IconifyIconOffline
|
<IconifyIconOffline
|
||||||
:icon="props.isActive ? 'menu-fold' : 'menu-unfold'"
|
:icon="props.isActive ? MenuFold : MenuUnfold"
|
||||||
class="inline-block align-middle hover:text-primary dark:hover:!text-white"
|
class="inline-block align-middle hover:text-primary dark:hover:!text-white"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import { useRoute } from "vue-router";
|
|||||||
import { emitter } from "@/utils/mitt";
|
import { emitter } from "@/utils/mitt";
|
||||||
import SidebarItem from "./sidebarItem.vue";
|
import SidebarItem from "./sidebarItem.vue";
|
||||||
import leftCollapse from "./leftCollapse.vue";
|
import leftCollapse from "./leftCollapse.vue";
|
||||||
import type { StorageConfigs } from "/#/index";
|
|
||||||
import { useNav } from "@/layout/hooks/useNav";
|
import { useNav } from "@/layout/hooks/useNav";
|
||||||
import { storageLocal } from "@pureadmin/utils";
|
import { storageLocal } from "@pureadmin/utils";
|
||||||
import { ref, computed, watch, onBeforeMount } from "vue";
|
import { ref, computed, watch, onBeforeMount } from "vue";
|
||||||
@@ -13,13 +12,14 @@ import { usePermissionStoreHook } from "@/store/modules/permission";
|
|||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const showLogo = ref(
|
const showLogo = ref(
|
||||||
storageLocal.getItem<StorageConfigs>("responsive-configure")?.showLogo ?? true
|
storageLocal().getItem<StorageConfigs>("responsive-configure")?.showLogo ??
|
||||||
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
const { routers, device, pureApp, isCollapse, menuSelect, toggleSideBar } =
|
const { routers, device, pureApp, isCollapse, menuSelect, toggleSideBar } =
|
||||||
useNav();
|
useNav();
|
||||||
|
|
||||||
let subMenuData = ref([]);
|
const subMenuData = ref([]);
|
||||||
|
|
||||||
const menuData = computed(() => {
|
const menuData = computed(() => {
|
||||||
return pureApp.layout === "mix" && device.value !== "mobile"
|
return pureApp.layout === "mix" && device.value !== "mobile"
|
||||||
@@ -60,7 +60,10 @@ watch(
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div :class="['sidebar-container', showLogo ? 'has-logo' : '']">
|
<div
|
||||||
|
v-loading="menuData.length === 0"
|
||||||
|
:class="['sidebar-container', showLogo ? 'has-logo' : '']"
|
||||||
|
>
|
||||||
<Logo v-if="showLogo" :collapse="isCollapse" />
|
<Logo v-if="showLogo" :collapse="isCollapse" />
|
||||||
<el-scrollbar
|
<el-scrollbar
|
||||||
wrap-class="scrollbar-wrapper"
|
wrap-class="scrollbar-wrapper"
|
||||||
@@ -92,3 +95,9 @@ watch(
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
:deep(.el-loading-mask) {
|
||||||
|
opacity: 0.45;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -3,13 +3,20 @@ import { emitter } from "@/utils/mitt";
|
|||||||
import { RouteConfigs } from "../../types";
|
import { RouteConfigs } from "../../types";
|
||||||
import { useTags } from "../../hooks/useTag";
|
import { useTags } from "../../hooks/useTag";
|
||||||
import { routerArrays } from "@/layout/types";
|
import { routerArrays } from "@/layout/types";
|
||||||
import { isEqual, isEmpty } from "lodash-unified";
|
import { isEqual, isAllEmpty } from "@pureadmin/utils";
|
||||||
import { useSettingStoreHook } from "@/store/modules/settings";
|
import { useSettingStoreHook } from "@/store/modules/settings";
|
||||||
import { ref, watch, unref, nextTick, onBeforeMount } from "vue";
|
import { ref, watch, unref, nextTick, onBeforeMount } from "vue";
|
||||||
import { handleAliveRoute, delAliveRoutes } from "@/router/utils";
|
import { handleAliveRoute, delAliveRoutes } from "@/router/utils";
|
||||||
import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
|
import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
|
||||||
import { useResizeObserver, useDebounceFn, useFullscreen } from "@vueuse/core";
|
import { useResizeObserver, useDebounceFn, useFullscreen } from "@vueuse/core";
|
||||||
|
|
||||||
|
import ExitFullscreen from "@iconify-icons/ri/fullscreen-exit-fill";
|
||||||
|
import Fullscreen from "@iconify-icons/ri/fullscreen-fill";
|
||||||
|
import ArrowDown from "@iconify-icons/ri/arrow-down-s-line";
|
||||||
|
import ArrowRightSLine from "@iconify-icons/ri/arrow-right-s-line";
|
||||||
|
import ArrowLeftSLine from "@iconify-icons/ri/arrow-left-s-line";
|
||||||
|
import CloseBold from "@iconify-icons/ep/close-bold";
|
||||||
|
|
||||||
const {
|
const {
|
||||||
route,
|
route,
|
||||||
router,
|
router,
|
||||||
@@ -40,7 +47,7 @@ const {
|
|||||||
const tabDom = ref();
|
const tabDom = ref();
|
||||||
const containerDom = ref();
|
const containerDom = ref();
|
||||||
const scrollbarDom = ref();
|
const scrollbarDom = ref();
|
||||||
let isShowArrow = ref(false);
|
const isShowArrow = ref(false);
|
||||||
const { isFullscreen, toggle } = useFullscreen();
|
const { isFullscreen, toggle } = useFullscreen();
|
||||||
|
|
||||||
const dynamicTagView = () => {
|
const dynamicTagView = () => {
|
||||||
@@ -127,7 +134,7 @@ function dynamicRouteTag(value: string, parentPath: string): void {
|
|||||||
function concatPath(arr: object[], value: string, parentPath: string) {
|
function concatPath(arr: object[], value: string, parentPath: string) {
|
||||||
if (!hasValue) {
|
if (!hasValue) {
|
||||||
arr.forEach((arrItem: any) => {
|
arr.forEach((arrItem: any) => {
|
||||||
let pathConcat = parentPath + arrItem.path;
|
const pathConcat = parentPath + arrItem.path;
|
||||||
if (arrItem.path === value || pathConcat === value) {
|
if (arrItem.path === value || pathConcat === value) {
|
||||||
useMultiTagsStoreHook().handleTags("push", {
|
useMultiTagsStoreHook().handleTags("push", {
|
||||||
path: value,
|
path: value,
|
||||||
@@ -158,7 +165,7 @@ function onFresh() {
|
|||||||
function deleteDynamicTag(obj: any, current: any, tag?: string) {
|
function deleteDynamicTag(obj: any, current: any, tag?: string) {
|
||||||
// 存放被删除的缓存路由
|
// 存放被删除的缓存路由
|
||||||
let delAliveRouteList = [];
|
let delAliveRouteList = [];
|
||||||
let valueIndex: number = multiTags.value.findIndex((item: any) => {
|
const valueIndex: number = multiTags.value.findIndex((item: any) => {
|
||||||
if (item.query) {
|
if (item.query) {
|
||||||
if (item.path === obj.path) {
|
if (item.path === obj.path) {
|
||||||
return item.query === obj.query;
|
return item.query === obj.query;
|
||||||
@@ -197,7 +204,7 @@ function deleteDynamicTag(obj: any, current: any, tag?: string) {
|
|||||||
// 从当前匹配到的路径中删除
|
// 从当前匹配到的路径中删除
|
||||||
spliceRoute(valueIndex, 1);
|
spliceRoute(valueIndex, 1);
|
||||||
}
|
}
|
||||||
let newRoute = useMultiTagsStoreHook().handleTags("slice");
|
const newRoute = useMultiTagsStoreHook().handleTags("slice");
|
||||||
if (current === route.path) {
|
if (current === route.path) {
|
||||||
// 删除缓存路由
|
// 删除缓存路由
|
||||||
tag
|
tag
|
||||||
@@ -282,11 +289,11 @@ function onClickDrop(key, item, selectRoute?: RouteConfigs) {
|
|||||||
toggle();
|
toggle();
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (isFullscreen.value) {
|
if (isFullscreen.value) {
|
||||||
tagsViews[6].icon = "exit-fullscreen";
|
tagsViews[6].icon = ExitFullscreen;
|
||||||
tagsViews[6].text = "整体页面退出全屏";
|
tagsViews[6].text = "退出全屏";
|
||||||
} else {
|
} else {
|
||||||
tagsViews[6].icon = "fullscreen";
|
tagsViews[6].icon = Fullscreen;
|
||||||
tagsViews[6].text = "整体页面全屏";
|
tagsViews[6].text = "全屏";
|
||||||
}
|
}
|
||||||
}, 100);
|
}, 100);
|
||||||
break;
|
break;
|
||||||
@@ -295,10 +302,10 @@ function onClickDrop(key, item, selectRoute?: RouteConfigs) {
|
|||||||
onContentFullScreen();
|
onContentFullScreen();
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (pureSetting.hiddenSideBar) {
|
if (pureSetting.hiddenSideBar) {
|
||||||
tagsViews[7].icon = "exit-fullscreen";
|
tagsViews[7].icon = ExitFullscreen;
|
||||||
tagsViews[7].text = "内容区退出全屏";
|
tagsViews[7].text = "内容区退出全屏";
|
||||||
} else {
|
} else {
|
||||||
tagsViews[7].icon = "fullscreen";
|
tagsViews[7].icon = Fullscreen;
|
||||||
tagsViews[7].text = "内容区全屏";
|
tagsViews[7].text = "内容区全屏";
|
||||||
}
|
}
|
||||||
}, 100);
|
}, 100);
|
||||||
@@ -337,10 +344,10 @@ function showMenuModel(
|
|||||||
query: object = {},
|
query: object = {},
|
||||||
refresh = false
|
refresh = false
|
||||||
) {
|
) {
|
||||||
let allRoute = multiTags.value;
|
const allRoute = multiTags.value;
|
||||||
let routeLength = multiTags.value.length;
|
const routeLength = multiTags.value.length;
|
||||||
let currentIndex = -1;
|
let currentIndex = -1;
|
||||||
if (isEmpty(query)) {
|
if (isAllEmpty(query)) {
|
||||||
currentIndex = allRoute.findIndex(v => v.path === currentPath);
|
currentIndex = allRoute.findIndex(v => v.path === currentPath);
|
||||||
} else {
|
} else {
|
||||||
currentIndex = allRoute.findIndex(v => isEqual(v.query, query));
|
currentIndex = allRoute.findIndex(v => isEqual(v.query, query));
|
||||||
@@ -494,7 +501,7 @@ onMounted(() => {
|
|||||||
<template>
|
<template>
|
||||||
<div ref="containerDom" class="tags-view" v-if="!showTags">
|
<div ref="containerDom" class="tags-view" v-if="!showTags">
|
||||||
<span v-show="isShowArrow" class="arrow-left">
|
<span v-show="isShowArrow" class="arrow-left">
|
||||||
<IconifyIconOffline icon="arrow-left-s-line" @click="handleScroll(200)" />
|
<IconifyIconOffline :icon="ArrowLeftSLine" @click="handleScroll(200)" />
|
||||||
</span>
|
</span>
|
||||||
<div ref="scrollbarDom" class="scroll-container">
|
<div ref="scrollbarDom" class="scroll-container">
|
||||||
<div class="tab select-none" ref="tabDom" :style="getTabStyle">
|
<div class="tab select-none" ref="tabDom" :style="getTabStyle">
|
||||||
@@ -528,7 +535,7 @@ onMounted(() => {
|
|||||||
class="el-icon-close"
|
class="el-icon-close"
|
||||||
@click.stop="deleteMenu(item)"
|
@click.stop="deleteMenu(item)"
|
||||||
>
|
>
|
||||||
<IconifyIconOffline icon="close-bold" />
|
<IconifyIconOffline :icon="CloseBold" />
|
||||||
</span>
|
</span>
|
||||||
<div
|
<div
|
||||||
:ref="'schedule' + index"
|
:ref="'schedule' + index"
|
||||||
@@ -539,10 +546,7 @@ onMounted(() => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<span v-show="isShowArrow" class="arrow-right">
|
<span v-show="isShowArrow" class="arrow-right">
|
||||||
<IconifyIconOffline
|
<IconifyIconOffline :icon="ArrowRightSLine" @click="handleScroll(-200)" />
|
||||||
icon="arrow-right-s-line"
|
|
||||||
@click="handleScroll(-200)"
|
|
||||||
/>
|
|
||||||
</span>
|
</span>
|
||||||
<!-- 右键菜单按钮 -->
|
<!-- 右键菜单按钮 -->
|
||||||
<transition name="el-zoom-in-top">
|
<transition name="el-zoom-in-top">
|
||||||
@@ -571,7 +575,7 @@ onMounted(() => {
|
|||||||
@command="handleCommand"
|
@command="handleCommand"
|
||||||
>
|
>
|
||||||
<span class="arrow-down">
|
<span class="arrow-down">
|
||||||
<IconifyIconOffline icon="arrow-down" class="dark:text-white" />
|
<IconifyIconOffline :icon="ArrowDown" class="dark:text-white" />
|
||||||
</span>
|
</span>
|
||||||
<template #dropdown>
|
<template #dropdown>
|
||||||
<el-dropdown-menu>
|
<el-dropdown-menu>
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import { getConfig } from "@/config";
|
import { getConfig } from "@/config";
|
||||||
import { find } from "lodash-unified";
|
|
||||||
import { useLayout } from "./useLayout";
|
import { useLayout } from "./useLayout";
|
||||||
import { themeColorsType } from "../types";
|
import { themeColorsType } from "../types";
|
||||||
import { TinyColor } from "@ctrl/tinycolor";
|
|
||||||
import { useGlobal } from "@pureadmin/utils";
|
import { useGlobal } from "@pureadmin/utils";
|
||||||
import { useEpThemeStoreHook } from "@/store/modules/epTheme";
|
import { useEpThemeStoreHook } from "@/store/modules/epTheme";
|
||||||
import {
|
import {
|
||||||
@@ -56,35 +54,27 @@ export function useDataThemeChange() {
|
|||||||
if (theme === "default" || theme === "light") {
|
if (theme === "default" || theme === "light") {
|
||||||
setEpThemeColor(getConfig().EpThemeColor);
|
setEpThemeColor(getConfig().EpThemeColor);
|
||||||
} else {
|
} else {
|
||||||
const colors = find(themeColors.value, { themeColor: theme });
|
const colors = themeColors.value.find(v => v.themeColor === theme);
|
||||||
setEpThemeColor(colors.color);
|
setEpThemeColor(colors.color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
function setPropertyPrimary(mode: string, i: number, color: string) {
|
||||||
* @description 自动计算hover和active颜色
|
document.documentElement.style.setProperty(
|
||||||
* @see {@link https://element-plus.org/zh-CN/component/button.html#%E8%87%AA%E5%AE%9A%E4%B9%89%E9%A2%9C%E8%89%B2}
|
`--el-color-primary-${mode}-${i}`,
|
||||||
*/
|
dataTheme.value ? darken(color, i / 10) : lighten(color, i / 10)
|
||||||
const shadeBgColor = (color: string): string => {
|
);
|
||||||
return new TinyColor(color).shade(10).toString();
|
}
|
||||||
};
|
|
||||||
|
|
||||||
/** 设置ep主题色 */
|
/** 设置 `element-plus` 主题色 */
|
||||||
const setEpThemeColor = (color: string) => {
|
const setEpThemeColor = (color: string) => {
|
||||||
useEpThemeStoreHook().setEpThemeColor(color);
|
useEpThemeStoreHook().setEpThemeColor(color);
|
||||||
body.style.setProperty("--el-color-primary-active", shadeBgColor(color));
|
|
||||||
document.documentElement.style.setProperty("--el-color-primary", color);
|
document.documentElement.style.setProperty("--el-color-primary", color);
|
||||||
for (let i = 1; i <= 9; i++) {
|
|
||||||
document.documentElement.style.setProperty(
|
|
||||||
`--el-color-primary-light-${i}`,
|
|
||||||
lighten(color, i / 10)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
for (let i = 1; i <= 2; i++) {
|
for (let i = 1; i <= 2; i++) {
|
||||||
document.documentElement.style.setProperty(
|
setPropertyPrimary("dark", i, color);
|
||||||
`--el-color-primary-dark-${i}`,
|
}
|
||||||
darken(color, i / 10)
|
for (let i = 1; i <= 9; i++) {
|
||||||
);
|
setPropertyPrimary("light", i, color);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { computed } from "vue";
|
import { computed } from "vue";
|
||||||
|
import { storeToRefs } from "pinia";
|
||||||
import { getConfig } from "@/config";
|
import { getConfig } from "@/config";
|
||||||
import { emitter } from "@/utils/mitt";
|
import { emitter } from "@/utils/mitt";
|
||||||
import { routeMetaType } from "../types";
|
import { routeMetaType } from "../types";
|
||||||
@@ -7,6 +8,7 @@ import { useRouter, useRoute } from "vue-router";
|
|||||||
import { router, remainingPaths } from "@/router";
|
import { router, remainingPaths } from "@/router";
|
||||||
import { useAppStoreHook } from "@/store/modules/app";
|
import { useAppStoreHook } from "@/store/modules/app";
|
||||||
import { useUserStoreHook } from "@/store/modules/user";
|
import { useUserStoreHook } from "@/store/modules/user";
|
||||||
|
import { usePermissionStoreHook } from "@/store/modules/permission";
|
||||||
|
|
||||||
const errorInfo = "当前路由配置不正确,请检查配置";
|
const errorInfo = "当前路由配置不正确,请检查配置";
|
||||||
|
|
||||||
@@ -14,6 +16,9 @@ export function useNav() {
|
|||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const pureApp = useAppStoreHook();
|
const pureApp = useAppStoreHook();
|
||||||
const routers = useRouter().options.routes;
|
const routers = useRouter().options.routes;
|
||||||
|
const { wholeMenus } = storeToRefs(usePermissionStoreHook());
|
||||||
|
/** 平台`layout`中所有`el-tooltip`的`effect`配置,默认`light` */
|
||||||
|
const tooltipEffect = getConfig()?.TooltipEffect ?? "light";
|
||||||
|
|
||||||
/** 用户名 */
|
/** 用户名 */
|
||||||
const username = computed(() => {
|
const username = computed(() => {
|
||||||
@@ -81,6 +86,7 @@ export function useNav() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function menuSelect(indexPath: string, routers): void {
|
function menuSelect(indexPath: string, routers): void {
|
||||||
|
if (wholeMenus.value.length === 0) return;
|
||||||
if (isRemaining(indexPath)) return;
|
if (isRemaining(indexPath)) return;
|
||||||
let parentPath = "";
|
let parentPath = "";
|
||||||
const parentPathIndex = indexPath.lastIndexOf("/");
|
const parentPathIndex = indexPath.lastIndexOf("/");
|
||||||
@@ -132,6 +138,7 @@ export function useNav() {
|
|||||||
isCollapse,
|
isCollapse,
|
||||||
pureApp,
|
pureApp,
|
||||||
username,
|
username,
|
||||||
avatarsStyle
|
avatarsStyle,
|
||||||
|
tooltipEffect
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,14 +9,21 @@ import {
|
|||||||
getCurrentInstance
|
getCurrentInstance
|
||||||
} from "vue";
|
} from "vue";
|
||||||
import { tagsViewsType } from "../types";
|
import { tagsViewsType } from "../types";
|
||||||
import { isEqual } from "lodash-unified";
|
|
||||||
import type { StorageConfigs } from "/#/index";
|
|
||||||
import { useEventListener } from "@vueuse/core";
|
import { useEventListener } from "@vueuse/core";
|
||||||
import { useRoute, useRouter } from "vue-router";
|
import { useRoute, useRouter } from "vue-router";
|
||||||
|
import { isEqual, isBoolean } from "@pureadmin/utils";
|
||||||
import { useSettingStoreHook } from "@/store/modules/settings";
|
import { useSettingStoreHook } from "@/store/modules/settings";
|
||||||
import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
|
import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
|
||||||
import { storageLocal, toggleClass, hasClass } from "@pureadmin/utils";
|
import { storageLocal, toggleClass, hasClass } from "@pureadmin/utils";
|
||||||
|
|
||||||
|
import Fullscreen from "@iconify-icons/ri/fullscreen-fill";
|
||||||
|
import CloseAllTags from "@iconify-icons/ri/subtract-line";
|
||||||
|
import CloseOtherTags from "@iconify-icons/ri/text-spacing";
|
||||||
|
import CloseRightTags from "@iconify-icons/ri/text-direction-l";
|
||||||
|
import CloseLeftTags from "@iconify-icons/ri/text-direction-r";
|
||||||
|
import RefreshRight from "@iconify-icons/ep/refresh-right";
|
||||||
|
import Close from "@iconify-icons/ep/close";
|
||||||
|
|
||||||
export function useTags() {
|
export function useTags() {
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -33,13 +40,13 @@ export function useTags() {
|
|||||||
|
|
||||||
/** 显示模式,默认灵动模式 */
|
/** 显示模式,默认灵动模式 */
|
||||||
const showModel = ref(
|
const showModel = ref(
|
||||||
storageLocal.getItem<StorageConfigs>("responsive-configure")?.showModel ||
|
storageLocal().getItem<StorageConfigs>("responsive-configure")?.showModel ||
|
||||||
"smart"
|
"smart"
|
||||||
);
|
);
|
||||||
/** 是否隐藏标签页,默认显示 */
|
/** 是否隐藏标签页,默认显示 */
|
||||||
const showTags =
|
const showTags =
|
||||||
ref(
|
ref(
|
||||||
storageLocal.getItem<StorageConfigs>("responsive-configure").hideTabs
|
storageLocal().getItem<StorageConfigs>("responsive-configure").hideTabs
|
||||||
) ?? ref("false");
|
) ?? ref("false");
|
||||||
const multiTags: any = computed(() => {
|
const multiTags: any = computed(() => {
|
||||||
return useMultiTagsStoreHook().multiTags;
|
return useMultiTagsStoreHook().multiTags;
|
||||||
@@ -47,56 +54,56 @@ export function useTags() {
|
|||||||
|
|
||||||
const tagsViews = reactive<Array<tagsViewsType>>([
|
const tagsViews = reactive<Array<tagsViewsType>>([
|
||||||
{
|
{
|
||||||
icon: "refresh-right",
|
icon: RefreshRight,
|
||||||
text: "重新加载",
|
text: "重新加载",
|
||||||
divided: false,
|
divided: false,
|
||||||
disabled: false,
|
disabled: false,
|
||||||
show: true
|
show: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: "close",
|
icon: Close,
|
||||||
text: "关闭当前标签页",
|
text: "关闭当前标签页",
|
||||||
divided: false,
|
divided: false,
|
||||||
disabled: multiTags.value.length > 1 ? false : true,
|
disabled: multiTags.value.length > 1 ? false : true,
|
||||||
show: true
|
show: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: "close-left-tags",
|
icon: CloseLeftTags,
|
||||||
text: "关闭左侧标签页",
|
text: "关闭左侧标签页",
|
||||||
divided: true,
|
divided: true,
|
||||||
disabled: multiTags.value.length > 1 ? false : true,
|
disabled: multiTags.value.length > 1 ? false : true,
|
||||||
show: true
|
show: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: "close-right-tags",
|
icon: CloseRightTags,
|
||||||
text: "关闭右侧标签页",
|
text: "关闭右侧标签页",
|
||||||
divided: false,
|
divided: false,
|
||||||
disabled: multiTags.value.length > 1 ? false : true,
|
disabled: multiTags.value.length > 1 ? false : true,
|
||||||
show: true
|
show: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: "close-other-tags",
|
icon: CloseOtherTags,
|
||||||
text: "关闭其他标签页",
|
text: "关闭其他标签页",
|
||||||
divided: true,
|
divided: true,
|
||||||
disabled: multiTags.value.length > 2 ? false : true,
|
disabled: multiTags.value.length > 2 ? false : true,
|
||||||
show: true
|
show: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: "close-all-tags",
|
icon: CloseAllTags,
|
||||||
text: "关闭全部标签页",
|
text: "关闭全部标签页",
|
||||||
divided: false,
|
divided: false,
|
||||||
disabled: multiTags.value.length > 1 ? false : true,
|
disabled: multiTags.value.length > 1 ? false : true,
|
||||||
show: true
|
show: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: "fullscreen",
|
icon: Fullscreen,
|
||||||
text: "整体页面全屏",
|
text: "整体页面全屏",
|
||||||
divided: true,
|
divided: true,
|
||||||
disabled: false,
|
disabled: false,
|
||||||
show: true
|
show: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: "fullscreen",
|
icon: Fullscreen,
|
||||||
text: "内容区全屏",
|
text: "内容区全屏",
|
||||||
divided: false,
|
divided: false,
|
||||||
disabled: false,
|
disabled: false,
|
||||||
@@ -105,15 +112,14 @@ export function useTags() {
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
function conditionHandle(item, previous, next) {
|
function conditionHandle(item, previous, next) {
|
||||||
if (
|
if (isBoolean(route?.meta?.showLink) && route?.meta?.showLink === false) {
|
||||||
Object.keys(route.query).length === 0 &&
|
if (Object.keys(route.query).length > 0) {
|
||||||
Object.keys(route.params).length === 0
|
return isEqual(route.query, item.query) ? previous : next;
|
||||||
) {
|
} else {
|
||||||
return route.path === item.path ? previous : next;
|
return isEqual(route.params, item.params) ? previous : next;
|
||||||
} else if (Object.keys(route.query).length > 0) {
|
}
|
||||||
return isEqual(route.query, item.query) ? previous : next;
|
|
||||||
} else {
|
} else {
|
||||||
return isEqual(route.params, item.params) ? previous : next;
|
return route.path === item.path ? previous : next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -188,11 +194,11 @@ export function useTags() {
|
|||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (!showModel.value) {
|
if (!showModel.value) {
|
||||||
const configure = storageLocal.getItem<StorageConfigs>(
|
const configure = storageLocal().getItem<StorageConfigs>(
|
||||||
"responsive-configure"
|
"responsive-configure"
|
||||||
);
|
);
|
||||||
configure.showModel = "card";
|
configure.showModel = "card";
|
||||||
storageLocal.setItem("responsive-configure", configure);
|
storageLocal().setItem("responsive-configure", configure);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import "animate.css";
|
||||||
|
// 引入 src/components/ReIcon/src/offlineIcon.ts 文件中所有使用addIcon添加过的本地图标
|
||||||
|
import "@/components/ReIcon/src/offlineIcon";
|
||||||
import { setType } from "./types";
|
import { setType } from "./types";
|
||||||
import { emitter } from "@/utils/mitt";
|
import { emitter } from "@/utils/mitt";
|
||||||
import { useLayout } from "./hooks/useLayout";
|
import { useLayout } from "./hooks/useLayout";
|
||||||
@@ -70,7 +73,7 @@ let isAutoCloseSidebar = true;
|
|||||||
// 监听容器
|
// 监听容器
|
||||||
emitter.on("resize", ({ detail }) => {
|
emitter.on("resize", ({ detail }) => {
|
||||||
if (isMobile) return;
|
if (isMobile) return;
|
||||||
let { width } = detail;
|
const { width } = detail;
|
||||||
width <= 760 ? setTheme("vertical") : setTheme(useAppStoreHook().layout);
|
width <= 760 ? setTheme("vertical") : setTheme(useAppStoreHook().layout);
|
||||||
/** width app-wrapper类容器宽度
|
/** width app-wrapper类容器宽度
|
||||||
* 0 < width <= 760 隐藏侧边栏
|
* 0 < width <= 760 隐藏侧边栏
|
||||||
|
|||||||
@@ -2,129 +2,104 @@
|
|||||||
* @description ⚠️:此文件仅供主题插件使用,请不要在此文件中导出别的工具函数(仅在页面加载前运行)
|
* @description ⚠️:此文件仅供主题插件使用,请不要在此文件中导出别的工具函数(仅在页面加载前运行)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { EpThemeColor } from "../../../public/serverConfig.json";
|
import { type multipleScopeVarsOptions } from "@pureadmin/theme";
|
||||||
|
|
||||||
type MultipleScopeVarsItem = {
|
|
||||||
scopeName: string;
|
|
||||||
varsContent: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** 将vxe默认主题色和ep默认主题色保持一致 */
|
|
||||||
const vxeColor = EpThemeColor;
|
|
||||||
/** 预设主题色 */
|
/** 预设主题色 */
|
||||||
const themeColors = {
|
const themeColors = {
|
||||||
default: {
|
default: {
|
||||||
vxeColor,
|
|
||||||
subMenuActiveText: "#fff",
|
subMenuActiveText: "#fff",
|
||||||
menuBg: "#001529",
|
menuBg: "#001529",
|
||||||
menuHover: "#4091f7",
|
menuHover: "#4091f7",
|
||||||
subMenuBg: "#0f0303",
|
subMenuBg: "#0f0303",
|
||||||
subMenuActiveBg: "#4091f7",
|
subMenuActiveBg: "#4091f7",
|
||||||
navTextColor: "#fff",
|
|
||||||
menuText: "rgb(254 254 254 / 65%)",
|
menuText: "rgb(254 254 254 / 65%)",
|
||||||
sidebarLogo: "#002140",
|
sidebarLogo: "#002140",
|
||||||
menuTitleHover: "#fff",
|
menuTitleHover: "#fff",
|
||||||
menuActiveBefore: "#4091f7"
|
menuActiveBefore: "#4091f7"
|
||||||
},
|
},
|
||||||
light: {
|
light: {
|
||||||
vxeColor,
|
|
||||||
subMenuActiveText: "#409eff",
|
subMenuActiveText: "#409eff",
|
||||||
menuBg: "#fff",
|
menuBg: "#fff",
|
||||||
menuHover: "#e0ebf6",
|
menuHover: "#e0ebf6",
|
||||||
subMenuBg: "#fff",
|
subMenuBg: "#fff",
|
||||||
subMenuActiveBg: "#e0ebf6",
|
subMenuActiveBg: "#e0ebf6",
|
||||||
navTextColor: "#7a80b4",
|
|
||||||
menuText: "#7a80b4",
|
menuText: "#7a80b4",
|
||||||
sidebarLogo: "#fff",
|
sidebarLogo: "#fff",
|
||||||
menuTitleHover: "#000",
|
menuTitleHover: "#000",
|
||||||
menuActiveBefore: "#4091f7"
|
menuActiveBefore: "#4091f7"
|
||||||
},
|
},
|
||||||
dusk: {
|
dusk: {
|
||||||
vxeColor: "#f5222d",
|
|
||||||
subMenuActiveText: "#fff",
|
subMenuActiveText: "#fff",
|
||||||
menuBg: "#2a0608",
|
menuBg: "#2a0608",
|
||||||
menuHover: "#e13c39",
|
menuHover: "#e13c39",
|
||||||
subMenuBg: "#000",
|
subMenuBg: "#000",
|
||||||
subMenuActiveBg: "#e13c39",
|
subMenuActiveBg: "#e13c39",
|
||||||
navTextColor: "#red",
|
|
||||||
menuText: "rgb(254 254 254 / 65.1%)",
|
menuText: "rgb(254 254 254 / 65.1%)",
|
||||||
sidebarLogo: "#42090c",
|
sidebarLogo: "#42090c",
|
||||||
menuTitleHover: "#fff",
|
menuTitleHover: "#fff",
|
||||||
menuActiveBefore: "#e13c39"
|
menuActiveBefore: "#e13c39"
|
||||||
},
|
},
|
||||||
volcano: {
|
volcano: {
|
||||||
vxeColor: "#fa541c",
|
|
||||||
subMenuActiveText: "#fff",
|
subMenuActiveText: "#fff",
|
||||||
menuBg: "#2b0e05",
|
menuBg: "#2b0e05",
|
||||||
menuHover: "#e85f33",
|
menuHover: "#e85f33",
|
||||||
subMenuBg: "#0f0603",
|
subMenuBg: "#0f0603",
|
||||||
subMenuActiveBg: "#e85f33",
|
subMenuActiveBg: "#e85f33",
|
||||||
navTextColor: "#fff",
|
|
||||||
menuText: "rgb(254 254 254 / 65%)",
|
menuText: "rgb(254 254 254 / 65%)",
|
||||||
sidebarLogo: "#441708",
|
sidebarLogo: "#441708",
|
||||||
menuTitleHover: "#fff",
|
menuTitleHover: "#fff",
|
||||||
menuActiveBefore: "#e85f33"
|
menuActiveBefore: "#e85f33"
|
||||||
},
|
},
|
||||||
yellow: {
|
yellow: {
|
||||||
vxeColor: "#fadb14",
|
|
||||||
subMenuActiveText: "#d25f00",
|
subMenuActiveText: "#d25f00",
|
||||||
menuBg: "#2b2503",
|
menuBg: "#2b2503",
|
||||||
menuHover: "#f6da4d",
|
menuHover: "#f6da4d",
|
||||||
subMenuBg: "#0f0603",
|
subMenuBg: "#0f0603",
|
||||||
subMenuActiveBg: "#f6da4d",
|
subMenuActiveBg: "#f6da4d",
|
||||||
navTextColor: "#fff",
|
|
||||||
menuText: "rgb(254 254 254 / 65%)",
|
menuText: "rgb(254 254 254 / 65%)",
|
||||||
sidebarLogo: "#443b05",
|
sidebarLogo: "#443b05",
|
||||||
menuTitleHover: "#fff",
|
menuTitleHover: "#fff",
|
||||||
menuActiveBefore: "#f6da4d"
|
menuActiveBefore: "#f6da4d"
|
||||||
},
|
},
|
||||||
mingQing: {
|
mingQing: {
|
||||||
vxeColor: "#13c2c2",
|
|
||||||
subMenuActiveText: "#fff",
|
subMenuActiveText: "#fff",
|
||||||
menuBg: "#032121",
|
menuBg: "#032121",
|
||||||
menuHover: "#59bfc1",
|
menuHover: "#59bfc1",
|
||||||
subMenuBg: "#000",
|
subMenuBg: "#000",
|
||||||
subMenuActiveBg: "#59bfc1",
|
subMenuActiveBg: "#59bfc1",
|
||||||
navTextColor: "#7a80b4",
|
|
||||||
menuText: "#7a80b4",
|
menuText: "#7a80b4",
|
||||||
sidebarLogo: "#053434",
|
sidebarLogo: "#053434",
|
||||||
menuTitleHover: "#fff",
|
menuTitleHover: "#fff",
|
||||||
menuActiveBefore: "#59bfc1"
|
menuActiveBefore: "#59bfc1"
|
||||||
},
|
},
|
||||||
auroraGreen: {
|
auroraGreen: {
|
||||||
vxeColor: "#52c41a",
|
|
||||||
subMenuActiveText: "#fff",
|
subMenuActiveText: "#fff",
|
||||||
menuBg: "#0b1e15",
|
menuBg: "#0b1e15",
|
||||||
menuHover: "#60ac80",
|
menuHover: "#60ac80",
|
||||||
subMenuBg: "#000",
|
subMenuBg: "#000",
|
||||||
subMenuActiveBg: "#60ac80",
|
subMenuActiveBg: "#60ac80",
|
||||||
navTextColor: "#7a80b4",
|
|
||||||
menuText: "#7a80b4",
|
menuText: "#7a80b4",
|
||||||
sidebarLogo: "#112f21",
|
sidebarLogo: "#112f21",
|
||||||
menuTitleHover: "#fff",
|
menuTitleHover: "#fff",
|
||||||
menuActiveBefore: "#60ac80"
|
menuActiveBefore: "#60ac80"
|
||||||
},
|
},
|
||||||
pink: {
|
pink: {
|
||||||
vxeColor: "#eb2f96",
|
|
||||||
subMenuActiveText: "#fff",
|
subMenuActiveText: "#fff",
|
||||||
menuBg: "#28081a",
|
menuBg: "#28081a",
|
||||||
menuHover: "#d84493",
|
menuHover: "#d84493",
|
||||||
subMenuBg: "#000",
|
subMenuBg: "#000",
|
||||||
subMenuActiveBg: "#d84493",
|
subMenuActiveBg: "#d84493",
|
||||||
navTextColor: "#7a80b4",
|
|
||||||
menuText: "#7a80b4",
|
menuText: "#7a80b4",
|
||||||
sidebarLogo: "#3f0d29",
|
sidebarLogo: "#3f0d29",
|
||||||
menuTitleHover: "#fff",
|
menuTitleHover: "#fff",
|
||||||
menuActiveBefore: "#d84493"
|
menuActiveBefore: "#d84493"
|
||||||
},
|
},
|
||||||
saucePurple: {
|
saucePurple: {
|
||||||
vxeColor: "#722ed1",
|
|
||||||
subMenuActiveText: "#fff",
|
subMenuActiveText: "#fff",
|
||||||
menuBg: "#130824",
|
menuBg: "#130824",
|
||||||
menuHover: "#693ac9",
|
menuHover: "#693ac9",
|
||||||
subMenuBg: "#000",
|
subMenuBg: "#000",
|
||||||
subMenuActiveBg: "#693ac9",
|
subMenuActiveBg: "#693ac9",
|
||||||
navTextColor: "#7a80b4",
|
|
||||||
menuText: "#7a80b4",
|
menuText: "#7a80b4",
|
||||||
sidebarLogo: "#1f0c38",
|
sidebarLogo: "#1f0c38",
|
||||||
menuTitleHover: "#fff",
|
menuTitleHover: "#fff",
|
||||||
@@ -135,25 +110,23 @@ const themeColors = {
|
|||||||
/**
|
/**
|
||||||
* @description 将预设主题色处理成主题插件所需格式
|
* @description 将预设主题色处理成主题插件所需格式
|
||||||
*/
|
*/
|
||||||
export const genScssMultipleScopeVars = (): MultipleScopeVarsItem[] => {
|
export const genScssMultipleScopeVars = (): multipleScopeVarsOptions[] => {
|
||||||
const result = [] as MultipleScopeVarsItem[];
|
const result = [] as multipleScopeVarsOptions[];
|
||||||
Object.keys(themeColors).forEach(key => {
|
Object.keys(themeColors).forEach(key => {
|
||||||
result.push({
|
result.push({
|
||||||
scopeName: `layout-theme-${key}`,
|
scopeName: `layout-theme-${key}`,
|
||||||
varsContent: `
|
varsContent: `
|
||||||
$vxe-primary-color: ${themeColors[key].vxeColor} !default;
|
|
||||||
$subMenuActiveText: ${themeColors[key].subMenuActiveText} !default;
|
$subMenuActiveText: ${themeColors[key].subMenuActiveText} !default;
|
||||||
$menuBg: ${themeColors[key].menuBg} !default;
|
$menuBg: ${themeColors[key].menuBg} !default;
|
||||||
$menuHover: ${themeColors[key].menuHover} !default;
|
$menuHover: ${themeColors[key].menuHover} !default;
|
||||||
$subMenuBg: ${themeColors[key].subMenuBg} !default;
|
$subMenuBg: ${themeColors[key].subMenuBg} !default;
|
||||||
$subMenuActiveBg: ${themeColors[key].subMenuActiveBg} !default;
|
$subMenuActiveBg: ${themeColors[key].subMenuActiveBg} !default;
|
||||||
$navTextColor: ${themeColors[key].navTextColor} !default;
|
|
||||||
$menuText: ${themeColors[key].menuText} !default;
|
$menuText: ${themeColors[key].menuText} !default;
|
||||||
$sidebarLogo: ${themeColors[key].sidebarLogo} !default;
|
$sidebarLogo: ${themeColors[key].sidebarLogo} !default;
|
||||||
$menuTitleHover: ${themeColors[key].menuTitleHover} !default;
|
$menuTitleHover: ${themeColors[key].menuTitleHover} !default;
|
||||||
$menuActiveBefore: ${themeColors[key].menuActiveBefore} !default;
|
$menuActiveBefore: ${themeColors[key].menuActiveBefore} !default;
|
||||||
`
|
`
|
||||||
} as MultipleScopeVarsItem);
|
} as multipleScopeVarsOptions);
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,17 +1,19 @@
|
|||||||
|
import type { IconifyIcon } from "@iconify/vue";
|
||||||
|
|
||||||
export const routerArrays: Array<RouteConfigs> = [
|
export const routerArrays: Array<RouteConfigs> = [
|
||||||
{
|
{
|
||||||
path: "/welcome",
|
path: "/welcome",
|
||||||
parentPath: "/",
|
parentPath: "/",
|
||||||
meta: {
|
meta: {
|
||||||
title: "首页",
|
title: "首页",
|
||||||
icon: "home-filled"
|
icon: "homeFilled"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
export type routeMetaType = {
|
export type routeMetaType = {
|
||||||
title?: string;
|
title?: string;
|
||||||
icon?: string;
|
icon?: string | IconifyIcon;
|
||||||
showLink?: boolean;
|
showLink?: boolean;
|
||||||
savedPosition?: boolean;
|
savedPosition?: boolean;
|
||||||
auths?: Array<string>;
|
auths?: Array<string>;
|
||||||
@@ -32,7 +34,7 @@ export type multiTagsType = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export type tagsViewsType = {
|
export type tagsViewsType = {
|
||||||
icon: string;
|
icon: string | IconifyIcon;
|
||||||
text: string;
|
text: string;
|
||||||
divided: boolean;
|
divided: boolean;
|
||||||
disabled: boolean;
|
disabled: boolean;
|
||||||
|
|||||||
@@ -6,21 +6,18 @@ import { getServerConfig } from "./config";
|
|||||||
import { createApp, Directive } from "vue";
|
import { createApp, Directive } from "vue";
|
||||||
import { MotionPlugin } from "@vueuse/motion";
|
import { MotionPlugin } from "@vueuse/motion";
|
||||||
// import { useEcharts } from "@/plugins/echarts";
|
// import { useEcharts } from "@/plugins/echarts";
|
||||||
// import { useTable } from "@/plugins/vxe-table";
|
|
||||||
import { injectResponsiveStorage } from "@/utils/responsive";
|
import { injectResponsiveStorage } from "@/utils/responsive";
|
||||||
|
|
||||||
// import Table from "@pureadmin/table";
|
// import Table from "@pureadmin/table";
|
||||||
// import PureDescriptions from "@pureadmin/descriptions";
|
// import PureDescriptions from "@pureadmin/descriptions";
|
||||||
|
|
||||||
import "animate.css";
|
|
||||||
// 引入重置样式
|
// 引入重置样式
|
||||||
import "./style/reset.scss";
|
import "./style/reset.scss";
|
||||||
// 导入公共样式
|
// 导入公共样式
|
||||||
import "./style/index.scss";
|
import "./style/index.scss";
|
||||||
|
// 一定要在main.ts中导入tailwind.css,防止vite每次hmr都会请求src/style/index.scss整体css文件导致热更新慢的问题
|
||||||
|
import "./style/tailwind.css";
|
||||||
import "element-plus/dist/index.css";
|
import "element-plus/dist/index.css";
|
||||||
import "@pureadmin/components/dist/index.css";
|
|
||||||
import "@pureadmin/components/dist/theme.css";
|
|
||||||
import "@pureadmin/components/dist/dark.scss";
|
|
||||||
// 导入字体图标
|
// 导入字体图标
|
||||||
import "./assets/iconfont/iconfont.js";
|
import "./assets/iconfont/iconfont.js";
|
||||||
import "./assets/iconfont/iconfont.css";
|
import "./assets/iconfont/iconfont.css";
|
||||||
@@ -56,6 +53,5 @@ getServerConfig(app).then(async config => {
|
|||||||
// .use(useEcharts);
|
// .use(useEcharts);
|
||||||
// .use(Table);
|
// .use(Table);
|
||||||
// .use(PureDescriptions);
|
// .use(PureDescriptions);
|
||||||
// .use(useTable);
|
|
||||||
app.mount("#app");
|
app.mount("#app");
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { App } from "vue";
|
import type { App } from "vue";
|
||||||
import * as echarts from "echarts/core";
|
import * as echarts from "echarts/core";
|
||||||
import { SVGRenderer } from "echarts/renderers";
|
import { CanvasRenderer } from "echarts/renderers";
|
||||||
import { PieChart, BarChart, LineChart } from "echarts/charts";
|
import { PieChart, BarChart, LineChart } from "echarts/charts";
|
||||||
import {
|
import {
|
||||||
GridComponent,
|
GridComponent,
|
||||||
@@ -19,7 +19,7 @@ use([
|
|||||||
PieChart,
|
PieChart,
|
||||||
BarChart,
|
BarChart,
|
||||||
LineChart,
|
LineChart,
|
||||||
SVGRenderer,
|
CanvasRenderer,
|
||||||
GridComponent,
|
GridComponent,
|
||||||
TitleComponent,
|
TitleComponent,
|
||||||
LegendComponent,
|
LegendComponent,
|
||||||
@@ -33,6 +33,7 @@ use([
|
|||||||
/**
|
/**
|
||||||
* @description 按需引入echarts
|
* @description 按需引入echarts
|
||||||
* @see {@link https://echarts.apache.org/handbook/zh/basics/import#%E6%8C%89%E9%9C%80%E5%BC%95%E5%85%A5-echarts-%E5%9B%BE%E8%A1%A8%E5%92%8C%E7%BB%84%E4%BB%B6}
|
* @see {@link https://echarts.apache.org/handbook/zh/basics/import#%E6%8C%89%E9%9C%80%E5%BC%95%E5%85%A5-echarts-%E5%9B%BE%E8%A1%A8%E5%92%8C%E7%BB%84%E4%BB%B6}
|
||||||
|
* @see 温馨提示:必须将 `$echarts` 添加到全局 `globalProperties` ,为了配合 https://pure-admin-utils.netlify.app/hooks/useEcharts/useEcharts.html 使用
|
||||||
*/
|
*/
|
||||||
export function useEcharts(app: App) {
|
export function useEcharts(app: App) {
|
||||||
app.config.globalProperties.$echarts = echarts;
|
app.config.globalProperties.$echarts = echarts;
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
@import "vxe-table/styles/variable.scss";
|
|
||||||
@import "vxe-table/styles/modules.scss";
|
|
||||||
|
|
||||||
i {
|
|
||||||
border-color: initial;
|
|
||||||
}
|
|
||||||
@@ -1,98 +0,0 @@
|
|||||||
import "xe-utils";
|
|
||||||
import "./index.scss";
|
|
||||||
import { App } from "vue";
|
|
||||||
import "font-awesome/css/font-awesome.min.css";
|
|
||||||
|
|
||||||
import {
|
|
||||||
// 核心
|
|
||||||
VXETable,
|
|
||||||
// 表格功能
|
|
||||||
Icon,
|
|
||||||
Filter,
|
|
||||||
Edit,
|
|
||||||
Menu,
|
|
||||||
Export,
|
|
||||||
Keyboard,
|
|
||||||
Validator,
|
|
||||||
// 可选组件
|
|
||||||
Column,
|
|
||||||
Colgroup,
|
|
||||||
Grid,
|
|
||||||
Tooltip,
|
|
||||||
Toolbar,
|
|
||||||
Pager,
|
|
||||||
Form,
|
|
||||||
FormItem,
|
|
||||||
FormGather,
|
|
||||||
Checkbox,
|
|
||||||
CheckboxGroup,
|
|
||||||
Radio,
|
|
||||||
RadioGroup,
|
|
||||||
RadioButton,
|
|
||||||
Switch,
|
|
||||||
Input,
|
|
||||||
Select,
|
|
||||||
Optgroup,
|
|
||||||
Option,
|
|
||||||
Textarea,
|
|
||||||
Button,
|
|
||||||
Modal,
|
|
||||||
List,
|
|
||||||
Pulldown,
|
|
||||||
// 表格
|
|
||||||
Table
|
|
||||||
} from "vxe-table";
|
|
||||||
|
|
||||||
// 全局默认参数
|
|
||||||
VXETable.setup({
|
|
||||||
size: "medium",
|
|
||||||
version: 0,
|
|
||||||
zIndex: 1002,
|
|
||||||
table: {
|
|
||||||
// 自动监听父元素的变化去重新计算表格
|
|
||||||
autoResize: true,
|
|
||||||
// 鼠标移到行是否要高亮显示
|
|
||||||
highlightHoverRow: true
|
|
||||||
},
|
|
||||||
input: {
|
|
||||||
clearable: true
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
export function useTable(app: App) {
|
|
||||||
app
|
|
||||||
.use(Icon)
|
|
||||||
.use(Filter)
|
|
||||||
.use(Edit)
|
|
||||||
.use(Menu)
|
|
||||||
.use(Export)
|
|
||||||
.use(Keyboard)
|
|
||||||
.use(Validator)
|
|
||||||
// 可选组件
|
|
||||||
.use(Column)
|
|
||||||
.use(Colgroup)
|
|
||||||
.use(Grid)
|
|
||||||
.use(Tooltip)
|
|
||||||
.use(Toolbar)
|
|
||||||
.use(Pager)
|
|
||||||
.use(Form)
|
|
||||||
.use(FormItem)
|
|
||||||
.use(FormGather)
|
|
||||||
.use(Checkbox)
|
|
||||||
.use(CheckboxGroup)
|
|
||||||
.use(Radio)
|
|
||||||
.use(RadioGroup)
|
|
||||||
.use(RadioButton)
|
|
||||||
.use(Switch)
|
|
||||||
.use(Input)
|
|
||||||
.use(Select)
|
|
||||||
.use(Optgroup)
|
|
||||||
.use(Option)
|
|
||||||
.use(Textarea)
|
|
||||||
.use(Button)
|
|
||||||
.use(Modal)
|
|
||||||
.use(List)
|
|
||||||
.use(Pulldown)
|
|
||||||
// 安装表格
|
|
||||||
.use(Table);
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
|
// import "@/utils/sso";
|
||||||
import { getConfig } from "@/config";
|
import { getConfig } from "@/config";
|
||||||
import { toRouteType } from "./types";
|
|
||||||
import NProgress from "@/utils/progress";
|
import NProgress from "@/utils/progress";
|
||||||
import { findIndex } from "lodash-unified";
|
|
||||||
import { sessionKey, type DataInfo } from "@/utils/auth";
|
import { sessionKey, type DataInfo } from "@/utils/auth";
|
||||||
import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
|
import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
|
||||||
import { usePermissionStoreHook } from "@/store/modules/permission";
|
import { usePermissionStoreHook } from "@/store/modules/permission";
|
||||||
@@ -21,19 +20,28 @@ import {
|
|||||||
formatTwoStageRoutes,
|
formatTwoStageRoutes,
|
||||||
formatFlatteningRoutes
|
formatFlatteningRoutes
|
||||||
} from "./utils";
|
} from "./utils";
|
||||||
import {
|
import { buildHierarchyTree } from "@/utils/tree";
|
||||||
buildHierarchyTree,
|
import { isUrl, openLink, storageSession } from "@pureadmin/utils";
|
||||||
openLink,
|
|
||||||
isUrl,
|
|
||||||
storageSession
|
|
||||||
} from "@pureadmin/utils";
|
|
||||||
|
|
||||||
import homeRouter from "./modules/home";
|
|
||||||
import errorRouter from "./modules/error";
|
|
||||||
import remainingRouter from "./modules/remaining";
|
import remainingRouter from "./modules/remaining";
|
||||||
|
|
||||||
|
/** 自动导入全部静态路由,无需再手动引入!匹配 src/router/modules 目录(任何嵌套级别)中具有 .ts 扩展名的所有文件,除了 remaining.ts 文件
|
||||||
|
* 如何匹配所有文件请看:https://github.com/mrmlnc/fast-glob#basic-syntax
|
||||||
|
* 如何排除文件请看:https://cn.vitejs.dev/guide/features.html#negative-patterns
|
||||||
|
*/
|
||||||
|
const modules: Record<string, any> = import.meta.glob(
|
||||||
|
["./modules/**/*.ts", "!./modules/**/remaining.ts"],
|
||||||
|
{
|
||||||
|
eager: true
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
/** 原始静态路由(未做任何处理) */
|
/** 原始静态路由(未做任何处理) */
|
||||||
const routes = [homeRouter, errorRouter];
|
const routes = [];
|
||||||
|
|
||||||
|
Object.keys(modules).forEach(key => {
|
||||||
|
routes.push(modules[key].default);
|
||||||
|
});
|
||||||
|
|
||||||
/** 导出处理后的静态路由(三级及以上的路由全部拍成二级) */
|
/** 导出处理后的静态路由(三级及以上的路由全部拍成二级) */
|
||||||
export const constantRoutes: Array<RouteRecordRaw> = formatTwoStageRoutes(
|
export const constantRoutes: Array<RouteRecordRaw> = formatTwoStageRoutes(
|
||||||
@@ -96,7 +104,7 @@ router.beforeEach((to: toRouteType, _from, next) => {
|
|||||||
handleAliveRoute(newMatched);
|
handleAliveRoute(newMatched);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const userInfo = storageSession.getItem<DataInfo<number>>(sessionKey);
|
const userInfo = storageSession().getItem<DataInfo<number>>(sessionKey);
|
||||||
NProgress.start();
|
NProgress.start();
|
||||||
const externalLink = isUrl(to?.name as string);
|
const externalLink = isUrl(to?.name as string);
|
||||||
if (!externalLink) {
|
if (!externalLink) {
|
||||||
@@ -107,6 +115,10 @@ router.beforeEach((to: toRouteType, _from, next) => {
|
|||||||
else document.title = item.meta.title as string;
|
else document.title = item.meta.title as string;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
/** 如果已经登录并存在登录信息后不能跳转到路由白名单,而是继续保持在当前页面 */
|
||||||
|
function toCorrectRoute() {
|
||||||
|
whiteList.includes(to.fullPath) ? next(_from.fullPath) : next();
|
||||||
|
}
|
||||||
if (userInfo) {
|
if (userInfo) {
|
||||||
// 无权限跳转403页面
|
// 无权限跳转403页面
|
||||||
if (to.meta?.roles && !isOneOfArray(to.meta?.roles, userInfo?.roles)) {
|
if (to.meta?.roles && !isOneOfArray(to.meta?.roles, userInfo?.roles)) {
|
||||||
@@ -118,7 +130,7 @@ router.beforeEach((to: toRouteType, _from, next) => {
|
|||||||
openLink(to?.name as string);
|
openLink(to?.name as string);
|
||||||
NProgress.done();
|
NProgress.done();
|
||||||
} else {
|
} else {
|
||||||
next();
|
toCorrectRoute();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 刷新
|
// 刷新
|
||||||
@@ -129,14 +141,10 @@ router.beforeEach((to: toRouteType, _from, next) => {
|
|||||||
initRouter().then((router: Router) => {
|
initRouter().then((router: Router) => {
|
||||||
if (!useMultiTagsStoreHook().getMultiTagsCache) {
|
if (!useMultiTagsStoreHook().getMultiTagsCache) {
|
||||||
const { path } = to;
|
const { path } = to;
|
||||||
const index = findIndex(remainingRouter, v => {
|
const route = findRouteByPath(
|
||||||
return v.path == path;
|
path,
|
||||||
});
|
router.options.routes[0].children
|
||||||
const routes: any =
|
);
|
||||||
index === -1
|
|
||||||
? router.options.routes[0].children
|
|
||||||
: router.options.routes;
|
|
||||||
const route = findRouteByPath(path, routes);
|
|
||||||
// query、params模式路由传参数的标签页不在此处处理
|
// query、params模式路由传参数的标签页不在此处处理
|
||||||
if (route && route.meta?.title) {
|
if (route && route.meta?.title) {
|
||||||
useMultiTagsStoreHook().handleTags("push", {
|
useMultiTagsStoreHook().handleTags("push", {
|
||||||
@@ -148,7 +156,7 @@ router.beforeEach((to: toRouteType, _from, next) => {
|
|||||||
}
|
}
|
||||||
router.push(to.fullPath);
|
router.push(to.fullPath);
|
||||||
});
|
});
|
||||||
next();
|
toCorrectRoute();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (to.path !== "/login") {
|
if (to.path !== "/login") {
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
import type { RouteConfigsTable } from "/#/index";
|
export default {
|
||||||
|
|
||||||
const errorRouter: RouteConfigsTable = {
|
|
||||||
path: "/error",
|
path: "/error",
|
||||||
redirect: "/error/403",
|
redirect: "/error/403",
|
||||||
meta: {
|
meta: {
|
||||||
icon: "information-line",
|
icon: "informationLine",
|
||||||
title: "异常页面",
|
title: "异常页面",
|
||||||
|
// showLink: false,
|
||||||
rank: 9
|
rank: 9
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
@@ -34,6 +33,4 @@ const errorRouter: RouteConfigsTable = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
} as RouteConfigsTable;
|
||||||
|
|
||||||
export default errorRouter;
|
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
import type { RouteConfigsTable } from "/#/index";
|
|
||||||
const Layout = () => import("@/layout/index.vue");
|
const Layout = () => import("@/layout/index.vue");
|
||||||
|
|
||||||
const homeRouter: RouteConfigsTable = {
|
export default {
|
||||||
path: "/",
|
path: "/",
|
||||||
name: "Home",
|
name: "Home",
|
||||||
component: Layout,
|
component: Layout,
|
||||||
redirect: "/welcome",
|
redirect: "/welcome",
|
||||||
meta: {
|
meta: {
|
||||||
icon: "home-filled",
|
icon: "homeFilled",
|
||||||
title: "首页",
|
title: "首页",
|
||||||
rank: 0
|
rank: 0
|
||||||
},
|
},
|
||||||
@@ -21,6 +20,4 @@ const homeRouter: RouteConfigsTable = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
} as RouteConfigsTable;
|
||||||
|
|
||||||
export default homeRouter;
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import type { RouteConfigsTable } from "/#/index";
|
|
||||||
const Layout = () => import("@/layout/index.vue");
|
const Layout = () => import("@/layout/index.vue");
|
||||||
|
|
||||||
const remainingRouter: Array<RouteConfigsTable> = [
|
export default [
|
||||||
{
|
{
|
||||||
path: "/login",
|
path: "/login",
|
||||||
name: "Login",
|
name: "Login",
|
||||||
@@ -16,7 +15,7 @@ const remainingRouter: Array<RouteConfigsTable> = [
|
|||||||
path: "/redirect",
|
path: "/redirect",
|
||||||
component: Layout,
|
component: Layout,
|
||||||
meta: {
|
meta: {
|
||||||
icon: "home-filled",
|
icon: "homeFilled",
|
||||||
title: "首页",
|
title: "首页",
|
||||||
showLink: false,
|
showLink: false,
|
||||||
rank: 104
|
rank: 104
|
||||||
@@ -29,6 +28,4 @@ const remainingRouter: Array<RouteConfigsTable> = [
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
];
|
] as Array<RouteConfigsTable>;
|
||||||
|
|
||||||
export default remainingRouter;
|
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
import { RouteLocationNormalized } from "vue-router";
|
|
||||||
|
|
||||||
export interface toRouteType extends RouteLocationNormalized {
|
|
||||||
meta: {
|
|
||||||
roles: Array<string>;
|
|
||||||
keepAlive?: boolean;
|
|
||||||
dynamicLevel?: string;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -8,16 +8,18 @@ import {
|
|||||||
} from "vue-router";
|
} from "vue-router";
|
||||||
import { router } from "./index";
|
import { router } from "./index";
|
||||||
import { isProxy, toRaw } from "vue";
|
import { isProxy, toRaw } from "vue";
|
||||||
import { loadEnv } from "../../build";
|
|
||||||
import { useTimeoutFn } from "@vueuse/core";
|
import { useTimeoutFn } from "@vueuse/core";
|
||||||
import { RouteConfigs } from "@/layout/types";
|
import { RouteConfigs } from "@/layout/types";
|
||||||
import {
|
import {
|
||||||
isString,
|
isString,
|
||||||
|
cloneDeep,
|
||||||
|
isAllEmpty,
|
||||||
|
intersection,
|
||||||
storageSession,
|
storageSession,
|
||||||
buildHierarchyTree,
|
|
||||||
isIncludeAllChildren
|
isIncludeAllChildren
|
||||||
} from "@pureadmin/utils";
|
} from "@pureadmin/utils";
|
||||||
import { cloneDeep, intersection } from "lodash-unified";
|
import { getConfig } from "@/config";
|
||||||
|
import { buildHierarchyTree } from "@/utils/tree";
|
||||||
import { sessionKey, type DataInfo } from "@/utils/auth";
|
import { sessionKey, type DataInfo } from "@/utils/auth";
|
||||||
import { usePermissionStoreHook } from "@/store/modules/permission";
|
import { usePermissionStoreHook } from "@/store/modules/permission";
|
||||||
const IFrame = () => import("@/layout/frameView.vue");
|
const IFrame = () => import("@/layout/frameView.vue");
|
||||||
@@ -27,19 +29,25 @@ const modulesRoutes = import.meta.glob("/src/views/**/*.{vue,tsx}");
|
|||||||
// 动态路由
|
// 动态路由
|
||||||
import { getAsyncRoutes } from "@/api/routes";
|
import { getAsyncRoutes } from "@/api/routes";
|
||||||
|
|
||||||
|
function handRank(routeInfo: any) {
|
||||||
|
const { name, path, parentId, meta } = routeInfo;
|
||||||
|
return isAllEmpty(parentId)
|
||||||
|
? isAllEmpty(meta?.rank) ||
|
||||||
|
(meta?.rank === 0 && name !== "Home" && path !== "/")
|
||||||
|
? true
|
||||||
|
: false
|
||||||
|
: false;
|
||||||
|
}
|
||||||
|
|
||||||
/** 按照路由中meta下的rank等级升序来排序路由 */
|
/** 按照路由中meta下的rank等级升序来排序路由 */
|
||||||
function ascending(arr: any[]) {
|
function ascending(arr: any[]) {
|
||||||
arr.forEach(v => {
|
arr.forEach((v, index) => {
|
||||||
if (v?.meta?.rank === null) v.meta.rank = undefined;
|
// 当rank不存在时,根据顺序自动创建,首页路由永远在第一位
|
||||||
if (v?.meta?.rank === 0) {
|
if (handRank(v)) v.meta.rank = index + 2;
|
||||||
if (v.name !== "Home" && v.path !== "/") {
|
|
||||||
console.warn("rank only the home page can be 0");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
return arr.sort(
|
return arr.sort(
|
||||||
(a: { meta: { rank: number } }, b: { meta: { rank: number } }) => {
|
(a: { meta: { rank: number } }, b: { meta: { rank: number } }) => {
|
||||||
return a?.meta?.rank - b?.meta?.rank;
|
return a?.meta.rank - b?.meta.rank;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -76,7 +84,7 @@ function isOneOfArray(a: Array<string>, b: Array<string>) {
|
|||||||
/** 从sessionStorage里取出当前登陆用户的角色roles,过滤无权限的菜单 */
|
/** 从sessionStorage里取出当前登陆用户的角色roles,过滤无权限的菜单 */
|
||||||
function filterNoPermissionTree(data: RouteComponent[]) {
|
function filterNoPermissionTree(data: RouteComponent[]) {
|
||||||
const currentRoles =
|
const currentRoles =
|
||||||
storageSession.getItem<DataInfo<number>>(sessionKey).roles ?? [];
|
storageSession().getItem<DataInfo<number>>(sessionKey)?.roles ?? [];
|
||||||
const newTree = cloneDeep(data).filter((v: any) =>
|
const newTree = cloneDeep(data).filter((v: any) =>
|
||||||
isOneOfArray(v.meta?.roles, currentRoles)
|
isOneOfArray(v.meta?.roles, currentRoles)
|
||||||
);
|
);
|
||||||
@@ -151,42 +159,66 @@ function addPathMatch() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 初始化路由 */
|
/** 处理动态路由(后端返回的路由) */
|
||||||
function initRouter() {
|
function handleAsyncRoutes(routeList) {
|
||||||
return new Promise(resolve => {
|
if (routeList.length === 0) {
|
||||||
getAsyncRoutes().then(({ data }) => {
|
usePermissionStoreHook().handleWholeMenus(routeList);
|
||||||
if (data.length === 0) {
|
} else {
|
||||||
usePermissionStoreHook().handleWholeMenus(data);
|
formatFlatteningRoutes(addAsyncRoutes(routeList)).map(
|
||||||
resolve(router);
|
(v: RouteRecordRaw) => {
|
||||||
} else {
|
// 防止重复添加路由
|
||||||
formatFlatteningRoutes(addAsyncRoutes(data)).map(
|
if (
|
||||||
(v: RouteRecordRaw) => {
|
router.options.routes[0].children.findIndex(
|
||||||
// 防止重复添加路由
|
value => value.path === v.path
|
||||||
if (
|
) !== -1
|
||||||
router.options.routes[0].children.findIndex(
|
) {
|
||||||
value => value.path === v.path
|
return;
|
||||||
) !== -1
|
} else {
|
||||||
) {
|
// 切记将路由push到routes后还需要使用addRoute,这样路由才能正常跳转
|
||||||
return;
|
router.options.routes[0].children.push(v);
|
||||||
} else {
|
// 最终路由进行升序
|
||||||
// 切记将路由push到routes后还需要使用addRoute,这样路由才能正常跳转
|
ascending(router.options.routes[0].children);
|
||||||
router.options.routes[0].children.push(v);
|
if (!router.hasRoute(v?.name)) router.addRoute(v);
|
||||||
// 最终路由进行升序
|
const flattenRouters: any = router
|
||||||
ascending(router.options.routes[0].children);
|
.getRoutes()
|
||||||
if (!router.hasRoute(v?.name)) router.addRoute(v);
|
.find(n => n.path === "/");
|
||||||
const flattenRouters: any = router
|
router.addRoute(flattenRouters);
|
||||||
.getRoutes()
|
}
|
||||||
.find(n => n.path === "/");
|
|
||||||
router.addRoute(flattenRouters);
|
|
||||||
}
|
|
||||||
resolve(router);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
usePermissionStoreHook().handleWholeMenus(data);
|
|
||||||
}
|
}
|
||||||
addPathMatch();
|
);
|
||||||
|
usePermissionStoreHook().handleWholeMenus(routeList);
|
||||||
|
}
|
||||||
|
addPathMatch();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 初始化路由(`new Promise` 写法防止在异步请求中造成无限循环)*/
|
||||||
|
function initRouter() {
|
||||||
|
if (getConfig()?.CachingAsyncRoutes) {
|
||||||
|
// 开启动态路由缓存本地sessionStorage
|
||||||
|
const key = "async-routes";
|
||||||
|
const asyncRouteList = storageSession().getItem(key) as any;
|
||||||
|
if (asyncRouteList && asyncRouteList?.length > 0) {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
handleAsyncRoutes(asyncRouteList);
|
||||||
|
resolve(router);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
getAsyncRoutes().then(({ data }) => {
|
||||||
|
handleAsyncRoutes(cloneDeep(data));
|
||||||
|
storageSession().setItem(key, data);
|
||||||
|
resolve(router);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
getAsyncRoutes().then(({ data }) => {
|
||||||
|
handleAsyncRoutes(cloneDeep(data));
|
||||||
|
resolve(router);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -227,7 +259,7 @@ function formatTwoStageRoutes(routesList: RouteRecordRaw[]) {
|
|||||||
children: []
|
children: []
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
newRoutesList[0].children.push({ ...v });
|
newRoutesList[0]?.children.push({ ...v });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return newRoutesList;
|
return newRoutesList;
|
||||||
@@ -291,7 +323,7 @@ function addAsyncRoutes(arrRoutes: Array<RouteRecordRaw>) {
|
|||||||
|
|
||||||
/** 获取路由历史模式 https://next.router.vuejs.org/zh/guide/essentials/history-mode.html */
|
/** 获取路由历史模式 https://next.router.vuejs.org/zh/guide/essentials/history-mode.html */
|
||||||
function getHistoryMode(): RouterHistory {
|
function getHistoryMode(): RouterHistory {
|
||||||
const routerHistory = loadEnv().VITE_ROUTER_HISTORY;
|
const routerHistory = import.meta.env.VITE_ROUTER_HISTORY;
|
||||||
// len为1 代表只有历史模式 为2 代表历史模式中存在base参数 https://next.router.vuejs.org/zh/api/#%E5%8F%82%E6%95%B0-1
|
// len为1 代表只有历史模式 为2 代表历史模式中存在base参数 https://next.router.vuejs.org/zh/api/#%E5%8F%82%E6%95%B0-1
|
||||||
const historyMode = routerHistory.split(",");
|
const historyMode = routerHistory.split(",");
|
||||||
const leftMode = historyMode[0];
|
const leftMode = historyMode[0];
|
||||||
@@ -323,6 +355,7 @@ function hasAuth(value: string | Array<string>): boolean {
|
|||||||
if (!value) return false;
|
if (!value) return false;
|
||||||
/** 从当前路由的`meta`字段里获取按钮级别的所有自定义`code`值 */
|
/** 从当前路由的`meta`字段里获取按钮级别的所有自定义`code`值 */
|
||||||
const metaAuths = getAuths();
|
const metaAuths = getAuths();
|
||||||
|
if (!metaAuths) return false;
|
||||||
const isAuths = isString(value)
|
const isAuths = isString(value)
|
||||||
? metaAuths.includes(value)
|
? metaAuths.includes(value)
|
||||||
: isIncludeAllChildren(value, metaAuths);
|
: isIncludeAllChildren(value, metaAuths);
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import { store } from "@/store";
|
|||||||
import { appType } from "./types";
|
import { appType } from "./types";
|
||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
import { getConfig } from "@/config";
|
import { getConfig } from "@/config";
|
||||||
import type { StorageConfigs } from "/#/index";
|
|
||||||
import { deviceDetection, storageLocal } from "@pureadmin/utils";
|
import { deviceDetection, storageLocal } from "@pureadmin/utils";
|
||||||
|
|
||||||
export const useAppStore = defineStore({
|
export const useAppStore = defineStore({
|
||||||
@@ -10,14 +9,14 @@ export const useAppStore = defineStore({
|
|||||||
state: (): appType => ({
|
state: (): appType => ({
|
||||||
sidebar: {
|
sidebar: {
|
||||||
opened:
|
opened:
|
||||||
storageLocal.getItem<StorageConfigs>("responsive-layout")
|
storageLocal().getItem<StorageConfigs>("responsive-layout")
|
||||||
?.sidebarStatus ?? getConfig().SidebarStatus,
|
?.sidebarStatus ?? getConfig().SidebarStatus,
|
||||||
withoutAnimation: false,
|
withoutAnimation: false,
|
||||||
isClickCollapse: false
|
isClickCollapse: false
|
||||||
},
|
},
|
||||||
// 这里的layout用于监听容器拖拉后恢复对应的导航模式
|
// 这里的layout用于监听容器拖拉后恢复对应的导航模式
|
||||||
layout:
|
layout:
|
||||||
storageLocal.getItem<StorageConfigs>("responsive-layout")?.layout ??
|
storageLocal().getItem<StorageConfigs>("responsive-layout")?.layout ??
|
||||||
getConfig().Layout,
|
getConfig().Layout,
|
||||||
device: deviceDetection() ? "mobile" : "desktop"
|
device: deviceDetection() ? "mobile" : "desktop"
|
||||||
}),
|
}),
|
||||||
@@ -31,7 +30,8 @@ export const useAppStore = defineStore({
|
|||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
TOGGLE_SIDEBAR(opened?: boolean, resize?: string) {
|
TOGGLE_SIDEBAR(opened?: boolean, resize?: string) {
|
||||||
const layout = storageLocal.getItem<StorageConfigs>("responsive-layout");
|
const layout =
|
||||||
|
storageLocal().getItem<StorageConfigs>("responsive-layout");
|
||||||
if (opened && resize) {
|
if (opened && resize) {
|
||||||
this.sidebar.withoutAnimation = true;
|
this.sidebar.withoutAnimation = true;
|
||||||
this.sidebar.opened = true;
|
this.sidebar.opened = true;
|
||||||
@@ -46,7 +46,7 @@ export const useAppStore = defineStore({
|
|||||||
this.sidebar.isClickCollapse = !this.sidebar.opened;
|
this.sidebar.isClickCollapse = !this.sidebar.opened;
|
||||||
layout.sidebarStatus = this.sidebar.opened;
|
layout.sidebarStatus = this.sidebar.opened;
|
||||||
}
|
}
|
||||||
storageLocal.setItem("responsive-layout", layout);
|
storageLocal().setItem("responsive-layout", layout);
|
||||||
},
|
},
|
||||||
async toggleSideBar(opened?: boolean, resize?: string) {
|
async toggleSideBar(opened?: boolean, resize?: string) {
|
||||||
await this.TOGGLE_SIDEBAR(opened, resize);
|
await this.TOGGLE_SIDEBAR(opened, resize);
|
||||||
|
|||||||
@@ -1,17 +1,16 @@
|
|||||||
import { store } from "@/store";
|
import { store } from "@/store";
|
||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
import { getConfig } from "@/config";
|
import { getConfig } from "@/config";
|
||||||
import type { StorageConfigs } from "/#/index";
|
|
||||||
import { storageLocal } from "@pureadmin/utils";
|
import { storageLocal } from "@pureadmin/utils";
|
||||||
|
|
||||||
export const useEpThemeStore = defineStore({
|
export const useEpThemeStore = defineStore({
|
||||||
id: "pure-epTheme",
|
id: "pure-epTheme",
|
||||||
state: () => ({
|
state: () => ({
|
||||||
epThemeColor:
|
epThemeColor:
|
||||||
storageLocal.getItem<StorageConfigs>("responsive-layout")?.epThemeColor ??
|
storageLocal().getItem<StorageConfigs>("responsive-layout")
|
||||||
getConfig().EpThemeColor,
|
?.epThemeColor ?? getConfig().EpThemeColor,
|
||||||
epTheme:
|
epTheme:
|
||||||
storageLocal.getItem<StorageConfigs>("responsive-layout")?.theme ??
|
storageLocal().getItem<StorageConfigs>("responsive-layout")?.theme ??
|
||||||
getConfig().Theme
|
getConfig().Theme
|
||||||
}),
|
}),
|
||||||
getters: {
|
getters: {
|
||||||
@@ -31,12 +30,13 @@ export const useEpThemeStore = defineStore({
|
|||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
setEpThemeColor(newColor: string): void {
|
setEpThemeColor(newColor: string): void {
|
||||||
const layout = storageLocal.getItem<StorageConfigs>("responsive-layout");
|
const layout =
|
||||||
|
storageLocal().getItem<StorageConfigs>("responsive-layout");
|
||||||
this.epTheme = layout?.theme;
|
this.epTheme = layout?.theme;
|
||||||
this.epThemeColor = newColor;
|
this.epThemeColor = newColor;
|
||||||
if (!layout) return;
|
if (!layout) return;
|
||||||
layout.epThemeColor = newColor;
|
layout.epThemeColor = newColor;
|
||||||
storageLocal.setItem("responsive-layout", layout);
|
storageLocal().setItem("responsive-layout", layout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
import { store } from "@/store";
|
import { store } from "@/store";
|
||||||
import { isEqual } from "lodash-unified";
|
import { isEqual } from "@pureadmin/utils";
|
||||||
import type { StorageConfigs } from "/#/index";
|
|
||||||
import { routerArrays } from "@/layout/types";
|
import { routerArrays } from "@/layout/types";
|
||||||
import { multiType, positionType } from "./types";
|
import { multiType, positionType } from "./types";
|
||||||
import { isUrl, storageLocal } from "@pureadmin/utils";
|
import { isUrl, storageLocal } from "@pureadmin/utils";
|
||||||
@@ -10,12 +9,13 @@ export const useMultiTagsStore = defineStore({
|
|||||||
id: "pure-multiTags",
|
id: "pure-multiTags",
|
||||||
state: () => ({
|
state: () => ({
|
||||||
// 存储标签页信息(路由信息)
|
// 存储标签页信息(路由信息)
|
||||||
multiTags: storageLocal.getItem<StorageConfigs>("responsive-configure")
|
multiTags: storageLocal().getItem<StorageConfigs>("responsive-configure")
|
||||||
.multiTagsCache
|
?.multiTagsCache
|
||||||
? storageLocal.getItem<StorageConfigs>("responsive-tags")
|
? storageLocal().getItem<StorageConfigs>("responsive-tags")
|
||||||
: [...routerArrays],
|
: [...routerArrays],
|
||||||
multiTagsCache: storageLocal.getItem<StorageConfigs>("responsive-configure")
|
multiTagsCache: storageLocal().getItem<StorageConfigs>(
|
||||||
.multiTagsCache
|
"responsive-configure"
|
||||||
|
)?.multiTagsCache
|
||||||
}),
|
}),
|
||||||
getters: {
|
getters: {
|
||||||
getMultiTagsCache() {
|
getMultiTagsCache() {
|
||||||
@@ -26,14 +26,14 @@ export const useMultiTagsStore = defineStore({
|
|||||||
multiTagsCacheChange(multiTagsCache: boolean) {
|
multiTagsCacheChange(multiTagsCache: boolean) {
|
||||||
this.multiTagsCache = multiTagsCache;
|
this.multiTagsCache = multiTagsCache;
|
||||||
if (multiTagsCache) {
|
if (multiTagsCache) {
|
||||||
storageLocal.setItem("responsive-tags", this.multiTags);
|
storageLocal().setItem("responsive-tags", this.multiTags);
|
||||||
} else {
|
} else {
|
||||||
storageLocal.removeItem("responsive-tags");
|
storageLocal().removeItem("responsive-tags");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
tagsCache(multiTags) {
|
tagsCache(multiTags) {
|
||||||
this.getMultiTagsCache &&
|
this.getMultiTagsCache &&
|
||||||
storageLocal.setItem("responsive-tags", multiTags);
|
storageLocal().setItem("responsive-tags", multiTags);
|
||||||
},
|
},
|
||||||
handleTags<T>(
|
handleTags<T>(
|
||||||
mode: string,
|
mode: string,
|
||||||
|
|||||||
@@ -39,6 +39,4 @@ export type setType = {
|
|||||||
export type userType = {
|
export type userType = {
|
||||||
username?: string;
|
username?: string;
|
||||||
roles?: Array<string>;
|
roles?: Array<string>;
|
||||||
verifyCode?: string;
|
|
||||||
currentPage?: number;
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -14,13 +14,9 @@ export const useUserStore = defineStore({
|
|||||||
state: (): userType => ({
|
state: (): userType => ({
|
||||||
// 用户名
|
// 用户名
|
||||||
username:
|
username:
|
||||||
storageSession.getItem<DataInfo<number>>(sessionKey)?.username ?? "",
|
storageSession().getItem<DataInfo<number>>(sessionKey)?.username ?? "",
|
||||||
// 页面级别权限
|
// 页面级别权限
|
||||||
roles: storageSession.getItem<DataInfo<number>>(sessionKey)?.roles ?? [],
|
roles: storageSession().getItem<DataInfo<number>>(sessionKey)?.roles ?? []
|
||||||
// 前端生成的验证码(按实际需求替换)
|
|
||||||
verifyCode: "",
|
|
||||||
// 判断登录页面显示哪个组件(0:登录(默认)、1:手机登录、2:二维码登录、3:注册、4:忘记密码)
|
|
||||||
currentPage: 0
|
|
||||||
}),
|
}),
|
||||||
actions: {
|
actions: {
|
||||||
/** 存储用户名 */
|
/** 存储用户名 */
|
||||||
@@ -31,14 +27,6 @@ export const useUserStore = defineStore({
|
|||||||
SET_ROLES(roles: Array<string>) {
|
SET_ROLES(roles: Array<string>) {
|
||||||
this.roles = roles;
|
this.roles = roles;
|
||||||
},
|
},
|
||||||
/** 存储前端生成的验证码 */
|
|
||||||
SET_VERIFYCODE(verifyCode: string) {
|
|
||||||
this.verifyCode = verifyCode;
|
|
||||||
},
|
|
||||||
/** 存储登录页面显示哪个组件 */
|
|
||||||
SET_CURRENTPAGE(value: number) {
|
|
||||||
this.currentPage = value;
|
|
||||||
},
|
|
||||||
/** 登入 */
|
/** 登入 */
|
||||||
async loginByUsername(data) {
|
async loginByUsername(data) {
|
||||||
return new Promise<UserResult>((resolve, reject) => {
|
return new Promise<UserResult>((resolve, reject) => {
|
||||||
@@ -59,9 +47,9 @@ export const useUserStore = defineStore({
|
|||||||
this.username = "";
|
this.username = "";
|
||||||
this.roles = [];
|
this.roles = [];
|
||||||
removeToken();
|
removeToken();
|
||||||
router.push("/login");
|
|
||||||
useMultiTagsStoreHook().handleTags("equal", [...routerArrays]);
|
useMultiTagsStoreHook().handleTags("equal", [...routerArrays]);
|
||||||
resetRouter();
|
resetRouter();
|
||||||
|
router.push("/login");
|
||||||
},
|
},
|
||||||
/** 刷新`token` */
|
/** 刷新`token` */
|
||||||
async handRefreshToken(data) {
|
async handRefreshToken(data) {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@import "element-plus/theme-chalk/src/dark/css-vars.scss";
|
@use "element-plus/theme-chalk/src/dark/css-vars.scss" as *;
|
||||||
|
|
||||||
/* 暗黑模式适配 */
|
/* 暗黑模式适配 */
|
||||||
html.dark {
|
html.dark {
|
||||||
@@ -26,11 +26,6 @@ html.dark {
|
|||||||
filter: invert(0.9) hue-rotate(180deg);
|
filter: invert(0.9) hue-rotate(180deg);
|
||||||
}
|
}
|
||||||
|
|
||||||
.ant-tabs {
|
|
||||||
background: var(--el-bg-color);
|
|
||||||
color: $color-white;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 标签页 */
|
/* 标签页 */
|
||||||
.tags-view {
|
.tags-view {
|
||||||
.arrow-left,
|
.arrow-left,
|
||||||
@@ -44,97 +39,6 @@ html.dark {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* vxe-table */
|
|
||||||
.vxe-table--header-wrapper,
|
|
||||||
.vxe-table--body-wrapper {
|
|
||||||
color: var(--el-text-color-primary);
|
|
||||||
background: var(--el-bg-color) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.vxe-table--render-default.border--full .vxe-header--column,
|
|
||||||
.vxe-table--render-default.border--full .vxe-body--column,
|
|
||||||
.vxe-table--render-default.border--full .vxe-footer--column {
|
|
||||||
background-image: linear-gradient(
|
|
||||||
var(--el-border-color-lighter),
|
|
||||||
var(--el-border-color-lighter)
|
|
||||||
),
|
|
||||||
linear-gradient(
|
|
||||||
var(--el-border-color-lighter),
|
|
||||||
var(--el-border-color-lighter)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 表头 */
|
|
||||||
.vxe-table--header-wrapper {
|
|
||||||
background: #262727 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.vxe-table--render-wrapper,
|
|
||||||
.vxe-table--main-wrapper {
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.vxe-pager.is--perfect,
|
|
||||||
.vxe-table--render-default .vxe-table--border-line {
|
|
||||||
border: 1px solid var(--el-border-color-lighter);
|
|
||||||
}
|
|
||||||
|
|
||||||
.vxe-table--header-border-line {
|
|
||||||
border-bottom: 1px solid var(--el-border-color-lighter) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.vxe-body--row.row--hover,
|
|
||||||
.vxe-pager {
|
|
||||||
background-color: #262727;
|
|
||||||
}
|
|
||||||
|
|
||||||
.vxe-input--inner,
|
|
||||||
.vxe-pager .vxe-pager--jump-prev,
|
|
||||||
.vxe-pager .vxe-pager--prev-btn,
|
|
||||||
.vxe-pager .vxe-pager--next-btn,
|
|
||||||
.vxe-pager .vxe-pager--jump-next,
|
|
||||||
.vxe-pager .vxe-pager--num-btn,
|
|
||||||
.vxe-pager .vxe-pager--jump .vxe-pager--goto {
|
|
||||||
background-color: transparent;
|
|
||||||
color: var(--el-text-color-primary);
|
|
||||||
// outline: none !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.vxe-select-option--wrapper {
|
|
||||||
background: var(--el-bg-color) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.vxe-select-option:not(.is--disabled).is--hover {
|
|
||||||
background: var(--el-color-primary-light-6) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.vxe-modal--wrapper.type--modal .vxe-modal--box,
|
|
||||||
.vxe-modal--wrapper.type--alert .vxe-modal--box,
|
|
||||||
.vxe-modal--wrapper.type--confirm .vxe-modal--box,
|
|
||||||
.vxe-form {
|
|
||||||
background: var(--el-bg-color) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.vxe-modal--box,
|
|
||||||
.vxe-modal--header {
|
|
||||||
border: none;
|
|
||||||
background: var(--el-bg-color) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.vxe-modal--title,
|
|
||||||
.vxe-button--content,
|
|
||||||
.vxe-modal--header-title {
|
|
||||||
color: var(--el-text-color-primary);
|
|
||||||
}
|
|
||||||
|
|
||||||
.vxe-button.type--button.size--medium:hover {
|
|
||||||
background: var(--el-color-primary) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.vxe-button {
|
|
||||||
background-color: transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 项目配置面板 */
|
/* 项目配置面板 */
|
||||||
.right-panel-items {
|
.right-panel-items {
|
||||||
.el-divider__text {
|
.el-divider__text {
|
||||||
@@ -160,4 +64,38 @@ html.dark {
|
|||||||
.el-dropdown-menu__item:not(.is-disabled):hover {
|
.el-dropdown-menu__item:not(.is-disabled):hover {
|
||||||
background: transparent;
|
background: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 全局覆盖element-plus的el-dialog、el-drawer、el-message-box、el-notification组件右上角关闭图标的样式,表现更鲜明 */
|
||||||
|
.el-icon {
|
||||||
|
&.el-dialog__close,
|
||||||
|
&.el-drawer__close,
|
||||||
|
&.el-message-box__close,
|
||||||
|
&.el-notification__closeBtn {
|
||||||
|
&:hover {
|
||||||
|
color: rgba(255, 255, 255, 0.85) !important;
|
||||||
|
background-color: rgba(255, 255, 255, 0.12);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 克隆并自定义 ElMessage 样式,不会影响 ElMessage 原本样式,在 src/utils/message.ts 中调用自定义样式 ElMessage 方法即可,非暗黑模式在 src/style/element-plus.scss 文件进行了适配 */
|
||||||
|
.pure-message {
|
||||||
|
background-image: initial !important;
|
||||||
|
background-color: rgb(36, 37, 37) !important;
|
||||||
|
box-shadow: rgb(13 13 13 / 12%) 0px 3px 6px -4px,
|
||||||
|
rgb(13 13 13 / 8%) 0px 6px 16px 0px, rgb(13 13 13 / 5%) 0px 9px 28px 8px !important;
|
||||||
|
|
||||||
|
& .el-message__content {
|
||||||
|
color: $color-white !important;
|
||||||
|
pointer-events: all !important;
|
||||||
|
background-image: initial !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
& .el-message__closeBtn {
|
||||||
|
&:hover {
|
||||||
|
color: rgba(255, 255, 255, 0.85);
|
||||||
|
background-color: rgba(255, 255, 255, 0.12);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,12 @@
|
|||||||
padding: 0 !important;
|
padding: 0 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 自定义 tooltip 的类名 */
|
||||||
|
.pure-tooltip {
|
||||||
|
// 右侧操作面板right-panel类名的z-index为40000,tooltip需要大于它才能显示
|
||||||
|
z-index: 41000 !important;
|
||||||
|
}
|
||||||
|
|
||||||
/* nprogress 适配 element-plus 的主题色 */
|
/* nprogress 适配 element-plus 的主题色 */
|
||||||
#nprogress {
|
#nprogress {
|
||||||
& .bar {
|
& .bar {
|
||||||
@@ -62,3 +68,64 @@
|
|||||||
border-left-color: var(--el-color-primary);
|
border-left-color: var(--el-color-primary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 全局覆盖element-plus的el-dialog、el-drawer、el-message-box、el-notification组件右上角关闭图标的样式,表现更鲜明 */
|
||||||
|
.el-dialog__headerbtn,
|
||||||
|
.el-message-box__headerbtn {
|
||||||
|
&:hover {
|
||||||
|
.el-dialog__close {
|
||||||
|
color: var(--el-color-info) !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.el-icon {
|
||||||
|
&.el-dialog__close,
|
||||||
|
&.el-drawer__close,
|
||||||
|
&.el-message-box__close,
|
||||||
|
&.el-notification__closeBtn {
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
outline: none;
|
||||||
|
border-radius: 4px;
|
||||||
|
transition: background-color 0.2s, color 0.2s;
|
||||||
|
&:hover {
|
||||||
|
color: rgba(0, 0, 0, 0.88) !important;
|
||||||
|
background-color: rgba(0, 0, 0, 0.06);
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 克隆并自定义 ElMessage 样式,不会影响 ElMessage 原本样式,在 src/utils/message.ts 中调用自定义样式 ElMessage 方法即可,暗黑模式在 src/style/dark.scss 文件进行了适配 */
|
||||||
|
.pure-message {
|
||||||
|
border-width: 0 !important;
|
||||||
|
background: #fff !important;
|
||||||
|
padding: 10px 13px !important;
|
||||||
|
box-shadow: 0 3px 6px -4px #0000001f, 0 6px 16px #00000014,
|
||||||
|
0 9px 28px 8px #0000000d !important;
|
||||||
|
|
||||||
|
&.el-message.is-closable .el-message__content {
|
||||||
|
padding-right: 17px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
& .el-message__content {
|
||||||
|
color: #000000d9 !important;
|
||||||
|
pointer-events: all !important;
|
||||||
|
background-image: initial !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
& .el-message__icon {
|
||||||
|
margin-right: 8px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
& .el-message__closeBtn {
|
||||||
|
outline: none;
|
||||||
|
border-radius: 4px;
|
||||||
|
right: 9px !important;
|
||||||
|
transition: background-color 0.2s, color 0.2s;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: rgba(0, 0, 0, 0.06);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
@import "./element-plus.scss";
|
@import "./element-plus.scss";
|
||||||
@import "./sidebar.scss";
|
@import "./sidebar.scss";
|
||||||
@import "./dark.scss";
|
@import "./dark.scss";
|
||||||
@import "./tailwind.css";
|
|
||||||
|
|
||||||
/* 自定义全局 CssVar */
|
/* 自定义全局 CssVar */
|
||||||
:root {
|
:root {
|
||||||
@@ -19,8 +18,3 @@
|
|||||||
.html-weakness {
|
.html-weakness {
|
||||||
filter: invert(80%);
|
filter: invert(80%);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 重置 vxe-table 中 pager 样式 */
|
|
||||||
.vxe-pager .vxe-pager--num-btn:not(.is--disabled).is--active {
|
|
||||||
color: #fff !important;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -44,16 +44,6 @@ abbr:where([title]) {
|
|||||||
text-decoration: underline dotted;
|
text-decoration: underline dotted;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1,
|
|
||||||
h2,
|
|
||||||
h3,
|
|
||||||
h4,
|
|
||||||
h5,
|
|
||||||
h6 {
|
|
||||||
font-size: inherit;
|
|
||||||
font-weight: inherit;
|
|
||||||
}
|
|
||||||
|
|
||||||
a {
|
a {
|
||||||
color: inherit;
|
color: inherit;
|
||||||
text-decoration: inherit;
|
text-decoration: inherit;
|
||||||
@@ -121,7 +111,6 @@ button,
|
|||||||
[type="button"],
|
[type="button"],
|
||||||
[type="reset"],
|
[type="reset"],
|
||||||
[type="submit"] {
|
[type="submit"] {
|
||||||
-webkit-appearance: button;
|
|
||||||
background-image: none;
|
background-image: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,16 +132,10 @@ progress {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[type="search"] {
|
[type="search"] {
|
||||||
-webkit-appearance: textfield;
|
|
||||||
outline-offset: -2px;
|
outline-offset: -2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
::-webkit-search-decoration {
|
|
||||||
-webkit-appearance: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
::-webkit-file-upload-button {
|
::-webkit-file-upload-button {
|
||||||
-webkit-appearance: button;
|
|
||||||
font: inherit;
|
font: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -221,7 +204,6 @@ iframe,
|
|||||||
embed,
|
embed,
|
||||||
object {
|
object {
|
||||||
display: block;
|
display: block;
|
||||||
vertical-align: middle;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
img,
|
img,
|
||||||
|
|||||||
@@ -68,10 +68,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-popper.is-light {
|
|
||||||
border: none !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar-container {
|
.sidebar-container {
|
||||||
/* 展开动画 */
|
/* 展开动画 */
|
||||||
transition: width var(--pure-transition-duration);
|
transition: width var(--pure-transition-duration);
|
||||||
@@ -233,9 +229,7 @@
|
|||||||
.search-container,
|
.search-container,
|
||||||
/* 告警 */
|
/* 告警 */
|
||||||
.dropdown-badge,
|
.dropdown-badge,
|
||||||
/* 全屏 */
|
/* 用户名 */
|
||||||
.screen-full,
|
|
||||||
/* 登录名 */
|
|
||||||
.el-dropdown-link,
|
.el-dropdown-link,
|
||||||
/* 设置 */
|
/* 设置 */
|
||||||
.set-icon {
|
.set-icon {
|
||||||
@@ -576,9 +570,7 @@ body[layout="vertical"] {
|
|||||||
.search-container,
|
.search-container,
|
||||||
/* 告警 */
|
/* 告警 */
|
||||||
.dropdown-badge,
|
.dropdown-badge,
|
||||||
/* 全屏 */
|
/* 用户名 */
|
||||||
.screen-full,
|
|
||||||
/* 登录名 */
|
|
||||||
.el-dropdown-link,
|
.el-dropdown-link,
|
||||||
/* 设置 */
|
/* 设置 */
|
||||||
.set-icon {
|
.set-icon {
|
||||||
|
|||||||
@@ -26,9 +26,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* breadcrumb transition */
|
/* breadcrumb transition */
|
||||||
.breadcrumb-enter-active,
|
.breadcrumb-enter-active {
|
||||||
|
transition: all 0.4s;
|
||||||
|
}
|
||||||
|
|
||||||
.breadcrumb-leave-active {
|
.breadcrumb-leave-active {
|
||||||
transition: all 0.5s;
|
transition: all 0.3s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.breadcrumb-enter-from,
|
.breadcrumb-enter-from,
|
||||||
@@ -43,11 +46,10 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 重置el-menu的展开收起动画时长
|
* @description 重置el-menu的展开收起动画时长
|
||||||
* @see {@link https://github.com/element-plus/element-plus/issues/4509#issuecomment-980165001}
|
|
||||||
*/
|
*/
|
||||||
.outer-most .el-collapse-transition-leave-active,
|
.outer-most .el-collapse-transition-leave-active,
|
||||||
.outer-most .el-collapse-transition-enter-active {
|
.outer-most .el-collapse-transition-enter-active {
|
||||||
transition: 0.12s all ease-in-out !important;
|
transition: 0.2s all ease-in-out !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.horizontal-collapse-transition {
|
.horizontal-collapse-transition {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export function getToken(): DataInfo<number> {
|
|||||||
// 此处与`TokenKey`相同,此写法解决初始化时`Cookies`中不存在`TokenKey`报错
|
// 此处与`TokenKey`相同,此写法解决初始化时`Cookies`中不存在`TokenKey`报错
|
||||||
return Cookies.get(TokenKey)
|
return Cookies.get(TokenKey)
|
||||||
? JSON.parse(Cookies.get(TokenKey))
|
? JSON.parse(Cookies.get(TokenKey))
|
||||||
: storageSession.getItem(sessionKey);
|
: storageSession().getItem(sessionKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -35,7 +35,7 @@ export function getToken(): DataInfo<number> {
|
|||||||
export function setToken(data: DataInfo<Date>) {
|
export function setToken(data: DataInfo<Date>) {
|
||||||
let expires = 0;
|
let expires = 0;
|
||||||
const { accessToken, refreshToken } = data;
|
const { accessToken, refreshToken } = data;
|
||||||
expires = new Date(data.expires).getTime();
|
expires = new Date(data.expires).getTime(); // 如果后端直接设置时间戳,将此处代码改为expires = data.expires,然后把上面的DataInfo<Date>改成DataInfo<number>即可
|
||||||
const cookieString = JSON.stringify({ accessToken, expires });
|
const cookieString = JSON.stringify({ accessToken, expires });
|
||||||
|
|
||||||
expires > 0
|
expires > 0
|
||||||
@@ -47,7 +47,7 @@ export function setToken(data: DataInfo<Date>) {
|
|||||||
function setSessionKey(username: string, roles: Array<string>) {
|
function setSessionKey(username: string, roles: Array<string>) {
|
||||||
useUserStoreHook().SET_USERNAME(username);
|
useUserStoreHook().SET_USERNAME(username);
|
||||||
useUserStoreHook().SET_ROLES(roles);
|
useUserStoreHook().SET_ROLES(roles);
|
||||||
storageSession.setItem(sessionKey, {
|
storageSession().setItem(sessionKey, {
|
||||||
refreshToken,
|
refreshToken,
|
||||||
expires,
|
expires,
|
||||||
username,
|
username,
|
||||||
@@ -59,8 +59,10 @@ export function setToken(data: DataInfo<Date>) {
|
|||||||
const { username, roles } = data;
|
const { username, roles } = data;
|
||||||
setSessionKey(username, roles);
|
setSessionKey(username, roles);
|
||||||
} else {
|
} else {
|
||||||
const { username, roles } =
|
const username =
|
||||||
storageSession.getItem<DataInfo<number>>(sessionKey);
|
storageSession().getItem<DataInfo<number>>(sessionKey)?.username ?? "";
|
||||||
|
const roles =
|
||||||
|
storageSession().getItem<DataInfo<number>>(sessionKey)?.roles ?? [];
|
||||||
setSessionKey(username, roles);
|
setSessionKey(username, roles);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -68,7 +70,7 @@ export function setToken(data: DataInfo<Date>) {
|
|||||||
/** 删除`token`以及key值为`user-info`的session信息 */
|
/** 删除`token`以及key值为`user-info`的session信息 */
|
||||||
export function removeToken() {
|
export function removeToken() {
|
||||||
Cookies.remove(TokenKey);
|
Cookies.remove(TokenKey);
|
||||||
sessionStorage.removeItem(sessionKey);
|
sessionStorage.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 格式化token(jwt格式) */
|
/** 格式化token(jwt格式) */
|
||||||
|
|||||||
7
src/utils/globalPolyfills.ts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
// 如果项目出现 `global is not defined` 报错,可能是您引入某个库的问题,比如 aws-sdk-js https://github.com/aws/aws-sdk-js
|
||||||
|
// 解决办法就是将该文件引入 src/main.ts 即可 import "@/utils/globalPolyfills";
|
||||||
|
if (typeof (window as any).global === "undefined") {
|
||||||
|
(window as any).global = window;
|
||||||
|
}
|
||||||
|
|
||||||
|
export {};
|
||||||
@@ -11,21 +11,12 @@ import {
|
|||||||
} from "./types.d";
|
} from "./types.d";
|
||||||
import { stringify } from "qs";
|
import { stringify } from "qs";
|
||||||
import NProgress from "../progress";
|
import NProgress from "../progress";
|
||||||
// import { loadEnv } from "@build/index";
|
|
||||||
import { getToken, formatToken } from "@/utils/auth";
|
import { getToken, formatToken } from "@/utils/auth";
|
||||||
import { useUserStoreHook } from "@/store/modules/user";
|
import { useUserStoreHook } from "@/store/modules/user";
|
||||||
|
|
||||||
// 加载环境变量 VITE_PROXY_DOMAIN(开发环境) VITE_PROXY_DOMAIN_REAL(打包后的线上环境)
|
|
||||||
// const { VITE_PROXY_DOMAIN, VITE_PROXY_DOMAIN_REAL } = loadEnv();
|
|
||||||
|
|
||||||
// 相关配置请参考:www.axios-js.com/zh-cn/docs/#axios-request-config-1
|
// 相关配置请参考:www.axios-js.com/zh-cn/docs/#axios-request-config-1
|
||||||
const defaultConfig: AxiosRequestConfig = {
|
const defaultConfig: AxiosRequestConfig = {
|
||||||
// baseURL:
|
// 请求超时时间
|
||||||
// process.env.NODE_ENV === "production"
|
|
||||||
// ? VITE_PROXY_DOMAIN_REAL
|
|
||||||
// : VITE_PROXY_DOMAIN,
|
|
||||||
// 当前使用mock模拟请求,将baseURL制空,如果你的环境用到了http请求,请删除下面的baseURL启用上面的baseURL,并将第14行、19行代码注释取消
|
|
||||||
baseURL: "",
|
|
||||||
timeout: 10000,
|
timeout: 10000,
|
||||||
headers: {
|
headers: {
|
||||||
Accept: "application/json, text/plain, */*",
|
Accept: "application/json, text/plain, */*",
|
||||||
@@ -184,7 +175,7 @@ class PureHttp {
|
|||||||
/** 单独抽离的post工具函数 */
|
/** 单独抽离的post工具函数 */
|
||||||
public post<T, P>(
|
public post<T, P>(
|
||||||
url: string,
|
url: string,
|
||||||
params?: T,
|
params?: AxiosRequestConfig<T>,
|
||||||
config?: PureHttpRequestConfig
|
config?: PureHttpRequestConfig
|
||||||
): Promise<P> {
|
): Promise<P> {
|
||||||
return this.request<P>("post", url, params, config);
|
return this.request<P>("post", url, params, config);
|
||||||
@@ -193,7 +184,7 @@ class PureHttp {
|
|||||||
/** 单独抽离的get工具函数 */
|
/** 单独抽离的get工具函数 */
|
||||||
public get<T, P>(
|
public get<T, P>(
|
||||||
url: string,
|
url: string,
|
||||||
params?: T,
|
params?: AxiosRequestConfig<T>,
|
||||||
config?: PureHttpRequestConfig
|
config?: PureHttpRequestConfig
|
||||||
): Promise<P> {
|
): Promise<P> {
|
||||||
return this.request<P>("get", url, params, config);
|
return this.request<P>("get", url, params, config);
|
||||||
|
|||||||
85
src/utils/message.ts
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
import { type VNode } from "vue";
|
||||||
|
import { isFunction } from "@pureadmin/utils";
|
||||||
|
import { type MessageHandler, ElMessage } from "element-plus";
|
||||||
|
|
||||||
|
type messageStyle = "el" | "antd";
|
||||||
|
type messageTypes = "info" | "success" | "warning" | "error";
|
||||||
|
|
||||||
|
interface MessageParams {
|
||||||
|
/** 消息类型,可选 `info` 、`success` 、`warning` 、`error` ,默认 `info` */
|
||||||
|
type?: messageTypes;
|
||||||
|
/** 自定义图标,该属性会覆盖 `type` 的图标 */
|
||||||
|
icon?: any;
|
||||||
|
/** 是否将 `message` 属性作为 `HTML` 片段处理,默认 `false` */
|
||||||
|
dangerouslyUseHTMLString?: boolean;
|
||||||
|
/** 消息风格,可选 `el` 、`antd` ,默认 `antd` */
|
||||||
|
customClass?: messageStyle;
|
||||||
|
/** 显示时间,单位为毫秒。设为 `0` 则不会自动关闭,`element-plus` 默认是 `3000` ,平台改成默认 `2000` */
|
||||||
|
duration?: number;
|
||||||
|
/** 是否显示关闭按钮,默认值 `false` */
|
||||||
|
showClose?: boolean;
|
||||||
|
/** 文字是否居中,默认值 `false` */
|
||||||
|
center?: boolean;
|
||||||
|
/** `Message` 距离窗口顶部的偏移量,默认 `20` */
|
||||||
|
offset?: number;
|
||||||
|
/** 设置组件的根元素,默认 `document.body` */
|
||||||
|
appendTo?: string | HTMLElement;
|
||||||
|
/** 合并内容相同的消息,不支持 `VNode` 类型的消息,默认值 `false` */
|
||||||
|
grouping?: boolean;
|
||||||
|
/** 关闭时的回调函数, 参数为被关闭的 `message` 实例 */
|
||||||
|
onClose?: Function | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 用法非常简单,参考 src/views/components/message/index.vue 文件 */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* `Message` 消息提示函数
|
||||||
|
*/
|
||||||
|
const message = (
|
||||||
|
message: string | VNode | (() => VNode),
|
||||||
|
params?: MessageParams
|
||||||
|
): MessageHandler => {
|
||||||
|
if (!params) {
|
||||||
|
return ElMessage({
|
||||||
|
message,
|
||||||
|
customClass: "pure-message"
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
const {
|
||||||
|
icon,
|
||||||
|
type = "info",
|
||||||
|
dangerouslyUseHTMLString = false,
|
||||||
|
customClass = "antd",
|
||||||
|
duration = 2000,
|
||||||
|
showClose = false,
|
||||||
|
center = false,
|
||||||
|
offset = 20,
|
||||||
|
appendTo = document.body,
|
||||||
|
grouping = false,
|
||||||
|
onClose
|
||||||
|
} = params;
|
||||||
|
|
||||||
|
return ElMessage({
|
||||||
|
message,
|
||||||
|
type,
|
||||||
|
icon,
|
||||||
|
dangerouslyUseHTMLString,
|
||||||
|
duration,
|
||||||
|
showClose,
|
||||||
|
center,
|
||||||
|
offset,
|
||||||
|
appendTo,
|
||||||
|
grouping,
|
||||||
|
// 全局搜 pure-message 即可知道该类的样式位置
|
||||||
|
customClass: customClass === "antd" ? "pure-message" : "",
|
||||||
|
onClose: () => (isFunction(onClose) ? onClose() : null)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关闭所有 `Message` 消息提示函数
|
||||||
|
*/
|
||||||
|
const closeAllMessage = (): void => ElMessage.closeAll();
|
||||||
|
|
||||||
|
export { message, closeAllMessage };
|
||||||
59
src/utils/sso.ts
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
import { removeToken, setToken, type DataInfo } from "./auth";
|
||||||
|
import { subBefore, getQueryMap } from "@pureadmin/utils";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 简版前端单点登录,根据实际业务自行编写
|
||||||
|
* 划重点:
|
||||||
|
* 判断是否为单点登录,不为则直接返回不再进行任何逻辑处理,下面是单点登录后的逻辑处理
|
||||||
|
* 1.清空本地旧信息;
|
||||||
|
* 2.获取url中的重要参数信息,然后通过 setToken 保存在本地;
|
||||||
|
* 3.删除不需要显示在 url 的参数
|
||||||
|
* 4.使用 window.location.replace 跳转正确页面
|
||||||
|
*/
|
||||||
|
(function () {
|
||||||
|
// 获取 url 中的参数
|
||||||
|
const params = getQueryMap(location.href) as DataInfo<Date>;
|
||||||
|
const must = ["username", "roles", "accessToken"];
|
||||||
|
const mustLength = must.length;
|
||||||
|
if (Object.keys(params).length !== mustLength) return;
|
||||||
|
|
||||||
|
// url 参数满足 must 里的全部值,才判定为单点登录,避免非单点登录时刷新页面无限循环
|
||||||
|
let sso = [];
|
||||||
|
let start = 0;
|
||||||
|
|
||||||
|
while (start < mustLength) {
|
||||||
|
if (Object.keys(params).includes(must[start]) && sso.length <= mustLength) {
|
||||||
|
sso.push(must[start]);
|
||||||
|
} else {
|
||||||
|
sso = [];
|
||||||
|
}
|
||||||
|
start++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sso.length === mustLength) {
|
||||||
|
// 判定为单点登录
|
||||||
|
|
||||||
|
// 清空本地旧信息
|
||||||
|
removeToken();
|
||||||
|
|
||||||
|
// 保存新信息到本地
|
||||||
|
setToken(params);
|
||||||
|
|
||||||
|
// 删除不需要显示在 url 的参数
|
||||||
|
delete params["roles"];
|
||||||
|
delete params["accessToken"];
|
||||||
|
|
||||||
|
const newUrl = `${location.origin}${location.pathname}${subBefore(
|
||||||
|
location.hash,
|
||||||
|
"?"
|
||||||
|
)}?${JSON.stringify(params)
|
||||||
|
.replace(/["{}]/g, "")
|
||||||
|
.replace(/:/g, "=")
|
||||||
|
.replace(/,/g, "&")}`;
|
||||||
|
|
||||||
|
// 替换历史记录项
|
||||||
|
window.location.replace(newUrl);
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
})();
|
||||||
188
src/utils/tree.ts
Normal file
@@ -0,0 +1,188 @@
|
|||||||
|
/**
|
||||||
|
* @description 提取菜单树中的每一项uniqueId
|
||||||
|
* @param tree 树
|
||||||
|
* @returns 每一项uniqueId组成的数组
|
||||||
|
*/
|
||||||
|
export const extractPathList = (tree: any[]): any => {
|
||||||
|
if (!Array.isArray(tree)) {
|
||||||
|
console.warn("tree must be an array");
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
if (!tree || tree.length === 0) return [];
|
||||||
|
const expandedPaths: Array<number | string> = [];
|
||||||
|
for (const node of tree) {
|
||||||
|
const hasChildren = node.children && node.children.length > 0;
|
||||||
|
if (hasChildren) {
|
||||||
|
extractPathList(node.children);
|
||||||
|
}
|
||||||
|
expandedPaths.push(node.uniqueId);
|
||||||
|
}
|
||||||
|
return expandedPaths;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 如果父级下children的length为1,删除children并自动组建唯一uniqueId
|
||||||
|
* @param tree 树
|
||||||
|
* @param pathList 每一项的id组成的数组
|
||||||
|
* @returns 组件唯一uniqueId后的树
|
||||||
|
*/
|
||||||
|
export const deleteChildren = (tree: any[], pathList = []): any => {
|
||||||
|
if (!Array.isArray(tree)) {
|
||||||
|
console.warn("menuTree must be an array");
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
if (!tree || tree.length === 0) return [];
|
||||||
|
for (const [key, node] of tree.entries()) {
|
||||||
|
if (node.children && node.children.length === 1) delete node.children;
|
||||||
|
node.id = key;
|
||||||
|
node.parentId = pathList.length ? pathList[pathList.length - 1] : null;
|
||||||
|
node.pathList = [...pathList, node.id];
|
||||||
|
node.uniqueId =
|
||||||
|
node.pathList.length > 1 ? node.pathList.join("-") : node.pathList[0];
|
||||||
|
const hasChildren = node.children && node.children.length > 0;
|
||||||
|
if (hasChildren) {
|
||||||
|
deleteChildren(node.children, node.pathList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return tree;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 创建层级关系
|
||||||
|
* @param tree 树
|
||||||
|
* @param pathList 每一项的id组成的数组
|
||||||
|
* @returns 创建层级关系后的树
|
||||||
|
*/
|
||||||
|
export const buildHierarchyTree = (tree: any[], pathList = []): any => {
|
||||||
|
if (!Array.isArray(tree)) {
|
||||||
|
console.warn("tree must be an array");
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
if (!tree || tree.length === 0) return [];
|
||||||
|
for (const [key, node] of tree.entries()) {
|
||||||
|
node.id = key;
|
||||||
|
node.parentId = pathList.length ? pathList[pathList.length - 1] : null;
|
||||||
|
node.pathList = [...pathList, node.id];
|
||||||
|
const hasChildren = node.children && node.children.length > 0;
|
||||||
|
if (hasChildren) {
|
||||||
|
buildHierarchyTree(node.children, node.pathList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return tree;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 广度优先遍历,根据唯一uniqueId找当前节点信息
|
||||||
|
* @param tree 树
|
||||||
|
* @param uniqueId 唯一uniqueId
|
||||||
|
* @returns 当前节点信息
|
||||||
|
*/
|
||||||
|
export const getNodeByUniqueId = (
|
||||||
|
tree: any[],
|
||||||
|
uniqueId: number | string
|
||||||
|
): any => {
|
||||||
|
if (!Array.isArray(tree)) {
|
||||||
|
console.warn("menuTree must be an array");
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
if (!tree || tree.length === 0) return [];
|
||||||
|
const item = tree.find(node => node.uniqueId === uniqueId);
|
||||||
|
if (item) return item;
|
||||||
|
const childrenList = tree
|
||||||
|
.filter(node => node.children)
|
||||||
|
.map(i => i.children)
|
||||||
|
.flat(1) as unknown;
|
||||||
|
return getNodeByUniqueId(childrenList as any[], uniqueId);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 向当前唯一uniqueId节点中追加字段
|
||||||
|
* @param tree 树
|
||||||
|
* @param uniqueId 唯一uniqueId
|
||||||
|
* @param fields 需要追加的字段
|
||||||
|
* @returns 追加字段后的树
|
||||||
|
*/
|
||||||
|
export const appendFieldByUniqueId = (
|
||||||
|
tree: any[],
|
||||||
|
uniqueId: number | string,
|
||||||
|
fields: object
|
||||||
|
): any => {
|
||||||
|
if (!Array.isArray(tree)) {
|
||||||
|
console.warn("menuTree must be an array");
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
if (!tree || tree.length === 0) return [];
|
||||||
|
for (const node of tree) {
|
||||||
|
const hasChildren = node.children && node.children.length > 0;
|
||||||
|
if (
|
||||||
|
node.uniqueId === uniqueId &&
|
||||||
|
Object.prototype.toString.call(fields) === "[object Object]"
|
||||||
|
)
|
||||||
|
Object.assign(node, fields);
|
||||||
|
if (hasChildren) {
|
||||||
|
appendFieldByUniqueId(node.children, uniqueId, fields);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return tree;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 构造树型结构数据
|
||||||
|
* @param data 数据源
|
||||||
|
* @param id id字段 默认id
|
||||||
|
* @param parentId 父节点字段,默认parentId
|
||||||
|
* @param children 子节点字段,默认children
|
||||||
|
* @returns 追加字段后的树
|
||||||
|
*/
|
||||||
|
export const handleTree = (
|
||||||
|
data: any[],
|
||||||
|
id?: string,
|
||||||
|
parentId?: string,
|
||||||
|
children?: string
|
||||||
|
): any => {
|
||||||
|
if (!Array.isArray(data)) {
|
||||||
|
console.warn("data must be an array");
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
const config = {
|
||||||
|
id: id || "id",
|
||||||
|
parentId: parentId || "parentId",
|
||||||
|
childrenList: children || "children"
|
||||||
|
};
|
||||||
|
|
||||||
|
const childrenListMap: any = {};
|
||||||
|
const nodeIds: any = {};
|
||||||
|
const tree = [];
|
||||||
|
|
||||||
|
for (const d of data) {
|
||||||
|
const parentId = d[config.parentId];
|
||||||
|
if (childrenListMap[parentId] == null) {
|
||||||
|
childrenListMap[parentId] = [];
|
||||||
|
}
|
||||||
|
nodeIds[d[config.id]] = d;
|
||||||
|
childrenListMap[parentId].push(d);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const d of data) {
|
||||||
|
const parentId = d[config.parentId];
|
||||||
|
if (nodeIds[parentId] == null) {
|
||||||
|
tree.push(d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const t of tree) {
|
||||||
|
adaptToChildrenList(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
function adaptToChildrenList(o: Record<string, any>) {
|
||||||
|
if (childrenListMap[o[config.id]] !== null) {
|
||||||
|
o[config.childrenList] = childrenListMap[o[config.id]];
|
||||||
|
}
|
||||||
|
if (o[config.childrenList]) {
|
||||||
|
for (const c of o[config.childrenList]) {
|
||||||
|
adaptToChildrenList(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return tree;
|
||||||
|
};
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import Motion from "./utils/motion";
|
import Motion from "./utils/motion";
|
||||||
import { useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
|
import { message } from "@/utils/message";
|
||||||
import { loginRules } from "./utils/rule";
|
import { loginRules } from "./utils/rule";
|
||||||
import { initRouter } from "@/router/utils";
|
import { initRouter } from "@/router/utils";
|
||||||
import { useNav } from "@/layout/hooks/useNav";
|
import { useNav } from "@/layout/hooks/useNav";
|
||||||
import { message } from "@pureadmin/components";
|
|
||||||
import type { FormInstance } from "element-plus";
|
import type { FormInstance } from "element-plus";
|
||||||
import { useLayout } from "@/layout/hooks/useLayout";
|
import { useLayout } from "@/layout/hooks/useLayout";
|
||||||
import { useUserStoreHook } from "@/store/modules/user";
|
import { useUserStoreHook } from "@/store/modules/user";
|
||||||
@@ -15,6 +15,8 @@ import { useDataThemeChange } from "@/layout/hooks/useDataThemeChange";
|
|||||||
|
|
||||||
import dayIcon from "@/assets/svg/day.svg?component";
|
import dayIcon from "@/assets/svg/day.svg?component";
|
||||||
import darkIcon from "@/assets/svg/dark.svg?component";
|
import darkIcon from "@/assets/svg/dark.svg?component";
|
||||||
|
import Lock from "@iconify-icons/ri/lock-fill";
|
||||||
|
import User from "@iconify-icons/ri/user-3-fill";
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: "Login"
|
name: "Login"
|
||||||
@@ -41,13 +43,13 @@ const onLogin = async (formEl: FormInstance | undefined) => {
|
|||||||
await formEl.validate((valid, fields) => {
|
await formEl.validate((valid, fields) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
useUserStoreHook()
|
useUserStoreHook()
|
||||||
.loginByUsername({ username: ruleForm.username })
|
.loginByUsername({ username: ruleForm.username, password: "admin123" })
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
// 获取后端路由
|
// 获取后端路由
|
||||||
initRouter().then(() => {
|
initRouter().then(() => {
|
||||||
message.success("登录成功");
|
|
||||||
router.push("/");
|
router.push("/");
|
||||||
|
message("登录成功", { type: "success" });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -119,7 +121,7 @@ onBeforeUnmount(() => {
|
|||||||
clearable
|
clearable
|
||||||
v-model="ruleForm.username"
|
v-model="ruleForm.username"
|
||||||
placeholder="账号"
|
placeholder="账号"
|
||||||
:prefix-icon="useRenderIcon('user')"
|
:prefix-icon="useRenderIcon(User)"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</Motion>
|
</Motion>
|
||||||
@@ -131,7 +133,7 @@ onBeforeUnmount(() => {
|
|||||||
show-password
|
show-password
|
||||||
v-model="ruleForm.password"
|
v-model="ruleForm.password"
|
||||||
placeholder="密码"
|
placeholder="密码"
|
||||||
:prefix-icon="useRenderIcon('lock')"
|
:prefix-icon="useRenderIcon(Lock)"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</Motion>
|
</Motion>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ defineOptions({
|
|||||||
name: "PermissionButton"
|
name: "PermissionButton"
|
||||||
});
|
});
|
||||||
|
|
||||||
let elStyle = computed((): CSSProperties => {
|
const elStyle = computed((): CSSProperties => {
|
||||||
return {
|
return {
|
||||||
width: "85vw",
|
width: "85vw",
|
||||||
justifyContent: "start"
|
justifyContent: "start"
|
||||||
|
|||||||
@@ -8,14 +8,14 @@ defineOptions({
|
|||||||
name: "PermissionPage"
|
name: "PermissionPage"
|
||||||
});
|
});
|
||||||
|
|
||||||
let elStyle = computed((): CSSProperties => {
|
const elStyle = computed((): CSSProperties => {
|
||||||
return {
|
return {
|
||||||
width: "85vw",
|
width: "85vw",
|
||||||
justifyContent: "start"
|
justifyContent: "start"
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
let username = ref(useUserStoreHook()?.username);
|
const username = ref(useUserStoreHook()?.username);
|
||||||
|
|
||||||
const options = [
|
const options = [
|
||||||
{
|
{
|
||||||
@@ -30,9 +30,10 @@ const options = [
|
|||||||
|
|
||||||
function onChange() {
|
function onChange() {
|
||||||
useUserStoreHook()
|
useUserStoreHook()
|
||||||
.loginByUsername({ username: username.value })
|
.loginByUsername({ username: username.value, password: "admin123" })
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
|
sessionStorage.removeItem("async-routes");
|
||||||
usePermissionStoreHook().clearAllCachePage();
|
usePermissionStoreHook().clearAllCachePage();
|
||||||
initRouter();
|
initRouter();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,26 +21,25 @@
|
|||||||
"incremental": true,
|
"incremental": true,
|
||||||
"paths": {
|
"paths": {
|
||||||
"@/*": ["src/*"],
|
"@/*": ["src/*"],
|
||||||
"@build/*": ["build/*"],
|
"@build/*": ["build/*"]
|
||||||
"/#/*": ["types/*"]
|
|
||||||
},
|
},
|
||||||
"types": [
|
"types": [
|
||||||
"node",
|
"node",
|
||||||
"vite/client",
|
"vite/client",
|
||||||
"element-plus/global",
|
"element-plus/global",
|
||||||
"@pureadmin/table/volar",
|
"@pureadmin/table/volar",
|
||||||
"unplugin-vue-define-options",
|
"@pureadmin/descriptions/volar",
|
||||||
"@pureadmin/descriptions/volar"
|
"unplugin-vue-define-options/macros-global"
|
||||||
],
|
],
|
||||||
"typeRoots": ["./node_modules/@types/", "./types"]
|
"typeRoots": ["./node_modules/@types/", "./types"]
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
|
"mock/*.ts",
|
||||||
"src/**/*.ts",
|
"src/**/*.ts",
|
||||||
"src/**/*.tsx",
|
"src/**/*.tsx",
|
||||||
"src/**/*.vue",
|
"src/**/*.vue",
|
||||||
"types/*.d.ts",
|
"types/*.d.ts",
|
||||||
"mock/*.ts",
|
|
||||||
"vite.config.ts"
|
"vite.config.ts"
|
||||||
],
|
],
|
||||||
"exclude": ["node_modules", "dist", "**/*.js", "index.html"]
|
"exclude": ["node_modules", "dist", "**/*.js"]
|
||||||
}
|
}
|
||||||
|
|||||||
124
types/global-components.d.ts
vendored
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
declare module "vue" {
|
||||||
|
/**
|
||||||
|
* 自定义全局组件获得 Volar 提示(自定义的全局组件需要在这里声明下才能获得 Volar 类型提示哦)
|
||||||
|
*/
|
||||||
|
export interface GlobalComponents {
|
||||||
|
IconifyIconOffline: typeof import("../src/components/ReIcon")["IconifyIconOffline"];
|
||||||
|
IconifyIconOnline: typeof import("../src/components/ReIcon")["IconifyIconOnline"];
|
||||||
|
FontIcon: typeof import("../src/components/ReIcon")["FontIcon"];
|
||||||
|
Auth: typeof import("../src/components/ReAuth")["Auth"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* todo:https://github.com/element-plus/element-plus/blob/dev/global.d.ts#L2
|
||||||
|
* No need to install @vue/runtime-core
|
||||||
|
*/
|
||||||
|
declare module "vue" {
|
||||||
|
export interface GlobalComponents {
|
||||||
|
ElAffix: typeof import("element-plus")["ElAffix"];
|
||||||
|
ElAlert: typeof import("element-plus")["ElAlert"];
|
||||||
|
ElAside: typeof import("element-plus")["ElAside"];
|
||||||
|
ElAutocomplete: typeof import("element-plus")["ElAutocomplete"];
|
||||||
|
ElAvatar: typeof import("element-plus")["ElAvatar"];
|
||||||
|
ElBacktop: typeof import("element-plus")["ElBacktop"];
|
||||||
|
ElBadge: typeof import("element-plus")["ElBadge"];
|
||||||
|
ElBreadcrumb: typeof import("element-plus")["ElBreadcrumb"];
|
||||||
|
ElBreadcrumbItem: typeof import("element-plus")["ElBreadcrumbItem"];
|
||||||
|
ElButton: typeof import("element-plus")["ElButton"];
|
||||||
|
ElButtonGroup: typeof import("element-plus")["ElButtonGroup"];
|
||||||
|
ElCalendar: typeof import("element-plus")["ElCalendar"];
|
||||||
|
ElCard: typeof import("element-plus")["ElCard"];
|
||||||
|
ElCarousel: typeof import("element-plus")["ElCarousel"];
|
||||||
|
ElCarouselItem: typeof import("element-plus")["ElCarouselItem"];
|
||||||
|
ElCascader: typeof import("element-plus")["ElCascader"];
|
||||||
|
ElCascaderPanel: typeof import("element-plus")["ElCascaderPanel"];
|
||||||
|
ElCheckbox: typeof import("element-plus")["ElCheckbox"];
|
||||||
|
ElCheckboxButton: typeof import("element-plus")["ElCheckboxButton"];
|
||||||
|
ElCheckboxGroup: typeof import("element-plus")["ElCheckboxGroup"];
|
||||||
|
ElCol: typeof import("element-plus")["ElCol"];
|
||||||
|
ElCollapse: typeof import("element-plus")["ElCollapse"];
|
||||||
|
ElCollapseItem: typeof import("element-plus")["ElCollapseItem"];
|
||||||
|
ElCollapseTransition: typeof import("element-plus")["ElCollapseTransition"];
|
||||||
|
ElColorPicker: typeof import("element-plus")["ElColorPicker"];
|
||||||
|
ElContainer: typeof import("element-plus")["ElContainer"];
|
||||||
|
ElConfigProvider: typeof import("element-plus")["ElConfigProvider"];
|
||||||
|
ElDatePicker: typeof import("element-plus")["ElDatePicker"];
|
||||||
|
ElDialog: typeof import("element-plus")["ElDialog"];
|
||||||
|
ElDivider: typeof import("element-plus")["ElDivider"];
|
||||||
|
ElDrawer: typeof import("element-plus")["ElDrawer"];
|
||||||
|
ElDropdown: typeof import("element-plus")["ElDropdown"];
|
||||||
|
ElDropdownItem: typeof import("element-plus")["ElDropdownItem"];
|
||||||
|
ElDropdownMenu: typeof import("element-plus")["ElDropdownMenu"];
|
||||||
|
ElEmpty: typeof import("element-plus")["ElEmpty"];
|
||||||
|
ElFooter: typeof import("element-plus")["ElFooter"];
|
||||||
|
ElForm: typeof import("element-plus")["ElForm"];
|
||||||
|
ElFormItem: typeof import("element-plus")["ElFormItem"];
|
||||||
|
ElHeader: typeof import("element-plus")["ElHeader"];
|
||||||
|
ElIcon: typeof import("element-plus")["ElIcon"];
|
||||||
|
ElImage: typeof import("element-plus")["ElImage"];
|
||||||
|
ElImageViewer: typeof import("element-plus")["ElImageViewer"];
|
||||||
|
ElInput: typeof import("element-plus")["ElInput"];
|
||||||
|
ElInputNumber: typeof import("element-plus")["ElInputNumber"];
|
||||||
|
ElLink: typeof import("element-plus")["ElLink"];
|
||||||
|
ElMain: typeof import("element-plus")["ElMain"];
|
||||||
|
ElMenu: typeof import("element-plus")["ElMenu"];
|
||||||
|
ElMenuItem: typeof import("element-plus")["ElMenuItem"];
|
||||||
|
ElMenuItemGroup: typeof import("element-plus")["ElMenuItemGroup"];
|
||||||
|
ElOption: typeof import("element-plus")["ElOption"];
|
||||||
|
ElOptionGroup: typeof import("element-plus")["ElOptionGroup"];
|
||||||
|
ElPageHeader: typeof import("element-plus")["ElPageHeader"];
|
||||||
|
ElPagination: typeof import("element-plus")["ElPagination"];
|
||||||
|
ElPopconfirm: typeof import("element-plus")["ElPopconfirm"];
|
||||||
|
ElPopper: typeof import("element-plus")["ElPopper"];
|
||||||
|
ElPopover: typeof import("element-plus")["ElPopover"];
|
||||||
|
ElProgress: typeof import("element-plus")["ElProgress"];
|
||||||
|
ElRadio: typeof import("element-plus")["ElRadio"];
|
||||||
|
ElRadioButton: typeof import("element-plus")["ElRadioButton"];
|
||||||
|
ElRadioGroup: typeof import("element-plus")["ElRadioGroup"];
|
||||||
|
ElRate: typeof import("element-plus")["ElRate"];
|
||||||
|
ElRow: typeof import("element-plus")["ElRow"];
|
||||||
|
ElScrollbar: typeof import("element-plus")["ElScrollbar"];
|
||||||
|
ElSelect: typeof import("element-plus")["ElSelect"];
|
||||||
|
ElSlider: typeof import("element-plus")["ElSlider"];
|
||||||
|
ElStep: typeof import("element-plus")["ElStep"];
|
||||||
|
ElSteps: typeof import("element-plus")["ElSteps"];
|
||||||
|
ElSubMenu: typeof import("element-plus")["ElSubMenu"];
|
||||||
|
ElSwitch: typeof import("element-plus")["ElSwitch"];
|
||||||
|
ElTabPane: typeof import("element-plus")["ElTabPane"];
|
||||||
|
ElTable: typeof import("element-plus")["ElTable"];
|
||||||
|
ElTableColumn: typeof import("element-plus")["ElTableColumn"];
|
||||||
|
ElTabs: typeof import("element-plus")["ElTabs"];
|
||||||
|
ElTag: typeof import("element-plus")["ElTag"];
|
||||||
|
ElTimePicker: typeof import("element-plus")["ElTimePicker"];
|
||||||
|
ElTimeSelect: typeof import("element-plus")["ElTimeSelect"];
|
||||||
|
ElTimeline: typeof import("element-plus")["ElTimeline"];
|
||||||
|
ElTimelineItem: typeof import("element-plus")["ElTimelineItem"];
|
||||||
|
ElTooltip: typeof import("element-plus")["ElTooltip"];
|
||||||
|
ElTransfer: typeof import("element-plus")["ElTransfer"];
|
||||||
|
ElTree: typeof import("element-plus")["ElTree"];
|
||||||
|
ElTreeV2: typeof import("element-plus")["ElTreeV2"];
|
||||||
|
ElUpload: typeof import("element-plus")["ElUpload"];
|
||||||
|
ElSpace: typeof import("element-plus")["ElSpace"];
|
||||||
|
ElSkeleton: typeof import("element-plus")["ElSkeleton"];
|
||||||
|
ElSkeletonItem: typeof import("element-plus")["ElSkeletonItem"];
|
||||||
|
ElCheckTag: typeof import("element-plus")["ElCheckTag"];
|
||||||
|
ElDescriptions: typeof import("element-plus")["ElDescriptions"];
|
||||||
|
ElDescriptionsItem: typeof import("element-plus")["ElDescriptionsItem"];
|
||||||
|
ElResult: typeof import("element-plus")["ElResult"];
|
||||||
|
ElSelectV2: typeof import("element-plus")["ElSelectV2"];
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ComponentCustomProperties {
|
||||||
|
$message: typeof import("element-plus")["ElMessage"];
|
||||||
|
$notify: typeof import("element-plus")["ElNotification"];
|
||||||
|
$msgbox: typeof import("element-plus")["ElMessageBox"];
|
||||||
|
$messageBox: typeof import("element-plus")["ElMessageBox"];
|
||||||
|
$alert: typeof import("element-plus")["ElMessageBox"]["alert"];
|
||||||
|
$confirm: typeof import("element-plus")["ElMessageBox"]["confirm"];
|
||||||
|
$prompt: typeof import("element-plus")["ElMessageBox"]["prompt"];
|
||||||
|
$loading: typeof import("element-plus")["ElLoadingService"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export {};
|
||||||
265
types/global.d.ts
vendored
@@ -1,24 +1,21 @@
|
|||||||
import type {
|
import type {
|
||||||
ComponentRenderProxy,
|
|
||||||
VNode,
|
VNode,
|
||||||
ComponentPublicInstance,
|
|
||||||
FunctionalComponent,
|
FunctionalComponent,
|
||||||
PropType as VuePropType
|
PropType as VuePropType,
|
||||||
|
ComponentPublicInstance
|
||||||
} from "vue";
|
} from "vue";
|
||||||
import type { ECharts } from "echarts";
|
import type { ECharts } from "echarts";
|
||||||
import { type ResponsiveStorage } from "./index";
|
import type { IconifyIcon } from "@iconify/vue";
|
||||||
|
import type { TableColumns } from "@pureadmin/table";
|
||||||
// GlobalComponents for Volar
|
import { type RouteComponent, type RouteLocationNormalized } from "vue-router";
|
||||||
declare module "vue" {
|
|
||||||
export interface GlobalComponents {
|
|
||||||
IconifyIconOffline: typeof import("../src/components/ReIcon")["IconifyIconOffline"];
|
|
||||||
IconifyIconOnline: typeof import("../src/components/ReIcon")["IconifyIconOnline"];
|
|
||||||
FontIcon: typeof import("../src/components/ReIcon")["FontIcon"];
|
|
||||||
Auth: typeof import("../src/components/ReAuth")["Auth"];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全局类型声明,无需引入直接在 `.vue` 、`.ts` 、`.tsx` 文件使用即可获得类型提示
|
||||||
|
*/
|
||||||
declare global {
|
declare global {
|
||||||
|
/**
|
||||||
|
* 平台的名称、版本、依赖、最后构建时间的类型提示
|
||||||
|
*/
|
||||||
const __APP_INFO__: {
|
const __APP_INFO__: {
|
||||||
pkg: {
|
pkg: {
|
||||||
name: string;
|
name: string;
|
||||||
@@ -28,6 +25,10 @@ declare global {
|
|||||||
};
|
};
|
||||||
lastBuildTime: string;
|
lastBuildTime: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Window 的类型提示
|
||||||
|
*/
|
||||||
interface Window {
|
interface Window {
|
||||||
// Global vue app instance
|
// Global vue app instance
|
||||||
__APP__: App<Element>;
|
__APP__: App<Element>;
|
||||||
@@ -41,39 +42,9 @@ declare global {
|
|||||||
msRequestAnimationFrame: (callback: FrameRequestCallback) => number;
|
msRequestAnimationFrame: (callback: FrameRequestCallback) => number;
|
||||||
}
|
}
|
||||||
|
|
||||||
// vue
|
/**
|
||||||
type PropType<T> = VuePropType<T>;
|
* 打包压缩格式的类型声明
|
||||||
|
*/
|
||||||
type Writable<T> = {
|
|
||||||
-readonly [P in keyof T]: T[P];
|
|
||||||
};
|
|
||||||
|
|
||||||
type Nullable<T> = T | null;
|
|
||||||
type NonNullable<T> = T extends null | undefined ? never : T;
|
|
||||||
type Recordable<T = any> = Record<string, T>;
|
|
||||||
type ReadonlyRecordable<T = any> = {
|
|
||||||
readonly [key: string]: T;
|
|
||||||
};
|
|
||||||
type Indexable<T = any> = {
|
|
||||||
[key: string]: T;
|
|
||||||
};
|
|
||||||
type DeepPartial<T> = {
|
|
||||||
[P in keyof T]?: DeepPartial<T[P]>;
|
|
||||||
};
|
|
||||||
type TimeoutHandle = ReturnType<typeof setTimeout>;
|
|
||||||
type IntervalHandle = ReturnType<typeof setInterval>;
|
|
||||||
|
|
||||||
interface ChangeEvent extends Event {
|
|
||||||
target: HTMLInputElement;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface WheelEvent {
|
|
||||||
path?: EventTarget[];
|
|
||||||
}
|
|
||||||
interface ImportMetaEnv extends ViteEnv {
|
|
||||||
__: unknown;
|
|
||||||
}
|
|
||||||
|
|
||||||
type ViteCompression =
|
type ViteCompression =
|
||||||
| "none"
|
| "none"
|
||||||
| "gzip"
|
| "gzip"
|
||||||
@@ -83,24 +54,35 @@ declare global {
|
|||||||
| "brotli-clear"
|
| "brotli-clear"
|
||||||
| "both-clear";
|
| "both-clear";
|
||||||
|
|
||||||
declare interface ViteEnv {
|
/**
|
||||||
|
* 全局自定义环境变量的类型声明
|
||||||
|
* @see {@link https://yiming_chang.gitee.io/pure-admin-doc/pages/config/#%E5%85%B7%E4%BD%93%E9%85%8D%E7%BD%AE}
|
||||||
|
*/
|
||||||
|
interface ViteEnv {
|
||||||
VITE_PORT: number;
|
VITE_PORT: number;
|
||||||
VITE_PUBLIC_PATH: string;
|
VITE_PUBLIC_PATH: string;
|
||||||
VITE_PROXY_DOMAIN: string;
|
|
||||||
VITE_PROXY_DOMAIN_REAL: string;
|
|
||||||
VITE_ROUTER_HISTORY: string;
|
VITE_ROUTER_HISTORY: string;
|
||||||
VITE_LEGACY: boolean;
|
|
||||||
VITE_CDN: boolean;
|
VITE_CDN: boolean;
|
||||||
VITE_COMPRESSION: ViteCompression;
|
VITE_COMPRESSION: ViteCompression;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare interface ServerConfigs {
|
/**
|
||||||
|
* 继承 `@pureadmin/table` 的 `TableColumns` ,方便全局直接调用
|
||||||
|
*/
|
||||||
|
interface TableColumnList extends Array<TableColumns> {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对应 `public/serverConfig.json` 文件的类型声明
|
||||||
|
* @see {@link https://yiming_chang.gitee.io/pure-admin-doc/pages/config/#serverconfig-json}
|
||||||
|
*/
|
||||||
|
interface ServerConfigs {
|
||||||
Version?: string;
|
Version?: string;
|
||||||
Title?: string;
|
Title?: string;
|
||||||
FixedHeader?: boolean;
|
FixedHeader?: boolean;
|
||||||
HiddenSideBar?: boolean;
|
HiddenSideBar?: boolean;
|
||||||
MultiTagsCache?: boolean;
|
MultiTagsCache?: boolean;
|
||||||
KeepAlive?: boolean;
|
KeepAlive?: boolean;
|
||||||
|
Locale?: string;
|
||||||
Layout?: string;
|
Layout?: string;
|
||||||
Theme?: string;
|
Theme?: string;
|
||||||
DarkMode?: boolean;
|
DarkMode?: boolean;
|
||||||
@@ -111,39 +93,162 @@ declare global {
|
|||||||
EpThemeColor?: string;
|
EpThemeColor?: string;
|
||||||
ShowLogo?: boolean;
|
ShowLogo?: boolean;
|
||||||
ShowModel?: string;
|
ShowModel?: string;
|
||||||
MapConfigure?: {
|
MenuArrowIconNoTransition?: boolean;
|
||||||
amapKey?: string;
|
CachingAsyncRoutes?: boolean;
|
||||||
options: {
|
TooltipEffect?: Effect;
|
||||||
resizeEnable?: boolean;
|
}
|
||||||
center?: number[];
|
|
||||||
zoom?: number;
|
/**
|
||||||
};
|
* 与 `ServerConfigs` 类型不同,这里是缓存到浏览器本地存储的类型声明
|
||||||
|
* @see {@link https://yiming_chang.gitee.io/pure-admin-doc/pages/config/#serverconfig-json}
|
||||||
|
*/
|
||||||
|
interface StorageConfigs {
|
||||||
|
version?: string;
|
||||||
|
title?: string;
|
||||||
|
fixedHeader?: boolean;
|
||||||
|
hiddenSideBar?: boolean;
|
||||||
|
multiTagsCache?: boolean;
|
||||||
|
keepAlive?: boolean;
|
||||||
|
locale?: string;
|
||||||
|
layout?: string;
|
||||||
|
theme?: string;
|
||||||
|
darkMode?: boolean;
|
||||||
|
grey?: boolean;
|
||||||
|
weak?: boolean;
|
||||||
|
hideTabs?: boolean;
|
||||||
|
sidebarStatus?: boolean;
|
||||||
|
epThemeColor?: string;
|
||||||
|
showLogo?: boolean;
|
||||||
|
showModel?: string;
|
||||||
|
username?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* `responsive-storage` 本地响应式 `storage` 的类型声明
|
||||||
|
*/
|
||||||
|
interface ResponsiveStorage {
|
||||||
|
locale: {
|
||||||
|
locale?: string;
|
||||||
|
};
|
||||||
|
layout: {
|
||||||
|
layout?: string;
|
||||||
|
theme?: string;
|
||||||
|
darkMode?: boolean;
|
||||||
|
sidebarStatus?: boolean;
|
||||||
|
epThemeColor?: string;
|
||||||
|
};
|
||||||
|
configure: {
|
||||||
|
grey?: boolean;
|
||||||
|
weak?: boolean;
|
||||||
|
hideTabs?: boolean;
|
||||||
|
showLogo?: boolean;
|
||||||
|
showModel?: string;
|
||||||
|
multiTagsCache?: boolean;
|
||||||
|
};
|
||||||
|
tags?: Array<any>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* `src/router` 文件夹里的类型声明
|
||||||
|
*/
|
||||||
|
interface toRouteType extends RouteLocationNormalized {
|
||||||
|
meta: {
|
||||||
|
roles: Array<string>;
|
||||||
|
keepAlive?: boolean;
|
||||||
|
dynamicLevel?: string;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
declare interface GlobalPropertiesApi {
|
/**
|
||||||
|
* @description 完整子路由配置表
|
||||||
|
*/
|
||||||
|
interface RouteChildrenConfigsTable {
|
||||||
|
/** 子路由地址 `必填` */
|
||||||
|
path: string;
|
||||||
|
/** 路由名字(对应不要重复,和当前组件的`name`保持一致)`必填` */
|
||||||
|
name?: string;
|
||||||
|
/** 路由重定向 `可选` */
|
||||||
|
redirect?: string;
|
||||||
|
/** 按需加载组件 `可选` */
|
||||||
|
component?: RouteComponent;
|
||||||
|
meta?: {
|
||||||
|
/** 菜单名称(兼容国际化、非国际化,如何用国际化的写法就必须在根目录的`locales`文件夹下对应添加) `必填` */
|
||||||
|
title: string;
|
||||||
|
/** 菜单图标 `可选` */
|
||||||
|
icon?: string | FunctionalComponent | IconifyIcon;
|
||||||
|
/** 菜单名称右侧的额外图标,支持`fontawesome`、`iconfont`、`element-plus-icon` `可选` */
|
||||||
|
extraIcon?: {
|
||||||
|
svg?: boolean;
|
||||||
|
name?: string;
|
||||||
|
};
|
||||||
|
/** 是否在菜单中显示(默认`true`)`可选` */
|
||||||
|
showLink?: boolean;
|
||||||
|
/** 是否显示父级菜单 `可选` */
|
||||||
|
showParent?: boolean;
|
||||||
|
/** 页面级别权限设置 `可选` */
|
||||||
|
roles?: Array<string>;
|
||||||
|
/** 按钮级别权限设置 `可选` */
|
||||||
|
auths?: Array<string>;
|
||||||
|
/** 路由组件缓存(开启 `true`、关闭 `false`)`可选` */
|
||||||
|
keepAlive?: boolean;
|
||||||
|
/** 内嵌的`iframe`链接 `可选` */
|
||||||
|
frameSrc?: string;
|
||||||
|
/** `iframe`页是否开启首次加载动画(默认`true`)`可选` */
|
||||||
|
frameLoading?: boolean;
|
||||||
|
/** 页面加载动画(有两种形式,一种直接采用vue内置的`transitions`动画,另一种是使用`animate.css`写进、离场动画)`可选` */
|
||||||
|
transition?: {
|
||||||
|
/**
|
||||||
|
* @description 当前路由动画效果
|
||||||
|
* @see {@link https://next.router.vuejs.org/guide/advanced/transitions.html#transitions}
|
||||||
|
* @see animate.css {@link https://animate.style}
|
||||||
|
*/
|
||||||
|
name?: string;
|
||||||
|
/** 进场动画 */
|
||||||
|
enterTransition?: string;
|
||||||
|
/** 离场动画 */
|
||||||
|
leaveTransition?: string;
|
||||||
|
};
|
||||||
|
// 是否不添加信息到标签页,(默认`false`)
|
||||||
|
hiddenTag?: boolean;
|
||||||
|
/** 动态路由可打开的最大数量 `可选` */
|
||||||
|
dynamicLevel?: number;
|
||||||
|
};
|
||||||
|
/** 子路由配置项 */
|
||||||
|
children?: Array<RouteChildrenConfigsTable>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 整体路由配置表(包括完整子路由)
|
||||||
|
*/
|
||||||
|
interface RouteConfigsTable {
|
||||||
|
/** 路由地址 `必填` */
|
||||||
|
path: string;
|
||||||
|
/** 路由名字(保持唯一)`可选` */
|
||||||
|
name?: string;
|
||||||
|
/** `Layout`组件 `可选` */
|
||||||
|
component?: RouteComponent;
|
||||||
|
/** 路由重定向 `可选` */
|
||||||
|
redirect?: string;
|
||||||
|
meta?: {
|
||||||
|
/** 菜单名称(兼容国际化、非国际化,如何用国际化的写法就必须在根目录的`locales`文件夹下对应添加)`必填` */
|
||||||
|
title: string;
|
||||||
|
/** 菜单图标 `可选` */
|
||||||
|
icon?: string | FunctionalComponent | IconifyIcon;
|
||||||
|
/** 是否在菜单中显示(默认`true`)`可选` */
|
||||||
|
showLink?: boolean;
|
||||||
|
/** 菜单升序排序,值越高排的越后(只针对顶级路由)`可选` */
|
||||||
|
rank?: number;
|
||||||
|
};
|
||||||
|
/** 子路由配置项 */
|
||||||
|
children?: Array<RouteChildrenConfigsTable>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 平台里所有组件实例都能访问到的全局属性对象的类型声明
|
||||||
|
*/
|
||||||
|
interface GlobalPropertiesApi {
|
||||||
$echarts: ECharts;
|
$echarts: ECharts;
|
||||||
$storage: ResponsiveStorage;
|
$storage: ResponsiveStorage;
|
||||||
$config: ServerConfigs;
|
$config: ServerConfigs;
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseInt(s: string | number, radix?: number): number;
|
|
||||||
|
|
||||||
function parseFloat(string: string | number): number;
|
|
||||||
|
|
||||||
namespace JSX {
|
|
||||||
// tslint:disable no-empty-interface
|
|
||||||
type Element = VNode;
|
|
||||||
// tslint:disable no-empty-interface
|
|
||||||
type ElementClass = ComponentRenderProxy;
|
|
||||||
interface ElementAttributesProperty {
|
|
||||||
$props: any;
|
|
||||||
}
|
|
||||||
interface IntrinsicElements {
|
|
||||||
[elem: string]: any;
|
|
||||||
}
|
|
||||||
interface IntrinsicAttributes {
|
|
||||||
[elem: string]: any;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
89
types/index.d.ts
vendored
@@ -1,33 +1,76 @@
|
|||||||
declare interface Fn<T = any, R = T> {
|
// 此文件跟同级目录的 global.d.ts 文件一样也是全局类型声明,只不过这里存放一些零散的全局类型,无需引入直接在 .vue 、.ts 、.tsx 文件使用即可获得类型提示
|
||||||
(...arg: T[]): R;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare interface PromiseFn<T = any, R = T> {
|
type RefType<T> = T | null;
|
||||||
(...arg: T[]): Promise<R>;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare type RefType<T> = T | null;
|
type EmitType = (event: string, ...args: any[]) => void;
|
||||||
|
|
||||||
declare type LabelValueOptions = {
|
type TargetContext = "_self" | "_blank";
|
||||||
label: string;
|
|
||||||
value: any;
|
|
||||||
}[];
|
|
||||||
|
|
||||||
declare type EmitType = (event: string, ...args: any[]) => void;
|
type ComponentRef<T extends HTMLElement = HTMLDivElement> =
|
||||||
|
|
||||||
declare type TargetContext = "_self" | "_blank";
|
|
||||||
|
|
||||||
declare interface ComponentElRef<T extends HTMLElement = HTMLDivElement> {
|
|
||||||
$el: T;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare type ComponentRef<T extends HTMLElement = HTMLDivElement> =
|
|
||||||
ComponentElRef<T> | null;
|
ComponentElRef<T> | null;
|
||||||
|
|
||||||
declare type ElRef<T extends HTMLElement = HTMLDivElement> = Nullable<T>;
|
type ElRef<T extends HTMLElement = HTMLDivElement> = Nullable<T>;
|
||||||
|
|
||||||
declare type ForDataType<T> = {
|
type ForDataType<T> = {
|
||||||
[P in T]?: ForDataType<T[P]>;
|
[P in T]?: ForDataType<T[P]>;
|
||||||
};
|
};
|
||||||
|
|
||||||
declare type AnyFunction<T> = (...args: any[]) => T;
|
type AnyFunction<T> = (...args: any[]) => T;
|
||||||
|
|
||||||
|
type PropType<T> = VuePropType<T>;
|
||||||
|
|
||||||
|
type Writable<T> = {
|
||||||
|
-readonly [P in keyof T]: T[P];
|
||||||
|
};
|
||||||
|
|
||||||
|
type Nullable<T> = T | null;
|
||||||
|
|
||||||
|
type NonNullable<T> = T extends null | undefined ? never : T;
|
||||||
|
|
||||||
|
type Recordable<T = any> = Record<string, T>;
|
||||||
|
|
||||||
|
type ReadonlyRecordable<T = any> = {
|
||||||
|
readonly [key: string]: T;
|
||||||
|
};
|
||||||
|
|
||||||
|
type Indexable<T = any> = {
|
||||||
|
[key: string]: T;
|
||||||
|
};
|
||||||
|
|
||||||
|
type DeepPartial<T> = {
|
||||||
|
[P in keyof T]?: DeepPartial<T[P]>;
|
||||||
|
};
|
||||||
|
|
||||||
|
type TimeoutHandle = ReturnType<typeof setTimeout>;
|
||||||
|
|
||||||
|
type IntervalHandle = ReturnType<typeof setInterval>;
|
||||||
|
|
||||||
|
type Effect = "light" | "dark";
|
||||||
|
|
||||||
|
interface ChangeEvent extends Event {
|
||||||
|
target: HTMLInputElement;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface WheelEvent {
|
||||||
|
path?: EventTarget[];
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ImportMetaEnv extends ViteEnv {
|
||||||
|
__: unknown;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Fn<T = any, R = T> {
|
||||||
|
(...arg: T[]): R;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface PromiseFn<T = any, R = T> {
|
||||||
|
(...arg: T[]): Promise<R>;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ComponentElRef<T extends HTMLElement = HTMLDivElement> {
|
||||||
|
$el: T;
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseInt(s: string | number, radix?: number): number;
|
||||||
|
|
||||||
|
function parseFloat(string: string | number): number;
|
||||||
|
|||||||
129
types/index.ts
@@ -1,129 +0,0 @@
|
|||||||
import { type RouteComponent } from "vue-router";
|
|
||||||
|
|
||||||
export interface StorageConfigs {
|
|
||||||
version?: string;
|
|
||||||
title?: string;
|
|
||||||
fixedHeader?: boolean;
|
|
||||||
hiddenSideBar?: boolean;
|
|
||||||
multiTagsCache?: boolean;
|
|
||||||
keepAlive?: boolean;
|
|
||||||
layout?: string;
|
|
||||||
theme?: string;
|
|
||||||
darkMode?: boolean;
|
|
||||||
grey?: boolean;
|
|
||||||
weak?: boolean;
|
|
||||||
hideTabs?: boolean;
|
|
||||||
sidebarStatus?: boolean;
|
|
||||||
epThemeColor?: string;
|
|
||||||
showLogo?: boolean;
|
|
||||||
showModel?: string;
|
|
||||||
mapConfigure?: {
|
|
||||||
amapKey?: string;
|
|
||||||
options: {
|
|
||||||
resizeEnable?: boolean;
|
|
||||||
center?: number[];
|
|
||||||
zoom?: number;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
username?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ResponsiveStorage {
|
|
||||||
layout: {
|
|
||||||
layout?: string;
|
|
||||||
theme?: string;
|
|
||||||
darkMode?: boolean;
|
|
||||||
sidebarStatus?: boolean;
|
|
||||||
epThemeColor?: string;
|
|
||||||
};
|
|
||||||
configure: {
|
|
||||||
grey?: boolean;
|
|
||||||
weak?: boolean;
|
|
||||||
hideTabs?: boolean;
|
|
||||||
showLogo?: boolean;
|
|
||||||
showModel?: string;
|
|
||||||
multiTagsCache?: boolean;
|
|
||||||
};
|
|
||||||
tags?: Array<any>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface RouteChildrenConfigsTable {
|
|
||||||
/** 子路由地址 `必填` */
|
|
||||||
path: string;
|
|
||||||
/** 路由名字(对应不要重复,和当前组件的`name`保持一致)`必填` */
|
|
||||||
name?: string;
|
|
||||||
/** 路由重定向 `可选` */
|
|
||||||
redirect?: string;
|
|
||||||
/** 按需加载组件 `可选` */
|
|
||||||
component?: RouteComponent;
|
|
||||||
meta?: {
|
|
||||||
/** 菜单名称(兼容国际化、非国际化,如何用国际化的写法就必须在根目录的`locales`文件夹下对应添加) `必填` */
|
|
||||||
title: string;
|
|
||||||
/** 菜单图标 `可选` */
|
|
||||||
icon?: string;
|
|
||||||
/** 菜单名称右侧的额外图标,支持`fontawesome`、`iconfont`、`element-plus-icon` `可选` */
|
|
||||||
extraIcon?: {
|
|
||||||
svg?: boolean;
|
|
||||||
name?: string;
|
|
||||||
};
|
|
||||||
/** 是否在菜单中显示(默认`true`)`可选` */
|
|
||||||
showLink?: boolean;
|
|
||||||
/** 是否显示父级菜单 `可选` */
|
|
||||||
showParent?: boolean;
|
|
||||||
/** 页面级别权限设置 `可选` */
|
|
||||||
roles?: Array<string>;
|
|
||||||
/** 按钮级别权限设置 `可选` */
|
|
||||||
auths?: Array<string>;
|
|
||||||
/** 路由组件缓存(开启 `true`、关闭 `false`)`可选` */
|
|
||||||
keepAlive?: boolean;
|
|
||||||
/** 内嵌的`iframe`链接 `可选` */
|
|
||||||
frameSrc?: string;
|
|
||||||
/** `iframe`页是否开启首次加载动画(默认`true`)`可选` */
|
|
||||||
frameLoading?: boolean;
|
|
||||||
/** 页面加载动画(有两种形式,一种直接采用vue内置的`transitions`动画,另一种是使用`animate.css`写进、离场动画)`可选` */
|
|
||||||
transition?: {
|
|
||||||
/**
|
|
||||||
* @description 当前路由动画效果
|
|
||||||
* @see {@link https://next.router.vuejs.org/guide/advanced/transitions.html#transitions}
|
|
||||||
*/
|
|
||||||
name?: string;
|
|
||||||
/** 进场动画 */
|
|
||||||
enterTransition?: string;
|
|
||||||
/** 离场动画 */
|
|
||||||
leaveTransition?: string;
|
|
||||||
};
|
|
||||||
// 是否不添加信息到标签页,(默认`false`)
|
|
||||||
hiddenTag?: boolean;
|
|
||||||
/** 动态路由可打开的最大数量 `可选` */
|
|
||||||
dynamicLevel?: number;
|
|
||||||
};
|
|
||||||
/** 子路由配置项 */
|
|
||||||
children?: Array<RouteChildrenConfigsTable>;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 完整路由配置表
|
|
||||||
* @see {@link https://yiming_chang.gitee.io/pure-admin-doc/pages/782b6e/#%E4%B8%80-%E9%85%8D%E7%BD%AE%E9%A1%B9}
|
|
||||||
*/
|
|
||||||
export interface RouteConfigsTable {
|
|
||||||
/** 路由地址 `必填` */
|
|
||||||
path: string;
|
|
||||||
/** 路由名字(保持唯一)`可选` */
|
|
||||||
name?: string;
|
|
||||||
/** `Layout`组件 `可选` */
|
|
||||||
component?: RouteComponent;
|
|
||||||
/** 路由重定向 `可选` */
|
|
||||||
redirect?: string;
|
|
||||||
meta?: {
|
|
||||||
/** 菜单名称(兼容国际化、非国际化,如何用国际化的写法就必须在根目录的`locales`文件夹下对应添加)`必填` */
|
|
||||||
title: string;
|
|
||||||
/** 菜单图标 `可选` */
|
|
||||||
icon?: string;
|
|
||||||
/** 是否在菜单中显示(默认`true`)`可选` */
|
|
||||||
showLink?: boolean;
|
|
||||||
/** 菜单升序排序,值越高排的越后(只针对顶级路由)`可选` */
|
|
||||||
rank?: number;
|
|
||||||
};
|
|
||||||
/** 子路由配置项 */
|
|
||||||
children?: Array<RouteChildrenConfigsTable>;
|
|
||||||
}
|
|
||||||
6
types/shims-tsx.d.ts
vendored
@@ -9,8 +9,14 @@ declare global {
|
|||||||
namespace JSX {
|
namespace JSX {
|
||||||
interface Element extends VNode {}
|
interface Element extends VNode {}
|
||||||
interface ElementClass extends Vue {}
|
interface ElementClass extends Vue {}
|
||||||
|
interface ElementAttributesProperty {
|
||||||
|
$props: any;
|
||||||
|
}
|
||||||
interface IntrinsicElements {
|
interface IntrinsicElements {
|
||||||
[elem: string]: any;
|
[elem: string]: any;
|
||||||
}
|
}
|
||||||
|
interface IntrinsicAttributes {
|
||||||
|
[elem: string]: any;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
5
types/shims-vue.d.ts
vendored
@@ -8,8 +8,3 @@ declare module "*.scss" {
|
|||||||
const scss: Record<string, string>;
|
const scss: Record<string, string>;
|
||||||
export default scss;
|
export default scss;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module "vuedraggable/src/vuedraggable";
|
|
||||||
declare module "@pureadmin/components";
|
|
||||||
declare module "@pureadmin/theme";
|
|
||||||
declare module "@pureadmin/theme/dist/browser-utils";
|
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import { resolve } from "path";
|
import { resolve } from "path";
|
||||||
import pkg from "./package.json";
|
import pkg from "./package.json";
|
||||||
import { warpperEnv, regExps } from "./build";
|
import { warpperEnv } from "./build";
|
||||||
import { getPluginsList } from "./build/plugins";
|
import { getPluginsList } from "./build/plugins";
|
||||||
|
import { include, exclude } from "./build/optimize";
|
||||||
import { UserConfigExport, ConfigEnv, loadEnv } from "vite";
|
import { UserConfigExport, ConfigEnv, loadEnv } from "vite";
|
||||||
|
|
||||||
/** 当前执行node命令时文件夹的地址(工作目录) */
|
/** 当前执行node命令时文件夹的地址(工作目录) */
|
||||||
@@ -26,15 +27,8 @@ const __APP_INFO__ = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default ({ command, mode }: ConfigEnv): UserConfigExport => {
|
export default ({ command, mode }: ConfigEnv): UserConfigExport => {
|
||||||
const {
|
const { VITE_CDN, VITE_PORT, VITE_COMPRESSION, VITE_PUBLIC_PATH } =
|
||||||
VITE_CDN,
|
warpperEnv(loadEnv(mode, root));
|
||||||
VITE_PORT,
|
|
||||||
VITE_LEGACY,
|
|
||||||
VITE_COMPRESSION,
|
|
||||||
VITE_PUBLIC_PATH,
|
|
||||||
VITE_PROXY_DOMAIN,
|
|
||||||
VITE_PROXY_DOMAIN_REAL
|
|
||||||
} = warpperEnv(loadEnv(mode, root));
|
|
||||||
return {
|
return {
|
||||||
base: VITE_PUBLIC_PATH,
|
base: VITE_PUBLIC_PATH,
|
||||||
root,
|
root,
|
||||||
@@ -48,23 +42,14 @@ export default ({ command, mode }: ConfigEnv): UserConfigExport => {
|
|||||||
// 端口号
|
// 端口号
|
||||||
port: VITE_PORT,
|
port: VITE_PORT,
|
||||||
host: "0.0.0.0",
|
host: "0.0.0.0",
|
||||||
// 本地跨域代理
|
// 本地跨域代理 https://cn.vitejs.dev/config/server-options.html#server-proxy
|
||||||
proxy:
|
proxy: {}
|
||||||
VITE_PROXY_DOMAIN_REAL.length > 0
|
|
||||||
? {
|
|
||||||
[VITE_PROXY_DOMAIN]: {
|
|
||||||
target: VITE_PROXY_DOMAIN_REAL,
|
|
||||||
// ws: true,
|
|
||||||
changeOrigin: true,
|
|
||||||
rewrite: (path: string) => regExps(path, VITE_PROXY_DOMAIN)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
: null
|
|
||||||
},
|
},
|
||||||
plugins: getPluginsList(command, VITE_LEGACY, VITE_CDN, VITE_COMPRESSION),
|
plugins: getPluginsList(command, VITE_CDN, VITE_COMPRESSION),
|
||||||
|
// https://cn.vitejs.dev/config/dep-optimization-options.html#dep-optimization-options
|
||||||
optimizeDeps: {
|
optimizeDeps: {
|
||||||
include: ["pinia", "lodash-es", "@vueuse/core", "dayjs"],
|
include,
|
||||||
exclude: ["@pureadmin/theme/dist/browser-utils"]
|
exclude
|
||||||
},
|
},
|
||||||
build: {
|
build: {
|
||||||
sourcemap: false,
|
sourcemap: false,
|
||||||
|
|||||||