This commit is contained in:
caishi 2024-11-22 15:25:54 +08:00
commit 837cb3b2f5
3 changed files with 113 additions and 1 deletions

View File

@ -159,8 +159,13 @@ 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"];
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) {
@ -336,6 +341,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) => {

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

@ -0,0 +1,34 @@
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");
// 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 <iframe
id="iframe"
width="100%"
className="test-iframe"
src={ 'https://testllm.trustie.net' }
onLoad={iframeLoad}
></iframe>
}
export default withRouter(CNotificationHOC()(SnackbarHOC()(TPMIndexHOC(Iframe))));

View File

@ -186,4 +186,71 @@ i.color-orange05:hover {
.color-light-green {
color: #29bd8b !important;
}
.AlignTop {
display:flex;
align-items: flex-start
}
.WhiteBack {
background-color:#fff;
border-radius:5px
}
.Box {
display:flex;
align-items:flex-start
}
.LongWidth {
flex:1;
width:0;
border-radius:5px;
margin-bottom:30px
}
.ShortWidth {
width:300px;
border-radius:5px;
margin-bottom:30px
}
.Gap {
padding-left:20px;
box-sizing:border-box;
}
.AlignCenter {
display:flex;
align-items: center
}
.FlexAJ {
display:flex;
align-items: center;
justify-content: space-between
}
.mt25 {
margin-top:25px
}
.User {
display:flex;
font-weight: bold;
align-items: center
}
.User img {
width:30px;
height:30px;
border-radius:50%
}
.User span {
margin-left:8px
}
.latex-error {
border: 1px solid #ff818266;
border-radius: 6px;
background-color: #ffebe9;
padding: 10px 8px;
font-size: 12px;
margin-bottom: 5px;
}
.test-iframe {
margin-top: -48px;
vertical-align:bottom;
height: 100vh;
}