From cc82615959a59363e35e2d2acb382a48fc6fa9d4 Mon Sep 17 00:00:00 2001 From: ysl <904079904@qq.com> Date: Fri, 21 Jun 2019 09:10:26 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tasks/GraduationTaskssettinglist.js | 4 +- public/react/src/modules/tpm/NewHeader.js | 1841 ++++++++--------- 2 files changed, 922 insertions(+), 923 deletions(-) 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条新消息,点击查看 + +
+
+ */} From 6b7cf4217cd66978be011ee4b750bab9d1d2c3c1 Mon Sep 17 00:00:00 2001 From: ysl <904079904@qq.com> Date: Fri, 21 Jun 2019 11:30:07 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/App.js | 3 +- .../tasks/GraduationTaskssettinglist.js | 3 +- .../src/modules/login/Trialapplication.js | 1065 +++++++++-------- public/react/src/modules/tpm/NewHeader.js | 13 +- 4 files changed, 589 insertions(+), 495 deletions(-) diff --git a/public/react/src/App.js b/public/react/src/App.js index f22ba14dd..d4c70e6aa 100644 --- a/public/react/src/App.js +++ b/public/react/src/App.js @@ -241,6 +241,7 @@ class App extends Component { render() { // let {isRenders} = this.state; + return ( @@ -254,7 +255,7 @@ class App extends Component { {/*{*/} {/* isRenders === true?*/} - + {/**/} {/*:""*/} {/*}*/} diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js index bfc7f361e..2f5b10f8f 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js @@ -1550,7 +1550,8 @@ class GraduationTaskssettinglist extends Component{ {taskslistdata.work_status===undefined?"":taskslistdata.work_status.map((item,key)=>{ return( - {item==="提交作品"?提交作品:""} + {item==="提交作品"?提交作品:""} + {item==="补交作品"?补交作品:""} {item==="修改作品"?修改作品:""} {item==="查看作品"?查看作品 :""} {item==="创建项目"?创建项目:""} diff --git a/public/react/src/modules/login/Trialapplication.js b/public/react/src/modules/login/Trialapplication.js index 9c9f0280b..a0903021a 100644 --- a/public/react/src/modules/login/Trialapplication.js +++ b/public/react/src/modules/login/Trialapplication.js @@ -1,10 +1,10 @@ import React, {Component} from 'react'; import {Redirect} from 'react-router'; import Dialog, { - DialogActions, - DialogContent, - DialogContentText, - DialogTitle, + DialogActions, + DialogContent, + DialogContentText, + DialogTitle, } from 'material-ui/Dialog'; import axios from 'axios'; @@ -14,343 +14,397 @@ import {Tabs, Input, Checkbox, Button, notification, Menu} from 'antd'; //试用申请页面 class Trialapplication extends Component { - // isRender控制弹出窗口显示 - constructor(props) { - super(props) - this.state = { - props:props, - login: "", - Phonenumberisnotcocodes:undefined, - codes: "", - reason: "", - Phonenumberisnotcoreason:undefined, - isRenders:false, - seconds: 60, - getverificationcodes: true, - Phonenumberisnotco: undefined, - Phonenumberisnotcobool: false, - readonlyInput: true, - } - // - console.log("Trialapplication"); - console.log(props); - } - - - componentWillReceiveProps(nextProps) { - - // this.setState({ - // isRenders:nextProps.isRenders - // }) - // console.log("componentWillReceiveProps"); - // console.log(nextProps); - } - //初始化数据 - componentDidMount() { - - if (this.props.isRenders != undefined) { - this.setState({ - isRenders: this.props.isRenders - }) - } - - axios.interceptors.response.use((response) => { - if(response!=undefined) - if (response&&response.data.status === 407) { - this.setState({ - isRenders: true - }) - } - return response; - }, (error) => { - // // if (error.response && error.response.data.error === '401 Unauthorized') { - // // this.back_url = window.location.href; - // // this.setState({ - // // isRender: true - // // }) - // // // TODO 这里如果样式变了会出现css不加载的情况 - // // const $ = window.$; - // // const isCssLoaded = window.getComputedStyle($('.log_nav li.active')[0], null) - // // .getPropertyValue('border-bottom') - // // == "2px solid rgb(69, 155, 229)" - // // if (!isCssLoaded) { - // // const isPort3007 = window.location.port == 3007; - // // let _url_origin = isPort3007 ? 'http://localhost:3000' : '' - // // - // // $('head').append( $('') - // // .attr('href', `${_url_origin}/stylesheets/educoder/edu-main.css`) ); - // // $('head').append( $('') - // // .attr('href', `${_url_origin}/stylesheets/educoder/edu-all.css`) ); - // // } - // // } - // // return Promise.reject(error); - }); - } - - //获取登入 - loginInputonChange = (e) => { - // console.log(e.target.value); - this.setState({ - login: e.target.value, - }) - - - } - //获取申请理由 - loginInputonChanges = (e) => { - // console.log(e.target.value); - this.setState({ - reason: e.target.value, - Phonenumberisnotcoreason:undefined, - }) - - - } - //获取code - codesonChange = (e) => { - this.setState({ - codes: e.target.value, - Phonenumberisnotcocodes:undefined, - }) - } - - openNotification = (messge) => { - notification.open({ - message: "提示", - description: - messge, - onClick: () => { - console.log('Notification Clicked!'); - }, - }); - }; - //倒计时 - getverificationcode = () => { - if (this.state.Phonenumberisnotcobool === false) { - if (this.state.login.length === 0) { - this.setState({ - Phonenumberisnotco: "请输入正确的手机号或邮箱", - }) - return - } else { - this.setState({ - Phonenumberisnotco: "请输入正确的手机号或邮箱", - }) - } - return; - } - if (this.state.getverificationcodes === true) { - this.setState({ - getverificationcodes: undefined, - }) - let timer = setInterval(() => { - this.setState((preState) => ({ - seconds: preState.seconds - 1, - }), () => { - if (this.state.seconds == 0) { - clearInterval(timer); - this.setState({ - getverificationcodes: false, - seconds: 60, - }) - } - }); - }, 1000) - this.SMSverification(); - } else { - this.setState({ - getverificationcodes: undefined, - }) - let timer = setInterval(() => { - this.setState((preState) => ({ - seconds: preState.seconds - 1, - }), () => { - if (this.state.seconds == 0) { - clearInterval(timer); - this.setState({ - getverificationcodes: false, - seconds: 60, - - }) - } - }); - }, 1000) - this.SMSverification(); - } - } - - //短信验证 - SMSverification = () => { - var url = `/accounts/get_verification_code.json`; - axios.get((url), { - params: { - login: this.state.login, - type: 3, - } - }).then((result) => { - //验证有问题{"status":1,"message":"success"} - console.log(result); - - - }).catch((error) => { - console.log(error); - - }) - } - - handleDialogClose() { - this.setState({ - isRenders: false - }) - window.location.href = "/"; - } - - postregistered = () => { - //提交按钮 - if (this.state.Phonenumberisnotcobool === false) { - // if (this.state.login.length === 0) { - // this.setState({ - // Phonenumberisnotco: "请输入手机号或邮箱", - // }) - // console.log("postregistered"); - // console.log("123456"); - // - // return - // } else { - this.setState({ - Phonenumberisnotco: this.state.Phonenumberisnotco, - }) - // console.log("postregistered"); - // console.log("1234567"); - // - // } - return; - } - if(this.state.codes.length===0){ - this.setState({ - Phonenumberisnotcocodes: "请输入验证码", - }) - return; - } - if(this.state.reason.length === 0){ - this.setState({ - Phonenumberisnotcoreason: "请输入推荐人信息或申请理由", - }) - return; - } - - - var url = "/users/trial_apply.json"; - axios.post(url, { - phone: this.state.login, - code: this.state.codes, - reason: this.state.reason, - }).then((result) => { - // console.log(result); - try { - // this.onTabChange("1"); - window.location.href = "/"; - } catch (e) { - - } - }).catch((error) => { - - }) - - - } - inputOnBlur = (e) => { - this.isCorrectname(e.target.value); - // this.Emailphonenumberverification(e.target.value, id); - } - isCorrectname = (value) => { - console.log(value.length); - if (value.length === 0) { - this.setState({ - Phonenumberisnotco: undefined, - Phonenumberisnotcobool: false, - }) - return; - } - // var telephone = $("#telephoneAdd.tianjia_phone").val(); - var regph = /^[1][3,4,5,6,7,8][0-9]{9}$/; - // var email = $("#add_email.tianjia_email").val(); - var regemail = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/; - - // [1]手机号开头必须是1 [3,4,5,6,7,8] 第二位是3-8中的一个 [0-9]{9} 后边9位可以是0-9的任意数字。 - var stringdata = undefined; - if (!regph.test(value)) { - stringdata = "手机号格式不正确"; - this.setState({ - Phonenumberisnotco: stringdata, - Phonenumberisnotcobool: false, - }) - } else { - this.setState({ - Phonenumberisnotco: undefined, - Phonenumberisnotcobool: true, - }) - return - } - - if (!regemail.test(value)) { - if ((value.indexOf("@") != -1) === true) { - stringdata = "邮箱格式不正确"; - } else { - stringdata = "手机号格式不正确"; - - } - this.setState({ - Phonenumberisnotco: stringdata, - Phonenumberisnotcobool: false, - }) - - // this.Emailphonenumberverification(value) - return - } else { - this.setState({ - Phonenumberisnotco: undefined, - Phonenumberisnotcobool: true, - }) - return - } - } - //邮箱手机号验证 - Emailphonenumberverification = (value) => { - var url = `/accounts/valid_email_and_phone.json`; - axios.get((url), { - params: { - login: value, - type: 2, - } - }).then((result) => { - //验证有问题{"status":1,"message":"success"} - console.log(result); - - - }).catch((error) => { - console.log(error); - // this.setState({ - // login:"", - // logins:"", - // }) - }) - } - - //执行view - render() { - let {login, codes, reason, isRenders, Phonenumberisnotco, getverificationcodes,Phonenumberisnotcocodes,Phonenumberisnotcoreason, seconds} = this.state; - // console.log("Trialapplication22222222"); - // console.log(this.props); - return ( -
- { - isRenders === false?"": - -
- - - - - -
{ - this.handleDialogClose() - }}> - -
-
-
-
    + } + + + + + +
    { + this.handleDialogClose() + }}> + +
    +
    + +
    +
      试用申请 -
    - -
    -
    - 您尚未获得访问权限,请如实填写下述信息 -
    -
    - 管理员审核批准后,即可继续访问网站 -
    -
    - this.inputOnBlur(e)} - style={{"height": "38px",}} - name="myiphone" - > - { - Phonenumberisnotco && Phonenumberisnotco != "" ? -

    - {Phonenumberisnotco} -

    - :
    - } -
    - - -
    - - - - - { - getverificationcodes === undefined ? - - : getverificationcodes === true ? - - : - - } -
    - { - Phonenumberisnotcocodes && Phonenumberisnotcocodes != "" ? -

    - {Phonenumberisnotcocodes} -

    - :
    - } -
    - - { - Phonenumberisnotcoreason && Phonenumberisnotcoreason != "" ? -

    - {Phonenumberisnotcoreason} -

    - :
    - } -
    - - - - -
    -
    - -
    -
