From 72cff809e5ef60cc4d61d8cf029af25c5b12377f Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Sat, 9 May 2020 11:35:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=AF=95=E8=AE=BE=E9=83=A8?= =?UTF-8?q?=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/courses/graduation/style.css | 56 - .../graduation/tasks/GraduateTaskItem.js | 407 ----- .../graduation/tasks/GraduationAcross.js | 556 ------ .../graduation/tasks/GraduationTaskDetail.js | 576 ------ .../tasks/GraduationTasksSubmitedit.js | 871 --------- .../tasks/GraduationTasksSubmitnew.js | 859 --------- .../tasks/GraduationTasksappraise.js | 349 ---- .../GraduationTasksappraiseMainEditor.js | 267 --- .../tasks/GraduationTasksappraiseReply.css | 36 - .../tasks/GraduationTasksappraiseReply.js | 195 --- .../GraduationTasksappraiseReplyChild.js | 103 -- .../graduation/tasks/GraduationTasksedit.js | 527 ------ .../graduation/tasks/GraduationTasksnew.js | 533 ------ .../tasks/GraduationTaskssetting.js | 1311 -------------- .../tasks/GraduationTaskssettingReply.js | 278 --- .../tasks/GraduationTaskssettinglist.js | 1553 ----------------- .../tasks/GraduationTaskssettingquestions.js | 400 ----- .../graduation/tasks/Graduationclass.css | 7 - .../graduation/tasks/Graduationtaskitem.js | 83 - .../graduation/tasks/TaskPublishModal.js | 140 -- src/modules/courses/graduation/tasks/index.js | 818 --------- .../topics/ChooseGraduateTopicModal.js | 89 - .../graduation/topics/GraduateTopicDetail.js | 164 -- .../topics/GraduateTopicDetailInfo.js | 130 -- .../topics/GraduateTopicDetailTable.js | 306 ---- .../graduation/topics/GraduateTopicItem.js | 157 -- .../graduation/topics/GraduateTopicNew.js | 635 ------- .../graduation/topics/GraduateTopicNewFrom.js | 520 ------ .../topics/GraduateTopicPostWorksNew.js | 432 ----- .../graduation/topics/GraduateTopicReply.css | 13 - .../graduation/topics/GraduateTopicReply.js | 270 --- .../courses/graduation/topics/index.js | 519 ------ 32 files changed, 13160 deletions(-) delete mode 100644 src/modules/courses/graduation/style.css delete mode 100644 src/modules/courses/graduation/tasks/GraduateTaskItem.js delete mode 100644 src/modules/courses/graduation/tasks/GraduationAcross.js delete mode 100644 src/modules/courses/graduation/tasks/GraduationTaskDetail.js delete mode 100644 src/modules/courses/graduation/tasks/GraduationTasksSubmitedit.js delete mode 100644 src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js delete mode 100644 src/modules/courses/graduation/tasks/GraduationTasksappraise.js delete mode 100644 src/modules/courses/graduation/tasks/GraduationTasksappraiseMainEditor.js delete mode 100644 src/modules/courses/graduation/tasks/GraduationTasksappraiseReply.css delete mode 100644 src/modules/courses/graduation/tasks/GraduationTasksappraiseReply.js delete mode 100644 src/modules/courses/graduation/tasks/GraduationTasksappraiseReplyChild.js delete mode 100644 src/modules/courses/graduation/tasks/GraduationTasksedit.js delete mode 100644 src/modules/courses/graduation/tasks/GraduationTasksnew.js delete mode 100644 src/modules/courses/graduation/tasks/GraduationTaskssetting.js delete mode 100644 src/modules/courses/graduation/tasks/GraduationTaskssettingReply.js delete mode 100644 src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js delete mode 100644 src/modules/courses/graduation/tasks/GraduationTaskssettingquestions.js delete mode 100644 src/modules/courses/graduation/tasks/Graduationclass.css delete mode 100644 src/modules/courses/graduation/tasks/Graduationtaskitem.js delete mode 100644 src/modules/courses/graduation/tasks/TaskPublishModal.js delete mode 100644 src/modules/courses/graduation/tasks/index.js delete mode 100644 src/modules/courses/graduation/topics/ChooseGraduateTopicModal.js delete mode 100644 src/modules/courses/graduation/topics/GraduateTopicDetail.js delete mode 100644 src/modules/courses/graduation/topics/GraduateTopicDetailInfo.js delete mode 100644 src/modules/courses/graduation/topics/GraduateTopicDetailTable.js delete mode 100644 src/modules/courses/graduation/topics/GraduateTopicItem.js delete mode 100644 src/modules/courses/graduation/topics/GraduateTopicNew.js delete mode 100644 src/modules/courses/graduation/topics/GraduateTopicNewFrom.js delete mode 100644 src/modules/courses/graduation/topics/GraduateTopicPostWorksNew.js delete mode 100644 src/modules/courses/graduation/topics/GraduateTopicReply.css delete mode 100644 src/modules/courses/graduation/topics/GraduateTopicReply.js delete mode 100644 src/modules/courses/graduation/topics/index.js diff --git a/src/modules/courses/graduation/style.css b/src/modules/courses/graduation/style.css deleted file mode 100644 index cf438a6a..00000000 --- a/src/modules/courses/graduation/style.css +++ /dev/null @@ -1,56 +0,0 @@ -.ant-checkbox-group > div .boardsList{ - padding:20px 30px!important; - background-color: #fff; - /*margin-bottom: 20px;*/ - border-top: none!important -} -/*.ant-checkbox-group > div .boardsList:hover{*/ - /*box-shadow: 0px 1px 15px rgba(156, 156, 156, 0.1);*/ -/*}*/ - -.boardsList .contentSection { - flex: 1; - margin-left: 15px; -} - -.graduateTopicList .ant-checkbox-wrapper { - margin-top: -33px; -} - -.ant-select-selection--single,.ant-select-selection__rendered{ - height: 40px; - line-height: 40px; -} - -.ant-input:focus + .ant-input-group-addon{ - background-color: #fff!important; -} -.ant-input-group-addon{ - color: #666!important; - font-size: 12px; - border: 1px solid #d9d9d9!important; - border-left: none!important; -} - -.courseForm .ant-form-item-label{ - margin-left: unset; -} - -/* 毕设选题列表 */ -.TopicDetailTable .topHead{background-color: #F5F5F5;height: 56px;color: #666666;padding:0px 30px} -.TopicDetailTable .topHead span,.TopicDetailTable .bottomBody li span{display: block;float: left;justify-content: center;align-items: center;display: -webkit-flex;height: 56px;} -.TopicDetailTable .bottomBody{padding:0px 30px} -.TopicDetailTable .bottomBody li{border-bottom: 1px solid #eee;clear: both;} -.TopicDetailTable .bottomBody li:last-child{border-bottom: none;} - -.acrossSureBtn{ - width: 40px; - height: 24px; - line-height: 18px; - /* border: 1px solid rgba(76,172,255,1); */ - /* color: #4CACFF!important; */ - float: left; - /* border-radius: 4px; */ - text-align: center; -} - diff --git a/src/modules/courses/graduation/tasks/GraduateTaskItem.js b/src/modules/courses/graduation/tasks/GraduateTaskItem.js deleted file mode 100644 index 6010d309..00000000 --- a/src/modules/courses/graduation/tasks/GraduateTaskItem.js +++ /dev/null @@ -1,407 +0,0 @@ -import React,{ Component } from "react"; -import CoursesListType from '../../coursesPublic/CoursesListType'; -import { WordsBtn } from 'educoder'; -import {Tooltip} from 'antd'; -import {Link} from 'react-router-dom'; -import axios from 'axios'; -import Modals from '../../../modals/Modals'; -import Associationmodel from '../../coursesPublic/Associationmodel'; -import AccessoryModal from "../../coursesPublic/AccessoryModal"; - - -class GraduateTaskItem extends Component{ - constructor(props){ - super(props); - this.state = { - modalname:"关联项目", - visible:false - } - } - - componentDidMount() { - // let url="/graduation_tasks/"+this.props.taskid+"/graduation_works/check_project.json"; - // axios.get(url).then((result)=>{ - // // console.log(result) - // }).catch((error)=>{ - // console.log(error) - // }) - // - // let is_relate=false - // - // this.setState({ - // isrelate:is_relate - // }) - } - - cannelAssociation=()=>{ - - this.setState({ - Modalstype:true, - Modalstopval:"确定要取消该项目关联?", - cardsModalcancel:this.cannerassocition, - cardsModalsavetype:this.savetassociton - }) - - } - cannerassocition=()=>{ - - this.setState({ - Modalstype:false, - Modalstopval:"", - cardsModalcancel:"", - cardsModalsavetype:"", - loadtype:false - }) - - } - savetassociton=()=>{ - this.cannerassocition(); - let taskid=this.props.taskid; - let url = "/graduation_tasks/"+taskid+"/graduation_works/cancel_relate_project.json"; - axios.get(url).then((result)=>{ - - if(result.data.status===0){ - // this.setState({ - // Modalstype:true, - // Modalstopval:result.data.message, - // cardsModalsavetype:this.cannerassocition, - // loadtype:true - // }) - this.props.funlist() - } - - }).catch((error)=>{ - console.log(error) - }) - - } - saveAssociationItems=()=>{ - - let coursesId=this.props.coursesId; - let taskid=this.props.taskid; - let url="/courses/"+coursesId+"/graduation_tasks/relate_project.json"; - axios.post(url,{ - project_id:taskid - }).then((result)=>{ - // console.log(result) - if(result.data.status===0){ - this.setState({ - Modalstype:true, - Modalstopval:result.data.message, - cardsModalsavetype:this.cannerassocition, - loadtype:true - }) - } - }).catch((error)=>{ - console.log(error) - }) - - } - - - AssociationItems=()=>{ - this.setState({ - visible:true - }) - // this.setState({ - // Modalstype:true, - // - // Modalstopval:"确定要关联该项目关联?", - // cardsModalcancel:this.cannerassocition, - // cardsModalsavetype:this.saveAssociationItems - // }) - - } - - addAccessory=()=>{ - this.setState({ - visibles:true - }) - } - - Cancel=()=>{ - this.setState({ - visible:false - }) - } - Cancelvisible=()=>{ - this.setState({ - visibles:false - }) - } - - setupdate=()=>{ - this.props.funlist - } - - toDetailPage=(url)=>{ - - if(this.props.checkIfLogin()===false){ - this.props.showLoginDialog() - return - } - // if(this.props.checkIfProfileCompleted()===false){ - // this.setState({ - // AccountProfiletype:true - // }) - // return - // } - // if(this.props.checkIfProfessionalCertification()===false){ - // this.props.showProfileCompleteDialog() - // return - // } - - this.props.history.push(url); - } - render(){ - let { - Modalstype, - Modalstopval, - Modalsbottomval, - cardsModalcancel, - cardsModalsavetype, - loadtype, - modalname, - visible - } = this.state; - - const { checkBox, - discussMessage, - onItemClick, - coursesId, - categoryid, - taskid, - index, - isAdmin - } = this.props; - - return( -
window.$(`.taskitem${index} input`).click() }> - - - {visible===true?:""} - {this.state.visibles===true?:""} - - - { checkBox } - - {/* - style={{borderTop:data===undefined?"":data.course_identity<4?'1px solid #EBEBEB':'1px solid transparent'}} - */} - - { - this.props.isAdmin?"":} -
- - -
- - { - this.props.isAdmin?this.toDetailPage("/classrooms/"+coursesId+"/graduation_tasks/"+categoryid+"/detail/"+taskid+"/list")} - title={discussMessage.name} - className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.name}:"" - } - { - this.props.isStudent? this.toDetailPage("/classrooms/"+coursesId+"/graduation_tasks/"+categoryid+"/detail/"+taskid+"/list")} - title={discussMessage.name} - className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.name}:"" - } - - { - this.props.isNotMember===true?this.props.discussMessage.private_icon===true? - {discussMessage.name} - :this.toDetailPage("/classrooms/"+coursesId+"/graduation_tasks/"+categoryid+"/"+taskid+"/list")} - title={discussMessage.name} - className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.name}:"" - } - - - { - this.props.discussMessage.private_icon===true? - - - - : -
- } - - - - {/* { !!discussMessage.sticky && 置顶 } */} -
- -
-

- - {/* {discussMessage.author.name} */} - { discussMessage.author && {discussMessage.author} } - {discussMessage.commit_count===undefined?"":{discussMessage.commit_count} 已交} - {discussMessage.uncommit_count===undefined?"":{discussMessage.uncommit_count} 未交} - {/*{discussMessage.replies_count} 3 未评*/} - - {discussMessage.task_status===1&&discussMessage.status_time!=""&&discussMessage.status_time!=null?"提交剩余时间:"+discussMessage.status_time:discussMessage.task_status===2&&discussMessage.status_time!=""&&discussMessage.status_time!=null?"补交剩余时间:"+discussMessage.status_time:discussMessage.task_status===3&&discussMessage.status_time!=""&&discussMessage.status_time!=null?"交叉评阅剩余时间:"+discussMessage.status_time:discussMessage.status_time} - - - {/* { discussMessage.replies_count != 0 && {discussMessage.replies_count} 回复 } - { discussMessage.praise_num != 0 && {discussMessage.praise_num} 点赞 } - { discussMessage.visits != 0 && {discussMessage.visits} 浏览 } */} - {/* {moment(discussMessage.created_on).fromNow()} */} - -

- - - - {this.props.isAdmin? - -
- - - 设置 - - - - 编辑 - - - this.toDetailPage("/classrooms/"+coursesId+"/graduation_tasks/"+categoryid+"/detail/"+taskid+"/list")} - className="btn colorblue colorblue font-16 mr20 fr"> - 查看详情 - -
- - :""} - - - - {this.props.isStudent? - - discussMessage&&discussMessage.work_status===null?"":discussMessage&&discussMessage.work_status.map((item,key)=>{ - - return( - - - - - {item==="提交作品"? - - - 提交作品 - - - :""} - - {item==="补交作品"? - - - 补交作品 - - - :""} - - {item==="修改作品"? - - - 修改作品 - - - :""} - - {item==="查看作品"? - - - 查看作品 - - - :""} - - {item==="创建项目"? - - - 创建项目 - - - :""} - - {item==="关联项目"? - - 关联项目 - - :""} - - - {item==="取消关联"? - - 取消关联 - - :""} - - {item==="补交附件"? - - - 补交附件 - {/**/} - - - :""} - - ) - }):""} - - {this.props.isStudent? - this.toDetailPage("/classrooms/"+coursesId+"/graduation_tasks/"+categoryid+"/detail/"+taskid+"/list")} - className="colorblue font-16 ml20 fr mt12"> - 查看详情 - :""} - -
-
- ) - } -} -export default GraduateTaskItem; diff --git a/src/modules/courses/graduation/tasks/GraduationAcross.js b/src/modules/courses/graduation/tasks/GraduationAcross.js deleted file mode 100644 index a42c3fc8..00000000 --- a/src/modules/courses/graduation/tasks/GraduationAcross.js +++ /dev/null @@ -1,556 +0,0 @@ -import React, { Component } from 'react'; - -import { Modal , Radio , Table , Pagination , Select ,Divider ,Icon , Input,Checkbox } from "antd"; -import {Link} from 'react-router-dom' -import axios from 'axios'; - -import '../style.css' - - -const RadioGroup = Radio.Group; - -const { Option } = Select; -const $ = window.$; - -const bindTableColumn=(that)=>{ - let { course_groups }=that.state - const filter=course_groups && course_groups.map((i,key)=>{ - let list={ - value: i.id, - text: i.name - } - return list; - }) - const columns = [ - { - title: '序号', - dataIndex: 'index', - key: 'index', - width:"50px", - className:"edu-txt-center", - render: (id, student, index) => { - return (that.state.page - 1) * that.state.limit + index + 1 - } - }, - { - title: '姓名', - dataIndex: 'user_name', - key: 'user_name', - render: (user_name, line, index) => { - return( - {user_name} - ) - } - },{ - title: '学号', - dataIndex: 'student_id', - key: 'student_id', - render: (student_id, line, index) => { - return( - {student_id} - ) - } - },{ - title: '分班', - dataIndex: 'course_group_name', - key: 'course_group_name', - filters:filter, - render: (course_group_name, line, index) => { - return( - {course_group_name} - ) - } - } - ]; - if(that.state.comment_status == 2){ - columns.push({ - title: '交叉评阅老师', - dataIndex: 'cross_teachers', - key: 'cross_teachers', - width:"200px", - render: (cross_teachers, line, index) => { - return( - {cross_teachers} - ) - } - }) - }else{ - columns.push({ - title: '答辩组', - dataIndex: 'cross_groups', - key: 'cross_groups', - width:"200px", - render: (cross_groups, line, index) => { - return( - {cross_groups} - ) - } - }) - } - - if(course_groups&&course_groups.length===0){ - columns.some((item,key)=> { - if (item.title === "分班") { - columns.splice(key, 1) - return true - } - } - ) - } - return columns; -} -class GraduationAcross extends Component{ - constructor(props){ - super(props); - this.state={ - comment_status:2, - page:1, - limit:7, - group_ids:undefined, - users:undefined, - user_count:undefined, - graduation_groups:undefined, - course_groups:undefined, - teachers:undefined, - tableLoading:false, - chooseCount:0, - chooseId:undefined, - AcrossTeamIds:undefined, - searchValue:undefined, - showflag:false - } - } - - - - // 根据分班筛选 - filterByGroup=(value,record)=>{ - console.log(value); - console.log(record) - } - - // 切换分配方式 - funcommentstatus = (e) =>{ - this.setState({ - comment_status:e.target.value, - chooseCount:0, - chooseId:[], - AcrossTeamIds:undefined, - searchValue:undefined, - showflag:false, - page:1 - }) - let { group_ids }=this.state; - this.getList(1,group_ids,e.target.value); - } - - componentDidMount =()=>{ - let { comment_status }=this.props; - let { page,group_ids }=this.state; - this.setState({ - comment_status - }) - - this.getList(page,group_ids,comment_status); - - window.addEventListener('click', this.clickOther) - } - - clickOther = (e) =>{ - if(e.target && e.target.matches('#acrossContent') || e.target.matches(".ant-modal-body") - || e.target.matches(".acrossfoot") || e.target.matches(".acrossHead") || e.target.matches ('.ant-radio-wrapper') || - e.target.matches("th") || e.target.matches("td")) { - this.setState({ - showflag:false - }) - } - } - - componentWillUnmount() { - window.removeEventListener('click', this.clickOther); - } - - getList=(page,group_ids,comment_status)=>{ - let { limit }=this.state; - let { task_Id }=this.props; - this.setState({ - tableLoading:true - }) - let url=`/graduation_tasks/${task_Id}/cross_comment_setting.json`; - axios.get((url),{params:{ - page,limit,group_ids,comment_status - }}).then((result)=>{ - if(result){ - this.setState({ - users:result.data.work_users && result.data.work_users.map((item,key)=>{ - let list = { - key:item.work_id, - course_group_name:item.course_group_name, - cross_teachers: item.cross_teachers, - student_id:item.student_id, - user_name:item.user_name, - work_id:item.work_id, - cross_groups:item.cross_groups - } - return list; - }), - user_count:result.data.user_count, - graduation_groups:result.data.graduation_groups, - course_groups:result.data.course_groups, - teachers:result.data.teachers, - tableLoading:false, - // AcrossTeamIds:result.data - }) - } - }).catch((error)=>{ - this.setState({ - tableLoading:false - }) - console.log(error); - }) - } - - // 切换分页 - onPageChange=(page)=>{ - this.setState({ - page, - showflag:false - }) - let{group_ids,comment_status}=this.state; - this.getList(page,group_ids,comment_status); - } - - // 下拉切换 - changeSelect = (AcrossTeamIds) =>{ - console.log(AcrossTeamIds) - this.setState({ - AcrossTeamIds - }) - } - - // 重置 - clearSelect =()=>{ - this.setState({ - AcrossTeamIds:undefined, - searchValue:undefined - }) - } - - // 确定分配 - sureAcross=()=>{ - let { AcrossTeamIds , chooseId , group_ids , comment_status,page }=this.state; - let { task_Id }=this.props; - - let type = comment_status == 2 ? "user_ids" : "graduation_group_ids"; - - let url=`/graduation_tasks/${task_Id}/assign_works.json`; - if(!AcrossTeamIds || (AcrossTeamIds && AcrossTeamIds.length==0)){ - this.props.showNotification(`请先选择${ comment_status == 2 ? "老师": "答辩组" }!`); - return; - } - if(!chooseId || (chooseId && chooseId.length==0)){ - this.props.showNotification("请先选择毕设作品!"); - return; - } - axios.post((url),{ - [type]:AcrossTeamIds, - work_ids:chooseId - }).then((result)=>{ - if(result){ - this.props.showNotification(result.data.message); - this.getList(page,group_ids,comment_status); - this.setState({ - showflag:false, - AcrossTeamIds:undefined, - chooseCount:0, - chooseId:[] - }) - } - }).catch((error)=>{ - console.log(error); - }) - } - - // 筛选 - handleTableChange =(pagination, filters, sorter)=>{ - console.log(filters.course_group_name) - // if(filters.course_group_name.length > 0){ - this.setState({ - page:1, - group_ids:filters.course_group_name - }) - let { comment_status }= this.state; - this.getList(1,filters.course_group_name,comment_status); - // } - } - - // 下拉搜索 - changeSearchValue=(e)=>{ - - this.setState({ - searchValue:e.target.value - }) - } - // 显示下拉 - changeFlag=(flag)=>{ - this.setState({ - showflag:flag - }) - } - - checkonChange=(e,list)=>{ - let newlist=[] - // AcrossTeamIds - let {comment_status}=this.state; - if(e.target.checked===true){ - if(comment_status===2){ - list.map((item,key)=>{ - newlist.push(String(item.user_id)) - }) - this.setState({ - AcrossTeamIds:newlist - }) - }else{ - list.map((item,key)=>{ - newlist.push(String(item.id)) - }) - this.setState({ - AcrossTeamIds:newlist - }) - } - }else{ - this.setState({ - AcrossTeamIds:undefined - }) - } - } - render(){ - let { - comment_status, - users, - user_count, - graduation_groups, - course_groups, - teachers, - page, - limit, - tableLoading, - chooseCount, - chooseId, - AcrossTeamIds, - searchValue,showflag, - } = this.state; - let { modalVisible } = this.props; - let courseId = this.props.match.params.coursesId; - - const radioStyle = { - display: 'block', - height: '30px', - lineHeight: '30px', - marginRight:'0px' - }; - - - - const rowSelection = { - // 选中行的key,选中行 - onChange: (selectedRowKeys, selectedRows) => { - this.setState({ - chooseId:selectedRowKeys, - chooseCount:selectedRowKeys.length, - showflag:false - }) - console.log(selectedRowKeys); - }, - selectedRowKeys:chooseId, - getCheckboxProps: record => ({ - disabled: record.name === 'Disabled User', // Column configuration not to be checked - name: record.name, - }), - }; - - - // 筛选下拉列表 - const teacherList = searchValue ? teachers&&teachers.filter(e=>e.user_name.indexOf(searchValue)>-1) : teachers; - const course_groupsList = searchValue ? course_groups&&course_groups.filter(e=>e.name.indexOf(searchValue)>-1) : course_groups; - const graduation_groupslist =searchValue ? graduation_groups&&graduation_groups.filter(e=>e.name.indexOf(searchValue)>-1) : graduation_groups; - return( - - {modalVisible===true?:""} -
- -
- -
- 评阅分配方式: - - - 手动分配评阅(逐一指定每个学生的交叉评阅老师) - 答辩组分配评阅(将老师加入不同答辩组,指定每个学生的交叉评阅答辩组, - - 立即设置答辩组 - - - -
-
- 已选 { chooseCount == 0 ? 0 : {chooseCount}} 个 - - 分配给{ comment_status && comment_status == 2 ? "老师":"答辩组"}: - - -
:""} - {comment_status != 2 &&course_groups&&course_groups.length>10?
- -
:""} - {comment_status == 2 &&teacherList&&teacherList.length>2? this.checkonChange(e,teacherList)}>全选:""} - {comment_status != 2 &&graduation_groupslist&&graduation_groupslist.length>2? this.checkonChange(e,graduation_groupslist)}>全选:""} - {menu} - -
- 提交 - 重置 -
- - )} - > - { comment_status == 2 ? - teacherList && teacherList.map((i,key)=>{ - return - }): - graduation_groupslist && graduation_groupslist.map((i,key)=>{ - return - }) - } - - - - - {/*{*/} - {/**/} - {/*}*/} -
-
-
- { - user_count > limit ? - :"" - } -
-
- 取消 - 确认 -
-
-
- ) - } -} -export default GraduationAcross; diff --git a/src/modules/courses/graduation/tasks/GraduationTaskDetail.js b/src/modules/courses/graduation/tasks/GraduationTaskDetail.js deleted file mode 100644 index d36a84f1..00000000 --- a/src/modules/courses/graduation/tasks/GraduationTaskDetail.js +++ /dev/null @@ -1,576 +0,0 @@ -import React, { Component } from 'react'; -import {getRandomNumber} from 'educoder'; -import {Link} from 'react-router-dom'; -import {Tooltip,Menu} from 'antd'; -import Loadable from 'react-loadable'; -import Loading from '../../../../Loading'; -import {BrowserRouter as Router,Route,Switch} from 'react-router-dom'; -import axios from 'axios'; -import OneSelfOrderModal from "../../coursesPublic/OneSelfOrderModal"; -import HomeworkModal from "../../coursesPublic/HomeworkModal"; -import AccessoryModal from "../../coursesPublic/AccessoryModal"; -import Associationmodel from '../../coursesPublic/Associationmodel'; -import CoursesListType from '../../coursesPublic/CoursesListType'; -import GraduationAcross from "./GraduationAcross"; -import moment from 'moment'; -import "../../css/members.css" -import "../../css/Courses.css" - -import Modals from '../../../modals/Modals'; - - -//毕设描述 -const GraduationTasksquestions= Loadable({ - loader: () => import('./GraduationTaskssettingquestions'), - loading: Loading, -}) -//毕设任务设置 -const GraduationTaskssetting=Loadable({ - loader: () => import('./GraduationTaskssetting'), - loading: Loading, -}) -//毕设任务列表 -const GraduationTaskslist=Loadable({ - loader: () => import('./GraduationTaskssettinglist'), - loading: Loading, -}) - -class GraduationTaskDetail extends Component{ - constructor(props){ - super(props); - this.state={ - modalname:undefined, - visible:false, - Topval:undefined, - starttime:undefined, - starttimes:undefined, - typs:undefined, - endtime:undefined, - Cancelname:undefined, - Savesname:undefined, - Cancel:undefined, - Saves:undefined, - Topvalright:undefined, - Botvalleft:undefined, - course_groupslist:undefined, - course_groups:undefined, - questionslist:undefined, - tab:"list", - visibles:undefined, - Modalstype:undefined, - Modalstopval:undefined, - ModalCancel:undefined, - ModalSave:undefined, - acrossVisible:undefined, - OneSelftype:false, - taskdatas:undefined - } - } - componentDidMount(){ - this.getdatas() - } - getdatas=()=>{ - const task_Id = this.props.match.params.task_Id; - let url="/graduation_tasks/"+task_Id+".json"; - - axios.get(url).then((result)=>{ - if(result.status===200){ - this.setState({ - questionslist:result.data - }) - - } - }).catch((error)=>{ - console.log(error) - }) - } - - - // 交叉评阅设置弹框 - openAcross=()=>{ - this.setState({ - acrossVisible:true - }) - } - closeAcross=()=>{ - this.setState({ - acrossVisible:false - }) - this.getdatas() - } - - - - //返回 - goback=()=>{ - // let courseId=this.props.match.params.coursesId; - // let category_id=this.props.match.params.category_id; - // window.location.href="/classrooms/"+courseId+"/graduation_tasks/"+category_id; - // let courseId = this.props.match.params.coursesId; - // if(courseId===undefined){ - // this.props.history.push("/classrooms"); - // }else{ - // this.props.history.push(this.props.current_user.first_category_url); - // } - - // this.props.history.goBack() - this.props.history.replace(`/classrooms/${this.state.questionslist.course_id}/graduation_tasks/${this.state.questionslist.graduation_id}`); - } - - setend_time=(time)=>{ - this.setState({ - starttimesend:time===undefined||time===null||time===""?undefined:time, - }) - } - //立即发布 - publish=()=>{ - let {questionslist}=this.state; - let starttime= this.props.getNowFormatDates(1,1); - let endtime=this.props.getNowFormatDates(2,1); - console.log(this.bindRef.end_time) - this.setState({ - modalname:"立即发布", - // visible:true, - OneSelftype:true, - Topval:"学生将立即收到毕设任务", - // Botvalleft:"点击修改", - // Botval:`本操作只对"未发布"的分班有效`, - starttime:moment(moment(new Date())).format("YYYY-MM-DD HH:mm") , - starttimes:questionslist.end_time, - staytime:this.props.getNowFormatDates(1), - typs:"start", - endtime:endtime, - Cancelname:"暂不发布", - Savesname:"立即发布", - Cancel:this.cancelmodel, - Saves:this.homepublish, - }) - } - // 确定立即发布 - homepublish=(ids,endtime)=>{ - this.cancelmodel(); - let task_Id=this.props.match.params.task_Id; - const cid = this.props.match.params.coursesId; - // let url = `/courses/${cid}/graduation_tasks/publish_task.json`; - - let url="/courses/"+cid+"/graduation_tasks/publish_task.json" - axios.post(url,{ - task_ids:[task_Id], - group_ids: this.state.course_groupslist, - end_time:endtime, - }).then((response)=>{ - if (response.data.status == 0) { - this.getdatas() - this.props.showNotification(response.data.message); - - this.setState({ - // Modalstopval:response.data.message, - // ModalSave:this.cancelmodel, - // Loadtype:true, - course_groupslist:[], - checkAllValue:false - }) - } - }).catch((error)=>{ - - }) - } - - // 刷新 - resetList=()=>{ - this.getdatas(); - this.child && this.child.searchValue(); - } - // 立即截止 - end=()=>{ - // this.homeworkstart() - this.setState({ - modalname:"立即截止", - visible:true, - Topval:"学生将不能再提交作品", - // Botvalleft:"暂不截止", - // Botval:`本操作只对"提交中"的作业有效`, - Cancelname:"暂不截止", - Savesname:"立即截止", - Cancel:this.cancelmodel, - Saves:this.coursetaskend, - typs:"end", - }) - } - coursetaskend=()=>{ - const coursesId = this.props.match.params.coursesId; - const task_Id = this.props.match.params.task_Id; - - let url = `/courses/${coursesId}/graduation_tasks/end_task.json`; - axios.post(url,{ - task_ids:[task_Id], - group_ids: this.state.course_groupslist, - }).then((response)=>{ - if (response.data.status == 0) { - this.props.showNotification(response.data.message); - this.cancelmodel(); - this.getdatas(); - this.child && this.child.reInit(); - } - - }).catch((error)=>{ - - }) - } - // 取消 - cancelmodel=()=>{ - this.setState({ - Modalstype:false, - Loadtype:false, - visible:false, - OneSelftype:false, - Modulationtype:false, - Allocationtype:false, - Modalstopval:"", - ModalCancel:"", - ModalSave:"", - }) - } - - getcourse_groupslist=(id)=>{ - this.setState({ - course_groupslist:id - }) - } - - setTab = (tab) =>{ - this.setState({ - tab - }) - } - - // 关联项目 - AssociationItems=()=>{ - this.setState({ - visibles:true - }) - } - - Cancel=()=>{ - this.setState({ - visibles:false - }) - } - - // 取消关联 - cannelAssociation=()=>{ - this.setState({ - Modalstype:true, - Modalstopval:"确定要取消该项目关联?", - ModalCancel:this.cannerassocition, - ModalSave:this.savetassociton - }) - } - - savetassociton=()=>{ - this.cannerassocition(); - let {questionslist}=this.state; - let url = "/graduation_tasks/"+questionslist.task_id+"/graduation_works/cancel_relate_project.json"; - console.log(url) - axios.get(url).then((result)=>{ - if(result.data.status===0){ - this.resetList(); - } - }).catch((error)=>{ - console.log(error) - }) - - } - - cannerassocition=()=>{ - this.setState({ - Modalstype:false, - Modalstopval:"", - ModalCancel:"", - ModalSave:"", - loadtype:false, - visibles:false - }) - } - - // 补交附件 - handaccessory=()=>{ - this.setState({ - avisible:true - }) - } - - Cancelvisible=()=>{ - this.setState({ - avisible:false - }) - } - - CodeReview=()=>{ - let newgetRandomNumber=getRandomNumber(true); - console.log(newgetRandomNumber) - this.props.showNotification("正在导出中..."); - if(newgetRandomNumber){ - const task_Id = this.props.match.params.task_Id; - window.open(`/api/graduation_tasks/${task_Id}/sonar? - ${this.state.taskdatas.teacher_comment===undefined||this.state.taskdatas.teacher_comment===null?"":"teacher_comment="+this.state.taskdatas.teacher_comment+"&"} - ${this.state.taskdatas.task_status===undefined||this.state.taskdatas.task_status===null?"":"task_status="+this.state.taskdatas.task_status+"&"} - ${this.state.taskdatas.course_group===undefined||this.state.taskdatas.course_group===null?"":"course_group="+this.state.taskdatas.course_group+"&"} - ${this.state.taskdatas.cross_comment===undefined||this.state.taskdatas.cross_comment===null?"":"cross_comment="+this.state.taskdatas.cross_comment+"&"} - ${this.state.taskdatas.search===undefined||this.state.taskdatas.search===null?"":"search="+this.state.taskdatas.search+"&"}${newgetRandomNumber}`) - } - } - - getsonars=(teacher_comment,task_status,course_group,cross_comment,search)=>{ - let data={ - teacher_comment:teacher_comment, - task_status:task_status, - course_group:course_group, - cross_comment:cross_comment, - search:search - } - this.setState({ - taskdatas:data - }) - } - - bindRef = ref => { this.child = ref } ; - - render(){ - - let courseId=this.props.match.params.coursesId; - let category_id=this.props.match.params.category_id; - let task_Id=this.props.match.params.task_Id; - let { - questionslist , - tab , - visibles , - Modalstype, - Modalstopval, - ModalCancel, - ModalSave, - acrossVisible - } = this.state - - const commom = { - setTab:this.setTab, - getdatas:this.getdatas - } - - - return( -
- { - questionslist && -
- this.getcourse_groupslist(id)} - /> - {this.state.OneSelftype==true? this.getcourse_groupslist(id)} - starttimes={this.state.starttimes} - starttimesend={this.state.starttimesend} - typs={this.state.typs} - />:""} - - - - - {/*关联项目*/} - {visibles===true? - this.Cancel()} - taskid={ questionslist && questionslist.task_id } - funlist={this.resetList} - /> - :""} - - {this.state.avisible===true?:""} - {/*提示*/} - - - { - acrossVisible && - - } - -

