From 8ec3869815e8bf7c2f397d0e6bf6233964344e0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Fri, 19 Jul 2019 20:39:51 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=90=9C=E7=B4=A2=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/App.js | 8 ++- public/react/src/modules/tpm/NewHeader.js | 5 +- .../src/modules/tpm/newshixuns/Newshixuns.js | 6 +- public/react/src/search/SearchPage.js | 55 ++++++++++++++----- 4 files changed, 55 insertions(+), 19 deletions(-) diff --git a/public/react/src/App.js b/public/react/src/App.js index 293d1baca..b7658450a 100644 --- a/public/react/src/App.js +++ b/public/react/src/App.js @@ -333,7 +333,13 @@ class App extends Component { {/*实训课程(原实训路径)*/} - + + () + } + > + {/*课堂*/} diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index 3ea3c493c..43152a074 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -384,7 +384,7 @@ class NewHeader extends Component { } onKeywordSearchKeyDown = (e) => { - window.location.href ="/search"+"?value="+e.target.value; + window.location.href ="/search?value="+e.target.value; // let code = e.keyCode; // if(code == 13) { @@ -709,6 +709,7 @@ submittojoinclass=(value)=>{ console.log(value)} + onPressEnter={this.onKeywordSearchKeyDown} style={{ width: 258 }} /> @@ -791,6 +792,8 @@ submittojoinclass=(value)=>{ + {console.log(this.props)} + {console.log(this.state)} 新建课堂 新建实训 新建实践课程 diff --git a/public/react/src/modules/tpm/newshixuns/Newshixuns.js b/public/react/src/modules/tpm/newshixuns/Newshixuns.js index a7d48cb67..192bfdd8b 100644 --- a/public/react/src/modules/tpm/newshixuns/Newshixuns.js +++ b/public/react/src/modules/tpm/newshixuns/Newshixuns.js @@ -502,6 +502,8 @@ class Newshixuns extends Component { } sendsure_apply = () => { let {languagewrite,systemenvironment,testcoderunmode} = this.state; + + debugger // console.log("点击确定") // console.log("languagewrite"+languagewrite); // console.log("systemenvironment"+systemenvironment); @@ -987,14 +989,14 @@ class Newshixuns extends Component { { deleteisnot=== true? - + 上传附件 (单个文件50M以内) : - + 上传附件 (单个文件50M以内) diff --git a/public/react/src/search/SearchPage.js b/public/react/src/search/SearchPage.js index d2eb5ef93..5b1ae7f64 100644 --- a/public/react/src/search/SearchPage.js +++ b/public/react/src/search/SearchPage.js @@ -15,27 +15,28 @@ class SearchPage extends Component{ this.state={ tab:"0", count:0, - keywords:"", - type:"", + keywords:undefined, + type:"shixun", page:1, perpages:20, data:[], + } } //切换tab changeTab=(e)=>{ - console.log(e.key); - let types =""; + + let types =""; if(parseInt(e.key)===0){ - types="course"; + types="shixun"; } if(parseInt(e.key)===1){ - types="shixun"; + types="subject"; } if(parseInt(e.key)===2){ - types="subject"; + types="course"; } if(parseInt(e.key)===3){ @@ -59,16 +60,27 @@ class SearchPage extends Component{ // this.setState({ // tab:sum, // }) - let courstype=this.props.match.url; + let courstype=decodeURI(decodeURI(this.props.location.search)); courstype = courstype.split('?value='); - console.log(courstype); - this.getdata(this.state.page,this.state.type,this.state.keywords); + this.setState({ + keywords:courstype[1] + }) + this.getdata(this.state.page,this.state.type,courstype[1]); + + } + + setdatafunsval=(e)=>{ + this.setState({ + keywords:e.target.value + }) } + setdatafuns =(value)=>{ this.setState({ keywords:value }) + this.props.history.replace(`/search?value=${value}`) this.getdata(this.state.page,this.state.type,value); } paginationonChanges = (pageNumber) => { @@ -92,21 +104,22 @@ class SearchPage extends Component{ return } - console.log("63"); - console.log(response.data); + + this.setState({ count:response.data.count, data:response.data.results, }) }).catch((error) => { - console.log("56"); - console.log(error); + + }); } render(){ let {tab,count,data,page,perpages}=this.state; - console.log(tab); + + return( @@ -114,7 +127,9 @@ class SearchPage extends Component{ 搜索} + onInput={(e)=>this.setdatafunsval(e)} onSearch={ (value)=>this.setdatafuns(value)} /> @@ -146,11 +161,19 @@ class SearchPage extends Component{ 共找到相关结果{count}个 + {data === undefined ? "" : data.map((item, key) => { return ( + + @@ -208,6 +231,8 @@ class SearchPage extends Component{ + + ) })} From 20c2dda047b451f64348a31c296e64b002959853 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Fri, 19 Jul 2019 21:17:12 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=20=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/courses/new/CoursesNew.js | 10 +++++++++- public/react/src/modules/login/LoginDialog.js | 9 +++++++-- public/react/src/modules/tpm/NewHeader.js | 4 +--- public/react/src/search/SearchPage.js | 2 +- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/public/react/src/modules/courses/new/CoursesNew.js b/public/react/src/modules/courses/new/CoursesNew.js index f3442b8b7..e126027ec 100644 --- a/public/react/src/modules/courses/new/CoursesNew.js +++ b/public/react/src/modules/courses/new/CoursesNew.js @@ -40,6 +40,8 @@ class CoursesNew extends Component { } componentDidMount() { + + let coursesId = this.props.match.params.coursesId; let user_school=this.props.current_user&&this.props.current_user.user_school; @@ -85,7 +87,13 @@ class CoursesNew extends Component { this.Searchvalue("") } - + componentDidUpdate(prevProps){ + if(prevProps.current_user!=this.props.current_user){ + if(this.props.current_user.user_identity==="学生"){ + window.location.href ="/403" + } + } + } onChangeTimepublishs = (date, dateString) => { if(dateString===""){ this.setState({ diff --git a/public/react/src/modules/login/LoginDialog.js b/public/react/src/modules/login/LoginDialog.js index a5f0529e0..f3f4ceadf 100644 --- a/public/react/src/modules/login/LoginDialog.js +++ b/public/react/src/modules/login/LoginDialog.js @@ -7,7 +7,7 @@ import Dialog, { DialogContentText, DialogTitle, } from 'material-ui/Dialog'; - +import {notification } from 'antd'; import axios from 'axios'; @@ -349,7 +349,12 @@ class LoginDialog extends Component { if(response.status===200){ if (response.data.status === 402) { window.location.href = response.data.url; - }else{ + }else if (response.data.status === -2) { + notification.open({ + message: '提示', + description:response.data.message, + }); + }else{ broadcastChannelPostMessage('refreshPage') this.setState({ isRender:false diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index 43152a074..10a6ec054 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -792,9 +792,7 @@ submittojoinclass=(value)=>{ - {console.log(this.props)} - {console.log(this.state)} - 新建课堂 + {this.props.current_user&&this.props.current_user.user_identity==="学生"?"":新建课堂} 新建实训 新建实践课程 新建项目 diff --git a/public/react/src/search/SearchPage.js b/public/react/src/search/SearchPage.js index 5b1ae7f64..3f12bf33a 100644 --- a/public/react/src/search/SearchPage.js +++ b/public/react/src/search/SearchPage.js @@ -169,7 +169,7 @@ class SearchPage extends Component{ return (
共找到相关结果{count}个