From 56a4397eb6e5a107a67062713145864ee038e4ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Mon, 22 Jul 2019 09:23:47 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=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/tpm/NewHeader.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index d698ebf95..d6d076f93 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -393,6 +393,7 @@ class NewHeader extends Component { // } } onSearchhref = (value) => { + console.log(value); window.location.href ="/search?value="+value; // let code = e.keyCode; @@ -728,8 +729,7 @@ submittojoinclass=(value)=>{ > this.onSearchhref(value)} - + onSearch={value =>this.onSearchhref(value)} onPressEnter={this.onKeywordSearchKeyDown} style={{ width: 300 }} /> From b1a4b2633c3538c09cd34cfac045f48e0babf9d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Mon, 22 Jul 2019 09:28:10 +0800 Subject: [PATCH 2/5] . --- public/react/src/modules/tpm/NewHeader.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index d698ebf95..506e70f99 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -393,6 +393,7 @@ class NewHeader extends Component { // } } onSearchhref = (value) => { + debugger window.location.href ="/search?value="+value; // let code = e.keyCode; @@ -727,10 +728,10 @@ submittojoinclass=(value)=>{ style={{display: 'none'}} > this.onSearchhref(value)} - - onPressEnter={this.onKeywordSearchKeyDown} + placeholder="实践课程/翻转课堂/开发社区/交流问答" + // onSearch={(value)=>this.onSearchhref(value)} + onSearch={value => console.log(value)} + onPressEnter={this.onKeywordSearchKeyDown} style={{ width: 300 }} /> From f44cf53cb9fbcef67ecd2768666d796e069800b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Mon, 22 Jul 2019 09:58:42 +0800 Subject: [PATCH 3/5] =?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/tpm/NewHeader.js | 18 ++++++++++-------- public/react/src/search/SearchPage.js | 20 +++++++++++--------- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index 506e70f99..9202dfbf4 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -36,7 +36,7 @@ const $ = window.$ // TODO 这部分脚本从公共脚本中直接调用 const RadioGroup = Radio.Group; -const Search = Input.Search; +const { Search } = Input; let old_url; function loadHeader(){ //头部导航条的----------显示搜索框 @@ -384,7 +384,9 @@ class NewHeader extends Component { } onKeywordSearchKeyDown = (e) => { - window.location.href ="/search?value="+e.target.value; + let url="/search?value="+e.target.value; + + this.props.history.push(url) // let code = e.keyCode; // if(code == 13) { @@ -392,9 +394,10 @@ class NewHeader extends Component { // return false; // } } - onSearchhref = (value) => { - debugger - window.location.href ="/search?value="+value; + onSearchhref = (e) => { + let url="/search?value="+e.target.value; + + this.props.history.push(url) // let code = e.keyCode; // if(code == 13) { @@ -729,10 +732,9 @@ submittojoinclass=(value)=>{ > this.onSearchhref(value)} - onSearch={value => console.log(value)} + onChange={(e)=>this.onSearchhref(e)} onPressEnter={this.onKeywordSearchKeyDown} - style={{ width: 300 }} + style={{ width: 300 }} /> diff --git a/public/react/src/search/SearchPage.js b/public/react/src/search/SearchPage.js index 37a06e8d8..32d88b392 100644 --- a/public/react/src/search/SearchPage.js +++ b/public/react/src/search/SearchPage.js @@ -52,15 +52,6 @@ class SearchPage extends Component{ } componentDidMount(){ - // const query =this.props.location.search; - // const type = query.split('?tab='); - // let sum = [] - // sum.push(type[1]) - // // console.log("componentDidMountcomponentDidMount"); - // // console.log(sum); - // this.setState({ - // tab:sum, - // }) let courstype=decodeURI(decodeURI(this.props.location.search)); courstype = courstype.split('?value='); @@ -70,6 +61,17 @@ class SearchPage extends Component{ this.getdata(this.state.page,this.state.type,courstype[1]); } + componentDidUpdate(prevProps) { + if(prevProps.location.search!=this.props.location.search){ + let courstype=decodeURI(decodeURI(this.props.location.search)); + courstype = courstype.split('?value='); + + this.setState({ + keywords:courstype[1] + }) + this.getdata(this.state.page,this.state.type,courstype[1]); + } + } setdatafunsval=(e)=>{ this.setState({ From 23853f45a01b3a8ce7c5c138b9c211feadc4fefc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Mon, 22 Jul 2019 10:07:05 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=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/tpm/NewHeader.js | 363 +++++++++++----------- 1 file changed, 183 insertions(+), 180 deletions(-) diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index d6d076f93..719e70a52 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -36,7 +36,7 @@ const $ = window.$ // TODO 这部分脚本从公共脚本中直接调用 const RadioGroup = Radio.Group; -const Search = Input.Search; +const { Search } = Input; let old_url; function loadHeader(){ //头部导航条的----------显示搜索框 @@ -129,7 +129,7 @@ function header_search(reactHeaderComponnet){ // // { search: keyword, // // index: index}); // window.location.href = old_url+"/users/search_shixuns_or_courses" + "?search=" + keyword + "&index=" + index; - //e.stopPropagation();//阻止冒泡 + //e.stopPropagation();//阻止冒泡 // } else { // window.__headSearchKeyword = keyword // reactHeaderComponnet.props.history.push(`/shixuns`) @@ -251,7 +251,7 @@ class NewHeader extends Component { const url = `/accounts/logout.json` this.delCookie("autologin_trustie") axios.get(url, { - }) + }) .then((response) => { if(response.data.status===1){ this.setState({ @@ -384,17 +384,20 @@ class NewHeader extends Component { } onKeywordSearchKeyDown = (e) => { - window.location.href ="/search?value="+e.target.value; + let url="/search?value="+e.target.value; + + this.props.history.push(url) // let code = e.keyCode; - + // if(code == 13) { // header_search(this); // return false; // } } - onSearchhref = (value) => { - console.log(value); - window.location.href ="/search?value="+value; + onSearchhref = (e) => { + let url="/search?value="+e.target.value; + + this.props.history.push(url) // let code = e.keyCode; // if(code == 13) { @@ -429,136 +432,136 @@ class NewHeader extends Component { }) } -submittojoinclass=(value)=>{ - let {tojoinclasstitle,rolearr,RadioGroupvalue}=this.state; + submittojoinclass=(value)=>{ + let {tojoinclasstitle,rolearr,RadioGroupvalue}=this.state; - if(tojoinclasstitle===undefined){ - this.setState({ - code_notice:true - }) - return - } - let newrolearr=rolearr; - if(value===1){ - if(tojoinclasstitle.length<6){ + if(tojoinclasstitle===undefined){ this.setState({ code_notice:true }) return } - }else if(value===0){ - if(tojoinclasstitle.length<5){ + let newrolearr=rolearr; + if(value===1){ + if(tojoinclasstitle.length<6){ + this.setState({ + code_notice:true + }) + return + } + }else if(value===0){ + if(tojoinclasstitle.length<5){ + this.setState({ + code_notice:true + }) + return + } + } + if(tojoinclasstitle===""||tojoinclasstitle===undefined){ this.setState({ code_notice:true }) return + }else{ + this.setState({ + code_notice:false + }) } - } - if(tojoinclasstitle===""||tojoinclasstitle===undefined){ - this.setState({ - code_notice:true - }) - return - }else{ - this.setState({ - code_notice:false - }) - } - let pamst=[]; - let num=0; - for(var i = 0 ; i { - if( response.data.state===0){ - this.submitstatevalue(0,"加入成功",response.data.course_id) - }else if( response.data.state===1){ - }else if( response.data.state===2){ - this.submitstatevalue( 0,"课堂已过期! 请联系课堂管理员重启课堂。(在配置课堂处)") - }else if( response.data.state===3){ - this.submitstatevalue( 0,"您已是课堂成员)",response.data.course_id) - }else if( response.data.state===4){ - this.submitstatevalue( 0,"您输入的邀请码错误)") - }else if( response.data.state===5){ - this.submitstatevalue( 0,"您还未登录") - }else if( response.data.state===6){ - this.submitstatevalue( 0,"申请已提交,请等待审核") - }else if( response.data.state===7){ - this.submitstatevalue( 0," 您已经发送过申请了,请耐心等待") - }else if( response.data.state===8){ - this.submitstatevalue( 0,"您已经是该课堂的教师了",response.data.course_id) - }else if( response.data.state==9){ - this.submitstatevalue( 0,"您已经是该课堂的教辅了",response.data.course_id) - }else if( response.data.state==10){ - this.submitstatevalue(0,"您已经是该课堂的管理员了",response.data.course_id) - }else if( response.data.state==11){ - this.submitstatevalue(0," 该课堂已归档,请联系老师") - }else if( response.data.state==12){ - this.submitstatevalue(0,"您已经发送过申请了,请耐心等待师") - }else if( response.data.state==13){ - this.submitstatevalue(0,"您申请已提交,请等待审核") - }else if( response.data.state==14){ - this.submitstatevalue("此邀请码已停用,请与老师联系") - }else if( response.data.state==15){ - this.submitstatevalue(0,"您已是课堂成员! 加入分班请在课堂具体分班页面进行") - }else { - this.submitstatevalue(0," 未知错误,请稍后再试") - } - }) + if(value===0){ + let url="/courses/join_course_multi_role.json" + const form = new FormData(); + form.append('invite_code', tojoinclasstitle); + form.append('role', pamst); + form.append('type', 1); + axios.post(url,form,[true] + ).then((response) => { + if( response.data.state===0){ + this.submitstatevalue(0,"加入成功",response.data.course_id) + }else if( response.data.state===1){ + }else if( response.data.state===2){ + this.submitstatevalue( 0,"课堂已过期! 请联系课堂管理员重启课堂。(在配置课堂处)") + }else if( response.data.state===3){ + this.submitstatevalue( 0,"您已是课堂成员)",response.data.course_id) + }else if( response.data.state===4){ + this.submitstatevalue( 0,"您输入的邀请码错误)") + }else if( response.data.state===5){ + this.submitstatevalue( 0,"您还未登录") + }else if( response.data.state===6){ + this.submitstatevalue( 0,"申请已提交,请等待审核") + }else if( response.data.state===7){ + this.submitstatevalue( 0," 您已经发送过申请了,请耐心等待") + }else if( response.data.state===8){ + this.submitstatevalue( 0,"您已经是该课堂的教师了",response.data.course_id) + }else if( response.data.state==9){ + this.submitstatevalue( 0,"您已经是该课堂的教辅了",response.data.course_id) + }else if( response.data.state==10){ + this.submitstatevalue(0,"您已经是该课堂的管理员了",response.data.course_id) + }else if( response.data.state==11){ + this.submitstatevalue(0," 该课堂已归档,请联系老师") + }else if( response.data.state==12){ + this.submitstatevalue(0,"您已经发送过申请了,请耐心等待师") + }else if( response.data.state==13){ + this.submitstatevalue(0,"您申请已提交,请等待审核") + }else if( response.data.state==14){ + this.submitstatevalue("此邀请码已停用,请与老师联系") + }else if( response.data.state==15){ + this.submitstatevalue(0,"您已是课堂成员! 加入分班请在课堂具体分班页面进行") + }else { + this.submitstatevalue(0," 未知错误,请稍后再试") + } + }) - } + } - if(value===1){ - let url="/applied_project/applied_project_info.json" - const form = new FormData(); - form.append('invite_code', tojoinclasstitle); - form.append('member', RadioGroupvalue); - form.append('type', 1); - axios.post(url,form,[true] - ).then((response) => { - if( response.data.status===1){ - this.submitstatevalue(1,"您输入的邀请码错误") - }else if( response.data.status===2){ - this.submitstatevalue( 1,"您已经是该项目成员",response.data.project) - }else if( response.data.status===3){ - this.submitstatevalue( 1,"请选择一个角色") - }else if( response.data.status===4){ - this.submitstatevalue( 1,"您的申请已提交,请等待项目管理员审批") - }else if( response.data.status===5){ - this.submitstatevalue( 1,"您已经申请加入该项目了,请耐心等待") - }else if( response.data.status===6){ - this.submitstatevalue( 1,"您已成功加入项目",response.data.project) - } - }) + if(value===1){ + let url="/applied_project/applied_project_info.json" + const form = new FormData(); + form.append('invite_code', tojoinclasstitle); + form.append('member', RadioGroupvalue); + form.append('type', 1); + axios.post(url,form,[true] + ).then((response) => { + if( response.data.status===1){ + this.submitstatevalue(1,"您输入的邀请码错误") + }else if( response.data.status===2){ + this.submitstatevalue( 1,"您已经是该项目成员",response.data.project) + }else if( response.data.status===3){ + this.submitstatevalue( 1,"请选择一个角色") + }else if( response.data.status===4){ + this.submitstatevalue( 1,"您的申请已提交,请等待项目管理员审批") + }else if( response.data.status===5){ + this.submitstatevalue( 1,"您已经申请加入该项目了,请耐心等待") + }else if( response.data.status===6){ + this.submitstatevalue( 1,"您已成功加入项目",response.data.project) + } + }) + } } -} // trialapplications =()=>{ // console.log("点击了") @@ -631,10 +634,10 @@ submittojoinclass=(value)=>{
{/*{*/} {/* isRender&& isRender === true?*/} - + {/* :""*/} {/*}*/} @@ -692,15 +695,15 @@ submittojoinclass=(value)=>{
- {/*
  • 教学案例
  • */} + {/*
  • 教学案例
  • */}
  • - 在线竞赛 - + 在线竞赛 +
  • -
  • 教学案例
  • -
  • 众包创新
  • +
  • 教学案例
  • +
  • 众包创新
  • 交流问答
  • { -