dev_forum
杨树林 5 years ago
parent 3197b15e26
commit 75e64b2d68

@ -62,9 +62,9 @@ class NewHeader extends Component {
RadioGroupvalue:undefined, RadioGroupvalue:undefined,
submitapplications:false, submitapplications:false,
isRender:false, isRender:false,
showSearchOpentype:false, showSearchOpentype:false,
showTrial:false, showTrial:false,
setevaluatinghides:false setevaluatinghides:false
} }
// console.log("176") // console.log("176")
// console.log(props); // console.log(props);
@ -152,7 +152,7 @@ class NewHeader extends Component {
const url = `/accounts/logout.json` const url = `/accounts/logout.json`
this.delCookie("autologin_trustie") this.delCookie("autologin_trustie")
axios.get(url, { axios.get(url, {
}) })
.then((response) => { .then((response) => {
if(response.data.status===1){ if(response.data.status===1){
this.setState({ this.setState({
@ -331,136 +331,136 @@ class NewHeader extends Component {
}) })
} }
submittojoinclass=(value)=>{ submittojoinclass=(value)=>{
let {tojoinclasstitle,rolearr,RadioGroupvalue}=this.state; let {tojoinclasstitle,rolearr,RadioGroupvalue}=this.state;
if(tojoinclasstitle===undefined){ if(tojoinclasstitle===undefined){
this.setState({ this.setState({
code_notice:true code_notice:true
}) })
return return
} }
let newrolearr=rolearr; let newrolearr=rolearr;
// if(value===1){ // if(value===1){
if(tojoinclasstitle.length<6){ if(tojoinclasstitle.length<6){
this.setState({ this.setState({
code_notice:true code_notice:true
}) })
return return
} }
// }else if(value===0){ // }else if(value===0){
// if(tojoinclasstitle.length<5){ // if(tojoinclasstitle.length<5){
// this.setState({ // this.setState({
// code_notice:true // code_notice:true
// }) // })
// return // return
// } // }
// } // }
if(tojoinclasstitle===""||tojoinclasstitle===undefined){ if(tojoinclasstitle===""||tojoinclasstitle===undefined){
this.setState({ this.setState({
code_notice:true code_notice:true
}) })
return return
}else{
this.setState({
code_notice:false
})
}
let pamst=[];
let num=0;
for(var i = 0 ; i<newrolearr.length;i++){
if(newrolearr[i]!=""){
pamst.push(newrolearr[i])
}else{ }else{
num=num+1 this.setState({
code_notice:false
})
} }
}
if(num===2&&value===0){ let pamst=[];
this.setState({ let num=0;
checked_notice:true for(var i = 0 ; i<newrolearr.length;i++){
}) if(newrolearr[i]!=""){
return pamst.push(newrolearr[i])
} }else{
num=num+1
}
}
if(value===1&&RadioGroupvalue===undefined){ if(num===2&&value===0){
this.setState({ this.setState({
checked_notice:true checked_notice:true
}) })
return return
} }
if(value===0){ if(value===1&&RadioGroupvalue===undefined){
let url="/courses/join_course_multi_role.json" this.setState({
const form = new FormData(); checked_notice:true
form.append('invite_code', tojoinclasstitle); })
form.append('role', pamst); return
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===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(); if(value===1){
form.append('invite_code', tojoinclasstitle); let url="/api/applied_project/applied_project_info.json"
form.append('member', RadioGroupvalue); const form = new FormData();
form.append('type', 1); form.append('invite_code', tojoinclasstitle);
axios.post(url,form,[true] form.append('member', RadioGroupvalue);
).then((response) => { form.append('type', 1);
if( response.data.status===1){ axios.post(url,form,[true]
this.submitstatevalue(1,"您输入的邀请码错误") ).then((response) => {
}else if( response.data.status===2){ if( response.data.status===1){
this.submitstatevalue( 1,"您已经是该项目成员",response.data.project) this.submitstatevalue(1,"您输入的邀请码错误")
}else if( response.data.status===3){ }else if( response.data.status===2){
this.submitstatevalue( 1,"请选择一个角色") this.submitstatevalue( 1,"您已经是该项目成员",response.data.project)
}else if( response.data.status===4){ }else if( response.data.status===3){
this.submitstatevalue( 1,"您的申请已提交,请等待项目管理员审批") this.submitstatevalue( 1,"请选择一个角色")
}else if( response.data.status===5){ }else if( response.data.status===4){
this.submitstatevalue( 1,"您已经申请加入该项目了,请耐心等待") this.submitstatevalue( 1,"您的申请已提交,请等待项目管理员审批")
}else if( response.data.status===6){ }else if( response.data.status===5){
this.submitstatevalue( 1,"您已成功加入项目",response.data.project) this.submitstatevalue( 1,"您已经申请加入该项目了,请耐心等待")
} }else if( response.data.status===6){
}) this.submitstatevalue( 1,"您已成功加入项目",response.data.project)
}
})
}
} }
}
// trialapplications =()=>{ // trialapplications =()=>{
// console.log("点击了") // console.log("点击了")
@ -486,54 +486,54 @@ submittojoinclass=(value)=>{
}) })
} }
showSearchOpen=(e)=>{ showSearchOpen=(e)=>{
this.setState({ this.setState({
showSearchOpentype:true showSearchOpentype:true
}) })
e.stopPropagation(e);//阻止冒泡 e.stopPropagation(e);//阻止冒泡
} }
hideshowSearchOpen=(e)=>{ hideshowSearchOpen=(e)=>{
let {setevaluatinghides}=this.state; let {setevaluatinghides}=this.state;
if(setevaluatinghides===true){ if(setevaluatinghides===true){
this.setState({ this.setState({
showSearchOpentype:false, showSearchOpentype:false,
setevaluatinghides:false setevaluatinghides:false
}) })
e.stopPropagation(e);//阻止冒泡 e.stopPropagation(e);//阻止冒泡
} }
} }
onKeywordSearchKeyDown = (value) => { onKeywordSearchKeyDown = (value) => {
let url=`/search?value=${value}`; let url=`/search?value=${value}`;
this.props.history.push(url) this.props.history.push(url)
} }
onKeywordSearchKeyDowns=()=>{ onKeywordSearchKeyDowns=()=>{
this.setState( this.setState(
{ {
setevaluatinghides:false setevaluatinghides:false
} }
) )
} }
setevaluatinghides=()=>{ setevaluatinghides=()=>{
this.setState( this.setState(
{ {
setevaluatinghides:true setevaluatinghides:true
} }
) )
} }
//头部获取是否已经登录了 //头部获取是否已经登录了
getUser=(url)=>{ getUser=(url)=>{
console.log("点击了503") console.log("点击了503")
console.log(url); console.log(url);
let{user} =this.state; let{user} =this.state;
if(user===undefined){ if(user===undefined){
this.setState({ this.setState({
isRender:true isRender:true
}) })
return return
} }
if(user&&user.login===""){ if(user&&user.login===""){
this.setState({ this.setState({
@ -572,7 +572,7 @@ submittojoinclass=(value)=>{
submitapplicationsvalue, submitapplicationsvalue,
user, user,
isRender, isRender,
showSearchOpentype, showSearchOpentype,
}=this.state; }=this.state;
/* /*
用户名称 用户头像url 用户名称 用户头像url
@ -603,13 +603,13 @@ submittojoinclass=(value)=>{
<div className="newHeader" id="nHeader" > <div className="newHeader" id="nHeader" >
{isRender===true?<LoginDialog {isRender===true?<LoginDialog
Modifyloginvalue={()=>this.Modifyloginvalue()} Modifyloginvalue={()=>this.Modifyloginvalue()}
{...this.state} {...this.state}
{...this.props} {...this.props}
/>:""} />:""}
<div className="educontent clearfix"> <div className="educontent clearfix">
{/*<%= link_to image_tag("/images/educoder/logo.png", alt:"高校智能化教学与实训平台", className:"logoimg"), home_path %>*/} {/*<%= link_to image_tag("/images/educoder/logo.png", alt:"高校智能化教学与实训平台", className:"logoimg"), home_path %>*/}
<a href="/"> <a href="/">
<img alt="高校智能化教学与实训平台" className="logoimg" src={getImageUrl("images/educoder/headNavLogo.png?1526520218")}></img> <img alt="高校智能化教学与实训平台" className="logoimg" src={getImageUrl("images/educoder/headNavLogo.png?1526520218")}></img>
@ -654,15 +654,15 @@ submittojoinclass=(value)=>{
</div> </div>
</li> </li>
{/*<li className=""><a href={"/libraries"}>教学案例</a></li>*/} {/*<li className=""><a href={"/libraries"}>教学案例</a></li>*/}
<li className=""> <li className="">
<a href={this.props.Headertop===undefined?"":this.props.Headertop.competitions_url}>在线竞赛</a> <a href={this.props.Headertop===undefined?"":this.props.Headertop.competitions_url}>在线竞赛</a>
<img className="roundedRectangles" <img className="roundedRectangles"
src={require('./roundedRectangle.png')} src={require('./roundedRectangle.png')}
/> />
</li> </li>
<li className=""><a href={this.props.Headertop===undefined?"":this.props.Headertop.moop_cases_url}>教学案例</a></li> <li className=""><a href={this.props.Headertop===undefined?"":this.props.Headertop.moop_cases_url}>教学案例</a></li>
<li className=""><a href={this.props.Headertop===undefined?"":this.props.Headertop.crowdsourcing_url}>众包创新</a></li> <li className=""><a href={this.props.Headertop===undefined?"":this.props.Headertop.crowdsourcing_url}>众包创新</a></li>
<li className={`${activeForums === true ? 'active' : ''}`}><a href={this.props.Headertop===undefined?"":this.props.Headertop.topic_url}>交流问答</a></li> <li className={`${activeForums === true ? 'active' : ''}`}><a href={this.props.Headertop===undefined?"":this.props.Headertop.topic_url}>交流问答</a></li>
<li <li
style={{display: this.props.Headertop === undefined ? 'none' : this.props.Headertop.auth===null? 'none' : 'block'}} style={{display: this.props.Headertop === undefined ? 'none' : this.props.Headertop.auth===null? 'none' : 'block'}}
@ -670,37 +670,37 @@ submittojoinclass=(value)=>{
</ul> </ul>
<div className="posi-search" id="posi-search"> <div className="posi-search" id="posi-search">
<div className="search-all clearfix"> <div className="search-all clearfix">
{/*<!--<a href="javascript:void(0)" className="search-clear fl" onclick="closeSearch();">×</a>-->*/} {/*<!--<a href="javascript:void(0)" className="search-clear fl" onclick="closeSearch();">×</a>-->*/}
<div className="fl pr search-clear edu-menu-panel" style={{display: 'none'}}> <div className="fl pr search-clear edu-menu-panel" style={{display: 'none'}}>
<input type="hidden" id="search_type" value="1"></input> <input type="hidden" id="search_type" value="1"></input>
<span className="searchkey">实训</span> <span className="searchkey">实训</span>
<i className="fa fa-angle-down ml5 font-16"></i> <i className="fa fa-angle-down ml5 font-16"></i>
<ul id="searchkey" className="edu-menu-list edu-txt-center" style={{minWidth: '80px',right: '-10px',top: '50px'}}> <ul id="searchkey" className="edu-menu-list edu-txt-center" style={{minWidth: '80px',right: '-10px',top: '50px'}}>
<li><a>实训</a></li> <li><a>实训</a></li>
<li><a>课堂</a></li> <li><a>课堂</a></li>
<li><a>用户</a></li> <li><a>用户</a></li>
</ul> </ul>
</div> </div>
{/*<input type="text" className="search-input fl" id="search-input" */} {/*<input type="text" className="search-input fl" id="search-input" */}
{/*onKeyDown={this.onKeywordSearchKeyDown} name="search_keyword" placeholder="搜索实训项目"/>*/} {/*onKeyDown={this.onKeywordSearchKeyDown} name="search_keyword" placeholder="搜索实训项目"/>*/}
{/*搜索框*/} {/*搜索框*/}
{showSearchOpentype===true?<div className={"HeaderSearch"} onBlur={(e)=>this.hideshowSearchOpen(e)} onMouseLeave={()=>this.setevaluatinghides()}> {showSearchOpentype===true?<div className={"HeaderSearch"} onBlur={(e)=>this.hideshowSearchOpen(e)} onMouseLeave={()=>this.setevaluatinghides()}>
<Search <Search
id={"HeaderSearchs"} id={"HeaderSearchs"}
placeholder="实践课程/翻转课堂/开发社区/交流问答" placeholder="实践课程/翻转课堂/开发社区/交流问答"
onInput={()=>this.onKeywordSearchKeyDowns()} onInput={()=>this.onKeywordSearchKeyDowns()}
onSearch={(value) => this.onKeywordSearchKeyDown(value)} onSearch={(value) => this.onKeywordSearchKeyDown(value)}
// onPressEnter={this.onKeywordSearchKeyDown} // onPressEnter={this.onKeywordSearchKeyDown}
style={{ width: 300 }} style={{ width: 300 }}
autoFocus={true} autoFocus={true}
/> />
</div>:""} </div>:""}
{/*<a className="search-icon fl" id="header_keyword_search" onClick={this.onKeywordSearch}>*/} {/*<a className="search-icon fl" id="header_keyword_search" onClick={this.onKeywordSearch}>*/}
{/*/!*<i className="fa fa-search font-16 mt23 color-grey-6"></i>*!/*/} {/*/!*<i className="fa fa-search font-16 mt23 color-grey-6"></i>*!/*/}
{/*<i className="iconfont icon-sousuo color-blue"></i>*/} {/*<i className="iconfont icon-sousuo color-blue"></i>*/}
{/*</a>*/} {/*</a>*/}
{/* TODO {/* TODO
@ -729,37 +729,37 @@ submittojoinclass=(value)=>{
<em className="vertical-line"></em> <em className="vertical-line"></em>
<a href={"/register"} className="mr5 color-white">注册</a> <a href={"/register"} className="mr5 color-white">注册</a>
</span>: </span>:
<div className="fr edu-menu-panel" style={{height:'60px'}}> <div className="fr edu-menu-panel" style={{height:'60px'}}>
<a href={`/users/${this.props.current_user===undefined?"":this.props.current_user.login}/courses`} className="fl ml15"> <a href={`/users/${this.props.current_user===undefined?"":this.props.current_user.login}/courses`} className="fl ml15">
<img alt="头像" className="radius mt13" height="34" id="nh_user_logo" name="avatar_image" <img alt="头像" className="radius mt13" height="34" id="nh_user_logo" name="avatar_image"
src={getImageUrl(`images/`+user.image_url)} width="34"> src={getImageUrl(`images/`+user.image_url)} width="34">
</img> </img>
</a> </a>
<ul className="edu-menu-list" style={{top:'60px'}}> <ul className="edu-menu-list" style={{top:'60px'}}>
<span className="bor-bottom-greyE currentName task-hide">{user.username}</span> <span className="bor-bottom-greyE currentName task-hide">{user.username}</span>
<li><Link to={`/users/${this.props.current_user===undefined?"":this.props.current_user.login}/courses`}>我的课堂</Link></li> <li><Link to={`/users/${this.props.current_user===undefined?"":this.props.current_user.login}/courses`}>我的课堂</Link></li>
{/* p 老师 l 学生 */} {/* p 老师 l 学生 */}
<li><Link to={`/users/${this.props.current_user===undefined?"":this.props.current_user.login}/shixuns`}>我的实训</Link></li> <li><Link to={`/users/${this.props.current_user===undefined?"":this.props.current_user.login}/shixuns`}>我的实训</Link></li>
<li><Link to={`/users/${this.props.current_user===undefined?"":this.props.current_user.login}/paths`}>我的实践课程</Link></li> <li><Link to={`/users/${this.props.current_user===undefined?"":this.props.current_user.login}/paths`}>我的实践课程</Link></li>
<li><Link to={`/users/${this.props.current_user===undefined?"":this.props.current_user.login}/projects`}>我的项目</Link></li> <li><Link to={`/users/${this.props.current_user===undefined?"":this.props.current_user.login}/projects`}>我的项目</Link></li>
<li><a href={`/account/profile`}>账号管理</a></li> <li><a href={`/account/profile`}>账号管理</a></li>
{/*<li><a onClick={()=>this.educoderlogin()} >登入测试接口</a></li>*/} {/*<li><a onClick={()=>this.educoderlogin()} >登入测试接口</a></li>*/}
{/*<li><a onClick={()=>this.trialapplications()} >试用申请</a> </li>*/} {/*<li><a onClick={()=>this.trialapplications()} >试用申请</a> </li>*/}
{/*<li><Link to={`/interest`}>兴趣页</Link></li>*/} {/*<li><Link to={`/interest`}>兴趣页</Link></li>*/}
<li className="bor-top-greyE"> <li className="bor-top-greyE">
{/*<a href={this.props.Headertop===undefined?"":this.props.Headertop.logout_url}>退出</a>*/} {/*<a href={this.props.Headertop===undefined?"":this.props.Headertop.logout_url}>退出</a>*/}
{/*<a onClick={()=>this.educoderlogin()}>退出</a>*/} {/*<a onClick={()=>this.educoderlogin()}>退出</a>*/}
<a onClick={()=>this.educoderloginysl()}>退出</a> <a onClick={()=>this.educoderloginysl()}>退出</a>
</li> </li>
</ul> </ul>
</div> </div>
} }
{/*href="https://www.educoder.net/login"*/} {/*href="https://www.educoder.net/login"*/}
<div className="fr head-right "> <div className="fr head-right ">
{/*{ loadHeader()}*/} {/*{ loadHeader()}*/}
{showSearchOpentype===true?"":<a id="search-open" className="fl mr30 headIcon" onClick={(e)=>this.showSearchOpen(e)}> {showSearchOpentype===true?"":<a id="search-open" className="fl mr30 headIcon" onClick={(e)=>this.showSearchOpen(e)}>
{/*"/images/educoder/icon/search.svg" {/*"/images/educoder/icon/search.svg"
<img src={getImageUrl(`images/educoder/icon/search.svg`)} /> */} <img src={getImageUrl(`images/educoder/icon/search.svg`)} /> */}
@ -775,7 +775,7 @@ submittojoinclass=(value)=>{
<div className="edu-menu-list" style={{top: '60px',width:"240px"}}> <div className="edu-menu-list" style={{top: '60px',width:"240px"}}>
<div className="overPart"></div> <div className="overPart"></div>
<ul className="fl with50 edu-txt-center pr ul-leftline"> <ul className="fl with50 edu-txt-center pr ul-leftline">
{this.props.current_user&&this.props.current_user.user_identity==="学生"?"":<li><a onClick={(url)=>this.getUser("/courses/new")}>新建课堂</a></li>} {this.props.current_user&&this.props.current_user.user_identity==="学生"?"":<li><a onClick={(url)=>this.getUser("/courses/new")}>新建课堂</a></li>}
<li><a onClick={(url)=>this.getUser("/shixuns/new")}>新建实训</a></li> <li><a onClick={(url)=>this.getUser("/shixuns/new")}>新建实训</a></li>
{this.props.Headertop===undefined?"": {this.props.Headertop===undefined?"":
<li><a onClick={(url)=>this.getUser("/paths/new")} >新建实践课程</a></li> <li><a onClick={(url)=>this.getUser("/paths/new")} >新建实践课程</a></li>
@ -789,9 +789,9 @@ submittojoinclass=(value)=>{
</li> </li>
{Addcoursestypes===true?<Addcourses {Addcoursestypes===true?<Addcourses
Addcoursestype={Addcoursestypes} Addcoursestype={Addcoursestypes}
hideAddcoursestype={this.hideAddcoursestypes} hideAddcoursestype={this.hideAddcoursestypes}
/>:""} />:""}
{/* /courses/join_course_multi_role */} {/* /courses/join_course_multi_role */}
<li> <li>
@ -810,7 +810,7 @@ submittojoinclass=(value)=>{
<li className="clearfix mb10"> <li className="clearfix mb10">
<label className="panel-form-label fl">项目邀请码</label> <label className="panel-form-label fl">项目邀请码</label>
<Input type="text" className="input-60-40 fl mt5" name="invite_code" <Input type="text" className="input-60-40 fl mt5" name="invite_code"
style={{width: '275px'}} style={{width: '275px'}}
placeholder="请输入6位项目邀请码" value={tojoinclasstitle} onInput={this.inputjoinclassvalue}/> placeholder="请输入6位项目邀请码" value={tojoinclasstitle} onInput={this.inputjoinclassvalue}/>
</li> </li>
@ -848,7 +848,7 @@ submittojoinclass=(value)=>{
</div> </div>
</div> </div>
<div className="fl mr30 edu-menu-panel headIcon"> <div className="fl mr30 edu-menu-panel headIcon">
{ user===undefined?"":user.login===""?"": <a { user===undefined?"":user.login===""?"": <a
href={this.props.Headertop===undefined?"":this.props.Headertop.message_url} href={this.props.Headertop===undefined?"":this.props.Headertop.message_url}
style={{position:'relative'}} style={{position:'relative'}}

Loading…
Cancel
Save