From 6d974f9a58d4b8b30e37f1ae6d7b37d456e414b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Wed, 14 Aug 2019 10:39:29 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/courses/ListPageIndex.js | 81 ++++++++++++------- .../src/modules/courses/boards/BoardsNew.js | 2 +- .../graduation/tasks/GraduateTaskItem.js | 8 +- .../src/modules/courses/new/CoursesNew.js | 36 +++++++-- .../modules/courses/shixunHomework/Guide.js | 2 +- 5 files changed, 91 insertions(+), 38 deletions(-) diff --git a/public/react/src/modules/courses/ListPageIndex.js b/public/react/src/modules/courses/ListPageIndex.js index 20718c903..8976c29cd 100644 --- a/public/react/src/modules/courses/ListPageIndex.js +++ b/public/react/src/modules/courses/ListPageIndex.js @@ -69,19 +69,33 @@ class ListPageIndex extends Component{ super(props); this.state={ yslGuideone:undefined, - mysearch:undefined, } } componentDidMount(){ - var yslGuideone = window.sessionStorage.getItem('yslGuideone'); console.log("77"); + var yslGuideone = window.sessionStorage.getItem('yslGuideone'); + console.log("78"); console.log(yslGuideone); - var mysearchs= this.props.location.search===""?undefined:this.props.location.search===undefined?undefined:this.props.location.search==="?exhibition=true"?true:undefined; - this.setState({ - yslGuideone:yslGuideone, - mysearch:mysearchs, - }) + try { + if (yslGuideone === "true") { + console.log("true 字符串"); + this.setState({ + yslGuideone:true, + }) + } else { + this.setState({ + yslGuideone:false, + }); + console.log("false 字符串"); + } + }catch (e) { + console.log(e); + this.setState({ + yslGuideone:false, + }); + } + } // @@ -93,20 +107,33 @@ class ListPageIndex extends Component{ // }) // } componentWillUnmount(){ - window.sessionStorage.setItem('yslGuideone', false); + window.sessionStorage.setItem('yslGuideone', "false"); } setwindowlocal=(bool)=>{ window.sessionStorage.setItem('yslGuideone', bool); - this.setState({ - yslGuideone:bool, - mysearch:undefined, - }); - var currenturl = this.props.location.pathname; - var newUrl = (currenturl.split("?"))[0]; - window.history.pushState('','',newUrl); + try { + if (bool === "true") { + console.log("115"); + console.log("true 字符串"); + this.setState({ + yslGuideone:true, + }) + } else { + this.setState({ + yslGuideone:false, + }); + console.log("124"); + console.log("false 字符串"); + } + }catch (e) { + console.log(e); + this.setState({ + yslGuideone:false, + }); + } } render() { - let {yslGuideone,mysearch} =this.state; + let {yslGuideone} =this.state; // console.log("98"); // console.log(yslGuideone); // console.log(this.props.isAdmin()); @@ -119,17 +146,17 @@ class ListPageIndex extends Component{ {/*头部banner*/} - {/*{mysearch!==undefined?*/} - {/*(*/} - {/* mysearch===true?*/} - {/* this.setwindowlocal(b)}*/} - {/* >*/} - {/* */} - {/* :""*/} - {/* )*/} - {/* :""*/} - {/*}*/} + {yslGuideone!==undefined? + ( + yslGuideone===true? + this.setwindowlocal(b)} + > + + :"" + ) + :"" + }
diff --git a/public/react/src/modules/courses/boards/BoardsNew.js b/public/react/src/modules/courses/boards/BoardsNew.js index cea4f47aa..43be980ed 100644 --- a/public/react/src/modules/courses/boards/BoardsNew.js +++ b/public/react/src/modules/courses/boards/BoardsNew.js @@ -310,7 +310,7 @@ class BoardsNew extends Component{ {this.isEdit ? "编辑" : "新建"}帖子 this.props.history.goBack()}> - 返回 + {/*返回*/}

{/* notRequired */} diff --git a/public/react/src/modules/courses/graduation/tasks/GraduateTaskItem.js b/public/react/src/modules/courses/graduation/tasks/GraduateTaskItem.js index cf66b918a..d30944ef0 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduateTaskItem.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduateTaskItem.js @@ -283,11 +283,11 @@ class GraduateTaskItem extends Component{ {this.props.isAdmin?
- - 编辑 + + 设置 - - 设置 + + 编辑
diff --git a/public/react/src/modules/courses/new/CoursesNew.js b/public/react/src/modules/courses/new/CoursesNew.js index 7dcc9bce7..0211c9606 100644 --- a/public/react/src/modules/courses/new/CoursesNew.js +++ b/public/react/src/modules/courses/new/CoursesNew.js @@ -206,8 +206,21 @@ class CoursesNew extends Component { if (response.data.status === 0) { // this.goback() - window.location.href=first_category_url+"?exhibition=true"; - window.sessionStorage.setItem('yslGuideone', true); + window.location.href=first_category_url; + var yslGuideone = window.sessionStorage.getItem('yslGuideone'); + try { + if(yslGuideone=== null){ + window.sessionStorage.setItem('yslGuideone', "true"); + return + } + if(yslGuideone=== undefined){ + window.sessionStorage.setItem('yslGuideone', "true"); + return + } + }catch (e) { + + } + } }).catch((error) => { console.log(error) @@ -251,8 +264,20 @@ class CoursesNew extends Component { ).then((response) => { if (response.status === 200) { // this.goback - window.location.href=response.data.first_category_url+"?exhibition=true"; - window.sessionStorage.setItem('yslGuideone', true); + window.location.href=response.data.first_category_url; + var yslGuideone = window.sessionStorage.getItem('yslGuideone'); + try { + if(yslGuideone=== null){ + window.sessionStorage.setItem('yslGuideone', "true"); + return + } + if(yslGuideone=== undefined){ + window.sessionStorage.setItem('yslGuideone', "true"); + return + } + }catch (e) { + + } } }).catch((error) => { console.log(error) @@ -405,9 +430,10 @@ class CoursesNew extends Component { const propsWithoutForm = Object.assign({}, this.props) delete propsWithoutForm.form const options = this.state.searchlist && this.state.searchlist.map(d => ); - const optionschool = this.state.searchlistscholl&&this.state.searchlistscholl.map(z => ); + const optionschool = this.state.searchlistscholl===undefined?"":this.state.searchlistscholl===null?"":this.state.searchlistscholl==="[]"?"":this.state.searchlistscholl.map(z => ); // console.log(this.props.current_user.user_school) // form合并了 + console.log("获取到的数据"); console.log(this.state); console.log(this.props); console.log(this.props.current_user); diff --git a/public/react/src/modules/courses/shixunHomework/Guide.js b/public/react/src/modules/courses/shixunHomework/Guide.js index d93961518..29470190f 100644 --- a/public/react/src/modules/courses/shixunHomework/Guide.js +++ b/public/react/src/modules/courses/shixunHomework/Guide.js @@ -60,7 +60,7 @@ class Guide extends Component { page:i, }) if(i===7){ - this.props.setwindowlocal(false); + this.props.setwindowlocal("false"); } } render() {