- - } -
- - - - ) - - - } + "padding": "20px", + "text-align": "center!important", + "color": "#05101A", + "font-weight": "bold", + "font-size": "17px", + "margin-top": "10px", + }}>试用申请 + + +
+
+ 您尚未获得访问权限,请如实填写下述信息 +
+
+ 管理员审核批准后,即可继续访问网站 +
+ + { + user_phone_binded === true ? "" : +
+ this.inputOnBlur(e)} + style={{"height": "38px",}} + name="myiphone" + > + { + Phonenumberisnotco && Phonenumberisnotco != "" ? +

+ {Phonenumberisnotco} +

+ :
+ } +
+ } + + + { + user_phone_binded === true ? "" : +
+ + + + + { + getverificationcodes === undefined ? + + : getverificationcodes === true ? + + : + + } +
+ } + + + { + Phonenumberisnotcocodes && Phonenumberisnotcocodes != "" ? +

+ {Phonenumberisnotcocodes} +

+ :
+ } +
+ + { + Phonenumberisnotcoreason && Phonenumberisnotcoreason != "" ? +

+ {Phonenumberisnotcoreason} +

+ :
+ } +
+ + + + +
+ + +
+ + + + + } + + + + ) + + + } } diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index 3ef02578a..25d290fac 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -18,7 +18,7 @@ import Addcourses from '../courses/coursesPublic/Addcourses'; import LoginDialog from '../login/LoginDialog'; -// import Trialapplication from '../login/Trialapplication' +import Trialapplication from '../login/Trialapplication' import 'antd/lib/modal/style/index.css'; @@ -170,6 +170,7 @@ class NewHeader extends Component { submitapplications:false, isRender:false, isRenders:false, + showTrial:false, user:undefined, } } @@ -512,12 +513,17 @@ submittojoinclass=(value)=>{ } // trialapplications =()=>{ + // console.log("点击了") // this.setState({ // isRenders: true, + // showTrial:true, // }) // } - + // 关闭 + cancelModulationModels = () => { + this.setState({isRenders: false}) + } render() { const isLogin = true; // 这里不会出现未登录的情况,服务端在服务端路由时发现如果是未登录,则跳转到登录页了。 @@ -538,6 +544,7 @@ submittojoinclass=(value)=>{ submitapplicationsvalue, user, isRender, + isRenders, }=this.state; /* 用户名称 用户头像url @@ -574,11 +581,13 @@ submittojoinclass=(value)=>{ /> {/* :""*/} {/*}*/} + {/*{*/} {/* isRenders&&isRenders===true?*/} {/* this.cancelModulationModels()}*/} {/* />*/} {/* :""*/} {/*}*/} From 765af2c66e7c14fb909ca52552c5e1ca5bb257dc Mon Sep 17 00:00:00 2001 From: ysl <904079904@qq.com> Date: Fri, 21 Jun 2019 12:24:25 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/login/Trialapplication.js | 28 +++---------------- 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/public/react/src/modules/login/Trialapplication.js b/public/react/src/modules/login/Trialapplication.js index a0903021a..e0a631541 100644 --- a/public/react/src/modules/login/Trialapplication.js +++ b/public/react/src/modules/login/Trialapplication.js @@ -53,9 +53,9 @@ class Trialapplication extends Component { //初始化数据 componentDidMount() { - console.log("53"); + // console.log("53"); - console.log(this.props.isRenders); + // console.log(this.props.isRenders); if (this.props.isRenders != undefined) { this.setState({ @@ -78,31 +78,11 @@ class Trialapplication extends Component { } return response; }, (error) => { - // // if (error.response && error.response.data.error === '401 Unauthorized') { - // // this.back_url = window.location.href; - // // this.setState({ - // // isRender: true - // // }) // // // TODO 这里如果样式变了会出现css不加载的情况 - // // const $ = window.$; - // // const isCssLoaded = window.getComputedStyle($('.log_nav li.active')[0], null) - // // .getPropertyValue('border-bottom') - // // == "2px solid rgb(69, 155, 229)" - // // if (!isCssLoaded) { - // // const isPort3007 = window.location.port == 3007; - // // let _url_origin = isPort3007 ? 'http://localhost:3000' : '' - // // - // // $('head').append( $('') - // // .attr('href', `${_url_origin}/stylesheets/educoder/edu-main.css`) ); - // // $('head').append( $('') - // // .attr('href', `${_url_origin}/stylesheets/educoder/edu-all.css`) ); - // // } - // // } - // // return Promise.reject(error); }); - console.log("89"); + // console.log("89"); try { - console.log(this.state.props.user && this.state.props.user.user_phone_binded); + // console.log(this.state.props.user && this.state.props.user.user_phone_binded); if (this.state.props.user !== undefined) { this.setState({ user_phone_binded: this.state.props.user.user_phone_binded, From 05a22b7e9c97ab7a15e8fd07301b68d5a57970f6 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, 21 Jun 2019 12:31:40 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/busyWork/CommonWorkSetting.js | 2 +- .../courses/coursesPublic/Associationmodel.js | 476 +++---- .../src/modules/courses/exercise/Exercise.js | 2 +- .../graduation/tasks/GraduateTaskItem.js | 1 + .../tasks/GraduationTaskssetting.js | 10 +- .../tasks/GraduationTaskssettinglist.js | 15 +- .../tasks/GraduationTaskssettingquestions.js | 2 +- .../modules/courses/graduation/tasks/index.js | 2 +- public/react/src/modules/courses/poll/Poll.js | 1240 ++++++++--------- .../poll/pollPublicBtn/ImmediatelyPublish.js | 562 ++++---- .../courses/shixunHomework/Listofworks.js | 2 +- .../shixunHomework/ShixunStudentWork.js | 2 +- .../shixunHomework/Trainingjobsetting.js | 2 +- .../shixunHomework/Workquestionandanswer.js | 2 +- .../courses/shixunHomework/shixunHomework.js | 4 +- 15 files changed, 1165 insertions(+), 1159 deletions(-) diff --git a/public/react/src/modules/courses/busyWork/CommonWorkSetting.js b/public/react/src/modules/courses/busyWork/CommonWorkSetting.js index 3ef242a44..5ce5a5df3 100644 --- a/public/react/src/modules/courses/busyWork/CommonWorkSetting.js +++ b/public/react/src/modules/courses/busyWork/CommonWorkSetting.js @@ -421,7 +421,7 @@ class CommonWorkSetting extends Component{ Topval:"本操作只对“未发布”的对象生效", Botvalleft:"暂不发布", Botval:"则通过后续手动设置,定时发布", - starttime:starttime, + starttime:moment(moment(new Date())).format("YYYY-MM-DD HH:mm"), endtime:endtime, Cancelname:"暂不发布", Savesname:"立即发布", diff --git a/public/react/src/modules/courses/coursesPublic/Associationmodel.js b/public/react/src/modules/courses/coursesPublic/Associationmodel.js index 48616ef1f..1f10caa5f 100644 --- a/public/react/src/modules/courses/coursesPublic/Associationmodel.js +++ b/public/react/src/modules/courses/coursesPublic/Associationmodel.js @@ -1,239 +1,239 @@ -import React,{ Component } from "react"; -import { Modal,Checkbox,Upload,Button,Icon,message,Input,Radio} from "antd"; -import axios from 'axios'; -import Modals from '../../modals/Modals'; -const RadioGroup = Radio.Group; -const Search = Input.Search; - -class Associationmodel extends Component{ - constructor(props){ - super(props); - this.state={ - group_ids:[], - fileList:[], - Modalstype:false, - Modalstopval:"", - ModalCancel:"", - ModalSave:"", - loadtype:false, - search:undefined, - page:1, - limit:"", - projects:undefined, - projectvalue:undefined, - projectvaluetype:false, - } - } - - - componentDidMount() { - this.searchValue(); - } - - searchValue=()=>{ - let {search}=this.state; - let url="/users/search_user_projects.json"; - axios.get(url, { - params: { - search: search - } - }).then((result)=>{ - console.log(result) - if(result.status===200){ - this.setState({ - projects:result.data.projects - }) - } - - }).catch((error)=>{ - console.log(error) - }) - } - - inputSearchValue=(e)=>{ - this.setState({ - search:e.target.value - }) - } - - - goback=()=>{ - this.props.funlist() - this.props.Cancel() - console.log(this.props) - this.setState({ - Modalstype:false, - - }) - } - - - setSaves=()=>{ - let {projectvalue}=this.state; - let taskid=this.props.taskid; - let url="/graduation_tasks/"+taskid+"/graduation_works/relate_project.json"; - - axios.post(url, { - project_id: projectvalue - }).then((result)=>{ - - if(result.status===200){ - if(result.data.status===0){ - - this.setState({ - Modalstype:true, - Modalstopval:result.data.message, - ModalSave:this.goback, - loadtype:true - }) - - } - - } - - }).catch((error)=>{ - console.log(error) - }) - } - Saves=()=>{ - let {projectvalue}=this.state; - if(projectvalue===undefined||projectvalue===""){ - this.setState({ - projectvaluetype:true, - }) - }else{ - this.setState({ - projectvaluetype:false, - }) - } - let taskid=this.props.taskid; - console.log(this.props) - let url="/graduation_tasks/"+taskid+"/graduation_works/check_project.json"; - axios.get(url, { - params: { - project_id: projectvalue - } - }).then((result)=>{ - - if(result.status===200){ - - if(result.data.is_relate===false){ - - this.setSaves() - - }else{ - - this.setState({ - Modalstype:true, - Modalstopval:"该项目已被"+result.data.relate_user+"关联", - ModalSave:this.ModalSave, - loadtype:true - }) - - } - - } - - }).catch((error)=>{ - console.log(error) - }) - } - - onChange = (e) => { - - this.setState({ - projectvalue: e.target.value, - }); - - } - - ModalSave=()=>{ - this.setState({ - Modalstype:false - }) - } - - render(){ - let { - Modalstype, - Modalstopval, - ModalCancel, - ModalSave, - loadtype, - search, - projects, - projectvalue, - projectvaluetype - }=this.state; - - - - return( -
- {/*提示*/} - - -
-

