diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js index 4c5496ad5..3398d6763 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js @@ -1535,8 +1535,8 @@ class GraduationTaskssettinglist extends Component{ return( {item==="提交作品"?提交作品:""} - {item==="修改作品"?修改作品:""} - {item==="查看作品"?查看作品 :""} + {item==="修改作品"?修改作品:""} + {item==="查看作品"?查看作品 :""} {item==="创建项目"?创建项目:""} {item==="关联项目"?关联项目:""} {item==="取消关联"?取消关联:""} diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index 9dd0441de..3ef02578a 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -1,921 +1,920 @@ -import React, { Component } from 'react'; -import { BrowserRouter as Router, Route, Link } from "react-router-dom"; -import { Redirect } from 'react-router'; - -import PropTypes from 'prop-types'; - -// import searchImg from '../../../../images/educoder/icon/search.svg' - -// /images/educoder/icon/search.svg - -import { getImageUrl, toPath } from 'educoder' - -import axios from 'axios'; - -import { Modal,Checkbox ,Radio,Input,message } from 'antd'; - -import Addcourses from '../courses/coursesPublic/Addcourses'; - -import LoginDialog from '../login/LoginDialog'; - -import Trialapplication from '../login/Trialapplication' - -import 'antd/lib/modal/style/index.css'; - -import 'antd/lib/checkbox/style/index.css'; - -import 'antd/lib/radio/style/index.css'; - -import 'antd/lib/input/style/index.css'; - -import './TPMIndex.css' - -import { trigger, broadcastChannelPostMessage } from 'educoder'; - -const $ = window.$ -// TODO 这部分脚本从公共脚本中直接调用 - -const RadioGroup = Radio.Group; -const Search = Input.Search; -let old_url; -function loadHeader(){ - //头部导航条的----------显示搜索框 - $("#search-open").on("click",function(e){ - $(this).hide(); - // $("#header-nav").animate({opacity:"0"},1000); - $(".posi-search").show() // animate({opacity:"1"},1000); - $("#header-nav").css("z-index","2"); - $(".posi-search").css("z-index","3"); - $(".HeaderSearch").show(); - $(".HeaderSearch").val(""); - $(".search-input").focus(); - $(".search-all .search-content").hide(); - e.stopPropagation();//阻止冒泡 - }); - $(".HeaderSearch").on("click",function(e){ - e.stopPropagation();//阻止冒泡 - }); - //搜索框输入内容 - $(".HeaderSearch").on("input",function(e){ - if($(".HeaderSearch").val()==""){ - $(".search-all .search-content").hide(); - }else{ - $(".search-all .search-content").show(); - } - e.stopPropagation();//阻止冒泡 - }); - //搜索 - // $("#header_keyword_search").on("click", header_search); - // $("input[name='search_keyword']").on("keydown", function(event){ - // var code; - // if (!event) { - // event = window.event; //针对ie浏览器 - // code = event.keyCode; - // } - // else { - // code = event.keyCode; - // } - // if(code == 13) { - // header_search(); - // return false; - // } - // }); - $(".search-clear").click(function(e){e.stopPropagation();}); - //切换搜索条件 - $("#searchkey li").click(function(e){ - var key=$($(this).children("a")[0]).html(); - switch (key){ - case '实训': - $("#search_type").val('1'); - break; - case '课堂': - $("#search_type").val('2'); - break; - case '用户': - $("#search_type").val('3'); - break; - } - $("#searchkey").siblings(".searchkey").html(key); - $("#searchkey").hide(); - e.stopPropagation();//阻止冒泡 - }); - //切换选择导航条 - $("#header-nav li").click(function(){ - $("#header-nav li").removeClass("active"); - $(this).addClass("active"); - }); - //点击页面其它(与搜索框无关的地方)都会将搜索框隐藏,所以与搜索框有关的地方需要阻止冒泡 - $("body").on("click",function(){ - closeSearch(); - }); - - $(".search_history").on("click", function(){ - $("input[name='search_keyword']").val($(this).html()); - header_search(); - }); -} - -function header_search(reactHeaderComponnet){ - console.log(old_url) - var keyword = $("input[name='search_keyword']").val(); // 搜索关键字 - if (!reactHeaderComponnet) { - reactHeaderComponnet = window._header_componentHandler - } - if (!reactHeaderComponnet) { - var index = $("#search_type").val(); // 搜索课程/项目 - keyword = encodeURIComponent(keyword); - // $.get('/users/search_shixuns_or_course', - // { search: keyword, - // index: index}); - window.location.href = old_url+"/users/search_shixuns_or_courses" + "?search=" + keyword + "&index=" + index; - //e.stopPropagation();//阻止冒泡 - } else { - window.__headSearchKeyword = keyword - reactHeaderComponnet.props.history.push(`/shixuns`) - trigger('searchKeywordChange', keyword) - } -} -//头部导航条的隐藏 -function closeSearch(){ - $('#posi-search').hide(); - $("#search-open").show(); - // $(".posi-search").animate({opacity:"0"},800); - $(".HeaderSearch").hide(); - $("#header-nav").animate({opacity:"1"},1000); - $(".posi-search").css("z-index","2"); - $("#header-nav").css("z-index","3"); -} - -/* - _logined_header.html.erb - _unlogin_header.html.erb -*/ -window._header_componentHandler = null; -class NewHeader extends Component { - constructor(props) { - super(props) - this.state={ - Addcoursestypes:false, - tojoinitemtype:false, - tojoinclasstitle:undefined, - rolearr:["",""], - Checkboxteacherchecked:false, - Checkboxstudentchecked:false, - Checkboxteachingchecked:false, - Checkboxteachertype:false, - Checkboxteachingtype:false, - code_notice:false, - checked_notice:false, - RadioGroupvalue:undefined, - submitapplications:false, - isRender:false, - isRenders:false, - user:undefined, - } - } - - componentDidMount() { - window._header_componentHandler = this; - - loadHeader(); - - //下拉框的显示隐藏 - var hoverTimeout; - var hoveredPanel; - $(".edu-menu-panel").hover(function(){ - if (hoverTimeout) { // 一次只显示一个panel - if (hoveredPanel && hoveredPanel != this) { - $(hoveredPanel).find(".edu-menu-list").hide() - } - clearTimeout(hoverTimeout); - hoverTimeout = null; - } - hoveredPanel = this; - $(this).find(".edu-menu-list").show(); - },function(){ - var that =this; - // 延迟hide - hoverTimeout = setTimeout(function() { - $(that).find(".edu-menu-list").hide(); - }, 800) - - }); - - - - } - - - componentWillReceiveProps(newProps, oldProps) { - this.setState({ - user:newProps.user - }) - if(newProps.Headertop!=undefined){ - old_url=newProps.Headertop.old_url - } - - } - getCookie=(key)=>{ - var arr,reg = RegExp('(^| )'+key+'=([^;]+)(;|$)'); - if (arr = document.cookie.match(reg)) //["username=liuwei;", "", "liuwei", ";"] - return decodeURIComponent(arr[2]); - else - return null; - } - - delCookie=(name)=>{ - var exp = new Date(); - exp.setTime(exp.getTime() - 1); - var cval=this.getCookie(name); - if(cval!=null){ - document.cookie= name + "="+cval+";expires="+exp.toGMTString(); - } - } - onLogout = () => { - const url = `/accounts/logout.json` - this.delCookie("autologin_trustie") - axios.get(url, { - }) - .then((response) => { - if(response.data.status===1){ - this.setState({ - user:undefined - }) - // let path="/"; - // this.props.history.push(path); - broadcastChannelPostMessage('refreshPage') - window.location.href ="/login" - message.success('退出成功'); - } - }); - } - - tojoinclass=()=>{ - this.setState({ - Addcoursestypes:true, - }) - } - - tojoinitem=()=>{ - this.setState({ - tojoinitemtype:true - }) - } - - - submitstatevalue=(sum,value,data)=>{ - this.setState({ - Addcoursestypes:false, - tojoinitemtype:false, - tojoinclasstitle:undefined, - rolearr:["",""], - Checkboxteacherchecked:false, - Checkboxstudentchecked:false, - Checkboxteachingchecked:false, - Checkboxteachertype:false, - Checkboxteachingtype:false, - code_notice:false, - checked_notice:false, - submitapplicationssum:sum, - submitapplications:true, - submitapplicationsvalue:value, - submitapplicationsvaluedata:data, - RadioGroupvalue:undefined - }) - } - - onChangeRadioGroup = (e) => { - this.setState({ - RadioGroupvalue: e.target.value, - }); - } - - submitsubmitapplications=()=>{ - let { - submitapplicationssum, - submitapplicationsvaluedata - }=this.state; - this.setState({ - submitapplications:false, - RadioGroupvalue:undefined - }) - if(submitapplicationssum===0){ - if(submitapplicationsvaluedata!=undefined){ - window.location.href = "https://www.educoder.net/courses/"+submitapplicationsvaluedata; - } - }else if(submitapplicationssum===1){ - if(submitapplicationsvaluedata!=undefined){ - window.location.href = "https://www.educoder.net/projects/"+submitapplicationsvaluedata; - } - } - } - - hidesubmitapplications=()=>{ - this.setState({ - Addcoursestypes:false, - tojoinitemtype:false, - tojoinclasstitle:undefined, - rolearr:["",""], - Checkboxteacherchecked:false, - Checkboxstudentchecked:false, - Checkboxteachingchecked:false, - Checkboxteachertype:false, - Checkboxteachingtype:false, - code_notice:false, - checked_notice:false, - submitapplications:false, - RadioGroupvalue:undefined - }) - } - educoderlogin=()=>{ - //登出账号 - var url = `/accounts/logout.json`; - - axios.get((url)).then((result) => { - if(result!==undefined){ - this.setState({ - isRender:true - }) - } - }).catch((error) => { - console.log(error); - }) - } - - onKeywordSearch = () => { - header_search(this) - } - onKeywordSearchKeyDown = (e) => { - let code = e.keyCode; - - if(code == 13) { - header_search(this); - return false; - } - } - - hideAddcoursestypes=()=>{ - - this.setState({ - Addcoursestypes:false - }) - - } - - - hidetojoinclass=()=>{ - this.setState({ - tojoinclasstype:false, - tojoinitemtype:false, - tojoinclasstitle:undefined, - rolearr:["",""], - Checkboxteacherchecked:false, - Checkboxstudentchecked:false, - Checkboxteachingchecked:false, - Checkboxteachertype:false, - Checkboxteachingtype:false, - code_notice:false, - checked_notice:false, - RadioGroupvalue:undefined - }) - } - -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){ - 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 - }) - } - - 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===1){ - let url="https://www.educoder.net/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 =()=>{ - this.setState({ - isRenders: true, - }) - } - - - - render() { - const isLogin = true; // 这里不会出现未登录的情况,服务端在服务端路由时发现如果是未登录,则跳转到登录页了。 - const {match ,} = this.props; - - let {Addcoursestypes, - tojoinitemtype, - tojoinclasstitle, - Checkboxteacherchecked, - Checkboxstudentchecked, - Checkboxteachingchecked, - Checkboxteachertype, - Checkboxteachingtype, - code_notice, - checked_notice, - RadioGroupvalue, - submitapplications, - submitapplicationsvalue, - user, - isRenders, - isRender, - }=this.state; - /* - 用户名称 用户头像url - */ - let activeIndex = false; - let activeForums = false; - let activeShixuns = false; - let activePaths = false; - let coursestype=false; - - if (match.path === '/forums') { - activeForums = true; - } else if (match.path.startsWith('/shixuns')) { - activeShixuns = true; - }else if (match.path.startsWith('/paths')) { - activePaths = true; - } else if (match.path.startsWith('/courses')) { - coursestype = true; - }else { - activeIndex = true; - } - - // join_course_url: "https://www.educoder.net/courses/join_course_multi_role" - // join_project_url: "https://www.educoder.net/applied_project/applied_project_info" - // rolearr:["",""], - console.log() - return ( - -
- {/*{*/} - {/* isRender&& isRender === true?*/} - - {/* :""*/} - {/*}*/} - - { - isRenders&&isRenders===true? - - :"" - } - -
- {/*<%= link_to image_tag("/images/educoder/logo.png", alt:"高校智能化教学与实训平台", className:"logoimg"), home_path %>*/} - - 高校智能化教学与实训平台 - -
- - - - - - -
- - {/* - <%= link_to '登录', signin_path, :className => "mr5" %> - - <%= link_to '注册', user_join_path, :className => "ml5" %> - */} - { user===undefined? - - this.educoderlogin()} className="mr5 color-white">登录 - - 注册 - :user.login===""? - this.educoderlogin()} className="mr5 color-white">登录 - - 注册 - : - - } - {/*href="https://www.educoder.net/login"*/} - { user===undefined?"":user.login===""?"":*/} -
- - - - -
-
- - -
-
- - - - -
-
-
    -
    -

    - {submitapplicationsvalue} -

    -
    -
  • - 取消 - 确定 -
  • - -
