fix: 修复了逻辑报错时layout布局column排列的问题,关闭非当前tab页不会重定向到末尾tab页

This commit is contained in:
WANGFAN\wangf 2025-01-09 18:12:43 +08:00
parent 082d11253e
commit 19a0f12336
12 changed files with 155 additions and 9 deletions

View File

@ -45,6 +45,7 @@
"codemirror": "^6.0.1",
"driver.js": "^1.3.1",
"fingerprintjs2": "^2.1.4",
"jsbarcode": "^3.11.6",
"nprogress": "^0.2.0",
"pinia": "^2.1.7",
"pinia-plugin-persistedstate": "^3.2.1",

8
pnpm-lock.yaml generated
View File

@ -47,6 +47,9 @@ importers:
fingerprintjs2:
specifier: ^2.1.4
version: 2.1.4
jsbarcode:
specifier: ^3.11.6
version: 3.11.6
nprogress:
specifier: ^0.2.0
version: 0.2.0
@ -2690,6 +2693,9 @@ packages:
resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==}
hasBin: true
jsbarcode@3.11.6:
resolution: {integrity: sha512-G5TKGyKY1zJo0ZQKFM1IIMfy0nF2rs92BLlCz+cU4/TazIc4ZH+X1GYeDRt7TKjrYqmPfTjwTBkU/QnQlsYiuA==}
jsesc@2.5.2:
resolution: {integrity: sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==}
engines: {node: '>=4'}
@ -6988,6 +6994,8 @@ snapshots:
dependencies:
argparse: 2.0.1
jsbarcode@3.11.6: {}
jsesc@2.5.2: {}
json-buffer@3.0.1: {}

View File

@ -57,6 +57,7 @@ export default {
["icon-selector"]: "icon-selector",
["user-center"]: "user-center",
["fingerprintjs2"]: "fingerprintjs2",
["barcode"]: "barcode",
["markdown"]: "Markdown",
["directive"]: "directive",
["anti-shake"]: "anti-shake",

View File

@ -57,6 +57,7 @@ export default {
["icon-selector"]: "图标选择器",
["user-center"]: "用户中心",
["fingerprintjs2"]: "浏览器指纹",
["barcode"]: "条形码",
["markdown"]: "Markdown",
["directive"]: "自定义指令",
["anti-shake"]: "防抖",

View File

@ -0,0 +1,75 @@
<template>
<div :class="asideDark ? 'aside dark' : 'aside'">
<Logo />
<a-layout-sider :collapsed="collapsed" breakpoint="xl" class="layout_side" :width="220">
<a-scrollbar style="height: 100%; overflow: auto" outer-class="scrollbar"><Menu :route-tree="routeTree" /></a-scrollbar>
</a-layout-sider>
</div>
</template>
<script setup lang="ts">
import Logo from "@/layout/components/Logo/index.vue";
import Menu from "@/layout/components/Menu/index.vue";
import { storeToRefs } from "pinia";
import { useThemeConfig } from "@/store/modules/theme-config";
import { useRoutesConfigStore } from "@/store/modules/route-config";
const themeStore = useThemeConfig();
const { collapsed, asideDark } = storeToRefs(themeStore);
const routerStore = useRoutesConfigStore();
const { routeTree } = storeToRefs(routerStore);
</script>
<style lang="scss" scoped>
.aside {
display: flex;
flex-direction: column;
height: 100vh;
}
.dark {
background: #232324;
}
.layout_side {
flex: 1;
overflow: hidden;
.scrollbar {
height: 100%;
}
}
//
:deep(.arco-scrollbar-thumb-direction-vertical .arco-scrollbar-thumb-bar) {
width: 4px;
margin-left: 8px;
}
// 线
:deep(.arco-layout-sider-light) {
border-right: $border-1 solid $color-border-2;
box-shadow: unset;
}
// icon
:deep(.arco-menu-vertical.arco-menu-collapsed) {
// iconpadding
.arco-menu-has-icon {
justify-content: center;
padding: 0;
}
// iconmargin-righticonpaddingicon
.arco-menu-icon {
padding: 10px 0;
margin-right: 0;
}
// title
.arco-menu-title {
display: none;
}
}
// sider
.arco-layout-sider {
background: unset;
}
</style>

View File

@ -72,6 +72,7 @@ const onDelete = (key: string) => {
routerStore.removeTabsList(key);
routerStore.removeRouteName(key);
if (tabsList.value.length == 0) return;
if (currentRoute.value.name != key) return;
router.push(tabsList.value.at(-1).path);
};

View File

@ -1,5 +1,5 @@
<template>
<a-layout class="layout">
<a-layout class="layout" :has-sider="true">
<Aside />
<a-layout class="layout-right">
<Header />
@ -26,6 +26,7 @@ let { isFooter } = storeToRefs(themeStore);
<style lang="scss" scoped>
.layout {
height: 100vh;
border: 1px solid red;
}
.layout-right {
display: grid;

View File

@ -1,5 +1,5 @@
<template>
<a-layout class="layout">
<a-layout class="layout" :has-sider="true">
<div :class="asideDark ? 'aside dark' : 'aside'">
<Logo />
<a-layout-sider :collapsed="collapsed" breakpoint="xl" class="layout_side" :width="220">

View File

@ -554,6 +554,23 @@ export default [
icon: "icon-menu",
sort: 8
}
},
{
path: "/component/barcode",
name: "barcode",
component: "component/barcode/barcode",
meta: {
title: "barcode",
hide: false,
disable: false,
keepAlive: true,
affix: false,
link: "",
iframe: false,
roles: ["admin"],
icon: "icon-menu",
sort: 9
}
}
]
},

