Merge pull request 'iframetest' (#764) from Eeeros/forgeplus-react:gitlink_ssr_head into gitlink_ssr_head

1
This commit is contained in:
Eeeros 2024-08-29 13:48:38 +08:00
commit 97e205c498
3 changed files with 53 additions and 1 deletions

View File

@ -159,6 +159,11 @@ const Topic = Loadable({
loading: Loading,
})
const Iframe = Loadable({
loader: () => import("./forge/iframe"),
loading: Loading,
});
// 此处仅维护前端可能的一级路由,不用进行项目或者组织判断的字段。
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"];
@ -338,6 +343,12 @@ class App extends Component {
{!pathName || (pathName && pathName.toLowerCase() !== 'glcc') ? <SiderBar {...this.props}/> : <SiderBarHelp/>}
{/* <Router> */}
<Switch>
{/* iframe页面 */}
<Route path="/hiagent"
render={
(props) => (<Iframe {...this.props} {...props} {...this.state} />)
}
></Route>
{/* wiki预览 */}
<Route path="/:owner/:projectsId/wiki/preview/:projectName/:projectId" render={
(props) => {

36
src/forge/iframe.jsx Normal file
View File

@ -0,0 +1,36 @@
import React, { useEffect, useState, useCallback } from 'react';
import { withRouter } from "react-router";
import { SnackbarHOC } from "educoder";
import { CNotificationHOC } from "../modules/courses/common/CNotificationHOC";
import { TPMIndexHOC } from "../modules/tpm/TPMIndexHOC";
const Iframe = (props) => {
const history = props.history
const location = history.location
// if (!location.state.url) {
// history.push("/404");
// }
function iframeLoad() {
let myIframe = document.getElementById("iframe");
myIframe.height = `${document.documentElement.clientHeight - 473 + 86}px`
// if (myIframe.contentWindow.location && myIfram e.contentWindow.location.href) {
// window.location.href = 'http://118.145.132.196:3000/product/llm/llm-chat'
// //myIframe.contentWindow.location.href
// }
}
return <iframe
id="iframe"
width="100%"
height="800px"
className="test-iframe"
src={ 'http://118.145.132.196:3000/product/llm/llm-chat' }
onLoad={iframeLoad}
></iframe>
}
export default withRouter(CNotificationHOC()(SnackbarHOC()(TPMIndexHOC(Iframe))));

View File

@ -246,6 +246,11 @@ i.color-orange05:hover {
border-radius: 6px;
background-color: #ffebe9;
padding: 10px 8px;
font-size: 12px;
font-size: 12px;
margin-bottom: 5px;
}
.test-iframe {
margin-top: -48px;
vertical-align:bottom;
}