-
-
-
- -
} -
- - - ); - } -} - -export default NewHeader; - - - -// - - - -{/*{*/} -{/**/} -{/**/} -{/*/!*{this.props.Headertop===undefined?"":this.props.Headertop.unread_message_count > 99 ? '99+'*!/*/} -{/*/!*: this.props.Headertop===undefined?"":this.props.Headertop.unread_message_count}*!/*/} -{/**/} -{/**/} -{/*}*/} -{/*{ this.props.Headertop===undefined?"":this.props.Headertop.unread_message_count>0 &&*/} -{/**/} -{/**/} -{/*/!*{this.props.Headertop===undefined?"":this.props.Headertop.unread_message_count > 99 ? '99+'*!/*/} -{/*/!*: this.props.Headertop===undefined?"":this.props.Headertop.unread_message_count}*!/*/} -{/**/} -{/*}*/} -{/*{ this.props.Headertop===undefined?"":user && this.props.Headertop.unread_message_count>0 &&*/} -{/**/} -{/*
*/} -{/*您有*/} -{/*{this.props.Headertop===undefined?"":this.props.Headertop.unread_message_count}*/} -{/*条新消息,点击查看*/} -{/*
*/} -{/*
*/} -{/*}*/} - - - -{/* - 需求:消息数量 -
- - - -
- - 您有30条新消息,点击查看 - -
-
- */} +import React, { Component } from 'react'; +import { BrowserRouter as Router, Route, Link } from "react-router-dom"; +import { Redirect } from 'react-router'; + +import PropTypes from 'prop-types'; + +// import searchImg from '../../../../images/educoder/icon/search.svg' + +// /images/educoder/icon/search.svg + +import { getImageUrl, toPath } from 'educoder' + +import axios from 'axios'; + +import { Modal,Checkbox ,Radio,Input,message } from 'antd'; + +import Addcourses from '../courses/coursesPublic/Addcourses'; + +import LoginDialog from '../login/LoginDialog'; + +// import Trialapplication from '../login/Trialapplication' + +import 'antd/lib/modal/style/index.css'; + +import 'antd/lib/checkbox/style/index.css'; + +import 'antd/lib/radio/style/index.css'; + +import 'antd/lib/input/style/index.css'; + +import './TPMIndex.css' + +import { trigger, broadcastChannelPostMessage } from 'educoder'; + +const $ = window.$ +// TODO 这部分脚本从公共脚本中直接调用 + +const RadioGroup = Radio.Group; +const Search = Input.Search; +let old_url; +function loadHeader(){ + //头部导航条的----------显示搜索框 + $("#search-open").on("click",function(e){ + $(this).hide(); + // $("#header-nav").animate({opacity:"0"},1000); + $(".posi-search").show() // animate({opacity:"1"},1000); + $("#header-nav").css("z-index","2"); + $(".posi-search").css("z-index","3"); + $(".HeaderSearch").show(); + $(".HeaderSearch").val(""); + $(".search-input").focus(); + $(".search-all .search-content").hide(); + e.stopPropagation();//阻止冒泡 + }); + $(".HeaderSearch").on("click",function(e){ + e.stopPropagation();//阻止冒泡 + }); + //搜索框输入内容 + $(".HeaderSearch").on("input",function(e){ + if($(".HeaderSearch").val()==""){ + $(".search-all .search-content").hide(); + }else{ + $(".search-all .search-content").show(); + } + e.stopPropagation();//阻止冒泡 + }); + //搜索 + // $("#header_keyword_search").on("click", header_search); + // $("input[name='search_keyword']").on("keydown", function(event){ + // var code; + // if (!event) { + // event = window.event; //针对ie浏览器 + // code = event.keyCode; + // } + // else { + // code = event.keyCode; + // } + // if(code == 13) { + // header_search(); + // return false; + // } + // }); + $(".search-clear").click(function(e){e.stopPropagation();}); + //切换搜索条件 + $("#searchkey li").click(function(e){ + var key=$($(this).children("a")[0]).html(); + switch (key){ + case '实训': + $("#search_type").val('1'); + break; + case '课堂': + $("#search_type").val('2'); + break; + case '用户': + $("#search_type").val('3'); + break; + } + $("#searchkey").siblings(".searchkey").html(key); + $("#searchkey").hide(); + e.stopPropagation();//阻止冒泡 + }); + //切换选择导航条 + $("#header-nav li").click(function(){ + $("#header-nav li").removeClass("active"); + $(this).addClass("active"); + }); + //点击页面其它(与搜索框无关的地方)都会将搜索框隐藏,所以与搜索框有关的地方需要阻止冒泡 + $("body").on("click",function(){ + closeSearch(); + }); + + $(".search_history").on("click", function(){ + $("input[name='search_keyword']").val($(this).html()); + header_search(); + }); +} + +function header_search(reactHeaderComponnet){ + console.log(old_url) + var keyword = $("input[name='search_keyword']").val(); // 搜索关键字 + if (!reactHeaderComponnet) { + reactHeaderComponnet = window._header_componentHandler + } + if (!reactHeaderComponnet) { + var index = $("#search_type").val(); // 搜索课程/项目 + keyword = encodeURIComponent(keyword); + // $.get('/users/search_shixuns_or_course', + // { search: keyword, + // index: index}); + window.location.href = old_url+"/users/search_shixuns_or_courses" + "?search=" + keyword + "&index=" + index; + //e.stopPropagation();//阻止冒泡 + } else { + window.__headSearchKeyword = keyword + reactHeaderComponnet.props.history.push(`/shixuns`) + trigger('searchKeywordChange', keyword) + } +} +//头部导航条的隐藏 +function closeSearch(){ + $('#posi-search').hide(); + $("#search-open").show(); + // $(".posi-search").animate({opacity:"0"},800); + $(".HeaderSearch").hide(); + $("#header-nav").animate({opacity:"1"},1000); + $(".posi-search").css("z-index","2"); + $("#header-nav").css("z-index","3"); +} + +/* + _logined_header.html.erb + _unlogin_header.html.erb +*/ +window._header_componentHandler = null; +class NewHeader extends Component { + constructor(props) { + super(props) + this.state={ + Addcoursestypes:false, + tojoinitemtype:false, + tojoinclasstitle:undefined, + rolearr:["",""], + Checkboxteacherchecked:false, + Checkboxstudentchecked:false, + Checkboxteachingchecked:false, + Checkboxteachertype:false, + Checkboxteachingtype:false, + code_notice:false, + checked_notice:false, + RadioGroupvalue:undefined, + submitapplications:false, + isRender:false, + isRenders:false, + user:undefined, + } + } + + componentDidMount() { + window._header_componentHandler = this; + + loadHeader(); + + //下拉框的显示隐藏 + var hoverTimeout; + var hoveredPanel; + $(".edu-menu-panel").hover(function(){ + if (hoverTimeout) { // 一次只显示一个panel + if (hoveredPanel && hoveredPanel != this) { + $(hoveredPanel).find(".edu-menu-list").hide() + } + clearTimeout(hoverTimeout); + hoverTimeout = null; + } + hoveredPanel = this; + $(this).find(".edu-menu-list").show(); + },function(){ + var that =this; + // 延迟hide + hoverTimeout = setTimeout(function() { + $(that).find(".edu-menu-list").hide(); + }, 800) + + }); + + + + } + + + componentWillReceiveProps(newProps, oldProps) { + this.setState({ + user:newProps.user + }) + if(newProps.Headertop!=undefined){ + old_url=newProps.Headertop.old_url + } + + } + getCookie=(key)=>{ + var arr,reg = RegExp('(^| )'+key+'=([^;]+)(;|$)'); + if (arr = document.cookie.match(reg)) //["username=liuwei;", "", "liuwei", ";"] + return decodeURIComponent(arr[2]); + else + return null; + } + + delCookie=(name)=>{ + var exp = new Date(); + exp.setTime(exp.getTime() - 1); + var cval=this.getCookie(name); + if(cval!=null){ + document.cookie= name + "="+cval+";expires="+exp.toGMTString(); + } + } + onLogout = () => { + const url = `/accounts/logout.json` + this.delCookie("autologin_trustie") + axios.get(url, { + }) + .then((response) => { + if(response.data.status===1){ + this.setState({ + user:undefined + }) + // let path="/"; + // this.props.history.push(path); + broadcastChannelPostMessage('refreshPage') + window.location.href ="/login" + message.success('退出成功'); + } + }); + } + + tojoinclass=()=>{ + this.setState({ + Addcoursestypes:true, + }) + } + + tojoinitem=()=>{ + this.setState({ + tojoinitemtype:true + }) + } + + + submitstatevalue=(sum,value,data)=>{ + this.setState({ + Addcoursestypes:false, + tojoinitemtype:false, + tojoinclasstitle:undefined, + rolearr:["",""], + Checkboxteacherchecked:false, + Checkboxstudentchecked:false, + Checkboxteachingchecked:false, + Checkboxteachertype:false, + Checkboxteachingtype:false, + code_notice:false, + checked_notice:false, + submitapplicationssum:sum, + submitapplications:true, + submitapplicationsvalue:value, + submitapplicationsvaluedata:data, + RadioGroupvalue:undefined + }) + } + + onChangeRadioGroup = (e) => { + this.setState({ + RadioGroupvalue: e.target.value, + }); + } + + submitsubmitapplications=()=>{ + let { + submitapplicationssum, + submitapplicationsvaluedata + }=this.state; + this.setState({ + submitapplications:false, + RadioGroupvalue:undefined + }) + if(submitapplicationssum===0){ + if(submitapplicationsvaluedata!=undefined){ + window.location.href = "https://www.educoder.net/courses/"+submitapplicationsvaluedata; + } + }else if(submitapplicationssum===1){ + if(submitapplicationsvaluedata!=undefined){ + window.location.href = "https://www.educoder.net/projects/"+submitapplicationsvaluedata; + } + } + } + + hidesubmitapplications=()=>{ + this.setState({ + Addcoursestypes:false, + tojoinitemtype:false, + tojoinclasstitle:undefined, + rolearr:["",""], + Checkboxteacherchecked:false, + Checkboxstudentchecked:false, + Checkboxteachingchecked:false, + Checkboxteachertype:false, + Checkboxteachingtype:false, + code_notice:false, + checked_notice:false, + submitapplications:false, + RadioGroupvalue:undefined + }) + } + educoderlogin=()=>{ + //登出账号 + var url = `/accounts/logout.json`; + + axios.get((url)).then((result) => { + if(result!==undefined){ + this.setState({ + isRender:true + }) + } + }).catch((error) => { + console.log(error); + }) + } + + onKeywordSearch = () => { + header_search(this) + } + onKeywordSearchKeyDown = (e) => { + let code = e.keyCode; + + if(code == 13) { + header_search(this); + return false; + } + } + + hideAddcoursestypes=()=>{ + + this.setState({ + Addcoursestypes:false + }) + + } + + + hidetojoinclass=()=>{ + this.setState({ + tojoinclasstype:false, + tojoinitemtype:false, + tojoinclasstitle:undefined, + rolearr:["",""], + Checkboxteacherchecked:false, + Checkboxstudentchecked:false, + Checkboxteachingchecked:false, + Checkboxteachertype:false, + Checkboxteachingtype:false, + code_notice:false, + checked_notice:false, + RadioGroupvalue:undefined + }) + } + +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){ + 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 + }) + } + + 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===1){ + let url="https://www.educoder.net/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 =()=>{ + // this.setState({ + // isRenders: true, + // }) + // } + + + + render() { + const isLogin = true; // 这里不会出现未登录的情况,服务端在服务端路由时发现如果是未登录,则跳转到登录页了。 + const {match ,} = this.props; + + let {Addcoursestypes, + tojoinitemtype, + tojoinclasstitle, + Checkboxteacherchecked, + Checkboxstudentchecked, + Checkboxteachingchecked, + Checkboxteachertype, + Checkboxteachingtype, + code_notice, + checked_notice, + RadioGroupvalue, + submitapplications, + submitapplicationsvalue, + user, + isRender, + }=this.state; + /* + 用户名称 用户头像url + */ + let activeIndex = false; + let activeForums = false; + let activeShixuns = false; + let activePaths = false; + let coursestype=false; + + if (match.path === '/forums') { + activeForums = true; + } else if (match.path.startsWith('/shixuns')) { + activeShixuns = true; + }else if (match.path.startsWith('/paths')) { + activePaths = true; + } else if (match.path.startsWith('/courses')) { + coursestype = true; + }else { + activeIndex = true; + } + + // join_course_url: "https://www.educoder.net/courses/join_course_multi_role" + // join_project_url: "https://www.educoder.net/applied_project/applied_project_info" + // rolearr:["",""], + console.log() + return ( + +
+ {/*{*/} + {/* isRender&& isRender === true?*/} + + {/* :""*/} + {/*}*/} + + {/*{*/} + {/* isRenders&&isRenders===true?*/} + {/* */} + {/* :""*/} + {/*}*/} + +
+ {/*<%= link_to image_tag("/images/educoder/logo.png", alt:"高校智能化教学与实训平台", className:"logoimg"), home_path %>*/} + + 高校智能化教学与实训平台 + +
+ + + + + + +
+ + {/* + <%= link_to '登录', signin_path, :className => "mr5" %> + + <%= link_to '注册', user_join_path, :className => "ml5" %> + */} + { user===undefined? + + this.educoderlogin()} className="mr5 color-white">登录 + + 注册 + :user.login===""? + this.educoderlogin()} className="mr5 color-white">登录 + + 注册 + : + + } + {/*href="https://www.educoder.net/login"*/} + { user===undefined?"":user.login===""?"":*/} +
+ + + + +
+
+ + +
+
+ + + + +
+
+
    +
    +

    + {submitapplicationsvalue} +

    +
    +
  • + 取消 + 确定 +
  • + +
