release: update 3.8.5
@ -1,8 +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_ROUTER_HISTORY = "hash"
|
VITE_ROUTER_HISTORY = "hash"
|
||||||
|
@ -1,12 +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"
|
||||||
|
|
||||||
# 是否为打包后的文件提供传统浏览器兼容性支持 支持 true 不支持 false
|
|
||||||
VITE_LEGACY = false
|
|
||||||
|
|
||||||
# 是否在打包时使用cdn替换本地库 替换 true 不替换 false
|
# 是否在打包时使用cdn替换本地库 替换 true 不替换 false
|
||||||
VITE_CDN = false
|
VITE_CDN = false
|
||||||
|
|
||||||
|
@ -4,12 +4,9 @@ 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"
|
||||||
|
|
||||||
# 是否为打包后的文件提供传统浏览器兼容性支持 支持 true 不支持 false
|
|
||||||
VITE_LEGACY = false
|
|
||||||
|
|
||||||
# 是否在打包时使用cdn替换本地库 替换 true 不替换 false
|
# 是否在打包时使用cdn替换本地库 替换 true 不替换 false
|
||||||
VITE_CDN = true
|
VITE_CDN = true
|
||||||
|
|
||||||
|
@ -8,6 +8,10 @@
|
|||||||
|
|
||||||
精简版是基于 [vue-pure-admin](https://github.com/xiaoxian521/vue-pure-admin) 提炼出的架子,包含主体功能,更适合实际项目开发,打包后的大小低于 `3MB`,并且会永久同步完整版的代码。开启 `brotli` 压缩和 `cdn` 替换本地库模式后,打包大小低于 `500kb`
|
精简版是基于 [vue-pure-admin](https://github.com/xiaoxian521/vue-pure-admin) 提炼出的架子,包含主体功能,更适合实际项目开发,打包后的大小低于 `3MB`,并且会永久同步完整版的代码。开启 `brotli` 压缩和 `cdn` 替换本地库模式后,打包大小低于 `500kb`
|
||||||
|
|
||||||
|
## 版本选择
|
||||||
|
|
||||||
|
当前是国际化版本哦,如果您需要非国际化版本 [请点击](https://github.com/xiaoxian521/pure-admin-thin)
|
||||||
|
|
||||||
## 配套视频
|
## 配套视频
|
||||||
|
|
||||||
- [点我查看教程](https://www.bilibili.com/video/BV1534y1S7HV)
|
- [点我查看教程](https://www.bilibili.com/video/BV1534y1S7HV)
|
||||||
|
@ -1,11 +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_ROUTER_HISTORY: "",
|
VITE_ROUTER_HISTORY: "",
|
||||||
VITE_LEGACY: false,
|
|
||||||
VITE_CDN: false,
|
VITE_CDN: false,
|
||||||
VITE_COMPRESSION: "none"
|
VITE_COMPRESSION: "none"
|
||||||
};
|
};
|
||||||
@ -28,7 +27,7 @@ const warpperEnv = (envConf: Recordable): ViteEnv => {
|
|||||||
return ret;
|
return ret;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 环境变量 */
|
/** 获取环境变量 */
|
||||||
const loadEnv = (): ViteEnv => {
|
const loadEnv = (): ViteEnv => {
|
||||||
return import.meta.env;
|
return import.meta.env;
|
||||||
};
|
};
|
||||||
|
26
build/optimize.ts
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
/**
|
||||||
|
* 此文件作用于 `vite.config.ts` 的 `optimizeDeps.include` 依赖预构建配置项
|
||||||
|
* 依赖预构建,`vite` 启动时会将下面 include 里的模块,编译成 esm 格式并缓存到 node_modules/.vite 文件夹,页面加载到对应模块时如果浏览器有缓存就读取浏览器缓存,如果没有会读取本地缓存并按需加载
|
||||||
|
* 尤其当您禁用浏览器缓存时(这种情况只应该发生在调试阶段)必须将对应模块加入到 include里,否则会遇到开发环境切换页面卡顿的问题(vite 会认为它是一个新的依赖包会重新加载并强制刷新页面),因为它既无法使用浏览器缓存,又没有在本地 node_modules/.vite 里缓存
|
||||||
|
* 温馨提示:如果您使用的第三方库是全局引入,也就是引入到 src/main.ts 文件里,就不需要再添加到 include 里了,因为 vite 会自动将它们缓存到 node_modules/.vite
|
||||||
|
*/
|
||||||
|
export const include = [
|
||||||
|
"qs",
|
||||||
|
"mitt",
|
||||||
|
"dayjs",
|
||||||
|
"axios",
|
||||||
|
"pinia",
|
||||||
|
"lodash",
|
||||||
|
"echarts",
|
||||||
|
"vue-i18n",
|
||||||
|
"xe-utils",
|
||||||
|
"vxe-table",
|
||||||
|
"js-cookie",
|
||||||
|
"lodash-es",
|
||||||
|
"@vueuse/core",
|
||||||
|
"lodash-unified",
|
||||||
|
"@ctrl/tinycolor",
|
||||||
|
"@pureadmin/utils",
|
||||||
|
"responsive-storage",
|
||||||
|
"element-resize-detector"
|
||||||
|
];
|
@ -3,7 +3,6 @@ import { resolve } from "path";
|
|||||||
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 VueMacros from "unplugin-vue-macros/vite";
|
import VueMacros from "unplugin-vue-macros/vite";
|
||||||
import { viteMockServe } from "vite-plugin-mock";
|
import { viteMockServe } from "vite-plugin-mock";
|
||||||
@ -17,7 +16,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
|
||||||
) {
|
) {
|
||||||
@ -67,13 +65,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" })
|
||||||
|
41
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "pure-admin-thin",
|
"name": "pure-admin-thin",
|
||||||
"version": "3.6.4",
|
"version": "3.8.5",
|
||||||
"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,6 +11,7 @@
|
|||||||
"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 && 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",
|
||||||
@ -29,18 +30,16 @@
|
|||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ctrl/tinycolor": "^3.4.1",
|
"@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.8.0",
|
||||||
"@pureadmin/utils": "^1.1.5",
|
"@pureadmin/utils": "^1.6.7",
|
||||||
"@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.20",
|
"element-plus": "^2.2.25",
|
||||||
"element-resize-detector": "^1.2.4",
|
"element-resize-detector": "^1.2.4",
|
||||||
"js-cookie": "^3.0.1",
|
"js-cookie": "^3.0.1",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
@ -50,16 +49,15 @@
|
|||||||
"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.26",
|
||||||
"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.44",
|
"vue": "^3.2.45",
|
||||||
"vue-i18n": "^9.2.2",
|
"vue-i18n": "^9.2.2",
|
||||||
"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",
|
"vxe-table": "^4.3.6",
|
||||||
"xe-utils": "^3.5.6"
|
"xe-utils": "^3.5.7"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@commitlint/cli": "13.1.0",
|
"@commitlint/cli": "13.1.0",
|
||||||
@ -84,7 +82,7 @@
|
|||||||
"@vitejs/plugin-vue-jsx": "^2.1.1",
|
"@vitejs/plugin-vue-jsx": "^2.1.1",
|
||||||
"@vue/eslint-config-prettier": "^7.0.0",
|
"@vue/eslint-config-prettier": "^7.0.0",
|
||||||
"@vue/eslint-config-typescript": "^11.0.2",
|
"@vue/eslint-config-typescript": "^11.0.2",
|
||||||
"@vue/runtime-core": "^3.2.44",
|
"@vue/runtime-core": "^3.2.45",
|
||||||
"autoprefixer": "^10.4.13",
|
"autoprefixer": "^10.4.13",
|
||||||
"cloc": "^2.10.0",
|
"cloc": "^2.10.0",
|
||||||
"cssnano": "^5.1.14",
|
"cssnano": "^5.1.14",
|
||||||
@ -111,15 +109,16 @@
|
|||||||
"stylelint-config-recommended": "^9.0.0",
|
"stylelint-config-recommended": "^9.0.0",
|
||||||
"stylelint-config-standard": "^29.0.0",
|
"stylelint-config-standard": "^29.0.0",
|
||||||
"stylelint-order": "^5.0.0",
|
"stylelint-order": "^5.0.0",
|
||||||
"tailwindcss": "^3.2.3",
|
"svgo": "^3.0.2",
|
||||||
|
"tailwindcss": "^3.2.4",
|
||||||
"terser": "^5.15.1",
|
"terser": "^5.15.1",
|
||||||
"typescript": "^4.8.4",
|
"typescript": "^4.9.3",
|
||||||
"unplugin-vue-macros": "^0.16.2",
|
"unplugin-vue-macros": "^1.0.3",
|
||||||
"vite": "3.1.8",
|
"vite": "3.1.8",
|
||||||
"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.2.0",
|
"vite-plugin-remove-console": "^1.3.0",
|
||||||
"vite-svg-loader": "^3.6.0",
|
"vite-svg-loader": "^3.6.0",
|
||||||
"vue-eslint-parser": "^9.1.0",
|
"vue-eslint-parser": "^9.1.0",
|
||||||
"vue-tsc": "^1.0.9"
|
"vue-tsc": "^1.0.9"
|
||||||
|
1195
pnpm-lock.yaml
generated
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"Version": "3.6.4",
|
"Version": "3.8.5",
|
||||||
"Title": "PureAdmin",
|
"Title": "PureAdmin",
|
||||||
"FixedHeader": true,
|
"FixedHeader": true,
|
||||||
"HiddenSideBar": false,
|
"HiddenSideBar": false,
|
||||||
@ -15,5 +15,6 @@
|
|||||||
"SidebarStatus": true,
|
"SidebarStatus": true,
|
||||||
"EpThemeColor": "#409EFF",
|
"EpThemeColor": "#409EFF",
|
||||||
"ShowLogo": true,
|
"ShowLogo": true,
|
||||||
"ShowModel": "smart"
|
"ShowModel": "smart",
|
||||||
|
"MenuArrowIconNoTransition": true
|
||||||
}
|
}
|
||||||
|
Before Width: | Height: | Size: 23 KiB |
@ -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="globalization" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 512 512"><path d="M478.33 433.6l-90-218a22 22 0 0 0-40.67 0l-90 218a22 22 0 1 0 40.67 16.79L316.66 406h102.67l18.33 44.39A22 22 0 0 0 458 464a22 22 0 0 0 20.32-30.4zM334.83 362L368 281.65L401.17 362z" fill="currentColor"></path><path d="M267.84 342.92a22 22 0 0 0-4.89-30.7c-.2-.15-15-11.13-36.49-34.73c39.65-53.68 62.11-114.75 71.27-143.49H330a22 22 0 0 0 0-44H214V70a22 22 0 0 0-44 0v20H54a22 22 0 0 0 0 44h197.25c-9.52 26.95-27.05 69.5-53.79 108.36c-31.41-41.68-43.08-68.65-43.17-68.87a22 22 0 0 0-40.58 17c.58 1.38 14.55 34.23 52.86 83.93c.92 1.19 1.83 2.35 2.74 3.51c-39.24 44.35-77.74 71.86-93.85 80.74a22 22 0 1 0 21.07 38.63c2.16-1.18 48.6-26.89 101.63-85.59c22.52 24.08 38 35.44 38.93 36.1a22 22 0 0 0 30.75-4.9z" fill="currentColor"></path></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" aria-hidden="true" class="globalization" viewBox="0 0 512 512"><path fill="currentColor" d="m478.33 433.6-90-218a22 22 0 0 0-40.67 0l-90 218a22 22 0 1 0 40.67 16.79L316.66 406h102.67l18.33 44.39A22 22 0 0 0 458 464a22 22 0 0 0 20.32-30.4zM334.83 362 368 281.65 401.17 362zm-66.99-19.08a22 22 0 0 0-4.89-30.7c-.2-.15-15-11.13-36.49-34.73 39.65-53.68 62.11-114.75 71.27-143.49H330a22 22 0 0 0 0-44H214V70a22 22 0 0 0-44 0v20H54a22 22 0 0 0 0 44h197.25c-9.52 26.95-27.05 69.5-53.79 108.36-31.41-41.68-43.08-68.65-43.17-68.87a22 22 0 0 0-40.58 17c.58 1.38 14.55 34.23 52.86 83.93.92 1.19 1.83 2.35 2.74 3.51-39.24 44.35-77.74 71.86-93.85 80.74a22 22 0 1 0 21.07 38.63c2.16-1.18 48.6-26.89 101.63-85.59 22.52 24.08 38 35.44 38.93 36.1a22 22 0 0 0 30.75-4.9z"/></svg>
|
Before Width: | Height: | Size: 965 B After Width: | Height: | Size: 826 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 |
@ -10,6 +10,10 @@ import Close from "@iconify-icons/ep/close";
|
|||||||
import CloseBold from "@iconify-icons/ep/close-bold";
|
import CloseBold from "@iconify-icons/ep/close-bold";
|
||||||
import Bell from "@iconify-icons/ep/bell";
|
import Bell from "@iconify-icons/ep/bell";
|
||||||
import Search from "@iconify-icons/ep/search";
|
import Search from "@iconify-icons/ep/search";
|
||||||
|
import EpArrowDown from "@iconify-icons/ep/arrow-down";
|
||||||
|
import ArrowUp from "@iconify-icons/ep/arrow-up";
|
||||||
|
import ArrowRight from "@iconify-icons/ep/arrow-right";
|
||||||
|
import ArrowLeft from "@iconify-icons/ep/arrow-left";
|
||||||
addIcon("check", Check);
|
addIcon("check", Check);
|
||||||
addIcon("home-filled", HomeFilled);
|
addIcon("home-filled", HomeFilled);
|
||||||
addIcon("lollipop", Lollipop);
|
addIcon("lollipop", Lollipop);
|
||||||
@ -18,6 +22,10 @@ addIcon("close", Close);
|
|||||||
addIcon("close-bold", CloseBold);
|
addIcon("close-bold", CloseBold);
|
||||||
addIcon("bell", Bell);
|
addIcon("bell", Bell);
|
||||||
addIcon("search", Search);
|
addIcon("search", Search);
|
||||||
|
addIcon("ep-arrow-down", EpArrowDown);
|
||||||
|
addIcon("ep-arrow-up", ArrowUp);
|
||||||
|
addIcon("ep-arrow-right", ArrowRight);
|
||||||
|
addIcon("ep-arrow-left", ArrowLeft);
|
||||||
|
|
||||||
// remixicon
|
// remixicon
|
||||||
import ArrowRightSLine from "@iconify-icons/ri/arrow-right-s-line";
|
import ArrowRightSLine from "@iconify-icons/ri/arrow-right-s-line";
|
||||||
|
@ -31,7 +31,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 +43,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(() => {
|
||||||
|
@ -2,25 +2,16 @@
|
|||||||
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 { Tabs, TabPane } from "@pureadmin/components";
|
|
||||||
|
|
||||||
const dropdownDom = templateRef<ElRef | null>("dropdownDom", null);
|
|
||||||
const activeName = ref(noticesData[0].name);
|
|
||||||
const notices = ref(noticesData);
|
|
||||||
|
|
||||||
const noticesNum = ref(0);
|
const noticesNum = ref(0);
|
||||||
notices.value.forEach(notice => {
|
const notices = ref(noticesData);
|
||||||
noticesNum.value += notice.list.length;
|
const activeKey = ref(noticesData[0].key);
|
||||||
});
|
|
||||||
|
|
||||||
function tabClick() {
|
notices.value.map(v => (noticesNum.value += v.list.length));
|
||||||
(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">
|
||||||
@ -30,33 +21,25 @@ function tabClick() {
|
|||||||
</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 +55,28 @@ 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) {
|
// 如果上面的 notices 长度大于 3 请注释掉下面代码
|
||||||
padding: 15px 24px 0 24px;
|
:deep(.el-tabs__nav-wrap) {
|
||||||
|
padding: 0 36px 0 36px;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果上面的 notices 长度大于 3 请注释掉下面代码
|
||||||
|
:deep(.el-tabs__active-bar) {
|
||||||
|
margin: 0 36px 0 36px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.ant-tabs-nav) {
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
@ -21,7 +21,7 @@ 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="关闭配置">
|
||||||
<IconifyIconOffline
|
<IconifyIconOffline
|
||||||
class="dark:text-white"
|
class="dark:text-white"
|
||||||
|
@ -16,10 +16,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script setup lang="ts">
|
||||||
import enterOutlined from "@/assets/svg/enter_outlined.svg?component";
|
|
||||||
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,11 +1,11 @@
|
|||||||
<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 "lodash-unified";
|
||||||
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 { transformI18n } from "@/plugins/i18n";
|
import { transformI18n } from "@/plugins/i18n";
|
||||||
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";
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<script lang="ts" setup>
|
<script setup lang="ts">
|
||||||
import { computed } from "vue";
|
import { computed } from "vue";
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
import { useEpThemeStoreHook } from "@/store/modules/epTheme";
|
import { useEpThemeStoreHook } from "@/store/modules/epTheme";
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<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";
|
||||||
const { bool: show, toggle } = useBoolean();
|
const { bool: show, toggle } = useBoolean();
|
||||||
|
@ -13,7 +13,6 @@ import { useRouter } from "vue-router";
|
|||||||
import panel from "../panel/index.vue";
|
import panel from "../panel/index.vue";
|
||||||
import { emitter } from "@/utils/mitt";
|
import { emitter } from "@/utils/mitt";
|
||||||
import { resetRouter } from "@/router";
|
import { resetRouter } from "@/router";
|
||||||
import { templateRef } from "@vueuse/core";
|
|
||||||
import { removeToken } from "@/utils/auth";
|
import { removeToken } from "@/utils/auth";
|
||||||
import { routerArrays } from "@/layout/types";
|
import { routerArrays } from "@/layout/types";
|
||||||
import { useNav } from "@/layout/hooks/useNav";
|
import { useNav } from "@/layout/hooks/useNav";
|
||||||
@ -38,9 +37,9 @@ const { isDark } = useDark();
|
|||||||
const { isSelect } = useCssModule();
|
const { isSelect } = useCssModule();
|
||||||
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,
|
body,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { isEqual } from "lodash-unified";
|
import { isEqual } from "@pureadmin/utils";
|
||||||
import { transformI18n } from "@/plugins/i18n";
|
import { transformI18n } from "@/plugins/i18n";
|
||||||
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";
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<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 { transformI18n } from "@/plugins/i18n";
|
import { transformI18n } from "@/plugins/i18n";
|
||||||
@ -76,6 +77,10 @@ const getSpanStyle = computed(() => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const expandCloseIcon = computed(() => {
|
||||||
|
return getConfig()?.MenuArrowIconNoTransition ? "expand-close-icon" : "";
|
||||||
|
});
|
||||||
|
|
||||||
const onlyOneChild: childrenType = ref(null);
|
const onlyOneChild: childrenType = ref(null);
|
||||||
// 存放菜单是否存在showTooltip属性标识
|
// 存放菜单是否存在showTooltip属性标识
|
||||||
const hoverMenuMap = new WeakMap();
|
const hoverMenuMap = new WeakMap();
|
||||||
@ -212,7 +217,15 @@ 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"
|
||||||
|
:index="resolvePath(props.item.path)"
|
||||||
|
v-bind:[expandCloseIcon]="useRenderIcon('ep-arrow-down')"
|
||||||
|
:expand-open-icon="useRenderIcon('ep-arrow-up')"
|
||||||
|
:collapse-close-icon="useRenderIcon('ep-arrow-right')"
|
||||||
|
:collapse-open-icon="useRenderIcon('ep-arrow-left')"
|
||||||
|
>
|
||||||
<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
|
||||||
|
@ -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";
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<script lang="ts" setup>
|
<script setup lang="ts">
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
import { useRoute } from "vue-router";
|
import { useRoute } from "vue-router";
|
||||||
import { ref, unref, onMounted, nextTick } from "vue";
|
import { ref, unref, onMounted, nextTick } from "vue";
|
||||||
|
@ -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 { useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
import { emitter } from "@/utils/mitt";
|
import { emitter } from "@/utils/mitt";
|
||||||
@ -9,12 +10,14 @@ 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 { useEpThemeStoreHook } from "@/store/modules/epTheme";
|
import { useEpThemeStoreHook } from "@/store/modules/epTheme";
|
||||||
|
import { usePermissionStoreHook } from "@/store/modules/permission";
|
||||||
|
|
||||||
const errorInfo = "当前路由配置不正确,请检查配置";
|
const errorInfo = "当前路由配置不正确,请检查配置";
|
||||||
|
|
||||||
export function useNav() {
|
export function useNav() {
|
||||||
const pureApp = useAppStoreHook();
|
const pureApp = useAppStoreHook();
|
||||||
const routers = useRouter().options.routes;
|
const routers = useRouter().options.routes;
|
||||||
|
const { wholeMenus } = storeToRefs(usePermissionStoreHook());
|
||||||
|
|
||||||
/** 用户名 */
|
/** 用户名 */
|
||||||
const username = computed(() => {
|
const username = computed(() => {
|
||||||
@ -98,6 +101,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("/");
|
||||||
|
@ -9,11 +9,10 @@ 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 { transformI18n, $t } from "@/plugins/i18n";
|
import { transformI18n, $t } from "@/plugins/i18n";
|
||||||
|
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";
|
||||||
@ -106,16 +105,15 @@ 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 route.path === item.path ? previous : next;
|
|
||||||
} else if (Object.keys(route.query).length > 0) {
|
|
||||||
return isEqual(route.query, item.query) ? previous : next;
|
return isEqual(route.query, item.query) ? previous : next;
|
||||||
} else {
|
} else {
|
||||||
return isEqual(route.params, item.params) ? previous : next;
|
return isEqual(route.params, item.params) ? previous : next;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return route.path === item.path ? previous : next;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const iconIsActive = computed(() => {
|
const iconIsActive = computed(() => {
|
||||||
|
@ -19,9 +19,6 @@ import "./style/reset.scss";
|
|||||||
// 导入公共样式
|
// 导入公共样式
|
||||||
import "./style/index.scss";
|
import "./style/index.scss";
|
||||||
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";
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
// 多组件库的国际化和本地项目国际化兼容
|
// 多组件库的国际化和本地项目国际化兼容
|
||||||
import { App, WritableComputedRef } from "vue";
|
import { App, WritableComputedRef } from "vue";
|
||||||
import type { StorageConfigs } from "/#/index";
|
|
||||||
import { storageLocal } from "@pureadmin/utils";
|
import { storageLocal } from "@pureadmin/utils";
|
||||||
import { type I18n, createI18n } from "vue-i18n";
|
import { type I18n, createI18n } from "vue-i18n";
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
// 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 { findIndex } from "lodash-unified";
|
||||||
import { transformI18n } from "@/plugins/i18n";
|
import { transformI18n } from "@/plugins/i18n";
|
||||||
@ -22,19 +22,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(
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import { $t } from "@/plugins/i18n";
|
import { $t } from "@/plugins/i18n";
|
||||||
import type { RouteConfigsTable } from "/#/index";
|
|
||||||
|
|
||||||
const errorRouter: RouteConfigsTable = {
|
export default {
|
||||||
path: "/error",
|
path: "/error",
|
||||||
redirect: "/error/403",
|
redirect: "/error/403",
|
||||||
meta: {
|
meta: {
|
||||||
@ -35,6 +34,4 @@ const errorRouter: RouteConfigsTable = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
} as RouteConfigsTable;
|
||||||
|
|
||||||
export default errorRouter;
|
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
import { $t } from "@/plugins/i18n";
|
import { $t } from "@/plugins/i18n";
|
||||||
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,
|
||||||
@ -22,6 +21,4 @@ const homeRouter: RouteConfigsTable = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
} as RouteConfigsTable;
|
||||||
|
|
||||||
export default homeRouter;
|
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
import { $t } from "@/plugins/i18n";
|
import { $t } from "@/plugins/i18n";
|
||||||
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",
|
||||||
@ -20,7 +19,7 @@ const remainingRouter: Array<RouteConfigsTable> = [
|
|||||||
icon: "home-filled",
|
icon: "home-filled",
|
||||||
title: $t("menus.hshome"),
|
title: $t("menus.hshome"),
|
||||||
showLink: false,
|
showLink: false,
|
||||||
rank: 104
|
rank: 102
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
@ -30,6 +29,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;
|
|
||||||
};
|
|
||||||
}
|
|
@ -14,9 +14,9 @@ import { RouteConfigs } from "@/layout/types";
|
|||||||
import {
|
import {
|
||||||
isString,
|
isString,
|
||||||
storageSession,
|
storageSession,
|
||||||
buildHierarchyTree,
|
|
||||||
isIncludeAllChildren
|
isIncludeAllChildren
|
||||||
} from "@pureadmin/utils";
|
} from "@pureadmin/utils";
|
||||||
|
import { buildHierarchyTree } from "@/utils/tree";
|
||||||
import { cloneDeep, intersection } from "lodash-unified";
|
import { cloneDeep, intersection } from "lodash-unified";
|
||||||
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";
|
||||||
@ -76,7 +76,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)
|
||||||
);
|
);
|
||||||
|
@ -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({
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
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({
|
||||||
|
@ -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";
|
||||||
@ -11,11 +10,11 @@ export const useMultiTagsStore = defineStore({
|
|||||||
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>("responsive-configure")
|
||||||
.multiTagsCache
|
?.multiTagsCache
|
||||||
}),
|
}),
|
||||||
getters: {
|
getters: {
|
||||||
getMultiTagsCache() {
|
getMultiTagsCache() {
|
||||||
|
@ -16,11 +16,7 @@ export const useUserStore = defineStore({
|
|||||||
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) {
|
||||||
|
@ -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,
|
||||||
@ -127,7 +122,7 @@ html.dark {
|
|||||||
color: var(--el-text-color-primary);
|
color: var(--el-text-color-primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
.vxe-button.type--button.size--medium:hover {
|
.vxe-button.type--button:hover {
|
||||||
background: var(--el-color-primary) !important;
|
background: var(--el-color-primary) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,8 @@
|
|||||||
filter: invert(80%);
|
filter: invert(80%);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 重置 vxe-table 中 pager 样式 */
|
/* 重置 vxe-table 样式 */
|
||||||
|
.vxe-button.type--button.theme--primary:hover,
|
||||||
.vxe-pager .vxe-pager--num-btn:not(.is--disabled).is--active {
|
.vxe-pager .vxe-pager--num-btn:not(.is--disabled).is--active {
|
||||||
color: #fff !important;
|
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;
|
||||||
|
@ -43,11 +43,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 {
|
||||||
|
@ -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
|
||||||
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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 {};
|
33
src/utils/message.ts
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
import { type MessageHandler, ElMessage } from "element-plus";
|
||||||
|
|
||||||
|
// 更多配置请看:https://element-plus.org/zh-CN/component/message.html#message-%E9%85%8D%E7%BD%AE%E9%A1%B9
|
||||||
|
|
||||||
|
type messageTypes = "success" | "info" | "warning" | "error";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* `element-plus` 的 `info` 消息类型
|
||||||
|
*/
|
||||||
|
const message = (
|
||||||
|
message: string,
|
||||||
|
type = "info" as messageTypes,
|
||||||
|
showClose = true,
|
||||||
|
duration = 2000,
|
||||||
|
center = false,
|
||||||
|
grouping = false
|
||||||
|
): MessageHandler => {
|
||||||
|
return ElMessage({
|
||||||
|
message,
|
||||||
|
type,
|
||||||
|
showClose,
|
||||||
|
duration,
|
||||||
|
center,
|
||||||
|
grouping
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关闭 `element-plus` 的所有消息实例
|
||||||
|
*/
|
||||||
|
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";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 简版前端单点登录,根据实际业务自行编写,平台启动后本地可以跳后面这个链接进行测试 http://localhost:8848/#/permission/page/index?username=sso&roles=admin&accessToken=eyJhbGciOiJIUzUxMiJ9.admin
|
||||||
|
* 划重点:
|
||||||
|
* 判断是否为单点登录,不为则直接返回不再进行任何逻辑处理,下面是单点登录后的逻辑处理
|
||||||
|
* 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;
|
||||||
|
};
|
@ -2,10 +2,10 @@
|
|||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
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 { $t, transformI18n } from "@/plugins/i18n";
|
import { $t, transformI18n } from "@/plugins/i18n";
|
||||||
import { useLayout } from "@/layout/hooks/useLayout";
|
import { useLayout } from "@/layout/hooks/useLayout";
|
||||||
@ -52,8 +52,8 @@ const onLogin = async (formEl: FormInstance | undefined) => {
|
|||||||
if (res.success) {
|
if (res.success) {
|
||||||
// 获取后端路由
|
// 获取后端路由
|
||||||
initRouter().then(() => {
|
initRouter().then(() => {
|
||||||
message.success("登录成功");
|
|
||||||
router.push("/");
|
router.push("/");
|
||||||
|
message("登录成功", "success");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -42,5 +42,5 @@
|
|||||||
"mock/*.ts",
|
"mock/*.ts",
|
||||||
"vite.config.ts"
|
"vite.config.ts"
|
||||||
],
|
],
|
||||||
"exclude": ["node_modules", "dist", "**/*.js", "index.html"]
|
"exclude": ["node_modules", "dist", "**/*.js"]
|
||||||
}
|
}
|
||||||
|
269
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 { ResponsiveStorage } from "./index";
|
||||||
|
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,16 +54,28 @@ 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_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;
|
||||||
@ -110,6 +93,7 @@ declare global {
|
|||||||
EpThemeColor?: string;
|
EpThemeColor?: string;
|
||||||
ShowLogo?: boolean;
|
ShowLogo?: boolean;
|
||||||
ShowModel?: string;
|
ShowModel?: string;
|
||||||
|
MenuArrowIconNoTransition?: boolean;
|
||||||
MapConfigure?: {
|
MapConfigure?: {
|
||||||
amapKey?: string;
|
amapKey?: string;
|
||||||
options: {
|
options: {
|
||||||
@ -120,29 +104,176 @@ declare global {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
declare interface GlobalPropertiesApi {
|
/**
|
||||||
|
* 与 `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;
|
||||||
|
mapConfigure?: {
|
||||||
|
amapKey?: string;
|
||||||
|
options: {
|
||||||
|
resizeEnable?: boolean;
|
||||||
|
center?: number[];
|
||||||
|
zoom?: number;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
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;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 完整子路由配置表
|
||||||
|
*/
|
||||||
|
interface RouteChildrenConfigsTable {
|
||||||
|
/** 子路由地址 `必填` */
|
||||||
|
path: string;
|
||||||
|
/** 路由名字(对应不要重复,和当前组件的`name`保持一致)`必填` */
|
||||||
|
name?: string;
|
||||||
|
/** 路由重定向 `可选` */
|
||||||
|
redirect?: string;
|
||||||
|
/** 按需加载组件 `可选` */
|
||||||
|
component?: RouteComponent;
|
||||||
|
meta?: {
|
||||||
|
/** 菜单名称(兼容国际化、非国际化,如何用国际化的写法就必须在根目录的`locales`文件夹下对应添加) `必填` */
|
||||||
|
title: string;
|
||||||
|
/** 菜单图标 `可选` */
|
||||||
|
icon?: string | FunctionalComponent;
|
||||||
|
/** 菜单名称右侧的额外图标,支持`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 整体路由配置表(包括完整子路由)
|
||||||
|
*/
|
||||||
|
interface RouteConfigsTable {
|
||||||
|
/** 路由地址 `必填` */
|
||||||
|
path: string;
|
||||||
|
/** 路由名字(保持唯一)`可选` */
|
||||||
|
name?: string;
|
||||||
|
/** `Layout`组件 `可选` */
|
||||||
|
component?: RouteComponent;
|
||||||
|
/** 路由重定向 `可选` */
|
||||||
|
redirect?: string;
|
||||||
|
meta?: {
|
||||||
|
/** 菜单名称(兼容国际化、非国际化,如何用国际化的写法就必须在根目录的`locales`文件夹下对应添加)`必填` */
|
||||||
|
title: string;
|
||||||
|
/** 菜单图标 `可选` */
|
||||||
|
icon?: string | FunctionalComponent;
|
||||||
|
/** 是否在菜单中显示(默认`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;
|
declare module "vue" {
|
||||||
|
/**
|
||||||
function parseFloat(string: string | number): number;
|
* 自定义全局组件获得 Volar 提示(自定义的全局组件需要在这里声明下才能获得 Volar 类型提示哦)
|
||||||
|
*/
|
||||||
namespace JSX {
|
export interface GlobalComponents {
|
||||||
// tslint:disable no-empty-interface
|
IconifyIconOffline: typeof import("../src/components/ReIcon")["IconifyIconOffline"];
|
||||||
type Element = VNode;
|
IconifyIconOnline: typeof import("../src/components/ReIcon")["IconifyIconOnline"];
|
||||||
// tslint:disable no-empty-interface
|
FontIcon: typeof import("../src/components/ReIcon")["FontIcon"];
|
||||||
type ElementClass = ComponentRenderProxy;
|
Auth: typeof import("../src/components/ReAuth")["Auth"];
|
||||||
interface ElementAttributesProperty {
|
|
||||||
$props: any;
|
|
||||||
}
|
|
||||||
interface IntrinsicElements {
|
|
||||||
[elem: string]: any;
|
|
||||||
}
|
|
||||||
interface IntrinsicAttributes {
|
|
||||||
[elem: string]: any;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
87
types/index.d.ts
vendored
@ -1,33 +1,74 @@
|
|||||||
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>;
|
||||||
|
|
||||||
|
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;
|
||||||
|
134
types/index.ts
@ -1,134 +0,0 @@
|
|||||||
import { type FunctionalComponent } from "vue";
|
|
||||||
import { type RouteComponent } from "vue-router";
|
|
||||||
|
|
||||||
export 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;
|
|
||||||
mapConfigure?: {
|
|
||||||
amapKey?: string;
|
|
||||||
options: {
|
|
||||||
resizeEnable?: boolean;
|
|
||||||
center?: number[];
|
|
||||||
zoom?: number;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
username?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export 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>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface RouteChildrenConfigsTable {
|
|
||||||
/** 子路由地址 `必填` */
|
|
||||||
path: string;
|
|
||||||
/** 路由名字(对应不要重复,和当前组件的`name`保持一致)`必填` */
|
|
||||||
name?: string;
|
|
||||||
/** 路由重定向 `可选` */
|
|
||||||
redirect?: string;
|
|
||||||
/** 按需加载组件 `可选` */
|
|
||||||
component?: RouteComponent;
|
|
||||||
meta?: {
|
|
||||||
/** 菜单名称(兼容国际化、非国际化,如何用国际化的写法就必须在根目录的`locales`文件夹下对应添加) `必填` */
|
|
||||||
title: string;
|
|
||||||
/** 菜单图标 `可选` */
|
|
||||||
icon?: string | FunctionalComponent;
|
|
||||||
/** 菜单名称右侧的额外图标,支持`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 | FunctionalComponent;
|
|
||||||
/** 是否在菜单中显示(默认`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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
2
types/shims-vue.d.ts
vendored
@ -9,7 +9,5 @@ declare module "*.scss" {
|
|||||||
export default scss;
|
export default scss;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module "vuedraggable/src/vuedraggable";
|
|
||||||
declare module "@pureadmin/components";
|
|
||||||
declare module "@pureadmin/theme";
|
declare module "@pureadmin/theme";
|
||||||
declare module "@pureadmin/theme/dist/browser-utils";
|
declare module "@pureadmin/theme/dist/browser-utils";
|
||||||
|
@ -2,6 +2,7 @@ import dayjs from "dayjs";
|
|||||||
import { resolve } from "path";
|
import { resolve } from "path";
|
||||||
import pkg from "./package.json";
|
import pkg from "./package.json";
|
||||||
import { warpperEnv } from "./build";
|
import { warpperEnv } from "./build";
|
||||||
|
import { include } from "./build/optimize";
|
||||||
import { getPluginsList } from "./build/plugins";
|
import { getPluginsList } from "./build/plugins";
|
||||||
import { UserConfigExport, ConfigEnv, loadEnv } from "vite";
|
import { UserConfigExport, ConfigEnv, loadEnv } from "vite";
|
||||||
|
|
||||||
@ -26,13 +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
|
|
||||||
} = warpperEnv(loadEnv(mode, root));
|
|
||||||
return {
|
return {
|
||||||
base: VITE_PUBLIC_PATH,
|
base: VITE_PUBLIC_PATH,
|
||||||
root,
|
root,
|
||||||
@ -49,9 +45,10 @@ export default ({ command, mode }: ConfigEnv): UserConfigExport => {
|
|||||||
// 本地跨域代理 https://cn.vitejs.dev/config/server-options.html#server-proxy
|
// 本地跨域代理 https://cn.vitejs.dev/config/server-options.html#server-proxy
|
||||||
proxy: {}
|
proxy: {}
|
||||||
},
|
},
|
||||||
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", "vue-i18n", "lodash-es", "@vueuse/core", "dayjs"],
|
include,
|
||||||
exclude: ["@pureadmin/theme/dist/browser-utils"]
|
exclude: ["@pureadmin/theme/dist/browser-utils"]
|
||||||
},
|
},
|
||||||
build: {
|
build: {
|
||||||
|