From 2b5b6b3894120a7573d41180729f202963109d45 Mon Sep 17 00:00:00 2001 From: ZLY Date: Mon, 26 Jan 2026 10:01:08 +0800 Subject: [PATCH] =?UTF-8?q?feat(systemResource):=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E8=B5=84=E6=BA=90=E5=A4=A7=E5=B1=8F=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/ideContainer/icon/sysResource.png | Bin 0 -> 403 bytes .../ideContainer/icon/sysResource_active.png | Bin 0 -> 572 bytes .../systemResource/index.tsx | 38 ++++++++++++++++++ src/pages/ideContainer/config/menuData.ts | 13 ++++-- src/pages/ideContainer/index.tsx | 6 ++- 5 files changed, 53 insertions(+), 4 deletions(-) create mode 100644 public/ideContainer/icon/sysResource.png create mode 100644 public/ideContainer/icon/sysResource_active.png create mode 100644 src/pages/componentDevelopment/systemResource/index.tsx diff --git a/public/ideContainer/icon/sysResource.png b/public/ideContainer/icon/sysResource.png new file mode 100644 index 0000000000000000000000000000000000000000..b028c19d4305615297903416836ea16a9a07987d GIT binary patch literal 403 zcmV;E0c`$>P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D0VqjCK~y+T)zPs_ zLQxdQ@nHiScoOJhUS=3GnA98Dtq4=Fh5R74I1(PTCxEm1^i zK~f?P_5I!FgGEMN^mnM4~OrgL+GTNM>-s0c_5FVGV0q;aX@6&Jk&J9_^k=Ihq<8 z!8Piz6Gt95(Cu2B7tLN_R81ADD*j{)2beXTKf0ik}@P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D0ntfBK~y+T)lxl3 zTtN_?nTwhP3n7JKsuZ~*bqWc{of`aUB9R!=*c=v01hEjo6#E{E#6qxAEVLJYAQlOM zp!Y;1!Jt*5g10-}lYV?94L#hm6s3A#GEl*TnS9ariI5 zxN`Q0mNo|EC^mYCUt`o6n`733GWFowLEy0}og(-zz$VbP;2OzkIi6>F)az2n&$K423&W8FGVa=-A zAB8d@xN{XNjS=fRSPF1m>&qqD-^W+pwXAPY>2Up!eahLueggRtncv2)8}Q25YB}YT z_0N3hDKy(Ip#DFC`?R2fdCy-%y|FJ!h_+H?+Tp1L!gCl;lc3(T>v|^Cb}uC`D(HCI zImU-fU!s7gy+W~9wHN$zjGP{T`>jRYOXLJu(K=;b#9g-{!`+1WdWoDDyI)BDP>_8e zC;eC(k!`QXD0xgjVI5(ifq#P?oYx9{!y7qpO`L*yhPn26{Z7Ce8Ab9+u}rf#zq4V~ zKJnVE!00QmbYTKBvSwrxn}zct)x_!@kRna1(9&us8=ktqAi4lrE3A-RcmUr30000< KMNUMnLSTZ>-Ub%{ literal 0 HcmV?d00001 diff --git a/src/pages/componentDevelopment/systemResource/index.tsx b/src/pages/componentDevelopment/systemResource/index.tsx new file mode 100644 index 0000000..41875cb --- /dev/null +++ b/src/pages/componentDevelopment/systemResource/index.tsx @@ -0,0 +1,38 @@ +import React, { useRef, useState, useEffect } from 'react'; + +const SystemResource = () => { + const iframeRef = useRef(null); + + // 根据当前访问的 hostname 动态生成服务器 URL + const getServerUrl = () => { + const currentHostname = window.location.hostname; + + // 如果是 localhost 或 127.0.0.1,使用固定的 IP + if (currentHostname === 'localhost' || currentHostname === '127.0.0.1') { + return 'http://192.168.5.119:5001/'; + } + + // 否则使用当前的 IP 加 5001 端口 + return `http://${currentHostname}:5001/`; + }; + + const [serverUrl, setServerUrl] = useState(getServerUrl()); + + // 监听 URL 变化(如果需要动态更新) + useEffect(() => { + const handleLocationChange = () => { + setServerUrl(getServerUrl()); + }; + + // 监听 popstate 事件(浏览器前进后退) + window.addEventListener('popstate', handleLocationChange); + + return () => { + window.removeEventListener('popstate', handleLocationChange); + }; + }, []); + + return