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/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/GraduationTasksedit.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksedit.js index 36c2f9d3f..9874b26fa 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksedit.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksedit.js @@ -125,7 +125,7 @@ class GraduationTasksedit extends Component{ GraduationTasksedittype=false; // window.location.href="/courses/"+course_id+"/graduation/"+graduationId+"/graduation_tasks/"+category_id+"/questions"; // this.goback() - this.props.history.push("/courses/"+this.props.match.params.coursesId+"/graduation_tasks/"+graduation_id+"/"+this.props.match.params.category_id +"/setting"); + window.location.href="/courses/"+this.props.match.params.coursesId+"/graduation_tasks/"+graduation_id+"/"+this.props.match.params.category_id +"/setting"; } }).catch((error) => { console.log(error) diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js index 762fe1406..dfa6879f5 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js @@ -140,9 +140,11 @@ class GraduationTaskssettingapp extends Component{ componentDidMount(){ - + let query=this.props.location.search + const type = query.split('?tab='); + let id=parseInt(type[1]) this.getsettings(); - if(this.props.isAdmin()===true){ + if(this.props.isAdmin()===true&&isNaN(id)){ this.editSetting() } } @@ -413,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, @@ -484,6 +486,31 @@ class GraduationTaskssettingapp extends Component{ let {latepenalty,hascommit,minnums,max_nums,publish_time,end_time,crosscomment,latetime,starttimetype}=this.state; + + if(isNaN(parseInt(this.state.minnum))){ + this.setState({ + numtype:true + }) + this.scrollToAnchor("publishtimestart"); + return + }else{ + this.setState({ + numtype:false + }) + } + if(isNaN(parseInt(this.state.maxnum))){ + this.setState({ + numtype:true + }) + this.scrollToAnchor("publishtimestart"); + return + }else{ + this.setState({ + numtype:false + }) + } + + if(latepenalty===undefined){ this.setState({ latepenaltytype:true, @@ -611,26 +638,7 @@ class GraduationTaskssettingapp extends Component{ return } - if(isNaN(parseInt(this.state.minnum))){ - this.setState({ - numtype:true - }) - return - }else{ - this.setState({ - numtype:false - }) - } - if(isNaN(parseInt(this.state.maxnum))){ - this.setState({ - numtype:true - }) - return - }else{ - this.setState({ - numtype:false - }) - } + @@ -1036,7 +1044,7 @@ class GraduationTaskssettingapp extends Component{ 任务问答 设置 + to={"/courses/"+courseId+"/graduation_tasks/"+category_id+"/"+task_Id+"/setting?tab=3"}>设置 {/*导出*/}
{ topicInfo && topicInfo.description!="" && - + }
{ diff --git a/public/react/src/modules/courses/graduation/topics/GraduateTopicDetailTable.js b/public/react/src/modules/courses/graduation/topics/GraduateTopicDetailTable.js index 7dbbf21f7..963c7a4f9 100644 --- a/public/react/src/modules/courses/graduation/topics/GraduateTopicDetailTable.js +++ b/public/react/src/modules/courses/graduation/topics/GraduateTopicDetailTable.js @@ -254,7 +254,7 @@ class GraduateTopicDetailTable extends Component{ tableData.users_list && tableData.users_list.length > 0 && tableData.users_list.map((item,key)=>{ return(
  • - {parseInt(key)*parseInt(page*15)+1} + {parseInt(key+1)+(parseInt(page-1)*15)} {item.student_name} {item.student_id} {item.class_group_name || "--"} diff --git a/public/react/src/modules/courses/graduation/topics/GraduateTopicItem.js b/public/react/src/modules/courses/graduation/topics/GraduateTopicItem.js index 136280943..17a1b070e 100644 --- a/public/react/src/modules/courses/graduation/topics/GraduateTopicItem.js +++ b/public/react/src/modules/courses/graduation/topics/GraduateTopicItem.js @@ -96,26 +96,26 @@ class GraduateTopicItem extends Component{

    - + {discussMessage.author} - {discussMessage.selected_count} 已选 - {discussMessage.confirmation_count} 已确认 + {discussMessage.selected_count} 已选 + {discussMessage.confirmation_count} 已确认 { isAdmin && this.editTopic(`${discussMessage.id}`)} style="blue" className="font-16">编辑 } { - isStudent && data.user_selected == true && discussMessage.user_selected==true && - chooseTopic(`${discussMessage.id}`,index,discussMessage.user_selected)} style="blue" className="font-16"> + isStudent && data.user_selected == true && discussMessage.user_topic_status==0 && + chooseTopic(`${discussMessage.id}`,index,true)} style="blue" className="font-16"> 取消选题 } { - isStudent && data.user_selected == false && discussMessage.user_selected == false && - chooseTopic(`${discussMessage.id}`,index,discussMessage.user_selected)} style="blue" className="font-16"> + isStudent && data.user_selected==false && (discussMessage.user_topic_status == null || discussMessage.user_topic_status == 2) && + chooseTopic(`${discussMessage.id}`,index,false)} style="blue" className="font-16"> 选题 } diff --git a/public/react/src/modules/courses/graduation/topics/GraduateTopicNew.js b/public/react/src/modules/courses/graduation/topics/GraduateTopicNew.js index 876f2e4d0..c3c0d18e2 100644 --- a/public/react/src/modules/courses/graduation/topics/GraduateTopicNew.js +++ b/public/react/src/modules/courses/graduation/topics/GraduateTopicNew.js @@ -38,7 +38,7 @@ class GraduateTopicNew extends Component{ topic_source:[], topic_type:[], attachments:undefined, - addonAfter:20, + addonAfter:60, left_banner_id:undefined, course_name:undefined } @@ -87,7 +87,7 @@ class GraduateTopicNew extends Component{ let topicId=this.props.match.params.topicId let url=`/courses/${cid}/graduation_topics/${topicId}/edit.json`; axios.get((url)).then((result)=>{ - if(result.status==200){ + if(result){ this.setState({ left_banner_id:result.data.left_banner_id, course_name:result.data.course_name, @@ -257,7 +257,7 @@ class GraduateTopicNew extends Component{ // 附件相关 ------------ END changeTopicName=(e)=>{ - let num= 20 - parseInt(e.target.value.length); + let num= 60 - parseInt(e.target.value.length); this.setState({ addonAfter:num < 0 ? 0 : num }) @@ -315,6 +315,11 @@ class GraduateTopicNew extends Component{ console.log(this.props); return(

    +

    {course_name} @@ -357,10 +362,10 @@ class GraduateTopicNew extends Component{ rules: [{ required: true, message: '请输入选题名称', }, { - max: 20, message: '最大限制为20个字符', + max: 60, message: '最大限制为60个字符', }], })( - + )}

    @@ -381,6 +386,34 @@ class GraduateTopicNew extends Component{ width: 350px; margin-bottom:10px; } + .ant-upload-list-item{ + margin-top:0px!important; + } + + .ant-form-item-children{ + position:unset + } + .rememberTip{ + position:absolute; + right:0px; + bottom:-10px; + } + .chooseDes .ant-form-explain{ + position:absolute; + bottom:-10px; + left:0px; + } + .setUploadStyle .uploadBtn{ + height:20px; + line-height:20px; + } + .setUploadStyle .ant-form-item-control{ + margin-top:15px!important; + line-height:22px!important; + } + .setUploadStyle .ant-upload-list{ + margin-top:5px; + } `} @@ -389,7 +422,7 @@ class GraduateTopicNew extends Component{ {getFieldDecorator('description', { rules: [{ @@ -402,7 +435,9 @@ class GraduateTopicNew extends Component{ mdID={'courseMessageMD'} initValue={this.editTopic ? this.editTopic.content : ''} className="courseMessageMD"> )} - + { getFieldDecorator('file',{ rules:[{ @@ -505,6 +540,9 @@ class GraduateTopicNew extends Component{ .flexBlock .ant-row.ant-form-item { margin-bottom: 6px; } + .ant-cascader-menu{ + min-width:125px!important; + } `} @@ -543,7 +581,7 @@ class GraduateTopicNew extends Component{ {getFieldDecorator('city', { rules: [{ diff --git a/public/react/src/modules/courses/graduation/topics/index.js b/public/react/src/modules/courses/graduation/topics/index.js index d7d6852f2..aaba86e9e 100644 --- a/public/react/src/modules/courses/graduation/topics/index.js +++ b/public/react/src/modules/courses/graduation/topics/index.js @@ -223,7 +223,23 @@ onDelete=(index)=>{ }) }else{ // 加入题库 - + let courseid=this.props.match.params.coursesId + let url=`/courses/${courseid}/graduation_topics/add_to_bank.json`; + axios.post((url),{ + topic_ids:checkBoxValues + }).then((result)=>{ + if(result){ + this.props.showNotification(`题库更新成功`); + let {searchValue,page,status} =this.state + this.fetchAll(searchValue,page,status); + this.setState({ + checkBoxValues:[], + checkAllValue:false + }) + } + }).catch((error)=>{ + console.log(error) + }) } }else{ @@ -337,7 +353,7 @@ onBoardsNew=()=>{ {/* 参考普通作业 - 题库选用 */} {/* this.useFromBank()}>题库选用 正式版没有,先隐藏*/}

    - < a href={`/api/courses/${this.props.match.params.coursesId}/graduation_topics/export.xls`} className={"color-blue mr20 font-16"}>导出 + < a href={`/api/courses/${this.props.match.params.coursesId}/graduation_topics/export.xlsx`} className={"color-blue mr20 font-16"}>导出 this.onBoardsNew()}>新建 ):"" } 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/PollDetailTabFirst.js b/public/react/src/modules/courses/poll/PollDetailTabFirst.js index 4166895e1..6a5be2e8d 100644 --- a/public/react/src/modules/courses/poll/PollDetailTabFirst.js +++ b/public/react/src/modules/courses/poll/PollDetailTabFirst.js @@ -187,7 +187,7 @@ class PollDetailTabFirst extends Component{ key: 'classes', dataIndex: 'classes', width:160, - className:course_groups && course_groups.length > 0?"edu-txt-center":"edu-txt-center none" + className:poll_types && poll_types.groups_count > 0 ? "edu-txt-center":"edu-txt-center none" }, { title: '提交状态', dataIndex: 'status', diff --git a/public/react/src/modules/courses/poll/PollListItem.js b/public/react/src/modules/courses/poll/PollListItem.js index 769b4db33..3ebb6eb73 100644 --- a/public/react/src/modules/courses/poll/PollListItem.js +++ b/public/react/src/modules/courses/poll/PollListItem.js @@ -49,23 +49,23 @@ class PollListItem extends Component{

    { item.polls_status !=1 && - + {item.poll_answer} 已答 {item.poll_unanswer} 未答 } { item.polls_status ==1 && item.publish_time ==null && item.created_at && - 创建于{moment(item.created_at).format(dataformat)} + 创建于{moment(item.created_at).format(dataformat)} } { item.polls_status ==1 && item.publish_time !=null && - 将发布于{moment(item.publish_time).format(dataformat)} + 将发布于{moment(item.publish_time).format(dataformat)} } { item.polls_status ==2 && item.publish_time !=null && - {formatDuring(t)} + {formatDuring(t)} } { @@ -81,21 +81,14 @@ class PollListItem extends Component{ } :"" } -

    - { - IsAdmin && -
    -
      -
    • - -
        -
      • 编辑
      • -
      • 设置
      • -
      -
    • + { + IsAdmin && +
        + 设置 + 编辑
      -
    - } + } +

    ) 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 d346486d4..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", @@ -1116,7 +1116,7 @@ class Listofworks extends Component { >设置 {this.props.isAdmin() ? 导出 : ""} {this.props.isAdmin() ? teacherdata && teacherdata.end_immediately === true ? diff --git a/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js b/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js index 3fbdb2d3b..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:"立即发布", @@ -590,7 +590,7 @@ class ShixunStudentWork extends Component { >设置 {this.props.isAdmin() ? 导出 : ""} {this.props.isAdmin()? data.end_immediately===true? diff --git a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js index 70a92aae6..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, @@ -1592,7 +1592,7 @@ class Trainingjobsetting extends Component { {/**/} {this.props.isAdmin() ? 导出 : ""} {this.props.isAdmin() ?jobsettingsdata&&jobsettingsdata.data.end_immediately===true? 立即截止 : "": ""} diff --git a/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js b/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js index 419bca1b5..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: "立即发布", @@ -411,7 +411,7 @@ class Workquestionandanswer extends Component { {/*导出成绩*/} {this.props.isAdmin() ? 导出 : ""} {this.props.isAdmin() ?jobsettingsdata&&jobsettingsdata.data.end_immediately===true? 立即截止:"" : ""} 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, diff --git a/public/react/src/modules/login/Trialapplication.js b/public/react/src/modules/login/Trialapplication.js index 9c9f0280b..e0a631541 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,377 @@ 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 9dd0441de..25d290fac 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -1,921 +1,929 @@ -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; - - - -//
      -//
    • 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 &&*/} -{/**/} -{/**/} -{/**/} -{/*}*/} - - - -{/* - 需求:消息数量 - - */} +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, + showTrial: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 =()=>{ + // console.log("点击了") + // this.setState({ + // isRenders: true, + // showTrial:true, + // }) + // } + + // 关闭 + cancelModulationModels = () => { + this.setState({isRenders: false}) + } + + 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, + isRenders, + }=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?*/} + {/* this.cancelModulationModels()}*/} + {/* />*/} + {/* :""*/} + {/*}*/} + +
    + {/*<%= 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 &&*/} +{/**/} +{/**/} +{/**/} +{/*}*/} + + + +{/* + 需求:消息数量 + + */} diff --git a/public/react/src/modules/tpm/challengesnew/TPMMDEditor.js b/public/react/src/modules/tpm/challengesnew/TPMMDEditor.js index 30fa1c803..4af26d698 100644 --- a/public/react/src/modules/tpm/challengesnew/TPMMDEditor.js +++ b/public/react/src/modules/tpm/challengesnew/TPMMDEditor.js @@ -300,7 +300,7 @@ export default class TPMMDEditor extends Component { -
    +
    {noStorage == true ? '' :

    } {noStorage == true ? '' :

    }
    diff --git a/public/react/src/modules/user/usersInfo/Infos.js b/public/react/src/modules/user/usersInfo/Infos.js index 0f608426c..3300423a1 100644 --- a/public/react/src/modules/user/usersInfo/Infos.js +++ b/public/react/src/modules/user/usersInfo/Infos.js @@ -15,6 +15,8 @@ import "../../courses/css/members.css" import "../../courses/css/Courses.css" import update from 'immutability-helper' +import Trialapplication from '../../login/Trialapplication' + const $ = window.$; class Infos extends Component{ @@ -26,7 +28,8 @@ class Infos extends Component{ is_edit:false, sign:undefined, type:0, - login:undefined + login:undefined, + isRenders:false } } componentDidMount =()=>{ @@ -44,6 +47,8 @@ class Infos extends Component{ } } } + + //获取个人主页信息 getInfo = (user_login) =>{ let url =`/users/${user_login}/homepage_info.json`; @@ -146,6 +151,22 @@ class Infos extends Component{ } } + // 试用申请 + trialapplications =()=>{ + this.setState({ + isRenders: true, + showTrial:true + }) + } + cancelModulationModels=()=>{ + this.setState({ + isRenders: false + }) + } + ToBank=(url)=>{ + window.location.href=url; + } + render(){ let { data , @@ -155,12 +176,16 @@ class Infos extends Component{ type, followed, id, - login + login, + isRenders }=this.state; let {username}= this.props.match.params; let {isAdmin}=this.props.isAdmin(); return(
    + { + isRenders && this.cancelModulationModels()}/> + }
    @@ -251,7 +276,7 @@ class Infos extends Component{ : 签到 : - 试用申请 + 试用申请 }
    : @@ -268,7 +293,7 @@ class Infos extends Component{ 实训 实训课程 项目 - { isAdmin && 题库 } + { data && data.identity !="学生" && this.ToBank(`/users/${username}?type=a_project`)}>题库 }
    diff --git a/public/react/src/modules/user/usersInfo/InfosCourse.js b/public/react/src/modules/user/usersInfo/InfosCourse.js index 1a6b78542..b864dff63 100644 --- a/public/react/src/modules/user/usersInfo/InfosCourse.js +++ b/public/react/src/modules/user/usersInfo/InfosCourse.js @@ -41,7 +41,7 @@ class InfosCourse extends Component{ category, status, page, - per_page:category && page ==1?17:16 + per_page: this.props.is_current && category && page ==1?17:16 }}).then((result)=>{ if(result){ this.setState({ @@ -111,18 +111,21 @@ class InfosCourse extends Component{
  • this.changeCategory("manage")}>{is_current ? "我":"TA"}管理的
  • this.changeCategory("study")}>{is_current ? "我":"TA"}学习的
  • - + { + is_current && + + }

    共参与{totalCount}个{category?category=="manage"?"发布":"学习":"课堂"} 时间最新

    { - !isStudent && page == 1 && !category && + !isStudent && page == 1 && !category && is_current && } { diff --git a/public/react/src/modules/user/usersInfo/InfosPath.js b/public/react/src/modules/user/usersInfo/InfosPath.js index 156370f05..55422f208 100644 --- a/public/react/src/modules/user/usersInfo/InfosPath.js +++ b/public/react/src/modules/user/usersInfo/InfosPath.js @@ -44,7 +44,7 @@ class InfosPath extends Component{ status, sort_by, page, - per_page:category && page ==1?17:16 + per_page:this.props.is_current && category && page ==1?17:16 }}).then((result)=>{ if(result){ this.setState({ @@ -126,7 +126,7 @@ class InfosPath extends Component{
  • this.changeCategory("study")}>{is_current ? "我":"TA"}学习的
  • { - category && category == "manage" && + category && category == "manage" && is_current &&
  • this.changeStatus()}>全部
  • this.changeStatus("editing")}>编辑中
  • @@ -135,7 +135,7 @@ class InfosPath extends Component{
    } { - category && category == "study" && + category && category == "study" && is_current &&
  • this.changeStatus()}>全部
  • this.changeStatus("unfinished")}>未完成
  • @@ -148,7 +148,7 @@ class InfosPath extends Component{
    { - isStudent ==false && page == 1 && !category && + !isStudent && page == 1 && !category && is_current && } { diff --git a/public/react/src/modules/user/usersInfo/InfosProject.js b/public/react/src/modules/user/usersInfo/InfosProject.js index eb3ef9b65..fab96f59e 100644 --- a/public/react/src/modules/user/usersInfo/InfosProject.js +++ b/public/react/src/modules/user/usersInfo/InfosProject.js @@ -37,7 +37,7 @@ class InfosProject extends Component{ category, status, page, - per_page:category && page ==1?17:16 + per_page:this.props.is_current && category && page ==1?17:16 }}).then((result)=>{ if(result){ this.setState({ @@ -107,18 +107,21 @@ class InfosProject extends Component{
  • this.changeCategory("manage")}>{is_current ? "我":"TA"}管理的
  • this.changeCategory("study")}>{is_current ? "我":"TA"}学习的
  • - + { + is_current && + + }

    共参与{totalCount}个{category?category=="manage"?"发布":"学习":"项目"} 时间最新

    { - !isStudent && page == 1 && !category && + !isStudent && page == 1 && !category && is_current && } { diff --git a/public/react/src/modules/user/usersInfo/InfosShixun.js b/public/react/src/modules/user/usersInfo/InfosShixun.js index 1fcd86b98..90575f9f0 100644 --- a/public/react/src/modules/user/usersInfo/InfosShixun.js +++ b/public/react/src/modules/user/usersInfo/InfosShixun.js @@ -44,7 +44,7 @@ class InfosShixun extends Component{ status, sort_by, page, - per_page:category && page ==1?17:16 + per_page:this.props.is_current && category && page ==1?17:16 }}).then((result)=>{ if(result){ this.setState({ @@ -126,7 +126,7 @@ class InfosShixun extends Component{
  • this.changeCategory("study")}>{is_current ? "我":"TA"}学习的
  • { - category && category == "manage" && + category && category == "manage" && is_current &&
  • this.changeStatus()}>全部
  • this.changeStatus("editing")}>编辑中
  • @@ -136,7 +136,7 @@ class InfosShixun extends Component{
    } { - category && category == "study" && + category && category == "study" && is_current &&
  • this.changeStatus()}>全部
  • this.changeStatus("processing")}>未通关
  • @@ -157,7 +157,7 @@ class InfosShixun extends Component{
    { - isStudent ==false && page == 1 && !category && + !isStudent && page == 1 && !category && is_current && } {