Compare commits

...

7 Commits

Author SHA1 Message Date
xiaoxian521
27056e7560 release: update 3.9.4 2022-12-05 14:28:46 +08:00
xiaoxian521
132fbbade3 release: update 3.9.3 2022-12-04 18:00:16 +08:00
xiaoxian521
c6e25d6933 release: update 3.9.2 2022-12-03 15:20:30 +08:00
xiaoxian521
cabf1f85ef release: update 3.9.1 2022-12-02 20:20:50 +08:00
xiaoxian521
cb3d7cd552 perf: 优化 initRouter ,兼容 sso 场景 2022-12-01 16:05:06 +08:00
xiaoxian521
80453ec4b1 feat: 添加 CachingAsyncRoutes 是否开启动态路由缓存本地,默认 true 2022-12-01 11:42:10 +08:00
xiaoxian521
8ca8bbcee0 chore: update 2022-11-30 18:20:56 +08:00
35 changed files with 325 additions and 432 deletions

View File

@@ -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(

View File

@@ -12,8 +12,6 @@ const include = [
"pinia", "pinia",
"lodash", "lodash",
"echarts", "echarts",
"xe-utils",
"vxe-table",
"js-cookie", "js-cookie",
"lodash-es", "lodash-es",
"@vueuse/core", "@vueuse/core",

View File

@@ -1,8 +1,6 @@
// 模拟后端动态生成路由 // 模拟后端动态生成路由
import { MockMethod } from "vite-plugin-mock"; import { MockMethod } from "vite-plugin-mock";
import Lollipop from "@iconify-icons/ep/lollipop";
/** /**
* roles页面级别权限这里模拟二种 "admin"、"common" * roles页面级别权限这里模拟二种 "admin"、"common"
* admin管理员角色 * admin管理员角色
@@ -13,7 +11,7 @@ const permissionRouter = {
path: "/permission", path: "/permission",
meta: { meta: {
title: "权限管理", title: "权限管理",
icon: Lollipop, icon: "lollipop",
rank: 10 rank: 10
}, },
children: [ children: [

View File

@@ -1,6 +1,6 @@
{ {
"name": "pure-admin-thin", "name": "pure-admin-thin",
"version": "3.9.0", "version": "3.9.4",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "NODE_OPTIONS=--max-old-space-size=4096 vite", "dev": "NODE_OPTIONS=--max-old-space-size=4096 vite",
@@ -31,15 +31,15 @@
"dependencies": { "dependencies": {
"@ctrl/tinycolor": "^3.4.1", "@ctrl/tinycolor": "^3.4.1",
"@pureadmin/descriptions": "^1.1.0", "@pureadmin/descriptions": "^1.1.0",
"@pureadmin/table": "^1.8.0", "@pureadmin/table": "^1.8.3",
"@pureadmin/utils": "^1.6.7", "@pureadmin/utils": "^1.7.4",
"@vueuse/core": "^9.6.0", "@vueuse/core": "^9.6.0",
"@vueuse/motion": "2.0.0-beta.12", "@vueuse/motion": "2.0.0-beta.12",
"animate.css": "^4.1.1", "animate.css": "^4.1.1",
"axios": "^1.2.0", "axios": "^1.2.0",
"dayjs": "^1.11.6", "dayjs": "^1.11.6",
"echarts": "^5.4.0", "echarts": "^5.4.0",
"element-plus": "^2.2.25", "element-plus": "^2.2.26",
"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",
@@ -49,14 +49,12 @@
"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.26", "pinia": "^2.0.27",
"qs": "^6.11.0", "qs": "^6.11.0",
"responsive-storage": "^2.1.0", "responsive-storage": "^2.1.0",
"vue": "^3.2.45", "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.6",
"xe-utils": "^3.5.7"
}, },
"devDependencies": { "devDependencies": {
"@commitlint/cli": "13.1.0", "@commitlint/cli": "13.1.0",
@@ -86,7 +84,6 @@
"eslint": "^8.8.0", "eslint": "^8.8.0",
"eslint-plugin-prettier": "^4.0.0", "eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-vue": "^9.7.0", "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",

74
pnpm-lock.yaml generated
View File

@@ -8,9 +8,9 @@ specifiers:
"@iconify-icons/ri": ^1.2.3 "@iconify-icons/ri": ^1.2.3
"@iconify/vue": ^4.0.0 "@iconify/vue": ^4.0.0
"@pureadmin/descriptions": ^1.1.0 "@pureadmin/descriptions": ^1.1.0
"@pureadmin/table": ^1.8.0 "@pureadmin/table": ^1.8.3
"@pureadmin/theme": ^2.4.0 "@pureadmin/theme": ^2.4.0
"@pureadmin/utils": ^1.6.7 "@pureadmin/utils": ^1.7.4
"@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/lodash": ^4.14.180
@@ -35,12 +35,11 @@ specifiers:
cssnano: ^5.1.14 cssnano: ^5.1.14
dayjs: ^1.11.6 dayjs: ^1.11.6
echarts: ^5.4.0 echarts: ^5.4.0
element-plus: ^2.2.25 element-plus: ^2.2.26
element-resize-detector: ^1.2.4 element-resize-detector: ^1.2.4
eslint: ^8.8.0 eslint: ^8.8.0
eslint-plugin-prettier: ^4.0.0 eslint-plugin-prettier: ^4.0.0
eslint-plugin-vue: ^9.7.0 eslint-plugin-vue: ^9.7.0
font-awesome: ^4.7.0
husky: ^7.0.4 husky: ^7.0.4
js-cookie: ^3.0.1 js-cookie: ^3.0.1
lint-staged: 11.1.2 lint-staged: 11.1.2
@@ -52,7 +51,7 @@ specifiers:
nprogress: ^0.2.0 nprogress: ^0.2.0
path: ^0.12.7 path: ^0.12.7
picocolors: ^1.0.0 picocolors: ^1.0.0
pinia: ^2.0.26 pinia: ^2.0.27
postcss: ^8.4.18 postcss: ^8.4.18
postcss-html: ^1.5.0 postcss-html: ^1.5.0
postcss-import: ^15.0.0 postcss-import: ^15.0.0
@@ -87,21 +86,19 @@ specifiers:
vue-router: ^4.1.6 vue-router: ^4.1.6
vue-tsc: ^1.0.9 vue-tsc: ^1.0.9
vue-types: ^4.2.1 vue-types: ^4.2.1
vxe-table: ^4.3.6
xe-utils: ^3.5.7
dependencies: dependencies:
"@ctrl/tinycolor": 3.4.1 "@ctrl/tinycolor": 3.4.1
"@pureadmin/descriptions": 1.1.1_element-plus@2.2.25 "@pureadmin/descriptions": 1.1.1_element-plus@2.2.26
"@pureadmin/table": 1.8.0_element-plus@2.2.25 "@pureadmin/table": 1.8.3_element-plus@2.2.26
"@pureadmin/utils": 1.6.7_aotapuqn7htzdjltsyimavekky "@pureadmin/utils": 1.7.4_aotapuqn7htzdjltsyimavekky
"@vueuse/core": 9.6.0_vue@3.2.45 "@vueuse/core": 9.6.0_vue@3.2.45
"@vueuse/motion": 2.0.0-beta.12_vue@3.2.45 "@vueuse/motion": 2.0.0-beta.12_vue@3.2.45
animate.css: 4.1.1 animate.css: 4.1.1
axios: 1.2.0 axios: 1.2.0
dayjs: 1.11.6 dayjs: 1.11.6
echarts: 5.4.0 echarts: 5.4.0
element-plus: 2.2.25_vue@3.2.45 element-plus: 2.2.26_vue@3.2.45
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
@@ -111,14 +108,12 @@ dependencies:
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.26_mgnvym7yiazkylwwogi5r767ue pinia: 2.0.27_mgnvym7yiazkylwwogi5r767ue
qs: 6.11.0 qs: 6.11.0
responsive-storage: 2.1.0 responsive-storage: 2.1.0
vue: 3.2.45 vue: 3.2.45
vue-router: 4.1.6_vue@3.2.45 vue-router: 4.1.6_vue@3.2.45
vue-types: 4.2.1_vue@3.2.45 vue-types: 4.2.1_vue@3.2.45
vxe-table: 4.3.6_vue@3.2.45+xe-utils@3.5.7
xe-utils: 3.5.7
devDependencies: devDependencies:
"@commitlint/cli": 13.1.0 "@commitlint/cli": 13.1.0
@@ -148,7 +143,6 @@ devDependencies:
eslint: 8.28.0 eslint: 8.28.0
eslint-plugin-prettier: 4.2.1_5qrnzwqb344w6up62gv3safeoi eslint-plugin-prettier: 4.2.1_5qrnzwqb344w6up62gv3safeoi
eslint-plugin-vue: 9.8.0_eslint@8.28.0 eslint-plugin-vue: 9.8.0_eslint@8.28.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
@@ -1034,7 +1028,7 @@ packages:
fastq: 1.13.0 fastq: 1.13.0
dev: true dev: true
/@pureadmin/descriptions/1.1.1_element-plus@2.2.25: /@pureadmin/descriptions/1.1.1_element-plus@2.2.26:
resolution: resolution:
{ {
integrity: sha512-4BHLKomLU/LxGs5EUA+h+aKNrJEkhrU6+QE8VoWfJZ8VTU6ddvFLT/Pi4WuO5CWNXM9ZjqvHLFFVwEPlKntqtg== integrity: sha512-4BHLKomLU/LxGs5EUA+h+aKNrJEkhrU6+QE8VoWfJZ8VTU6ddvFLT/Pi4WuO5CWNXM9ZjqvHLFFVwEPlKntqtg==
@@ -1043,19 +1037,19 @@ packages:
element-plus: ^2.0.0 element-plus: ^2.0.0
dependencies: dependencies:
"@element-plus/icons-vue": 2.0.10_vue@3.2.45 "@element-plus/icons-vue": 2.0.10_vue@3.2.45
element-plus: 2.2.25_vue@3.2.45 element-plus: 2.2.26_vue@3.2.45
vue: 3.2.45 vue: 3.2.45
dev: false dev: false
/@pureadmin/table/1.8.0_element-plus@2.2.25: /@pureadmin/table/1.8.3_element-plus@2.2.26:
resolution: resolution:
{ {
integrity: sha512-hNXoU6HzAxUg/4KpG2rQbmr8EDdh+1XzP0Og0jqtgfj1uW5o5KWfx1101O/ReYVQ1EdnFsc44YLe0HZkyyMJDQ== integrity: sha512-M+I+CDu74s/ffNybbDg0rHhiMHTdkgVIaksfmmrEwjuLB2nEaz7R0tob2qC5rKE96U2Z246meDHBidyQNx2z9w==
} }
peerDependencies: peerDependencies:
element-plus: ^2.0.0 element-plus: ^2.0.0
dependencies: dependencies:
element-plus: 2.2.25_vue@3.2.45 element-plus: 2.2.26_vue@3.2.45
vue: 3.2.45 vue: 3.2.45
dev: false dev: false
@@ -1070,10 +1064,10 @@ packages:
string-hash: 1.1.3 string-hash: 1.1.3
dev: true dev: true
/@pureadmin/utils/1.6.7_aotapuqn7htzdjltsyimavekky: /@pureadmin/utils/1.7.4_aotapuqn7htzdjltsyimavekky:
resolution: resolution:
{ {
integrity: sha512-SNOGyhrzqMzySpicFd/ptJS7xOt9p2xGuNXFZwhq1elruPKRLRa7dl+OHGrIWzQIvhtbOf/yje9mnOFOY77PZA== integrity: sha512-uJNHcb2sO7R2avALf+v4TGyuZtJix0Wpw/kMb6eO4C003ZQImuGGi9WlxHaOlESrMyFHZ1AjWm5AqLwJLnpVlw==
} }
peerDependencies: peerDependencies:
dayjs: "*" dayjs: "*"
@@ -3098,10 +3092,10 @@ packages:
} }
dev: true dev: true
/element-plus/2.2.25_vue@3.2.45: /element-plus/2.2.26_vue@3.2.45:
resolution: resolution:
{ {
integrity: sha512-HC8CWY31e6pPyBpgqI0QnWkBgs0vRzdYnEw3mpdM/NlKfp0PtNFX7NESQLomqoIulH5ftL09hjQmJNvZBQpthQ== integrity: sha512-O/rdY5m9DkclpVg8r3GynyqCunm7MxSR142xSsjrZA77bi7bcwA3SIy6SPEDqHi5R4KqgkGYgKSp4Q4e3irbYg==
} }
peerDependencies: peerDependencies:
vue: ^3.2.0 vue: ^3.2.0
@@ -3934,14 +3928,6 @@ packages:
optional: true optional: true
dev: false dev: false
/font-awesome/4.7.0:
resolution:
{
integrity: sha512-U6kGnykA/6bFmg1M/oT9EkFeIYv7JlX3bozwQJWiiLz6L0w3F5vBVPxHlwyX/vtNq1ckcpRKOB9f2Qal/VtFpg==
}
engines: { node: ">=0.10.3" }
dev: true
/form-data/4.0.0: /form-data/4.0.0:
resolution: resolution:
{ {
@@ -5525,10 +5511,10 @@ packages:
engines: { node: ">=0.10.0" } engines: { node: ">=0.10.0" }
dev: true dev: true
/pinia/2.0.26_mgnvym7yiazkylwwogi5r767ue: /pinia/2.0.27_mgnvym7yiazkylwwogi5r767ue:
resolution: resolution:
{ {
integrity: sha512-tSxZNUcMGxQOvKZRjPKXxd2+/2NZhRF/CoYVE/+K6uE/Z3v1Oi4fcQFpxu5nMB1dCchjXUZ+lz0tBxV5ntwmQQ== integrity: sha512-nOnXP0OFeL8R4WjAHsterU+11vptda643gH02xKNtSCDPiRzVfRYodOLihLDoa0gL1KKuQKV+KOzEgdt3YvqEw==
} }
peerDependencies: peerDependencies:
"@vue/composition-api": ^1.4.0 "@vue/composition-api": ^1.4.0
@@ -7596,19 +7582,6 @@ packages:
"@vue/server-renderer": 3.2.45_vue@3.2.45 "@vue/server-renderer": 3.2.45_vue@3.2.45
"@vue/shared": 3.2.45 "@vue/shared": 3.2.45
/vxe-table/4.3.6_vue@3.2.45+xe-utils@3.5.7:
resolution:
{
integrity: sha512-SZ+ocVoOFc1PSzvpz6q5n7YvWvPSXUV+raet0zaSbQy3g8Dj7jKNlFbcsSoWZm8Uys9ufAQxeqYO5rRwOB2m7A==
}
peerDependencies:
vue: ^3.2.28
xe-utils: ^3.5.0
dependencies:
vue: 3.2.45
xe-utils: 3.5.7
dev: false
/webpack-sources/3.2.3: /webpack-sources/3.2.3:
resolution: resolution:
{ {
@@ -7695,13 +7668,6 @@ packages:
signal-exit: 3.0.7 signal-exit: 3.0.7
dev: true dev: true
/xe-utils/3.5.7:
resolution:
{
integrity: sha512-3H+fDBKBR2wLJgyA7k9C/w1Xljx6Maml5ukV0WDY06HjYyGs2FEz6XhcwRCLIDXX4pBP3Gu0nX9DbCeuuRA2Ew==
}
dev: false
/xml-name-validator/4.0.0: /xml-name-validator/4.0.0:
resolution: resolution:
{ {

View File

@@ -1,5 +1,5 @@
{ {
"Version": "3.9.0", "Version": "3.9.4",
"Title": "PureAdmin", "Title": "PureAdmin",
"FixedHeader": true, "FixedHeader": true,
"HiddenSideBar": false, "HiddenSideBar": false,
@@ -15,5 +15,7 @@
"EpThemeColor": "#409EFF", "EpThemeColor": "#409EFF",
"ShowLogo": true, "ShowLogo": true,
"ShowModel": "smart", "ShowModel": "smart",
"MenuArrowIconNoTransition": true "MenuArrowIconNoTransition": true,
"CachingAsyncRoutes": true,
"TooltipEffect": "light"
} }

View 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);

View File

@@ -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(() => {
@@ -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"

View File

@@ -1,11 +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"; import Close from "@iconify-icons/ep/close";
const 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;
@@ -23,9 +39,11 @@ emitter.on("openPanel", () => {
<div class="right-panel-items"> <div class="right-panel-items">
<div class="project-configuration"> <div class="project-configuration">
<h4 class="dark:text-white">项目配置</h4> <h4 class="dark:text-white">项目配置</h4>
<span title="关闭配置"> <span title="关闭配置" :class="iconClass">
<IconifyIconOffline <IconifyIconOffline
class="dark:text-white" class="dark:text-white"
width="20px"
height="20px"
:icon="Close" :icon="Close"
@click="show = !show" @click="show = !show"
/> />
@@ -69,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;
} }
@@ -125,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) {

View File

@@ -6,8 +6,15 @@ import {
reactive, reactive,
computed, computed,
nextTick, nextTick,
useCssModule onBeforeMount
} from "vue"; } from "vue";
import {
useDark,
debounce,
useGlobal,
storageLocal,
storageSession
} from "@pureadmin/utils";
import { getConfig } from "@/config"; import { getConfig } from "@/config";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import panel from "../panel/index.vue"; import panel from "../panel/index.vue";
@@ -17,16 +24,9 @@ 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";
import { useAppStoreHook } from "@/store/modules/app"; import { useAppStoreHook } from "@/store/modules/app";
import { toggleTheme } from "@pureadmin/theme/dist/browser-utils";
import { useMultiTagsStoreHook } from "@/store/modules/multiTags"; import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
import { useDataThemeChange } from "@/layout/hooks/useDataThemeChange"; import { useDataThemeChange } from "@/layout/hooks/useDataThemeChange";
import {
useDark,
debounce,
useGlobal,
storageLocal,
storageSession
} from "@pureadmin/utils";
import { toggleTheme } from "@pureadmin/theme/dist/browser-utils";
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";
@@ -34,9 +34,8 @@ import Check from "@iconify-icons/ep/check";
import Logout from "@iconify-icons/ri/logout-circle-r-line"; 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 = ref(); const mixRef = ref();
@@ -161,30 +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 }) => {
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 => {
@@ -218,14 +197,36 @@ function setLayoutModel(layout: string) {
useAppStoreHook().setLayout(layout); useAppStoreHook().setLayout(layout);
} }
/* 初始化项目配置 */ watch($storage, ({ layout }) => {
nextTick(() => { switch (layout["layout"]) {
case "vertical":
toggleClass(true, "is-select", unref(verticalRef));
debounce(setFalse([horizontalRef]), 50);
debounce(setFalse([mixRef]), 50);
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();
/* 初始化项目配置 */
nextTick(() => {
settings.greyVal && settings.greyVal &&
document.querySelector("html")?.setAttribute("class", "html-grey"); document.querySelector("html")?.setAttribute("class", "html-grey");
settings.weakVal && settings.weakVal &&
document.querySelector("html")?.setAttribute("class", "html-weakness"); document.querySelector("html")?.setAttribute("class", "html-weakness");
settings.tabsVal && tagsChange(); settings.tabsVal && tagsChange();
dataThemeChange(); });
}); });
</script> </script>
@@ -243,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')"
> >
@@ -256,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')"
> >
@@ -272,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')"
> >
@@ -392,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%;
@@ -410,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;

View File

@@ -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>

View File

@@ -35,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>
@@ -93,6 +96,9 @@ watch(
</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;

View File

@@ -1,7 +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"; 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;
@@ -10,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;
@@ -25,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 ? MenuFold : MenuUnfold" :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>

View File

@@ -51,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"
@@ -124,6 +128,9 @@ watch(
</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;

View File

@@ -11,7 +11,7 @@ import EpArrowDown from "@iconify-icons/ep/arrow-down";
import ArrowLeft from "@iconify-icons/ep/arrow-left"; import ArrowLeft from "@iconify-icons/ep/arrow-left";
import ArrowRight from "@iconify-icons/ep/arrow-right"; import ArrowRight from "@iconify-icons/ep/arrow-right";
const { layout, isCollapse } = useNav(); const { layout, isCollapse, tooltipEffect } = useNav();
const props = defineProps({ const props = defineProps({
item: { item: {
@@ -200,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"
> >
@@ -245,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 }}

View File

@@ -59,7 +59,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"
@@ -91,3 +94,9 @@ watch(
/> />
</div> </div>
</template> </template>
<style scoped>
:deep(.el-loading-mask) {
opacity: 0.45;
}
</style>

View File

@@ -17,6 +17,8 @@ export function useNav() {
const pureApp = useAppStoreHook(); const pureApp = useAppStoreHook();
const routers = useRouter().options.routes; const routers = useRouter().options.routes;
const { wholeMenus } = storeToRefs(usePermissionStoreHook()); const { wholeMenus } = storeToRefs(usePermissionStoreHook());
/** 平台`layout`中所有`el-tooltip`的`effect`配置,默认`light` */
const tooltipEffect = getConfig()?.TooltipEffect ?? "light";
/** 用户名 */ /** 用户名 */
const username = computed(() => { const username = computed(() => {
@@ -136,6 +138,7 @@ export function useNav() {
isCollapse, isCollapse,
pureApp, pureApp,
username, username,
avatarsStyle avatarsStyle,
tooltipEffect
}; };
} }

View File

@@ -1,5 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import "animate.css"; 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";

View File

@@ -2,19 +2,14 @@
* @description ⚠️:此文件仅供主题插件使用,请不要在此文件中导出别的工具函数(仅在页面加载前运行) * @description ⚠️:此文件仅供主题插件使用,请不要在此文件中导出别的工具函数(仅在页面加载前运行)
*/ */
import { EpThemeColor } from "../../../public/serverConfig.json";
type MultipleScopeVarsItem = { type MultipleScopeVarsItem = {
scopeName: string; scopeName: string;
varsContent: 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",
@@ -26,7 +21,6 @@ const themeColors = {
menuActiveBefore: "#4091f7" menuActiveBefore: "#4091f7"
}, },
light: { light: {
vxeColor,
subMenuActiveText: "#409eff", subMenuActiveText: "#409eff",
menuBg: "#fff", menuBg: "#fff",
menuHover: "#e0ebf6", menuHover: "#e0ebf6",
@@ -38,7 +32,6 @@ const themeColors = {
menuActiveBefore: "#4091f7" menuActiveBefore: "#4091f7"
}, },
dusk: { dusk: {
vxeColor: "#f5222d",
subMenuActiveText: "#fff", subMenuActiveText: "#fff",
menuBg: "#2a0608", menuBg: "#2a0608",
menuHover: "#e13c39", menuHover: "#e13c39",
@@ -50,7 +43,6 @@ const themeColors = {
menuActiveBefore: "#e13c39" menuActiveBefore: "#e13c39"
}, },
volcano: { volcano: {
vxeColor: "#fa541c",
subMenuActiveText: "#fff", subMenuActiveText: "#fff",
menuBg: "#2b0e05", menuBg: "#2b0e05",
menuHover: "#e85f33", menuHover: "#e85f33",
@@ -62,7 +54,6 @@ const themeColors = {
menuActiveBefore: "#e85f33" menuActiveBefore: "#e85f33"
}, },
yellow: { yellow: {
vxeColor: "#fadb14",
subMenuActiveText: "#d25f00", subMenuActiveText: "#d25f00",
menuBg: "#2b2503", menuBg: "#2b2503",
menuHover: "#f6da4d", menuHover: "#f6da4d",
@@ -74,7 +65,6 @@ const themeColors = {
menuActiveBefore: "#f6da4d" menuActiveBefore: "#f6da4d"
}, },
mingQing: { mingQing: {
vxeColor: "#13c2c2",
subMenuActiveText: "#fff", subMenuActiveText: "#fff",
menuBg: "#032121", menuBg: "#032121",
menuHover: "#59bfc1", menuHover: "#59bfc1",
@@ -86,7 +76,6 @@ const themeColors = {
menuActiveBefore: "#59bfc1" menuActiveBefore: "#59bfc1"
}, },
auroraGreen: { auroraGreen: {
vxeColor: "#52c41a",
subMenuActiveText: "#fff", subMenuActiveText: "#fff",
menuBg: "#0b1e15", menuBg: "#0b1e15",
menuHover: "#60ac80", menuHover: "#60ac80",
@@ -98,7 +87,6 @@ const themeColors = {
menuActiveBefore: "#60ac80" menuActiveBefore: "#60ac80"
}, },
pink: { pink: {
vxeColor: "#eb2f96",
subMenuActiveText: "#fff", subMenuActiveText: "#fff",
menuBg: "#28081a", menuBg: "#28081a",
menuHover: "#d84493", menuHover: "#d84493",
@@ -110,7 +98,6 @@ const themeColors = {
menuActiveBefore: "#d84493" menuActiveBefore: "#d84493"
}, },
saucePurple: { saucePurple: {
vxeColor: "#722ed1",
subMenuActiveText: "#fff", subMenuActiveText: "#fff",
menuBg: "#130824", menuBg: "#130824",
menuHover: "#693ac9", menuHover: "#693ac9",
@@ -132,7 +119,6 @@ export const genScssMultipleScopeVars = (): MultipleScopeVarsItem[] => {
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;

View File

@@ -1,5 +1,4 @@
import type { IconifyIcon } from "@iconify/vue"; import type { IconifyIcon } from "@iconify/vue";
import HomeFilled from "@iconify-icons/ep/home-filled";
export const routerArrays: Array<RouteConfigs> = [ export const routerArrays: Array<RouteConfigs> = [
{ {
@@ -7,7 +6,7 @@ export const routerArrays: Array<RouteConfigs> = [
parentPath: "/", parentPath: "/",
meta: { meta: {
title: "首页", title: "首页",
icon: HomeFilled icon: "homeFilled"
} }
} }
]; ];

View File

@@ -6,7 +6,6 @@ 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";
@@ -52,6 +51,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");
}); });

View File

@@ -1,6 +0,0 @@
@import "vxe-table/styles/variable.scss";
@import "vxe-table/styles/modules.scss";
i {
border-color: initial;
}

View File

@@ -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);
}

View File

@@ -1,10 +1,8 @@
import InformationLine from "@iconify-icons/ri/information-line";
export default { export default {
path: "/error", path: "/error",
redirect: "/error/403", redirect: "/error/403",
meta: { meta: {
icon: InformationLine, icon: "informationLine",
title: "异常页面", title: "异常页面",
rank: 9 rank: 9
}, },

View File

@@ -1,5 +1,4 @@
const Layout = () => import("@/layout/index.vue"); const Layout = () => import("@/layout/index.vue");
import HomeFilled from "@iconify-icons/ep/home-filled";
export default { export default {
path: "/", path: "/",
@@ -7,7 +6,7 @@ export default {
component: Layout, component: Layout,
redirect: "/welcome", redirect: "/welcome",
meta: { meta: {
icon: HomeFilled, icon: "homeFilled",
title: "首页", title: "首页",
rank: 0 rank: 0
}, },

View File

@@ -1,5 +1,4 @@
const Layout = () => import("@/layout/index.vue"); const Layout = () => import("@/layout/index.vue");
import HomeFilled from "@iconify-icons/ep/home-filled";
export default [ export default [
{ {
@@ -16,7 +15,7 @@ export default [
path: "/redirect", path: "/redirect",
component: Layout, component: Layout,
meta: { meta: {
icon: HomeFilled, icon: "homeFilled",
title: "首页", title: "首页",
showLink: false, showLink: false,
rank: 104 rank: 104

View File

@@ -16,6 +16,7 @@ import {
storageSession, storageSession,
isIncludeAllChildren isIncludeAllChildren
} from "@pureadmin/utils"; } from "@pureadmin/utils";
import { getConfig } from "@/config";
import { buildHierarchyTree } from "@/utils/tree"; 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";
@@ -151,15 +152,12 @@ 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) {
usePermissionStoreHook().handleWholeMenus(data);
resolve(router);
} else { } else {
formatFlatteningRoutes(addAsyncRoutes(data)).map( formatFlatteningRoutes(addAsyncRoutes(routeList)).map(
(v: RouteRecordRaw) => { (v: RouteRecordRaw) => {
// 防止重复添加路由 // 防止重复添加路由
if ( if (
@@ -179,14 +177,41 @@ function initRouter() {
.find(n => n.path === "/"); .find(n => n.path === "/");
router.addRoute(flattenRouters); router.addRoute(flattenRouters);
} }
resolve(router);
} }
); );
usePermissionStoreHook().handleWholeMenus(data); usePermissionStoreHook().handleWholeMenus(routeList);
} }
addPathMatch(); 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);
});
});
}
} }
/** /**

View File

@@ -39,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:hover {
background: var(--el-color-primary) !important;
}
.vxe-button {
background-color: transparent;
}
/* 项目配置面板 */ /* 项目配置面板 */
.right-panel-items { .right-panel-items {
.el-divider__text { .el-divider__text {
@@ -156,6 +65,19 @@ html.dark {
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 文件进行了适配 */ /* 克隆并自定义 ElMessage 样式,不会影响 ElMessage 原本样式,在 src/utils/message.ts 中调用自定义样式 ElMessage 方法即可,非暗黑模式在 src/style/element-plus.scss 文件进行了适配 */
.pure-message { .pure-message {
background-image: initial !important; background-image: initial !important;

View File

@@ -46,6 +46,12 @@
padding: 0 !important; padding: 0 !important;
} }
/* 自定义 tooltip 的类名 */
.pure-tooltip {
// 右侧操作面板right-panel类名的z-index为40000tooltip需要大于它才能显示
z-index: 41000 !important;
}
/* nprogress 适配 element-plus 的主题色 */ /* nprogress 适配 element-plus 的主题色 */
#nprogress { #nprogress {
& .bar { & .bar {
@@ -63,6 +69,33 @@
} }
} }
/* 全局覆盖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 文件进行了适配 */ /* 克隆并自定义 ElMessage 样式,不会影响 ElMessage 原本样式,在 src/utils/message.ts 中调用自定义样式 ElMessage 方法即可,暗黑模式在 src/style/dark.scss 文件进行了适配 */
.pure-message { .pure-message {
border-width: 0 !important; border-width: 0 !important;

View File

@@ -19,9 +19,3 @@
.html-weakness { .html-weakness {
filter: invert(80%); filter: invert(80%);
} }
/* 重置 vxe-table 样式 */
.vxe-button.type--button.theme--primary:hover,
.vxe-pager .vxe-pager--num-btn:not(.is--disabled).is--active {
color: #fff !important;
}

View File

@@ -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,

View File

@@ -70,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();
} }
/** 格式化tokenjwt格式 */ /** 格式化tokenjwt格式 */

View File

@@ -33,6 +33,7 @@ function onChange() {
.loginByUsername({ username: username.value, password: "admin123" }) .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();
} }

19
types/global.d.ts vendored
View File

@@ -6,7 +6,6 @@ import type {
} from "vue"; } from "vue";
import type { ECharts } from "echarts"; import type { ECharts } from "echarts";
import type { IconifyIcon } from "@iconify/vue"; import type { IconifyIcon } from "@iconify/vue";
import type { ResponsiveStorage } from "./index";
import type { TableColumns } from "@pureadmin/table"; import type { TableColumns } from "@pureadmin/table";
import { type RouteComponent, type RouteLocationNormalized } from "vue-router"; import { type RouteComponent, type RouteLocationNormalized } from "vue-router";
@@ -95,14 +94,8 @@ declare global {
ShowLogo?: boolean; ShowLogo?: boolean;
ShowModel?: string; ShowModel?: string;
MenuArrowIconNoTransition?: boolean; MenuArrowIconNoTransition?: boolean;
MapConfigure?: { CachingAsyncRoutes?: boolean;
amapKey?: string; TooltipEffect?: Effect;
options: {
resizeEnable?: boolean;
center?: number[];
zoom?: number;
};
};
} }
/** /**
@@ -127,14 +120,6 @@ declare global {
epThemeColor?: string; epThemeColor?: string;
showLogo?: boolean; showLogo?: boolean;
showModel?: string; showModel?: string;
mapConfigure?: {
amapKey?: string;
options: {
resizeEnable?: boolean;
center?: number[];
zoom?: number;
};
};
username?: string; username?: string;
} }

2
types/index.d.ts vendored
View File

@@ -45,6 +45,8 @@ type TimeoutHandle = ReturnType<typeof setTimeout>;
type IntervalHandle = ReturnType<typeof setInterval>; type IntervalHandle = ReturnType<typeof setInterval>;
type Effect = "light" | "dark";
interface ChangeEvent extends Event { interface ChangeEvent extends Event {
target: HTMLInputElement; target: HTMLInputElement;
} }