fix: 静态资源文件路径解析

This commit is contained in:
TsMask
2024-10-28 14:31:04 +08:00
parent 0a96fee6c3
commit 6e3ef7e56a
5 changed files with 37 additions and 7 deletions

View File

@@ -7,6 +7,7 @@ import { listAllNeInfo, stateNeInfo } from '@/api/ne/neInfo';
import { message } from 'ant-design-vue/es';
import { randerGroph, switchLayout } from './graph';
import { parseDateToStr } from '@/utils/date-utils';
import { parseBasePath } from '@/plugins/file-static-url';
const { t } = useI18n();
/**图DOM节点实例对象 */
@@ -87,7 +88,7 @@ function fnGetList(refresh: boolean = false) {
x: -30,
y: -30,
// 可更换为其他图片地址
img: '/svg/service_db.svg',
img: parseBasePath('/svg/service_db.svg'),
width: 60,
height: 60,
},
@@ -102,7 +103,7 @@ function fnGetList(refresh: boolean = false) {
icon: {
x: -24,
y: -24,
img: '/svg/service.svg',
img: parseBasePath('/svg/service.svg'),
width: 48,
height: 48,
},

View File

@@ -24,6 +24,7 @@ import {
import useNeOptions from '@/views/ne/neInfo/hooks/useNeOptions';
import useI18n from '@/hooks/useI18n';
import { OptionsType, WS } from '@/plugins/ws-websocket';
import { parseBasePath } from '@/plugins/file-static-url';
const { t } = useI18n();
const { fnNeRestart, fnNeStop, fnNeLogFile } = useNeOptions();
const ws = new WS();
@@ -291,6 +292,10 @@ function fnGraphDataLoad(reload: boolean = false) {
const nf: Record<string, any>[] = nodes.filter(
(node: Record<string, any>) => {
Reflect.set(node, 'neState', { online: false });
// 图片路径处理
if (node.img) node.img = parseBasePath(node.img);
if (node.icon.show && node.icon?.img) node.icon.img = parseBasePath(node.icon.img);
// 遍历是否有网元数据
const nodeID: string = node.id;
const hasNe = res.neList.some(ne => {
Reflect.set(node, 'neInfo', ne.neType === nodeID ? ne : {});