- {questionslist.course_name} - > - {questionslist.graduation_name} - > - 任务详情 -

-
-

- {questionslist.task_name} -

- - 返回 -
-
-
- - 任务列表 - 毕设描述 - 设置 - - {/*导出成绩*/} - {/*{this.props.isAdmin()?导出成绩:""}*/} - {/*{this.props.isAdmin()?导出作品附件:""}*/} - - - {this.props.isAdmin()?
  • - 导出 - -
  • :""} - {questionslist.work_status===undefined||questionslist.work_status===null||questionslist.work_status.length===0?"":questionslist.work_status.map((item,key)=>{ - return( - - {item==="提交作品"?提交作品:""} - {item==="补交作品"?补交作品:""} - {item==="修改作品"?修改作品:""} - {item==="查看作品"?查看作品 :""} - {item==="创建项目"?创建项目:""} - {item==="关联项目"?关联项目:""} - {item==="取消关联"?取消关联:""} - {item==="补交附件"?补交附件:""} - - - ) - })} - - {/*项目在线质量检测*/} - { this.props.isAdmin() ? questionslist.status===1 ? { this.end()} }>立即截止 : "" : "" } - { this.props.isAdmin() ? questionslist.status===0 ? { this.publish()} }>立即发布 : "" : "" } - { this.props.isAdmin() && questionslist.cross_comment ? 交叉评阅设置 : "" } - { this.props.isAdmin() ? 编辑任务 : "" } - { this.props.user&&this.props.user.admin===true || this.props.user&&this.props.user.business===true ? this.CodeReview()}>代码评测 : "" } - -
    -
    - - {/*//毕设任务列表*/} - (this.getsonars(teacher_comment,task_status,course_group,cross_comment,search)}{...this.props} {...props} {...this.state} {...commom} triggerRef={this.bindRef} setend_time={(time)=>this.setend_time(time)} tab={`list`}/>) - } - > - - (this.setend_time(time)} tab={`setting`}/>) - } - > - - (this.setend_time(time)} tab={`questions`}/>) - }> - - -
    - } - -
    - ) - } -} -// CNotificationHOC() ( SnackbarHOC() ( TPMIndexHOC)) -export default (GraduationTaskDetail) ; diff --git a/src/modules/courses/graduation/tasks/GraduationTasksSubmitedit.js b/src/modules/courses/graduation/tasks/GraduationTasksSubmitedit.js deleted file mode 100644 index 48fad9d6..00000000 --- a/src/modules/courses/graduation/tasks/GraduationTasksSubmitedit.js +++ /dev/null @@ -1,871 +0,0 @@ -import React,{Component} from "react"; -import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal,Spin,Tooltip} from "antd"; -import {Link} from 'react-router-dom'; -import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor'; -import { WordsBtn,getUploadActionUrl ,bytesToSize,getImageUrl,appendFileSizeToUploadFileAll,appendFileSizeToUploadFile} from 'educoder'; -import axios from 'axios'; -import Modals from '../../../modals/Modals'; -const Search = Input.Search; -const CheckboxGroup = Checkbox.Group; -let GraduationTasksnewtype=true; - -class GraduationTasksSubmitedit extends Component{ - - constructor(props){ - super(props) - this.state={ - coursename:"", - coursesearch:"", - title_num:20, - title_value:"", - fileList: [], - contents: [{val:"",id:1}], - type:true, - workslist:undefined, - search:"", - memberslist:undefined, - task_status:[], - selectmemberslist:[], - minvalue:"", - setvalue:"", - minmaxtype:false, - selectobjct:undefined, - Loadtype:false, - description:undefined, - attachments:undefined, - spinnings:false, - shixunsreplace:false, - limit:20 - } - } - - componentDidMount(){ - - this.props.form.validateFields(); - let workId=this.props.match.params.work_Id; - - let url = "/graduation_works/"+workId+"/edit.json"; - axios.get(url).then((result)=>{ - - if(result){ - console.log(result.data.description); - const fileList = result.data.attachments.map(item => { - return { - id: item.id, - uid: item.id, - name: appendFileSizeToUploadFile(item), - url: item.url, - filesize: item.filesize, - delete:item.delete, - status: 'done' - } - }) - this.setState({ - workslist:result.data, - attachments:result.data.attachments, - selectmemberslist:result.data.members, - selectobjct:result.data.members, - description:result.data.description, - fileList:fileList - }) - if(result.data.task_type===1){ - - }else{ - this.searchList("",1,20,result.data.task_id) - } - - this.props.form.setFieldsValue({ - description:result.data.description, - }); - - } - - }).catch((error)=>{ - console.log(error) - }) - - - - } - - - handleSelectChange = (value) => { - console.log(value); - this.props.form.setFieldsValue({ - note: `Hi, ${value === 'male' ? 'man' : 'lady'}!`, - }); - } - - goback=()=>{ - - // let courseId=this.props.match.params.coursesId; - // if(courseId===undefined){ - // this.props.history.push("/courses"); - // }else{ - // this.props.history.push(this.props.current_user.first_category_url); - // } - this.props.history.replace(`/classrooms/${this.state.workslist.course_id}/graduation_tasks/${this.state.workslist.graduation_id}`); - - } - - - // 输入title - changeTitle=(e)=>{ - - this.setState({ - title_num:20-parseInt(e.target.value.length), - title_value:e.target.value - }) - - } - // 附件相关 START - handleChange = (info) => { - - if (info.file.status === 'uploading') { - - let fileList = info.fileList; - this.setState({ fileList:appendFileSizeToUploadFileAll(fileList) }); - } - - if (info.file.status === 'done' || info.file.status === 'removed') { - let fileList = info.fileList; - this.setState({ fileList:appendFileSizeToUploadFileAll(fileList) }); - } - } - - onAttachmentRemove = (file) => { - if(file.delete===false){ - this.props.showNotification(`该作品已被评阅,不能删除该附件`); - return false - }else{ - if(!file.percent || file.percent == 100){ - this.setState({ - Modalstype:true, - Modalstopval:'确定要删除这个附件吗?', - ModalSave: ()=>this.deleteAttachment(file), - ModalCancel:this.cancelAttachment - }) - return false; - } - } - - - } - - cancelAttachment=()=>{ - this.setState({ - Modalstype:false, - Modalstopval:'', - ModalSave:"", - ModalCancel:"" - }) - } - - - deleteAttachment = (file) => { - if(!file.percent || file.percent == 100){ - let {attachments,fileList}=this.state; - let id=file.response ==undefined ? file.id : file.response.id; - const url = `/attachments/${id}.json` - axios.delete(url, { - }) - .then((response) => { - if (response.data) { - // const { status } = response.data; - if (response.data.status === 0) { - console.log('--- success') - let newattachments=attachments; - if(file.uid===undefined){ - for(var i=0; i { - const index = state.fileList.indexOf(file); - const newFileList = state.fileList.slice(); - newFileList.splice(index, 1); - return { - fileList: newFileList, - }; - }); - } - } - }) - .catch(function (error) { - console.log(error); - }); - } - - } - - inputSearchValue=(e)=>{ - - if(e.target.value===""){ - this.setState({ - search:null - }) - }else{ - this.setState({ - search:e.target.value - }) - } - - } - - - searchValue=()=>{ - - let {search,workslist} = this.state; - - this.searchList(search,1,20,workslist.task_id) - - } - - searchList=(search,page,limit,id,types)=>{ - let {memberslist}=this.state; - let newmemberslist=memberslist - this.setState({ - - }) - let newid=id - if(newid===undefined){ - newid=this.props.match.params.work_Id; - } - - let url="/graduation_tasks/"+newid+"/graduation_works/search_member_list.json"; - axios.post(url,{ - search:search, - page:page, - limit:limit - }).then((result)=>{ - - if(result){ - if(types===1){ - if(result.data.members.length>0) { - result.data.members.map((item, key) => { - newmemberslist.push(item) - }) - } - this.setState({ - memberslist:newmemberslist, - search:search, - page:page, - limit:limit - }) - - }else{ - this.setState({ - memberslist:result.data.members, - search:search, - page:page, - limit:limit - }) - } - - } - - }).catch((error)=>{ - console.log(error) - }) - } - - - contentViewScroll=(e)=>{ - //滑动到底判断 - let newscrollTop=parseInt(e.currentTarget.scrollTop); - let allclientHeight=e.currentTarget.clientHeight+newscrollTop; - - if(e.currentTarget.scrollHeight-allclientHeight===0||e.currentTarget.scrollHeight-allclientHeight===1||e.currentTarget.scrollHeight-allclientHeight===-1){ - // console.log("到达底部"); - - let{ search,page,limit,workslist}=this.state; - - let newpage=page+1 - - this.searchList(search,newpage,limit,workslist.task_id,1) - - } - - } - - - funtaskstatus=(checkedValues)=>{ - - let{memberslist,selectobjct,workslist}=this.state; - if(selectobjct.length>workslist.max_num){ - this.setState({ - minvalue:workslist.max_num, - setvalue:"大于", - minmaxtype:true - }) - return - }else{ - this.setState({ - minmaxtype:false - }) - } - let newlist =memberslist; - let newcheckedValues=checkedValues; - let selects=[]; - - for(var list of selectobjct){ - selects.push(list) - } - for(var i=0; i{ - - let{selectmemberslist,task_status}=this.state; - let newlist=task_status; - let selects=selectmemberslist; - - for(var i=0; i{ - this.props.history.goBack() - } - - handleSubmit=(e) => { - - let {fileList,selectmemberslist,workslist}=this.state; - - this.Commoninterface(fileList,selectmemberslist,workslist); - // setTimeout(function () { - // GraduationTasksnewtype=true - // },10000) - - } - Commoninterface =(fileList,selectmemberslist,workslist)=>{ - - let coursesIds=this.props.match.params.coursesId - let workId=this.props.match.params.work_Id; - - let userids=[]; - // for(var list of selectmemberslist){ - // if(list.user_id!=undefined&&list.user_id!=null){ - // userids.push(list.user_id) - // } - // } - if(selectmemberslist!=undefined&&selectmemberslist.length>0){ - selectmemberslist.map((list,key)=>{ - if(list.user_id!=undefined&&list.user_id!=null){ - userids.push(list.user_id) - } - }) - } - - - let listid=[]; - - // for(var list of fileList){ - // listid.push(list.response == undefined ? list.id : list.response.id) - // } - if(fileList!=undefined&&fileList.length>0){ - fileList.map((list,key)=>{ - listid.push(list.response == undefined ? list.id : list.response.id) - }) - } - - - this.props.form.validateFields((err, values) => { - - // console.log(fileList); - if(values.description===undefined||values.description===""){ - this.scrollToAnchor("valuestypes"); - return - } - - if(workslist.task_type===2){ - if(userids.lengthworkslist.max_num){ - this.setState({ - minvalue:workslist.max_num, - setvalue:"大于", - minmaxtype:true - }) - return - } - - } - this.setState({ - spinnings:true - }) - - - // if(fileList.length===0){ - // this.setState({ - // shixunsreplace:true, - // }) - // return - // } - - let url="/graduation_works/"+workId+".json"; - axios.put(url, { - description:values.description, - attachment_ids:listid, - user_ids:userids - } - ).then((response) => { - this.setState({ - spinnings:false - }) - if(response!== undefined){ - // this.goback() - window.location.href=`/classrooms/${coursesIds}/graduation_tasks/${workId}/appraise` - } - // if(response.status===200) { - // GraduationTasksnewtype=false; - // if(response.data.status===0){ - // // this.setState({ - // // Modalstype:true, - // // Modalstopval:response.data.message, - // // ModalSave:this.setedit, - // // Loadtype:true - // // }) - // }else{ - // GraduationTasksnewtype=true; - // } - // } - }).catch((error) => { - console.log(error) - this.setState({ - spinnings:false - }) - }) - - - }); - - } - - hidestartshixunsreplace = ()=>{ - - let {fileList,selectmemberslist,workslist}=this.state; - - this.Commoninterface(fileList,selectmemberslist,workslist); - - } - - hidestartshixunsreplacetwo= ()=>{ - this.setState({ - shixunsreplace:false, - spinnings:false - }) - } - - scrollToAnchor = (anchorName) => { - if (anchorName) { - // 找到锚点 - let anchorElement = document.getElementById(anchorName); - // 如果对应id的锚点存在,就跳转到锚点 - if(anchorElement) { anchorElement.scrollIntoView({block: 'start', behavior: 'smooth'}); } - } - } - render(){ - const { getFieldDecorator } = this.props.form; - let {search,fileList, workslist,setvalue,minvalue,minmaxtype,Loadtype,description,attachments, - Modalstype,Modalstopval,ModalCancel,ModalSave,memberslist,task_status,selectmemberslist,shixunsreplace} =this.state; - - let courseId=this.props.match.params.coursesId; - let task_Id=this.props.match.params.coursesId; - // let category_id=this.props.match.params.category_id; - let work_Id=this.props.match.params.work_Id - const uploadProps = { - width: 600, - fileList, - multiple: true, - // https://github.com/ant-design/ant-design/issues/15505 - // showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。 - // showUploadList: false, - action: `${getUploadActionUrl()}`, - onChange: this.handleChange, - onRemove: this.onAttachmentRemove, - beforeUpload: (file) => { - // TODO 文件存在则提示并退出 - let gotSameFile = false; - this.state.fileList && this.state.fileList.some((item) => { - if (item.name && item.name.startsWith(file.name)) { - gotSameFile = true; - return true - } - }) - if (gotSameFile) { - this.props.showNotification("该附件已被上传!") - return false - } - console.log('beforeUpload', file.name); - const isLt150M = file.size / 1024 / 1024 < 150; - if (!isLt150M) { - this.props.showNotification('文件大小必须小于150MB!'); - } - return isLt150M; - }, - }; - - document.title=workslist&&workslist.course_name; - return( - - -
    - - {/*提示*/} - - -
    -

    还未上传附件

    -

    是否确认提交作品?

    -
    - -
    -
    -
    - -

    - {/* {workslist&&workslist.course_name}*/} - {/*>*/} - 毕设任务 - > - 任务详情 - > - {/**/} - {/*{workslist&&workslist.task_name}*/} - {/*>*/} - {/**/} - {this.props.current_user&&this.props.current_user.real_name} 修改作品 -

    - -
    -

    { workslist && workslist.task_name }

    - 返回 -
    - - {description&&description? -
    -
    -
    - - - {getFieldDecorator('description', { - rules: [{ - required: true, message: '请在此输入作品内容或附件的简要描述', - }, { - max: 5000, message: '最大限制为5000个字符', - }], - })( - - )} - - - - (单个文件150M以内) - - - - {/*{attachments&&attachments.map((item,key)=>{*/} - - {/*return(*/} - {/*
    */} - {/**/} - {/**/} - {/**/} - {/**/} - {/*{item.title}*/} - - {/**/} - {/**/} - {/*{item.filesize}*/} - - {/**/} - {/*{item.delete===true?*/} - {/*this.onAttachmentRemoves(item.id)}*/} - {/*aria-hidden="true">*/} - {/*:""}*/} - {/*
    */} - {/*)*/} - {/*})}*/} - - {/**/} - {/*{this.state.fileList.length===0?"":this.state.fileList.map((item,key)=>{*/} - {/*return(*/} - {/*

    */} - {/**/} - {/**/} - {/**/} - {/**/} - {/*{item.name}*/} - {/**/} - {/**/} - {/*{item.response===undefined?"":bytesToSize(item.size)}*/} - {/**/} - {/*this.onAttachmentRemove(item.response===undefined?"":item.response.id&&item.response.id)}>*/} - {/*

    */} - {/*)*/} - {/*})}*/} - - - -
    - - - - {workslist&&workslist.task_type===1?"": -
    - -
    -
    成员要求:{workslist&&workslist.min_num}~{workslist&&workslist.max_num}人
    - -
    - - -
    -
    - - -
    - - - {memberslist===undefined?"":memberslist.length===0?
    -
    - -

    未找到包含{search}的学生

    -
    -
    :memberslist&&memberslist.map((item,key)=>{ - return( -
    - { - return parseInt(task_status[key])===item.user_id?true:false - }) - } - disabled={item.commit_status===true?true:false} className="fl "> -
    {item.user_name}
    -
    {item.group_name}
    -
    {item.student_id}
    -
    {item.commit_status===true?已提交 :""}
    -
    - ) - })} -
    - - -
    - -
    - -
    - -
    - - {selectmemberslist&&selectmemberslist.map((item,key)=>{ - console.log(item) - if(item.group_name!=undefined) { - return ( -
    -
    {item.user_name}
    -
    {item.group_name}
    -
    {item.student_id}
    - {key > 0 ? -
    this.delecttask_status(item.user_id)}> -
    : ""} -
    -
    - ) - } - })} - -
    - - -
    - -
    - - {minmaxtype===true? - 人数不能{setvalue+minvalue}个人 - :""} - -
    -
    } - - - - - {/**/} -
    - - 取消 -
    - -
    -
    - :""} - -
    -
    -
    -
    - -
    - - ) - } -} -const GraduationTasksSubmiteditApp = Form.create({ name: 'coursesNew' })(GraduationTasksSubmitedit); -export default GraduationTasksSubmiteditApp; diff --git a/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js b/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js deleted file mode 100644 index 9dfd141e..00000000 --- a/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js +++ /dev/null @@ -1,859 +0,0 @@ -import React,{Component} from "react"; - -import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal,Tooltip,Spin} from "antd"; -import {Link} from 'react-router-dom'; -import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor'; -import { WordsBtn,getUrl,getImageUrl,getUploadActionUrl,appendFileSizeToUploadFileAll} from 'educoder'; -import axios from 'axios'; -import Modals from '../../../modals/Modals'; -const Search = Input.Search; -const CheckboxGroup = Checkbox.Group; -let GraduationTasksnewtype=true; - -class GraduationTasksSubmitnew extends Component{ - - constructor(props){ - super(props) - this.state={ - coursename:"", - coursesearch:"", - title_num:20, - title_value:"", - fileList: [], - contents: [{val:"",id:1}], - type:true, - workslist:undefined, - search:"", - memberslist:undefined, - task_status:[], - selectmemberslist:[], - minvalue:"", - setvalue:"", - minmaxtype:false, - selectobjct:undefined, - Loadtype:false, - spinnings:false, - shixunsreplace:false, - limit:20 - } - } - - componentDidMount(){ - - let id=this.props.match.params.task_Id; - // let categoryid=this.props.match.params.category_id; - let url = "/graduation_tasks/"+id+"/graduation_works/new.json"; - axios.get(url).then((result)=>{ - - if(result.status===200){ - - let list=[]; - - let listobjct={ - group_name:result.data.group_name, - student_id:result.data.user_student_id, - user_id:result.data.user_id, - user_name:result.data.user_name, - } - - list.push(listobjct) - if(result.data.task_type===1){ - - }else{ - this.searchList("",1,20) - } - this.setState({ - workslist:result.data, - selectmemberslist:list, - selectobjct:listobjct - }) - } - - }).catch((error)=>{ - console.log(error) - }) - - - - } - - setedit=(workId)=>{ - - let coursesId=this.props.match.params.coursesId; - window.location.href="/classrooms/"+coursesId+"/graduation_tasks/"+workId+"/appraise"; - - } - - handleSubmit=(e) => { - - let {fileList,selectmemberslist,workslist}=this.state; - - this.Commoninterface(fileList,selectmemberslist,workslist); - } - - handleSelectChange = (value) => { - console.log(value); - this.props.form.setFieldsValue({ - note: `Hi, ${value === 'male' ? 'man' : 'lady'}!`, - }); - } - - goback=()=>{ - // let courseId=this.props.match.params.coursesId; - // if(courseId===undefined){ - // this.props.history.push("/courses"); - // }else{ - // this.props.history.push(this.props.current_user.first_category_url); - // } - this.props.history.replace(`/classrooms/${this.state.workslist.course_id}/graduation_tasks/${this.state.workslist.graduation_id}`); - } - - - // 输入title - changeTitle=(e)=>{ - - this.setState({ - title_num:20-parseInt(e.target.value.length), - title_value:e.target.value - }) - - } - // 附件相关 START - handleChange = (info) => { - if (info.file.status === 'uploading') { - let fileList = info.fileList; - this.setState({ fileList:appendFileSizeToUploadFileAll(fileList) }); - } - - if (info.file.status === 'done' || info.file.status === 'removed') { - let fileList = info.fileList; - this.setState({ fileList:appendFileSizeToUploadFileAll(fileList) }); - } - - } - - onAttachmentRemove = (file) => { - // confirm({ - // title: '确定要删除这个附件吗?', - // okText: '确定', - // cancelText: '取消', - // // content: 'Some descriptions', - // onOk: () => { - // this.deleteAttachment(file) - // }, - // onCancel() { - // console.log('Cancel'); - // }, - // }); - // return false; - if(!file.percent || file.percent == 100){ - this.setState({ - Modalstype:true, - Modalstopval:'确定要删除这个附件吗?', - ModalSave: ()=>this.deleteAttachment(file), - ModalCancel:this.cancelAttachment - }) - return false; - } - - } - - cancelAttachment=()=>{ - this.setState({ - Modalstype:false, - Modalstopval:'', - ModalSave:"", - ModalCancel:"" - }) - } - - deleteAttachment = (file) => { - if(!file.percent || file.percent == 100){ - let id = file.response == undefined ? file.id : file.response.id; - const url = `/attachments/${id}.json` - axios.delete(url, {}) - .then((response) => { - if (response.data) { - // const { status } = response.data; - if (response.data.status === 0) { - - console.log('--- success') - // this.setState({ - // Modalstype: true, - // Modalstopval: response.data.message, - // ModalSave: this.cancelAttachment, - // Loadtype: true, - // }) - this.cancelAttachment(); - - this.setState((state) => { - const index = state.fileList.indexOf(file); - const newFileList = state.fileList.slice(); - newFileList.splice(index, 1); - return { - fileList: newFileList, - }; - }); - } - } - }) - .catch(function (error) { - console.log(error); - }); - } - } - - inputSearchValue=(e)=>{ - - if(e.target.value===""){ - this.setState({ - search:null - }) - }else{ - this.setState({ - search:e.target.value - }) - } - - } - - - searchValue=()=>{ - - let {search} = this.state; - - this.searchList(search,1,20) - - } - - searchList=(search,page,limit,types)=>{ - let id=this.props.match.params.task_Id; - let {memberslist}=this.state; - let newmemberslist=memberslist - let url="/graduation_tasks/"+id+"/graduation_works/search_member_list.json"; - - axios.post(url,{ - search:search, - page:page, - limit:15 - }).then((result)=>{ - - if(result){ - if(result.data.status!=403){ - if(types===1){ - if(result.data.members.length>0){ - result.data.members.map((item,key)=>{ - newmemberslist.push(item) - }) - } - this.setState({ - memberslist:newmemberslist, - search:search, - page:page, - limit:limit - }) - - }else{ - this.setState({ - memberslist:result.data.members, - search:search, - page:page, - limit:limit - }) - } - - } - } - - }).catch((error)=>{ - console.log(error) - }) - } - - - contentViewScroll=(e)=>{ - - - //滑动到底判断 - const {memberslist} = this.state; - let newscrollTop=parseInt(e.currentTarget.scrollTop); - let allclientHeight=e.currentTarget.clientHeight+newscrollTop; - if(e.currentTarget.scrollHeight-allclientHeight===0||e.currentTarget.scrollHeight-allclientHeight===1||e.currentTarget.scrollHeight-allclientHeight===-1){ - - if(memberslist.length===0){ - return; - }else{ - let{ search,page,limit }=this.state; - - let newpage=page+1 - - this.searchList(search,newpage,limit,1) - - } - } - - - - } - - - funtaskstatus=(checkedValues)=>{ - let{memberslist,selectobjct,workslist}=this.state; - if(selectobjct.length>workslist.max_num){ - this.setState({ - minvalue:workslist.max_num, - setvalue:"大于", - minmaxtype:true - }) - return - }else{ - this.setState({ - minmaxtype:false - }) - } - let newlist =memberslist; - let newcheckedValues=checkedValues; - let selects=[]; - selects.push(selectobjct) - for(var i=0; i{ - let{selectmemberslist,task_status}=this.state; - let newlist=task_status; - let selects=selectmemberslist; - - for(var i=0; i { - if (e.keyCode === 13) { - } - } - onSearckeyd=(e)=>{ - if(e.keyCode){ - - let {search} = this.state; - - this.searchList(search,1,20) - } - } - onSearchKeywordKeyUps= (e)=>{ - if(e.keyCode=== 13){ - } - } - onKeywordSearchKeyDown = (e) => { - if(e.keyCode == 13) { - return false; - } - } - - - //公用数据 - Commoninterface = (fileList,selectmemberslist,workslist)=>{ - - let userids=[]; - if(selectmemberslist!=undefined&&selectmemberslist.length>0){ - for(var list of selectmemberslist){ - if(list.user_id!=undefined&&list.user_id!=null){ - userids.push(list.user_id) - } - - } - } - - - if(workslist.task_type===1){ - userids=undefined - } - - let listid=[]; - if(fileList!=undefined&&fileList.length>0){ - for(var list of fileList){ - listid.push(list.response.id) - } - } - - // if( GraduationTasksnewtype===true){ - this.props.form.validateFields((err, values) => { - - // console.log(fileList); - if(values.description===undefined||values.description===""){ - this.scrollToAnchor("valuestypes"); - - return - } - - - if(workslist&&workslist.task_type===2){ - if(userids!=undefined){ - if(userids.lengthworkslist.max_num){ - this.setState({ - minvalue:workslist.max_num, - setvalue:"大于", - minmaxtype:true - }) - return - } - } - } - - this.setState({ - spinnings:true - }) - - - let id=this.props.match.params.task_Id; - - // if(fileList.length === 0){ - // this.setState({ - // shixunsreplace:true, - // }) - // return - // } - let url="/graduation_tasks/"+id+"/graduation_works.json"; - axios.post(url, { - description:values.description, - attachment_ids:listid, - user_ids:userids - } - ).then((response) => { - this.setState({ - spinnings:false - }); - // /courses/2915/graduation_tasks/1301/appraise - // window.location.href - if(response){ - if(response.data){ - if(response.data.work_id){ - window.location.href=`/classrooms/${this.props.match.params.coursesId}/graduation_tasks/${response.data.work_id}/appraise` - } - } - } - // console.log(this.props); - // console.log(response); - - // 新需求 - // https://www.trustie.net/issues/23015 - // if(response!==undefined){ - // this.goback() - // } - // if(response.status===200) { - // GraduationTasksnewtype=false; - // if(response.data.status===0){ - // this.setState({ - // Modalstype:true, - // Modalstopval:response.data.message, - // ModalSave:()=>this.setedit(response.data.work_id), - // Loadtype:true - // }) - - // }else{ - // GraduationTasksnewtype=true; - // } - // } - }).catch((error) => { - this.setState({ - spinnings:false - }); - console.log(error) - }) - - - }); - // } - - } - - //确认 - hidestartshixunsreplace=()=>{ - - let {fileList,selectmemberslist,workslist}=this.state; - this.Commoninterface(fileList,selectmemberslist,workslist); - - } - //取消 - hidestartshixunsreplacetwo=()=>{ - this.setState({ - shixunsreplace:false, - spinnings:false - }) - } - scrollToAnchor = (anchorName) => { - if (anchorName) { - // 找到锚点 - let anchorElement = document.getElementById(anchorName); - // 如果对应id的锚点存在,就跳转到锚点 - if(anchorElement) { anchorElement.scrollIntoView({block: 'start', behavior: 'smooth'}); } - } - } -render(){ - const { getFieldDecorator } = this.props.form; - let {search,fileList, workslist,setvalue,minvalue,minmaxtype,Loadtype, - Modalstype,Modalstopval,ModalCancel,ModalSave,memberslist,task_status,selectmemberslist,shixunsreplace} =this.state; - - let courseId=this.props.match.params.coursesId; - let category_id=this.props.match.params.category_id; - let task_Id=this.props.match.params.task_Id - const uploadProps = { - width: 600, - fileList, - multiple: true, - // https://github.com/ant-design/ant-design/issues/15505 - // showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。 - // showUploadList: false, - action: `${getUploadActionUrl()}`, - onChange: this.handleChange, - onRemove: this.onAttachmentRemove, - beforeUpload: (file) => { - // TODO 文件存在则提示并退出 - let gotSameFile = false; - this.state.fileList && this.state.fileList.some((item) => { - if (item.name && item.name.startsWith(file.name)) { - gotSameFile = true; - return true - } - }) - if (gotSameFile) { - this.props.showNotification("该附件已被上传!") - return false - } - console.log('beforeUpload', file.name); - const isLt150M = file.size / 1024 / 1024 < 150; - if (!isLt150M) { - this.props.showNotification('文件大小必须小于150MB!'); - } - return isLt150M; - }, - }; - - // console.log(this.props) - - - document.title=workslist&&workslist.course_name; - return( - - -
    - {/*提示*/} - - - -
    -

    还未上传附件

    -

    是否确认提交作品?

    -
    - -
    -
    -
    - -

    - {/* {workslist&&workslist.course_name}*/} - {/*>*/} - 毕设任务 - > - 任务详情 - > - {/**/} - {/*{workslist&&workslist.task_name}*/} - {/*>*/} - {/**/} - {this.props.current_user&&this.props.current_user.real_name} 提交作品 -

    - -
    -

    {workslist&&workslist.task_name}

    - 返回 -
    - - {/*
    */} -
    - - - {getFieldDecorator('description', { - rules: [{ - required: true, message: '请在此输入作品内容或附件的简要描述', - }, { - max: 5000, message: '最大限制为5000个字符', - }], - })( - - )} - - - - (单个文件150M以内) - - {/**/} - {/*{this.state.fileList.length===0?"":this.state.fileList.map((item,key)=>{*/} - {/*return(*/} - {/*

    */} - {/**/} - {/**/} - {/**/} - {/**/} - {/*{item.name}*/} - {/**/} - {/**/} - {/*{item.response===undefined?"":bytesToSize(item.size)}*/} - {/**/} - {/*this.onAttachmentRemove(item.response===undefined?"":item.response.id&&item.response.id)}>*/} - {/*

    */} - {/*)*/} - {/*})}*/} - -
    - - - - {workslist&&workslist.task_type===1?"": -
    - -
    -
    成员要求:{workslist&&workslist.min_num}~{workslist&&workslist.max_num}人
    - this.onSearchKeywordKeyUp(e)} - onkeydown={(e)=>this.onSearchKeywordKeyUps(e)}/> - - this.onSearchKeywordKeyUp(e)} - onkeydown={(e)=>this.onSearchKeywordKeyUps(e)} - onPressEnter={this.onKeywordSearchKeyDown} - autoComplete="off" - > - this.onSearckeyd(e)} - autoComplete="off" - > - -
    - - -
    - - - -
    - -
    - - {memberslist===undefined?"":memberslist.length===0? -
    -
    - - {/*

    未找到包含{search}的学生

    */} -

    未找到该学生

    -
    -
    :memberslist&&memberslist.map((item,key)=>{ - - return( -
    - { - return parseInt(task_status[key])===item.user_id?true:false - }) - } - disabled={item.commit_status===true?true:false} className="fl "> -
    {item.user_name}
    -
    {item.group_name}
    -
    {item.student_id}
    -
    {item.commit_status===true?已提交 :""}
    -
    - ) - })} -
    -
    - -
    - -
    - -
    - - {selectmemberslist&&selectmemberslist.map((item,key)=>{ - if(item.group_name!=undefined){ - return( -
    -
    {item.user_name}
    -
    {item.group_name}
    -
    {item.student_id}
    - {key>0?
    this.delecttask_status(item.user_id)}>
    :""} - -
    - ) - } - - })} -
    - - -
    - -
    - - {minmaxtype===true? - 人数不能{setvalue+minvalue}个人 - :""} - -
    -
    } - - - - - -
    - - 取消 -
    -
    - {/*
    */} - -
    -
    -
    -
    - -
    - - ) - } -} -const GraduationTasksSubmitnewApp = Form.create({ name: 'coursesNew' })(GraduationTasksSubmitnew); -export default GraduationTasksSubmitnewApp; diff --git a/src/modules/courses/graduation/tasks/GraduationTasksappraise.js b/src/modules/courses/graduation/tasks/GraduationTasksappraise.js deleted file mode 100644 index a314f962..00000000 --- a/src/modules/courses/graduation/tasks/GraduationTasksappraise.js +++ /dev/null @@ -1,349 +0,0 @@ -import React,{Component} from "react"; -import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal, Table, Divider, Tag} from "antd"; -import {Link} from 'react-router-dom'; -import { WordsBtn,markdownToHTML } from 'educoder'; -import axios from 'axios'; -import moment from 'moment'; -import Modals from '../../../modals/Modals'; -import AccessoryModal from "../../coursesPublic/AccessoryModal"; -import GraduationTasksappraiseReply from './GraduationTasksappraiseReply'; -import CoursesListType from '../../coursesPublic/CoursesListType'; -import '../../css/Courses.css'; - -class GraduationTasksappraise extends Component{ - - constructor(props){ - super(props) - this.state={ - coursename:"", - title_num:20, - title_value:"", - fileList: [], - contents: [{val:"",id:1}], - type:true, - visible:false, - firelistdata:undefined, - datalist: undefined, - } - } - setupdate=()=>{ - let category_id= this.props.match.params.category_id; - let zrl="/graduation_works/"+category_id+"/supply_attachments.json"; - axios.get(zrl).then((result)=>{ - - if(result.status===200){ - let status=result.data.status; - if(status===undefined || status=== 403 || status === 401 || status=== 407 || status=== 408|| status=== 409 || status === 500||status===-1){ - - }else{ - this.setState({ - firelistdata:result.data, - }) - } - - } - - }).catch((error)=>{ - console.log(error) - }) - - - let url ='/graduation_works/'+category_id+'.json'; - axios.get(url).then((result)=>{ - if(result.status===200) { - this.setState({ - datalist: result.data, - }) - } - }).catch((error)=>{ - console.log(error) - }) - - } - componentDidMount(){ - - this.setupdate() - - } - - goback=()=>{ - // let {datalist}=this.state; - // let courseId=this.props.match.params.coursesId; - // let category_id=this.props.match.params.category_id; - // - // window.location.href="/classrooms/"+courseId+"/graduation_tasks/"+datalist.graduation_id; - // let courseId=this.props.match.params.coursesId; - // if(courseId===undefined){ - // this.props.history.push("/classrooms"); - // }else{ - // this.props.history.push(this.props.current_user.first_category_url); - // } - - this.props.history.replace(`/classrooms/${this.state.datalist.course_id}/graduation_tasks/${this.state.datalist.graduation_id}/${this.state.datalist.task_id}/list`); - - } - - Cancelvisible=()=>{ - this.setState({ - visible:false - }) - } - - addAccessory=()=>{ - this.setState({ - visible:true - }) - } - - deleteAttachment = (id) => { - const url = `/attachments/${id}.json` - axios.delete(url, { - }) - .then((response) => { - if (response.data) { - const { status } = response.data; - if (status == 0) { - this.setupdate(); - this.cancelAttachment(); - } - } - }) - .catch(function (error) { - console.log(error); - }); - } - - onAttachmentRemove = (id) => { - - this.setState({ - Modalstype:true, - Modalstopval:'确定要删除这个附件吗?', - ModalSave: ()=>this.deleteAttachment(id), - ModalCancel:this.cancelAttachment - }) - - } - - cancelAttachment=()=>{ - this.setState({ - Modalstype:false, - Modalstopval:'', - ModalSave:"", - ModalCancel:"" - }) - } - - - - render(){ - - let {datalist,firelistdata, - Modalstype,Modalstopval,ModalCancel,ModalSave,loadtype,visible} =this.state; - - let courseId=this.props.match.params.coursesId; - let position=this.props.match.params.position; - let category_id=this.props.match.params.category_id; - let graduation_id=datalist===undefined?"":datalist.graduation_id; - let task_id=datalist===undefined?"":datalist.task_id; - // console.log(datalist); - - document.title=datalist&&datalist.course_name; - return( - - -
    - {/*提示*/} - - - - -
    -
    - -

    - {datalist&&datalist.course_name} - > - {datalist&&datalist.graduation_name} - > - 任务详情 - > - {datalist&&datalist.author_name} -

    - - - -
    -

    {datalist&&datalist.task_name}

    - - 返回 - {this.props.isStudent()? - datalist&&datalist.task_status===2? - 补交附件:"" - :""} -
    - - -
    - -
    - -
    - 内容 -
    - -
    -
    -
    - - {/*
    */} - {/*15M*/} - {/*文件包名称*/} - {/*15M*/} - {/*
    */} - - {datalist&& datalist.attachments && datalist.attachments.map((item,key)=>{ - return( -
    - - - - - {item.title} - - {item.filesize} - {/*{item.delete===true?:""}*/} - -
    - ) - })} - - -
    - - {/*更新*/} - {/*{datalist&&datalist.update_user_name}*/} - {/**/} - {/*{moment(datalist&&datalist.update_time).format('YYYY-MM-DD HH:mm:ss')==="Invalid date"?"":moment(datalist&&datalist.update_time).format('YYYY-MM-DD HH:mm:ss')}*/} - {/**/} - 提交 - {datalist&&datalist.author_name} - - {moment(datalist&&datalist.commit_time).format('YYYY-MM-DD HH:mm:ss')==="Invalid date"?"":moment(datalist&&datalist.commit_time).format('YYYY-MM-DD HH:mm:ss')} - - -
    - -
    - - {firelistdata===undefined?"":firelistdata.length===0?"":firelistdata.revise_attachments.length===0?"": -
    -
    - 补交附件 -
    -
    - 补交原因:{firelistdata&&firelistdata.revise_reason} -
    - - -
    - {firelistdata===undefined?"":firelistdata.length===0?"":firelistdata.revise_attachments.map((item,key)=>{ - - return( - - - - - - {item.title} - - {item.filesize} - {item.delete===true?:""} - - ) - })} - -
    - -
    - - 更新 - {firelistdata&&firelistdata.atta_update_user} - - {moment(firelistdata&&firelistdata.atta_update_time).format('YYYY-MM-DD HH:mm:ss')==="Invalid date"?"":moment(firelistdata&&firelistdata.atta_update_time).format('YYYY-MM-DD HH:mm:ss')} - - -
    - - -
    } - {datalist&&datalist.project_info===undefined?"": -
    -
    - 关联项目 -
    -
    - {datalist&&datalist.project_info.name} -
    -
    } - {/*{*/} - { datalist === undefined?"": datalist && datalist.task_type===undefined ?"" : datalist.task_type===1? "": datalist && datalist.work_members && datalist.work_members.length == 0 ?"": -
    -
    - 其他组员 -
    -
    - {datalist.work_members.map((item,key)=>{ - return( -
    - {item.user_name} -
    - ) - })} -
    -
    - } -
    - - - - -
    - - -
    -
    - -
    - - ) - } -} - -export default GraduationTasksappraise; diff --git a/src/modules/courses/graduation/tasks/GraduationTasksappraiseMainEditor.js b/src/modules/courses/graduation/tasks/GraduationTasksappraiseMainEditor.js deleted file mode 100644 index 6b3f9ecd..00000000 --- a/src/modules/courses/graduation/tasks/GraduationTasksappraiseMainEditor.js +++ /dev/null @@ -1,267 +0,0 @@ -import React,{ Component } from "react"; -import { Pagination, Upload, Button, Icon, message, InputNumber, Input, Checkbox } from "antd"; - -import update from 'immutability-helper' -import axios from 'axios' -import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor'; -import { getUrl, getUploadActionUrl } from 'educoder' -const $ = window.$; - -/* - -*/ -class GraduationTasksappraiseMainEditor extends Component{ - constructor(props){ - super(props); - this.mdRef = React.createRef(); - - this.state={ - fileList: [], - score: undefined, - same_score: false, - errorMessage: '', - numberErrorMessage: '', - errorMessagetype:false - } - } - onSubmit = () => { - const { score, same_score } = this.state - let category_id= this.props.match.params.category_id; - const url = `/graduation_works/${category_id}/add_score.json` - const attachment_ids = this.state.fileList.map(item => { - return item.response ? item.response.id : item.id - }) - const comment = this.mdRef.current.getValue() - - if ((!comment || comment.trim() == "") && !score &&this.props.isAdmin()===true&&comment!=0&&comment!=0.0) { - this.setState( {errorMessage : '分数和评语不能同时为空' }) - // this.props.showNotification('请先输入评阅说明') - return; - } - if (!score && this.props.isAdmin()===false &&this.props.isAdmin()===true&&comment!=0&&comment!=0.0) { - this.setState( { - errorMessage : '分数不能为空', - errorMessagetype:true - }) - // this.props.showNotification('请先输入评阅说明') - return; - } - - if (comment.length > 2000) { - this.setState( {errorMessage : '不能超过2000个字符' }) - // this.props.showNotification('评阅说明文本长度不能超过2000') - return; - } - this.setState( { errorMessage : ''}) - // if (score == 0 ||score<1|| score === undefined || score === null || score === "" ) { - // this.setState( {numberErrorMessage : '分数不能为空' }) - // // this.props.showNotification('请先输入分数') - // return; - // } - this.setState( { numberErrorMessage: '' }) - - const params = { - score, - comment, - attachment_ids, - same_score - } - if (this.props.onReply) { - if(this.props.get_next_works){ - this.props.get_next_works() - } - this.props.onReply(params) - } else { - axios.post(url, params).then((response)=>{ - if(response.data.status == 0) { - this.clearInputs() - this.props.addSuccess(); - } - - }).catch((error)=>{ - console.log(error) - }) - } - - } - clearInputs = () => { - this.setState({ - score: undefined, - same_score: false, - fileList: [] - }) - this.mdRef.current.setValue('') - } - onCancel = () => { - this.clearInputs() - } - componentDidMount(){ - } - handleUploadChange = (info) => { - if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') { - let fileList = info.fileList; - this.setState({ fileList }); - } - } - onAttachmentRemove = (file, stateName) => { - if(!file.percent || file.percent == 100){ - this.props.confirm({ - content: '确定要删除这个附件吗?', - okText: '确定', - cancelText: '取消', - // content: 'Some descriptions', - onOk: () => { - this.deleteAttachment(file, stateName) - }, - onCancel() { - console.log('Cancel'); - }, - }); - - - return false; - } - - } - deleteAttachment = (file, stateName) => { - // 初次上传不能直接取uid - const url = `/attachments/${file.response ? file.response.id : file.uid}.json` - axios.delete(url, { - }) - .then((response) => { - if (response.data) { - const { status } = response.data; - if (status == 0) { - console.log('--- success') - - this.setState((state) => { - const index = state[stateName].indexOf(file); - const newFileList = state[stateName].slice(); - newFileList.splice(index, 1); - return { - [stateName]: newFileList, - }; - }); - } - } - }) - .catch(function (error) { - console.log(error); - }); - } - onScoreChange = (val) => { - if(val){ - this.setState( { - errorMessage: '', - errorMessagetype:false - }) - } - if (val > 100 ) { - this.props.showNotification('不能大于100') - this.setState({ score: 100 }) - return; - } - if (val < 0 ) { - this.props.showNotification('不能小于0') - this.setState({ score: 0 }) - return; - } - if (val && val.indexOf && val.indexOf('-') != -1) { - this.setState({ score: 0 }) - window.event.preventDefault() - return - } - this.setState({ score: val }) - } - same_score_change = (e) => { - this.setState({ same_score: e.target.checked }) //!this.state.same_score - } - render(){ - let { total_count, comments, errorMessagetype, fileList, score, same_score, errorMessage, numberErrorMessage } = this.state - const { current_user, memo, showSameScore, placeholder } = this.props - const isAdmin = this.props.isAdmin() - const commentUploadProp = { - width: 600, - fileList: fileList, - multiple: true, - // https://github.com/ant-design/ant-design/issues/15505 - // showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。 - // showUploadList: false, - action: `${getUploadActionUrl()}`, - onChange: this.handleUploadChange, - onRemove: (file) => this.onAttachmentRemove(file, 'fileList'), - beforeUpload: (file) => { - console.log('beforeUpload', file.name); - const isLt150M = file.size / 1024 / 1024 < 150; - if (!isLt150M) { - this.props.showNotification('文件大小必须小于150MB!'); - } - return isLt150M; - }, - }; - return( - - -
    - - - {this.props.title && {this.props.title}} - - { showSameScore == true &&
    - 整组同评 - (选中,则本次评阅对象指小组全部成员,否则仅评阅此成员1人 ) -
    } - - - (单个文件150M以内) - - - -
    -
    - 分 -
    - - { (errorMessage || numberErrorMessage) && {errorMessage || numberErrorMessage} } - - 提交 - 清空 - -
    -
    -
    - ) - } -} -export default (GraduationTasksappraiseMainEditor); \ No newline at end of file diff --git a/src/modules/courses/graduation/tasks/GraduationTasksappraiseReply.css b/src/modules/courses/graduation/tasks/GraduationTasksappraiseReply.css deleted file mode 100644 index e15d32c4..00000000 --- a/src/modules/courses/graduation/tasks/GraduationTasksappraiseReply.css +++ /dev/null @@ -1,36 +0,0 @@ -.uploadBtn { - margin-left: 0px; -} -.comment_item_cont .J_Comment_Face img { - width: 42px; - height: 42px; - margin-top: 2px; -} -.panel-comment_item .t_area { - font-size: 13px; -} -.panel-comment_item .score_area { - color: #FF6800; - margin-left: 28px; -} - -.panel-comment_item .validate_area { - color: #999999; -} - -.appraise .panel-comment_item .t_info { - width: 1062px; -} -.appraise .panel-comment_item .childrenCommentsView .t_info { - width: 989px; -} -.course-message .panel-comment_item .comment_orig_content { - width: 980px; -} - -.course-message .panel-comment_item a.content-username { - max-width: 300px -} -.panel-comment_item{ - min-height:50px; -} \ No newline at end of file diff --git a/src/modules/courses/graduation/tasks/GraduationTasksappraiseReply.js b/src/modules/courses/graduation/tasks/GraduationTasksappraiseReply.js deleted file mode 100644 index 010e0935..00000000 --- a/src/modules/courses/graduation/tasks/GraduationTasksappraiseReply.js +++ /dev/null @@ -1,195 +0,0 @@ -import React,{ Component } from "react"; -import { Pagination } from "antd"; -import axios from 'axios' -import moment from 'moment' -import { getImageUrl,WordsBtn } from 'educoder'; -import {ImageLayerOfCommentHOC} from '../../../page/layers/ImageLayerOfCommentHOC'; -import GraduationTasksappraiseReplyChild from './GraduationTasksappraiseReplyChild'; -import '../../../comment/Comment.css' -import '../../common/courseMessage.css' -import './GraduationTasksappraiseReply.css' - -const REPLY_PAGE_COUNT = 10 -const $ = window.$; - -/* - -*/ -class GraduationTasksappraiseReply extends Component{ - constructor(props){ - super(props); - this.state={ - total_count: 0, - comment_scores: [] - } - } - - fetchAllComments = () => { - let category_id= this.props.match.params.category_id; - const url = `/graduation_works/${category_id}/comment_list.json` - axios.get(url).then((result)=>{ - if(result.data.comment_scores){ - const comment_scores = result.data.comment_scores.map(item => { - return this.transformReply(item) - }) - this.setState({ - ...result.data, - comment_scores - }) - } - }).catch((error)=>{ - console.log(error) - }) - } - componentDidMount(){ - this.fetchAllComments() - } - addSuccess = () => { - this.fetchAllComments() - } - - transformReply = (reply, children = []) => { - const isAdmin = this.props.isAdmin() - const isSuperAdmin = this.props.isSuperAdmin() - return { - isSuperAdmin: isSuperAdmin, - admin: isAdmin, // - children: children, - child_message_count: reply.child_message_count, - id: reply.comment_id, - image_url: reply.user_image_url, - // time: moment(reply.comment_time).fromNow(), - time: moment(reply.comment_time).format('YYYY-MM-DD HH:mm'), - user_login: reply.user_login, - username: reply.user_name, - content: reply.content, - - score: reply.score, - delete: reply.delete, - is_invalid: reply.is_invalid, - comment_role: reply.comment_role - } - } - onDelete = (item) => { - this.props.confirm({ - content: '确定要删除这个评阅吗?', - okText: '确定', - cancelText: '取消', - onOk: () => { - let category_id= this.props.match.params.category_id; - const url = `/graduation_works/${category_id}/delete_score.json?comment_id=${item.id}` - axios.delete(url).then((result)=>{ - if(result.data.status == 0){ - this.props.showNotification('删除成功') - this.fetchAllComments() - } - }).catch((error)=>{ - console.log(error) - }) - }, - onCancel() { - console.log('Cancel'); - }, - }); - - } - - showModulationtype=(id)=>{ - // console.log(id) - - this.setState({ - Modulationtype:true, - operationId:id - }) - - } - - cancelmodel=()=>{ - - this.setState({ - Modalstype:false, - Loadtype:false, - visible:false, - Modulationtype:false, - Allocationtype:false, - Modalstopval:"", - ModalCancel:"", - ModalSave:"", - }) - - } - - - saveModulationModal=(value,num)=>{ - console.log(value,num) - let {operationId}=this.state; - let category_id= this.props.match.params.category_id; - // console.log(value,num) - let url ="/graduation_works/"+category_id+"/adjust_score.json"; - axios.post(url,{ - score:num, - comment:value - }).then((result)=>{ - // console.log(result) - if(result.data.status===0){ - this.setState({ - Modalstype:true, - Allocationtype:false, - Modalstopval:result.data.message, - ModalSave:this.cancelmodel, - }) - this.fetchAllComments() - } - - }).catch((error)=>{ - console.log(error) - }) - - } - - render(){ - let { total_count, comments, pageCount, comment_scores } = this.state - const { current_user, memo } = this.props - const isAdmin = this.props.isAdmin(); - const isStudent=this.props.isStudent(); - const isNotMember=this.props.isNotMember(); - - - return( - - {comment_scores.length===0&&isStudent===true||comment_scores.length===0&&isNotMember===true? "":
    - {isStudent===true? - this.showModulationtype(id)} - saveModulationModal={(value,num)=>this.saveModulationModal(value,num)} - addSuccess={this.addSuccess} - onDelete={this.onDelete} - /> - : this.showModulationtype(id)} - saveModulationModal={(value,num)=>this.saveModulationModal(value,num)} - addSuccess={this.addSuccess} - onDelete={this.onDelete} - /> - } -
    - } -
    - ) - } -} -export default ImageLayerOfCommentHOC() (GraduationTasksappraiseReply); -{/*
    */} - {/*
    */} - {/**/} - {/**/} - {/*

    暂时还没有相关数据哦!

    */} - {/*
    */} - {/*
    */} -{/**/} \ No newline at end of file diff --git a/src/modules/courses/graduation/tasks/GraduationTasksappraiseReplyChild.js b/src/modules/courses/graduation/tasks/GraduationTasksappraiseReplyChild.js deleted file mode 100644 index 62012237..00000000 --- a/src/modules/courses/graduation/tasks/GraduationTasksappraiseReplyChild.js +++ /dev/null @@ -1,103 +0,0 @@ -import React,{ Component } from "react"; -import { Pagination } from "antd"; -import {ImageLayerOfCommentHOC} from '../../../page/layers/ImageLayerOfCommentHOC' -import GraduationTasksappraiseMainEditor from './GraduationTasksappraiseMainEditor' -import Graduationtaskitem from './Graduationtaskitem' -import '../../../comment/Comment.css' -import '../../common/courseMessage.css' -import './GraduationTasksappraiseReply.css' -import ModulationModal from "../../coursesPublic/ModulationModal"; -import Modals from '../../../modals/Modals'; -const REPLY_PAGE_COUNT = 10 -const $ = window.$; - -class GraduationTasksappraiseReplyChild extends Component{ - constructor(props){ - super(props); - this.state={ - - } - } - - render(){ - let { total_count, comments, pageCount, comment_scores} = this.props; - - const isAdmin = this.props.isAdmin(); - const isStudent=this.props.isStudent(); - - - return( - - -
    - - - - - {this.props.Modulationtype===true?this.props.saveModulationModal(value,num)} - closable={false} - footer={null} - destroyOnClose={true} - centered={true} - />:""} - - {/*
    */} - {/*

    {datalist&&datalist.task_name}

    */} - {/*返回*/} - {/*{this.props.isStudent()?补交附件:""}*/} - {/*
    */} - {this.props.ultimate===true? isAdmin && - - :""} - {this.props.ultimate===true?"":
    - 全部评阅 - { !!comment_scores.length && - {comment_scores.length===0?"":`(${comment_scores.length})`} - } -
    } - - {this.props.ultimate===true ? "": isAdmin && this.props.addSuccess()} - showSameScore={this.props.task_type == 2} - > } -
    - - {!!comment_scores.length &&
    - -
    - - - -
    - { comment_scores.map(item => { - return - }) } -
    -
    -
    } -
    - ) - } -} -export default ImageLayerOfCommentHOC() (GraduationTasksappraiseReplyChild); \ No newline at end of file diff --git a/src/modules/courses/graduation/tasks/GraduationTasksedit.js b/src/modules/courses/graduation/tasks/GraduationTasksedit.js deleted file mode 100644 index ce789848..00000000 --- a/src/modules/courses/graduation/tasks/GraduationTasksedit.js +++ /dev/null @@ -1,527 +0,0 @@ -import React,{Component} from "react"; -import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal} from "antd"; -import {Link} from 'react-router-dom'; -import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor'; -import { WordsBtn,getUrl ,getUploadActionUrl,appendFileSizeToUploadFileAll,AttachmentList,appendFileSizeToUploadFile} from 'educoder'; -import axios from 'axios'; -import Modals from '../../../modals/Modals'; -import '../../css/Courses.css'; -const { Option} = Select; -const CheckboxGroup = Checkbox.Group; -const confirm = Modal.confirm; -let GraduationTasksedittype=true; - -class GraduationTasksedit extends Component{ - - constructor(props){ - super(props) - this.state={ - coursename:"", - coursesearch:"", - title_num:0, - title_value:"", - fileList: [], - contents: [{val:"",id:1}], - taskid:"", - taskneme:"", - tasktype:undefined, - name:"", - description:undefined, - shixunsreplace:false, - graduationtask_id:undefined - } - } - - componentDidMount(){ - - let {title_num}=this.state; - - let tasksid=this.props.match.params.category_id; - let url ="/graduation_tasks/"+tasksid+"/edit.json" - axios.get(url).then((result)=>{ - let namelength=result.data.task_name.length; - - const fileList = result.data.attachments.map(item => { - return { - id: item.id, - uid: item.id, - name: appendFileSizeToUploadFile(item), - url: item.url, - filesize: item.filesize, - status: 'done' - } - }) - this.setState({ - // fileList:newfilelist, - description:result.data.description, - tasktype:result.data.task_type, - name:result.data.task_name, - data:result.data, - title_num:namelength, - attachments:result.data.attachments, - fileList:fileList, - graduationtask_id:result.data.graduation_id - }) - - - this.props.form.setFieldsValue({ - tasktype:result.data.task_type, - name:result.data.task_name, - }); - }).catch((error)=>{ - console.log(error) - }) - - - - } - - - - - goback=()=>{ - this.props.history.replace(`/classrooms/${this.state.data.course_id}/graduation_tasks/${this.state.data.graduation_id}`); - } - - - // 输入title - changeTitle=(e)=>{ - this.setState({ - title_num:e.target.value.length, - title_value:e.target.value - }) - - } - // 附件相关 START - handleChange = (info) => { - if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') { - let fileList = info.fileList; - this.setState({ - fileList: appendFileSizeToUploadFileAll(fileList), - }); - } - } - - cancelAttachment=()=>{ - this.setState({ - Modalstype:false, - Loadtype:false, - Modalstopval:'确定要删除这个附件吗?', - ModalSave:"", - ModalCancel:"" - }) - } - - onAttachmentRemove = (file) => { - if(!file.percent || file.percent == 100){ - this.cancelAttachment(); - const url = `/attachments/${file.response ? file.response.id : file.uid}.json` - // const url = `/attachments/${file}.json` - axios.delete(url, { - }) - .then((response) => { - if (response.data) { - - if ( response.data.status === 0) { - - this.setState({ - Modalstype:false, - Modalstopval:response.data.message, - ModalSave:this.cancelAttachment, - Loadtype:true, - }) - - this.setState((state) => { - - const index = state.fileList.indexOf(file); - const newFileList = state.fileList.slice(); - newFileList.splice(index, 1); - return { - fileList: newFileList, - }; - }); - } - } - }) - .catch(function (error) { - console.log(error); - }); - } - - } - - Commoninterface=(fileList)=>{ - let listid=[] - let graduation_id=this.state.data.graduation_id; - if(fileList!=undefined&&fileList.length>0) { - for (var list of fileList) { - if (list.response != undefined) { - listid.push(list.response.id) - } else { - listid.push(list.uid) - } - - } - } - - // console.log(listid) - // if(GraduationTasksedittype===true){ - this.props.form.validateFields((err, values) => { - - if (!err) { - - if(values.tasktype===undefined){ - this.scrollToAnchors("tasktypes"); - return - } - - if(values.name===undefined){ - this.scrollToAnchors("nametypes"); - return - } - - if(values.description===undefined){ - this.scrollToAnchors("descriptiontypes"); - return - }else if(values.description.length>5000){ - this.scrollToAnchors("descriptiontypes"); - return - } - - - console.log('Received values of form: ', values); - // console.log(fileList); - let tasksid=this.props.match.params.category_id; - - let url="/graduation_tasks/"+tasksid+".json" - axios.put(url, { - task_type:parseInt(values.tasktype), - name:values.name, - description:values.description, - attachment_ids:listid, - } - ).then((response) => { - if(response.status===200) { - // console.log(response) - // GraduationTasksedittype=false; - // window.location.href="/classrooms/"+course_id+"/graduation/"+graduationId+"/graduation_tasks/"+category_id+"/questions"; - this.goback() - //this.props.history.push("/classrooms/"+this.props.match.params.coursesId+"/graduation_tasks/"+graduation_id+"/"+this.props.match.params.category_id +"/setting"); - } - }).catch((error) => { - console.log(error) - }) - - } - }); - // } - } - handleSubmit=(e)=>{ - - let {fileList}=this.state; - // if(fileList.length===0){ - // this.setState({ - // shixunsreplace:true, - // }) - // return - // } - - this.Commoninterface(fileList); - } - //确认 - hidestartshixunsreplace = ()=>{ - let {fileList}=this.state; - - this.Commoninterface(fileList); - - - } - //取消 - hidestartshixunsreplacetwo=()=>{ - this.setState({ - shixunsreplace:false, - }) - } - checkContent = (rule, value, callback) => { - if(value.length>5000){ - callback('最大限制为5000个字符'); - }else{ - callback(); - } - } - render(){ - const { getFieldDecorator } = this.props.form; - let {title_num,pageType,name,description,Loadtype,attachments,fileList, - Modalstype,Modalstopval,ModalCancel,ModalSave,shixunsreplace ,graduationtask_id} =this.state; - - let {coursedata}=this.props; - let courseId=this.props.match.params.coursesId; - - let category_id=this.props.match.params.category_id; - const uploadProps = { - width: 600, - fileList, - // https://github.com/ant-design/ant-design/issues/15505 - // showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。 - // showUploadList: false, - action: `${getUploadActionUrl()}`, - onChange: this.handleChange, - onRemove: this.onAttachmentRemove, - beforeUpload: (file) => { - console.log('beforeUpload', file.name); - const isLt150M = file.size / 1024 / 1024 < 150; - if (!isLt150M) { - this.props.showNotification('文件大小必须小于150MB!'); - } - return isLt150M; - }, - }; - - - document.title=this.props.current_user&&this.props.current_user.course_name; - return( - - -
    - {/*提示*/} - - -
    -

    还未上传附件

    -

    是否确认提交作品?

    -
    - -
    -
    -
    - -

    - - {this.props.current_user&&this.props.current_user.course_name} - - > - 毕设任务 - > - {name===""?"": - - {name} - > - - } - {"编辑"} -

    - -
    -

    编辑毕设任务

    - 返回 -
    - - {description===undefined?"": -
    - -
    - - - {getFieldDecorator('tasktype', { - rules: [{ required: true, message: "请选择任务类型" }], - })()} - - (选择确认后,无法修改) - - - - {getFieldDecorator('name', { - rules: [{ required: true, message: "请输入标题" }], - })()} - - -
    - - -
    - - - {getFieldDecorator('description', { - rules: [{ - required: true, message: '请输入内容', - },{ - max:5000,message:'最大限制5000个字符' - }], - })( - - )} - - - {/**/} - {/*{attachments&&attachments.map((item,key)=>{*/} - - {/*return(*/} - {/*
    */} - {/**/} - {/**/} - {/**/} - {/**/} - {/*{item.title}*/} - - {/**/} - {/**/} - {/*{item.filesize}*/} - - {/**/} - {/*{item.delete===true?*/} - {/*this.onAttachmentRemove(item.id)}*/} - {/*aria-hidden="true">*/} - {/*:""}*/} - {/*
    */} - {/*)*/} - {/*})}*/} - - - (单个文件150M以内) - - {/**/} - {/*{this.state.fileList.length===0?"":this.state.fileList.map((item,key)=>{*/} - {/*return(*/} - {/*

    */} - {/**/} - {/**/} - {/**/} - {/**/} - {/*{item.name}*/} - {/**/} - {/**/} - {/*{item.response===undefined?"":bytesToSize(item.size)}*/} - {/**/} - {/*this.onAttachmentRemove(item.response===undefined?"":item.response.id&&item.response.id)}>*/} - {/*

    */} - {/*)*/} - {/*})}*/} - {/*{attachments&&attachments.map((item,key)=>{*/} - - {/*return(*/} - {/*
    */} - {/**/} - {/**/} - {/**/} - {/**/} - {/*{item.title}*/} - - {/**/} - {/**/} - {/*{item.filesize}*/} - - {/**/} - {/*{item.delete===true?*/} - {/*this.onAttachmentRemove(item)}*/} - {/*aria-hidden="true">*/} - {/*:""}*/} - {/*
    */} - {/*)*/} - {/*})}*/} - - -
    - - - -
    - - 取消 -
    -
    - {/**/} -
    - } - -
    -
    -
    - -
    - - ) - } -} -const GraduationTaskseditApp = Form.create({ name: 'coursesNew' })(GraduationTasksedit); -export default GraduationTaskseditApp; diff --git a/src/modules/courses/graduation/tasks/GraduationTasksnew.js b/src/modules/courses/graduation/tasks/GraduationTasksnew.js deleted file mode 100644 index 06096913..00000000 --- a/src/modules/courses/graduation/tasks/GraduationTasksnew.js +++ /dev/null @@ -1,533 +0,0 @@ -import React, {Component} from "react"; -import {Form, Select, Input, Button, Checkbox, Upload, Icon, message, Modal} from "antd"; -import {Link} from 'react-router-dom'; -import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor'; -import {WordsBtn, getUrl,bytesToSize,appendFileSizeToUploadFileAll , getUploadActionUrl} from 'educoder'; -import axios from 'axios'; -import Modals from '../../../modals/Modals'; -import '../../css/Courses.css'; - - -const {Option} = Select; -const CheckboxGroup = Checkbox.Group; -const confirm = Modal.confirm; -let GraduationTasksnewtype = true; - -class GraduationTasksnew extends Component { - - constructor(props) { - super(props) - this.state = { - coursename: "", - coursesearch: "", - title_num: 0, - title_value: "", - fileList: [], - contents: [{val: "", id: 1}], - type: true, - shixunsreplace:false, - } - } - - componentDidMount() { - // const query =this.props.location.search; - // - // const type = query.split('&'); - // let name = type[1].split("name=") - // name = String(name).split(",") - // name = decodeURI(name[1]) - // - // this.setState({ - // coursename:name, - // coursesearch:this.props.location.search - // }) - } - - scrollToAnchors = (anchorName) => { - this.setState({ - anchor: anchorName - }) - } - - Commoninterface =(fileList)=>{ - let coursesId=this.props.match.params.coursesId; - let category_id=this.props.match.params.category_id; - let listid = [] - - for (var list of fileList) { - listid.push(list.response.id) - } - // if (GraduationTasksnewtype === true) { - this.props.form.validateFields((err, values) => { - if (values.tasktype === undefined) { - this.ifHasAnchorJustScorll("tasktypes"); - return - } - if (values.name === undefined) { - this.ifHasAnchorJustScorll("nametypes"); - return - } - if (values.description === undefined) { - this.ifHasAnchorJustScorll("descriptiontypes"); - return - }else if (values.description.length > 5000) { - this.ifHasAnchorJustScorll("descriptiontypes"); - return - } - if (!err) { - // console.log('Received values of form: ', values); - // console.log(fileList); - const course_id = this.props.match.params.coursesId; - - let url = "/courses/" + course_id + "/graduation_tasks.json" - axios.post(url, { - task_type: parseInt(values.tasktype), - name: values.name, - description: values.description, - attachment_ids: listid, - } - ).then((response) => { - // if (response.status === 200) { - // GraduationTasksnewtype = false; - // this.goback(); - if(response!==undefined){ - // this.goback() - this.props.history.replace(`/classrooms/${coursesId}/graduation_tasks/${category_id}/detail/${response.data.task_id}/questions`); - } - // } - }).catch((error) => { - console.log(error) - }) - } - - }); - // } - } - - - - - goback = () => { - // let courseId = this.props.match.params.coursesId; - // if(courseId===undefined){ - // this.props.history.push("/classrooms"); - // }else{ - // this.props.history.push(this.props.current_user.first_category_url); - // } - // this.props.history.goBack() - this.props.history.replace(`/classrooms/${this.props.match.params.coursesId}/graduation_tasks/${this.props.match.params.category_id}`); - } - - - // 输入title - changeTitle = (e) => { - // title_num: 60 - parseInt(e.target.value.length), - this.setState({ - title_num: e.target.value.length, - title_value: e.target.value - }) - - } - // 附件相关 START - handleChange = (info) => { - if(info.file.status == "done" || info.file.status == "uploading" || info.file.status === 'removed'){ - let fileList = info.fileList; - - // for(var list of fileList ){ - // console.log(list) - // } - this.setState({ - fileList: appendFileSizeToUploadFileAll(fileList), - }); - } - } - - // onAttachmentRemove = (file) => { - // // confirm({ - // // title: '确定要删除这个附件吗?', - // // okText: '确定', - // // cancelText: '取消', - // // // content: 'Some descriptions', - // // onOk: () => { - // // this.deleteAttachment(file) - // // }, - // // onCancel() { - // // console.log('Cancel'); - // // }, - // // }); - // // return false; - // - // this.setState({ - // Modalstype: true, - // Modalstopval: '确定要删除这个附件吗?', - // ModalSave: () => this.deleteAttachment(file), - // ModalCancel: this.cancelAttachment - // }) - // return false; - // } - - cancelAttachment = () => { - this.setState({ - Modalstype: false, - Modalstopval: '', - ModalSave: "", - ModalCancel: "" - }) - } - - onAttachmentRemove = (file) => { - if(!file.percent || file.percent == 100){ - this.props.confirm({ - content: '确定要删除这个附件吗?', - okText: '确定', - cancelText: '取消', - // content: 'Some descriptions', - onOk: () => { - this.deleteAttachment(file) - }, - onCancel() { - console.log('Cancel'); - }, - }); - return false; - - } - - } - - deleteAttachment = (file) =>{ - const url = `/attachments/${file.response ? file.response.id : file.uid}.json` - // const url = `/attachments/${file}.json` - axios.delete(url, {}) - .then((response) => { - if (response.data) { - const {status} = response.data; - if (status == 0) { - console.log('--- success') - - this.setState((state) => { - const index = state.fileList.indexOf(file); - const newFileList = state.fileList.slice(); - newFileList.splice(index, 1); - return { - fileList: newFileList, - }; - }); - this.cancelAttachment() - } - } - }) - .catch(function (error) { - console.log(error); - }); - } - - //滚动 - ifHasAnchorJustScorll() { - // let anchor = this.getURLStuff("anchor"); - - let anchor = this.state.anchor; - // console.log("anchor ", anchor); - // 对应id的话, 滚动到相应位置 - if (!!anchor) { - let anchorElement = document.getElementById(anchor); - if (anchorElement) { - window.scrollTo(0, anchorElement.offsetTop - window.innerHeight / 2); - } - } - // 没有的话,滚动到头部 - else { - document.body.scrollTop = document.documentElement.scrollTop = 0; - } - } - - // 提交按钮 - handleSubmit = (e) => { - let {fileList} = this.state; - // if(fileList.length===0){ - // this.setState({ - // shixunsreplace:true, - // }) - // - // return - // } - - this.Commoninterface(fileList); - - } - //确认 - hidestartshixunsreplace =()=>{ - let {fileList} = this.state; - - this.Commoninterface(fileList); - } - //取消 - hidestartshixunsreplacetwo=()=>{ - this.setState({ - shixunsreplace:false, - }) - - } - - - checkContent = (rule, value, callback) => { - if (value == "") { - callback('请输入内容'); - }else if(value.length>5000){ - callback('最大限制为5000个字符'); - }else{ - callback(); - } - } - - render() { - const {getFieldDecorator} = this.props.form; - let { - coursename, coursesearch, title_num, title_value, pageType, fileList, contents, type, - Modalstype, Modalstopval, ModalCancel, ModalSave,shixunsreplace - } = this.state; - - let {coursedata} = this.props; - - let courseId = this.props.match.params.coursesId; - let position = this.props.match.params.position; - let category_id = this.props.match.params.category_id; - const uploadProps = { - width: 600, - fileList, - multiple: true, - // https://github.com/ant-design/ant-design/issues/15505 - // showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。 - // showUploadList: false, - action: `${getUploadActionUrl()}`, - onChange: this.handleChange, - onRemove: this.onAttachmentRemove, - beforeUpload: (file) => { - console.log('beforeUpload', file.name); - const isLt150M = file.size / 1024 / 1024 < 150; - if (!isLt150M) { - this.props.showNotification('文件大小必须小于150MB!'); - } - return isLt150M; - }, - }; - // this.ifHasAnchorJustScorll(); - // console.log(this.props.current_user.course_name) - document.title=this.props.current_user&&this.props.current_user.course_name; - return ( - - -
    - {/*提示*/} - - -
    -

    还未上传附件

    -

    是否确认提交作品?

    -
    - -
    -
    -
    - -

    - {this.props.current_user && this.props.current_user.course_name} - > - 毕设任务 - > - {"新建"} -

    - -
    -

    新建毕设任务

    - 返回 -
    - - - {/**/} - - {/*内容*/} -
    - - - {getFieldDecorator('tasktype', { - rules: [{required: true, message: "请选择任务类型"}], - })()} - - (选择确认后,无法修改) - - - - {getFieldDecorator('name', { - rules: [{required: true, message: "不能为空"}], - })( - - - - )} - - -
    - - -
    - - - {getFieldDecorator('description', { - rules: [{ - required: true, message: '请输入内容', - },{ - max:5000,message:'最大限制5000个字符' - }] - })( - - )} - - - - - - (单个文件150M以内) - - - - {/*{this.state.fileList.length===0?"":this.state.fileList.map((item,key)=>{*/} - {/*return(*/} - {/*

    */} - {/**/} - {/**/} - {/**/} - {/**/} - {/*{item.name}*/} - {/**/} - {/**/} - {/*{item.response===undefined?"":bytesToSize(item.size)}*/} - {/**/} - {/*this.onAttachmentRemove(item.response===undefined?"":item.response.id&&item.response.id)}>*/} - {/*

    */} - {/*)*/} - {/*})}*/} - -
    - - - -
    - - 取消 -
    -
    - {/**/} - -
    -
    -
    - -
    - - ) - } -} - -const GraduationTasksnewApp = Form.create({name: 'coursesNew'})(GraduationTasksnew); -export default GraduationTasksnewApp; diff --git a/src/modules/courses/graduation/tasks/GraduationTaskssetting.js b/src/modules/courses/graduation/tasks/GraduationTaskssetting.js deleted file mode 100644 index bff4e424..00000000 --- a/src/modules/courses/graduation/tasks/GraduationTaskssetting.js +++ /dev/null @@ -1,1311 +0,0 @@ -import React,{Component} from "react"; -import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal, Table, Divider, Tag,DatePicker,Radio,Tooltip} from "antd"; -import {Link} from 'react-router-dom'; -import locale from 'antd/lib/date-picker/locale/zh_CN'; -import { WordsBtn,getRandomcode ,handleDateString} from 'educoder'; -import axios from 'axios'; -import Modals from '../../../modals/Modals'; -import DownloadMessageysl from "../../../modals/DownloadMessageysl"; - -import CoursesListType from '../../coursesPublic/CoursesListType'; -import HomeworkModal from "../../coursesPublic/HomeworkModal"; -import moment from 'moment'; -const { Option} = Select; -const RadioGroup = Radio.Group; - -function range(start, end) { - const result = []; - for (let i = start; i < end; i++) { - result.push(i); - } - return result; -} - -function disabledDateTime() { - return { - disabledMinutes: () => range(1, 30).concat(range(31, 60)), - }; -} - -function disabledDate(current) { - return current && current < moment().endOf('day').subtract(1, 'days'); -} - -//毕设任务设置 -class GraduationTaskssettingapp extends Component{ - - constructor(props){ - super(props) - this.state={ - coursename:"", - coursesearch:"", - title_num:20, - title_value:"", - fileList: [], - contents: [{val:"",id:1}], - type:true, - taskname:"", - taskid:"", - settingdata:undefined, - baseonproject:false, - minnum:2, - maxnum:5, - firstTimes:true, - publish_time:null, - end_time:null, - allowlate:1, - latepenalty:undefined, - latetime:null, - crosscomment:undefined, - commentstatus:1, - commentnum:0, - opergrade:false, - operworks:false, - commenttime:undefined, - graduationgroups:[], - assigngroups:[], - selecassigngroups:[], - hasproject:false, - hascommit:false, - minnums:0, - max_nums:0, - minnumstype:false, - maxnumstype:false, - edittype:false, - task_type:false, - starttimetype:false, - endtimetype:false, - flagPageEdit:false, - visible:false, - starttime:undefined, - DownloadType:false, - DownloadMessageval:undefined, - commentstatustype:undefined, - commenttimeone:undefined - } - } - - reInit=()=>{ - this.getsettings(); - } - - getsettings=()=>{ - let task_Id=this.props.match.params.task_Id; - - let url ="/graduation_tasks/"+task_Id+"/settings.json" - axios.get(url).then((result)=> { - if(result.status===200){ - let assigngroups = [] - for (var list of result.data.graduation_groups) { - assigngroups.push({ - assign_group_id: list.assign_group_id, - select_name: list.select_name, - }) - } - let starttype=false; - let endtype=false; - if(moment(result.data.publish_time)<=moment()){ - starttype=true - } - if(moment(result.data.end_time)<=moment()){ - endtype=true - } - - this.setState({ - starttimetype:starttype, - endtimetype:endtype, - settingdata: result.data, - minnum: result.data.min_num, - minnums: result.data.min_num, - maxnum: result.data.max_num, - max_nums: result.data.max_num, - task_type: result.data.task_type, - baseonproject: result.data.base_on_project, - firstTimes:!result.data.publish_time && !result.data.end_time, - publish_time:result.data.publish_time===null||result.data.publish_time=== ""?"":moment(moment(handleDateString(result.data.publish_time))).format("YYYY-MM-DD HH:mm"), - end_time:result.data.end_time===null||result.data.end_time=== ""?"":moment(moment(handleDateString(result.data.end_time))).format("YYYY-MM-DD HH:mm"), - allowlate: result.data.allow_late, - latepenalty: result.data.late_penalty, - latetime:result.data.late_time===null||result.data.late_time=== ""?"":moment(moment(handleDateString(result.data.late_time))).format("YYYY-MM-DD HH:mm"), - crosscomment: result.data.cross_comment, - taskid: result.data.id, - taskname: result.data.task_name, - coursename: result.data.course_name, - commentstatus: result.data.comment_status, - commentstatustype:result.data.status, - commentnum: result.data.comment_num, - operworks: result.data.open_work, - opergrade: result.data.open_score, - graduationgroups: result.data.graduation_groups, - hasproject: result.data.has_project, - hascommit: result.data.has_commit, - assigngroups: assigngroups, - commenttime:result.data.comment_time===null||result.data.comment_time=== ""?"":moment(moment(handleDateString(result.data.comment_time))).format("YYYY-MM-DD HH:mm"), - task_status: result.data.task_status - }) - this.props.setend_time(result.data.end_time) - } - - }).catch((error)=>{ - console.log(error) - }) - } - - - componentDidMount(){ - let query=this.props.location.search - const type = query.split('?tab='); - let id=parseInt(type[1]) - this.getsettings(); - if(this.props.isAdmin()===true&&isNaN(id)){ - this.editSetting() - } - - let tab = this.props.tab; - this.props.setTab && this.props.setTab(tab); - try{ - this.props.triggerRef(this) - }catch(e){ - - } - } - - - baseprojectfun=(e)=>{ - this.setState({ - baseonproject:e.target.checked - }) - } - - - setminnum=(e)=>{ - - if(isNaN(parseInt(e.target.value))){ - this.setState({ - minnum:"" - }) - }else if(parseInt(e.target.value)===0) { - this.setState({ - minnum:1 - }) - }else{ - this.setState({ - minnum:parseInt(e.target.value) - }) - } - - } - - setmaxnum=(e)=>{ - let {minnum}=this.state; - - if(isNaN(parseInt(e.target.value))){ - this.setState({ - maxnum:"" - }) - }else if(parseInt(e.target.value)===0) { - this.setState({ - maxnum:parseInt(minnum)+1 - }) - }else{ - if(parseInt(e.target.value)<=parseInt(minnum)){ - this.setState({ - maxnum:minnum+1 - }) - }else{ - this.setState({ - maxnum:parseInt(e.target.value) - }) - } - } - } - - - onChangeTimepublish= (date, dateString) => { - let endtime; - if(date===null){ - this.setState({ - publish_time:null, - end_time:null, - latetime:null - }) - }else{ - let { firstTimes } = this.state; - // 判断是否是第一次设置 - this.setState({ - publish_time:moment(moment(handleDateString(dateString))).format("YYYY-MM-DD HH:mm"), - publishTimetypes:false - }) - if(firstTimes){ - endtime= moment(moment(handleDateString(dateString))).add(1, 'months').format("YYYY-MM-DD HH:mm") - let {allowlate}=this.state; - this.setState({ - firstTimes:undefined - }) - if(allowlate===true||allowlate===1){ - this.setState({ - end_time:endtime, - latetime:moment(moment(handleDateString(endtime))).add(1, 'months').format("YYYY-MM-DD HH:mm"), - }) - }else{ - this.setState({ - end_time:endtime - }) - } - } - } - } - - - onChangeTimeend= (date, dateString) => { - - if(date===null){ - this.setState({ - end_time:null, - latetime:null - }) - }else{ - let { firstTimes } = this.state; - this.setState({ - end_time:moment(moment(handleDateString(dateString))).format("YYYY-MM-DD HH:mm"), - endTimetypes:false - }) - // 判断是否是第一次设置 - if(firstTimes){ - this.setState({ - firstTimes:undefined - }) - let {allowlate}=this.state; - if(allowlate===true||allowlate===1){ - this.setState({ - latetime:moment(moment(handleDateString(dateString))).add(1, 'months').format("YYYY-MM-DD HH:mm"), - }) - } - } - } - } - - onChangeTimelatetime=(date, dateString)=>{ - let {end_time}=this.state; - if(moment(dateString)>moment(end_time)){ - this.setState({ - latetimetype:false - }) - } - this.setState({ - latetime:handleDateString(dateString) - }) - } - - onChangeTimecommenttime=(date, dateString)=>{ - let{end_time}=this.state; - if(moment(dateString)>moment(end_time)){ - this.setState({ - commenttimetype:false, - }) - } - - this.setState({ - commenttime:handleDateString(dateString) - }) - - } - - - allowlatefun=(e)=>{ - let {end_time}=this.state; - - if(e.target.checked===true||e.target.checked===1){ - - this.setState({ - latepenalty:5, - allowlate:e.target.checked, - latetime:end_time===null||end_time === ""?"":moment(moment(handleDateString(end_time))).add(1, 'months').format("YYYY-MM-DD HH:mm"), - }) - }else{ - this.setState({ - latepenalty:0, - allowlate:e.target.checked, - latetime:"" - }) - } - } - - funlatepenalty=(e)=>{ - let value= parseInt(e.target.value); - - if(isNaN(value)){ - value=0 - } - - this.setState({ - latepenalty:value - }) - } - - updatesfuncrosscomment=(types,newlatetime,newcommenttime)=>{ - let {endtimetype}=this.state; - if(types===1){ - this.setState({ - // latetime:newlatetime, - crosscomment:true, - commenttime:newlatetime, - commenttimeone:newlatetime, - }) - }else{ - if(endtimetype===true){ - this.setState({ - crosscomment:true, - commenttime:newlatetime, - commenttimeone:newlatetime, - }) - }else{ - this.setState({ - // end_time:newlatetime, - crosscomment:true, - commenttime:newlatetime, - commenttimeone:newlatetime, - }) - } - } - - } - funcrosscomment=(e)=>{ - let {latetime,end_time,allowlate,commenttime,commenttimeone}=this.state; - let commenttimetype=commenttime===null||commenttime===""; - - let newlatetimea=moment(new Date()).add(7, 'days').format("YYYY-MM-DD HH:mm"); - let newcommenttimea=moment(new Date()).format("YYYY-MM-DD HH:mm"); - - let newlatetimes=moment(latetime).add(7, 'days').format("YYYY-MM-DD HH:mm"); - let newcommenttimes=moment(latetime).format("YYYY-MM-DD HH:mm"); - - let newend_timeb=moment(new Date()).add(7, 'days').format("YYYY-MM-DD HH:mm"); - let newcommenttimeb=moment(new Date()).add(8, 'days').format("YYYY-MM-DD HH:mm"); - - let newend_timed=moment(end_time).add(7, 'days').format("YYYY-MM-DD HH:mm"); - let newcommenttimed=moment(end_time).add(8, 'days').format("YYYY-MM-DD HH:mm"); - - if(e.target.checked===true){ - - - if(allowlate===1||allowlate===true){ - if(latetime===null||latetime===""){ - this.updatesfuncrosscomment(1,newlatetimea,newcommenttimea) - }else{ - this.updatesfuncrosscomment(1,newlatetimes,newcommenttimes) - } - }else{ - if(end_time===null||end_time===""){ - this.updatesfuncrosscomment(2,newend_timeb,newcommenttimeb) - }else{ - this.updatesfuncrosscomment(2,newend_timed,newcommenttimed) - } - } - - }else{ - this.setState({ - crosscomment:e.target.checked, - commenttime:undefined - }) - } - } - - funcommentstatus=(e)=>{ - this.setState({ - commentstatus:parseInt(e.target.value) - }) - } - - funcoperworks=(e)=>{ - this.setState({ - operworks:e.target.checked - }) - } - - funcopergrade=(e)=>{ - this.setState({ - opergrade:e.target.checked - }) - } - - homepublish=(ids,endtime)=>{ - let task_Id=this.props.match.params.task_Id; - const cid = this.props.match.params.coursesId - // let url = `/courses/${cid}/graduation_tasks/publish_task.json`; - let url="/courses/"+cid+"/graduation_tasks/publish_task.json" - axios.post(url,{ - task_ids:[task_Id], - group_ids: this.state.course_groupslist, - end_time:endtime, - }).then((response)=>{ - if (response.data.status == 0) { - this.getsettings(); - this.cancelmodel(); - this.setState({ - // Modalstype:true, - // Modalstopval:resulet.data.message, - // ModalSave:this.cancelmodel, - // Loadtype:true - starttime:undefined, - course_groupslist:[], - }) - this.props.showNotification(response.data.message); - } - }).catch((error)=>{ - - }) - } - // //跳转道描点的地方 - // scrollToAnchor = (anchorName) => { - // if (anchorName) { - // // 找到锚点 - // let anchorElement = document.getElementById(anchorName); - // // 如果对应id的锚点存在,就跳转到锚点 - // if(anchorElement) { anchorElement.scrollIntoView(); } - // } - // } - - saveTaskssetting=()=>{ - - - 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, - latepenaltyvalue:"不能为空" - }) - return - }else if(latepenalty===""){ - this.setState({ - latepenaltytype:true, - latepenaltyvalue:"不能为空" - }) - return - }else{ - this.setState({ - latepenaltytype:false - }) - } - - - if(starttimetype===false) { - if (moment(publish_time) <= moment()) { - this.setState({ - publishTimetypes: true, - publishTimetypesval: "发布时间不能早于当前时间", - }) - return - } else { - this.setState({ - publishTimetypes: false - }) - } - } - - - if(moment(end_time)<=moment(publish_time)){ - this.setState({ - endTimetypes:true, - endTimetypesval:"截止时间必须晚于发布时间" - }) - return - }else{ - this.setState({ - endTimetypes:false - }) - } - - if(moment(latetime)<=moment(publish_time)){ - - - this.setState({ - latetimetype:true, - latetimetypeval:"结束时间必须晚于发布时间" - }) - return - }else if(moment(latetime)<=moment(end_time)){ - - this.setState({ - latetimetype:true, - latetimetypeval:"结束时间必须晚于截止时间" - }) - return - }else{ - - this.setState({ - latetimetype:false - }) - } - - - if(crosscomment===true){ - if(this.state.commenttime===undefined||this.state.commenttime===null||this.state.commenttime===""){ - this.setState({ - commenttimetype:true, - commenttimevalue:"不能为空", - }) - return - }else{ - this.setState({ - commenttimetype:false - }) - } - if(moment(this.state.commenttime)<=moment(publish_time)){ - this.setState({ - commenttimetype:true, - commenttimevalue:"开始时间不能小于发布时间", - }) - return - }else{ - this.setState({ - commenttimetype:false - }) - } - - if(moment(this.state.commenttime)<=moment(end_time)){ - this.setState({ - commenttimetype:true, - commenttimevalue:"开始时间不能小于截止时间", - }) - return - }else{ - this.setState({ - commenttimetype:false - }) - } - - } - - if(starttimetype===false){ - if(publish_time===null||publish_time=== ""){ - this.setState({ - publishTimetypes:true, - publishTimetypesval:"发布时间不能为空", - }) - this.scrollToAnchor("publishtimestart"); - return - } - } - - - - - if(end_time===null||end_time=== ""){ - this.setState({ - endTimetypes:true, - endTimetypesval:"截止时间不能为空" - }) - this.scrollToAnchor("publishtimeend"); - return - } - - - - - - if(this.props.isAdmin()) { - - this.setState({ - edittype: true - }) - - if (hascommit === true) { - if (parseInt(this.state.minnum) > parseInt(minnums)) { - this.setState({ - minnumstype: true - }) - return - }else{ - this.setState({ - minnumstype:false - }) - } - if (parseInt(this.state.maxnum) < parseInt(max_nums)) { - this.setState({ - maxnumstype: true - }) - return - }else{ - this.setState({ - maxnumstype:false - }) - } - } - - if (this.state.end_time === "" || this.state.end_time === null) { - this.setState({ - end_timetype: true - }) - return - }else{ - this.setState({ - end_timetype:false - }) - } - - - if(publish_time!=null){ - this.sethomepublish(); - - } - - } - } - - - sethomepublish=()=>{ - let {assigngroups,starttime}=this.state; - let assigngroupslist=[]; - for(var list of assigngroups){ - assigngroupslist.push(list.assign_group_id) - } - - let {allowlate,baseonproject,crosscomment,opergrade,operworks,commentstatus,latepenalty,end_time,latetime}=this.state; - - let task_Id=this.props.match.params.task_Id; - - - let url="/graduation_tasks/"+task_Id+"/update_settings.json"; - axios.post(url,{ - min_num: this.state.minnum, - max_num: this.state.maxnum, - base_on_project:baseonproject===true?1:0, - publish_time:this.state.publish_time===null||this.state.publish_time=== ""?"":this.state.publish_time, - end_time: this.state.end_time===null||this.state.end_time=== ""?this.props.getNowFormatDates(2,1):this.state.end_time, - allow_late:allowlate===true||allowlate===1?1:undefined, - late_time: this.state.latetime===null||this.state.latetime=== ""?this.props.getNowFormatDates(3,1):this.state.latetime, - late_penalty: latepenalty, - cross_comment: crosscomment===true?1:undefined, - comment_status: crosscomment===true?this.state.commentstatus===0?2:this.state.commentstatus===1?2:this.state.commentstatus:undefined, - comment_num: commentstatus===4?this.state.commentnum:undefined, - comment_time: crosscomment===true?this.state.commenttime:undefined, - comment_group: commentstatus===4?assigngroupslist:undefined, - open_work: opergrade===true?1:undefined, - open_score: operworks===true?1:undefined, - group_ids:this.state.course_groupslist - }).then((resulet)=>{ - - if(resulet.status===200){ - - if(resulet.data.status===0){ - this.getsettings(); - this.cancelmodel(); - this.isgoback() - this.setState({ - // Modalstype:true, - // Modalstopval:resulet.data.message, - // ModalSave:this.cancelmodel, - // Loadtype:true - starttime:undefined, - course_groupslist:[], - }) - this.props.showNotification(resulet.data.message); - //调用父组件方法,刷新按钮 - this.props.getdatas(); - } - } - }).catch((error)=>{ - console.log(error) - }) - } - - - selectassigngroups=(e,index)=>{ - - let {assigngroups}=this.state; - let newassigngroups=assigngroups; - for(var i=0; i{ - this.getsettings(); - this.setState({ - flagPageEdit: false, - }) - } - cancelmodel=()=>{ - - this.setState({ - Modalstype:false, - Loadtype:false, - visible:false, - visibles:false, - Modalstopval:"", - ModalCancel:"", - ModalSave:"", - starttime:undefined - }) - - } - - coursetaskend=()=>{ - - const coursesId = this.props.match.params.coursesId; - const task_Id = this.props.match.params.task_Id; - - let url = `/courses/${coursesId}/graduation_tasks/end_task.json`; - axios.post(url,{ - task_ids:[task_Id], - group_ids:this.state.course_groupslist - }).then((response)=>{ - if (response.data.status == 0) { - // this.setState({ - // Modalstype:true, - // Modalstopval:response.data.message, - // ModalSave:this.cancelmodel, - // Loadtype:true, - // checkBoxValues:[], - // checkAllValue:false - // }) - this.getsettings(); - this.props.showNotification(response.data.message); - - this.cancelmodel(); - this.setState({ - course_groupslist:[], - // Modalstopval:resulet.data.message, - // ModalSave:this.cancelmodel, - // Loadtype:true - }) - - - } - }).catch((error)=>{ - - }) - - - } - - - - setcommentnum=(e)=>{ - this.setState({ - commentnum:parseInt(e.target.value) - }) - - } - - scrollToAnchor = (anchorName) => { - if (anchorName) { - // 找到锚点 - let anchorElement = document.getElementById(anchorName); - // 如果对应id的锚点存在,就跳转到锚点 - if(anchorElement) { anchorElement.scrollIntoView({block: 'start', behavior: 'smooth'}); } - } - } - - skipTop=()=>{ - this.scrollToAnchor("starttime") - this.cancelmodel() - } - - getcourse_groupslist=(id)=>{ - this.setState({ - course_groupslist:id - }) - } - - //编辑 - editSetting = () => { - - if (this.state.settingdata&&this.state.settingdata.is_end === true) { - // this.setState({ - // modalsType: true, - // modalsTopval: "课堂已结束不能再修改!", - // loadtype: true, - // modalSave: this.cancelBox - // }) - this.props.showNotification("课堂已结束不能再修改!"); - } else { - - this.setState({ - flagPageEdit: true, - }) - } - - - } - /// 确认是否下载 - confirmysl(url,urls){ - - axios.get(url + '?export=true' ).then((response) => { - if(response === undefined){ - return - } - if(response.data.status&&response.data.status===-1){ - - }else if(response.data.status&&response.data.status===-2){ - if(response.data.message === "100"){ - // 已超出文件导出的上限数量(100 ),建议: - - this.setState({ - DownloadType:true, - DownloadMessageval:100 - }) - }else { - //因附件资料超过500M - this.setState({ - DownloadType:true, - DownloadMessageval:500 - }) - } - }else { - - // this.props.showNotification(`正在下载中`); - this.props.slowDownload(getRandomcode(url)) - // window.open(getRandomcode("/api" + url), '_blank'); - // this.props.showNotification(`正在下载中`); - // window.open("/api"+url, '_blank'); - } - }).catch((error) => { - console.log(error) - }); - } - - Downloadcal=()=> { - this.setState({ - DownloadType: false, - DownloadMessageval: undefined - }) - } - render(){ - const { getFieldDecorator } = this.props.form; - const dateFormat = 'YYYY-MM-DD HH:mm'; - - let {coursename,taskname,settingdata,baseonproject,Modalstype,Modalstopval,operworks,opergrade,graduationgroups,Loadtype,task_type,end_timetype, - ModalCancel,ModalSave,publish_time,end_time,allowlate,latepenalty,latetime,crosscomment,commentstatus,commentnum,commenttime,numtype, - minnum,maxnum,modalname,task_status, - visible, - Topval, - Topvalright, - Botvalleft, - Botval, - starttime, - endtime, - Cancelname, - Savesname, - Cancel, - Saves, - course_groups,hasproject,hascommit,minnumstype,maxnumstype, - latepenaltytype, - latepenaltyvalue, - latetimetype, - starttimetype, - endtimetype, - commenttimetype, - commenttimevalue, - flagPageEdit, - commentstatustype - } =this.state; - - let courseId=this.props.match.params.coursesId; - let category_id=this.props.match.params.category_id; - let task_Id=this.props.match.params.task_Id; - const radioStyle = { - display: 'block', - height: '30px', - lineHeight: '30px', - }; - - // - // console.log(moment(publish_time)) - console.log(commenttime) - - return( - - - { settingdata && settingdata ?
    - {/*提示*/} - - - - this.getcourse_groupslist(id)} - /> - - -
    - { - !flagPageEdit && this.props.isAdmin() === true ? - - 编辑设置 - {/**/} - - : "" - } - {/*内容*/} - {task_type===2?
    -
    分组设置
    -
    - - ~ - - - (学生提交作品时需要关联同组成员,组内成员作品共享) -
    - {minnumstype===true?
    已有提交作品,最小人数不能变大
    :""} - {maxnumstype===true?
    已有提交作品,最大人数不能变小
    :""} - {numtype===true?
    不能为空
    :""} -
    - - 基于项目实施 - - (选中,则必须在本平台创建项目,项目管理员可以提交作品;不选中,无需在平台创建项目,任意小组成员均可以提交作品) -
    -
    :""} - - -
    - -
    发布设置
    - - - -
    - 发布时间: - - - - - - (学生收到作业的时间) -
    - - - {this.state.publishTimetypes===true?
    - {this.state.publishTimetypesval} -
    :""} - -
    - 截止时间: - - - - - - (学生“按时”提交作品的时间截点) -
    - - {this.state.endTimetypes===true?
    {this.state.endTimetypesval} -
    :""} - {end_timetype===true?
    不能为空
    :""} - - -
    - -
    -
    补交设置
    - 开启补交 (选中,则允许学生延时提交作品) - -
    - 迟交扣分: - - (延时提交作品时,学生成绩将被扣减的分值) - {latepenaltytype===true?
    {latepenaltyvalue}
    :""} -
    - -
    - 结束时间: - - (学生“延时”提交作品的时间截点) - - {latetimetype===true?
    {this.state.latetimetypeval}
    :""} -
    - -
    - - -
    -
    评分设置
    -
    最终成绩组成 (取各教师最终评分的平均分)
    - - 启用交叉评阅 (给老师分配其他指导老师的学生作品) - - - {crosscomment===true?
    -
    - 开始时间: - - (交叉评阅开始时间之前提交的作品,参与交叉评阅) - - {crosscomment===true&&commenttimetype===true?
    {commenttimevalue}
    :""} -
    - - {/*
    - 评阅方式: - - - - - 指导老师手动分配 (由指导老师在作品列表中,手动选择每个作品被分配的评阅老师) - 答辩组间老师互评 (由系统按照设置在答辩组之间自动分配: - - 答辩组设置 - - - - - -
    */} - - - {/*
    -
    - 评阅数: - - (单个作品将被分配互评的次数) -
    - - {graduationgroups.map((item,key)=>{ - return( -
    -
    - {item.group_name}({item.member_count} 个教师) -
    - -
    - -
    - -
    - - -
    -
    - ) - })} - -
    */} -
    :""} - - -
    -
    - - {/*open_score: true*/} - {/*open_work: true*/} -
    -
    公开设置
    - -
    - 公开作品 - (选中,则在作业截止/补交结束时间之后,已提交作品的学生可以查看其它学生的作品,否则只能查看自己的作品) -
    - -
    - 公开成绩 - (选中,则在作业截止/补交结束时间之后,已提交作品的学生可以查看其它学生的成绩,否则只能查看自己的成绩) -
    - -
    - -
    - {this.props.isAdmin()===true?flagPageEdit===true?
    - - {/*取消*/} - 取消 -
    :"":""} - -
    :""} -
    - - ) - } -} - -const GraduationTaskssetting = Form.create({ name: 'coursesNew' })(GraduationTaskssettingapp); -export default GraduationTaskssetting; -// {/**/} -// -// {/* 开启补交(选中,则允许学生延时提交作品)*/} -// {/* 禁止补交*/} -// -// {/**/} diff --git a/src/modules/courses/graduation/tasks/GraduationTaskssettingReply.js b/src/modules/courses/graduation/tasks/GraduationTaskssettingReply.js deleted file mode 100644 index 85313805..00000000 --- a/src/modules/courses/graduation/tasks/GraduationTaskssettingReply.js +++ /dev/null @@ -1,278 +0,0 @@ -import React,{ Component } from "react"; -import { Pagination } from "antd"; - -import update from 'immutability-helper' -import axios from 'axios' -import MemoDetailMDEditor from '../../../forums/MemoDetailMDEditor' - -import '../../../forums/RightSection.css' -import {ImageLayerOfCommentHOC} from '../../../page/layers/ImageLayerOfCommentHOC' - -import Comments from '../../../comment/Comments' -// import './GraduateTopicReply.css' -import '../../common/courseMessage.css' -import { generateComments, generateChildComments, _findById, handleContentBeforeCreateNew, addNewComment - , addSecondLevelComment, NEED_TO_WRITE_CONTENT, handleContentBeforeCreateSecondLevelComment - , handleDeleteComment, handleCommentPraise, handleHiddenComment } from '../../common/CommentsHelper' -const REPLY_PAGE_COUNT = 10 -const $ = window.$; - -/* - 相比较GraduateTopicReply 改动的地方 - 列表接口名 /graduation_tasks/${graduation_topic_id}/show_comment.json?parent_id=${parent.id}&limit=500 - 回复类型名 jour_type: 'GraduationTask', -*/ -class GraduationTaskssettingReply extends Component{ - constructor(props){ - super(props); - this.state={ - pageCount: 1 - } - } - - componentDidMount(){ - this.fetchReplies() - - - } - _getUser() { - const { current_user } = this.props; - current_user.user_url = `/users/${current_user.login}`; - return current_user; - } - _findById = _findById - createNewComment = (commentContent, id, editor) => { - const graduation_topic_id = this.props.memo.id - - let content = handleContentBeforeCreateNew(commentContent); - const { memo } = this.props; - const url = `/users/reply_message.json`; - - let { comments } = this.state; - axios.post(url, { - journals_for_message: { - jour_type: 'GraduationTask', - jour_id: graduation_topic_id, - notes: content, - // m_parent_id - reply_id: memo.user_id - } - } - ).then((response) => { - if (response.data.status === -1) { - console.error('服务端异常') - return; - } - // this.props.showNotification('帖子发表成功') - - if (response.data && response.data.id) { - const _id = response.data.id; - // md - editor.setValue && editor.setValue('') - - const user = this._getUser(); - this.setState({ - comments: addNewComment(this.state.comments, _id, content, user, this.props.isSuperAdmin(), this), - total_count: this.state.total_count + 1 - }) - this.refs.editor.showEditor(); - - } - }).catch((error) => { - console.log(error) - }) - } - replyComment = (commentContent, id, editor) => { - const { showNotification } = this.props; - // if (!commentContent || commentContent.length === 0) { - // showNotification(NEED_TO_WRITE_CONTENT) - // return; - // } - - if (this.props.memo.id === id ) { // 回复帖子 - this.createNewComment(commentContent, id, editor); - return; - } - const url = `/users/reply_message.json`; - - const { comments } = this.state; - const user = this._getUser(); - const graduation_topic_id = this.props.memo.id - const commentIndex = this._findById(id, comments); - let comment = comments[commentIndex]; - - commentContent = handleContentBeforeCreateSecondLevelComment(commentContent) - axios.post(url, { - journals_for_message: { - jour_type: 'GraduationTask', - jour_id: graduation_topic_id, - notes: commentContent, - m_parent_id: id, - reply_id: comment.user_id - } - }, - { - } - ).then((response) => { - if (response.data.id) { - let newId = response.data.id; - - this.setState({ - comments: addSecondLevelComment(comments, comment, commentIndex, newId, commentContent, user, editor) - }) - - const newMemo2 = Object.assign({}, this.props.memo); - newMemo2.total_count = newMemo2.total_count + 1; - this.setState({ - memo: newMemo2 - }) - } - - }).catch((error) => { - console.log(error) - }) - } - - loadMoreChildComments = (parent) => { - const graduation_topic_id = this.props.memo.id - const course_id = this.props.course_id - const url = `/graduation_tasks/${graduation_topic_id}/show_comment.json?parent_id=${parent.id}&limit=500` - axios.get(url,{ - }) - .then((response) => { - const { comments } = response.data - - - // const memo = Object.assign({}, this.state.memo) - // memo.sum_replies_count = sum_replies_count; - this.setState({ - // memo, - comments: generateChildComments(comments, this.state.comments, parent, this.transformReply) - }) - }).catch((error) => { - console.log(error) - }) - } - - onPaginationChange = (pageCount) => { - this.setState({ pageCount }, () => { - this.fetchReplies() - }) - } - - fetchReplies = () => { - const graduation_topic_id = this.props.memo.id - const course_id = this.props.course_id - const url = `/graduation_tasks/${graduation_topic_id}/show_comment.json?page=${this.state.pageCount}` - // page limit parent_id - axios.get(url,{ - }) - .then((response) => { - const { comments, messages_count } = response.data - - this.setState({ - comments: generateComments(comments, this.transformReply), - // : this.state.comments.concat(comments), - total_count: messages_count - }) - }).catch((error) => { - console.log(error) - }) - } - - transformReply = (reply, children = []) => { - const isAdmin = this.props.isAdmin() - const isSuperAdmin = this.props.isSuperAdmin() - return { - admin: isAdmin, // - isSuperAdmin: isSuperAdmin, - permission: true, // - children: children, - hidden: reply.hidden, - id: reply.id, - image_url: reply.author.image_url, - reward: null, // - time: reply.time, // moment(reply.created_on).fromNow(), - user_id: reply.author.id, - user_login: reply.author.login, - user_praise: reply.user_praise, - username: reply.author.name, - content: reply.content, - praise_count: reply.praise_count, - child_message_count: reply.child_message_count - } - } - - // 公共接口 --- 删除回复 - deleteComment = (parrentComment, childCommentId) => { - handleDeleteComment(this, parrentComment, childCommentId, 'journals_for_message') - } - // 公共接口 --- 回复点赞 - commentPraise = (discussId) => { - handleCommentPraise(this, discussId, 'journals_for_message') - } - // 公共接口 --- 隐藏回复 - hiddenComment = (item, childCommentId) => { - handleHiddenComment(this, item, childCommentId, 'journals_for_message') - } - - showCommentInput = () => { - this.refs.editor.showEditor(); - } - initReply = (parent) => { - if (!parent.isAllChildrenLoaded) { - this.loadMoreChildComments(parent) - } - } - - render(){ - let { total_count, comments, pageCount } = this.state - const { current_user, memo } = this.props - - return( - - - - -
    -
    - 全部回复 - {total_count} -
    - - - - - {/* { true ? : -
    -
    写评论
    -
    } */} -
    - - { total_count > REPLY_PAGE_COUNT && -
    - -
    写评论
    -
    } -
    - ) - } -} -export default ImageLayerOfCommentHOC() (GraduationTaskssettingReply); \ No newline at end of file diff --git a/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js b/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js deleted file mode 100644 index 805f93ce..00000000 --- a/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js +++ /dev/null @@ -1,1553 +0,0 @@ -import React,{Component} from "react"; -import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal,Pagination, Table, Divider, Tag,Tooltip} from "antd"; -import {Link} from 'react-router-dom'; -import {getImageUrl, NoneData, sortDirections,getRandomcode} from 'educoder'; -import axios from 'axios'; -import moment from 'moment'; -import HomeworkModal from "../../coursesPublic/HomeworkModal"; -import Modals from '../../../modals/Modals'; -import CoursesListType from '../../coursesPublic/CoursesListType'; -import DownloadMessageysl from "../../../modals/DownloadMessageysl"; -import ModulationModal from "../../coursesPublic/ModulationModal"; -import AllocationModal from "../../coursesPublic/AllocationModal"; -import Associationmodel from '../../coursesPublic/Associationmodel'; -import AccessoryModal from "../../coursesPublic/AccessoryModal"; -import './Graduationclass.css'; - - -const CheckboxGroup = Checkbox.Group; -const Search = Input.Search; -const qs = require('qs'); - - -//毕设任务列表 -class GraduationTaskssettinglist extends Component{ - - constructor(props){ - super(props) - this.state={ - coursename:"", - coursesearch:"", - title_num:20, - limit:20, - title_value:"", - fileList: [], - contents: [{val:"",id:1}], - type:true, - taskslistdata:undefined, - data:undefined, - page:1, - teacher_comment:null, - task_status:undefined, - cross_comment:null, - search:null, - order:"update_time", - b_order:"desc", - course_group:undefined, - loadingstate:true, - operationId:null, - Allocationtype:false, - task_Id:"", - user_id:"", - visibles:false, - DownloadType:false, - DownloadMessageval:undefined, - commentstate:null - } - } - - componentDidMount(){ - let tab = this.props.tab; - this.props.setTab && this.props.setTab(tab); - - - let{teacher_comment,task_status,course_group,cross_comment,order,b_order,search}=this.state; - this.seacthdata(teacher_comment,task_status,course_group,cross_comment,order,b_order,search,this.state.page); - - this.props.getsonar(teacher_comment, task_status, course_group, cross_comment, search) - - try{ - this.props.triggerRef(this) - }catch(e){ - - } - } - - goback=()=>{ - // window.history.back(-1) - // let courseId=this.props.match.params.coursesId; - // if(courseId===undefined){ - // this.props.history.push("/classrooms"); - // }else{ - // this.props.history.push(this.props.current_user.first_category_url); - // } - // this.props.history.goBack() - this.props.history.replace(`/classrooms/${this.state.taskslistdata.course_id}/graduation_tasks/${this.state.taskslistdata.graduation_id}`); - } - - reInit=()=>{ - this.setState({ - course_groupslist:[], - checkAllValue:false - }) - let {commentstate, task_status, course_group, cross_comment, order, b_order, search} = this.state; - this.seacthdata(commentstate, task_status, course_group, cross_comment, order, b_order, search,this.state.page); - - this.props.getsonar(commentstate, task_status, course_group, cross_comment, search) - } - - seacthdata=(commentstate,task_status,course_group,cross_comment,order,b_order,search,pages)=>{ - let{page,limit}=this.state; - - // console.log(teacher_comment,task_status,course_group,cross_comment,order,b_order,search) - let task_Id=this.props.match.params.task_Id; - let url="/graduation_tasks/"+task_Id+"/tasks_list.json"; - // let user=this.props.user.user_id; - //get 数组 - axios.get(url,{ - params: { - teacher_comment:commentstate===null||commentstate===undefined?undefined:commentstate, - task_status:task_status===null?undefined:task_status, - course_group:course_group===null?undefined:course_group, - cross_comment:cross_comment===null?undefined:cross_comment, - order:order===null?undefined:order, - b_order:b_order===null?undefined:b_order, - search:search===null?undefined:search, - page:pages, - limit:20, - }, - paramsSerializer: function(params) { - return qs.stringify(params, {arrayFormat: 'brackets'}) - } - }).then((result)=> { - if(result.status===200){ - let datalist = []; - let worklists = result.data.work_lists; - if (worklists.length != 0) { - - for (var i = 0; i < worklists.length; i++) { - datalist.push({ - name: worklists[i].name, - number: (parseInt(pages)-1)*parseInt(limit)+(i+1), - stduynumber: worklists[i].student_id, - classroom: worklists[i].class_grouping_name, - grouping: result.data.have_grouping === true ? worklists[i].grouping_name : null, - submitstate: worklists[i].status === 0 ? "未提交" : worklists[i].status === 1 ? "按时提交" : worklists[i].status === 2 ? "延时提交" : "", - turnovertime:worklists[i].update_time, - associationitems:result.data.have_grouping==false?"": {name:worklists[i].project_info === undefined ?"--": worklists[i].project_info.name,id:worklists[i].project_info===undefined?"":worklists[i].project_info.id}, - teacherrating: worklists[i].teacher_comment_score, - crossrating: {cross_comment_score:worklists[i].cross_comment_score,cross_comment_num:worklists[i].cross_comment_num}, - finalscore: {work_score:worklists[i].final_score.work_score === null ? "--" : worklists[i].final_score.work_score, - teacher_comment_score:worklists[i].teacher_comment_score, - cross_comment_score:worklists[i].cross_comment_score, - late_penalty:worklists[i].late_penalty, - final_score:worklists[i].final_score, - ultimate_score:worklists[i].ultimate_score - }, - operation: this.props.isAdmin()?[{name: worklists[i].assign === true ? "分配" : "", id: worklists[i].id,status:worklists[i].status}, { - name: "调分", - id: worklists[i].id, - status:worklists[i].status - }, {name:"评阅", id: worklists[i].id, status:worklists[i].status}]:[{name:"", id: worklists[i].id, - status:worklists[i].status,view_work:worklists[i].view_work}], - }) - } - } - this.setState({ - taskslistdata: result.data, - data: datalist, - loadingstate: false, - end_time:result.data.end_time - }) - this.props.setend_time(result.data.end_time) - } - }).catch((error)=>{ - console.log(error) - }) - - } - TablePagination = (pagination, filters, sorter) => { - // console.log(e.current); - // this.setState({ - // page:e.current - // }) - if (JSON.stringify(sorter) === "{}") { - //没有选择 - } else { - //stduynumber 学号 - try { - //学生学号排序 - if (sorter.columnKey === "stduynumber") { - let orderlumn = ""; - if (sorter.order === "ascend") { - //升序 - orderlumn = "asc"; - } else if (sorter.order === "descend") { - //降序 - orderlumn = "desc"; - } - this.funorder("student_id", orderlumn) - } - } catch (e) { - - } - - //turnovertime 时间 - try { - //学生学号排序 - if (sorter.columnKey === "turnovertime") { - let orderlumn = ""; - if (sorter.order === "ascend") { - //升序 - orderlumn = "asc"; - } else if (sorter.order === "descend") { - //降序 - orderlumn = "desc"; - } - this.funorder("update_time", orderlumn); - } - } catch (e) { - - } - - //finalscore 成绩 - try { - //学生学号排序 - if (sorter.columnKey === "finalscore") { - let orderlumn = ""; - if (sorter.order === "ascend") { - //升序 - orderlumn = "asc"; - } else if (sorter.order === "descend") { - //降序 - orderlumn = "desc"; - } - this.funorder("work_score", orderlumn); - } - } catch (e) { - - } - } - } - - funteachercomment=(list,key)=> { - - let asum=undefined - let {teacher_comment, task_status, course_group, cross_comment, order, b_order, search} = this.state; - if(this.state.teacher_comment!=null&&list.length>0){ - if(this.state.teacher_comment.length>0){ - list.map((item,key)=>{ - this.state.teacher_comment.map((k,y)=>{ - if(item===k){ - list.splice(key, 1) - } - }) - }) - } - } - - let listype =list instanceof Array; - if(listype===false){ - this.setState({ - teacher_comment:null, - loadingstate:true, - commentstate:null - }) - }else{ - - if(list.length>0){ - list.map((item,key)=>{ - if(key===0){ - asum=item; - } - }) - }else{ - asum=undefined - } - this.setState({ - teacher_comment:list, - loadingstate:true, - commentstate:asum, - }) - } - - this.seacthdata(asum, task_status, course_group, cross_comment, order, b_order, search,this.state.page); - this.props.getsonar(asum, task_status, course_group, cross_comment, search) - // if(list.length===key){ - // this.seacthdata(undefined, task_status, course_group, cross_comment, order, b_order, search,this.state.page); - // this.props.getsonar(undefined, task_status, course_group, cross_comment, search) - // }else{ - // this.seacthdata(list[0], task_status, course_group, cross_comment, order, b_order, search,this.state.page); - // this.props.getsonar(list[0], task_status, course_group, cross_comment, search) - // - // } - - } - - - - - funcross_comment=(e)=>{ - let {teacher_comment, task_status, course_group, order, b_order, search,commentstate} = this.state; - - this.setState({ - cross_comment:e.target.value===undefined||e.target.value===false?null:e.target.value, - loadingstate:true - }) - this.seacthdata(commentstate, task_status, course_group, e.target.value===undefined||e.target.value===false?"":e.target.value, order, b_order, search,this.state.page); - this.props.getsonar(commentstate, task_status, course_group, e.target.value===undefined||e.target.value===false?"":e.target.value, search) - } - - inputSearchValue=(e)=>{ - - if(e.target.value===""){ - this.setState({ - search:null - }) - }else{ - this.setState({ - search:e.target.value - }) - } - - - } - - searchValue=()=>{ - - let {teacher_comment, task_status, course_group, cross_comment, order, b_order,search,commentstate} = this.state; - this.setState({ - loadingstate:true - }) - this.seacthdata(commentstate, task_status, course_group, cross_comment, order, b_order, search,this.state.page); - this.props.getsonar(commentstate, task_status, course_group, cross_comment, search) - } - - funorder = (value, newb_order) => { - - let {teacher_comment, task_status, course_group, cross_comment, b_order, search,commentstate} = this.state; - this.setState({ - order: value, - b_order: newb_order, - loadingstate: true - }) - this.seacthdata(commentstate, task_status, course_group, cross_comment, value, newb_order, search,this.state.page); - this.props.getsonar(commentstate, task_status, course_group, cross_comment, search) - } - - - - funtaskstatus=(checkedValues,key)=>{ - // console.log(checkedValues) - - let {teacher_comment, course_group, cross_comment, order, b_order, search,commentstate} = this.state; - - - - - if(JSON.stringify(checkedValues) === "[]"){ - // console.log(checkedValues); - // 全部没选的时候是空数组 - this.setState({ - task_status:undefined, - loadingstate:true - }) - this.seacthdata(commentstate, null, course_group, cross_comment, order, b_order, search,this.state.page); - this.props.getsonar(commentstate, null, course_group, cross_comment, search) - } - // else if(checkedValues.length ===key){ - // // 全部抖选中 自然就是查找全部 就是空 - // this.setState({ - // task_status:undefined, - // loadingstate:true - // }) - // this.seacthdata(teacher_comment, null, course_group, cross_comment, order, b_order, search,this.state.page); - // } - else { - //选哪个就替换那个 - this.setState({ - task_status:checkedValues===key?null:checkedValues, - loadingstate:true - }) - this.seacthdata(commentstate, checkedValues===key?undefined:checkedValues, course_group, cross_comment, order, b_order, search,this.state.page); - this.props.getsonar(commentstate, checkedValues===key?undefined:checkedValues, course_group, cross_comment, search) - } - - - } - groupgroup=(checkedValues,key)=>{ - // console.log(checkedValues); - // console.log(key); - - let {teacher_comment, task_status, cross_comment, order,b_order, search,commentstate} = this.state; - - if(JSON.stringify(checkedValues) === "[]"){ - // console.log(checkedValues); - // 全部没选的时候是空数组 - this.setState({ - course_group:undefined, - loadingstate:true - }) - this.seacthdata(commentstate, task_status, null, cross_comment, order, b_order, search,this.state.page); - this.props.getsonar(commentstate,task_status, null, cross_comment, search) - } - // else if(checkedValues.length ===key){ - // // 全部抖选中 自然就是查找全部 就是空 - // this.setState({ - // course_group:undefined, - // loadingstate:true - // }) - // this.seacthdata(teacher_comment, task_status, null, cross_comment, order, b_order, search,this.state.page); - // - // } - else { - //选哪个就替换那个 - this.setState({ - course_group:checkedValues===key?null:checkedValues, - loadingstate:true - }) - this.seacthdata(commentstate, task_status, checkedValues===key?undefined:checkedValues, cross_comment, order, b_order, search,this.state.page); - this.props.getsonar(commentstate,task_status, checkedValues===key?undefined:checkedValues, cross_comment, search) - } - - - - } - - - end=()=>{ - // this.homeworkstart() - this.setState({ - modalname:"立即截止", - visible:true, - Topval:"学生将不能再提交作品", - // Botvalleft:"暂不截止", - // Botval:`本操作只对"提交中"的任务有效`, - Cancelname:"暂不截止", - Savesname:"立即截止", - Cancel:this.cancelmodel, - Saves:this.coursetaskend, - typs:"end", - }) - - } - //立即发布 - publish=()=>{ - let starttime= this.props.getNowFormatDates(1,1); - let endtime=this.props.getNowFormatDates(2,1); - // this.homeworkstart() - this.setState({ - modalname:"立即发布", - visible:true, - Topval:"学生将立即收到毕设任务", - // Botvalleft:"点击修改", - // Botval:`本操作只对"未发布"的分班有效`, - starttime:moment(moment(new Date())).format("YYYY-MM-DD HH:mm") , - starttimes:this.props.getNowFormatDates(1), - typs:"start", - endtime:endtime, - Cancelname:"暂不发布", - Savesname:"立即发布", - Cancel:this.cancelmodel, - Saves:this.homepublish, - }) - } - //立即发布 - homeworkstart=()=>{ - let coursesId=this.props.match.params.coursesId; - let url="/courses/"+coursesId+"/all_course_groups.json"; - - axios.get(url).then((response) => { - - if(response.status===200){ - this.setState({ - modaltype:response.data.course_groups===null||response.data.course_groups.length===0?2:1, - course_groups:response.data.course_groups, - }) - } - }).catch((error) => { - console.log(error) - }); - - } - - - homepublish=(ids,endtime)=>{ - let task_Id=this.props.match.params.task_Id; - const cid = this.props.match.params.coursesId - // let url = `/courses/${cid}/graduation_tasks/publish_task.json`; - - let url="/courses/"+cid+"/graduation_tasks/publish_task.json" - axios.post(url,{ - task_ids:[task_Id], - group_ids: this.state.course_groupslist, - end_time:endtime, - }).then((response)=>{ - if (response.data.status == 0) { - this.props.showNotification(response.data.message); - this.searchValue(); - this.cancelmodel(); - this.setState({ - // Modalstopval:response.data.message, - // ModalSave:this.cancelmodel, - // Loadtype:true, - course_groupslist:[], - checkAllValue:false - }) - - } - }).catch((error)=>{ - - }) - } - - cancelmodel=()=>{ - - this.setState({ - Modalstype:false, - Loadtype:false, - visible:false, - Modulationtype:false, - Allocationtype:false, - Modalstopval:"", - ModalCancel:"", - ModalSave:"", - }) - - } - - coursetaskend=()=>{ - - const coursesId = this.props.match.params.coursesId; - const task_Id = this.props.match.params.task_Id; - - let url = `/courses/${coursesId}/graduation_tasks/end_task.json`; - axios.post(url,{ - task_ids:[task_Id], - group_ids: this.state.course_groupslist, - }).then((response)=>{ - if (response.data.status == 0) { - this.props.showNotification(response.data.message); - this.searchValue(); - this.cancelmodel(); - this.setState({ - // Modalstopval:response.data.message, - // ModalSave:this.cancelmodel, - // Loadtype:true, - course_groupslist:[], - checkAllValue:false - }) - - } - - }).catch((error)=>{ - - }) - } - - - handaccessory=()=>{ - // let {taskslistdata}=this.state; - // let courseId=this.props.match.params.coursesId; - // - // let url="/courses/"+courseId+"/graduation_tasks/"+taskslistdata.work_id+"/appraise" - // - // window.location.href=url; - this.setState({ - avisible:true - }) - } - - Cancelvisible=()=>{ - this.setState({ - avisible:false - }) - } - - setupdate=()=>{ - this.searchValue() - } - - showModulationtype=(id)=>{ - // console.log(id) - - this.setState({ - Modulationtype:true, - operationId:id - }) - - } - - showAllocationModal=(id)=>{ - - this.setState({ - Allocationtype:true, - operationId:id - }) - } - - - saveModulationModal=(value,num)=>{ - let{teacher_comment,task_status,course_group,cross_comment,order,b_order,search,commentstate}=this.state; - - let {operationId}=this.state; - // console.log(value,num) - let url ="/graduation_works/"+operationId+"/adjust_score.json"; - axios.post(url,{ - score:num, - comment:value - }).then((result)=>{ - // console.log(result) - if(result.data.status===0){ - this.seacthdata(commentstate,task_status,course_group,cross_comment,order,b_order,search,this.state.page); - this.props.getsonar(commentstate,task_status, course_group, cross_comment, search) - this.props.showNotification(result.data.message); - this.cancelmodel(); - this.setState({ - Modalstype:false, - Allocationtype:false, - // Modalstopval:result.data.message, - ModalSave:this.cancelmodel, - }) - } - - }).catch((error)=>{ - console.log(error) - }) - - } - - saveAllocationModal=(value)=>{ - let {operationId}=this.state; - let userid=parseInt(value) - let url = "/graduation_works/"+operationId+"/assign_teacher.json"; - axios.post(url,{ - user_id:userid - }).then((result)=>{ - // console.log(result) - if(result.data.status===0){ - this.setState({ - Modalstype:true, - Allocationtype:false, - Modalstopval:result.data.message, - ModalSave:this.cancelmodel, - }) - } - - }).catch((error)=>{ - console.log(error) - }) - } - - cannelAssociation=()=>{ - - this.setState({ - Modalstype:true, - Modalstopval:"确定要取消该项目关联?", - ModalCancel:this.cannerassocition, - ModalSave:this.savetassociton - }) - - } - - cannerassocition=()=>{ - - this.setState({ - Modalstype:false, - Modalstopval:"", - ModalCancel:"", - ModalSave:"", - loadtype:false, - visibles:false - }) - - } - - savetassociton=()=>{ - this.cannerassocition(); - let {taskslistdata}=this.state; - let url = "/graduation_tasks/"+taskslistdata.task_id+"/graduation_works/cancel_relate_project.json"; - - axios.get(url).then((result)=>{ - - if(result.data.status===0){ - this.searchValue() - // this.setState({ - // Modalstype:true, - // Modalstopval:result.data.message, - // ModalSave:this.cannerassocition, - // loadtype:true - // }) - } - - }).catch((error)=>{ - console.log(error) - }) - - } - - - AssociationItems=()=>{ - - this.setState({ - visibles:true - }) - } - - Cancel=()=>{ - this.setState({ - visibles:false - }) - } - - skipTop=()=>{ - this.scrollToAnchor("starttime") - this.cancelmodel() - } - - getcourse_groupslist=(id)=>{ - this.setState({ - course_groupslist:id - }) - } - - //教师下面分页搜索入口 - paginationonChanges=(pageNumber)=>{ - this.setState({ - page: pageNumber, - }) - let{teacher_comment,task_status,course_group,cross_comment,order,b_order,search,commentstate}=this.state; - this.seacthdata(commentstate,task_status,course_group,cross_comment,order,b_order,search,pageNumber); - this.props.getsonar(commentstate,task_status, course_group, cross_comment, search) - } - - /// 确认是否下载 - confirmysl(url){ - - let {teacher_comment, task_status, course_group, cross_comment, order, b_order, search,commentstate} =this.state; - - let params ={ - teacher_comment:commentstate, - task_status:task_status, - course_group:course_group, - cross_comment:cross_comment, - order:order, - b_order:b_order, - search:search, - } - axios.get(url + '?export=true',{ - params - }).then((response) => { - if(response === undefined){ - return - } - if(response.data.status&&response.data.status===-1){ - - }else if(response.data.status&&response.data.status===-2){ - if(response.data.message === "100"){ - // 已超出文件导出的上限数量(100 ),建议: - - this.setState({ - DownloadType:true, - DownloadMessageval:100 - }) - }else { - //因附件资料超过500M - this.setState({ - DownloadType:true, - DownloadMessageval:500 - }) - } - }else { - this.props.slowDownload(getRandomcode(url)) - - // this.props.showNotification(`正在下载中`); - // window.open("/api"+url, '_blank'); - } - }).catch((error) => { - console.log(error) - }); - } - - Downloadcal=()=> { - this.setState({ - DownloadType: false, - DownloadMessageval: undefined - }) - } - render(){ - - let { taskslistdata,data,page,limit,teacher_comment,task_status,cross_comment,search,loadingstate, - course_group,Modalstype,Modalstopval,ModalCancel,ModalSave,modalname,Modulationtype,Allocationtype,visibles, - visible, - Topval, - Topvalright, - Botvalleft, - Botval, - starttime, - endtime, - Cancelname, - Savesname, - Cancel, - Saves, - course_groups - } =this.state; - - let columns = [{ - title: '序号', - dataIndex: 'number', - key: 'number', - className:'edu-txt-center' - }, { - title: '姓名', - dataIndex: 'name', - key: 'name', - className:'edu-txt-center', - render: (text, record) => ( - -
    {record.name}
    -
    - ), - }, { - title: '学号', - dataIndex: 'stduynumber', - key: 'stduynumber', - className:'edu-txt-center', - sorter: true, - sortDirections: sortDirections, - render: (text, record) => ( - -
    {record.stduynumber}
    -
    - ), - }, { - title: '分班', - key: 'classroom', - dataIndex: 'classroom', - className:'edu-txt-center', - render: (text, record) => ( - - {record.classroom==="未分班"?"--":record.classroom} - - ), - }, { - title: '分组', - key: 'grouping', - dataIndex: 'grouping', - className:'edu-txt-center', - render: (text, record) => ( - - {record.grouping} - ) - },{ - title: '关联项目', - dataIndex: 'associationitems', - key: 'associationitems', - className:'edu-txt-center', - render: (text, record) => ( - - ), - },{ - title: '提交状态', - dataIndex: 'submitstate', - key: 'submitstate', - className:'edu-txt-center', - render: (text, record) => ( - - {record.submitstate} - - ), - }, { - title: '更新时间', - dataIndex: 'turnovertime', - key: 'turnovertime', - className:'edu-txt-center', - sorter: true, - defaultSortOrder: 'descend', - sortDirections: sortDirections, - render: (text, record) => ( - - - {record.turnovertime===""?"--":moment(record.turnovertime).format('YYYY-MM-DD HH:mm')} - - - ), - }, { - title: '教师评分', - key: 'teacherrating', - dataIndex: 'teacherrating', - className:'edu-txt-center', - render: (text, record) => ( - - - 90?'#DD1717':parseInt(record.teacherrating)>60&&parseInt(record.teacherrating)<90?"#FF6800":'#747A7F'}}>{record.teacherrating==="--"||record.teacherrating==="未批阅"?"--":record.teacherrating} - - - ), - }, { - title: '交叉评分', - key: 'crossrating', - dataIndex: 'crossrating', - className:'edu-txt-center', - render: (text, record) => ( - - - {record.crossrating.cross_comment_num}名老师进行了交叉评阅
    - 有效平均分:{record.crossrating.cross_comment_score}分 - }> - 90?'#DD1717':parseInt(record.crossrating.cross_comment_score)>60&&parseInt(record.crossrating.cross_comment_score)<90?"#FF6800":'#747A7F'}}>{record.crossrating.cross_comment_score==="--"||record.crossrating.cross_comment_score==="未批阅"?"--":record.crossrating.cross_comment_score} -
    -
    - ), - }, { - - title: '最终成绩', - key: 'finalscore', - dataIndex: 'finalscore', - className:'edu-txt-center', - sorter: true, - sortDirections: sortDirections, - render: (text, record) => ( - - - {record.finalscore.final_score.username}({record.finalscore.final_score.login})
    - {record.finalscore.ultimate_score===true?"":"教师评分:"+record.finalscore.teacher_comment_score+"分"}
    - {record.finalscore.cross_comment_score===undefined||record.finalscore.cross_comment_score==="未批阅"?"交叉评分:--":"交叉评分:"+record.finalscore.cross_comment_score+"分"}
    - {record.finalscore.late_penalty===undefined?"":"迟交扣分:"+record.finalscore.late_penalty+"分"}
    - 最终成绩:{record.finalscore.work_score}分
    - }> - 90?'#DD1717':parseInt(record.finalscore.work_score)>60&&parseInt(record.finalscore.work_score)<90?"#FF6800":'#747A7F'}}>{record.finalscore.work_score==="--"?"--":record.finalscore.work_score} -
    -
    - ), - }, { - title: '操作', - key: 'operation', - width:'100px', - dataIndex: 'operation', - className:'edu-txt-center', - render: operation => ( -
    - {this.props.isAdmin()?operation.map((tag,key) => { - return( - - { - tag.name && - 调整学生最终成绩
    其它历史评分将全部失效:""}> - {tag.name==="评阅"? - {tag.name} - - : - this.showModulationtype(tag.id):tag.name==="分配"?taskslistdata&&taskslistdata.cross_comment===true?"":"":""}> - {tag.name==="分配"?taskslistdata&&taskslistdata.cross_comment===true?"":"":tag.name} - - } -
    - } -
    - ) - }):""} - { - this.props.isStudent()? - operation.map((tag,key) => { - return( -
    - {tag.view_work===false?"--":查看} -
    - )} - ):"" - } -
    - - ), - }]; - - let courseId=this.props.match.params.coursesId; - let position=this.props.match.params.position; - let category_id=this.props.match.params.category_id; - let task_Id = this.props.match.params.task_Id; - - if(this.props.isStudent()===true){ - - columns.some((item,key)=> { - if (item.title === "学号") { - columns.splice(key, 1) - return true - } - } - ) - - } - - if(taskslistdata&&taskslistdata.course_group_count<=0){ - - columns.some((item,key)=> { - if (item.title === "分班") { - columns.splice(key, 1) - return true - } - } - ) - - } - - if(taskslistdata&&taskslistdata.cross_comment===false){ - - columns.some((item,key)=> { - if (item.title === "交叉评分") { - columns.splice(key, 1) - return true - } - } - ) - - } - if(taskslistdata&&taskslistdata.have_project===false){ - - columns.some((item,key)=> { - if (item.title === "关联项目") { - columns.splice(key, 1) - return true - } - } - ) - - } - - - if(taskslistdata&&taskslistdata.have_grouping===false){ - - - columns.some((item,key)=> { - if (item.title === "分组") { - columns.splice(key, 1) - return true - } - } - ) - - } - - - return( - - -
    - - - {taskslistdata&&taskslistdata.have_grouping===true|| - taskslistdata&&taskslistdata.have_project===true|| - taskslistdata&&taskslistdata.cross_comment===true?:""} - {/*提示*/} - - - {/*立即发布*/} - this.getcourse_groupslist(id)} - /> - - - - {Allocationtype===true?this.saveAllocationModal(value)} - closable={false} - footer={null} - destroyOnClose={true} - centered={true} - />:""} - - {Modulationtype===true?this.saveModulationModal(value,num)} - closable={false} - footer={null} - destroyOnClose={true} - centered={true} - />:""} - - {/*关联项目*/} - {visibles===true? - this.Cancel()} - taskid={taskslistdata&&taskslistdata.task_id} - funlist={()=>this.searchValue()} - /> - :""} - - {this.state.avisible===true?:""} - - - - { taskslistdata && taskslistdata ? - // 教师列表 - this.props.isAdmin() ? -
    -
    - {this.props.questionslist&&this.props.questionslist.status===0?"":
      - -
    • - 教师评阅: - - - 全部 - - this.funteachercomment(e,taskslistdata.search_assistants&&taskslistdata.search_assistants.teacher_comment.length)} style={{ paddingTop: '4px'}}> - {taskslistdata.search_assistants && taskslistdata.search_assistants.teacher_comment && taskslistdata.search_assistants.teacher_comment.map((item,key)=>{ - return( - - {item.name} - ({item.count}) - - - ) - })} - -
      - -
      - -
    • - - -
    • - 作品状态: - - - this.funtaskstatus([])}>全部 - - - this.funtaskstatus(e,taskslistdata.search_assistants&&taskslistdata.search_assistants.task_status.length)} style={{ paddingTop: '4px'}}> - {taskslistdata.search_assistants&&taskslistdata.search_assistants.task_status.map((item,key)=>{ - return( - - {item.name} - ({item.count}) - - - ) - })} - - - -
    • - - - {taskslistdata.search_assistants&&taskslistdata.search_assistants.course_group_info.length!=0?
    • - 分班情况: - -
      - this.groupgroup(e,taskslistdata.search_assistants&&taskslistdata.search_assistants.course_group_info.length)} style={{width: '1000px', paddingTop: '4px'}}> - - - {taskslistdata.search_assistants&&taskslistdata.search_assistants.course_group_info.map((item,key)=>{ - return( - - {item.group_group_name} - ({item.count}) - - - ) - })} - -
      - -
    • :""} - - - - {taskslistdata.search_assistants&&taskslistdata.search_assistants.cross_comment.length===0?"":
    • - 交叉评阅: - - - 全部 - - - {taskslistdata.search_assistants&&taskslistdata.search_assistants.cross_comment.map((item,key)=>{ - return( - - {item.name} - ({item.count}) - - - ) - })} - -
    • } - -
    } - - {this.props.questionslist&&this.props.questionslist.status===0?"":
    - -
    - {this.props.isAdmin()===true? - {taskslistdata&&taskslistdata.work_count} - 个检索结果({taskslistdata&&taskslistdata.all_work_count} 学生):""} - -
    - - {this.props.isStudent()===true? -
    - - {taskslistdata&&taskslistdata.commit_count} - 已交 - - {taskslistdata&&taskslistdata.uncommit_count} - 未交 - {taskslistdata&&taskslistdata.left_time.status===null?"": - - {taskslistdata&&taskslistdata.left_time.status} : - - {taskslistdata&&taskslistdata.left_time.time} - - } -
    - :""} - -
    } - - { - JSON.stringify(data)==="[]" ? - - : -
    - -
    - {data===undefined?"":} - - - } - - - { - taskslistdata && taskslistdata.work_count && taskslistdata.work_count > limit ? -
    - -
    - : "" - } - - : - // 学生列表 - this.props.isStudent()||this.props.isNotMember()? - -
    - -
    - - {this.props.isNotMember()?
      - -
    • - 教师评阅: - - - 全部 - - - this.funteachercomment(e,taskslistdata.search_assistants&&taskslistdata.search_assistants.teacher_comment.length)} style={{ paddingTop: '4px'}}> - {taskslistdata.search_assistants&&taskslistdata.search_assistants.teacher_comment.map((item,key)=>{ - return( - - {item.name} - ({item.count}) - - - ) - })} - - -
      - -
      - -
    • - - -
    • - 作品状态: - - - this.funtaskstatus([])}>全部 - - - this.funtaskstatus(e,taskslistdata.search_assistants&&taskslistdata.search_assistants.task_status.length)} style={{ paddingTop: '4px'}}> - {taskslistdata.search_assistants&&taskslistdata.search_assistants.task_status.map((item,key)=>{ - return( - - {item.name} - ({item.count}) - - - ) - })} - - - -
    • - - - {taskslistdata.search_assistants&&taskslistdata.search_assistants.course_group_info.length!=0?
    • - 分班情况: - - - this.groupgroup([])}>全部 - - - this.groupgroup(e,taskslistdata.search_assistants&&taskslistdata.search_assistants.course_group_info.length)} style={{ paddingTop: '4px'}}> - {taskslistdata.search_assistants&&taskslistdata.search_assistants.course_group_info.map((item,key)=>{ - return( - - {item.group_group_name} - ({item.count}) - - - ) - })} - -
    • :""} - - - - {taskslistdata.search_assistants&&taskslistdata.search_assistants.cross_comment.length===0?"":
    • - 交叉评阅: - - - 全部 - - - {taskslistdata.search_assistants&&taskslistdata.search_assistants.cross_comment.map((item,key)=>{ - return( - - {item.name} - ({item.count}) - - - ) - })} - -
    • } - -
    :""} - - -
    - {this.props.isStudent()===true? -
    - - {taskslistdata&&taskslistdata.commit_count} - 已交 - - {taskslistdata&&taskslistdata.uncommit_count} - 未交 - {taskslistdata&&taskslistdata.left_time.status===null?"": - - {taskslistdata&&taskslistdata.left_time.status} : - - {taskslistdata&&taskslistdata.left_time.time} - - } -
    - :""} -
    - { - JSON.stringify(data) === "[]" ? - -
    -
    -
    - -

    暂时还没有相关数据哦!

    -
    -
    - -
    - : - -
    - -
    - {data === undefined ? "" :
    } - - - - } - - { - taskslistdata && taskslistdata.work_count && taskslistdata.work_count > limit ? -
    - -
    - : "" - } - - :"" - :""} - - - - - - - ) - } -} - -export default GraduationTaskssettinglist; diff --git a/src/modules/courses/graduation/tasks/GraduationTaskssettingquestions.js b/src/modules/courses/graduation/tasks/GraduationTaskssettingquestions.js deleted file mode 100644 index 221d5137..00000000 --- a/src/modules/courses/graduation/tasks/GraduationTaskssettingquestions.js +++ /dev/null @@ -1,400 +0,0 @@ -import React,{Component} from "react"; -import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal, Table, Divider, Tag} from "antd"; -import {Link} from 'react-router-dom'; -import { getRandomcode,markdownToHTML,AttachmentList} from 'educoder'; -import axios from 'axios'; -import Modals from '../../../modals/Modals'; -import DownloadMessageysl from "../../../modals/DownloadMessageysl"; -import HomeworkModal from "../../coursesPublic/HomeworkModal"; -import CoursesListType from '../../coursesPublic/CoursesListType'; -import moment from 'moment'; -import GraduationTaskssettingReply from './GraduationTaskssettingReply'; - -let GraduationTasksnewtype=true; - - -class GraduationTasksquestions extends Component{ - - constructor(props){ - super(props) - this.state={ - coursename:"", - coursesearch:"", - title_num:20, - title_value:"", - fileList: [], - contents: [{val:"",id:1}], - type:true, - questionslist:undefined, - DownloadType:false, - DownloadMessageval:undefined, - } - } - - componentDidMount(){ - let tab = this.props.tab; - this.props.setTab && this.props.setTab(tab); - - this.getdatas(); - try{ - this.props.triggerRef(this) - }catch(e){ - - } - } - - reInit=()=>{ - this.getdatas(); - } - - getdatas=()=>{ - const task_Id = this.props.match.params.task_Id; - let url="/graduation_tasks/"+task_Id+".json"; - - axios.get(url).then((result)=>{ - if(result.status===200){ - this.setState({ - questionslist:result.data, - end_time:result.data.end_time - }) - this.props.setend_time(result.data.end_time) - } - }).catch((error)=>{ - console.log(error) - }) - } - - goback=()=>{ - // let courseId=this.props.match.params.coursesId; - // let category_id=this.props.match.params.category_id; - // window.location.href="/classrooms/"+courseId+"/graduation_tasks/"+category_id; - // let courseId = this.props.match.params.coursesId; - // if(courseId===undefined){ - // this.props.history.push("/classrooms"); - // }else{ - // this.props.history.push(this.props.current_user.first_category_url); - // } - - // this.props.history.goBack() - this.props.history.replace(`/classrooms/${this.state.questionslist.course_id}/graduation_tasks/${this.state.questionslist.graduation_id}`); - } - - end=()=>{ - // this.homeworkstart() - this.setState({ - modalname:"立即截止", - visible:true, - Topval:"学生将不能再提交作品", - // Botvalleft:"暂不截止", - // Botval:`本操作只对"提交中"的任务有效`, - Cancelname:"暂不截止", - Savesname:"立即截止", - Cancel:this.cancelmodel, - Saves:this.coursetaskend, - typs:"end", - }) - - } - //立即发布 - publish=()=>{ - let starttime= this.props.getNowFormatDates(1,1); - let endtime=this.props.getNowFormatDates(2,1); - // this.homeworkstart() - this.setState({ - modalname:"立即发布", - visible:true, - Topval:"学生将立即收到毕设任务", - // Botvalleft:"点击修改", - // Botval:`本操作只对"未发布"的分班有效`, - starttime:moment(moment(new Date())).format("YYYY-MM-DD HH:mm") , - starttimes:this.props.getNowFormatDates(1), - typs:"start", - endtime:endtime, - Cancelname:"暂不发布", - Savesname:"立即发布", - Cancel:this.cancelmodel, - Saves:this.homepublish, - }) - } - //立即发布 - homeworkstart=()=>{ - let coursesId=this.props.match.params.coursesId; - let url="/courses/"+coursesId+"/all_course_groups.json"; - - axios.get(url).then((response) => { - - if(response.status===200){ - this.setState({ - modaltype:response.data.course_groups===null||response.data.course_groups.length===0?2:1, - course_groups:response.data.course_groups, - }) - } - }).catch((error) => { - console.log(error) - }); - - } - homepublish=(ids,endtime)=>{ - this.cancelmodel(); - let task_Id=this.props.match.params.task_Id; - const cid = this.props.match.params.coursesId - // let url = `/courses/${cid}/graduation_tasks/publish_task.json`; - - let url="/courses/"+cid+"/graduation_tasks/publish_task.json" - axios.post(url,{ - task_ids:[task_Id], - group_ids: this.state.course_groupslist, - end_time:endtime, - }).then((response)=>{ - if (response.data.status == 0) { - this.getdatas() - this.props.showNotification(response.data.message); - this.searchValue(); - - this.setState({ - // Modalstopval:response.data.message, - // ModalSave:this.cancelmodel, - // Loadtype:true, - course_groupslist:[], - checkAllValue:false - }) - } - }).catch((error)=>{ - - }) - } - - cancelmodel=()=>{ - - this.setState({ - Modalstype:false, - Loadtype:false, - visible:false, - Modulationtype:false, - Allocationtype:false, - Modalstopval:"", - ModalCancel:"", - ModalSave:"", - }) - - } - - coursetaskend=()=>{ - this.cancelmodel(); - const coursesId = this.props.match.params.coursesId; - const task_Id = this.props.match.params.task_Id; - - let url = `/courses/${coursesId}/graduation_tasks/end_task.json`; - axios.post(url,{ - task_ids:[task_Id], - group_ids: this.state.course_groupslist, - }).then((response)=>{ - if (response.data.status == 0) { - this.getdatas() - this.props.showNotification(response.data.message); - this.setState({ - // Modalstopval:response.data.message, - // ModalSave:this.cancelmodel, - // Loadtype:true, - course_groupslist:[], - checkAllValue:false - }) - - } - - }).catch((error)=>{ - - }) - } - - getcourse_groupslist=(id)=>{ - this.setState({ - course_groupslist:id - }) - } - - /// 确认是否下载 - confirmysl(url,urls){ - - axios.get(url + '?export=true').then((response) => { - if(response === undefined){ - return - } - if(response.data.status&&response.data.status===-1){ - - }else if(response.data.status&&response.data.status===-2){ - if(response.data.message === "100"){ - // 已超出文件导出的上限数量(100 ),建议: - - this.setState({ - DownloadType:true, - DownloadMessageval:100 - }) - }else { - //因附件资料超过500M - this.setState({ - DownloadType:true, - DownloadMessageval:500 - }) - } - }else { - // this.props.slowDownload(urls) - //this.props.showNotification(`正在下载中`); - this.props.slowDownload(getRandomcode(url)) - // window.open(getRandomcode("/api" + url), '_blank'); - // this.props.showNotification(`正在下载中`); - // window.open("/api"+url, '_blank'); - } - }).catch((error) => { - console.log(error) - }); - } - - Downloadcal=()=> { - this.setState({ - DownloadType: false, - DownloadMessageval: undefined - }) - } - render(){ - - let { Modalstype,Modalstopval,ModalCancel,ModalSave,questionslist} =this.state; - // console.log(this.props) - - let courseId=this.props.match.params.coursesId; - let category_id=this.props.match.params.category_id; - let task_Id=this.props.match.params.task_Id; - - - //console.log(questionslist&&questionslist) - return( - - -
    - {/*提示*/} - - {/*提示*/} - {/**/} - - this.getcourse_groupslist(id)} - /> - {questionslist&&questionslist?
    -
    -
    -

    -

    - - {questionslist&&questionslist? -
    -
    -
    :"" - } - -
    - -
    - - {questionslist&&questionslist.group_info?
    - -
    - 分组要求: - (提交作品时需要关联同组成员,组内成员作品共享) -
    - -
    - 分组人数:{questionslist.group_info.min_number} - {questionslist.group_info.max_number} 人 - {questionslist.group_info.base_on_project===true? - (基于项目,项目管理员角色的成员可以提交作品) - : (非基于项目,任意小组成员可以提交作品)} -
    - - {questionslist.group_info.base_on_project===true?
    - 基于项目实施 - (各小组必须在educoder平台创建项目) -
    :
    不基于项目实施
    } - -
    :""} - -
    - -

    - - - {/*
    */} - {/*{this.clickPraise()}}*/} - {/*>*/} - {/**/} - {/*
    */} - {/*/!*{memo.praise_count}*!/*/} - {/*

    */} - {/*
    */} - -
    - -
    - - - {/*讨论区*/} - -
    - -
    - -
    :""} - -
    - -
    - - ) - } -} - -export default GraduationTasksquestions; - - diff --git a/src/modules/courses/graduation/tasks/Graduationclass.css b/src/modules/courses/graduation/tasks/Graduationclass.css deleted file mode 100644 index 9788284b..00000000 --- a/src/modules/courses/graduation/tasks/Graduationclass.css +++ /dev/null @@ -1,7 +0,0 @@ -.classroomclass{ - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - width: 110px; - display: inline-block; -} \ No newline at end of file diff --git a/src/modules/courses/graduation/tasks/Graduationtaskitem.js b/src/modules/courses/graduation/tasks/Graduationtaskitem.js deleted file mode 100644 index 662369dd..00000000 --- a/src/modules/courses/graduation/tasks/Graduationtaskitem.js +++ /dev/null @@ -1,83 +0,0 @@ -import React,{ Component } from "react"; -import { getImageUrl, markdownToHTML, WordsBtn } from 'educoder'; -import { Tooltip } from 'antd' -const _origin = '' -class Graduationtaskitem extends Component{ - constructor(props){ - super(props); - - } - parseCommentContent = (oldContent) => { - return markdownToHTML(oldContent); - } - renderChildenComments = () => { - - } - render(){ - let { item }=this.props; - const _content = item.content && this.parseCommentContent(item.content) - return( -
    -
    - - 用户头像 - -
    - -
    -
    -
    - - -
    -
    - - {item.username}({item.comment_role}) - - {item.time} - {/* 分数 */} - {item.score != null && item.score >= 0 && {item.score}分} - - { !item.is_invalid && item.delete && - this.props.onDelete(item)}> - - } - {/* 回复 */} - { item.is_invalid ? 失效 : ''} -
    -
    - - {!!_content &&
    -
    -
    -
    -
    -
    } - {!_content && {"暂未写评语"}} - -
    - {(item && item.children && item.children.length) ?
    : ''} - {this.renderChildenComments(item)} - { item.isAllChildrenLoaded != true && item.children && this.props.isChildCommentPagination == true && item.children.length >= 5? - -
    {this.props.loadMoreChildComments && this.props.loadMoreChildComments(item)}}> - -
    -
    - : ''} -
    - {/*mr10 */} -

    - {/* 第二排右侧按钮区域 */} -

    - - -
    -
    -
    -
    - ) - } -} -export default Graduationtaskitem; \ No newline at end of file diff --git a/src/modules/courses/graduation/tasks/TaskPublishModal.js b/src/modules/courses/graduation/tasks/TaskPublishModal.js deleted file mode 100644 index 0a805f37..00000000 --- a/src/modules/courses/graduation/tasks/TaskPublishModal.js +++ /dev/null @@ -1,140 +0,0 @@ -import React,{ Component } from "react"; -import { Input, Checkbox, Menu } from "antd"; - -import CourseLayoutComponent from '../../common/CourseLayoutComponent' -import TitleSearchSection from '../../common/titleSearch/TitleSearchSection' -import ColorCountText from '../../common/titleSearch/ColorCountText' - -import { WordsBtn } from 'educoder' -import axios from 'axios' - -import _ from 'lodash' - -import GraduateTaskItem from './GraduateTaskItem' -import HomeworkModal from "../../coursesPublic/HomeworkModal"; - -import '../../css/members.css' -import '../style.css' -// 毕设任务 立即发布弹框 https://www.trustie.net/issues/19981 -class TaskPublishModal extends Component{ - constructor(props){ - super(props); - this.state = { - modalname:"立即发布", - modaltype:1, - visible: false, - Topval:"本操作只对“未发布”的对象生效", - Botvalleft:"暂不发布", - Botval:"则通过后续手动设置,定时发布", - starttime:"发布时间:2018-07-15 15:33", - endtime:"截止时间:2018-08-15 15:33", - Cancelname:"暂不发布", - Savesname:"立即发布", - Cancel:this.onCancel, - Saves:this.homeworkstartend, - } - } - publish = ()=> { - this.publish1() - } - end = ()=> { - this.end1() - } - //立即发布 - publish1 =()=>{ - this.setState({ - modalname:"立即发布", - modaltype:1, - visible:true, - Topval:"本操作只对“未发布”的对象生效", - Botvalleft:"暂不发布", - Botval:"则通过后续手动设置,定时发布", - starttime:"发布时间:2018-07-15 15:33", - endtime:"截止时间:2018-08-15 15:33", - Cancelname:"暂不发布", - Savesname:"立即发布", - Cancel:this.onCancel, - Saves:this.homeworkstartend, - }) - } - - publish2=()=>{ - this.setState({ - modalname:"立即发布", - modaltype:2, - visible:true, - Topval:"发布设置均可修改,", - Topvalright:"点击修改", - Botval:"此设置将对所有分班生效", - Botvalleft:undefined, - starttime:"发布时间:2018-07-15 15:33", - endtime:"截止时间:2018-08-15 15:33", - Cancelname:"取消", - Savesname:"确定", - Cancel:this.onCancel, - Saves:undefined - }) - } - - //立即截止 - end1=()=>{ - this.setState({ - modalname:"立即截止", - modaltype:3, - visible:true, - Topval:"本操作只对“提交中”的对象生效", - Botvalleft:"暂不截止", - Botval:"则将根据已设置的截止时间,定时截止", - Cancelname:"暂不截止", - Savesname:"立即截止", - Cancel:this.onCancel, - Saves:this.homeworkends, - starttime:undefined, - endtime:undefined, - }) - } - end2=()=>{ - this.setState({ - modalname:"立即截止", - modaltype:4, - visible:true, - Topval:"本操作只对“提交中”的对象生效", - Botvalleft:"暂不截止", - Botval:"则将根据已设置的截止时间,定时截止", - Cancelname:"暂不截止", - Savesname:"立即截止", - Cancel:this.onCancel, - Saves:undefined, - starttime:undefined, - endtime:undefined, - }) - } - setVisible = (visible) => { - this.setState({ visible }) - } - onCancel = () => { - this.setState({ visible: false}) - } - render(){ - - let { modaltype, modalname, visible, Topval, Topvalright, Botvalleft, Botval, starttime, endtime, Cancelname, Savesname, Cancel, Saves } = this.state; - return( - - ) - } -} -export default TaskPublishModal; \ No newline at end of file diff --git a/src/modules/courses/graduation/tasks/index.js b/src/modules/courses/graduation/tasks/index.js deleted file mode 100644 index ef1ff8e5..00000000 --- a/src/modules/courses/graduation/tasks/index.js +++ /dev/null @@ -1,818 +0,0 @@ -import React,{ Component } from "react"; -import { Checkbox, Menu,Pagination,Spin} from "antd"; -import {Link} from 'react-router-dom'; -import Titlesearchsection from '../../common/titleSearch/TitleSearchSection'; -import HomeworkModal from "../../coursesPublic/HomeworkModal"; -import { WordsBtn } from 'educoder'; -import axios from 'axios'; -import moment from 'moment'; -import GraduateTaskItem from './GraduateTaskItem'; -import TaskPublishModal from "./TaskPublishModal"; -import Modals from '../../../modals/Modals'; -import '../../css/members.css'; -import '../style.css'; -import NoneData from "../../coursesPublic/NoneData"; - - -class GraduationTasks extends Component{ - constructor(props){ - super(props); - this.state = { - searchValue: '', - checkAllValue: false, - checkBoxValues: [], - all_count:undefined, - task_count:undefined, - course_identity:undefined, - course_public:undefined, - tasks:[], - page:1, - search:"", - order:null, - selectpage:"", - isSpin:false, - typs:undefined, - starttimes:undefined, - - } - } - fetchAll = (search,page,order,count) => { - - const cid = this.props.match.params.coursesId - - - const url = `/courses/${cid}/graduation_tasks.json` - axios.get(url,{ - params: { - search:search, - page:page, - order:order, - count:count - } - }).then((response)=>{ - // console.log(response) - if(response.status===200){ - this.setState({ - all_count:response.data.all_count, - task_count:response.data.task_count, - course_public:response.data.course_public, - tasks:response.data.tasks, - unpublished_count:response.data.unpublished_count, - published_count:response.data.published_count, - isSpin:false - }) - } - }).catch(function (error) { - this.setState({ - isSpin:false - }) - }); - - } - componentDidMount = () => { - this.setState({ - isSpin:true - }) - this.fetchAll("",1,"",15) - - } - cancelmodel=()=>{ - - this.setState({ - Modalstype:false, - Loadtype:false, - Modalstopval:"", - ModalCancel:"", - ModalSave:"", - }) - - } - - savedelete=()=>{ - this.setState({ - Modalstype:false, - }) - let {checkAllValue,checkBoxValues,search,page,order} = this.state; - // let all_check; - // if(checkAllValue===true){ - // all_check=1 - // }else{ - // all_check=0 - // } - // all_check: all_check - const cid = this.props.match.params.coursesId - const url = `/courses/${cid}/graduation_tasks/multi_destroy.json` - axios.delete(url, { data: { - task_ids: checkBoxValues, - }}) - .then((response) => { - if (response.data.status == 0) { - // {"status":1,"message":"删除成功"} - this.fetchAll(search,page,order) - this.props.showNotification(response.data.message); - this.setState({ - // Modalstype:true, - // Modalstopval:response.data.message, - ModalsBottomval:"", - ModalSave:this.cancelmodel, - Loadtype:true, - checkBoxValues:[], - checkAllValue:false - }) - } - }) - .catch(function (error) { - console.log(error); - }); - - } - - testonSelect=()=>{ - let {checkBoxValues,checkAllValue}=this.state; - - if(checkAllValue===false){ - if(checkBoxValues.length===0||checkAllValue===undefined){ - return true - } - } - - } - - noSelect=()=>{ - // this.setState({ - // Modalstype:true, - // Loadtype:true, - // Modalstopval:"请选择你要操作的任务", - // ModalSave:this.cancelmodel, - // }) - - this.props.showNotification("请选择你要操作的任务"); - } - - - onDelete = () => { - - let selectnum= this.testonSelect(); - if(selectnum===true){ - this.noSelect(); - return - } - - - this.setState({ - Modalstype:true, - Modalstopval:"是否确认删除?", - ModalCancel:this.cancelmodel, - ModalSave:this.savedelete, - }) - - } - ActionPoll = () => { - - let selectnum= this.testonSelect(); - if(selectnum===true){ - this.noSelect(); - return - } - let {search,page,order,count} =this.state; - const cid = this.props.match.params.coursesId - //加入题库 - let url=`/courses/${cid}/graduation_tasks/add_to_bank.json`; - axios.post((url), { - task_ids: this.state.checkBoxValues - }) - .then((result)=>{ - if(result.data.status==0){ - this.setState({ - checkBoxValues:[], - checkAllValue:false - }) - this.fetchAll(search,page,order,15) - this.props.showNotification(`${result.data.message}`); - - } - }).catch((error)=>{ - console.log(error); - }) - } - - saveonOpen=()=>{ - this.setState({ - Modalstype:false, - }) - let {checkAllValue,checkBoxValues,search,page,order} = this.state; - // let all_check; - // if(checkAllValue===true){ - // all_check=1 - // }else{ - // all_check=0 - // } - // all_check: all_check - - const cid = this.props.match.params.coursesId - const url = `/courses/${cid}/graduation_tasks/set_public.json` - axios.post(url, { - task_ids: checkBoxValues, - }) - .then((response) => { - if (response.data.status == 0) { - // {"status":1,"message":"删除成功"} - this.fetchAll(search,page,order) - this.props.showNotification(response.data.message); - this.cancelmodel() - this.setState({ - Modalstype:false, - Modalstopval:response.data.message, - ModalsBottomval:"", - ModalSave:this.cancelmodel, - Loadtype:false, - checkBoxValues:[], - checkAllValue:false - }) - } - }) - .catch(function (error) { - console.log(error); - }); - } - - - onOpen=()=>{ - let selectnum= this.testonSelect(); - if(selectnum===true){ - this.noSelect(); - return - } - - this.setState({ - Modalstype:true, - Modalstopval:"设为公开后,非课堂成员也可以访问查看", - ModalsBottomval:"是否确认设为公开?", - ModalCancel:this.cancelmodel, - ModalSave:this.saveonOpen, - }) - } - - - - - // onSticky = (message) => { - // const cid = this.props.match.params.coursesId - // const url = `/messages/${message.id}/sticky_top.json` - // axios.put(url, { - // course_id: cid, - // }) - // .then((response) => { - // if (response.data.id) { - // // {"status":1,"message":"删除成功"} - // console.log('--- 置顶/取消置顶成功') - // this.fetchAll() - // } - // }) - // .catch(function (error) { - // console.log(error); - // }); - // } - // 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) - // } - - onInputSearchChange = (e) => { - this.setState({ - searchValue:e.target.value, - }) - - if (this.timeoutHandler) { - clearTimeout(this.timeoutHandler) - } - this.timeoutHandler = setTimeout(() => { - this.fetchAll(this.state.searchValue) - }, 1200) - } - - onselectfifteen = () => { - this.setState({ - Modalstype:true, - Modalstopval:"选择条数不能大于15条", - ModalSave:this.cancelmodel, - Loadtype:true - }) - } - onCheckAll = (e) => { - let {tasks,checkBoxValues,page} =this.state; - - this.setState({ - checkAllValue:e.target.checked, - selectpage:page - }) - let checkBoxValuess=[]; - if(e.target.checked===true){ - for (var list of checkBoxValues){ - checkBoxValuess.push(list) - } - for(var value of tasks){ - checkBoxValuess.push(value.task_id) - } - checkBoxValuess=[...new Set(checkBoxValuess)] - if(checkBoxValuess.length>15){ - this.onselectfifteen() - return - } - - this.setState({ - checkBoxValues:checkBoxValuess - }) - }else if(e.target.checked===false){ - this.setState({ - checkBoxValues:checkBoxValuess - }) - } - - } - - onCheckBoxChange=(checkedValues)=>{ - - let {checkBoxValues,checkAllValue,tasks} =this.state; - let type=false; - if(checkBoxValues15||checkedValues.length>15){ - this.onselectfifteen() - return - } - this.setState({ - checkBoxValues: checkedValues, - checkAllValue:type - }) - } - - - PaginationTask=(page)=>{ - - let {search,order,selectpage,checkAllValue,checkBoxValues}=this.state; - let selectpagetype=selectpage===page?true:false - this.setState({ - page:page, - checkAllValue:selectpagetype, - checkBoxValues:[] - }) - - this.fetchAll(search,page,order); - - let checkBoxValueslist=checkBoxValues; - - // if(checkAllValue===true){ - // for(var value of tasks){ - // checkBoxValueslist.push(value.task_id) - // } - // this.setState({ - // checkBoxValues:checkBoxValueslist - // }) - // } - - } - - handleClick = (e) => { - let {search,page}=this.state; - - this.setState({ - order: e.key, - page:1, - isSpin:true, - checkBoxValues:[], - checkAllValue:false - }); - - let newkey=e.key; - if(newkey==="null"){ - newkey="all" - } - - this.fetchAll(search,1,newkey); - } - - onPressEnter = (value) => { - - let {page,order}=this.state; - this.setState({ - search:value, - isSpin:true - }) - this.fetchAll(value,page,order); - - } - - - //立即发布 - publish=()=>{ - - let selectnum= this.testonSelect(); - if(selectnum===true){ - this.noSelect(); - return - } - // this.homeworkstart() - let starttime= this.props.getNowFormatDates(1); - let endtime=this.props.getNowFormatDates(2); - this.setState({ - modalname:"立即发布", - visible:true, - Topval:"学生将立即收到毕设任务", - // Botvalleft:"暂不发布", - Botval:`本操作只对"未发布"的任务有效`, - starttime:"发布时间:"+moment(new Date()).format("YYYY-MM-DD HH:mm"), - starttimes:this.props.getNowFormatDates(1), - typs:"start", - endtime:"截止时间:"+endtime, - Cancelname:"暂不发布", - Savesname:"立即发布", - Cancel:this.publishcanner, - Saves:this.homepublish, - }) - } - - publishcanner=()=>{ - this.setState({ - visible:false, - }) - } - - homepublish=(ids,endtime)=>{ - let {checkAllValue,checkBoxValues} = this.state; - // let all_check; - // if(checkAllValue===true){ - // all_check=1 - // }else{ - // all_check=0 - // } - // all_check:all_check - const cid = this.props.match.params.coursesId - let url = `/courses/${cid}/graduation_tasks/publish_task.json`; - axios.post(url,{ - task_ids:checkBoxValues, - group_ids: this.state.course_groupslist, - end_time:endtime, - }).then((response)=>{ - if (response.data.status == 0) { - this.props.showNotification(`${response.data.message}`); - this.setState({ - // Modalstype:true, - // Modalstopval:response.data.message, - // ModalSave:this.cancelmodel, - // Loadtype:true, - checkBoxValues:[], - checkAllValue:false - }) - this.publishcanner(); - - let {search,page,order} = this.state - this.fetchAll(search,page,order); - } - }).catch((error)=>{ - - }) - } - - - - end=()=>{ - let selectnum= this.testonSelect(); - if(selectnum===true){ - this.noSelect(); - return - } - // this.homeworkstart() - this.setState({ - modalname:"立即截止", - visible:true, - Topval:"学生将不能再提交作品", - // Botvalleft:"暂不截止", - Botval:`本操作只对"提交中"的任务有效`, - Cancelname:"暂不截止", - Savesname:"立即截止", - Cancel:this.publishcanner, - Saves:this.coursetaskend, - typs:"end", - }) - - } - // //毕设因为没有分班列表分班列表 - // homeworkstart=()=>{ - // let coursesId=this.props.match.params.coursesId; - // let url="/courses/"+coursesId+"/all_course_groups.json"; - // - // axios.get(url).then((response) => { - // - // if(response.status===200){ - // this.setState({ - // modaltype:response.data.course_groups===null||response.data.course_groups.length===0?2:1, - // course_groups:response.data.course_groups, - // }) - // } - // }).catch((error) => { - // console.log(error) - // }); - // - // } - coursetaskend=()=>{ - let {checkAllValue,checkBoxValues} = this.state; - // let all_check; - // if(checkAllValue===true){ - // all_check=1 - // }else{ - // all_check=0 - // } - // all_check:all_check - const cid = this.props.match.params.coursesId - let url = `/courses/${cid}/graduation_tasks/end_task.json`; - axios.post(url,{ - task_ids:checkBoxValues, - group_ids: this.state.course_groupslist, - }).then((response)=>{ - if (response.data.status == 0) { - // this.setState({ - // Modalstype:true, - // Modalstopval:response.data.message, - // ModalSave:this.cancelmodel, - // Loadtype:true, - // checkBoxValues:[], - // checkAllValue:false - // }) - // this.publishcanner(); - - this.props.showNotification(`${response.data.message}`); - this.setState({ - // Modalstype:true, - // Modalstopval:response.data.message, - // ModalSave:this.cancelmodel, - // Loadtype:true, - checkBoxValues:[], - checkAllValue:false - }) - this.publishcanner(); - this.useBankSuccess(); - } - }).catch((error)=>{ - - }) - } - // 题库选用成功后刷新页面 - useBankSuccess=(checkBoxValues,object_ids)=>{ - - let {search,page,order,all_count} = this.state; - this.fetchAll(search,page,order,all_count) - - this.setState({ - checkBoxValues:object_ids - }) - - // 立即发布 - this.publish(); - - } - getcourse_groupslist=(id)=>{ - this.setState({ - course_groupslist:id - }) - } - render(){ - - let { searchValue, tasks, checkBoxValues, checkAllValue,all_count,course_public,page, - Modalstype, - Modalstopval, - ModalCancel, - ModalSave, - ModalsBottomval, - Loadtype, - modaltype, - modalname, - visible, - Topval, - Topvalright, - Botvalleft, - Botval, - starttime, - endtime, - Cancelname, - Savesname, - Cancel, - Saves, - course_groups, - search, - order, - task_count - } = this.state; - // this.fetchAll(search,page,order); - const coursesId=this.props.match.params.coursesId; - const category_id=this.props.match.params.Id; - const graduationId=this.props.match.params.graduationId; - // console.log(this.props.isCourseidentity()===isNotMember) - return( - - {/*提示*/} - - - {/*立即发布*/} - this.getcourse_groupslist(id)} - - /> - - - - - - - {/*{this.props.isAdmin() ? this.addDir()}>题库选用:""}*/} - {/*{this.props.isAdmin() ?导出成绩 :""}*/} - {this.props.isAdmin() ? - - 新建 - - : ""} - - {/*题库选用 {this.props.isAdmin() ?this.useBankSuccess(checkBoxValues,object_ids)}>:""}*/} - - - } - - // firstRowMid={ - // - // } - - secondRowLeft={ -
    - 共{all_count}个毕设任务 - 已发布:{this.state.published_count}个 - 未发布:{this.state.unpublished_count}个 -
    - } - - secondRowBotton={ -
    - - 全部 - {this.props.isAdmin()?未发布:""} - 提交中 - 补交中 - 评阅中 - 交叉评阅中 - -
    - } - - onPressEnter={this.onPressEnter} - searchPlaceholder={"请输入名称进行搜索"} - /> - - - {/* - - */} - - {this.props.isAdmin()?all_count===undefined?'' :all_count===0?"":
    -
    - 已选 {checkBoxValues===undefined?0:checkBoxValues.length} 个 (不支持跨页勾选) - -
    -
    :""} - - - - { tasks&&tasks.map((item, index) => { - // console.log(item) - return ( -
    -
    - :""} - // onItemClick={this.onItemClick} - // onSticky={this.onSticky} - funlist={()=>this.fetchAll(search,page,order)} - coursename={this.props.coursedata&&this.props.coursedata.name} - graduationId={this.props.match.params.graduationId} - taskid={item.task_id} - coursesId={this.props.match.params.coursesId} - categoryid={this.props.match.params.Id} - workid={item.work_id} - index={index} - > -
    -
    - ) - - }) - } -
    -
    - - { - task_count > 15 && -
    - -
    - } - - - { - tasks===undefined?'' :tasks.length===0? :"" - } -
    - -
    - - - ) - } -} -export default GraduationTasks; - -{/*
    */} - {/*
    */} - {/**/} - {/*

    暂时还没有相关数据哦!

    */} -{/*
    */} diff --git a/src/modules/courses/graduation/topics/ChooseGraduateTopicModal.js b/src/modules/courses/graduation/topics/ChooseGraduateTopicModal.js deleted file mode 100644 index 3a3d129b..00000000 --- a/src/modules/courses/graduation/topics/ChooseGraduateTopicModal.js +++ /dev/null @@ -1,89 +0,0 @@ -import React,{ Component } from "react"; -import { Input, Checkbox} from "antd"; -import ModalWrapper from '../../common/ModalWrapper' -const Search = Input.Search -// 题库选用弹框 https://www.trustie.net/issues/19980 -class ChooseGraduateTopicModal extends Component{ - constructor(props){ - super(props); - this.state={ - - } - } - - setVisible = (visible) => { - this.refs.modalWrapper.setVisible(visible) - } - - //切换tab - changeNav=(index)=>{ - this.setState({ - nav_my:index - }) - } - onOk = () => { - this.refs.modalWrapper.setVisible(false) - } - render() { - let {flag,nav_my}=this.state - let {workType}=this.props; - return( - - - -
    - - -
    -

    - 选用对象:你在课堂{"毕设选题"}列表中已“加入题库” - 的选题 -

    -
    -
    -

    - - - 数据库原理数据库原理 - { - nav_my===2 && - 胡莎莎胡莎莎 - } -

    -
    -
    -
    -
    - ) - } -} -export default ChooseGraduateTopicModal; \ No newline at end of file diff --git a/src/modules/courses/graduation/topics/GraduateTopicDetail.js b/src/modules/courses/graduation/topics/GraduateTopicDetail.js deleted file mode 100644 index 50368fe9..00000000 --- a/src/modules/courses/graduation/topics/GraduateTopicDetail.js +++ /dev/null @@ -1,164 +0,0 @@ -import React,{ Component } from "react"; -import { Input, Checkbox, Menu, Pagination,Table } from "antd"; - -import '../../css/members.css' -import '../../css/busyWork.css' -import '../style.css' - -import { WordsBtn } from 'educoder' -import NoneData from '../../coursesPublic/NoneData' -import axios from 'axios' -import DetailTable from './GraduateTopicDetailTable' -import DetailInfo from './GraduateTopicDetailInfo' -import CoursesListType from '../../coursesPublic/CoursesListType'; - - - -class GraduateTopicDetail extends Component{ - constructor(props){ - super(props); - this.state={ - tableData:[], - tablePage:1, - tablePageSize:15, - tab:1 - } - } - - componentDidMount(){ - let{tablePage}=this.state; - this.getDetailList(tablePage); - } - // 获取详情列表 - getDetailList=(page)=>{ - let course_id=this.props.match.params.course_id; - let graduation_topic_id=this.props.match.params.graduation_topic_id; - - let{tablePageSize}=this.state; - let url=`/courses/${course_id}/graduation_topics/${graduation_topic_id}.json?page=`+page+`&limit=`+tablePageSize; - - axios.get(url).then((result)=>{ - if(result.status==200){ - this.setState({ - tableData:result.data - }) - } - }).catch((error)=>{ - console.log(error); - }) - } - //详情列表翻页 - changeTablePag=(pageNumber)=>{ - this.setState({ - tablePage:pageNumber - }) - this.getDetailList(pageNumber); - } - - // 切换tab - onChangeStatus=(e)=>{ - this.setState({ - tab:e.key - }) - } - - actionTopic=()=>{ - let graduation_topic_id=this.props.match.params.graduation_topic_id; - let course_id=this.props.match.params.course_id; - let {tableData}=this.state; - - this.props.confirm({ - content: tableData.user_selected_topic==0?`是否确认取消选题?`:"是否确认选题?", - onOk: () => { - let url="/courses/"+course_id+"/graduation_topics/"+graduation_topic_id+"/" - if(tableData.user_selected_topic==0){ - url+="student_cancel_topic.json" - }else if(tableData.user_selected_topic==null || tableData.user_selected_topic==2){ - url+="student_select_topic.json" - } - axios.post((url)).then((result)=>{ - // console.log(result); - if(result.data.status == 0){ - this.getDetailList(); - this.props.showNotification(`${result.data.message}`); - } - }).catch((error)=>{ - console.log(error); - }) - } - }) - } - - render(){ - let { - tableData, - tablePage, - tablePageSize, - tab, - }=this.state - const { current_user } = this.props - let {course_id,graduation_topic_id}=this.props.match.params; - const isStudent =this.props.isStudent(); - const isAdmin =this.props.isAdmin(); - document.title=tableData && tableData.course_name; - return( -
    -
    -

    - {tableData && tableData.course_name} - > - {tableData.graduation_name} - > - 选题详情 -

    -

    - {tableData && tableData.graduation_topic_name} - - 返回 -

    -
    -
    -
    - - 选题列表 - 选题描述 - -
    - {/* null: 未选题 0:待确认 1:已同意 2:已拒绝 */} - { - isStudent && tableData.user_selected == false && (tableData.user_selected_topic==null || tableData.user_selected_topic==2) && - 选题 - } - { - isStudent && tableData.user_selected == true && tableData.user_selected_topic==0 && - 取消选题 - } - { - isAdmin && 编辑 - } -
    - { - tab && tab==1&& -
    -
    - -
    - { - tableData && tableData.users_count>tablePageSize && -
    - -
    - } -
    - } - { - tab && tab==2&& - - } -
    -
    -
    - ) - } -} -export default GraduateTopicDetail; diff --git a/src/modules/courses/graduation/topics/GraduateTopicDetailInfo.js b/src/modules/courses/graduation/topics/GraduateTopicDetailInfo.js deleted file mode 100644 index 033033c4..00000000 --- a/src/modules/courses/graduation/topics/GraduateTopicDetailInfo.js +++ /dev/null @@ -1,130 +0,0 @@ -import React,{ Component } from "react"; - -import '../../css/members.css' -import '../../css/busyWork.css' -import '../style.css' -import axios from "axios"; -import GraduateTopicReply from './GraduateTopicReply' - -import { ConditionToolTip , MarkdownToHtml , AttachmentList } from 'educoder' - -const $=window.$; -const type={1: "设计",2: "论文", 3: "创作"} -const source={1: "生产/社会实际", 2:"结合科研", 3: "其它"} -const first={1:'真题', 2:'模拟题'} -const second={1:'纵向课题', 2:'横向课题', 3: "自选"} -const repeat={1:'新题',2:"往届题,有新要求",3:'往届题,无新要求'} -class GraduateTopicDetailTable extends Component{ - constructor(props){ - super(props); - this.state={ - topicInfo:undefined - } - } - componentDidMount=()=>{ - let course_id=this.props.match.params.course_id; - let graduation_topic_id=this.props.match.params.graduation_topic_id; - - let url=`/courses/${course_id}/graduation_topics/${graduation_topic_id}/show_detail.json`; - axios.get(url).then((result)=>{ - if(result.status==200){ - this.setState({ - topicInfo:result.data - }) - } - }).catch((error)=>{ - console.log(error); - }) - } - render(){ - let{topicInfo}=this.state - console.log(topicInfo) - let course_id=this.props.match.params.course_id; - let graduation_topic_id=this.props.match.params.graduation_topic_id; - - return( -
    - -
    -
    -
    - { - topicInfo && topicInfo.description!="" && - - } -
    - { - topicInfo && topicInfo.attachment_list.length>0 && -
    - {/* { - topicInfo.attachment_list.map((item,key)=>{ - return( - -
  • - - 30 }> - {item.title} - - {item.filesize} -
  • - ) - }) - } */} - -
    - } -
    -
    - { - topicInfo && -

    - - 课题类型: - {topicInfo.topic_type ? type[`${topicInfo.topic_type}`] :"--"} - - - 课题来源: - {topicInfo.topic_source ? source[`${topicInfo.topic_source}`] :"--"} - - - 课题性质1: - {topicInfo.topic_property_first ? first[`${topicInfo.topic_property_first}`] :"--"} - - - 课题性质2: - {topicInfo.topic_property_second ? second[`${topicInfo.topic_property_second}`] :"--"} - -

    - } - { - topicInfo && -

    - - 课题重复情况: - {topicInfo.topic_repeat ? repeat[`${topicInfo.topic_repeat}`] :"--"} - - - 调研或实习地点: - {topicInfo.city || "--"} - - - 课题来源单位: - {topicInfo.source_unit || "--"} - -

    - } -
    -
    - -
    - -
    -
    - ) - } -} -export default GraduateTopicDetailTable; \ No newline at end of file diff --git a/src/modules/courses/graduation/topics/GraduateTopicDetailTable.js b/src/modules/courses/graduation/topics/GraduateTopicDetailTable.js deleted file mode 100644 index 07e2b61b..00000000 --- a/src/modules/courses/graduation/topics/GraduateTopicDetailTable.js +++ /dev/null @@ -1,306 +0,0 @@ -import React,{ Component } from "react"; - -import '../../css/members.css' -import '../../css/busyWork.css' -import '../style.css' - -import { WordsBtn } from 'educoder' -import NoneData from '../../coursesPublic/NoneData' -import Modals from "../../../modals/Modals" -import axios from 'axios' -import { Modal,Select,Input } from "antd"; - -const Option = Select.Option -class GraduateTopicDetailTable extends Component{ - constructor(props){ - super(props); - this.state={ - modalsType:false, - modalsTopval:'', - operationId:undefined, - agreeFlag:false, - classesId:undefined, - agreeCheck:false, - visible:false, - un_addClass:undefined, - un_addClass_notice:"", - un_choose_notice:"" - } - } - // 拒绝 - aboutTopic=(id)=>{ - this.setState({ - modalsType:true, - modalsTopval:'是否确认拒绝学生选题?', - operationId:id - }) - } - cancelAboutTopic=()=>{ - this.setState({ - modalsType:false, - modalsTopval:'' - }) - } - sureAboutTopic=()=>{ - let{operationId}=this.state - let courseId=this.props.match.params.course_id; - let graduation_topic_id=this.props.match.params.graduation_topic_id; - let url =`/courses/${courseId}/graduation_topics/${graduation_topic_id}/refuse_student_topic.json?student_graduation_topic=`+operationId; - axios.post(url).then((result)=>{ - if(result.data.status==0){ - this.props.showNotification(`${result.data.message}`); - this.setState({ - modalsType:false, - modalsTopval:'' - }) - //成功后调用列表接口,刷新 - this.props.getDetailList(this.props.page); - } - }).catch((error)=>{ - console.log(error); - }) - this.setState({ - modalsType:false, - modalsTopval:'' - }) - } - - //同意 - agreeTopic=(id)=>{ - this.setState({ - agreeFlag:true, - operationId:id - }) - } - hideAgreeTopic=()=>{ - this.setState({ - agreeFlag:false, - classesId:undefined - }) - } - sureAgreeTopic=(count)=>{ - let{tableData}=this.props; - let{operationId,classesId}=this.state - let courseId=this.props.match.params.course_id; - - if(classesId!=undefined){ - let name=tableData.group_list.filter(item=>item.group_id==classesId)[0].group_name; - this.agreeChoose(courseId,operationId,classesId,name); - }else{ - this.agreeChoose(courseId,operationId,classesId); - } - } - - agreeChoose=(courseId,operationId,classesId,courseName)=>{ - let graduation_topic_id=this.props.match.params.graduation_topic_id; - let url =`/courses/${courseId}/graduation_topics/${graduation_topic_id}/accept_student_topic.json`; - axios.post(url,{ - student_graduation_topic_id:operationId, - group_id:classesId, - course_group_name:courseName - }).then((result)=>{ - if(result.data.status==0){ - this.props.showNotification(`${result.data.message}`); - this.setState({ - agreeFlag:false, - agreeCheck:true, - visible:false - }) - //成功后调用列表接口,刷新 - this.props.getDetailList(this.props.page); - } - }).catch((error)=>{ - console.log(error); - }) - } - - //切换分班 - changeClasses=(value)=>{ - this.setState({ - classesId:value - }) - } - - //新增分班 - topicAddClasses=()=>{ - this.setState({ - visible:true, - agreeFlag:false - }) - } - hideClasses=()=>{ - this.setState({ - visible:false, - classesId:undefined - }) - } - - //新建分班--输入分班 - inputClasses=(e)=>{ - this.setState({ - un_addClass:e.target.value - }) - } - - // 新建分班---确定 - sureAddClass=()=>{ - let {un_addClass}=this.state; - if(!un_addClass){ - this.setState({ - un_addClass_notice:"请输入分班名称" - }) - return; - } - - let{operationId}=this.state - let courseId=this.props.match.params.course_id; - this.agreeChoose(courseId,operationId,-1,un_addClass); - } - - render(){ - let {page,tableData}=this.props - let { modalsType,modalsTopval,agreeFlag,classesId,visible - ,un_addClass_notice - ,un_addClass, - un_choose_notice - } = this.state - const isAdmin =this.props.isAdmin(); - const isStudent =this.props.isStudent(); - const isNotMember=this.props.isNotMember(); - console.log(un_addClass_notice) - return( -
    -
    -
    - 序号 - 姓名 - {isNotMember ?"" :学号} - 分班 - 选题时间 - 操作 - { - isAdmin && - 确认结果 - } - -
    - {/* 拒绝弹框 */} - - {/* 同意弹框 */} - -
    -

    确认同意学生的选题,将学生加入我的分班

    - { tableData.group_list && tableData.group_list.length===0?"":
    - 选择: -
    - -

    {un_choose_notice}

    -
    -
    } - -
    -
    - -
    -
    - 分班: -
    - -

    - {un_addClass_notice} -

    -
    -
    -
    - 取消 - 确定 -
    -
    -
    -
    - { - tableData.users_list && tableData.users_list.length > 0 && tableData.users_list.map((item,key)=>{ - return( -
  • - {parseInt(key+1)+(parseInt(page-1)*15)} - {item.student_name} - {isNotMember ?"" :{item.student_id}} - {item.class_group_name || "--"} - {item.selected_time} - { - isAdmin && - - { - item.result == "待确认" ? - - this.aboutTopic(`${item.id}`)}>拒绝 - this.agreeTopic(`${item.id}`)}>同意 - : - ( - item.result === "已拒绝" ? -- - : - this.aboutTopic(`${item.id}`)}>拒绝 - ) - } - - } - { - isStudent && - {item.result} - } - { - isAdmin && - {item.result=== "待确认"?"--":item.result} - } - { - isNotMember && -- - } - -
  • - ) - }) - } - { - tableData.users_list && tableData.users_list.length == 0 && - } -
    -
    -
    - ) - } -} -export default GraduateTopicDetailTable; \ No newline at end of file diff --git a/src/modules/courses/graduation/topics/GraduateTopicItem.js b/src/modules/courses/graduation/topics/GraduateTopicItem.js deleted file mode 100644 index 551f7f58..00000000 --- a/src/modules/courses/graduation/topics/GraduateTopicItem.js +++ /dev/null @@ -1,157 +0,0 @@ -import React,{ Component } from "react"; -import CoursesListType from '../../coursesPublic/CoursesListType'; - -import { WordsBtn } from 'educoder' -import {Tooltip} from 'antd' -import axios from 'axios' - -const map={0:"待选中",1:"待确认",2:"已确认"} -class GraduateTopicItem extends Component{ - constructor(props){ - super(props); - } - editTopic=(topicId)=>{ - let courseId=this.props.match.params.coursesId; - this.props.history.push(`/classrooms/${courseId}/graduation_topics/${topicId}/edit`); - } - toDetailPage=(topicId)=>{ - - if(this.props.checkIfLogin()===false){ - this.props.showLoginDialog() - return - } - // if(this.props.checkIfProfileCompleted()===false){ - // this.setState({ - // AccountProfiletype:true - // }) - // return - // } - // if(this.props.checkIfProfessionalCertification()===false){ - // this.props.showProfileCompleteDialog() - // return - // } - - let courseId=this.props.match.params.coursesId; - this.props.history.push(`/classrooms/${courseId}/graduation_topics/${topicId}/detail`); - } - render(){ - const { checkBox, discussMessage, index,chooseTopic, - data, - courseId - } = this.props; - - const isAdmin = this.props.isAdmin(); - const isStudent=this.props.isStudent(); - const isNotMember=this.props.isNotMember(); - if (!discussMessage || !discussMessage.author) { - return ''; - } - return( -
    - - -
    window.$(`.topicItem${index} input`).click() }> - - { isAdmin ? {checkBox} : ""} -
    - -
    - { - isNotMember? - discussMessage.private_icon===true?{discussMessage.name}: - {discussMessage.name} - :"" - } - { - isStudent? this.toDetailPage(`${discussMessage.id}`)} - className="fl mt3 font-16 font-bd color-dark maxwidth580" title={discussMessage.name}>{discussMessage.name}:"" - } - { - isAdmin? this.toDetailPage(`${discussMessage.id}`)} className="fl mt3 font-16 font-bd color-dark maxwidth580" title={discussMessage.name}>{discussMessage.name}:"" - } - { - discussMessage.private_icon===true? - - - - :"" - } - -
    - -
    -

    - - - {discussMessage.author} - - - {discussMessage.selected_count} 已选 - {discussMessage.confirmation_count} 已确认 - - { - isStudent? this.toDetailPage(`${discussMessage.id}`)} - className="font-16 mr20" >查看详情:"" - } - { - isAdmin? this.toDetailPage(`${discussMessage.id}`)} className="font-16 mr20" >查看详情:"" - } - - { - isAdmin && this.editTopic(`${discussMessage.id}`)} 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 mr20"> - 取消选题 - - } - { - 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 mr20"> - 选题 - - } - - - -

    -
    -
    -
    - ) - } -} -export default GraduateTopicItem; diff --git a/src/modules/courses/graduation/topics/GraduateTopicNew.js b/src/modules/courses/graduation/topics/GraduateTopicNew.js deleted file mode 100644 index 433007c6..00000000 --- a/src/modules/courses/graduation/topics/GraduateTopicNew.js +++ /dev/null @@ -1,635 +0,0 @@ -import React,{ Component } from "react"; - -import { - Form, Input, InputNumber, Switch, Radio, - Slider, Button, Upload, Icon, Rate, Checkbox, message, - Row, Col, Select, Modal,Cascader -} from 'antd'; -import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor'; -import axios from 'axios' -import {getUrl} from 'educoder'; -import "../../common/formCommon.css" -import '../style.css' -import '../../css/Courses.css' -import { WordsBtn, City , getUploadActionUrl } from 'educoder' - -import {Link} from 'react-router-dom' -// import City from './City' - -// import './board.css' -// import { RouteHOC } from './common.js' - -const confirm = Modal.confirm; -const $ = window.$ -const { Option } = Select; -const NAME_COUNT=60; -// 新建毕设选题 -// https://lanhuapp.com/web/#/item/project/board/detail?pid=a3bcd4b1-99ce-4e43-8ead-5b8b0a410807&project_id=a3bcd4b1-99ce-4e43-8ead-5b8b0a410807&image_id=c6d9b36f-7701-4035-afdb-62404681108c -class GraduateTopicNew extends Component{ - constructor(props){ - super(props); - - this.mdRef = React.createRef(); - - this.state = { - fileList: [], - boards: [], - teacherList:[], - topic_property_first:[], - topic_property_second:[], - topic_repeat:[], - topic_source:[], - topic_type:[], - attachments:undefined, - addonAfter:0, - left_banner_id:undefined, - course_name:undefined - } - } - // 获取老师列表 - getTeacherList=()=>{ - const cid = this.props.match.params.coursesId - let url=`/courses/${cid}/graduation_topics/new.json`; - axios.get((url)).then((result)=>{ - if(result.status==200){ - this.setState({ - teacherList:result.data.teacher_list, - left_banner_id:result.data.left_banner_id, - course_name:result.data.course_name, - left_banner_name:result.data.left_banner_name, - topic_property_first:result.data.topic_property_first, - topic_property_second:result.data.topic_property_second, - topic_repeat:result.data.topic_repeat, - topic_source:result.data.topic_source, - topic_type:result.data.topic_type - }) - console.log("sdfds"); - console.log(this.props.current_user && this.props.current_user.user_id); - this.props.form.setFieldsValue({ - tea_id:this.props.current_user && this.props.current_user.user_id - }) - } - }).catch((error)=>{ - console.log(error); - }) - } - componentDidMount = () => { - //新建or编辑 - let topicId=this.props.match.params.topicId; - - if(topicId==undefined){ - this.getTeacherList(); - }else{ - this.getEditInfo(); - - } - } - //编辑,信息显示 - getEditInfo=()=>{ - const cid = this.props.match.params.coursesId - let topicId=this.props.match.params.topicId - let url=`/courses/${cid}/graduation_topics/${topicId}/edit.json`; - axios.get((url)).then((result)=>{ - if(result){ - this.setState({ - left_banner_id:result.data.left_banner_id, - course_name:result.data.course_name, - left_banner_name:result.data.left_banner_name, - teacherList:result.data.teacher_list, - topic_property_first:result.data.topic_property_first, - topic_property_second:result.data.topic_property_second, - topic_repeat:result.data.topic_repeat, - topic_source:result.data.topic_source, - topic_type:result.data.topic_type, - attachments:result.data.attachments, - addonAfter:parseInt(result.data.selected_data.name.length) - }) - this.props.form.setFieldsValue({ - tea_id:result.data.selected_data.tea_id, - name:result.data.selected_data.name, - city: [result.data.selected_data.province,result.data.selected_data.city], - topic_type:result.data.selected_data.topic_type || undefined, - topic_source:result.data.selected_data.topic_source || undefined, - topic_property_first:result.data.selected_data.topic_property_first || undefined, - topic_property_second:result.data.selected_data.topic_property_second || undefined, - source_unit:result.data.selected_data.source_unit, - topic_repeat:result.data.selected_data.topic_repeat || undefined - }); - this.mdRef.current.setValue(result.data.selected_data.description) - const _fileList = result.data.attachments.map(item => { - return { - id: item.id, - uid: item.id, - name: item.title, - url: item.url, - status: 'done' - } - }) - this.setState({ fileList: _fileList, cityDefaultValue: [result.data.selected_data.province,result.data.selected_data.city] }) - } - }).catch((error)=>{ - console.log(error); - }) - } - - handleSubmit = (e) => { - e.preventDefault(); - const cid = this.props.match.params.coursesId - const topicId = this.props.match.params.topicId - // console.log(this.props); - - this.props.form.validateFieldsAndScroll((err, values) => { - if (!err) { - console.log('Received values of form: ', values); - if (topicId !=undefined) { - const editTopic = this.editTopic - const editUrl = `/courses/${cid}/graduation_topics/${topicId}.json` - - let attachment_ids = undefined - if (this.state.fileList) { - attachment_ids = this.state.fileList.map(item => { - return item.response ? item.response.id : item.id - }) - } - axios.put(editUrl, { - graduation_topic:{ - ...values, - province: values.city==undefined?"":values.city[0], - city: values.city==undefined?"":values.city[1], - }, - attachment_ids - }).then((response) => { - if (response.status == 200) { - const { id } = response.data; - if (id) { - this.props.showNotification('保存成功!'); - this.props.history.push(`/classrooms/${cid}/graduation_topics/${this.state.left_banner_id}`); - } - } - }).catch(function (error) { - console.log(error); - }); - } else { - const url = `/courses/${cid}/graduation_topics.json` - let attachment_ids = undefined - if (this.state.fileList) { - attachment_ids = this.state.fileList.map(item => { - return item.response.id - }) - } - - axios.post(url, { - graduation_topic:{ - ...values, - province: values.city==undefined?"":values.city[0], - city: values.city==undefined?"":values.city[1], - }, - attachment_ids, - }).then((response) => { - if (response.data) { - const { id } = response.data; - if (id) { - this.props.showNotification('提交成功!'); - this.props.history.push(`/classrooms/${cid}/graduation_topics/${this.state.left_banner_id}`); - } - } - }) - .catch(function (error) { - console.log(error); - }); - } - } else { - $("html").animate({ scrollTop: $('html').scrollTop() - 100 }) - } - }); - } - - // 选择省市 - ChangeCity=(value, selectedOptions)=>{ - console.log(selectedOptions); - } - - // 附件相关 START - handleChange = (info) => { - if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') { - let fileList = info.fileList; - this.setState({ fileList }); - } - } - onAttachmentRemove = (file) => { - - if(!file.percent || file.percent == 100){ - this.props.confirm({ - content: '确定要删除这个附件吗?', - okText: '确定', - cancelText: '取消', - // content: 'Some descriptions', - onOk: () => { - this.deleteAttachment(file) - }, - onCancel() { - console.log('Cancel'); - }, - }); - return false; - } - - } - deleteAttachment = (file) => { - console.log(file); - let id=file.response ==undefined ? file.id : file.response.id - const url = `/attachments/${id}.json` - axios.delete(url, { - }) - .then((response) => { - if (response.data) { - const { status } = response.data; - if (status == 0) { - console.log('--- success') - - this.setState((state) => { - const index = state.fileList.indexOf(file); - const newFileList = state.fileList.slice(); - newFileList.splice(index, 1); - return { - fileList: newFileList, - }; - }); - } - } - }) - .catch(function (error) { - console.log(error); - }); - } - - // 附件相关 ------------ END - - changeTopicName=(e)=>{ - // let num= 60 - parseInt(e.target.value.length); - this.setState({ - addonAfter:e.target.value.length - }) - } - render() { - let { - fileList, - teacherList, - topic_property_first, - topic_property_second, - topic_repeat, - topic_source, - topic_type, - addonAfter, - left_banner_id, - course_name, - left_banner_name - } = this.state; - const { current_user } = this.props - const { getFieldDecorator } = this.props.form; - let{ topicId,coursesId }=this.props.match.params - // console.log(this.props); - - const formItemLayout = { - labelCol: { - xs: { span: 24 }, - // sm: { span: 8 }, - sm: { span: 24 }, - }, - wrapperCol: { - xs: { span: 24 }, - // sm: { span: 16 }, - sm: { span: 24 }, - }, - }; - const uploadProps = { - width: 600, - fileList, - multiple: true, - // https://github.com/ant-design/ant-design/issues/15505 - // showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。 - // showUploadList: false, - action: `${getUploadActionUrl()}`, - onChange: this.handleChange, - onRemove: this.onAttachmentRemove, - beforeUpload: (file) => { - console.log('beforeUpload', file.name); - const isLt150M = file.size / 1024 / 1024 < 150; - if (!isLt150M) { - this.props.showNotification('文件大小必须小于150MB!'); - } - return isLt150M; - }, - }; - // console.log("dfsf"); - // console.log(this.props); - document.title=course_name===undefined?"":course_name; - return( -
    - -
    -

    - {course_name} - > - {left_banner_name} - > - {topicId==undefined?"新建":"编辑"} -

    -
    -

    {topicId==undefined?"新建":"编辑"}毕设选题

    - 返回 -
    - -
    -
    - - {getFieldDecorator('tea_id', { - rules: [{ - required: true, message: '请选择指导老师' - }], - })( - - )} - - - - {getFieldDecorator('name', { - rules: [{ - required: true, message: '请输入选题名称', - }, { - max: 60, message: '最大限制为60个字符', - }], - })( - - )} - -
    - - - -
    - - - {getFieldDecorator('description', { - rules: [{ - required: true, message: '请输入选题简介', - }, { - max: 5000, message: '最大限制为5000个字符', - }], - })( - - )} - - - { - getFieldDecorator('file',{ - rules:[{ - required:false - }] - })( - - - (单个文件150M以内) - - ) - } - -
    - - {getFieldDecorator('topic_type', { - rules: [{ - required: false, message: '', - }], - })( - - )} - - - {getFieldDecorator('topic_source', { - rules: [{ - required: false, message: '', - }], - })( - - )} - - - {getFieldDecorator('topic_property_first', { - rules: [{ - required: false, message: '', - }], - })( - - )} - - - {getFieldDecorator('topic_property_second', { - rules: [{ - required: false, message: '', - }], - })( - - )} - -
    -
    - - - - - -
    - - {getFieldDecorator('source_unit', { - rules: [{ - required: false, message: '', - }], - })( - - )} - - - {getFieldDecorator('topic_repeat', { - rules: [{ - required: false, message: '', - }], - })( - - )} - - - {getFieldDecorator('city', { - rules: [{ - initialValue: this.state.cityDefaultValue, - type: 'array', - required: false, message: '', - }], - })( - - )} - -
    - - -
    - - this.props.history.goBack()}>取消 -
    -
    - -
    -
    - ) - } -} - -const WrappedGraduateTopicNew = Form.create({ name: 'topicPostWorksNew' })(GraduateTopicNew); -// RouteHOC() -export default (WrappedGraduateTopicNew); diff --git a/src/modules/courses/graduation/topics/GraduateTopicNewFrom.js b/src/modules/courses/graduation/topics/GraduateTopicNewFrom.js deleted file mode 100644 index 1a860922..00000000 --- a/src/modules/courses/graduation/topics/GraduateTopicNewFrom.js +++ /dev/null @@ -1,520 +0,0 @@ -import React,{ Component } from "react"; - -import { - Form, Input, Button, Upload, Icon , message, Select -} from 'antd'; -import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor'; -import axios from 'axios' -import { City , getUploadActionUrl , appendFileSizeToUploadFileAll } from 'educoder'; -const $ = window.$; -const NAME_COUNT=60; -const { Option} = Select; -class GraduateTopicNewForm extends Component{ - constructor(props){ - super(props); - - this.mdRef = React.createRef(); - - this.state = { - fileList: [], - teacherList:[], - topic_property_first:[], - topic_property_second:[], - topic_repeat:[], - topic_source:[], - topic_type:[], - addonAfter:0, - cityDefaultValue:undefined - } - } - // init编辑信息 - initValue=(result)=>{ - this.setState({ - teacherList:result.data.teacher_list, - topic_property_first:result.data.topic_property_first, - topic_property_second:result.data.topic_property_second, - topic_repeat:result.data.topic_repeat, - topic_source:result.data.topic_source, - topic_type:result.data.topic_type, - addonAfter:parseInt(result.data.selected_data.name.length) - }) - this.props.form.setFieldsValue({ - tea_id:result.data.selected_data.tea_id, - name:result.data.selected_data.name, - city: [result.data.selected_data.province,result.data.selected_data.city], - topic_type:result.data.selected_data.topic_type || undefined, - topic_source:result.data.selected_data.topic_source || undefined, - topic_property_first:result.data.selected_data.topic_property_first || undefined, - topic_property_second:result.data.selected_data.topic_property_second || undefined, - source_unit:result.data.selected_data.source_unit, - topic_repeat:result.data.selected_data.topic_repeat || undefined - }); - this.mdRef.current.setValue(result.data.selected_data.description) - const _fileList = result.data.attachments.map(item => { - return { - id: item.id, - uid: item.id, - name: item.title, - url: item.url, - status: 'done' - } - }) - this.setState({ fileList: _fileList, cityDefaultValue: [result.data.selected_data.province,result.data.selected_data.city] }) - } - //init新建信息 - initNewInfo=(result)=>{ - this.setState({ - teacherList:result.data.teacher_list, - topic_property_first:result.data.topic_property_first, - topic_property_second:result.data.topic_property_second, - topic_repeat:result.data.topic_repeat, - topic_source:result.data.topic_source, - topic_type:result.data.topic_type - }) - - this.props.form.setFieldsValue({ - tea_id:this.props.current_user && this.props.current_user.user_id - }) - } - - // 附件相关 START - handleChange = (info) => { - if (info.file.status === 'done' || info.file.status === 'uploading') { - let contentFileList = info.fileList; - // this.setState({ fileList: appendFileSizeToUploadFileAll(contentFileList)}); - // let list = appendFileSizeToUploadFileAll(contentFileList); - // let arr = list.map(item=>{ - // return ( item.response && item.response.id ) - // }) - this.setState({ - fileList:contentFileList - }); - } - } - onAttachmentRemove = (file) => { - this.props.confirm({ - content: '确定要删除这个附件吗?', - onOk: () => { - this.deleteAttachment(file) - }, - onCancel() { - console.log('Cancel'); - }, - }); - return false; - } - deleteAttachment = (file) => { - console.log(file); - let id=file.response ==undefined ? file.id : file.response.id - const url = `/attachments/${id}.json` - axios.delete(url).then((response) => { - if (response.data) { - const { status } = response.data; - if (status == 0) { - console.log('--- success') - - this.setState((state) => { - const index = state.fileList.indexOf(file); - const newFileList = state.fileList.slice(); - newFileList.splice(index, 1); - return { - fileList: newFileList, - }; - }); - } - } - }) - .catch(function (error) { - console.log(error); - }); - } - - changeTopicName=(e)=>{ - // let num= 60 - parseInt(e.target.value.length); - this.setState({ - addonAfter:e.target.value.length - }) - } - - - handleSubmit = (e) => { - e.preventDefault(); - const topicId = this.props.topicId - this.props.form.validateFieldsAndScroll((err, values) => { - if (!err) { - if (topicId !=undefined) { - // 编辑 - // const editTopic = this.editTopic - let attachment_ids = undefined - if (this.state.fileList) { - attachment_ids = this.state.fileList.map(item => { - return item.response ? item.response.id : item.id - }) - } - const param = { - ...values, - province: values.city==undefined?"":values.city[0], - city: values.city==undefined?"":values.city[1], - } - this.props.editSave && this.props.editSave(param,attachment_ids,topicId); - } else { - // 新建 - let attachment_ids = undefined - if (this.state.fileList) { - attachment_ids = this.state.fileList.map(item => { - return item.response.id - }) - } - const param ={ - ...values, - province: values.city==undefined?"":values.city[0], - city: values.city==undefined?"":values.city[1], - } - this.props.newSubmit && this.props.newSubmit(param,attachment_ids,topicId); - } - } else { - $("html").animate({ scrollTop: $('html').scrollTop() - 100 }) - } - }); - } - - // 附件相关 ------------ END - render(){ - let{ - fileList, - teacherList, - topic_property_first, - topic_property_second, - topic_repeat, - topic_source, - topic_type, - addonAfter, - cityDefaultValue - }=this.state; - const { getFieldDecorator } = this.props.form; - const formItemLayout = { - labelCol: { - xs: { span: 24 }, - // sm: { span: 8 }, - sm: { span: 24 }, - }, - wrapperCol: { - xs: { span: 24 }, - // sm: { span: 16 }, - sm: { span: 24 }, - }, - }; - const uploadProps = { - width: 600, - fileList, - multiple: true, - action: `${getUploadActionUrl()}`, - onChange: this.handleChange, - onRemove: this.onAttachmentRemove, - beforeUpload: (file) => { - const isLt150M = file.size / 1024 / 1024 < 150; - if (!isLt150M) { - //message.error('文件大小必须小于150MB!'); - this.props.define({ - title:'提示', - content:"该文件无法上传。超过文件大小限制(150MB),建议上传到百度云等其它共享工具里,然后再txt文档里给出链接以及共享密码并上传" - }) - return isLt150M; - } - } - }; - let { topicId , teacherName }=this.props; - return( - -
    -
    - { - teacherName && - - {getFieldDecorator('tea_id', { - rules: [{ - required: true, message: '请选择指导老师' - }], - })( - - )} - - } - - - {getFieldDecorator('name', { - rules: [{ - required: true, message: '请输入选题名称', - }, { - max: 60, message: '最大限制为60个字符', - }], - })( - - )} - -
    - - - -
    - - - {getFieldDecorator('description', { - rules: [{ - required: true, message: '请输入选题简介', - }, { - max: 10000, message: '最大限制为10000个字符', - }], - })( - // initValue={this.editTopic ? this.editTopic.content : ''} - - )} - - - { - getFieldDecorator('file',{ - rules:[{ - required:false - }] - })( - - - (单个文件150M以内) - - ) - } - -
    - - {getFieldDecorator('topic_type', { - rules: [{ - required: false, message: '', - }], - })( - - )} - - - {getFieldDecorator('topic_source', { - rules: [{ - required: false, message: '', - }], - })( - - )} - - - {getFieldDecorator('topic_property_first', { - rules: [{ - required: false, message: '', - }], - })( - - )} - - - {getFieldDecorator('topic_property_second', { - rules: [{ - required: false, message: '', - }], - })( - - )} - -
    -
    - - - - - -
    - - {getFieldDecorator('source_unit', { - rules: [{ - required: false, message: '', - }], - })( - - )} - - - {getFieldDecorator('topic_repeat', { - rules: [{ - required: false, message: '', - }], - })( - - )} - - - {getFieldDecorator('city', { - rules: [{ - initialValue: cityDefaultValue, - type: 'array', - required: false, message: '', - }], - })( - - )} - -
    - - -
    - - - - ) - } -} - -const WrappedGraduateTopicNewForm = Form.create({ name: 'topicPostWorksNew' })(GraduateTopicNewForm); -// RouteHOC() -export default (WrappedGraduateTopicNewForm); \ No newline at end of file diff --git a/src/modules/courses/graduation/topics/GraduateTopicPostWorksNew.js b/src/modules/courses/graduation/topics/GraduateTopicPostWorksNew.js deleted file mode 100644 index 6d4d0874..00000000 --- a/src/modules/courses/graduation/topics/GraduateTopicPostWorksNew.js +++ /dev/null @@ -1,432 +0,0 @@ -import React,{ Component } from "react"; - -import { - Form, Input, InputNumber, Switch, Radio, - Slider, Button, Upload, Icon, Rate, Checkbox, message, - Row, Col, Select, Modal -} from 'antd'; -import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor'; -import axios from 'axios' -import {getUrl,getUploadActionUrl} from 'educoder'; -import "../../common/formCommon.css" - -// import './board.css' -// import { RouteHOC } from './common.js' - -const confirm = Modal.confirm; -const $ = window.$ -const { Option } = Select; -// 提交作品 -// https://lanhuapp.com/web/#/item/project/board/detail?pid=a3bcd4b1-99ce-4e43-8ead-5b8b0a410807&project_id=a3bcd4b1-99ce-4e43-8ead-5b8b0a410807&image_id=c6d9b36f-7701-4035-afdb-62404681108c -class GraduateTopicPostWorksNew extends Component{ - constructor(props){ - super(props); - - this.mdRef = React.createRef(); - - this.state = { - fileList: [], - boards: [] - } - } - componentDidMount = () => { - - const topicId = this.props.match.params.topicId - - const cid = this.props.match.params.coursesId - const boardsUrl = `/courses/${cid}/get_all_boards.json` - axios.get(boardsUrl, { }) - .then((response) => { - if (response.data.status == 0) { - this.setState({ - boards: response.data.data - }) - } - }) - .catch(function (error) { - console.log(error); - }); - - const isEdit = !!topicId - this.isEdit = isEdit - if (isEdit) { - const url = `/messages/${topicId}.json` - axios.get(url, { - }) - .then((response) => { - if (response.data.status == 0) { - const { id, data } = response.data; - if (data) { - this.editTopic = data; - this.props.form.setFieldsValue({ - content: data.content, - subject: data.subject, - board_id: data.board_id - }); - this.mdRef.current.setValue(data.content) - const _fileList = data.attachments.map(item => { - return { - id: item.id, - uid: item.id, - name: item.title, - url: item.url, - status: 'done' - } - }) - this.setState({ fileList: _fileList}) - } - } - }) - .catch(function (error) { - console.log(error); - }); - } else { - const boardId = this.props.match.params.boardId - - this.props.form.setFieldsValue({ - board_id: parseInt(boardId) - }); - } - } - handleSubmit = (e) => { - e.preventDefault(); - const cid = this.props.match.params.coursesId - const boardId = this.props.match.params.boardId - - this.props.form.validateFieldsAndScroll((err, values) => { - if (!err) { - console.log('Received values of form: ', values); - if (this.isEdit == true) { - const editTopic = this.editTopic - const editUrl = `/messages/${editTopic.id}.json` - - let attachment_ids = undefined - if (this.state.fileList) { - attachment_ids = this.state.fileList.map(item => { - return item.response ? item.response.id : item.id - }) - } - axios.put(editUrl, { - subject: values.subject, - board_id: values.board_id, - content: values.content, - sticky: values.sticky, - attachment_ids, - // board_id: 3779, - }) - .then((response) => { - if (response.data.status == 0) { - const { id } = response.data; - console.log('--- success') - - this.props.toDetailPage(cid, values.board_id, editTopic.id) - } - }) - .catch(function (error) { - console.log(error); - }); - } else { - const url = `/messages.json` - let attachment_ids = undefined - if (this.state.fileList) { - attachment_ids = this.state.fileList.map(item => { - return item.response.id - }) - } - - axios.post(url, { - ...values, - course_id: cid, - board_id: boardId, - attachment_ids, - }) - .then((response) => { - if (response.data) { - const { id } = response.data; - if (id) { - console.log('--- success') - } - } - }) - .catch(function (error) { - console.log(error); - }); - } - } else { - $("html").animate({ scrollTop: $('html').scrollTop() - 100 }) - } - }); - } - // 附件相关 START - handleChange = (info) => { - if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') { - let fileList = info.fileList; - this.setState({ fileList }); - } - } - onAttachmentRemove = (file) => { - if(!file.percent || file.percent == 100){ - confirm({ - title: '确定要删除这个附件吗?', - okText: '确定', - cancelText: '取消', - // content: 'Some descriptions', - onOk: () => { - this.deleteAttachment(file) - }, - onCancel() { - console.log('Cancel'); - }, - }); - - - return false; - } - - - } - deleteAttachment = (file) => { - const url = `/attachments/${file.id}.json` - axios.delete(url, { - }) - .then((response) => { - if (response.data) { - const { status } = response.data; - if (status == 0) { - console.log('--- success') - - this.setState((state) => { - const index = state.fileList.indexOf(file); - const newFileList = state.fileList.slice(); - newFileList.splice(index, 1); - return { - fileList: newFileList, - }; - }); - } - } - }) - .catch(function (error) { - console.log(error); - }); - } - // 附件相关 ------------ END - render() { - let { addGroup, fileList } = this.state; - const { getFieldDecorator } = this.props.form; - - const formItemLayout = { - labelCol: { - xs: { span: 24 }, - // sm: { span: 8 }, - sm: { span: 24 }, - }, - wrapperCol: { - xs: { span: 24 }, - // sm: { span: 16 }, - sm: { span: 24 }, - }, - }; - - const tailFormItemLayout = { - wrapperCol: { - xs: { - span: 24, - offset: 0, - }, - sm: { - span: 16, - offset: 8, - }, - }, - }; - - const uploadProps = { - width: 600, - fileList, - multiple: true, - // https://github.com/ant-design/ant-design/issues/15505 - // showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。 - // showUploadList: false, - action: `${getUploadActionUrl()}`, - onChange: this.handleChange, - onRemove: this.onAttachmentRemove, - beforeUpload: (file) => { - console.log('beforeUpload', file.name); - const isLt150M = file.size / 1024 / 1024 < 150; - if (!isLt150M) { - this.props.showNotification('文件大小必须小于150MB!'); - } - return isLt150M; - }, - }; - return( -
    - -
    - - - -
    -
    - - {getFieldDecorator('subject', { - rules: [{ - required: true, message: '请输入标题', - }, { - max: 20, message: '最大限制为20个字符', - }], - })( - - )} - -
    - - - -
    - - - {getFieldDecorator('content', { - rules: [{ - required: true, message: '请输入帖子内容', - }, { - max: 10000, message: '最大限制为10000个字符', - }], - })( - - )} - - - - - (单个文件150M以内) - -
    - - - -
    - - {getFieldDecorator('min', { - rules: [{ - required: true, message: '请输入每组最小人数', - }], - })( - - )} - - - ~ - - - {getFieldDecorator('max', { - rules: [{ - // required: true, message: '请输入每组最大人数', - }], - })( - - )} - - - (学生提交作品时需要关联同组成员,组内成员作品共享) - - {getFieldDecorator('c', { - rules: [], - })( - 基于项目实施 - )} - - (选中,则必须在本平台创建项目,项目管理员可以提交作品;不选中,无需在平台创建项目,任意小组成员均可以提交作品) -
    - -
    - - {getFieldDecorator('answer', { - rules: [{ - required: true, message: '请输入帖子内容', - }, { - max: 10000, message: '最大限制为10000个字符', - }], - })( - - )} - -
    - - -
    - - 取消 -
    -
    - -
    -
    - ) - } -} - -const WrappedGraduateTopicPostWorksNew = Form.create({ name: 'topicPostWorksNew' })(GraduateTopicPostWorksNew); -// RouteHOC() -export default (WrappedGraduateTopicPostWorksNew); \ No newline at end of file diff --git a/src/modules/courses/graduation/topics/GraduateTopicReply.css b/src/modules/courses/graduation/topics/GraduateTopicReply.css deleted file mode 100644 index 6e295411..00000000 --- a/src/modules/courses/graduation/topics/GraduateTopicReply.css +++ /dev/null @@ -1,13 +0,0 @@ -.graduateTopic .commentsbtn { - -} - - -.edu-class-container { - width: 1200px; - margin: 10px auto 20px; -} -#forum_index_list { - margin-top: 90px; - margin-bottom: 320px; -} diff --git a/src/modules/courses/graduation/topics/GraduateTopicReply.js b/src/modules/courses/graduation/topics/GraduateTopicReply.js deleted file mode 100644 index 5faf626f..00000000 --- a/src/modules/courses/graduation/topics/GraduateTopicReply.js +++ /dev/null @@ -1,270 +0,0 @@ -import React,{ Component } from "react"; -import { Pagination } from "antd"; - -import update from 'immutability-helper' -import axios from 'axios' -import MemoDetailMDEditor from '../../../forums/MemoDetailMDEditor' - -import '../../../forums/RightSection.css' -import {ImageLayerOfCommentHOC} from '../../../page/layers/ImageLayerOfCommentHOC' - -import Comments from '../../../comment/Comments' -import './GraduateTopicReply.css' -import '../../common/courseMessage.css' -import { generateComments, generateChildComments, _findById, handleContentBeforeCreateNew, addNewComment - , addSecondLevelComment, NEED_TO_WRITE_CONTENT, handleContentBeforeCreateSecondLevelComment - , handleDeleteComment, handleCommentPraise, handleHiddenComment } from '../../common/CommentsHelper' -const REPLY_PAGE_COUNT = 10 -const $ = window.$; -class GraduateTopicReply extends Component{ - constructor(props){ - super(props); - this.state={ - pageCount: 1 - } - } - - componentDidMount(){ - this.fetchReplies() - - - } - _getUser() { - const { current_user } = this.props; - current_user.user_url = `/users/${current_user.login}`; - return current_user; - } - _findById = _findById - createNewComment = (commentContent, id, editor) => { - const graduation_topic_id = this.props.memo.id - - let content = handleContentBeforeCreateNew(commentContent); - const { memo } = this.props; - const url = `/users/reply_message.json`; - - let { comments } = this.state; - axios.post(url, { - journals_for_message: { - jour_type: 'GraduationTopic', - jour_id: graduation_topic_id, - notes: content, - // m_parent_id - reply_id: memo.user_id - } - } - ).then((response) => { - if (response.data.status === -1) { - console.error('服务端异常') - return; - } - // this.props.showNotification('帖子发表成功') - - if (response.data && response.data.id) { - const _id = response.data.id; - // md - editor.setValue && editor.setValue('') - - const user = this._getUser(); - this.setState({ - comments: addNewComment(this.state.comments, _id, content, user, this.props.isSuperAdmin(), this), - total_count: this.state.total_count + 1 - }) - this.refs.editor.showEditor(); - - } - }).catch((error) => { - console.log(error) - }) - } - replyComment = (commentContent, id, editor) => { - const { showNotification } = this.props; - // if (!commentContent || commentContent.length === 0) { - // showNotification(NEED_TO_WRITE_CONTENT) - // return; - // } - - if (this.props.memo.id === id ) { // 回复帖子 - this.createNewComment(commentContent, id, editor); - return; - } - const url = `/users/reply_message.json`; - - const { comments } = this.state; - const user = this._getUser(); - const graduation_topic_id = this.props.memo.id - const commentIndex = this._findById(id, comments); - let comment = comments[commentIndex]; - - commentContent = handleContentBeforeCreateSecondLevelComment(commentContent) - axios.post(url, { - journals_for_message: { - jour_type: 'GraduationTopic', - jour_id: graduation_topic_id, - notes: commentContent, - m_parent_id: id, - reply_id: comment.user_id - } - }, - { - } - ).then((response) => { - if (response.data.id) { - let newId = response.data.id; - - this.setState({ - comments: addSecondLevelComment(comments, comment, commentIndex, newId, commentContent, user, editor) - }) - - const newMemo2 = Object.assign({}, this.props.memo); - newMemo2.total_count = newMemo2.total_count + 1; - this.setState({ - memo: newMemo2 - }) - } - - }).catch((error) => { - console.log(error) - }) - } - - loadMoreChildComments = (parent) => { - const graduation_topic_id = this.props.memo.id - const course_id = this.props.course_id - const url = `/courses/${course_id}/graduation_topics/${graduation_topic_id}/show_comment.json?parent_id=${parent.id}&limit=500` - axios.get(url,{ - }) - .then((response) => { - const { comments } = response.data - - - // const memo = Object.assign({}, this.state.memo) - // memo.sum_replies_count = sum_replies_count; - this.setState({ - // memo, - comments: generateChildComments(comments, this.state.comments, parent, this.transformReply) - }) - }).catch((error) => { - console.log(error) - }) - } - - onPaginationChange = (pageCount) => { - this.setState({ pageCount }, () => { - this.fetchReplies() - }) - } - - fetchReplies = () => { - const graduation_topic_id = this.props.memo.id - const course_id = this.props.course_id - const url = `/courses/${course_id}/graduation_topics/${graduation_topic_id}/show_comment.json?page=${this.state.pageCount}` - // page limit parent_id - axios.get(url,{ - }) - .then((response) => { - const { comments, messages_count } = response.data - - this.setState({ - comments: generateComments(comments, this.transformReply), - // : this.state.comments.concat(comments), - total_count: messages_count - }) - }).catch((error) => { - console.log(error) - }) - } - - transformReply = (reply, children = []) => { - const isAdmin = this.props.isAdmin() - const isSuperAdmin = this.props.isSuperAdmin() - return { - isSuperAdmin: isSuperAdmin, - admin: isAdmin, // - permission: true, // - children: children, - child_message_count: reply.child_message_count, - hidden: reply.hidden, - id: reply.id, - image_url: reply.author.image_url, - reward: null, // - time: reply.time, // moment(reply.created_on).fromNow(), - user_id: reply.author.id, - user_login: reply.author.login, - user_praise: reply.user_praise, - username: reply.author.name, - content: reply.content, - praise_count: reply.praise_count - } - } - - // 公共接口 --- 删除回复 - deleteComment = (parrentComment, childCommentId) => { - handleDeleteComment(this, parrentComment, childCommentId, 'journals_for_message') - } - // 公共接口 --- 回复点赞 - commentPraise = (discussId) => { - handleCommentPraise(this, discussId, 'journals_for_message') - } - // 公共接口 --- 隐藏回复 - hiddenComment = (item, childCommentId) => { - handleHiddenComment(this, item, childCommentId, 'journals_for_message') - } - - showCommentInput = () => { - this.refs.editor.showEditor(); - } - initReply = (parent) => { - if (!parent.isAllChildrenLoaded) { - this.loadMoreChildComments(parent) - } - } - - render(){ - let { total_count, comments, pageCount } = this.state - const { current_user, memo } = this.props - - return( - - - -
    -
    - 全部回复 - {total_count} -
    - - - - - {/* { true ? : -
    -
    写评论
    -
    } */} -
    - - { total_count > REPLY_PAGE_COUNT && -
    - -
    写评论
    -
    } -
    - ) - } -} -export default ImageLayerOfCommentHOC() (GraduateTopicReply); \ No newline at end of file diff --git a/src/modules/courses/graduation/topics/index.js b/src/modules/courses/graduation/topics/index.js deleted file mode 100644 index 2fe241a5..00000000 --- a/src/modules/courses/graduation/topics/index.js +++ /dev/null @@ -1,519 +0,0 @@ -import React, { Component } from "react"; -import { Checkbox, Menu, Pagination, Spin } from "antd"; - -import Titlesearchsection from '../../common/titleSearch/TitleSearchSection' -import DownloadMessageysl from "../../../modals/DownloadMessageysl"; - -import { WordsBtn, getRandomcode, getRandomNumber } from 'educoder' -import NoneData from '../../coursesPublic/NoneData' -import Modals from "../../../modals/Modals" -import axios from 'axios' - -import _ from 'lodash' - -import GraduateTopicItem from './GraduateTopicItem' -import ChooseGraduateTopicModal from './ChooseGraduateTopicModal' -import '../../css/members.css' -import '../../css/busyWork.css' -import '../style.css' - - -class Boards extends Component { - constructor(props) { - super(props); - this.state = { - searchValue: '', - checkAllValue: false, - checkBoxValues: [], - data: [], - topicList: undefined, - course_public: 1, - page: 1, - totalCount: undefined, - status: "all", - pageSize: 15, - modalsType: "", - modalsTopval: "", - modalsBottomval: "", - topicId: undefined, - index: undefined, - flag: true, - delType: false, - delTopval: "", - delLoadType: false, - delOrPublic: 1, - isSpin: true, - DownloadType: false, - DownloadMessageval: undefined, - } - } - fetchAll = (searchValue, page, status) => { - this.setState({ - checkAllValue: false, - isSpin: true - }) - - let { pageSize } = this.state; - const cid = this.props.match.params.coursesId - - let url = `/courses/${cid}/graduation_topics.json?limit=${pageSize}` - if (searchValue != "") { - url += "&search=" + searchValue - } - if (page != "") { - url += "&page=" + page - } - if (status != "" && status != "all") { - url += "&status=" + status; - } - url = encodeURI(url);//IE11传参为乱码(search) - axios.get(url - // ,{ - // params:{ - // search:encodeURI(searchValue), - // page:page, - // status:status, - // limit:pageSize - // } - // } - ).then((response) => { - if (response.status == 200 && response.status) { - this.setState({ - data: response.data, - topicList: response.data.graduation_topic, - totalCount: response.data.graduation_topic_count, - course_public: response.data.course_public, - isSpin: false, - page: page - }) - } - }) - .catch(function (error) { - this.setState({ - isSpin: false - }) - }); - } - componentDidMount = () => { - this.setState({ - isSpin: true - }) - let { searchValue, page, status } = this.state - this.fetchAll(searchValue, page, status); - - } - - - - //搜索 - onPressEnter = (value) => { - this.setState({ - page: 1, - searchValue: value, - checkBoxValues: [] - }) - let { status } = this.state; - this.fetchAll(value, 1, status); - } - - onInputSearchChange = (e) => { - this.setState({ - searchValue: e.target.value, - }) - } - - - // 全选or反选 - onCheckAll = (e) => { - this.setState({ - checkAllValue: e.target.checked - }) - const values = this.state.topicList.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) - }) - } - } - - 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) - } - - onCheckBoxChange = (checkedValues) => { - this.setState({ - checkBoxValues: checkedValues, - checkAllValue: checkedValues.length == this.state.topicList.length - }) - } - - // 分页 - onChangePage = (pageNum) => { - this.setState({ - page: pageNum, - checkBoxValues: [] - }) - let { status, searchValue } = this.state; - this.fetchAll(searchValue, pageNum, status); - - } - - // 筛选 - onChangeStatus = (e) => { - this.setState({ - page: 1, - status: e.key, - checkBoxValues: [], - isSpin: true - }) - let { searchValue } = this.state; - this.fetchAll(searchValue, 1, e.key === "all" ? "" : e.key); - } - - // 选题or取消选题 - chooseTopic = (topicId, index, flag) => { - this.setState({ - modalsType: true, - modalsTopval: flag == true ? "是否确认取消选题?" : "是否确认选题?", - modalsBottomval: "", - modalCancel: true, - topicId: topicId, - index: index, - flag: flag - }) - } - cancelOperateTopic = () => { - this.setState({ - modalsType: false, - modalsTopval: "", - modalsBottomval: "", - modalCancel: false - }) - } - sureOperateTopic = () => { - let { topicId, index, flag } = this.state; - let courseid = this.props.match.params.coursesId - - let url = "/courses/" + courseid + "/graduation_topics/" + topicId + "/" - if (flag) { - url += "student_cancel_topic.json" - } else { - url += "student_select_topic.json" - } - axios.post((url)).then((result) => { - if (result.data.status == 0) { - this.props.showNotification(`${result.data.message}`); - let { searchValue, page, status } = this.state - this.fetchAll(searchValue, page, status); - this.cancelOperateTopic(); - } - }).catch(error => { - console.log(error); - }) - } - // 删除 - onDelete = (index) => { - let { checkBoxValues } = this.state; - if (checkBoxValues.length > 0) { - if (index < 3) { - this.setState({ - delType: true, - delTopval: index == 1 ? "是否确认删除?" : "是否设为公开?", - delLoadType: false, - delOrPublic: 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 { - this.setState({ - // delType:true, - // delTopval:"请先在列表中选择数据", - // delLoadType:true, - delOrPublic: index - }) - this.props.showNotification("请先在列表中选择数据"); - } - } - cancelDelTopic = () => { - this.setState({ - delType: false, - delTopval: "", - delLoadType: false - }) - } - sureDelTopic = () => { - let { checkBoxValues, delOrPublic } = this.state; - if (checkBoxValues.length > 0) { - let courseid = this.props.match.params.coursesId; - let url = ""; - // 删除 - if (delOrPublic == 1) { - url = "/courses/" + courseid + "/graduation_topics/destroys.json"; - axios.delete((url), { - data: { - graduation_topic_ids: this.state.checkBoxValues - } - }) - .then((result) => { - if (result.data.status == 0) { - this.props.showNotification(`${result.data.message}`); - this.setState({ - delType: false, - delTopval: "", - checkBoxValues: [] - }) - let { searchValue, status } = this.state; - this.fetchAll(searchValue, 1, status); - } - }).catch((error) => { - console.log(error); - }) - } else if (delOrPublic == 2) { - // 设为公开 - url = "/courses/" + courseid + "/graduation_topics/set_public.json"; - axios.post((url), { - graduation_topic_ids: this.state.checkBoxValues - }).then((result) => { - if (result.data.status == 0) { - this.props.showNotification(`${result.data.message}`); - this.setState({ - delType: false, - delTopval: "", - checkBoxValues: [] - }) - let { searchValue, status } = this.state; - this.fetchAll(searchValue, 1, status); - } - }).catch((error) => { - console.log(error); - }) - } - } else { - this.setState({ - delType: false, - delTopval: "", - delLoadType: false - }) - } - } - // 新建 - onBoardsNew = () => { - let courseId = this.props.match.params.coursesId - this.props.history.push(`/classrooms/${courseId}/graduation_topics/new`) - } - /// 确认是否下载 - confirmysl(url) { - axios.get(url + '&export=true').then((response) => { - if (response.data.status && response.data.status === -1) { - - } else if (response.data.status && response.data.status === -2) { - if (response.data.message === "100") { - // 已超出文件导出的上限数量(100 ),建议: - - this.setState({ - DownloadType: true, - DownloadMessageval: 100 - }) - } else { - //因附件资料超过500M - this.setState({ - DownloadType: true, - DownloadMessageval: 500 - }) - } - } else { - this.props.showNotification(`正在下载中`); - window.open(getRandomcode("/api" + url), '_blank'); - } - }).catch((error) => { - console.log(error) - }); - } - - Downloadcal = () => { - this.setState({ - DownloadType: false, - DownloadMessageval: undefined - }) - } - - // 题库选用成功后刷新页面 - useBankSuccess = (checkBoxValues, object_ids) => { - - let { searchValue, page, status } = this.state - this.fetchAll(searchValue, page, status); - } - render() { - let { - searchValue, - topicList, - data, - course_public, - checkBoxValues, - checkAllValue, - page, - totalCount, - pageSize, - //选题和取消选题 - modalsType, - modalsTopval, - modalsBottomval, - // 删除弹框 - delType, - delTopval, - delLoadType - } = this.state; - // let {course_identity}=this.props.coursedata - const isAdmin = this.props.isAdmin(); - return ( - - - - - {/* 参考普通作业 - 题库选用 */} - {/* this.useFromBank()}>题库选用 正式版没有,先隐藏*/} - < a className={"fl color-blue mr30 font-16"} onClick={(url) => this.confirmysl(`/courses/${this.props.match.params.coursesId}/graduation_topics/export.xlsx`)}>导出
    - {/*

    题库选用*/} - this.onBoardsNew()}>新建 - ) : "" - } - secondRowLeft={ -
    - - 全部 - 待选中 - 待确认 - 已确认 - -
    - } - onPressEnter={this.onPressEnter} - searchPlaceholder={"请输入名称进行搜索"} - showSearchInput={topicList && topicList.length >= pageSize} - > - - { - topicList && topicList.length > 0 ? - ( -
    - { - // 超级管理员、教师、助教 - isAdmin ? -
    - 已选 {checkBoxValues.length} 个 (不支持跨页勾选) -
    -
  • this.onDelete(1)}>删除
  • - { - course_public && course_public == 1 ?
  • this.onDelete(2)}>设为公开
  • : "" - } - {/*
  • this.onDelete(3)}>加入题库
  • */} - {/*
  • 加入题库
  • */} -
    -
    - : "" - } - - - -
    - - {topicList.map((item, index) => { - return ( -
    - this.onItemClick(item)} className="mr15">} - onItemClick={this.onItemClick} - index={index} - chooseTopic={this.chooseTopic} - > -
    - ) - }) - } -
    -
    - - - -
    - ) : (topicList && topicList.length === 0 ? :
    ) - } -
    - { - totalCount && totalCount > pageSize ? -
    - -
    - : -
    - } - -
    -
    - - ) - } -} -export default Boards;