View File

@ -0,0 +1,36 @@
<template>
<div class="snow-page">
<div class="snow-inner">
<svg id="imgcode"></svg>
</div>
</div>
</template>
<script setup lang="ts">
import JsBarcode from "jsbarcode";
const createCode = () => {
JsBarcode("#imgcode", "123", {
format: "CODE39", //使
width: 3, //
height: 100, //
displayValue: true, //
text: "456", //
fontOptions: "bold italic", //使
font: "fantasy", //
textAlign: "left", //
textPosition: "top", //
textMargin: 5, //
fontSize: 15, //
background: "#eee", //
lineColor: "#2196f3", //
margin: 15 //
});
};
onMounted(() => {
createCode();
});
</script>
<style lang="scss" scoped></style>

View File

@ -15,15 +15,19 @@
<script setup lang="ts">
import Fingerprint2 from "fingerprintjs2";
const browserInfo = ref<Array[Object]>([]);
interface IComponents {
key: string;
value: any;
}
const browserInfo = ref<any>([]);
const getBrowserInfo = () => {
//
Fingerprint2.get(components => {
Fingerprint2.get((components: any) => {
//
const values = components.map(component => component.value); //
const values = components.map((component: any) => component.value); //
const murmur = Fingerprint2.x64hash128(values.join(""), 31).toUpperCase(); //
let arr = [];
components.forEach(el => {
components.forEach((el: IComponents) => {
switch (el.key) {
case "userAgent":
arr.push({ label: "用户代理(User-Agent)", value: el.value });
@ -76,16 +80,16 @@ const getBrowserInfo = () => {
});
};
const mobileFinger = ref<Array[Object]>([]);
const mobileFinger = ref<any>([]);
const getMobileFinger = () => {
Fingerprint2.get(components => {
Fingerprint2.get((components: any) => {
// Fingerprint2
//
components.push({
key: "ip",
value: "192.168.1.1" //ip
});
const values = components.map(component => component.value); //
const values = components.map((component: any) => component.value); //
const murmur = Fingerprint2.x64hash128(values.join(""), 31).toUpperCase(); //
mobileFinger.value.push({ label: "移动设备指纹(需要唯一标识)", value: murmur });
});

1
src/vite-env.d.ts vendored
View File

@ -19,3 +19,4 @@ declare module "@/directives/modules/custom";
declare module "mockjs";
declare module "@/store/modules/route-config";
declare module "@arco-design/*";
declare module "fingerprintjs2";