- - - -

- -
- - - - {projects&&projects.map((item,key)=>{ - return( -
- -
{item.project_name}
-
- ) - })} - -
- -
- - {projectvaluetype===true?请先选择项目:""} - -
- 取消 - 确认 -
- -
-
-
- ) - } -} +import React,{ Component } from "react"; +import { Modal,Checkbox,Upload,Button,Icon,message,Input,Radio} from "antd"; +import axios from 'axios'; +import Modals from '../../modals/Modals'; +const RadioGroup = Radio.Group; +const Search = Input.Search; + +class Associationmodel extends Component{ + constructor(props){ + super(props); + this.state={ + group_ids:[], + fileList:[], + Modalstype:false, + Modalstopval:"", + ModalCancel:"", + ModalSave:"", + loadtype:false, + search:undefined, + page:1, + limit:"", + projects:undefined, + projectvalue:undefined, + projectvaluetype:false, + } + } + + + componentDidMount() { + this.searchValue(); + } + + searchValue=()=>{ + let {search}=this.state; + let url="/users/search_user_projects.json"; + axios.get(url, { + params: { + search: search + } + }).then((result)=>{ + console.log(result) + if(result.status===200){ + this.setState({ + projects:result.data.projects + }) + } + + }).catch((error)=>{ + console.log(error) + }) + } + + inputSearchValue=(e)=>{ + this.setState({ + search:e.target.value + }) + } + + + goback=()=>{ + this.props.funlist() + this.props.Cancel() + console.log(this.props) + this.setState({ + Modalstype:false, + + }) + } + + + setSaves=()=>{ + let {projectvalue}=this.state; + let taskid=this.props.taskid; + let url="/graduation_tasks/"+taskid+"/graduation_works/relate_project.json"; + + axios.post(url, { + project_id: projectvalue + }).then((result)=>{ + + if(result.status===200){ + if(result.data.status===0){ + + this.setState({ + Modalstype:true, + Modalstopval:result.data.message, + ModalSave:this.goback, + loadtype:true + }) + this.props.funlist() + } + + } + + }).catch((error)=>{ + console.log(error) + }) + } + Saves=()=>{ + let {projectvalue}=this.state; + if(projectvalue===undefined||projectvalue===""){ + this.setState({ + projectvaluetype:true, + }) + }else{ + this.setState({ + projectvaluetype:false, + }) + } + let taskid=this.props.taskid; + console.log(this.props) + let url="/graduation_tasks/"+taskid+"/graduation_works/check_project.json"; + axios.get(url, { + params: { + project_id: projectvalue + } + }).then((result)=>{ + + if(result.status===200){ + + if(result.data.is_relate===false){ + + this.setSaves() + + }else{ + + this.setState({ + Modalstype:true, + Modalstopval:"该项目已被"+result.data.relate_user+"关联", + ModalSave:this.ModalSave, + loadtype:true + }) + + } + + } + + }).catch((error)=>{ + console.log(error) + }) + } + + onChange = (e) => { + + this.setState({ + projectvalue: e.target.value, + }); + + } + + ModalSave=()=>{ + this.setState({ + Modalstype:false + }) + } + + render(){ + let { + Modalstype, + Modalstopval, + ModalCancel, + ModalSave, + loadtype, + search, + projects, + projectvalue, + projectvaluetype + }=this.state; + + + + return( +
+ {/*提示*/} + + +
+

+ + + +

+ +
+ + + + {projects&&projects.map((item,key)=>{ + return( +
+ +
{item.project_name}
+
+ ) + })} + +
+ +
+ + {projectvaluetype===true?请先选择项目:""} + +
+ 取消 + 确认 +
+ +
+
+
+ ) + } +} export default Associationmodel; \ No newline at end of file diff --git a/public/react/src/modules/courses/exercise/Exercise.js b/public/react/src/modules/courses/exercise/Exercise.js index 608bdf166..a6791fb54 100644 --- a/public/react/src/modules/courses/exercise/Exercise.js +++ b/public/react/src/modules/courses/exercise/Exercise.js @@ -213,7 +213,7 @@ class Exercise extends Component{ Topval:"本操作只对“未发布”的对象生效", Botvalleft:"暂不发布", Botval:"则通过后续手动设置,定时发布", - starttime:"发布时间:"+this.props.getNowFormatDates(1), + starttime:"发布时间:"+moment(moment(new Date())).format("YYYY-MM-DD HH:mm"), starttimes:this.props.getNowFormatDates(1), endtime:"截止时间:"+this.props.getNowFormatDates(2), Cancelname:"暂不发布", diff --git a/public/react/src/modules/courses/graduation/tasks/GraduateTaskItem.js b/public/react/src/modules/courses/graduation/tasks/GraduateTaskItem.js index 942fa96ca..4d6c6777b 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduateTaskItem.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduateTaskItem.js @@ -65,6 +65,7 @@ class GraduateTaskItem extends Component{ cardsModalsavetype:this.cannerassocition, loadtype:true }) + this.props.funlist() } }).catch((error)=>{ diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js index c74f8a1d7..dfa6879f5 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js @@ -415,7 +415,7 @@ class GraduationTaskssettingapp extends Component{ Topval:"发布设置均可修改", Botvalleft:"点击修改", Botval:"此设置将对所有分班生效", - starttime:moment(moment(handleDateString(this.props.getNowFormatDates(1)))).format("YYYY-MM-DD HH:mm") , + starttime:moment(moment(new Date())).format("YYYY-MM-DD HH:mm") , starttimes:this.props.getNowFormatDates(1), typs:"start", endtime:endtime, @@ -1164,7 +1164,7 @@ class GraduationTaskssettingapp extends Component{
截止时间: - + 指导老师手动分配 (由指导老师在作品列表中,手动选择每个作品被分配的评阅老师) - 答辩组间老师互评 (由系统按照设置在答辩组之间自动分配: - 答辩组设置 + 答辩组间老师互评 (由系统按照设置在答辩组之间自动分配: + + 答辩组设置 + diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js index 7ef1f99c5..019b739c9 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js @@ -332,7 +332,7 @@ class GraduationTaskssettinglist extends Component{ Topval:"发布设置均可修改", Botvalleft:"点击修改", Botval:"此设置将对所有分班生效", - starttime:moment(new Date()).format('YYYY-MM-DD 00:00'), + starttime:moment(moment(new Date())).format("YYYY-MM-DD HH:mm") , starttimes:this.props.getNowFormatDates(1), typs:"start", endtime:endtime, @@ -544,6 +544,7 @@ class GraduationTaskssettinglist extends Component{ axios.get(url).then((result)=>{ if(result.data.status===0){ + this.searchValue() this.setState({ Modalstype:true, Modalstopval:result.data.message, @@ -730,7 +731,7 @@ class GraduationTaskssettinglist extends Component{ 其它历史评分将全部失效:""}> {tag.name==="评阅"?tag.status===0?"--": - tag.name + {tag.name} : :""}> {tag.name==="评阅"?tag.status===0?"--": - tag.name + {tag.name} : 调整学生最终成绩
其它历史评分将全部失效:""}> {tag.name==="评阅"?tag.status===0?"--":
- tag.name + {tag.name} + : this.showModulationtype(tag.id):tag.name==="分配"?()=>this.showAllocationModal(tag.id):""} @@ -1145,7 +1147,7 @@ class GraduationTaskssettinglist extends Component{ 调整学生最终成绩
其它历史评分将全部失效:""}> {tag.name==="评阅"?tag.status===0?"--":
- tag.name + {tag.name} : :""} {taskslistdata&&taskslistdata? @@ -1551,7 +1554,7 @@ class GraduationTaskssettinglist extends Component{ to={"/courses/"+courseId+"/graduation_tasks/"+category_id+"/"+task_Id+"/setting"}>设置 - {taskslistdata.work_status===undefined?"":taskslistdata.work_status.map((item,key)=>{ + {taskslistdata.work_status===undefined||taskslistdata.work_status===null||taskslistdata.work_status.length===0?"":taskslistdata.work_status.map((item,key)=>{ return( {item==="提交作品"?提交作品:""} diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettingquestions.js b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettingquestions.js index 80055f5d3..997085d13 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettingquestions.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettingquestions.js @@ -81,7 +81,7 @@ class GraduationTasksquestions extends Component{ Topval:"发布设置均可修改", Botvalleft:"点击修改", Botval:"此设置将对所有分班生效", - starttime:moment(new Date()).format('YYYY-MM-DD 00:00'), + starttime:moment(moment(new Date())).format("YYYY-MM-DD HH:mm") , starttimes:this.props.getNowFormatDates(1), typs:"start", endtime:endtime, diff --git a/public/react/src/modules/courses/graduation/tasks/index.js b/public/react/src/modules/courses/graduation/tasks/index.js index fa86da93d..f2fc3845e 100644 --- a/public/react/src/modules/courses/graduation/tasks/index.js +++ b/public/react/src/modules/courses/graduation/tasks/index.js @@ -413,7 +413,7 @@ class GraduationTasks extends Component{ Topval:"本操作只对“未发布”的对象生效", Botvalleft:"暂不发布", Botval:"则通过后续手动设置,定时发布", - starttime:"发布时间:"+starttime, + starttime:"发布时间:"+moment(moment(new Date())).format("YYYY-MM-DD HH:mm"), starttimes:this.props.getNowFormatDates(1), typs:"start", endtime:"截止时间:"+endtime, diff --git a/public/react/src/modules/courses/poll/Poll.js b/public/react/src/modules/courses/poll/Poll.js index 2d0aedd7a..aa01bcf47 100644 --- a/public/react/src/modules/courses/poll/Poll.js +++ b/public/react/src/modules/courses/poll/Poll.js @@ -1,621 +1,621 @@ -import React,{ Component } from "react"; -import { Input,Checkbox,Table, Pagination, Modal,Menu, Tooltip ,Spin} from "antd"; -import CourseLayoutcomponent from '../common/CourseLayoutComponent'; -import HomeworkModal from "../coursesPublic/HomeworkModal"; -import ShixunModal from "../coursesPublic/ShixunModal"; -import PathModal from "../coursesPublic/PathModal"; -import AddcoursesNav from "../coursesPublic/AddcoursesNav"; -import ImmediatelyPublish from './pollPublicBtn/ImmediatelyPublish' -import ImmediatelyEnd from './pollPublicBtn/ImmediatelyEnd' -import PollListItem from './PollListItem' -import NoneData from '../coursesPublic/NoneData' -import UseBank from '../busyWork/UseBank' - -import _ from 'lodash'; - -import '../css/members.css' -import '../css/busyWork.css' - - -import { WordsBtn } from 'educoder' -import Modals from '../../modals/Modals' - -import axios from 'axios' - -const Search = Input.Search; - - -class Poll extends Component{ - constructor(props){ - super(props); - this.state={ - modalname:undefined, - modaltype:undefined, - visible:false, - Topval:undefined, - Topvalright:undefined, - Botvalleft:undefined, - Botval:undefined, - starttime:undefined, - endtime:undefined, - Cancelname:undefined, - Savesname:undefined, - Cancel:undefined, - Saves:undefined, - StudentList_value:undefined, - addname:undefined, - addnametype:false, - addnametab:undefined, - addcanner:undefined, - addsave:undefined, - course_groups:[], - chooseId:undefined, - // 列表相关 - checkBoxValues:[], - checkAllValue:false, - pollsList:undefined, - course_types:undefined, - page:1, - pageSize:15, - type:0, - polls_counts:undefined, - - //公用提示弹框相关 - modalsType:false, - modalsTopval:"", - modalsBottomval:"", - loadtype:false, - boxType:"delete", - isSpin:false - } - - } - - inputStudent=(e)=>{ - this.setState({ - StudentList_value:e.target.value - }) - } - - - // 题库选用 - selectBlank=(type)=>{ - if(type===2){ - this.setState({ - addname:"添加目录", - addnametype:true, - addnametab:type, - addcanner:this.homeworkhide, - addsave:undefined - }) - }else if(type===4){ - this.setState({ - addname:"移动到目录", - addnametype:true, - addnametab:type, - addcanner:this.homeworkhide, - addsave:undefined - }) - } - - } - // 切换菜单选项 - changeType=(e)=>{ - this.setState({ - type:e.key, - checkBoxValues:[], - checkAllValue:false - }) - let{StudentList_value,page}=this.state; - this.InitList(e.key,StudentList_value,page); - } - // 获取列表数据 - InitList=(type,search,page)=>{ - this.setState({ - isSpin:true - }) - let {pageSize}=this.state - let coursesId=this.props.match.params.coursesId; - let url='/courses/'+coursesId+'/polls.json?limit='+pageSize+'&page='+page - if(type!="0"){ - url+="&type="+type - } - if(search!=""&&search!=undefined){ - url+="&search="+search - } - axios.get(url).then((result)=>{ - if(result){ - this.setState({ - pollsList:result.data.polls, - course_types:result.data.course_types, - polls_counts:result.data.polls_counts, - isSpin:false, - checkBoxValues:[] - }) - } - }).catch((error)=>{ - console.log(error); - }) - } - // 加载列表 - componentDidMount(){ - this.setState({ - isSpin:true - }) - let{type,StudentList_value,page}=this.state - this.InitList(type,StudentList_value,page); - } - //切换分页 - changePage=(pageNumber)=>{ - - this.setState({ - page:pageNumber - }) - let{type,StudentList_value}=this.state - this.InitList(type,StudentList_value,pageNumber); - } - // 搜索 - searchInfo=()=>{ - this.setState({ - page:1 - }) - let{type,StudentList_value}=this.state; - this.InitList(type,StudentList_value,1) - } - // checkbox - onItemClick = (item) => { - const checkBoxValues = this.state.checkBoxValues.slice(0); - const index = checkBoxValues.indexOf(item.id); - if (index != -1) { - _.remove(checkBoxValues, (listItem)=> listItem === item.id) - } else { - checkBoxValues.push(item.id); - } - this.onCheckBoxChange(checkBoxValues) - } - // 全选or反选 - onCheckAll = (e) => { - this.setState({ - checkAllValue: e.target.checked - }) - const values = this.state.pollsList.map(item => { - return item.id - }) - if (e.target.checked) { - const concated = this.state.checkBoxValues.concat(values); - const uniq=_.uniq(concated) - this.setState({ - checkBoxValues: uniq - }) - } else { - this.setState({ - checkBoxValues: _.difference(this.state.checkBoxValues, values) - }) - } - } - - onCheckBoxChange = (checkedValues) => { - this.setState({ - checkBoxValues: checkedValues, - checkAllValue: checkedValues.length == this.state.pollsList.length - }) - } - - //删除或者设为公开 - ActionPoll=(value)=>{ - let CourseId=this.props.match.params.coursesId; - //判断是否有选中数据 - if(this.state.checkBoxValues.length==0){ - this.props.showNotification("请先在列表中选择数据"); - // this.setState({ - // modalsType:true, - // modalsTopval:"请先在列表中选择数据", - // modalsBottomval:'', - // loadtype:true - // }) - }else{ - if(value != "bank"){ - this.setState({ - modalsType:true, - modalsTopval:value=="delete"?"已提交作品将全部被删除,不可恢复":"公开后非课堂成员也可以访问查看", - modalsBottomval:value=="delete"?"您确定要删除吗?":"是否确认公开?", - loadtype:false, - boxType:value - }) - }else{ - //加入题库 - let url=`/courses/${CourseId}/polls/join_poll_banks.json`; - axios.post((url), { - check_ids: this.state.checkBoxValues - }) - .then((result)=>{ - if(result){ - this.props.showNotification(`${result.data.message}`); - this.setState({ - modalsType:false, - modalsTopval:"", - modalsBottomval:"", - loadtype:false, - checkBoxValues:[], - checkAllValue:false - }) - let{type,StudentList_value}=this.state - this.InitList(type,StudentList_value,1); - } - }).catch((error)=>{ - console.log(error); - }) - } - } - } - //取消删除或者设为公开 - modalCancel=()=>{ - this.setState({ - modalsType:false, - modalsTopval:"", - modalsBottomval:"", - loadtype:false - }) - } - //确定删除或者设为公开 - ModalAction=()=>{ - let CourseId=this.props.match.params.coursesId; - if(this.state.checkBoxValues.length==0){ - this.setState({ - modalsType:false, - modalsTopval:"", - loadtype:false, - checkBoxValues:[] - }) - }else{ - if(this.state.boxType=="delete"){ - //删除 - let url=`/courses/${CourseId}/polls/destroys.json`; - axios.post((url), { - check_ids: this.state.checkBoxValues - }) - .then((result)=>{ - if(result){ - this.props.showNotification(`${result.data.message}`); - this.setState({ - modalsType:false, - modalsTopval:"", - modalsBottomval:"", - loadtype:false, - checkBoxValues:[] - }) - let{type,StudentList_value}=this.state - this.InitList(type,StudentList_value,1); - } - }).catch((error)=>{ - console.log(error); - }) - }else if(this.state.boxType=="public"){ - //设为公开 - let url=`/courses/${CourseId}/polls/set_public.json`; - axios.post((url), { - check_ids: this.state.checkBoxValues - }) - .then((result)=>{ - if(result){ - this.props.showNotification(`${result.data.message}`); - this.setState({ - modalsType:false, - modalsTopval:"", - loadtype:false, - checkBoxValues:[] - }) - let{type,StudentList_value}=this.state - this.InitList(type,StudentList_value,1); - } - }).catch((error)=>{ - console.log(error); - }) - } - } - } - - successFun=()=>{ - let{type,StudentList_value,page}=this.state - this.InitList(type,StudentList_value,page) - - } - // 题库选用成功后,立即发布,刷新页面 - useBankSuccess=(checkValue,value)=>{ - // let{type,StudentList_value,page}=this.state - // this.InitList(type,StudentList_value,page); - this.setState({ - checkBoxValues:[] - }) - let coursesId=this.props.match.params.coursesId; - let url=`/courses/${coursesId}/polls/publish_modal.json`; - axios.get(url,{ - params:{ - check_ids:value - } - }).then((response) => { - if(response){ - let list=[]; - if(response.data.course_info){ - for(var i=0;i 0 ? 1 : 2, - visible:true, - Topval:"本操作只对“未发布”的对象生效", - Botvalleft:"暂不发布", - Botval:"则通过后续手动设置,定时发布", - starttime:"发布时间:"+this.props.getNowFormatDates(1), - starttimes:this.props.getNowFormatDates(1), - endtime:"截止时间:"+this.props.getNowFormatDates(2), - Cancelname:"暂不发布", - Savesname:"立即发布", - Cancel:this.homeworkhide, - Saves:this.homeworkstartend, - }) - } - }).catch((error) => { - console.log(error) - }); - } - - getcourse_groupslist=(id)=>{ - this.setState({ - chooseId:id - }) - } - - // 确定立即发布 - homeworkstartend=(value,endtime)=>{ - - let {checkBoxValues}=this.state; - let coursesId=this.props.match.params.coursesId; - - let url=`/courses/${coursesId}/polls/publish.json` - axios.post(url,{ - check_ids:checkBoxValues, - group_ids:value, - end_time:endtime - }).then((result)=>{ - if(result){ - let{type,StudentList_value,page}=this.state - this.InitList(type,StudentList_value,page); - this.props.showNotification(result.data.message); - this.homeworkhide(); - } - }).catch((error)=>{ - console.log(error); - }) - } - - //暂不发布 - homeworkhide=()=>{ - this.setState({ - modalname:undefined, - modaltype:undefined, - visible:false, - Topval:undefined, - Topvalright:undefined, - Botvalleft:undefined, - Botval:undefined, - starttime:undefined, - endtime:undefined, - Cancelname:undefined, - Savesname:undefined, - Cancel:undefined, - Saves:undefined, - StudentList_value:undefined, - addname:undefined, - addnametype:false, - addnametab:undefined, - checkBoxValues:[] - }) - } - - render(){ - let { - modalname, - modaltype, - visible, - Topval, - Topvalright, - Botvalleft, - Botval, - starttime, - endtime, - Cancelname, - Savesname, - Cancel, - Saves, - StudentList_value, - addname, - addnametype, - addnametab, - addcanner, - addsave, - course_groups, - - checkAllValue, - checkBoxValues, - course_types, - pollsList, - page, - pageSize, - polls_counts, - - modalsType, - modalsTopval, - modalsBottomval, - loadtype - }=this.state; - console.log(this.props); - let {child}=this.props; - let {coursesId,Id}=this.props.match.params - const isAdmin = this.props.isAdmin() - const isStudent=this.props.isStudent(); - // console.log(child) - return( - - - {visible===true?this.getcourse_groupslist(id)} - />:""} - - {/*添加目录/选择目录*/} - - - {/* 公用的提示弹框 */} - - - -
-

- {polls_counts&&polls_counts.left_banner_name} - { - isAdmin && -

  • -

    - 新建 -
  • - } -

    -
    -

    - 共{polls_counts && polls_counts.polls_total_counts}个问卷 - 已发布:{polls_counts && polls_counts.polls_published_counts}个 - { - isAdmin && 未发布:{polls_counts && polls_counts.polls_unpublish_counts}个 - } -

    -
    - -
    -
    -
    - - 全部 - { course_types && course_types.user_permission == 1 && 未发布 } - 提交中 - 已截止 - -
    -
    - - { - pollsList && pollsList.length > 0 && isAdmin && -
    -
    - 已选 {checkBoxValues.length} 个 -
    -
  • this.ActionPoll("delete")}>删除
  • -
  • - -
  • -
  • - -
  • - { - course_types && course_types.course_is_public == 1 &&
  • this.ActionPoll("public")}>设为公开
  • - } -
  • this.ActionPoll("bank")}>加入题库
  • -
    -
    -
    - } - - { - pollsList && pollsList.length > 0 && - - -
    - { - pollsList && pollsList.map((item,key)=>{ - return( - this.onItemClick(item)}>} - > - ) - }) - } -
    -
    - } -
    - { - pollsList && pollsList.length==0 && - } - { - course_types && polls_counts.polls_all_counts > pageSize ? -
    - -
    - : - "" - } - - -
    - ) - } -} +import React,{ Component } from "react"; +import { Input,Checkbox,Table, Pagination, Modal,Menu, Tooltip ,Spin} from "antd"; +import CourseLayoutcomponent from '../common/CourseLayoutComponent'; +import HomeworkModal from "../coursesPublic/HomeworkModal"; +import ShixunModal from "../coursesPublic/ShixunModal"; +import PathModal from "../coursesPublic/PathModal"; +import AddcoursesNav from "../coursesPublic/AddcoursesNav"; +import ImmediatelyPublish from './pollPublicBtn/ImmediatelyPublish' +import ImmediatelyEnd from './pollPublicBtn/ImmediatelyEnd' +import PollListItem from './PollListItem' +import NoneData from '../coursesPublic/NoneData' +import UseBank from '../busyWork/UseBank' + +import _ from 'lodash'; + +import '../css/members.css' +import '../css/busyWork.css' + + +import { WordsBtn } from 'educoder' +import Modals from '../../modals/Modals' + +import axios from 'axios' + +const Search = Input.Search; + + +class Poll extends Component{ + constructor(props){ + super(props); + this.state={ + modalname:undefined, + modaltype:undefined, + visible:false, + Topval:undefined, + Topvalright:undefined, + Botvalleft:undefined, + Botval:undefined, + starttime:undefined, + endtime:undefined, + Cancelname:undefined, + Savesname:undefined, + Cancel:undefined, + Saves:undefined, + StudentList_value:undefined, + addname:undefined, + addnametype:false, + addnametab:undefined, + addcanner:undefined, + addsave:undefined, + course_groups:[], + chooseId:undefined, + // 列表相关 + checkBoxValues:[], + checkAllValue:false, + pollsList:undefined, + course_types:undefined, + page:1, + pageSize:15, + type:0, + polls_counts:undefined, + + //公用提示弹框相关 + modalsType:false, + modalsTopval:"", + modalsBottomval:"", + loadtype:false, + boxType:"delete", + isSpin:false + } + + } + + inputStudent=(e)=>{ + this.setState({ + StudentList_value:e.target.value + }) + } + + + // 题库选用 + selectBlank=(type)=>{ + if(type===2){ + this.setState({ + addname:"添加目录", + addnametype:true, + addnametab:type, + addcanner:this.homeworkhide, + addsave:undefined + }) + }else if(type===4){ + this.setState({ + addname:"移动到目录", + addnametype:true, + addnametab:type, + addcanner:this.homeworkhide, + addsave:undefined + }) + } + + } + // 切换菜单选项 + changeType=(e)=>{ + this.setState({ + type:e.key, + checkBoxValues:[], + checkAllValue:false + }) + let{StudentList_value,page}=this.state; + this.InitList(e.key,StudentList_value,page); + } + // 获取列表数据 + InitList=(type,search,page)=>{ + this.setState({ + isSpin:true + }) + let {pageSize}=this.state + let coursesId=this.props.match.params.coursesId; + let url='/courses/'+coursesId+'/polls.json?limit='+pageSize+'&page='+page + if(type!="0"){ + url+="&type="+type + } + if(search!=""&&search!=undefined){ + url+="&search="+search + } + axios.get(url).then((result)=>{ + if(result){ + this.setState({ + pollsList:result.data.polls, + course_types:result.data.course_types, + polls_counts:result.data.polls_counts, + isSpin:false, + checkBoxValues:[] + }) + } + }).catch((error)=>{ + console.log(error); + }) + } + // 加载列表 + componentDidMount(){ + this.setState({ + isSpin:true + }) + let{type,StudentList_value,page}=this.state + this.InitList(type,StudentList_value,page); + } + //切换分页 + changePage=(pageNumber)=>{ + + this.setState({ + page:pageNumber + }) + let{type,StudentList_value}=this.state + this.InitList(type,StudentList_value,pageNumber); + } + // 搜索 + searchInfo=()=>{ + this.setState({ + page:1 + }) + let{type,StudentList_value}=this.state; + this.InitList(type,StudentList_value,1) + } + // checkbox + onItemClick = (item) => { + const checkBoxValues = this.state.checkBoxValues.slice(0); + const index = checkBoxValues.indexOf(item.id); + if (index != -1) { + _.remove(checkBoxValues, (listItem)=> listItem === item.id) + } else { + checkBoxValues.push(item.id); + } + this.onCheckBoxChange(checkBoxValues) + } + // 全选or反选 + onCheckAll = (e) => { + this.setState({ + checkAllValue: e.target.checked + }) + const values = this.state.pollsList.map(item => { + return item.id + }) + if (e.target.checked) { + const concated = this.state.checkBoxValues.concat(values); + const uniq=_.uniq(concated) + this.setState({ + checkBoxValues: uniq + }) + } else { + this.setState({ + checkBoxValues: _.difference(this.state.checkBoxValues, values) + }) + } + } + + onCheckBoxChange = (checkedValues) => { + this.setState({ + checkBoxValues: checkedValues, + checkAllValue: checkedValues.length == this.state.pollsList.length + }) + } + + //删除或者设为公开 + ActionPoll=(value)=>{ + let CourseId=this.props.match.params.coursesId; + //判断是否有选中数据 + if(this.state.checkBoxValues.length==0){ + this.props.showNotification("请先在列表中选择数据"); + // this.setState({ + // modalsType:true, + // modalsTopval:"请先在列表中选择数据", + // modalsBottomval:'', + // loadtype:true + // }) + }else{ + if(value != "bank"){ + this.setState({ + modalsType:true, + modalsTopval:value=="delete"?"已提交作品将全部被删除,不可恢复":"公开后非课堂成员也可以访问查看", + modalsBottomval:value=="delete"?"您确定要删除吗?":"是否确认公开?", + loadtype:false, + boxType:value + }) + }else{ + //加入题库 + let url=`/courses/${CourseId}/polls/join_poll_banks.json`; + axios.post((url), { + check_ids: this.state.checkBoxValues + }) + .then((result)=>{ + if(result){ + this.props.showNotification(`${result.data.message}`); + this.setState({ + modalsType:false, + modalsTopval:"", + modalsBottomval:"", + loadtype:false, + checkBoxValues:[], + checkAllValue:false + }) + let{type,StudentList_value}=this.state + this.InitList(type,StudentList_value,1); + } + }).catch((error)=>{ + console.log(error); + }) + } + } + } + //取消删除或者设为公开 + modalCancel=()=>{ + this.setState({ + modalsType:false, + modalsTopval:"", + modalsBottomval:"", + loadtype:false + }) + } + //确定删除或者设为公开 + ModalAction=()=>{ + let CourseId=this.props.match.params.coursesId; + if(this.state.checkBoxValues.length==0){ + this.setState({ + modalsType:false, + modalsTopval:"", + loadtype:false, + checkBoxValues:[] + }) + }else{ + if(this.state.boxType=="delete"){ + //删除 + let url=`/courses/${CourseId}/polls/destroys.json`; + axios.post((url), { + check_ids: this.state.checkBoxValues + }) + .then((result)=>{ + if(result){ + this.props.showNotification(`${result.data.message}`); + this.setState({ + modalsType:false, + modalsTopval:"", + modalsBottomval:"", + loadtype:false, + checkBoxValues:[] + }) + let{type,StudentList_value}=this.state + this.InitList(type,StudentList_value,1); + } + }).catch((error)=>{ + console.log(error); + }) + }else if(this.state.boxType=="public"){ + //设为公开 + let url=`/courses/${CourseId}/polls/set_public.json`; + axios.post((url), { + check_ids: this.state.checkBoxValues + }) + .then((result)=>{ + if(result){ + this.props.showNotification(`${result.data.message}`); + this.setState({ + modalsType:false, + modalsTopval:"", + loadtype:false, + checkBoxValues:[] + }) + let{type,StudentList_value}=this.state + this.InitList(type,StudentList_value,1); + } + }).catch((error)=>{ + console.log(error); + }) + } + } + } + + successFun=()=>{ + let{type,StudentList_value,page}=this.state + this.InitList(type,StudentList_value,page) + + } + // 题库选用成功后,立即发布,刷新页面 + useBankSuccess=(checkValue,value)=>{ + // let{type,StudentList_value,page}=this.state + // this.InitList(type,StudentList_value,page); + this.setState({ + checkBoxValues:[] + }) + let coursesId=this.props.match.params.coursesId; + let url=`/courses/${coursesId}/polls/publish_modal.json`; + axios.get(url,{ + params:{ + check_ids:value + } + }).then((response) => { + if(response){ + let list=[]; + if(response.data.course_info){ + for(var i=0;i 0 ? 1 : 2, + visible:true, + Topval:"本操作只对“未发布”的对象生效", + Botvalleft:"暂不发布", + Botval:"则通过后续手动设置,定时发布", + starttime:"发布时间:"+moment(moment(new Date())).format("YYYY-MM-DD HH:mm"), + starttimes:this.props.getNowFormatDates(1), + endtime:"截止时间:"+this.props.getNowFormatDates(2), + Cancelname:"暂不发布", + Savesname:"立即发布", + Cancel:this.homeworkhide, + Saves:this.homeworkstartend, + }) + } + }).catch((error) => { + console.log(error) + }); + } + + getcourse_groupslist=(id)=>{ + this.setState({ + chooseId:id + }) + } + + // 确定立即发布 + homeworkstartend=(value,endtime)=>{ + + let {checkBoxValues}=this.state; + let coursesId=this.props.match.params.coursesId; + + let url=`/courses/${coursesId}/polls/publish.json` + axios.post(url,{ + check_ids:checkBoxValues, + group_ids:value, + end_time:endtime + }).then((result)=>{ + if(result){ + let{type,StudentList_value,page}=this.state + this.InitList(type,StudentList_value,page); + this.props.showNotification(result.data.message); + this.homeworkhide(); + } + }).catch((error)=>{ + console.log(error); + }) + } + + //暂不发布 + homeworkhide=()=>{ + this.setState({ + modalname:undefined, + modaltype:undefined, + visible:false, + Topval:undefined, + Topvalright:undefined, + Botvalleft:undefined, + Botval:undefined, + starttime:undefined, + endtime:undefined, + Cancelname:undefined, + Savesname:undefined, + Cancel:undefined, + Saves:undefined, + StudentList_value:undefined, + addname:undefined, + addnametype:false, + addnametab:undefined, + checkBoxValues:[] + }) + } + + render(){ + let { + modalname, + modaltype, + visible, + Topval, + Topvalright, + Botvalleft, + Botval, + starttime, + endtime, + Cancelname, + Savesname, + Cancel, + Saves, + StudentList_value, + addname, + addnametype, + addnametab, + addcanner, + addsave, + course_groups, + + checkAllValue, + checkBoxValues, + course_types, + pollsList, + page, + pageSize, + polls_counts, + + modalsType, + modalsTopval, + modalsBottomval, + loadtype + }=this.state; + console.log(this.props); + let {child}=this.props; + let {coursesId,Id}=this.props.match.params + const isAdmin = this.props.isAdmin() + const isStudent=this.props.isStudent(); + // console.log(child) + return( + + + {visible===true?this.getcourse_groupslist(id)} + />:""} + + {/*添加目录/选择目录*/} + + + {/* 公用的提示弹框 */} + + + +
    +

    + {polls_counts&&polls_counts.left_banner_name} + { + isAdmin && +

  • +

    + 新建 +
  • + } +

    +
    +

    + 共{polls_counts && polls_counts.polls_total_counts}个问卷 + 已发布:{polls_counts && polls_counts.polls_published_counts}个 + { + isAdmin && 未发布:{polls_counts && polls_counts.polls_unpublish_counts}个 + } +

    +
    + +
    +
    +
    + + 全部 + { course_types && course_types.user_permission == 1 && 未发布 } + 提交中 + 已截止 + +
    +
    + + { + pollsList && pollsList.length > 0 && isAdmin && +
    +
    + 已选 {checkBoxValues.length} 个 +
    +
  • this.ActionPoll("delete")}>删除
  • +
  • + +
  • +
  • + +
  • + { + course_types && course_types.course_is_public == 1 &&
  • this.ActionPoll("public")}>设为公开
  • + } +
  • this.ActionPoll("bank")}>加入题库
  • +
    +
    +
    + } + + { + pollsList && pollsList.length > 0 && + + +
    + { + pollsList && pollsList.map((item,key)=>{ + return( + this.onItemClick(item)}>} + > + ) + }) + } +
    +
    + } +
    + { + pollsList && pollsList.length==0 && + } + { + course_types && polls_counts.polls_all_counts > pageSize ? +
    + +
    + : + "" + } + + +
    + ) + } +} export default Poll; \ No newline at end of file diff --git a/public/react/src/modules/courses/poll/pollPublicBtn/ImmediatelyPublish.js b/public/react/src/modules/courses/poll/pollPublicBtn/ImmediatelyPublish.js index e0424aa93..95e5ba2ad 100644 --- a/public/react/src/modules/courses/poll/pollPublicBtn/ImmediatelyPublish.js +++ b/public/react/src/modules/courses/poll/pollPublicBtn/ImmediatelyPublish.js @@ -1,282 +1,282 @@ -import React,{ Component } from "react"; - - -import Modals from '../../../modals/Modals' -import { WordsBtn } from 'educoder' -import HomeworkModal from "../../coursesPublic/HomeworkModal"; - -import axios from 'axios' -import moment from 'moment'; - - - - -class Immediatelypublish extends Component{ - constructor(props){ - super(props) - this.state={ - modalname:undefined, - modaltype:undefined, - visible:false, - Topval:undefined, - Topvalright:undefined, - Botvalleft:undefined, - Botval:undefined, - starttime:undefined, - starttimes:undefined, - endtime:undefined, - Cancelname:undefined, - Savesname:undefined, - Cancel:undefined, - Saves:undefined, - course_groups:undefined, - - modalsType:false, - modalsTopval:"", - loadtype:false, - chooseId:undefined - } - } - //立即发布 - homeworkstart=()=>{ - let {checkBoxValues}=this.props - - - // console.log(this.props.Exercisetype==="exercise") - - - if(checkBoxValues.length==0){ - this.props.showNotification("请先在列表中选择数据"); - // this.setState({ - // modalsType:true, - // modalsTopval:"请先在列表中选择数据", - // loadtype:true - // }) - }else{ - let coursesId=this.props.match.params.coursesId; - if(this.props.Exercisetype==="exercise"){ - let url=`/courses/${coursesId}/exercises/publish_modal.json`; - axios.get(url,{ - params:{ - check_ids:checkBoxValues - } - }).then((response) => { - if(response.status===200){ - let list=[]; - if(response.data.course_info){ - for(var i=0;i 0 ? 1 : 2, - visible:true, - Topval:"本操作只对“未发布”的对象生效", - Botvalleft:"暂不发布", - Botval:"则通过后续手动设置,定时发布", - starttime:"发布时间:"+this.props.getNowFormatDates(1), - starttimes:this.props.getNowFormatDates(1), - endtime:"截止时间:"+this.props.getNowFormatDates(2), - Cancelname:"暂不发布", - Savesname:"立即发布", - Cancel:this.homeworkhide, - Saves:this.homeworkstartend, - }) - } - }).catch((error) => { - console.log(error) - }); - }else{ - let url=`/courses/${coursesId}/polls/publish_modal.json`; - axios.get(url,{ - params:{ - check_ids:checkBoxValues - } - }).then((response) => { - if(response){ - let list=[]; - if(response.data.course_info){ - for(var i=0;i 0 ? 1 : 2, - visible:true, - Topval:"本操作只对“未发布”的对象生效", - Botvalleft:"暂不发布", - Botval:"则通过后续手动设置,定时发布", - starttime:"发布时间:"+this.props.getNowFormatDates(1), - starttimes:this.props.getNowFormatDates(1), - endtime:"截止时间:"+this.props.getNowFormatDates(2), - Cancelname:"暂不发布", - Savesname:"立即发布", - Cancel:this.homeworkhide, - Saves:this.homeworkstartend, - }) - } - }).catch((error) => { - console.log(error) - }); - - } - - } - } - - //取消提示弹框 - modalCancel=()=>{ - this.setState({ - modalsType:false, - modalsTopval:"", - loadtype:false - }) - } - //暂不发布 - homeworkhide=()=>{ - this.setState({ - modalname:undefined, - modaltype:undefined, - visible:false, - Topval:undefined, - Topvalright:undefined, - Botvalleft:undefined, - Botval:undefined, - starttime:undefined, - starttimes:undefined, - endtime:undefined, - Cancelname:undefined, - Savesname:undefined, - Cancel:undefined, - Saves:undefined, - StudentList_value:undefined, - addname:undefined, - addnametype:false, - addnametab:undefined - }) - } - // 确定立即发布 - homeworkstartend=(ids,endtime)=>{ - - let {checkBoxValues}=this.props - let {chooseId}=this.state; - let coursesId=this.props.match.params.coursesId; - - if(this.props.Exercisetype==="exercise"){ - - let url=`/courses/${coursesId}/exercises/publish.json` - axios.post(url,{ - check_ids:checkBoxValues, - group_ids:chooseId, - end_time:endtime - }).then((result)=>{ - if(result){ - this.props.showNotification(result.data.message); - this.homeworkhide(); - - // 调用父级公共头部的接口刷新 - this.props.action() - } - }).catch((error)=>{ - console.log(error); - }) - - }else{ - let url=`/courses/${coursesId}/polls/publish.json` - axios.post(url,{ - check_ids:checkBoxValues, - group_ids:chooseId, - end_time:endtime - }).then((result)=>{ - if(result){ - this.props.showNotification(result.data.message); - this.homeworkhide(); - - // 调用父级公共头部的接口刷新 - this.props.action() - } - }).catch((error)=>{ - console.log(error); - }) - } - - } - - getcourse_groupslist=(id)=>{ - this.setState({ - chooseId:id - }) - } - - render(){ - let{ - modalname, - modaltype, - visible, - Topval, - Topvalright, - Botvalleft, - Botval, - starttime, - starttimes, - endtime, - Cancelname, - Savesname, - Cancel, - Saves, - course_groups, - - modalsType, - modalsTopval, - loadtype, - }=this.state - return( - - this.getcourse_groupslist(id)} - /> - {/* 公用的提示弹框 */} - - - 立即发布 - - ) - } -} +import React,{ Component } from "react"; + + +import Modals from '../../../modals/Modals' +import { WordsBtn } from 'educoder' +import HomeworkModal from "../../coursesPublic/HomeworkModal"; + +import axios from 'axios' +import moment from 'moment'; + + + + +class Immediatelypublish extends Component{ + constructor(props){ + super(props) + this.state={ + modalname:undefined, + modaltype:undefined, + visible:false, + Topval:undefined, + Topvalright:undefined, + Botvalleft:undefined, + Botval:undefined, + starttime:undefined, + starttimes:undefined, + endtime:undefined, + Cancelname:undefined, + Savesname:undefined, + Cancel:undefined, + Saves:undefined, + course_groups:undefined, + + modalsType:false, + modalsTopval:"", + loadtype:false, + chooseId:undefined + } + } + //立即发布 + homeworkstart=()=>{ + let {checkBoxValues}=this.props + + + // console.log(this.props.Exercisetype==="exercise") + + + if(checkBoxValues.length==0){ + this.props.showNotification("请先在列表中选择数据"); + // this.setState({ + // modalsType:true, + // modalsTopval:"请先在列表中选择数据", + // loadtype:true + // }) + }else{ + let coursesId=this.props.match.params.coursesId; + if(this.props.Exercisetype==="exercise"){ + let url=`/courses/${coursesId}/exercises/publish_modal.json`; + axios.get(url,{ + params:{ + check_ids:checkBoxValues + } + }).then((response) => { + if(response.status===200){ + let list=[]; + if(response.data.course_info){ + for(var i=0;i 0 ? 1 : 2, + visible:true, + Topval:"本操作只对“未发布”的对象生效", + Botvalleft:"暂不发布", + Botval:"则通过后续手动设置,定时发布", + starttime:"发布时间:"+moment(moment(new Date())).format("YYYY-MM-DD HH:mm"), + starttimes:this.props.getNowFormatDates(1), + endtime:"截止时间:"+this.props.getNowFormatDates(2), + Cancelname:"暂不发布", + Savesname:"立即发布", + Cancel:this.homeworkhide, + Saves:this.homeworkstartend, + }) + } + }).catch((error) => { + console.log(error) + }); + }else{ + let url=`/courses/${coursesId}/polls/publish_modal.json`; + axios.get(url,{ + params:{ + check_ids:checkBoxValues + } + }).then((response) => { + if(response){ + let list=[]; + if(response.data.course_info){ + for(var i=0;i 0 ? 1 : 2, + visible:true, + Topval:"本操作只对“未发布”的对象生效", + Botvalleft:"暂不发布", + Botval:"则通过后续手动设置,定时发布", + starttime:"发布时间:"+moment(moment(new Date())).format("YYYY-MM-DD HH:mm"), + starttimes:this.props.getNowFormatDates(1), + endtime:"截止时间:"+this.props.getNowFormatDates(2), + Cancelname:"暂不发布", + Savesname:"立即发布", + Cancel:this.homeworkhide, + Saves:this.homeworkstartend, + }) + } + }).catch((error) => { + console.log(error) + }); + + } + + } + } + + //取消提示弹框 + modalCancel=()=>{ + this.setState({ + modalsType:false, + modalsTopval:"", + loadtype:false + }) + } + //暂不发布 + homeworkhide=()=>{ + this.setState({ + modalname:undefined, + modaltype:undefined, + visible:false, + Topval:undefined, + Topvalright:undefined, + Botvalleft:undefined, + Botval:undefined, + starttime:undefined, + starttimes:undefined, + endtime:undefined, + Cancelname:undefined, + Savesname:undefined, + Cancel:undefined, + Saves:undefined, + StudentList_value:undefined, + addname:undefined, + addnametype:false, + addnametab:undefined + }) + } + // 确定立即发布 + homeworkstartend=(ids,endtime)=>{ + + let {checkBoxValues}=this.props + let {chooseId}=this.state; + let coursesId=this.props.match.params.coursesId; + + if(this.props.Exercisetype==="exercise"){ + + let url=`/courses/${coursesId}/exercises/publish.json` + axios.post(url,{ + check_ids:checkBoxValues, + group_ids:chooseId, + end_time:endtime + }).then((result)=>{ + if(result){ + this.props.showNotification(result.data.message); + this.homeworkhide(); + + // 调用父级公共头部的接口刷新 + this.props.action() + } + }).catch((error)=>{ + console.log(error); + }) + + }else{ + let url=`/courses/${coursesId}/polls/publish.json` + axios.post(url,{ + check_ids:checkBoxValues, + group_ids:chooseId, + end_time:endtime + }).then((result)=>{ + if(result){ + this.props.showNotification(result.data.message); + this.homeworkhide(); + + // 调用父级公共头部的接口刷新 + this.props.action() + } + }).catch((error)=>{ + console.log(error); + }) + } + + } + + getcourse_groupslist=(id)=>{ + this.setState({ + chooseId:id + }) + } + + render(){ + let{ + modalname, + modaltype, + visible, + Topval, + Topvalright, + Botvalleft, + Botval, + starttime, + starttimes, + endtime, + Cancelname, + Savesname, + Cancel, + Saves, + course_groups, + + modalsType, + modalsTopval, + loadtype, + }=this.state + return( + + this.getcourse_groupslist(id)} + /> + {/* 公用的提示弹框 */} + + + 立即发布 + + ) + } +} export default Immediatelypublish \ No newline at end of file diff --git a/public/react/src/modules/courses/shixunHomework/Listofworks.js b/public/react/src/modules/courses/shixunHomework/Listofworks.js index e38a0c453..ba3c34c51 100644 --- a/public/react/src/modules/courses/shixunHomework/Listofworks.js +++ b/public/react/src/modules/courses/shixunHomework/Listofworks.js @@ -821,7 +821,7 @@ class Listofworks extends Component { Topval: "本操作只对“未发布”的对象生效", Botvalleft: "暂不发布", Botval: "则通过后续手动设置,定时发布", - starttime: "发布时间:" + starttime, + starttime: "发布时间:" + moment(moment(new Date())).format("YYYY-MM-DD HH:mm"), endtime: "截止时间:" + endtime, starttimes:starttime, typs:"start", diff --git a/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js b/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js index 461c4d74d..a62e815ef 100644 --- a/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js +++ b/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js @@ -304,7 +304,7 @@ class ShixunStudentWork extends Component { Topval:"本操作只对“未发布”的对象生效", Botvalleft:"暂不发布", Botval:"则通过后续手动设置,定时发布", - starttime:"发布时间:"+starttime, + starttime:"发布时间:"+moment(moment(new Date())).format("YYYY-MM-DD HH:mm"), endtime:"截止时间:"+endtime, Cancelname:"暂不发布", Savesname:"立即发布", diff --git a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js index 919a744cf..108ab58f0 100644 --- a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js +++ b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js @@ -1237,7 +1237,7 @@ class Trainingjobsetting extends Component { Topval: "本操作只对“未发布”的对象生效", Botvalleft: "暂不发布", Botval: "则通过后续手动设置,定时发布", - starttime: "发布时间:" + starttime, + starttime: "发布时间:" + moment(moment(new Date())).format("YYYY-MM-DD HH:mm"), starttimes:starttime, typs:"start", endtime: "截止时间:" + endtime, diff --git a/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js b/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js index a06a5be32..7808355e8 100644 --- a/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js +++ b/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js @@ -148,7 +148,7 @@ class Workquestionandanswer extends Component { Topval: "本操作只对“未发布”的对象生效", Botvalleft: "暂不发布", Botval: "则通过后续手动设置,定时发布", - starttime: "发布时间:" + starttime, + starttime: "发布时间:" + moment(moment(new Date())).format("YYYY-MM-DD HH:mm"), endtime: "截止时间:" + endtime, Cancelname: "暂不发布", Savesname: "立即发布", diff --git a/public/react/src/modules/courses/shixunHomework/shixunHomework.js b/public/react/src/modules/courses/shixunHomework/shixunHomework.js index 9589d4515..5970a8907 100644 --- a/public/react/src/modules/courses/shixunHomework/shixunHomework.js +++ b/public/react/src/modules/courses/shixunHomework/shixunHomework.js @@ -209,7 +209,7 @@ class ShixunHomework extends Component{ Topval:"本操作只对“未发布”的对象生效", Botvalleft:"暂不发布", Botval:"则通过后续手动设置,定时发布", - starttime:"发布时间:"+starttime, + starttime:"发布时间:"+moment(moment(new Date())).format("YYYY-MM-DD HH:mm"), starttimes:starttime, endtime:"截止时间:"+endtime, Cancelname:"暂不发布", @@ -403,7 +403,7 @@ class ShixunHomework extends Component{ Topval:"本操作只对“未发布”的对象生效", Botvalleft:"暂不发布", Botval:"则通过后续手动设置,定时发布", - starttime:"发布时间:"+ starttime, + starttime:"发布时间:"+ moment(moment(new Date())).format("YYYY-MM-DD HH:mm"), starttimes:starttime, typs:"start", endtime:"截止时间:"+ endtime,