+
+
+
+ +
} +
+ + + ); + } +} + +export default NewHeader; + + + +//
    +//
  • 1{/*<%= link_to "首页", home_path %>*/}
  • +//
  • 2{/*<%= link_to "精选实训", shixuns_path %>*/}
  • +//
  • 3{/*<%= link_to "实训路径", subjects_path %>*/}
  • +//
  • 4{/*<%= link_to "在线课堂", courses_path %>*/}
  • +//
  • 5{/*<%= link_to "讨论组", forums_path %>*/}
  • +//
+ + + +{/*{*/} +{/**/} +{/**/} +{/*/!*{this.props.Headertop===undefined?"":this.props.Headertop.unread_message_count > 99 ? '99+'*!/*/} +{/*/!*: this.props.Headertop===undefined?"":this.props.Headertop.unread_message_count}*!/*/} +{/**/} +{/**/} +{/*}*/} +{/*{ this.props.Headertop===undefined?"":this.props.Headertop.unread_message_count>0 &&*/} +{/**/} +{/**/} +{/*/!*{this.props.Headertop===undefined?"":this.props.Headertop.unread_message_count > 99 ? '99+'*!/*/} +{/*/!*: this.props.Headertop===undefined?"":this.props.Headertop.unread_message_count}*!/*/} +{/**/} +{/*}*/} +{/*{ this.props.Headertop===undefined?"":user && this.props.Headertop.unread_message_count>0 &&*/} +{/**/} +{/*
*/} +{/*您有*/} +{/*{this.props.Headertop===undefined?"":this.props.Headertop.unread_message_count}*/} +{/*条新消息,点击查看*/} +{/*
*/} +{/*
*/} +{/*}*/} + + + +{/* + 需求:消息数量 +
+ + + +
+ + 您有30条新消息,点击查看 + +
+
+ */}