From 85b53727bf3a36cec14afab65d8abab32bb6bd8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E5=BF=83=E5=AE=87?= Date: Wed, 4 Sep 2024 14:18:52 +0800 Subject: [PATCH 1/2] iframe cont. --- src/App.js | 2 +- src/forge/iframe.jsx | 6 ++---- src/index.css | 1 + 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/App.js b/src/App.js index 7e05ec87f..779881133 100644 --- a/src/App.js +++ b/src/App.js @@ -165,7 +165,7 @@ const Iframe = Loadable({ }); // 此处仅维护前端可能的一级路由,不用进行项目或者组织判断的字段。 -const keyWord = ["explore", "settings", "setting", "mulan", "wiki", "issues", "setting", "trending", "code", "projects", "pulls", "mine", "login", "register", "email", "export", "nopage", "404", "403", "500", "501", "search", "organize", "login", "register", "resetPassword", "aboutus","educoder", "glcc","bindlogin", "softbot","zone"]; +const keyWord = ["explore", "settings", "setting", "mulan", "wiki", "issues", "setting", "trending", "code", "projects", "pulls", "mine", "login", "register", "email", "export", "nopage", "404", "403", "500", "501", "search", "organize", "login", "register", "resetPassword", "aboutus","educoder", "glcc","bindlogin", "softbot","zone", "hiagent"]; class App extends Component { constructor(props) { diff --git a/src/forge/iframe.jsx b/src/forge/iframe.jsx index f7b6ef56e..26cdd8897 100644 --- a/src/forge/iframe.jsx +++ b/src/forge/iframe.jsx @@ -16,8 +16,7 @@ const Iframe = (props) => { function iframeLoad() { let myIframe = document.getElementById("iframe"); - myIframe.height = `${document.documentElement.clientHeight - 473 + 86}px` - // if (myIframe.contentWindow.location && myIfram e.contentWindow.location.href) { + // if (myIframe.contentWindow.location && myIframe.contentWindow.location.href) { // window.location.href = 'http://118.145.132.196:3000/product/llm/llm-chat' // //myIframe.contentWindow.location.href // } @@ -26,9 +25,8 @@ const Iframe = (props) => { return } diff --git a/src/index.css b/src/index.css index 452f0f91b..7f853f7d9 100644 --- a/src/index.css +++ b/src/index.css @@ -253,4 +253,5 @@ i.color-orange05:hover { .test-iframe { margin-top: -48px; vertical-align:bottom; + height: 100vh; } \ No newline at end of file From 1f78d1aa9a1516d9d7f78cd686af119eb37260a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E5=BF=83=E5=AE=87?= Date: Wed, 16 Oct 2024 14:56:08 +0800 Subject: [PATCH 2/2] =?UTF-8?q?hiagent=E7=99=BB=E5=BD=95=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E4=BB=A5=E5=8F=8A=E5=9C=B0=E5=9D=80=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/iframe.jsx | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/src/forge/iframe.jsx b/src/forge/iframe.jsx index 26cdd8897..469aa808c 100644 --- a/src/forge/iframe.jsx +++ b/src/forge/iframe.jsx @@ -7,28 +7,24 @@ import { TPMIndexHOC } from "../modules/tpm/TPMIndexHOC"; const Iframe = (props) => { - const history = props.history - const location = history.location + const { history, showLoginDialog, current_user } = props + let settings = localStorage.chromesetting && localStorage.chromesetting !== 'undefined' &&JSON.parse(localStorage.chromesetting); - // if (!location.state.url) { - // history.push("/404"); - // } + useEffect(() => { + if (!settings?.common?.hiAgent) { + history.push("/404"); + } + if (!current_user?.login) { + history.push("/login?go_page=/hiagent"); + } + }, []) - function iframeLoad() { - let myIframe = document.getElementById("iframe"); - // if (myIframe.contentWindow.location && myIframe.contentWindow.location.href) { - // window.location.href = 'http://118.145.132.196:3000/product/llm/llm-chat' - // //myIframe.contentWindow.location.href - // } - } - - return + src={ settings?.common?.hiAgent } + > : '' } export default withRouter(CNotificationHOC()(SnackbarHOC()(TPMIndexHOC(Iframe)))); \ No newline at end of file