From 1bb339bfb1df6fd5da9ec6f04ab4c5e0143a8a49 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Tue, 6 Jul 2021 11:54:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=BB=BA=EF=BC=9A=E6=8B=A5=E6=9C=89?= =?UTF-8?q?=E8=80=85=E9=BB=98=E8=AE=A4=E9=80=89=E4=B8=AD=E5=BD=93=E5=89=8D?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E7=94=A8=E6=88=B7=EF=BC=8C=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E8=B7=AF=E7=94=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.js | 32 ++++++++++---------------------- src/forge/Index.js | 14 -------------- src/forge/New/Index.js | 18 ++++++++++++------ 3 files changed, 22 insertions(+), 42 deletions(-) diff --git a/src/App.js b/src/App.js index 5105d3ec..a73c04d4 100644 --- a/src/App.js +++ b/src/App.js @@ -78,6 +78,10 @@ const Search = Loadable({ loading: Loading, }) +const ProjectIndex = Loadable({ + loader: () => import("./forge/Main/Index"), + loading: Loading, +}); class App extends Component { constructor(props) { super(props); @@ -103,30 +107,9 @@ class App extends Component { Addcoursestypes: false }) }; - ModalCancelsy = () => { - this.setState({ - mydisplay: false, - }) - window.location.href = "/"; - }; - ModalshowCancelsy = () => { - this.setState({ - mydisplay: true, - }) - }; - disableVideoContextMenu = () => { - window.$("body").on("mousedown", "video", function (event) { - if (event.which === 3) { - window.$('video').bind('contextmenu', function () { return false; }); - } else { - window.$('video').unbind('contextmenu'); - } - }); - } componentDidMount() { document.title = "loading..."; - this.disableVideoContextMenu(); initAxiosInterceptors(this.props); this.getAppdata(); @@ -204,6 +187,8 @@ class App extends Component { }; render() { + const { mygetHelmetapi } = this.state; + let personal = mygetHelmetapi && mygetHelmetapi.personal; return ( @@ -265,7 +250,10 @@ class App extends Component { ( - + personal && personal.length > 0 ? + + : + ) } /> diff --git a/src/forge/Index.js b/src/forge/Index.js index 533530b0..af4d4443 100644 --- a/src/forge/Index.js +++ b/src/forge/Index.js @@ -26,10 +26,6 @@ const ProjectDetail = Loadable({ loading: Loading, }); -const Infos = Loadable({ - loader: () => import("./users/Infos"), - loading: Loading, -}); class Index extends Component { componentDidUpdate=()=>{ @@ -73,16 +69,6 @@ class Index extends Component { )} > - ( - this.props.current_user && this.props.current_user.login ? - - : - - )} - > ); diff --git a/src/forge/New/Index.js b/src/forge/New/Index.js index 381d7438..c2e2afc0 100644 --- a/src/forge/New/Index.js +++ b/src/forge/New/Index.js @@ -68,24 +68,30 @@ class Index extends Component { getOwner=()=>{ const { OIdentifier } = this.props.match.params; + const { user_id } = this.props && this.props.current_user; const url = `/owners.json`; axios.get(url).then(result=>{ if(result && result.data){ let owner = result.data.owners; + this.setState({ + OwnerList: owner, + }) if(OIdentifier){ owner = owner.filter(item=>item.name === OIdentifier); this.props.form.setFieldsValue({ user_id:OIdentifier }) - owner && this.setState({ - owners_id:owner[0].id, - owners_name:owner[0].name + }else if(user_id){ + owner = owner.filter(item=>item.id === user_id); + this.props.form.setFieldsValue({ + user_id:owner && owner[0].name }) } - this.setOptionsList(owner, 'owners'); - this.setState({ - OwnerList: owner, + owner && this.setState({ + owners_id:owner[0].id, + owners_name:owner[0].name }) + this.setOptionsList(owner, 'owners'); } }).catch(error=>{}) }