diff --git a/public/ideContainer/icon/sysResource.png b/public/ideContainer/icon/sysResource.png new file mode 100644 index 0000000..b028c19 Binary files /dev/null and b/public/ideContainer/icon/sysResource.png differ diff --git a/public/ideContainer/icon/sysResource_active.png b/public/ideContainer/icon/sysResource_active.png new file mode 100644 index 0000000..f0a871f Binary files /dev/null and b/public/ideContainer/icon/sysResource_active.png differ 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