删除毕设部分

This commit is contained in:
caishi 2020-05-09 11:35:00 +08:00
parent c9719b72ec
commit 72cff809e5
32 changed files with 0 additions and 13160 deletions

View File

@ -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;
}

View File

@ -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(
<div className="graduateTopicList boardsList" style={{cursor : isAdmin ? "pointer" : "default" }} onClick={() => window.$(`.taskitem${index} input`).click() }>
<Modals
modalsType={Modalstype}
modalsTopval={Modalstopval}
modalsBottomval={Modalsbottomval}
modalCancel={cardsModalcancel}
modalSave={cardsModalsavetype}
loadtype={loadtype}
/>
{visible===true?<Associationmodel
modalname={modalname}
visible={visible}
Cancel={this.Cancel}
taskid={taskid}
funlist={this.props.funlist}
/>:""}
{this.state.visibles===true?<AccessoryModal
{...this.props}
modalname={"补交附件"}
visible={this.state.visibles}
Cancelname={"取消"}
Savesname={"确认"}
Cancel={this.Cancelvisible}
categoryid={discussMessage.work_id}
setupdate={this.setupdate}
/>:""}
<style>{`
.graduateTopicList .ant-checkbox-input {
margin-right: 15px;
}
`}</style>
<span className={`taskitem${index} fl`} style={{"height":"59px"}}>
{ checkBox }
</span>
{/*
style={{borderTop:data===undefined?"":data.course_identity<4?'1px solid #EBEBEB':'1px solid transparent'}}
*/}
{
this.props.isAdmin?"":<style>{`
.boardsList .contentSection {
margin-left: 0px !important;
}
`}</style>}
<div className="clearfix ds pr pt5 contentSection" >
<style>{`
.maxwidth580{
max-width: 580px;
overflow:hidden;
text-overflow:ellipsis;
white-space:nowrap
}
`}</style>
<h6>
{
this.props.isAdmin?<a onClick={()=>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}</a>:""
}
{
this.props.isStudent? <a onClick={()=>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}</a>:""
}
{
this.props.isNotMember===true?this.props.discussMessage.private_icon===true?
<span className="fl mt3 font-16 font-bd color-dark maxwidth580 pointer" title={"私有属性,非课堂成员不能访问"}>{discussMessage.name}</span>
:<a onClick={()=>this.toDetailPage("/classrooms/"+coursesId+"/graduation_tasks/"+categoryid+"/"+taskid+"/list")}
title={discussMessage.name}
className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.name}</a>:""
}
{
this.props.discussMessage.private_icon===true?
<Tooltip title={"私有属性,非课堂成员不能访问"} placement="bottom">
<i className="iconfont icon-guansuo color-grey-c ml10 font-16 fl mt4"></i>
</Tooltip>
:
<div></div>
}
<CoursesListType typelist={discussMessage.status} typesylename={""} />
{/* { !!discussMessage.sticky && <span className="btn-cir btn-cir-red fl mt5 ml5">置顶</span> } */}
</h6>
<div className="cl"></div>
<p className="color-grey mt16 fl">
<span className="mr50">
{/* <a href="/users/innov" className="panel-name-small hide fl mr15 mr30 color-grey3">{discussMessage.author.name}</a> */}
{ discussMessage.author && <span className="mr15 color-grey-3">{discussMessage.author}</span> }
{discussMessage.commit_count===undefined?"":<span className="mr15 color-grey9 font-14">{discussMessage.commit_count} 已交</span>}
{discussMessage.uncommit_count===undefined?"":<span className="mr15 color-grey9 font-14">{discussMessage.uncommit_count} 未交</span>}
{/*<span className="mr15 color-grey9">{discussMessage.replies_count} 3 未评</span>*/}
<Tooltip title={discussMessage.task_status===1?"提交剩余时间":discussMessage.task_status===2?"补交剩余时间":discussMessage.task_status===3?"交叉评阅剩余时间":""} placement="bottom">
<span className="mr15 color-grey9 font-14">{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}</span>
</Tooltip>
{/* { discussMessage.replies_count != 0 && <span className="mr15 color-grey9">{discussMessage.replies_count} </span> }
{ discussMessage.praise_num != 0 && <span className="mr15 color-grey9">{discussMessage.praise_num} 点赞</span> }
{ discussMessage.visits != 0 && <span className="mr15 color-grey9">{discussMessage.visits} 浏览</span> } */}
{/* <span className="mr15 color-light-grey-C">{moment(discussMessage.created_on).fromNow()} </span> */}
</span>
</p>
<style>
{
`
.mrf4{
margin-right: -4px;
}
`
}
</style>
{this.props.isAdmin?
<div className="mt13">
<WordsBtn style="blue" to={"/classrooms/"+coursesId+"/graduation_tasks/"+categoryid+"/detail/"+taskid+"/setting"} className="colorblue font-16 mrf4 fr">
<a className="btn colorblue">设置</a>
</WordsBtn>
<WordsBtn style="blue" to={"/classrooms/"+coursesId+"/graduation_tasks/"+taskid+"/edit"} className="colorblue font-16 mr20 fr">
<a className="btn colorblue" >编辑</a>
</WordsBtn>
<WordsBtn style="blue" onClick={()=>this.toDetailPage("/classrooms/"+coursesId+"/graduation_tasks/"+categoryid+"/detail/"+taskid+"/list")}
className="btn colorblue colorblue font-16 mr20 fr">
查看详情
</WordsBtn>
</div>
:""}
{this.props.isStudent?
discussMessage&&discussMessage.work_status===null?"":discussMessage&&discussMessage.work_status.map((item,key)=>{
return(
<span key={key}>
{item==="提交作品"?
<WordsBtn style="blue" className="colorblue font-16 ml20 fr mt12">
<a className="btn colorblue" href={"/classrooms/"+this.props.coursesId+"/graduation_tasks/"+this.props.categoryid+"/works"+"/"+this.props.taskid+"/new"}>提交作品</a>
</WordsBtn>
:""}
{item==="补交作品"?
<WordsBtn style="blue" className="colorblue font-16 ml20 fr mt12">
<a className="btn colorblue" href={"/classrooms/"+this.props.coursesId+"/graduation_tasks/"+this.props.categoryid+"/works"+"/"+this.props.taskid+"/new"}>补交作品</a>
</WordsBtn>
:""}
{item==="修改作品"?
<WordsBtn style="blue" className="font-16 colorblue ml20 fr mt12">
<a className="btn colorblue" href={"/classrooms/"+this.props.coursesId+"/graduation_tasks/"+this.props.categoryid+"/works"+"/"+this.props.workid+"/edit"}>修改作品</a>
</WordsBtn>
:""}
{item==="查看作品"?
<WordsBtn style="blue" className="font-16 colorblue ml20 fr mt12">
<a className="btn colorblue" target="_blank" href={"/classrooms/"+this.props.coursesId+"/graduation_tasks/"+this.props.workid+"/appraise"}>查看作品</a>
</WordsBtn>
:""}
{item==="创建项目"?
<WordsBtn className="colorblue font-16 ml20 fr mt12">
<a className="btn colorblue" href={'/projects/new'} target="_blank">创建项目</a>
</WordsBtn>
:""}
{item==="关联项目"?
<WordsBtn onClick={this.AssociationItems} className="colorblue font-16 ml20 fr mt12">关联项目</WordsBtn>
:""}
{item==="取消关联"?
<WordsBtn onClick={this.cannelAssociation} className="colorblue font-16 ml20 fr mt12">取消关联</WordsBtn>
:""}
{item==="补交附件"?
<WordsBtn className="colorblue font-16 ml20 fr mt12" onClick={this.addAccessory}>
补交附件
{/*<a className="btn colorblue " href={"/classrooms/"+this.props.coursesId+"/graduation_tasks/"+discussMessage.work_id+"/appraise"}></a>*/}
</WordsBtn>
:""}
</span>
)
}):""}
{this.props.isStudent?
<WordsBtn style="blue" onClick={()=>this.toDetailPage("/classrooms/"+coursesId+"/graduation_tasks/"+categoryid+"/detail/"+taskid+"/list")}
className="colorblue font-16 ml20 fr mt12">
查看详情
</WordsBtn>:""}
</div>
</div>
)
}
}
export default GraduateTaskItem;

View File

@ -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(
<span className="fl task-hide" style={{width:"69px"}} title={user_name}>{user_name}</span>
)
}
},{
title: '学号',
dataIndex: 'student_id',
key: 'student_id',
render: (student_id, line, index) => {
return(
<span className="fl task-hide" style={{width:"127px"}} title={student_id}>{student_id}</span>
)
}
},{
title: '分班',
dataIndex: 'course_group_name',
key: 'course_group_name',
filters:filter,
render: (course_group_name, line, index) => {
return(
<span className="fl task-hide" style={{width:"160px"}} title={course_group_name}>{course_group_name}</span>
)
}
}
];
if(that.state.comment_status == 2){
columns.push({
title: '交叉评阅老师',
dataIndex: 'cross_teachers',
key: 'cross_teachers',
width:"200px",
render: (cross_teachers, line, index) => {
return(
<span className="fl task-hide" style={{width:"200px",paddingRight:"20px"}} title={cross_teachers}>{cross_teachers}</span>
)
}
})
}else{
columns.push({
title: '答辩组',
dataIndex: 'cross_groups',
key: 'cross_groups',
width:"200px",
render: (cross_groups, line, index) => {
return(
<span className="fl task-hide" style={{width:"200px",paddingRight:"20px"}} title={cross_groups}>{cross_groups}</span>
)
}
})
}
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(
<Modal
className={"AcrossModal"}
title={"交叉评阅设置"}
visible={modalVisible}
closable={false}
footer={null}
width="775px"
destroyOnClose={true}
>
{modalVisible===true?<style>
{
`
body{
overflow: hidden !important;
}
.closeIcon{
font-size: 22px !important;
}
`
}
</style>:""}
<div id="closeIcon" onClick={this.props.modalCloss}>
<i className="iconfont icon-shanchudiao"></i>
</div>
<style>
{`
.AcrossModal .ant-modal-body{
padding:0px;
}
.AcrossModal span.ant-radio + *{
padding-right:0px;
}
.AcrossModal .ant-table-thead > tr > th,.AcrossModal .ant-table-tbody > tr > td{
padding:7px 5px;
border-bottom:none!important;
}
.AcrossModal .ant-table-tbody{
background:#F7FBFF;
}
.AcrossModal .ant-table-placeholder{
border:none!important;
}
.AcrossModal .ant-table-tbody .ant-table-selection-column,.AcrossModal .ant-table-thead .ant-table-selection-column{
padding-left: 23px!important;
}
.AcrossModal .ant-select-selection--multiple{
padding-top:0px;
}
.AcrossModal .ant-select-selection--multiple .ant-select-selection__rendered>ul>li,.AcrossModal .ant-select-selection--multiple>ul>li{
margin-top:3px;
margin-bottom:0px;
}
.AcrossModal .ant-select-selection__rendered{
height:30px;
line-height:30px;
overflow-y:auto;
overflow-x:hidden;
margin-right:0px;
}
.ant-table-filter-dropdown{
width:200px;
}
.ant-table-filter-dropdown .ant-dropdown-menu{
height:200px
}
.ant-dropdown-menu-item > label{
float:left
}
.ant-dropdown-menu-item > span{
float: left;
max-width: 153px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.pd8px{
padding: 8px;
}
`}
</style>
<div className="pt20 pl30 pr30 acrossHead">
<span className={"fl mt5"} style={{fontWeight: "400",color: "#05101A"}}>评阅分配方式</span>
<span>
<RadioGroup onChange={this.funcommentstatus} value={comment_status}>
<Radio style={radioStyle} value={2}>手动分配评阅<span className={"font-14 color-grey-c ml5"}>逐一指定每个学生的交叉评阅老师</span></Radio>
<Radio style={radioStyle} value={4}>答辩组分配评阅<span className={"font-14 color-grey-c ml5"}>将老师加入不同答辩组指定每个学生的交叉评阅答辩组
<a href={"/classrooms/"+courseId+"/teachers"} target="_blank">
<span className={"color-blue"}>立即设置答辩组</span></a>
</span></Radio>
</RadioGroup>
</span>
</div>
<div className="clearfix mb15 mt15 pl30 pr30" id="acrossContent">
<span className="fl color-grey-c mt5">已选 { chooseCount == 0 ? 0 : <span className="color-blue">{chooseCount}</span>} </span>
<span className="fr">
<span className={"fl mt5"}><span className={"color-orange"}>分配</span>{ comment_status && comment_status == 2 ? "":""}</span>
<span className={"fl"} style={{height:"32px"}} id="selectTags">
<Select
mode="multiple"
placeholder={ comment_status && comment_status == 2 ? "请选择老师":"请选择答辩组"}
// value={AcrossTeamIds}
style={{width:"300px",height:"30px"}}
onChange={this.changeSelect}
open={showflag}
onFocus={()=>this.changeFlag(true)}
dropdownRender={menu => (
<div id="selectDropdown">
{comment_status == 2 &&teachers&&teachers.length>10?<div className="padding10-20">
<Input
type='input'
value={searchValue}
onChange={this.changeSearchValue}
placeholder='请输入名称搜索'
style={{height:"30px"}}
className="searchInput"
></Input>
</div>:""}
{comment_status != 2 &&course_groups&&course_groups.length>10?<div className="padding10-20">
<Input
type='input'
value={searchValue}
onChange={this.changeSearchValue}
placeholder='请输入名称搜索'
style={{height:"30px"}}
className="searchInput"
></Input>
</div>:""}
{comment_status == 2 &&teacherList&&teacherList.length>2? <Checkbox className={"pd8px"} onChange={(e)=>this.checkonChange(e,teacherList)}>全选</Checkbox>:""}
{comment_status != 2 &&graduation_groupslist&&graduation_groupslist.length>2? <Checkbox className={"pd8px"} onChange={(e)=>this.checkonChange(e,graduation_groupslist)}>全选</Checkbox>:""}
{menu}
<Divider style={{ margin: '4px 0 0' }} />
<div style={{ padding: '8px 12px', cursor: 'pointer' }}>
<a onClick={this.sureAcross} className="acrossSureBtn color-orange">提交</a>
<a onClick={this.clearSelect} className="ml20"><span className="acrossResetBtn color-blue">重置</span></a>
</div>
</div>
)}
>
{ comment_status == 2 ?
teacherList && teacherList.map((i,key)=>{
return <Option key={i.user_id} value={String(i.user_id)}>{i.user_name}</Option>
}):
graduation_groupslist && graduation_groupslist.map((i,key)=>{
return <Option key={i.id} value={String(i.id)}>{i.name}</Option>
})
}
</Select>
</span>
</span>
</div>
{/*{*/}
{/*<style>*/}
{/*{*/}
{/*`*/}
{/*.ant-table-thead > tr > th .anticon-filter, .ant-table-thead > tr > th .ant-table-filter-icon{*/}
{/*left: 40px;*/}
{/*}*/}
{/*`*/}
{/*}*/}
{/*</style>*/}
{/*}*/}
<Table rowSelection={rowSelection} columns={bindTableColumn(this)} dataSource={users} pagination={false} onChange={this.handleTableChange} loading={tableLoading}></Table>
<div className="clearfix mt20 pb30 pl30 pr30 acrossfoot">
<div className="fl">
{
user_count > limit ?
<Pagination defaultCurrent={page} current={page} pageSize={limit} total={user_count} onChange={this.onPageChange}></Pagination>:""
}
</div>
<div className="fr">
<a className="task-btn color-white mr30" onClick={this.props.modalCloss}>取消</a>
<a className="task-btn task-btn-orange" onClick={this.props.modalCloss}>确认</a>
</div>
</div>
</Modal>
)
}
}
export default GraduationAcross;

View File

@ -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(
<div className="newMain clearfix">
{
questionslist &&
<div className={"educontent mb20"}>
<HomeworkModal
starttimes={this.state.starttimes}
typs={this.state.typs}
modalname={this.state.modalname}
visible={this.state.visible}
Topval={this.state.Topval}
Topvalright={this.state.Topvalright}
Botvalleft={this.state.Botvalleft}
Botval={this.state.Botval}
starttime={this.state.starttime}
endtime={this.state.endtime}
Cancelname={this.state.Cancelname}
Savesname={this.state.Savesname}
Cancel={this.state.Cancel}
Saves={this.state.Saves}
course_groups={this.state.course_groups}
modaltype={this.state.modaltype}
getcourse_groupslist={(id) => this.getcourse_groupslist(id)}
/>
{this.state.OneSelftype==true?<OneSelfOrderModal
{...this.props}
staytime={this.state.staytime}
starttimes={this.state.starttimes}
typs={this.state.typs}
modalname={this.state.modalname}
OneSelftype={this.state.OneSelftype}
Topval={this.state.Topval}
Topvalright={this.state.Topvalright}
Botvalleft={this.state.Botvalleft}
Botval={this.state.Botval}
starttime={this.state.starttime}
endtime={this.state.endtime}
Cancelname={this.state.Cancelname}
Savesname={this.state.Savesname}
Cancel={this.state.Cancel}
Saves={this.state.Saves}
course_groups={this.state.course_groups}
modaltype={this.state.modaltype}
getcourse_groupslist={(id) => this.getcourse_groupslist(id)}
starttimes={this.state.starttimes}
starttimesend={this.state.starttimesend}
typs={this.state.typs}
/>:""}
{/*关联项目*/}
{visibles===true?
<Associationmodel
modalname={"关联项目"}
visible={visibles}
Cancel={()=>this.Cancel()}
taskid={ questionslist && questionslist.task_id }
funlist={this.resetList}
/>
:""}
{this.state.avisible===true?<AccessoryModal
{...this.props}
modalname={"补交附件"}
visible={this.state.avisible}
Cancelname={"取消"}
Savesname={"确认"}
Cancel={this.Cancelvisible}
categoryid={questionslist.work_id}
setupdate={this.resetList}
/>:""}
{/*提示*/}
<Modals
modalsType={Modalstype}
modalsTopval={Modalstopval}
modalCancel={ModalCancel}
modalSave={ModalSave}
closable={false}
footer={null}
destroyOnClose={true}
centered={true}
/>
{
acrossVisible &&
<GraduationAcross
{...this.props}
{...this.state}
task_Id={task_Id}
modalVisible={acrossVisible}
modalCloss={this.closeAcross}
resetFun={this.resetList}
comment_status={ questionslist && questionslist.comment_status }
/>
}
<p className="clearfix mt10">
<a onClick={this.goback} className="color-grey-9 fl">{questionslist.course_name}</a>
<span className="color-grey-9 fl ml3 mr3">&gt;</span>
<Link to={`/classrooms/${courseId}/graduation_tasks/${category_id}`} className="color-grey-9 fl">{questionslist.graduation_name}</Link>
<span className="color-grey-9 fl ml3 mr3">&gt;</span>
<span className="color-grey-6">任务详情</span>
</p>
<div className="clearfix mt20 mb20 lineh-25 linbox">
<p className=" fl color-black summaryname">
<Link to={`/classrooms/${courseId}/graduation_tasks/${category_id}`} className="color-grey-3">{questionslist.task_name}</Link>
</p>
<CoursesListType
typelist={questionslist.task_status}
/>
<a className="color-grey-3 fr font-16 ml30 mr20" onClick={this.goback}>返回</a>
</div>
<div className="stud-class-set bor-bottom-greyE">
<div className="clearfix edu-back-white pl30 pr30 graduationTaskMenu">
<Link className={tab && tab == "list" ? "active" : ""} to={"/classrooms/"+courseId+"/graduation_tasks/"+category_id+"/detail/"+task_Id+"/list"}>任务列表</Link>
<Link className={tab && tab == "questions" ? "active" : ""} to={"/classrooms/"+courseId+"/graduation_tasks/"+category_id+"/detail/"+task_Id+"/questions"}>毕设描述</Link>
<Link className={tab && tab == "setting" ? "active" : ""} to={"/classrooms/"+courseId+"/graduation_tasks/"+category_id+"/detail/"+task_Id+"/setting?tab=3"}>设置</Link>
{/*<a className={"fr color-blue font-16"}>导出成绩</a>*/}
{/*{this.props.isAdmin()?<a href={"/api/graduation_tasks/"+task_Id+"/tasks_list.xls"} className={"fr color-blue font-16"}>导出成绩</a>:""}*/}
{/*{this.props.isAdmin()?<a href={"/api/graduation_tasks/"+task_Id+"/tasks_list.zip"} className={"fr color-blue font-16"}>导出作品附件</a>:""}*/}
<style>
{ `
.drop_down_menu{
height: 118px;
left:0px;
width: 121px;
}
.drop_down_menu li {
overflow: visible;
width: 121px;
}
.drop_down_menu li a{
padding: 0px;
font-size: 14px;
}
.mt19{
margin-top:19px;
}
.drop_down_menu, .drop_down_normal{
padding-top: 10px;
padding-bottom: 8px;
}
.drop_down_menu li .color-dark{
color: #666 !important;
}
.linbox{
height: 26px;
}
`}
</style>
{this.props.isAdmin()? <li className="li_line drop_down fr color-blue font-16 mt20" style={{"paddingLeft":"0px"}}>
导出<i className="iconfont icon-xiajiantou font-12 ml2"></i>
<ul className="drop_down_menu" style={{"right":"-34px","left":"unset","height":"auto"}}>
<li><a onClick={()=>this.child.confirmysl(`/graduation_tasks/${task_Id}/tasks_list.xlsx`)} className="color-dark">导出成绩</a></li>
<li><a onClick={()=>this.child.confirmysl(`/graduation_tasks/${task_Id}/tasks_list.zip`)} className="color-dark">导出作品附件</a></li>
</ul>
</li>:""}
{questionslist.work_status===undefined||questionslist.work_status===null||questionslist.work_status.length===0?"":questionslist.work_status.map((item,key)=>{
return(
<span key={key} className="fr mt20">
{item==="提交作品"?<a className={"fr color-blue font-16 ml20"} href={"/classrooms/"+courseId+"/graduation_tasks/"+category_id+"/works/"+task_Id+"/new"}>提交作品</a>:""}
{item==="补交作品"?<a className={"fr color-blue font-16 ml20"} href={"/classrooms/"+courseId+"/graduation_tasks/"+category_id+"/works/"+task_Id+"/new"}>补交作品</a>:""}
{item==="修改作品"?<a className={"fr color-blue font-16 ml20"} href={"/classrooms/"+courseId+"/graduation_tasks/"+category_id+"/works"+"/"+ questionslist.work_id + "/edit"}>修改作品</a>:""}
{item==="查看作品"?<a className={"fr color-blue font-16 ml20"} target="_blank" href={"/classrooms/"+courseId+"/graduation_tasks/"+ questionslist.work_id + "/appraise"}>查看作品</a> :""}
{item==="创建项目"?<a className={"fr color-blue font-16 ml20"} href={'/projects/new'} target="_blank">创建项目</a>:""}
{item==="关联项目"?<a className={"fr color-blue font-16 ml20"} onClick={this.AssociationItems}>关联项目</a>:""}
{item==="取消关联"?<a className={"fr color-blue font-16 ml20"} onClick={this.cannelAssociation}>取消关联</a>:""}
{item==="补交附件"?<a className={"fr color-blue font-16 ml20"} onClick={this.handaccessory}>补交附件</a>:""}
</span>
)
})}
{/*<a className={"fr color-blue font-16"}>项目在线质量检测</a>*/}
{ this.props.isAdmin() ? questionslist.status===1 ? <a className={"fr color-blue font-16 mr20"} onClick={() => { this.end()} }>立即截止</a> : "" : "" }
{ this.props.isAdmin() ? questionslist.status===0 ? <a className={"fr color-blue font-16 mr20"} onClick={() => { this.publish()} }>立即发布</a> : "" : "" }
{ this.props.isAdmin() && questionslist.cross_comment ? <a className={"fr color-blue font-16"} onClick={this.openAcross}>交叉评阅设置</a> : "" }
{ this.props.isAdmin() ? <a className={"fr color-blue font-16"} href={"/classrooms/"+courseId+"/graduation_tasks/"+task_Id+"/edit"}>编辑任务</a> : "" }
{ this.props.user&&this.props.user.admin===true || this.props.user&&this.props.user.business===true ? <a className={"fr color-blue font-16"} onClick={()=>this.CodeReview()}>代码评测</a> : "" }
</div>
</div>
<Switch {...this.props}>
{/*//毕设任务列表*/}
<Route exact path="/classrooms/:coursesId/graduation_tasks/:category_id/detail/:task_Id/list"
render={
(props) => (<GraduationTaskslist getsonar={(teacher_comment,task_status,course_group,cross_comment,search)=>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`}/>)
}
></Route>
<Route exact path="/classrooms/:coursesId/graduation_tasks/:category_id/detail/:task_Id/setting"
render={
(props) => (<GraduationTaskssetting {...this.props} {...props} {...this.state} {...commom} triggerRef={this.bindRef} setend_time={(time)=>this.setend_time(time)} tab={`setting`}/>)
}
></Route>
<Route exact path="/classrooms/:coursesId/graduation_tasks/:category_id/detail/:task_Id/questions"
render={
(props) => (<GraduationTasksquestions {...this.props} {...props} {...this.state} {...commom} triggerRef={this.bindRef} setend_time={(time)=>this.setend_time(time)} tab={`questions`}/>)
}></Route>
</Switch>
</div>
}
</div>
)
}
}
// CNotificationHOC() ( SnackbarHOC() ( TPMIndexHOC))
export default (GraduationTaskDetail) ;

View File

@ -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<newattachments.length; i++){
if(newattachments[i].id===file.id){
newattachments.splice(i, 1);
}
}
}
// this.setState({
// Modalstype:true,
// Modalstopval:response.data.message,
// ModalSave:this.cancelAttachment,
// Loadtype:true,
// attachments:newattachments
// })
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,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<newlist.length; i++){
for(var z=0; z<newcheckedValues.length; z++){
if(newlist[i].user_id===newcheckedValues[z]){
selects.push(newlist[i])
}
}
}
this.setState({
task_status:checkedValues,
selectmemberslist:selects
})
}
delecttask_status=(id)=>{
let{selectmemberslist,task_status}=this.state;
let newlist=task_status;
let selects=selectmemberslist;
for(var i=0; i<newlist.length; i++){
if(newlist[i]===id){
newlist.splice(i,1)
}
}
for(var z=0; z<selects.length; z++){
if(selects[z].user_id===id){
selects.splice(z,1)
}
}
console.log(newlist)
console.log(selects)
this.setState({
task_status:newlist,
selectmemberslist:selects
})
}
gocannel=()=>{
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.length<workslist.min_num){
this.setState({
minvalue:workslist.min_num,
setvalue:"小于",
minmaxtype:true
})
return
}else if(userids.length>workslist.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(
<React.Fragment>
<div>
<Spin size="large" spinning={this.state.spinnings}>
{/*提示*/}
<Modals
modalsType={Modalstype}
modalsTopval={Modalstopval}
modalCancel={ModalCancel}
modalSave={ModalSave}
loadtype={Loadtype}
/>
<Modal
keyboard={false}
title="提示"
visible={shixunsreplace}
closable={false}
footer={null}
>
<div className="task-popup-content">
<p className="task-popup-text-center font-16 ">还未上传附件</p>
<p className="task-popup-text-center font-16 pb20">是否确认提交作品?</p>
</div>
<div className="task-popup-submit clearfix">
<a className="task-btn task-btn-orange fr "
onClick={() => this.hidestartshixunsreplace()}>确认</a>
<a className="task-btn fr mr50"
onClick={() => this.hidestartshixunsreplacetwo()}>取消</a>
</div>
</Modal>
<div className="newMain clearfix">
<div className={"educontent mb20"}>
<p className="clearfix mt10">
{/*<WordsBtn style="grey" className="fl"> <Link to={"/classrooms/"+courseId+"/graduation"} className="color-grey-6">{workslist&&workslist.course_name}</Link></WordsBtn>*/}
{/*<span className="color-grey-9 fl ml3 mr3">&gt;</span>*/}
<WordsBtn style="grey" className="fl"> <a onClick={this.goback} className="color-grey-6">毕设任务</a></WordsBtn>
<span className="color-grey-9 fl ml3 mr3">&gt;</span>
<WordsBtn style="grey" className="fl"> <Link to={`/classrooms/${courseId}/graduation_tasks/${workslist && workslist.graduation_id}/detail/${workslist && workslist.task_id}/list`} className="color-grey-6">任务详情</Link></WordsBtn>
<span className="color-grey-9 fl ml3 mr3">&gt;</span>
{/*<WordsBtn style="grey" className="fl">*/}
{/*<Link to={"/classrooms/"+courseId+"/graduation/graduation_tasks/"+category_id} className="color-grey-6">{workslist&&workslist.task_name}</Link>*/}
{/*<span className="color-grey-9 ml3 mr3">&gt;</span>*/}
{/*</WordsBtn>*/}
<span>{this.props.current_user&&this.props.current_user.real_name} 修改作品</span>
</p>
<div style={{ width:'100%',height:'75px'}} >
<p className=" fl color-black mt25 summaryname">{ workslist && workslist.task_name }</p>
<a className="color-grey-6 fr font-16 ml30 mt10 mr20" onClick={this.goback}>返回</a>
</div>
{description&&description?
<div>
<Form>
<div className="stud-class-set pd20 coursenavbox edu-back-white" id={"valuestypes"}>
<style>{`
.uploadBtn.ant-btn {
border: none;
color: #4CACFF;
box-shadow: none;
background: transparent;
padding: 0 6px;
}
.ant-upload-list-item:hover .ant-upload-list-item-info{
background-color:#fff;
}
.upload_1 .ant-upload-list {
width: 350px;
}
.ant-form-item{
margin-bottom: 0px;
}
`}</style>
<Form.Item
label="内容"
className="mdInForm"
>
{getFieldDecorator('description', {
rules: [{
required: true, message: '请在此输入作品内容或附件的简要描述',
}, {
max: 5000, message: '最大限制为5000个字符',
}],
})(
<TPMMDEditor ref={this.mdRef} placeholder={'请在此输入作品内容或附件的简要描述最大限制5000个字符'} maxLent={"5000"}
mdID={'courseMessageMD'} initValue={description} className="courseMessageMD"></TPMMDEditor>
)}
</Form.Item>
<Upload {...uploadProps} className="upload_1">
<Button className="uploadBtn">
<Icon type="upload" /> 上传附件
</Button>
<span className={"color-grey-9"}>(单个文件150M以内)</span>
</Upload>
{/*{attachments&&attachments.map((item,key)=>{*/}
{/*return(*/}
{/*<div className="color-grey mt5"*/}
{/*key={key}*/}
{/*>*/}
{/*<a className="color-grey ml3">*/}
{/*<i className="font-14 color-green iconfont icon-fujian mr8" aria-hidden="true"></i>*/}
{/*</a>*/}
{/*<a*/}
{/*href={item.url}*/}
{/*className="mr12 color9B9B" length="58">*/}
{/*{item.title}*/}
{/*</a>*/}
{/*<span className="color656565 mt2 color-grey-6 font-12 mr8">*/}
{/*{item.filesize}*/}
{/*</span>*/}
{/*{item.delete===true?*/}
{/*<i className="font-14 iconfont icon-guanbi "*/}
{/*id={item.id}*/}
{/*onClick={()=>this.onAttachmentRemoves(item.id)}*/}
{/*aria-hidden="true">*/}
{/*</i>:""}*/}
{/*</div>*/}
{/*)*/}
{/*})}*/}
{/*<style>*/}
{/*{*/}
{/*`*/}
{/*.maxwidth500{*/}
{/*max-width:500px;*/}
{/*overflow: hidden;*/}
{/*text-overflow: ellipsis;*/}
{/*white-space: nowrap;*/}
{/*color: #05101a;*/}
{/*}*/}
{/*`*/}
{/*}*/}
{/*</style>*/}
{/*{this.state.fileList.length===0?"":this.state.fileList.map((item,key)=>{*/}
{/*return(*/}
{/*<p className="color-grey mt10" key={key} >*/}
{/*<a className="color-grey fl">*/}
{/*<i className="font-14 color-green iconfont icon-fujian mr8" aria-hidden="true"></i>*/}
{/*</a>*/}
{/*<span className="mr12 color9B9B maxwidth500 fl" length="58">*/}
{/*{item.name}*/}
{/*</span>*/}
{/*<span className="color656565 mt2 color-grey-6 font-12 mr8">*/}
{/*{item.response===undefined?"":bytesToSize(item.size)}*/}
{/*</span>*/}
{/*<i className="font-14 iconfont icon-guanbi "*/}
{/*id={item.response===undefined?"":item.response.id}*/}
{/*aria-hidden="true" onClick={()=>this.onAttachmentRemove(item.response===undefined?"":item.response.id&&item.response.id)}></i>*/}
{/*</p>*/}
{/*)*/}
{/*})}*/}
</div>
{workslist&&workslist.task_type===1?"":
<div className="stud-class-set pd20 coursenavbox edu-back-white"
style={{borderTop:'1px solid #ccc'}}
>
<Form.Item
label="小组成员"
>
<div>
<div className={"fl ml20"}>成员要求{workslist&&workslist.min_num}{workslist&&workslist.max_num}</div>
<Search
className={"fl mt5 ml20"}
style={{width:"270px"}}
placeholder="请输入姓名或学号搜索"
id="subject_search_input"
value={search}
onInput={this.inputSearchValue}
onSearch={this.searchValue}
autoComplete="off"
></Search>
</div>
<style>{`
.fonthidden{
overflow:hidden;
text-overflow:ellipsis;
white-space:nowrap
}
.width100{
width: 100px;
height: 24px;
}
img.edu-nodata-img {
width: 200px;
margin: 50px 90px 20px;
display: block;
}
.autos{
overflow: auto;
}
`}</style>
</Form.Item>
<div className={"ml20 mt10"} style={{width:"100%"}}>
<div className={"members fl autos"}
style={{paddingLeft: '9px'}}
onScroll={this.contentViewScroll}>
<CheckboxGroup value={task_status} onChange={this.funtaskstatus} style={{ paddingTop: '4px'}}>
{memberslist===undefined?"":memberslist.length===0? <div className="square-list clearfix">
<div className="edu-tab-con-box clearfix edu-txt-center">
<img className="edu-nodata-img mb20" src={getImageUrl("images/educoder/nodata.png")}/>
<p className="edu-nodata-p mb20">未找到包含{search}的学生</p>
</div>
</div>:memberslist&&memberslist.map((item,key)=>{
return(
<div key={key} style={{
width: '400px',
height: '30px'
}}>
<Checkbox value={item.user_id}
key={item.user_id}
checked={
task_status.map((item,key)=>{
return parseInt(task_status[key])===item.user_id?true:false
})
}
disabled={item.commit_status===true?true:false} className="fl "></Checkbox>
<div className={"fl ml5 fonthidden width100"} style={{width: '70px'}} title={item.user_name}>{item.user_name}</div>
<div className={"fl ml5 fonthidden width100 color-grey-9"}>{item.group_name}</div>
<div className={"fl ml5 color-grey-9 fonthidden width100"}>{item.student_id}</div>
<div className={"fl ml20"}>{item.commit_status===true?<span className={"color-orange"}>已提交</span> :""}</div>
</div>
)
})}
</CheckboxGroup>
</div>
<div className={"youjiangboxs"}>
<i className={"iconfont icon-youjiang fl ml20 mr20"}></i>
</div>
<div className={"members fl autos"}>
{selectmemberslist&&selectmemberslist.map((item,key)=>{
console.log(item)
if(item.group_name!=undefined) {
return (
<div key={key} style={{
width: '375px',
height: '30px',
display: item.user_name === undefined ? "none" : ""
}}>
<div className={"fl ml5 fonthidden width100"}
title={item.user_name}>{item.user_name}</div>
<div className={"fl ml5 fonthidden width100 color-grey-9"}>{item.group_name}</div>
<div className={"fl ml5 color-grey-9 fonthidden width100"}>{item.student_id}</div>
{key > 0 ?
<div className={"fr ml20"}><i className={"iconfont icon-shanchudiao fl color-grey-9"}
style={{marginTop: '-4px'}}
onClick={() => this.delecttask_status(item.user_id)}></i>
</div> : ""}
<div className={"both"}></div>
</div>
)
}
})}
</div>
<div className={"both"}>
</div>
{minmaxtype===true?<span className={"color-red mt20"}>
人数不能{setvalue+minvalue}个人
</span>:""}
</div>
</div>}
{/*<Form.Item></Form.Item>*/}
<div className="clearfix mt30 mb30">
<Button type="primary" onClick={this.handleSubmit} className="defalutSubmitbtn fl mr20">提交</Button>
<a onClick={this.goback} className="defalutCancelbtn fl">取消</a>
</div>
</Form>
</div>
:""}
</div>
</div>
</Spin>
</div>
</React.Fragment>
)
}
}
const GraduationTasksSubmiteditApp = Form.create({ name: 'coursesNew' })(GraduationTasksSubmitedit);
export default GraduationTasksSubmiteditApp;

View File

@ -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<newlist.length; i++){
for(var z=0; z<newcheckedValues.length; z++){
if(newlist[i].user_id===newcheckedValues[z]){
selects.push(newlist[i])
}
}
}
this.setState({
task_status:checkedValues,
selectmemberslist:selects
})
}
delecttask_status=(id)=>{
let{selectmemberslist,task_status}=this.state;
let newlist=task_status;
let selects=selectmemberslist;
for(var i=0; i<newlist.length; i++){
if(newlist[i]===id){
newlist.splice(i,1)
}
}
for(var z=0; z<selects.length; z++){
if(selects[z].user_id===id){
selects.splice(z,1)
}
}
this.setState({
task_status:newlist,
selectmemberslist:selects
})
}
onSearchKeywordKeyUp = (e) => {
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.length<workslist.min_num){
this.setState({
minvalue:workslist.min_num,
setvalue:"小于",
minmaxtype:true
})
return
}else if(userids.length>workslist.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(
<React.Fragment>
<div>
{/*提示*/}
<Spin size="large" spinning={this.state.spinnings}>
<Modals
modalsType={Modalstype}
modalsTopval={Modalstopval}
modalCancel={ModalCancel}
modalSave={ModalSave}
loadtype={Loadtype}
/>
<Modal
keyboard={false}
title="提示"
visible={shixunsreplace}
closable={false}
footer={null}
>
<div className="task-popup-content">
<p className="task-popup-text-center font-16 ">还未上传附件</p>
<p className="task-popup-text-center font-16 pb20">是否确认提交作品?</p>
</div>
<div className="task-popup-submit clearfix">
<a className="task-btn task-btn-orange fr "
onClick={() => this.hidestartshixunsreplace()}>确认</a>
<a className="task-btn fr mr50"
onClick={() => this.hidestartshixunsreplacetwo()}>取消</a>
</div>
</Modal>
<div className="newMain clearfix">
<div className={"educontent mb20"}>
<p className="clearfix mt10">
{/*<WordsBtn style="grey" className="fl"> <Link to={"/classrooms/"+courseId+"/graduation_tasks"} className="color-grey-6">{workslist&&workslist.course_name}</Link></WordsBtn>*/}
{/*<span className="color-grey-9 fl ml3 mr3">&gt;</span>*/}
<WordsBtn style="grey" className="fl"> <a onClick={this.goback} className="color-grey-6">毕设任务</a></WordsBtn>
<span className="color-grey-9 fl ml3 mr3">&gt;</span>
<WordsBtn style="grey" className="fl"> <Link to={"/classrooms/"+courseId+"/graduation_tasks/"+category_id+"/detail/"+task_Id+"/list"} className="color-grey-6">任务详情</Link></WordsBtn>
<span className="color-grey-9 fl ml3 mr3">&gt;</span>
{/*<WordsBtn style="grey" className="fl">*/}
{/*<Link to={"/classrooms/"+courseId+"/graduation/graduation_tasks/"+category_id} className="color-grey-6">{workslist&&workslist.task_name}</Link>*/}
{/*<span className="color-grey-9 ml3 mr3">&gt;</span>*/}
{/*</WordsBtn>*/}
<span>{this.props.current_user&&this.props.current_user.real_name} 提交作品</span>
</p>
<div style={{ width:'100%',height:'75px'}} >
<p className=" fl color-black mt25 summaryname">{workslist&&workslist.task_name}</p>
<a className="color-grey-6 fr font-16 ml30 mt10 mr20" onClick={this.goback}>返回</a>
</div>
{/*<Form onSubmit={GraduationTasksnewtype===true?this.handleSubmit:"return false"}*/}
{/*>*/}
<div className="stud-class-set pd20 coursenavbox edu-back-white" id={"valuestypes"}>
<style>{`
.uploadBtn.ant-btn {
border: none;
color: #4CACFF;
box-shadow: none;
background: transparent;
padding: 0 6px;
}
.ant-upload-list-item:hover .ant-upload-list-item-info{
background-color:#fff;
}
.upload_1 .ant-upload-list {
width: 350px;
}
`}</style>
<Form.Item
label="内容"
className={"contentbox mdInForm"}
>
{getFieldDecorator('description', {
rules: [{
required: true, message: '请在此输入作品内容或附件的简要描述',
}, {
max: 5000, message: '最大限制为5000个字符',
}],
})(
<TPMMDEditor ref={this.mdRef} placeholder={'请在此输入作品内容或附件的简要描述最大限制5000个字符'} maxLent={"5000"}
mdID={'courseMessageMD'} initValue={this.editTopic ? this.editTopic.content : ''} className="courseMessageMD"></TPMMDEditor>
)}
</Form.Item>
<Upload {...uploadProps} className="upload_1">
<Button className="uploadBtn">
<Icon type="upload" /> 上传附件
</Button>
<span className={"color-grey-9"}>(单个文件150M以内)</span>
</Upload>
{/*<style>*/}
{/*{*/}
{/*`*/}
{/*.maxwidth500{*/}
{/*max-width:500px;*/}
{/*overflow: hidden;*/}
{/*text-overflow: ellipsis;*/}
{/*white-space: nowrap;*/}
{/*color: #05101a;*/}
{/*}*/}
{/*`*/}
{/*}*/}
{/*</style>*/}
{/*{this.state.fileList.length===0?"":this.state.fileList.map((item,key)=>{*/}
{/*return(*/}
{/*<p className="color-grey mt10" key={key} >*/}
{/*<a className="color-grey fl">*/}
{/*<i className="font-14 color-green iconfont icon-fujian mr8" aria-hidden="true"></i>*/}
{/*</a>*/}
{/*<span className="mr12 color9B9B maxwidth500 fl" length="58">*/}
{/*{item.name}*/}
{/*</span>*/}
{/*<span className="color656565 mt2 color-grey-6 font-12 mr8">*/}
{/*{item.response===undefined?"":bytesToSize(item.size)}*/}
{/*</span>*/}
{/*<i className="font-14 iconfont icon-guanbi "*/}
{/*id={item.response===undefined?"":item.response.id}*/}
{/*aria-hidden="true" onClick={()=>this.onAttachmentRemove(item.response===undefined?"":item.response.id&&item.response.id)}></i>*/}
{/*</p>*/}
{/*)*/}
{/*})}*/}
</div>
{workslist&&workslist.task_type===1?"":
<div className="stud-class-set pd20 coursenavbox edu-back-white"
style={{borderTop:'0.5px solid #ccc'}}
>
<Form.Item
label="小组成员"
>
<div>
<div className={"fl ml20"}>成员要求{workslist&&workslist.min_num}{workslist&&workslist.max_num}</div>
<input type="text" style={{width:"0px",height:"0px",display:"none"}} onKeyUp={(e) => this.onSearchKeywordKeyUp(e)}
onkeydown={(e)=>this.onSearchKeywordKeyUps(e)}/>
<Search
style={{width:"0px",height:"0px",display:"none"}}
onKeyUp={(e) => this.onSearchKeywordKeyUp(e)}
onkeydown={(e)=>this.onSearchKeywordKeyUps(e)}
onPressEnter={this.onKeywordSearchKeyDown}
autoComplete="off"
></Search>
<Search
className={"fl mt5 ml20"}
style={{width:"270px"}}
placeholder="请输入姓名或学号搜索"
id="subject_search_input"
value={search}
onInput={this.inputSearchValue}
onSearch={this.searchValue}
onPressEnter={this.onKeywordSearchKeyDown}
onKeyUp={(e) => this.onSearckeyd(e)}
autoComplete="off"
></Search>
<input type="text" style={{display: "none",height:0, width: 0, border: "none"}}/>
</div>
</Form.Item>
<style>{`
.fonthidden{
overflow:hidden;
text-overflow:ellipsis;
white-space:nowrap
}
.width100{
width: 100px;
height: 24px;
}
img.edu-nodata-img {
width: 200px;
margin: 50px 90px 20px;
display: block;
}
.autos{
overflow: auto;
}
`}</style>
<div className={"ml20"} style={{width:"100%"}}>
<div className={"members fl autos"}
style={{paddingLeft: '9px'}}
onScroll={this.contentViewScroll}>
<CheckboxGroup value={task_status} onChange={this.funtaskstatus} style={{ paddingTop: '4px'}}>
{memberslist===undefined?"":memberslist.length===0?
<div className="square-list clearfix">
<div className="edu-tab-con-box clearfix edu-txt-center">
<img className="edu-nodata-img mb20" src={getImageUrl("images/educoder/nodata.png")}/>
{/*<p className="edu-nodata-p mb20">未找到包含{search}的学生</p>*/}
<p className="edu-nodata-p mb20">未找到该学生</p>
</div>
</div>:memberslist&&memberslist.map((item,key)=>{
return(
<div key={key} style={{
width: '375px',
height: '30px'
}}>
<Checkbox value={item.user_id} key={item.user_id} checked={
task_status.map((item,key)=>{
return parseInt(task_status[key])===item.user_id?true:false
})
}
disabled={item.commit_status===true?true:false} className="fl "></Checkbox>
<div className={"fl ml5 fonthidden width100"} title={item.user_name} >{item.user_name}</div>
<div className={"fl ml5 fonthidden width100 color-grey-9"} title={item.group_name}>{item.group_name}</div>
<div className={"fl ml5 color-grey-9 fonthidden width100"} title={item.student_id}>{item.student_id}</div>
<div className={"fl ml20"}>{item.commit_status===true?<span className={"color-orange"}>已提交</span> :""}</div>
</div>
)
})}
</CheckboxGroup>
</div>
<div className={"youjiangboxs"}>
<i className={"iconfont icon-youjiang fl ml20 mr20"}></i>
</div>
<style>{`
.fonthidden{
overflow:hidden;
text-overflow:ellipsis;
white-space:nowrap
}
`}</style>
<div className={"members fl autos"}>
{selectmemberslist&&selectmemberslist.map((item,key)=>{
if(item.group_name!=undefined){
return(
<div key={key} style={{
width: '375px',
height: '30px',
display:item.user_name===undefined?"none":""
}}>
<div className={"fl ml5 fonthidden width100"} title={item.user_name}>{item.user_name}</div>
<div className={"fl ml5 fonthidden width100 color-grey-9"}>{item.group_name}</div>
<div className={"fl ml5 color-grey-9 fonthidden width100"}>{item.student_id}</div>
{key>0?<div className={"fr ml20"}><i className={"iconfont icon-shanchudiao fl color-grey-9 "} style={{marginTop:'-4px'}} onClick={()=>this.delecttask_status(item.user_id)}></i></div>:""}
</div>
)
}
})}
</div>
<div className={"both"}>
</div>
{minmaxtype===true?<span className={"color-red mt20"}>
人数不能{setvalue+minvalue}个人
</span>:""}
</div>
</div>}
<Form.Item>
<div className="clearfix mt30 mb30">
<Button type="primary" onClick={this.handleSubmit} className="defalutSubmitbtn fl mr20">提交</Button>
<a onClick={this.goback} className="defalutCancelbtn fl">取消</a>
</div>
</Form.Item>
{/*</Form>*/}
</div>
</div>
</Spin>
</div>
</React.Fragment>
)
}
}
const GraduationTasksSubmitnewApp = Form.create({ name: 'coursesNew' })(GraduationTasksSubmitnew);
export default GraduationTasksSubmitnewApp;

View File

@ -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(
<React.Fragment>
<div>
{/*提示*/}
<Modals
modalsType={Modalstype}
modalsTopval={Modalstopval}
modalCancel={ModalCancel}
modalSave={ModalSave}
loadtype={loadtype}
/>
<AccessoryModal
{...this.props}
modalname={"补交附件"}
visible={visible}
Cancelname={"取消"}
Savesname={"确认"}
Cancel={this.Cancelvisible}
categoryid={category_id}
setupdate={this.setupdate}
/>
<div className="newMain clearfix appraise ">
<div className={"educontent mb20"}>
<p className="clearfix mt10">
<a onClick={this.goback} className="color-grey-9 fl">{datalist&&datalist.course_name}</a>
<span className="color-grey-9 fl ml3 mr3">&gt;</span>
<Link to={"/classrooms/"+courseId+"/graduation_tasks/"+graduation_id} className="color-grey-9 fl">{datalist&&datalist.graduation_name}</Link>
<span className="color-grey-9 fl ml3 mr3">&gt;</span>
<Link to={"/classrooms/"+courseId+"/graduation_tasks/"+graduation_id+"/detail/"+task_id+"/list"} className="color-grey-9 fl">任务详情</Link>
<span className="color-grey-9 fl ml3 mr3">&gt;</span>
<span className="color-grey-6 fl">{datalist&&datalist.author_name}</span>
</p>
<style>
{
`
.mt23{
margin-top:23px;
}
`
}
</style>
<div className="mt20 mb20 clearfix lineh-25">
<p className="fl color-black summaryname lineh-25">{datalist&&datalist.task_name}</p>
<CoursesListType
typelist={datalist&&datalist.status}
/>
<a className="color-grey-6 fr font-16 mr20" onClick={this.goback}>返回</a>
{this.props.isStudent()?
datalist&&datalist.task_status===2?
<a className={"fr color-blue font-16 mr20"} onClick={this.addAccessory}>补交附件</a>:""
:""}
</div>
<div className="edu-back-white">
<div className={"stud-class-set edu-back-white padding20-30"}>
<div className={"color-grey-6 h20 mb20"}>
内容
</div>
<div className={"ml20"}>
<div className="markdown-body" dangerouslySetInnerHTML={{__html: markdownToHTML(datalist&&datalist.description===null?"--":datalist&&datalist.description).replace(/▁/g,"▁▁▁")}}></div>
</div>
{/*<div className={"color-grey-6 h20 ml20"}>*/}
{/*<span>15M</span>*/}
{/*<span className={"mr10 color656565"}>文件包名称</span>*/}
{/*<span className={"mr10 color9B9B"}>15M</span>*/}
{/*</div>*/}
{datalist&& datalist.attachments && datalist.attachments.map((item,key)=>{
return(
<div className="color-grey" key={key}>
<a className="color-grey ml20">
<i className="font-14 color-green iconfont icon-fujian mr8" aria-hidden="true"></i>
</a>
<a href={item.url}
className="mr12 color9B9B" length="58">
{item.title}
</a>
<span className="color656565 mt2 color-grey-6 font-12 mr8">{item.filesize}</span>
{/*{item.delete===true?<i className="font-14 iconfont icon-guanbi " id={item.id} aria-hidden="true" onClick={()=>this.onAttachmentRemove(item.id)}></i>:""}*/}
</div>
)
})}
<div className={"color-grey-6 lineh-25 clearfix ml20"}>
{/*<span className={"color9B9B fr"}>更新</span>*/}
{/*<span className={"fr font-13 mr10 ml10"}>{datalist&&datalist.update_user_name}</span>*/}
{/*<span className={"color9B9B fr"}>*/}
{/*{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')}*/}
{/*</span>*/}
<span className={"color9B9B fr"}>提交</span>
<span className={"fr font-13 mr10 ml10"}>{datalist&&datalist.author_name}</span>
<span className={" color9B9B fr"}>
{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')}
</span>
</div>
</div>
{firelistdata===undefined?"":firelistdata.length===0?"":firelistdata.revise_attachments.length===0?"":
<div className={"stud-class-set bor-top-greyE padding20-30 edu-back-white"}>
<div className={"color-grey-6 mb10 "}>
补交附件
</div>
<div className={"ml20"} style={{"white-space":"pre-wrap","word-break": "break-all","word-wrap": "break-word"}}>
补交原因{firelistdata&&firelistdata.revise_reason}
</div>
<div className="color-grey">
{firelistdata===undefined?"":firelistdata.length===0?"":firelistdata.revise_attachments.map((item,key)=>{
return(
<span>
<a className="color-grey ml20">
<i className="font-14 color-green iconfont icon-fujian mr8" aria-hidden="true"></i>
</a>
<a href={item.url}
className="mr12 color9B9B" length="58">
{item.title}
</a>
<span className="color656565 mt2 color-grey-6 font-12 mr8">{item.filesize}</span>
{item.delete===true?<i className="font-14 iconfont icon-guanbi " id={item.id} aria-hidden="true" onClick={()=>this.onAttachmentRemove(item.id)}></i>:""}
</span>
)
})}
</div>
<div className={"color-grey-6 lineh-25 clearfix ml20"}>
<span className={"color9B9B fr"}>更新</span>
<span className={"fr font-13 mr10 ml10"}>{firelistdata&&firelistdata.atta_update_user}</span>
<span className={"color9B9B fr"}>
{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')}
</span>
</div>
</div>}
{datalist&&datalist.project_info===undefined?"":
<div className={"stud-class-set edu-back-white padding20-30 bor-top-greyE"}>
<div className={"color-grey-6 mb10"}>
关联项目
</div>
<div className={"ml20"}>
{datalist&&datalist.project_info.name}
</div>
</div>}
{/*{*/}
{ datalist === undefined?"": datalist && datalist.task_type===undefined ?"" : datalist.task_type===1? "": datalist && datalist.work_members && datalist.work_members.length == 0 ?"":
<div className={"stud-class-set edu-back-white padding20-30 bor-top-greyE"} style={{height:"100%"}}>
<div className={"color-grey-6 mb10"}>
其他组员
</div>
<div className={"both"}></div>
{datalist.work_members.map((item,key)=>{
return(
<div className={"fl mr20 ml20"} key={key} id={item.user_id}>
{item.user_name}
</div>
)
})}
<div className={"both"}></div>
</div>
}
</div>
<GraduationTasksappraiseReply {...this.props} task_id={datalist&&datalist.task_id} task_type={datalist&&datalist.task_type}></GraduationTasksappraiseReply>
</div>
</div>
</div>
</React.Fragment>
)
}
}
export default GraduationTasksappraise;

View File

@ -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(
<React.Fragment>
<div className="mainEditor color-grey-6">
<style>{`
.editorInputError .editormd {
border: 1px solid red;
}
.numberInputError.ant-input-number {
border: 1px solid red;
}
.upload_mainEditor .ant-upload-list-item {
margin-bottom: 8px;
}
.newuploads{
margin-top: -5px;
display: block;
margin-bottom: 8px;
}
.mainEditor {
padding: 0 10px;
padding-bottom: 8px;
}
.mainEditorTitle {
margin-bottom: 6px;
}
`}</style>
{this.props.title && <span className="mainEditorTitle color-grey-6">{this.props.title}</span>}
<TPMMDEditor ref={this.mdRef} mdID={'appraiseEditor'} placeholder={placeholder || "请在此输入对本作品的评语最大限制2000个字符"}
watch={false} height={160} className={errorMessage&&errorMessagetype!=true ? 'editorInputError' : ''} imageExpand={true}></TPMMDEditor>
{ showSameScore == true && <div>
<Checkbox checked={same_score} onChange={this.same_score_change}>整组同评</Checkbox>
<span className={"font-14 color-grey-9"}>(选中则本次评阅对象指小组全部成员否则仅评阅此成员1人 )</span>
</div> }
<Upload {...commentUploadProp} className="upload_mainEditor upload_1 newuploads">
<Button className="uploadBtn">
<Icon type="upload" /> 上传附件
</Button>
(单个文件150M以内)
</Upload>
<div style={{height: '36px'}}>
<div style={{ float: 'left' }}>
<InputNumber placeholder="请填写分数" value={score} onChange={this.onScoreChange} className={numberErrorMessage ? 'numberInputError' : ''}
style={{width:"120px", marginRight: '6px'}}
min={0} max={100} precision={1} size="large"
></InputNumber>
</div>
{ (errorMessage || numberErrorMessage) && <span className="fl" style={{color: 'red', marginTop: '6px', marginLeft: '10px'}}>{errorMessage || numberErrorMessage}</span> }
<a className="task-btn task-btn-orange fr mt4" style={{height: '30px', width: '100px'}}
onClick={this.onSubmit}
>提交</a>
<a onClick={this.onCancel} className="defalutCancelbtn fr mt4"
style={{height: '30px', width: '100px', fontSize: '14px', lineHeight: '30px', marginRight: '20px'}}>清空</a>
</div>
</div>
</React.Fragment>
)
}
}
export default (GraduationTasksappraiseMainEditor);

View File

@ -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;
}

View File

@ -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(
<React.Fragment>
{comment_scores.length===0&&isStudent===true||comment_scores.length===0&&isNotMember===true? "": <div className="edu-back-white" style={{marginTop: '16px'}}>
{isStudent===true?
<GraduationTasksappraiseReplyChild
{...this.props}
{...this.state}
cancelmodel={this.cancelmodel}
showModulationtype={(id)=>this.showModulationtype(id)}
saveModulationModal={(value,num)=>this.saveModulationModal(value,num)}
addSuccess={this.addSuccess}
onDelete={this.onDelete}
/>
: <GraduationTasksappraiseReplyChild {...this.state} {...this.props}
cancelmodel={this.cancelmodel}
showModulationtype={(id)=>this.showModulationtype(id)}
saveModulationModal={(value,num)=>this.saveModulationModal(value,num)}
addSuccess={this.addSuccess}
onDelete={this.onDelete}
/>
}
</div>
}
</React.Fragment>
)
}
}
export default ImageLayerOfCommentHOC() (GraduationTasksappraiseReply);
{/*<div id="forum_list" className="forum_table">*/}
{/*<div className="mh650 edu-back-white">*/}
{/*<div*/}
{/*className="edu-tab-con-box clearfix edu-txt-center">*/}
{/*<img className="edu-nodata-img mb20"*/}
{/*src={getImageUrl("images/educoder/nodata.png")}/>*/}
{/*<p className="edu-nodata-p mb30">暂时还没有相关数据哦!</p>*/}
{/*</div>*/}
{/*</div>*/}
{/*</div>*/}

View File

@ -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(
<React.Fragment>
<div className={`${comment_scores && comment_scores.length && 'bor-bottom-greyE'} stud-class-set edu-back-white mb10 padding20-30 `}
style={{height:"100%"}}>
<Modals
modalsType={this.props.Modalstype}
modalsTopval={this.props.Modalstopval}
modalCancel={this.props.ModalCancel}
modalSave={this.props.ModalSave}
closable={false}
footer={null}
destroyOnClose={true}
centered={true}
/>
{this.props.Modulationtype===true?<ModulationModal
modalname={"调分"}
visible={this.props.Modulationtype}
Cancelname={"取消"}
Savesname={"保存"}
Cancel={this.props.cancelmodel}
Saves={(value,num)=>this.props.saveModulationModal(value,num)}
closable={false}
footer={null}
destroyOnClose={true}
centered={true}
/>:""}
{/*<div style={{ width:'100%',height:'75px'}} >*/}
{/*<p className=" fl color-black mt25 summaryname">{datalist&&datalist.task_name}</p>*/}
{/*<a className="color-grey-6 fr font-16 mt10 mr20" onClick={this.goback}>返回</a>*/}
{/*{this.props.isStudent()?<a className={"fr color-blue font-16 mt10 mr20"} onClick={this.addAccessory}>补交附件</a>:""}*/}
{/*</div>*/}
{this.props.ultimate===true? isAdmin &&
<div style={{ width:'100%',height:'75px'}} >
<a className={"fr color-blue font-16 mt10 mr20"} onClick={()=>this.props.showModulationtype(this.props.task_id)}>调分</a>
</div>
:""}
{this.props.ultimate===true?"":<div className={"color-grey-6 mb10"}>
<span className="labal">全部评阅</span>
{ !!comment_scores.length && <span className="count">
{comment_scores.length===0?"":`(${comment_scores.length})`}
</span> }
</div>}
{this.props.ultimate===true ? "": isAdmin && <GraduationTasksappraiseMainEditor {...this.props}
addSuccess={() => this.props.addSuccess()}
showSameScore={this.props.task_type == 2}
></GraduationTasksappraiseMainEditor> }
</div>
{!!comment_scores.length && <div className={"stud-class-set edu-back-white mb10"} style={{height:"100%"}}>
<div className="padding20 memoReplies commentsDelegateParent course-message"
style={{ paddingTop: '0px', paddingBottom: '0px' }}
>
<style>{`
`}</style>
<div className="panel-comment_item">
{ comment_scores.map(item => {
return <Graduationtaskitem item={item} onDelete={this.props.onDelete} {...this.props}></Graduationtaskitem>
}) }
</div>
</div>
</div> }
</React.Fragment>
)
}
}
export default ImageLayerOfCommentHOC() (GraduationTasksappraiseReplyChild);

View File

@ -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(
<React.Fragment>
<div>
{/*提示*/}
<Modals
modalsType={Modalstype}
modalsTopval={Modalstopval}
modalCancel={ModalCancel}
modalSave={ModalSave}
loadtype={Loadtype}
/>
<Modal
keyboard={false}
title="提示"
visible={shixunsreplace}
closable={false}
footer={null}
>
<div className="task-popup-content">
<p className="task-popup-text-center font-16 ">还未上传附件</p>
<p className="task-popup-text-center font-16 pb20">是否确认提交作品?</p>
</div>
<div className="task-popup-submit clearfix">
<a className="task-btn task-btn-orange fr "
onClick={() => this.hidestartshixunsreplace()}>确认</a>
<a className="task-btn fr mr50"
onClick={() => this.hidestartshixunsreplacetwo()}>取消</a>
</div>
</Modal>
<div className="newMain clearfix">
<div className={"educontent mb20"}>
<p className="clearfix mt10">
<WordsBtn style="grey" className="fl">
<Link to={`/classrooms/${graduationtask_id}`} className="color-grey-6">{this.props.current_user&&this.props.current_user.course_name}</Link>
</WordsBtn>
<span className="color-grey-9 fl ml3 mr3">&gt;</span>
<WordsBtn style="grey" className="fl"> <Link to={"/classrooms/"+courseId+"/graduation_tasks/"+graduationtask_id} className="color-grey-6">毕设任务</Link></WordsBtn>
<span className="color-grey-9 fl ml3 mr3">&gt;</span>
{name===""?"":
<WordsBtn style="grey" className="fl">
<Link to={"/classrooms/"+courseId+"/graduation_tasks/"+graduationtask_id+"/detail/"+category_id+"/list"} className="color-grey-6">{name}</Link>
<span className="color-grey-9 ml3 mr3">&gt;</span>
</WordsBtn>
}
<span>{"编辑"}</span>
</p>
<div style={{ width:'100%',height:'75px'}} >
<p className=" fl color-black mt25 summaryname">编辑毕设任务</p>
<a className="color-grey-6 fr font-16 ml30 mt10 mr20" onClick={this.goback}>返回</a>
</div>
{description===undefined?"":
<div>
<div className="stud-class-set bor-bottom-greyE pt20 pl20 pr20 pb0 edu-back-white">
<Form.Item label="类型">
{getFieldDecorator('tasktype', {
rules: [{ required: true, message: "请选择任务类型" }],
})(<Select className={"greyInput"}
style={{width:'20%'}}
disabled={true}
placeholder="请选择任务类型">
<Option value={1}>普通</Option>
<Option value={2}>分组</Option>
</Select>)}
<input type="hidden" id='tasktypes' />
<span className={"newcoursestitle"}>选择确认后无法修改</span>
</Form.Item>
<style>
{
`
.yslgraduainputedit .ant-input{
border-right: none !important;
height: 40px !important;
}
`
}
</style>
<Form.Item label="任务标题" >
{getFieldDecorator('name', {
rules: [{ required: true, message: "请输入标题" }],
})(<Input placeholder="请输入任务名称最大限制60个字符" value={name} onInput={this.changeTitle} className="searchView searchViewAfter yslgraduainputedit" style={{"width":"100%"}} maxLength="60" addonAfter={String(title_num)+"/60"}/>)}
</Form.Item>
<input type="hidden" id='nametypes' />
</div>
<div className="stud-class-set pt20 pl20 pr20 pb0 coursenavbox edu-back-white">
<style>{`
.uploadBtn.ant-btn {
border: none;
color: #4CACFF;
box-shadow: none;
background: transparent;
padding: 0 6px;
}
.ant-upload-list-item:hover .ant-upload-list-item-info{
background-color:#fff;
}
.upload_1 .ant-upload-list {
width: 350px;
}
`}</style>
<Form.Item
label="内容"
className="mdInForm"
style={{marginBottom:'0px'}}
>
{getFieldDecorator('description', {
rules: [{
required: true, message: '请输入内容',
},{
max:5000,message:'最大限制5000个字符'
}],
})(
<TPMMDEditor ref={this.mdRef} placeholder={'请输入任务内容说明最大限制5000个字符'} {...this.state} {...this.props}
mdID={'courseMessageMD'} initValue={description} className="courseMessageMD"></TPMMDEditor>
)}
</Form.Item>
<input type="hidden" id='descriptiontypes' />
{/*<AttachmentList {...this.props} {...this.state} attachments={attachments&&attachments}></AttachmentList>*/}
{/*{attachments&&attachments.map((item,key)=>{*/}
{/*return(*/}
{/*<div className="color-grey mt5"*/}
{/*key={key}*/}
{/*>*/}
{/*<a className="color-grey ml3">*/}
{/*<i className="font-14 color-green iconfont icon-fujian mr8" aria-hidden="true"></i>*/}
{/*</a>*/}
{/*<a*/}
{/*href={item.url}*/}
{/*className="mr12 color9B9B" length="58">*/}
{/*{item.title}*/}
{/*</a>*/}
{/*<span className="color656565 mt2 color-grey-6 font-12 mr8">*/}
{/*{item.filesize}*/}
{/*</span>*/}
{/*{item.delete===true?*/}
{/*<i className="font-14 iconfont icon-guanbi "*/}
{/*id={item.id}*/}
{/*onClick={()=>this.onAttachmentRemove(item.id)}*/}
{/*aria-hidden="true">*/}
{/*</i>:""}*/}
{/*</div>*/}
{/*)*/}
{/*})}*/}
<Upload {...uploadProps} fileList={this.state.fileList} className="upload_1 ml5">
<Button className="uploadBtn">
<Icon type="upload" /> 上传附件
</Button>
(单个文件150M以内)
</Upload>
{/*<style>*/}
{/*{*/}
{/*`*/}
{/*.maxwidth500{*/}
{/*max-width:500px;*/}
{/*overflow: hidden;*/}
{/*text-overflow: ellipsis;*/}
{/*white-space: nowrap;*/}
{/*color: #05101a;*/}
{/*}*/}
{/*`*/}
{/*}*/}
{/*</style>*/}
{/*{this.state.fileList.length===0?"":this.state.fileList.map((item,key)=>{*/}
{/*return(*/}
{/*<p className="color-grey mt10" key={key} >*/}
{/*<a className="color-grey fl">*/}
{/*<i className="font-14 color-green iconfont icon-fujian mr8" aria-hidden="true"></i>*/}
{/*</a>*/}
{/*<span className="mr12 color9B9B maxwidth500 fl" length="58">*/}
{/*{item.name}*/}
{/*</span>*/}
{/*<span className="color656565 mt2 color-grey-6 font-12 mr8">*/}
{/*{item.response===undefined?"":bytesToSize(item.size)}*/}
{/*</span>*/}
{/*<i className="font-14 iconfont icon-guanbi "*/}
{/*id={item.response===undefined?"":item.response.id}*/}
{/*aria-hidden="true" onClick={()=>this.onAttachmentRemove(item.response===undefined?"":item.response.id&&item.response.id)}></i>*/}
{/*</p>*/}
{/*)*/}
{/*})}*/}
{/*{attachments&&attachments.map((item,key)=>{*/}
{/*return(*/}
{/*<div className="color-grey mt5"*/}
{/*key={key}*/}
{/*>*/}
{/*<a className="color-grey ml3">*/}
{/*<i className="font-14 color-green iconfont icon-fujian mr8" aria-hidden="true"></i>*/}
{/*</a>*/}
{/*<a*/}
{/*href={item.url}*/}
{/*className="mr12 color9B9B" length="58">*/}
{/*{item.title}*/}
{/*</a>*/}
{/*<span className="color656565 mt2 color-grey-6 font-12 mr8">*/}
{/*{item.filesize}*/}
{/*</span>*/}
{/*{item.delete===true?*/}
{/*<i className="font-14 iconfont icon-guanbi "*/}
{/*id={item.id}*/}
{/*onClick={()=>this.onAttachmentRemove(item)}*/}
{/*aria-hidden="true">*/}
{/*</i>:""}*/}
{/*</div>*/}
{/*)*/}
{/*})}*/}
</div>
<Form.Item>
<div className="clearfix mt30 mb30">
<Button type="primary" htmlType="submit" onClick={()=>this.handleSubmit()} className="defalutSubmitbtn fl mr20">提交</Button>
<a onClick={this.goback} className="defalutCancelbtn fl">取消</a>
</div>
</Form.Item>
{/*</Form>*/}
</div>
}
</div>
</div>
</div>
</React.Fragment>
)
}
}
const GraduationTaskseditApp = Form.create({ name: 'coursesNew' })(GraduationTasksedit);
export default GraduationTaskseditApp;

View File

@ -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 (
<React.Fragment>
<div>
{/*提示*/}
<Modals
modalsType={Modalstype}
modalsTopval={Modalstopval}
modalCancel={ModalCancel}
modalSave={ModalSave}
/>
<Modal
keyboard={false}
title="提示"
visible={shixunsreplace}
closable={false}
footer={null}
>
<div className="task-popup-content">
<p className="task-popup-text-center font-16 ">还未上传附件</p>
<p className="task-popup-text-center font-16 pb20">是否确认提交作品?</p>
</div>
<div className="task-popup-submit clearfix">
<a className="task-btn task-btn-orange fr "
onClick={() => this.hidestartshixunsreplace()}>确认</a>
<a className="task-btn fr mr50"
onClick={() => this.hidestartshixunsreplacetwo()}>取消</a>
</div>
</Modal>
<div className="newMain clearfix">
<div className={"educontent mb20"}>
<p className="clearfix mt10">
<WordsBtn style="grey" className="fl"> <a onClick={this.goback} className="color-grey-6">{this.props.current_user && this.props.current_user.course_name}</a></WordsBtn>
<span className="color-grey-9 fl ml3 mr3">&gt;</span>
<WordsBtn style="grey" className="fl"> <Link
to={"/classrooms/" + courseId + "/graduation_tasks/" + category_id} className="color-grey-6">毕设任务</Link></WordsBtn>
<span className="color-grey-9 fl ml3 mr3">&gt;</span>
<span>{"新建"}</span>
</p>
<div style={{width: '100%', height: '60px'}}>
<p className=" fl color-black mt20 summaryname">新建毕设任务</p>
<a className="color-grey-6 fr font-16 ml30 mt10 mr20" onClick={this.goback}>返回</a>
</div>
{/*<Form*/}
{/* onSubmit={GraduationTasksnewtype === true ? this.handleSubmit : ""}>*/}
<style>
{
`.ant-form-item-label{
text-align: right;
vertical-align: middle;
padding: 0px 0px 20px 0px;
display: inline-block;
overflow: hidden;
white-space: nowrap;
line-height: 20px; */
}
.ant-form-item-control{
line-height: 39.9999px;
position: relative;
zoom: 1;
}
`
}
</style>
{/*内容*/}
<div className="stud-class-set bor-bottom-greyE pt20 pl20 pr20 pb25 edu-back-white">
<style>
{
`
.tasktype .ant-form-explain{
margin-top: -20px;
margin-bottom: 15px;
}
`
}
</style>
<Form.Item label="类型" className={"tasktype"}>
{getFieldDecorator('tasktype', {
rules: [{required: true, message: "请选择任务类型"}],
})(<Select className={"greyInput mb20"}
style={{width: '20%'}}
placeholder="请选择任务类型">
<Option value="1">普通</Option>
<Option value="2">分组</Option>
</Select>)}
<input type="hidden" id='tasktypes'/>
<span className={"newcoursestitle"}>选择确认后无法修改</span>
</Form.Item>
<style>
{
`
.taskname .ant-form-explain{
margin-top: 0px;
margin-bottom: 0px;
}
.yslgts .ant-input{
border-right: none !important;
height: 40px !important;
}
`
}
</style>
<Form.Item label="任务标题" className={"taskname"} >
{getFieldDecorator('name', {
rules: [{required: true, message: "不能为空"}],
})(
<Input placeholder="请输入任务名称最大限制60个字符" value={title_value} onInput={this.changeTitle}
className="searchView searchViewAfter h40 yslgts" style={{"width": "100%"}} maxLength="60"
addonAfter={String(title_num)+"/60"}/>
)}
</Form.Item>
<input type="hidden" id='nametypes' />
</div>
<div className="stud-class-set pd20 coursenavbox edu-back-white">
<style>{`
.uploadBtn.ant-btn {
border: none;
color: #4CACFF;
box-shadow: none;
background: transparent;
padding: 0 6px;
}
.ant-upload-list-item:hover .ant-upload-list-item-info{
background-color:#fff;
}
.upload_1 .ant-upload-list {
width: 350px;
}
.ant-form-item{
margin-bottom:0px
}
`}</style>
<Form.Item
label="内容"
className="mdInForm "
>
{getFieldDecorator('description', {
rules: [{
required: true, message: '请输入内容',
},{
max:5000,message:'最大限制5000个字符'
}]
})(
<TPMMDEditor ref={this.mdRef} placeholder={'请输入任务内容说明最大限制5000个字符'}
mdID={'courseMessageMD'} className="courseMessageMD"></TPMMDEditor>
)}
</Form.Item>
<input type="hidden" id='descriptiontypes'/>
<style>
{
`
.upload_1 .ant-upload-list{
width: 560px;
}
`
}
</style>
<Upload {...uploadProps} className="upload_1 ml5">
<Button className="uploadBtn">
<Icon type="upload"/> 上传附件
</Button>
(单个文件150M以内)
</Upload>
{/*{this.state.fileList.length===0?"":this.state.fileList.map((item,key)=>{*/}
{/*return(*/}
{/*<p className="color-grey mt10" key={key} >*/}
{/*<a className="color-grey fl">*/}
{/*<i className="font-14 color-green iconfont icon-fujian mr8" aria-hidden="true"></i>*/}
{/*</a>*/}
{/*<span className="mr12 color9B9B maxwidth500 fl" length="58">*/}
{/*{item.name}*/}
{/*</span>*/}
{/*<span className="color656565 mt2 color-grey-6 font-12 mr8">*/}
{/*{item.response===undefined?"":bytesToSize(item.size)}*/}
{/*</span>*/}
{/*<i className="font-14 iconfont icon-guanbi "*/}
{/*id={item.response===undefined?"":item.response.id}*/}
{/*aria-hidden="true" onClick={()=>this.onAttachmentRemove(item.response===undefined?"":item.response.id&&item.response.id)}></i>*/}
{/*</p>*/}
{/*)*/}
{/*})}*/}
</div>
<Form.Item>
<div className="clearfix mt30 mb30">
<Button type="primary" htmlType="submit" onClick={()=>this.handleSubmit()} className="defalutSubmitbtn fl mr20">提交</Button>
<a onClick={this.goback} className="defalutCancelbtn fl">取消</a>
</div>
</Form.Item>
{/*</Form>*/}
</div>
</div>
</div>
</React.Fragment>
)
}
}
const GraduationTasksnewApp = Form.create({name: 'coursesNew'})(GraduationTasksnew);
export default GraduationTasksnewApp;

File diff suppressed because it is too large Load Diff

View File

@ -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(
<React.Fragment>
<style>{`
`}</style>
<MemoDetailMDEditor {...this.props} ref="editor" memo={memo} usingMockInput={true} placeholder="请在此输入对本作品的评语最大限制2000个字符"
height={160} showError={true}></MemoDetailMDEditor>
<div className="padding40 bor-bottom-greyE memoReplies commentsDelegateParent"
style={{ display: (comments && !!comments.length) ? 'block' : 'none' }}>
<div className="replies_count">
<span className="labal">全部回复</span>
<span className="count">{total_count}</span>
</div>
<Comments comments={comments} user={current_user}
replyComment={this.replyComment}
deleteComment={this.deleteComment}
commentPraise={this.commentPraise}
rewardCode={this.rewardCode}
hiddenComment={this.hiddenComment}
usingAntdModal={true}
isChildCommentPagination={true}
loadMoreChildComments={this.loadMoreChildComments}
initReply={this.initReply}
showRewardButton={false}
onlySuperAdminCouldHide={true}
></Comments>
{/* { true ? :
<div className="memoMore">
<div className="writeCommentBtn" onClick={this.showCommentInput}>写评论</div>
</div>} */}
</div>
{ total_count > REPLY_PAGE_COUNT &&
<div className="memoMore">
<Pagination showQuickJumper onChange={this.onPaginationChange} current={pageCount} total={total_count} pageSize={10}/>
<div className="writeCommentBtn" onClick={this.showCommentInput}>写评论</div>
</div> }
</React.Fragment>
)
}
}
export default ImageLayerOfCommentHOC() (GraduationTaskssettingReply);

View File

@ -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(
<React.Fragment>
<div>
{/*提示*/}
<Modals
modalsType={this.state.Modalstype}
modalsTopval={this.state.Modalstopval}
modalCancel={this.state.ModalCancel}
modalSave={this.state.ModalSave}
loadtype={this.state.Loadtype}
/>
{/*提示*/}
{/*<Modals*/}
{/*modalsType={Modalstype}*/}
{/*modalsTopval={Modalstopval}*/}
{/*modalCancel={ModalCancel}*/}
{/*modalSave={ModalSave}*/}
{/*loadtype={Loadtype}*/}
{/*/>*/}
<DownloadMessageysl
{...this.props}
value={this.state.DownloadMessageval}
modalCancel={this.Downloadcal}
modalsType={this.state.DownloadType}
/>
<HomeworkModal
starttimes={this.state.starttimes}
typs={this.state.typs}
modalname={this.state.modalname}
visible={this.state.visible}
Topval={this.state.Topval}
Topvalright={this.state.Topvalright}
Botvalleft={this.state.Botvalleft}
Botval={this.state.Botval}
starttime={this.state.starttime}
endtime={this.state.endtime}
Cancelname={this.state.Cancelname}
Savesname={this.state.Savesname}
Cancel={this.state.Cancel}
Saves={this.state.Saves}
course_groups={this.state.course_groups}
modaltype={this.state.modaltype}
getcourse_groupslist={(id) => this.getcourse_groupslist(id)}
/>
{questionslist&&questionslist?<div className="newMain clearfix">
<div className={"educontent mb20"}>
<div className="justify break_full_word new_li markdown-body edu-back-white"
id="challenge_editorMd_description">
<p id="ReactMarkdown">
<div style={{padding: '30px 40px'}}>
{questionslist&&questionslist?
<div style={{
width: '100%',
border: '1px solid transparent'
}}>
<div className={"markdown-body"} dangerouslySetInnerHTML={{__html: markdownToHTML(questionslist.description).replace(/▁/g,"▁▁▁")}}></div>
</div>:""
}
<div>
<AttachmentList {...this.props} {...this.state} attachments={questionslist&&questionslist.attachments}></AttachmentList>
</div>
{questionslist&&questionslist.group_info?<div>
<div className={"mt20"}>
<span className="font-14">分组要求</span>
<span className="font-14 color-grey-9">提交作品时需要关联同组成员组内成员作品共享</span>
</div>
<div className={"mt10"}>
<span className="font-14">分组人数{questionslist.group_info.min_number} - {questionslist.group_info.max_number} </span>
{questionslist.group_info.base_on_project===true?
<span className="font-14 color-grey-9"> 基于项目项目管理员角色的成员可以提交作品</span>
: <span className="font-14 color-grey-9"> 非基于项目任意小组成员可以提交作品</span>}
</div>
{questionslist.group_info.base_on_project===true?<div className={"mt10"}>
<span className="font-14">基于项目实施</span>
<span className="font-14 color-grey-9"> 各小组必须在educoder平台创建项目</span>
</div>:<div className="font-14 mt10"></div>}
</div>:""}
</div>
</p>
{/*<div className="mt10 mb20">*/}
{/*<p*/}
{/*// className={`noteDetailPoint ${memo.user_praise ? 'Pointed' : ''} `}*/}
{/*className={`noteDetailPoint `}*/}
{/*onClick={()=>{this.clickPraise()}}*/}
{/*>*/}
{/*<i className="iconfont icon-dianzan"></i>*/}
{/*<br/>*/}
{/*/!*<span>{memo.praise_count}</span>*!/*/}
{/*</p>*/}
{/*</div>*/}
</div>
<div className={"mt20 course-message"} style={{background: '#fff'}}>
<GraduationTaskssettingReply
memo={{id: task_Id,
user_id: questionslist && questionslist.user_id}}
course_id={courseId} {...this.props}>
</GraduationTaskssettingReply>
{/*讨论区*/}
</div>
</div>
</div>:""}
</div>
</React.Fragment>
)
}
}
export default GraduationTasksquestions;

View File

@ -1,7 +0,0 @@
.classroomclass{
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
width: 110px;
display: inline-block;
}

View File

@ -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(
<div className="comment_item_cont appraise df clearfix" key={item.id}>
<div className="J_Comment_Face fl">
<a href={`${_origin}/users/${item.user_login}`} target="_blank">
<img alt="用户头像" height="50" src={getImageUrl(`images/${item.image_url}`)} width="50"/>
</a>
</div>
<div className="t_content fl">
<div className="J_Comment_Reply">
<div className="comment_orig_content" style={{ margin:"0px" }}>
<div className="J_Comment_Info clearfix mt3">
<div className="t_info fl">
<a href={`${_origin}/users/${item.user_login}`} className="content-username hide fl">
{item.username}{item.comment_role}
</a>
<span className="t_area fl">{item.time}</span>
{/* 分数 */}
{item.score != null && item.score >= 0 && <span className="score_area fl">{item.score}</span>}
{ !item.is_invalid && item.delete && <Tooltip title={ "删除" } >
<i className="iconfont icon-shanchu mr5 fr" style={{marginLeft: '6px'}}
onClick={() => this.props.onDelete(item)}>
</i>
</Tooltip>}
{/* <WordsBtn style="blue" className="fr">回复</WordsBtn> */}
{ item.is_invalid ? <span className="validate_area fr">失效</span> : ''}
</div>
</div>
{!!_content && <div className="comment_content clearfix" id={`reply_content_${item.id}`}>
<div className="color-grey-3" id={`reply_content_${item.id}`}>
<div className={"break_word_comments"} dangerouslySetInnerHTML={{__html: _content}}></div>
<div className="cl"></div>
</div>
</div>}
{!_content && <span className="color656565 mt2 color-grey-9 font-12 mr8" style={{ display: 'inline-block'}}>{"暂未写评语"}</span>}
<div className="childrenCommentsView">
{(item && item.children && item.children.length) ? <div className="trangle"></div>: ''}
{this.renderChildenComments(item)}
{ item.isAllChildrenLoaded != true && item.children && this.props.isChildCommentPagination == true && item.children.length >= 5?
<Tooltip title={ "点击查看更多回复" } disableFocusListener={true}>
<div className="loadMoreChildComments" onClick={() => {this.props.loadMoreChildComments && this.props.loadMoreChildComments(item)}}>
<i className="iconfont icon-xiajiantou"></i>
</div>
</Tooltip>
: ''}
</div>
{/*mr10 */}
<p className="fr orig_reply">
{/* 第二排右侧按钮区域 */}
</p>
</div>
</div>
</div>
</div>
)
}
}
export default Graduationtaskitem;

View File

@ -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(
<HomeworkModal
modaltype={modaltype}
modalname={modalname}
visible={visible}
Topval={Topval}
Topvalright={Topvalright}
Botvalleft={Botvalleft}
Botval={Botval}
starttime={starttime}
endtime={endtime}
Cancelname={Cancelname}
Savesname={Savesname}
Cancel={this.onCancel}
Saves={Saves}
/>
)
}
}
export default TaskPublishModal;

View File

@ -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(checkBoxValues<tasks){
type=false
}else if(checkBoxValues<tasks){
type=true
}
if(checkBoxValues.length>15||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(
<React.Fragment>
{/*提示*/}
<Modals
modalsType={Modalstype}
modalsTopval={Modalstopval}
modalCancel={ModalCancel}
modalSave={ModalSave}
modalsBottomval={ModalsBottomval}
loadtype={Loadtype}
/>
{/*立即发布*/}
<HomeworkModal
modalname={modalname}
visible={visible}
Topval={Topval}
Topvalright={Topvalright}
Botvalleft={Botvalleft}
Botval={Botval}
starttime={starttime}
starttimes={this.state.starttimes}
typs={this.state.typs}
endtime={endtime}
Cancelname={Cancelname}
Savesname={Savesname}
Cancel={Cancel}
Saves={Saves}
course_groups={this.state.course_groups}
modaltype={this.state.modaltype}
getcourse_groupslist={(id) => this.getcourse_groupslist(id)}
/>
<TaskPublishModal ref="taskPublishModal"></TaskPublishModal>
<style>{`
.task_menu_ul{
width: 550px;
}
`}</style>
<Titlesearchsection
title="毕设任务"
searchValue={searchValue}
onInputSearchChange={this.onInputSearchChange}
allowClearonChange={this.onInputSearchChange}
firstRowRight={
<React.Fragment>
{/*{this.props.isAdmin() ?<WordsBtn style="blue" className="mr30" onClick={() => this.addDir()}>题库选用</WordsBtn>:""}*/}
{/*{this.props.isAdmin() ?<a href={"/api/graduation_tasks/"+category_id+"/tasks_list.xls"} className={"fr color-blue font-16"}>导出成绩</a> :""}*/}
{this.props.isAdmin() ? <WordsBtn style="blue" className=" fr font-16">
<Link to={"/classrooms/" + coursesId + "/graduation_tasks/"+category_id+"/new"}>
<span className={"color-blue font-16"}>新建</span>
</Link>
</WordsBtn> : ""}
{/*题库选用 {this.props.isAdmin() ?<UseBank {...this.props} {...this.state} object_type={"gtask"} useBankSuccess={(checkBoxValues,object_ids)=>this.useBankSuccess(checkBoxValues,object_ids)}></UseBank>:""}*/}
</React.Fragment>
}
// firstRowMid={
//
// }
secondRowLeft={
<div style={{"display":"inline-block", "marginTop": "22px"}}>
<span>{all_count}个毕设任务</span>
<span style={{"marginLeft":"16px"}}>已发布{this.state.published_count}</span>
<span style={{"marginLeft":"16px"}}>未发布{this.state.unpublished_count}</span>
</div>
}
secondRowBotton={
<div className="fl mt6 task_menu_ul">
<Menu mode="horizontal" defaultSelectedKeys="all" onClick={this.handleClick}>
<Menu.Item key="all">全部</Menu.Item>
{this.props.isAdmin()?<Menu.Item key="0">未发布</Menu.Item>:""}
<Menu.Item key="1">提交中</Menu.Item>
<Menu.Item key="4">补交中</Menu.Item>
<Menu.Item key="2">评阅中</Menu.Item>
<Menu.Item key="3">交叉评阅中</Menu.Item>
</Menu>
</div>
}
onPressEnter={this.onPressEnter}
searchPlaceholder={"请输入名称进行搜索"}
/>
{/* <GraduateTaskItem></GraduateTaskItem>
<FilesListItem></FilesListItem> */}
{this.props.isAdmin()?all_count===undefined?'' :all_count===0?"": <div className="mt20 edu-back-white padding20-30">
<div className="clearfix">
<Checkbox className="fl" onChange={this.onCheckAll} checked={checkAllValue}>已选 {checkBoxValues===undefined?0:checkBoxValues.length} 不支持跨页勾选</Checkbox>
<div className="studentList_operation_ul">
<li className="li_line"><a className="color-grey-9" onClick={this.onDelete}>删除</a></li>
<li className="li_line"><a className="color-grey-9" onClick={() => { this.publish() }}>立即发布</a></li>
<li className="li_line"><a className="color-grey-9" onClick={() => { this.end() }}>立即截止</a></li>
{course_public===true?<li className="li_line"><a className="color-grey-9" onClick={this.onOpen}>设为公开</a></li>:""}
{/*<li className="li_line"><a className="color-grey-9" onClick={()=>this.ActionPoll()}>加入题库</a></li>*/}
</div>
</div>
</div>:""}
<style>{`
.padding02010{
padding: 10px 30px 0px 30px;
cursor: pointer;
}
.ant-checkbox-group > div .boardsList {
border-top: 1px solid transparent;
padding: 10px 0px 20px!important;
}
.padding02010:hover{
box-shadow: 0px 2px 6px rgba(51,51,51,0.09);
opacity: 1;
border-radius: 2px;
}
`}</style>
<Spin size="large" spinning={this.state.isSpin}> <Checkbox.Group style={{ width: '100%' }} onChange={this.onCheckBoxChange} value={checkBoxValues===undefined?[]:checkBoxValues}>
{ tasks&&tasks.map((item, index) => {
// console.log(item)
return (
<div className="mt20 edu-back-white pt10 pl30 pr30" key={index}>
<div className="clearfix">
<GraduateTaskItem
{...this.state}
{...this.props}
discussMessage={item}
isAdmin={this.props.isAdmin()}
isStudent={this.props.isStudent()}
isNotMember={this.props.isNotMember()}
checkBox={this.props.isAdmin()?<Checkbox value={item.task_id} key={item.task_id}></Checkbox>:""}
// 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}
></GraduateTaskItem>
</div>
</div>
)
})
}
</Checkbox.Group>
</Spin>
{
task_count > 15 &&
<div className="mb40 edu-txt-center padding20-30" >
<Pagination
showQuickJumper
defaultCurrent={1}
pageSize={15}
total={task_count}
current={page}
onChange={this.PaginationTask}
/>
</div>
}
{
tasks===undefined?'' :tasks.length===0? <NoneData></NoneData>:""
}
<div>
</div>
</React.Fragment>
)
}
}
export default GraduationTasks;
{/*<div className="alltask"*/}
{/*style={*/}
{/*{*/}
{/*display: all_count===undefined?'none' :all_count===0? 'block' : 'none'*/}
{/*}*/}
{/*}*/}
{/*>*/}
{/*<div className="edu-tab-con-box clearfix edu-txt-center">*/}
{/*<img className="edu-nodata-img mb20" src="/images/educoder/nodata.png" />*/}
{/*<p className="edu-nodata-p mb20">暂时还没有相关数据哦!</p></div>*/}
{/*</div>*/}

View File

@ -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(
<ModalWrapper
ref="modalWrapper"
onOk={this.onOk}
title={ "题库选用" }
>
<React.Fragment>
<style>{`
.courseModalNav li{
float: left;
margin-right: 20px;
}
.courseModalNav li:last-child{
margin-right: 0px;
}
.courseModalNav li.active a{
color: #fff!important;
background-color: #4CACFF;
}
.courseModalNav li a{
display: block;
padding:0px 10px;
height: 28px;
line-height: 28px;
background-color: #F5F5F5;
border-radius: 36px;
color: #666666!important;
}
`}</style>
<div className="clearfix mb30">
<ul className="fl mt2 courseModalNav">
<li className={nav_my===1?"active":""} onClick={()=>this.changeNav(1)}><a>我的题库</a></li>
<li className={nav_my===1?"":"active"} onClick={()=>this.changeNav(2)}><a>公共题库</a></li>
</ul>
<Search placeholder="输入适用选题名称关键字搜索" className="searchView fr" style={{"width":"268px","height":"30px"}}></Search>
</div>
<p className="color-grey-6 mb25 edu-txt-center">
选用对象你在课堂{"毕设选题"}列表中已<span className="color-orange-tip">加入题库</span>
的选题
</p>
<div>
<div className="edu-back-skyblue padding20" style={{"height":"300px"}}>
<p className="clearfix mb7">
<Checkbox className="fl"></Checkbox>
<span className="fl with45"><label className="task-hide fl" style={{"maxWidth":"208px;"}}>毕业设计2018开题报告题报</label></span>
<span className={nav_my===1?"fl with50 color-grey-6 task-hide pl5":"fl with30 color-grey-6 task-hide pl5"}>数据库原理数据库原理</span>
{
nav_my===2 &&
<span className="fl with16 color-grey-6 task-hide pl10">胡莎莎胡莎莎</span>
}
</p>
</div>
</div>
</React.Fragment>
</ModalWrapper>
)
}
}
export default ChooseGraduateTopicModal;

View File

@ -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(
<div className="newMain">
<div className="educontent mt10 mb50">
<p className="clearfix mb15 lineh-20">
<WordsBtn style="grey" className="fl" to={current_user&&current_user.first_category_url}>{tableData && tableData.course_name}</WordsBtn>
<span className="color-grey-9 fl ml3 mr3">&gt;</span>
<WordsBtn style="grey" className="fl" to={`/classrooms/${tableData.course_id}/graduation_topics/${tableData.graduation_id}`}>{tableData.graduation_name}</WordsBtn>
<span className="color-grey-9 fl ml3 mr3">&gt;</span>
<span>选题详情</span>
</p>
<p className="clearfix mb20 lineh-25">
<span className="color-grey-3 font-24 fl task-hide" style={{lineHeight:"25px",maxWidth:"900px"}}>{tableData && tableData.graduation_topic_name}</span>
<span className="fl mt1" style={{height:"25px"}}><CoursesListType typelist={[`${tableData && tableData.status_name}`]} typesylename={""} /></span>
<WordsBtn className="fr font-16 mt1" style="grey" to={`/classrooms/${tableData.course_id}/graduation_topics/${tableData.graduation_id}`}>返回</WordsBtn>
</p>
<div>
<div className="clearfix edu-back-white bor-bottom-greyE" >
<div className="fl mt6 task_menu_ul ml30">
<Menu mode="horizontal" defaultSelectedKeys="1" onClick={this.onChangeStatus}>
<Menu.Item key="1">选题列表</Menu.Item>
<Menu.Item key="2">选题描述</Menu.Item>
</Menu>
</div>
{/* null: 未选题 0待确认 1已同意 2已拒绝 */}
{
isStudent && tableData.user_selected == false && (tableData.user_selected_topic==null || tableData.user_selected_topic==2) &&
<WordsBtn className="fr font-16 mt22 mr30" style="blue" onClick={this.actionTopic}>选题</WordsBtn>
}
{
isStudent && tableData.user_selected == true && tableData.user_selected_topic==0 &&
<WordsBtn className="fr font-16 mt22 mr30" style="blue" onClick={this.actionTopic}>取消选题</WordsBtn>
}
{
isAdmin && <WordsBtn className="fr font-16 mt22 mr30" to={`/classrooms/${course_id}/graduation_topics/${graduation_topic_id}/edit`} style="blue">编辑</WordsBtn>
}
</div>
{
tab && tab==1&&
<div>
<div className="minH-560 edu-back-white">
<DetailTable {...this.props} {...this.state} tableData={tableData} page={tablePage} getDetailList={this.getDetailList}></DetailTable>
</div>
{
tableData && tableData.users_count>tablePageSize &&
<div className="edu-txt-center mt30 mb50">
<Pagination showQuickJumper pageSize={tablePageSize} current={tablePage} total={tableData.users_count} onChange={this.changeTablePage}></Pagination>
</div>
}
</div>
}
{
tab && tab==2&&
<DetailInfo {...this.props} {...this.state}></DetailInfo>
}
</div>
</div>
</div>
)
}
}
export default GraduateTopicDetail;

View File

@ -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(
<div>
<style>{`
.editormd-html-preview{
width:100%!important;
}
`}</style>
<div className="edu-back-white mb20 padding30">
<div className="bor-bottom-greyE pb30">
<div id="gratuationTopic_Detail" className="new_li markdown-body justify">
{
topicInfo && topicInfo.description!="" &&
<MarkdownToHtml content={topicInfo.description} ></MarkdownToHtml>
}
</div>
{
topicInfo && topicInfo.attachment_list.length>0 &&
<div className="mt30">
{/* {
topicInfo.attachment_list.map((item,key)=>{
return(
<li className="clearfix mb8" key={key}>
<i className="iconfont icon-fujian color-green font-16 mr8 fl"></i>
<ConditionToolTip title={item.title} condition={item.title && item.title.length > 30 }>
<a href={item.url} className="color-grey-3 fl mr12 task-hide" style={{"maxWidth":"432px"}}>{item.title}</a>
</ConditionToolTip>
<span className="fl font-12 color-grey-9">{item.filesize}</span>
</li>
)
})
} */}
<AttachmentList {...this.props} {...this.state} attachments = {topicInfo.attachment_list}></AttachmentList>
</div>
}
</div>
<div className="mt30">
{
topicInfo &&
<p className="clearfix exu-txt-left mb20">
<span className="fl with25">
<span className="color-grey-9">课题类型</span>
<span className="color-grey-3">{topicInfo.topic_type ? type[`${topicInfo.topic_type}`] :"--"}</span>
</span>
<span className="fl with25">
<span className="color-grey-9">课题来源</span>
<span className="color-grey-3">{topicInfo.topic_source ? source[`${topicInfo.topic_source}`] :"--"}</span>
</span>
<span className="fl with25">
<span className="color-grey-9">课题性质1</span>
<span className="color-grey-3">{topicInfo.topic_property_first ? first[`${topicInfo.topic_property_first}`] :"--"}</span>
</span>
<span className="fl with25">
<span className="color-grey-9">课题性质2</span>
<span className="color-grey-3">{topicInfo.topic_property_second ? second[`${topicInfo.topic_property_second}`] :"--"}</span>
</span>
</p>
}
{
topicInfo &&
<p className="clearfix exu-txt-left">
<span className="fl with25">
<span className="color-grey-9">课题重复情况</span>
<span className="color-grey-3">{topicInfo.topic_repeat ? repeat[`${topicInfo.topic_repeat}`] :"--"}</span>
</span>
<span className="fl with25">
<span className="color-grey-9">调研或实习地点</span>
<span className="color-grey-3">{topicInfo.city || "--"}</span>
</span>
<span className="fl with50">
<span className="color-grey-9">课题来源单位</span>
<span className="color-grey-3">{topicInfo.source_unit || "--"}</span>
</span>
</p>
}
</div>
</div>
<div className="edu-back-white mb20 graduateTopic course-message">
<GraduateTopicReply memo={{id: graduation_topic_id, user_id: topicInfo && topicInfo.user_id}} course_id={course_id} {...this.props}></GraduateTopicReply>
</div>
</div>
)
}
}
export default GraduateTopicDetailTable;

View File

@ -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(
<div className="minH-560 edu-back-white">
<div className="TopicDetailTable">
<div className="topHead edu-txt-center">
<span style={{"width":"5%"}}>序号</span>
<span style={{"width":"12%"}}>姓名</span>
{isNotMember ?"" :<span style={{"width":"13%"}}>学号</span>}
<span style={{"width":"15%"}}>分班</span>
<span style={{"width":"15%"}}>选题时间</span>
<span style={{"width":"12%"}} className="fr">操作</span>
{
isAdmin &&
<span style={{"width":"12%"}} className="fr">确认结果</span>
}
</div>
{/* 拒绝弹框 */}
<Modals
modalsType={modalsType}
modalsTopval={modalsTopval}
modalsBottomval=""
modalCancel={this.cancelAboutTopic}
modalSave={this.sureAboutTopic}
></Modals>
{/* 同意弹框 */}
<Modal
title="同意选题"
visible={agreeFlag}
closable={false}
footer={null}
destroyOnClose={true}
centered={true}
keyboard={false}
>
<div className="newupload_conbox">
<p className="color-grey-9 mb15 edu-txt-center">确认同意学生的选题将学生加入我的分班</p>
{ tableData.group_list && tableData.group_list.length===0?"":<div className="df">
<span className="lineh-40 mr10">选择</span>
<div className="flex1">
<Select placeholder="请选择分班" style={{"width":"100%"}} value={classesId} onChange={this.changeClasses}>
{
tableData.group_list && tableData.group_list.map((item,key)=>{
return(
<Option value={item.group_id} key={key}>{item.group_name}</Option>
)
})
}
<Option key="0"><a onClick={this.topicAddClasses} style={{display:"block"}}>添加分班</a></Option>
</Select>
<p style={{height:"20px",lineHeight:"20px"}}><span className="color-orange-tip">{un_choose_notice}</span></p>
</div>
</div>}
<div className="mt20 clearfix edu-txt-center">
<a onClick={this.hideAgreeTopic} className="pop_close task-btn mr30">取消</a>
<a className="task-btn task-btn-orange" onClick={()=>this.sureAgreeTopic(tableData.group_list.length)}>确定</a>
</div>
</div>
</Modal>
<Modal
visible={visible}
title="新建分班"
closable={false}
footer={null}
destroyOnClose={true}
centered={true}
keyboard={false}
>
<div className="newupload_conbox">
<div className="df">
<span className="lineh-40 mr10">分班</span>
<div className="flex1">
<Input className="input-flex-40" value={un_addClass} onInput={this.inputClasses} placeholder="示例:分班(最佳4个字符)"></Input>
<p style={{height:"20px",lineHeight:"20px"}}>
<span className="color-orange-tip">{un_addClass_notice}</span>
</p>
</div>
</div>
<div className="clearfix edu-txt-center">
<a onClick={this.hideClasses} className="pop_close task-btn mr30">取消</a>
<a className="task-btn task-btn-orange" onClick={this.sureAddClass}>确定</a>
</div>
</div>
</Modal>
<div className="bottomBody">
{
tableData.users_list && tableData.users_list.length > 0 && tableData.users_list.map((item,key)=>{
return(
<li className="color-grey-9 clearfix" key={key}>
<span style={{"width":"5%"}} className="color-grey-6">{parseInt(key+1)+(parseInt(page-1)*15)}</span>
<span style={{"width":"12%"}} className="color-grey-3">{item.student_name}</span>
{isNotMember ?"" :<span style={{"width":"13%"}}>{item.student_id}</span>}
<span style={{"width":"15%"}}>{item.class_group_name || "--"}</span>
<span style={{"width":"15%"}}>{item.selected_time}</span>
{
isAdmin &&
<span style={{"width":"12%"}} className="fr">
{
item.result == "待确认" ?
<span>
<a className="mr20 color-grey-B3" onClick={()=>this.aboutTopic(`${item.id}`)}>拒绝</a>
<a className="color-blue" onClick={()=>this.agreeTopic(`${item.id}`)}>同意</a>
</span>:
(
item.result === "已拒绝" ? <span className="color-grey-B3">--</span>
:
<a className="color-grey-B3" onClick={()=>this.aboutTopic(`${item.id}`)}>拒绝</a>
)
}
</span>
}
{
isStudent &&
<span style={{"width":"12%"}} className={item.result === "已拒绝"?"fr color-red":"fr"}>{item.result}</span>
}
{
isAdmin &&
<span style={{"width":"12%"}} className={item.result === "已拒绝"?"fr color-orange-tip":"fr"}>{item.result=== "待确认"?"--":item.result}</span>
}
{
isNotMember && <span style={{"width":"12%"}} className="fr color-grey-9">--</span>
}
</li>
)
})
}
{
tableData.users_list && tableData.users_list.length == 0 && <NoneData></NoneData>
}
</div>
</div>
</div>
)
}
}
export default GraduateTopicDetailTable;

View File

@ -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(
<div>
<style>
{
`
.boardsList:hover {
box-shadow: 0px 2px 6px rgba(51,51,51,0.09);
opacity: 1;
border-radius: 2px;
}
.graduateTopicList .ant-checkbox-wrapper {
margin-top: -44px;
}
`
}
</style>
<div className="graduateTopicList boardsList mb20" style={{cursor : isAdmin ? "pointer" : "default" }} onClick={() => window.$(`.topicItem${index} input`).click() }>
<style>{`
.graduateTopicList .ant-checkbox-input {s
margin-right: 15px;
}
.ant-checkbox-group > div .boardsList {
padding: 17px 30px 20px!important;
}
`}</style>
{ isAdmin ? <span className={`topicItem${index} fl`} style={{"height":"64px"}}>{checkBox}</span> : ""}
<div className="clearfix ds pr flex1">
<style>{`
.maxwidth580{
max-width: 580px;
overflow:hidden;
text-overflow:ellipsis;
white-space:nowrap
}
a:hover{
color: #4cacff;
}
`}</style>
<h6>
{
isNotMember?
discussMessage.private_icon===true?<span className="fl mt3 font-16 font-bd color-dark maxwidth580 pointer" title={ discussMessage.private_icon===true?"私有属性,非课堂成员不能访问":discussMessage.name}>{discussMessage.name}</span>:
<a className="fl mt3 font-16 font-bd color-dark maxwidth580 pointer" title={discussMessage.name}>{discussMessage.name}</a>
:""
}
{
isStudent?<a onClick={() => this.toDetailPage(`${discussMessage.id}`)}
className="fl mt3 font-16 font-bd color-dark maxwidth580" title={discussMessage.name}>{discussMessage.name}</a>:""
}
{
isAdmin?<a onClick={() => this.toDetailPage(`${discussMessage.id}`)} className="fl mt3 font-16 font-bd color-dark maxwidth580" title={discussMessage.name}>{discussMessage.name}</a>:""
}
{
discussMessage.private_icon===true?
<Tooltip title={"私有属性,非课堂成员不能访问"} placement="bottom">
<i className="iconfont icon-guansuo color-grey-c ml10 font-16 fl mt4"></i>
</Tooltip>
:""
}
<CoursesListType typelist={[map[`${discussMessage.status}`]]} typesylename={""} />
</h6>
<div className="cl"></div>
<p className="color-grey mt20 clearfix">
<span className="fl mr40 mt1">
<Tooltip title="指导老师" placement="bottom">
<span className="color-grey3">{discussMessage.author}</span>
</Tooltip>
</span>
<span className="fl mr20 color-grey-9 mt1">{discussMessage.selected_count} 已选</span>
<span className="fl color-grey-9 mt1">{discussMessage.confirmation_count} 已确认</span>
<span className="fr">
{
isStudent?<WordsBtn style="blue" onClick={() => this.toDetailPage(`${discussMessage.id}`)}
className="font-16 mr20" >查看详情</WordsBtn>:""
}
{
isAdmin?<WordsBtn style="blue" onClick={() => this.toDetailPage(`${discussMessage.id}`)} className="font-16 mr20" >查看详情</WordsBtn>:""
}
{
isAdmin && <WordsBtn onClick={()=>this.editTopic(`${discussMessage.id}`)} style="blue" className="font-16 ">编辑</WordsBtn>
}
{
isStudent && data.user_selected == true && discussMessage.user_topic_status==0 &&
<WordsBtn onClick={()=>chooseTopic(`${discussMessage.id}`,index,true)} style="blue" className="font-16 mr20">
取消选题
</WordsBtn>
}
{
isStudent && data.user_selected==false && (discussMessage.user_topic_status == null || discussMessage.user_topic_status == 2) &&
<WordsBtn onClick={()=>chooseTopic(`${discussMessage.id}`,index,false)} style="blue" className="font-16 mr20">
选题
</WordsBtn>
}
</span>
</p>
</div>
</div>
</div>
)
}
}
export default GraduateTopicItem;

View File

@ -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(
<div className="newMain ">
<style>{`
.courseForm .ant-form-item-label{
margin-left:unset!important
}
`}</style>
<div className="edu-class-container edu-position courseForm">
<p className="clearfix mb20 mt10">
<WordsBtn style="grey" className="fl" to={current_user&&current_user.first_category_url}>{course_name}</WordsBtn>
<span className="color-grey-9 fl ml3 mr3">&gt;</span>
<WordsBtn style="grey" className="fl" to={`/classrooms/${coursesId}/graduation_topics/${left_banner_id}`}>{left_banner_name}</WordsBtn>
<span className="color-grey-9 fl ml3 mr3">&gt;</span>
<span>{topicId==undefined?"新建":"编辑"}</span>
</p>
<div className="clearfix mb20 lineh-25">
<p className="fl color-black summaryname">{topicId==undefined?"新建":"编辑"}毕设选题</p>
<Link to={`/classrooms/${coursesId}/graduation_topics/${left_banner_id}`} className="color-grey-6 fr font-16">返回</Link>
</div>
<Form {...formItemLayout} onSubmit={this.handleSubmit}>
<div className="createPage">
<Form.Item
label="指导老师"
>
{getFieldDecorator('tea_id', {
rules: [{
required: true, message: '请选择指导老师'
}],
})(
<Select style={{"width":"20%"}} placeholder="请选择指导老师">
{
teacherList && teacherList.map((item,key)=>{
return(
<Option value={item.id} id={key}>{item.name}</Option>
)
})
}
</Select>
)}
</Form.Item>
<style>
{
`
.exercicenewinputysl .ant-input{
border-right: none !important;
height: 40px !important;
}
`
}
</style>
<Form.Item
label="选题名称"
className="mt15"
>
{getFieldDecorator('name', {
rules: [{
required: true, message: '请输入选题名称',
}, {
max: 60, message: '最大限制为60个字符',
}],
})(
<Input placeholder="请输入帖子选题名称最大限制60个字符" maxLength="60" onInput={this.changeTopicName} autoComplete="off" addonAfter={`${String(addonAfter)}/${NAME_COUNT}`} className="searchViewAfter exercicenewinputysl" />
)}
</Form.Item>
</div>
<style>{`
.courseMessageMD {
width: 1140px;
}
.uploadBtn.ant-btn {
border: none;
color: #4CACFF;
box-shadow: none;
background: transparent;
padding: 0 6px;
}
.upload_1 .ant-upload-list {
width: 350px;
margin-bottom:10px;
}
.ant-upload-list-item{
margin-top:0px!important;
}
.ant-form-item-children{
position:unset
}
.rememberTip{
position:absolute;
right:0px;
bottom:-10px;
}
.chooseDes .ant-form-explain{
position:absolute;
bottom:-10px;
left:0px;
}
.setUploadStyle .uploadBtn{
height:20px;
line-height:20px;
}
.setUploadStyle .ant-form-item-control{
margin-top:15px!important;
line-height:22px!important;
}
.setUploadStyle .ant-upload-list{
margin-top:5px;
}
`}</style>
<div className="createPage">
<Form.Item
label="选题简介"
style={{"borderBottom":'none'}}
className="chooseDes pr"
>
{getFieldDecorator('description', {
rules: [{
required: true, message: '请输入选题简介',
}, {
max: 5000, message: '最大限制为5000个字符',
}],
})(
<TPMMDEditor ref={this.mdRef} placeholder={'请简要说明选题内容最大限制5000个字符'}
mdID={'courseMessageMD'} initValue={this.editTopic ? this.editTopic.content : ''} className="courseMessageMD"></TPMMDEditor>
)}
</Form.Item>
<Form.Item
className="setUploadStyle"
>
{
getFieldDecorator('file',{
rules:[{
required:false
}]
})(
<Upload {...uploadProps} className="upload_1 ">
<Button className="uploadBtn">
<Icon type="upload" /> 上传附件
</Button>
<span className="color-grey-c">(单个文件150M以内)</span>
</Upload>
)
}
</Form.Item>
<div className="clearfix">
<Form.Item className="fl mr20 with20" style={{"marginRight":"20px"}}>
{getFieldDecorator('topic_type', {
rules: [{
required: false, message: '',
}],
})(
<Select placeholder="请选择选题类型">
{
topic_type && topic_type.map((item,key)=>{
return(
<Option value={item.id} key={key}>{item.name}</Option>
)
})
}
</Select>
)}
</Form.Item>
<Form.Item className="fl mr20 with20" style={{"marginRight":"20px"}}>
{getFieldDecorator('topic_source', {
rules: [{
required: false, message: '',
}],
})(
<Select placeholder="请输入选题来源">
{
topic_source && topic_source.map((item,key)=>{
return(
<Option value={item.id} key={key}>{item.name}</Option>
)
})
}
</Select>
)}
</Form.Item>
<Form.Item className="fl mr20 with20" style={{"marginRight":"20px"}}>
{getFieldDecorator('topic_property_first', {
rules: [{
required: false, message: '',
}],
})(
<Select placeholder="请输入选题性质1">
{
topic_property_first && topic_property_first.map((item,key)=>{
return(
<Option value={item.id} key={key}>{item.name}</Option>
)
})
}
</Select>
)}
</Form.Item>
<Form.Item className="fl mr20 with20" style={{"marginRight":"20px"}}>
{getFieldDecorator('topic_property_second', {
rules: [{
required: false, message: '',
}],
})(
<Select placeholder="请输入选题性质2">
{
topic_property_second && topic_property_second.map((item,key)=>{
return(
<Option value={item.id} key={key}>{item.name}</Option>
)
})
}
</Select>
)}
</Form.Item>
</div>
</div>
<style>{`
.courseForm .flexBlock.formBlock {
align-items: flex-end;
display: flex;
flex-wrap: wrap;
}
.courseForm .flexBlock .tag {
margin-left: 8px;
margin-right: 6px;
margin-bottom: 16px;
}
.flexBlock .ant-row.ant-form-item {
margin-bottom: 6px;
}
.ant-cascader-menu{
min-width:125px!important;
}
`}</style>
<div className="createPage" style={{"borderBottom":"none"}}>
<Form.Item
label="选题来源单位"
className="with22"
>
{getFieldDecorator('source_unit', {
rules: [{
required: false, message: '',
}],
})(
<Input placeholder="请填写来源单位" autoComplete="off" className="searchView"/>
)}
</Form.Item>
<Form.Item
label="选择重复情况"
className="mt15 with22"
>
{getFieldDecorator('topic_repeat', {
rules: [{
required: false, message: '',
}],
})(
<Select placeholder="请选择选题重复情况">
{
topic_repeat && topic_repeat.map((item,key)=>{
return(
<Option value={item.id} key={key}>{item.name}</Option>
)
})
}
</Select>
)}
</Form.Item>
<Form.Item
label="调研或实习地点"
className="mt15 with22 setAreaStyle"
>
{getFieldDecorator('city', {
rules: [{
initialValue: this.state.cityDefaultValue,
type: 'array',
required: false, message: '',
}],
})(
<City ></City>
)}
</Form.Item>
</div>
<Form.Item>
<div className="clearfix mt30 mb30">
<Button type="primary" htmlType="submit" className="defalutSubmitbtn fl mr20">{topicId==undefined?"提交":"保存"}</Button>
<a className="defalutCancelbtn fl" onClick={()=>this.props.history.goBack()}>取消</ a>
</div>
</Form.Item>
</Form>
</div>
</div>
)
}
}
const WrappedGraduateTopicNew = Form.create({ name: 'topicPostWorksNew' })(GraduateTopicNew);
// RouteHOC()
export default (WrappedGraduateTopicNew);

View File

@ -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(
<React.Fragment>
<Form {...formItemLayout} onSubmit={this.handleSubmit}>
<div className="createPage">
{
teacherName &&
<Form.Item
label="指导老师"
>
{getFieldDecorator('tea_id', {
rules: [{
required: true, message: '请选择指导老师'
}],
})(
<Select style={{"width":"20%"}} placeholder="请选择指导老师">
{
teacherList && teacherList.map((item,key)=>{
return(
<Option value={item.id} id={key}>{item.name}</Option>
)
})
}
</Select>
)}
</Form.Item>
}
<style>
{
`
.exercicenewinputysl .ant-input{
border-right: none !important;
height: 40px !important;
}
`
}
</style>
<Form.Item
label="选题名称"
className="mt15"
>
{getFieldDecorator('name', {
rules: [{
required: true, message: '请输入选题名称',
}, {
max: 60, message: '最大限制为60个字符',
}],
})(
<Input placeholder="请输入帖子选题名称最大限制60个字符" maxLength="60" onInput={this.changeTopicName} autoComplete="off" addonAfter={`${String(addonAfter)}/${NAME_COUNT}`} className="searchViewAfter exercicenewinputysl" />
)}
</Form.Item>
</div>
<style>{`
.courseMessageMD {
width: 1140px;
}
.uploadBtn.ant-btn {
border: none;
color: #4CACFF;
box-shadow: none;
background: transparent;
padding: 0 6px;
}
.upload_1 .ant-upload-list {
width: 350px;
margin-bottom:10px;
}
.ant-upload-list-item{
margin-top:0px!important;
}
.ant-form-item-children{
position:unset
}
.rememberTip{
position:absolute;
right:0px;
bottom:-10px;
}
.chooseDes .ant-form-explain{
position:absolute;
bottom:-10px;
left:0px;
}
.setUploadStyle .uploadBtn{
height:20px;
line-height:20px;
}
.setUploadStyle .ant-form-item-control{
margin-top:15px!important;
line-height:22px!important;
}
.setUploadStyle .ant-upload-list{
margin-top:5px;
}
`}</style>
<div className="createPage">
<Form.Item
label="选题简介"
style={{"borderBottom":'none'}}
className="chooseDes pr"
>
{getFieldDecorator('description', {
rules: [{
required: true, message: '请输入选题简介',
}, {
max: 10000, message: '最大限制为10000个字符',
}],
})(
// initValue={this.editTopic ? this.editTopic.content : ''}
<TPMMDEditor ref={this.mdRef} placeholder={'请简要说明选题内容最大限制5000个字符'}
mdID={'courseMessageMD'} className="courseMessageMD"></TPMMDEditor>
)}
</Form.Item>
<Form.Item
className="setUploadStyle"
>
{
getFieldDecorator('file',{
rules:[{
required:false
}]
})(
<Upload {...uploadProps} className="upload_1 ">
<Button className="uploadBtn">
<Icon type="upload" /> 上传附件
</Button>
<span className="color-grey-c">(单个文件150M以内)</span>
</Upload>
)
}
</Form.Item>
<div className="clearfix">
<Form.Item className="fl mr20 with20" style={{"marginRight":"20px"}}>
{getFieldDecorator('topic_type', {
rules: [{
required: false, message: '',
}],
})(
<Select placeholder="请选择选题类型">
{
topic_type && topic_type.map((item,key)=>{
return(
<Option value={item.id} key={key}>{item.name}</Option>
)
})
}
</Select>
)}
</Form.Item>
<Form.Item className="fl mr20 with20" style={{"marginRight":"20px"}}>
{getFieldDecorator('topic_source', {
rules: [{
required: false, message: '',
}],
})(
<Select placeholder="请输入选题来源">
{
topic_source && topic_source.map((item,key)=>{
return(
<Option value={item.id} key={key}>{item.name}</Option>
)
})
}
</Select>
)}
</Form.Item>
<Form.Item className="fl mr20 with20" style={{"marginRight":"20px"}}>
{getFieldDecorator('topic_property_first', {
rules: [{
required: false, message: '',
}],
})(
<Select placeholder="请输入选题性质1">
{
topic_property_first && topic_property_first.map((item,key)=>{
return(
<Option value={item.id} key={key}>{item.name}</Option>
)
})
}
</Select>
)}
</Form.Item>
<Form.Item className="fl mr20 with20" style={{"marginRight":"20px"}}>
{getFieldDecorator('topic_property_second', {
rules: [{
required: false, message: '',
}],
})(
<Select placeholder="请输入选题性质2">
{
topic_property_second && topic_property_second.map((item,key)=>{
return(
<Option value={item.id} key={key}>{item.name}</Option>
)
})
}
</Select>
)}
</Form.Item>
</div>
</div>
<style>{`
.courseForm .flexBlock.formBlock {
align-items: flex-end;
display: flex;
flex-wrap: wrap;
}
.courseForm .flexBlock .tag {
margin-left: 8px;
margin-right: 6px;
margin-bottom: 16px;
}
.flexBlock .ant-row.ant-form-item {
margin-bottom: 6px;
}
.ant-cascader-menu{
min-width:125px!important;
}
`}</style>
<div className="createPage" style={{"borderBottom":"none"}}>
<Form.Item
label="选题来源单位"
className="with22"
>
{getFieldDecorator('source_unit', {
rules: [{
required: false, message: '',
}],
})(
<Input placeholder="请填写来源单位" autoComplete="off" className="searchView"/>
)}
</Form.Item>
<Form.Item
label="选择重复情况"
className="mt15 with22"
>
{getFieldDecorator('topic_repeat', {
rules: [{
required: false, message: '',
}],
})(
<Select placeholder="请选择选题重复情况">
{
topic_repeat && topic_repeat.map((item,key)=>{
return(
<Option value={item.id} key={key}>{item.name}</Option>
)
})
}
</Select>
)}
</Form.Item>
<Form.Item
label="调研或实习地点"
className="mt15 with22 setAreaStyle"
>
{getFieldDecorator('city', {
rules: [{
initialValue: cityDefaultValue,
type: 'array',
required: false, message: '',
}],
})(
<City ></City>
)}
</Form.Item>
</div>
<Form.Item>
<div className="clearfix mt30 mb30">
<Button type="primary" htmlType="submit" className="defalutSubmitbtn fl mr20">{topicId==undefined?"提交":"保存"}</Button>
<a className="defalutCancelbtn fl" onClick={this.props.editCancel}>取消</ a>
</div>
</Form.Item>
</Form>
</React.Fragment>
)
}
}
const WrappedGraduateTopicNewForm = Form.create({ name: 'topicPostWorksNew' })(GraduateTopicNewForm);
// RouteHOC()
export default (WrappedGraduateTopicNewForm);

View File

@ -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(
<div className="newMain ">
<style>{`
.courseForm .ant-form {
}
`}</style>
<div className="edu-class-container edu-position courseForm">
<div style={{ width:'100%',height:'70px'}} >
<p className="ml15 fl color-black mt30 summaryname">提交作品</p>
<a onClick={()=>this.props.history.goBack()} className="color-grey-6 fr font-16 ml30 mt18 mr20">返回</a>
</div>
<Form {...formItemLayout} onSubmit={this.handleSubmit}>
<div className="formBlock" style={{paddingBottom: '0px'}}>
<Form.Item
label="标题"
>
{getFieldDecorator('subject', {
rules: [{
required: true, message: '请输入标题',
}, {
max: 20, message: '最大限制为20个字符',
}],
})(
<Input placeholder="请输入帖子标题最大限制20个字符" />
)}
</Form.Item>
</div>
<style>{`
.courseMessageMD {
width: 1140px;
}
.uploadBtn.ant-btn {
border: none;
color: #4CACFF;
box-shadow: none;
background: transparent;
padding: 0 6px;
}
.upload_1 .ant-upload-list {
width: 350px;
}
`}</style>
<div className="formBlock">
<Form.Item
label="内容"
className="mdInForm"
>
{getFieldDecorator('content', {
rules: [{
required: true, message: '请输入帖子内容',
}, {
max: 10000, message: '最大限制为10000个字符',
}],
})(
<TPMMDEditor ref={this.mdRef} placeholder={'请在此输入帖子详情最大限制为10000个字符'}
mdID={'courseMessageMD'} initValue={this.editTopic ? this.editTopic.content : ''} className="courseMessageMD"></TPMMDEditor>
)}
</Form.Item>
<Upload {...uploadProps} className="upload_1">
<Button className="uploadBtn">
<Icon type="upload" /> 上传附件
</Button>
(单个文件150M以内)
</Upload>
</div>
<style>{`
.courseForm .flexBlock.formBlock {
align-items: flex-end;
display: flex;
flex-wrap: wrap;
}
.courseForm .flexBlock .tag {
margin-left: 8px;
margin-right: 6px;
margin-bottom: 16px;
}
.flexBlock .ant-row.ant-form-item {
margin-bottom: 6px;
}
`}</style>
<div className="formBlock flexBlock" style={{ }} >
<Form.Item
label="分组设置"
className=" "
style={{ display: 'inline-block', marginLeft: "14px" }}
>
{getFieldDecorator('min', {
rules: [{
required: true, message: '请输入每组最小人数',
}],
})(
<Input placeholder="请填写每组最小人数" />
)}
</Form.Item>
<span className="tag">~</span>
<Form.Item
label=""
className=" "
style={{ }}
>
{getFieldDecorator('max', {
rules: [{
// required: true, message: '请输入每组最大人数',
}],
})(
<Input placeholder="请填写每组最大人数" />
)}
</Form.Item>
<span className="tag color-grey9 ">(学生提交作品时需要关联同组成员组内成员作品共享)</span>
<Form.Item
label=""
className=" "
style={{ marginLeft: "14px" }}
>
{getFieldDecorator('c', {
rules: [],
})(
<Checkbox >基于项目实施</Checkbox>
)}
</Form.Item>
<span className="tag color-grey9 ">(选中则必须在本平台创建项目项目管理员可以提交作品不选中无需在平台创建项目任意小组成员均可以提交作品)</span>
</div>
<div className="formBlock">
<Form.Item
label="参考答案"
>
{getFieldDecorator('answer', {
rules: [{
required: true, message: '请输入帖子内容',
}, {
max: 10000, message: '最大限制为10000个字符',
}],
})(
<TPMMDEditor ref={this.mdRef} placeholder={'请在此输入参考答案最大限制为5000个字符'}
mdID={'courseAnswerMD'} initValue={this.editTopic ? this.editTopic.content : ''} className="courseMessageMD"></TPMMDEditor>
)}
</Form.Item>
</div>
<Form.Item>
<div className="clearfix mt30 mb30">
<Button type="primary" htmlType="submit" className="defalutSubmitbtn fl mr20">提交</Button>
<a className="defalutCancelbtn fl">取消</ a>
</div>
</Form.Item>
</Form>
</div>
</div>
)
}
}
const WrappedGraduateTopicPostWorksNew = Form.create({ name: 'topicPostWorksNew' })(GraduateTopicPostWorksNew);
// RouteHOC()
export default (WrappedGraduateTopicPostWorksNew);

View File

@ -1,13 +0,0 @@
.graduateTopic .commentsbtn {
}
.edu-class-container {
width: 1200px;
margin: 10px auto 20px;
}
#forum_index_list {
margin-top: 90px;
margin-bottom: 320px;
}

View File

@ -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(
<React.Fragment>
<MemoDetailMDEditor {...this.props} ref="editor" memo={memo} usingMockInput={true} placeholder="说点什么"
height={160} showError={true}></MemoDetailMDEditor>
<div className="padding40 bor-bottom-greyE memoReplies commentsDelegateParent"
style={{ display: (comments && !!comments.length) ? 'block' : 'none' }}>
<div className="replies_count">
<span className="labal">全部回复</span>
<span className="count">{total_count}</span>
</div>
<Comments comments={comments} user={current_user}
replyComment={this.replyComment}
deleteComment={this.deleteComment}
commentPraise={this.commentPraise}
rewardCode={this.rewardCode}
hiddenComment={this.hiddenComment}
usingAntdModal={true}
isChildCommentPagination={true}
loadMoreChildComments={this.loadMoreChildComments}
initReply={this.initReply}
showRewardButton={false}
onlySuperAdminCouldHide={true}
></Comments>
{/* { true ? :
<div className="memoMore">
<div className="writeCommentBtn" onClick={this.showCommentInput}>写评论</div>
</div>} */}
</div>
{ total_count > REPLY_PAGE_COUNT &&
<div className="memoMore">
<Pagination showQuickJumper onChange={this.onPaginationChange} current={pageCount} total={total_count} pageSize={10}/>
<div className="writeCommentBtn" onClick={this.showCommentInput}>写评论</div>
</div> }
</React.Fragment>
)
}
}
export default ImageLayerOfCommentHOC() (GraduateTopicReply);

View File

@ -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 (
<React.Fragment >
<ChooseGraduateTopicModal ref="chooseGraduateTopicModal"></ChooseGraduateTopicModal>
<DownloadMessageysl
{...this.props}
value={this.state.DownloadMessageval}
modalCancel={this.Downloadcal}
modalsType={this.state.DownloadType}
/>
<Titlesearchsection
title="毕设选题"
searchValue={searchValue}
onInputSearchChange={this.onInputSearchChange}
allowClearonChange={this.onInputSearchChange}
firstRowRight=
{isAdmin ?
(<React.Fragment>
{/* 参考普通作业 - 题库选用 */}
{/* <WordsBtn style="blue" className="mr30" onClick={()=>this.useFromBank()}>题库选用</WordsBtn> 正式版没有,先隐藏*/}
< a className={"fl color-blue mr30 font-16"} onClick={(url) => this.confirmysl(`/courses/${this.props.match.params.coursesId}/graduation_topics/export.xlsx`)}>导出</a>
{/*<p className="fl"><UseBank {...this.props} {...this.state} object_type={"gtopic"} useBankSuccess={this.useBankSuccess}></UseBank></p> 题库选用*/}
<WordsBtn style="blue" className="font-16" onClick={() => this.onBoardsNew()}>新建</WordsBtn>
</React.Fragment>) : ""
}
secondRowLeft={
<div className="fl mt6 task_menu_ul">
<Menu mode="horizontal" defaultSelectedKeys="all" onClick={this.onChangeStatus}>
<Menu.Item key="all">全部</Menu.Item>
<Menu.Item key="0">待选中</Menu.Item>
<Menu.Item key="1">待确认</Menu.Item>
<Menu.Item key="2">已确认</Menu.Item>
</Menu>
</div>
}
onPressEnter={this.onPressEnter}
searchPlaceholder={"请输入名称进行搜索"}
showSearchInput={topicList && topicList.length >= pageSize}
></Titlesearchsection>
<Spin size="large" spinning={this.state.isSpin}>
{
topicList && topicList.length > 0 ?
(
<div>
{
// 超级管理员、教师、助教
isAdmin ?
<div className="clearfix mt20 edu-back-white padding20-30">
<Checkbox className="fl" onChange={this.onCheckAll} checked={checkAllValue}>已选 {checkBoxValues.length} 不支持跨页勾选</Checkbox>
<div className="studentList_operation_ul">
<li className="li_line"><a className="color-grey-9" onClick={() => this.onDelete(1)}>删除</a></li>
{
course_public && course_public == 1 ? <li className="li_line"><a className="color-grey-9" onClick={() => this.onDelete(2)}>设为公开</a></li> : ""
}
{/*<li className="li_line"><a className="color-grey-9" onClick={()=>this.onDelete(3)}>加入题库</a></li>*/}
{/* <li className="li_line"><a className="color-grey-9">加入题库</a></li> */}
</div>
</div>
: ""
}
<Modals
modalsType={delType}
modalsTopval={delTopval}
modalsBottomval=""
modalCancel={this.cancelDelTopic}
modalSave={this.sureDelTopic}
loadtype={delLoadType}
>
</Modals>
<div className="clearfix stu_table mt20">
<Checkbox.Group style={{ width: '100%' }} onChange={this.onCheckBoxChange} value={checkBoxValues}>
{topicList.map((item, index) => {
return (
<div>
<GraduateTopicItem
{...this.props}
discussMessage={item}
data={data}
checkBox={<Checkbox value={item.id} key={item.id} onClick={() => this.onItemClick(item)} className="mr15"></Checkbox>}
onItemClick={this.onItemClick}
index={index}
chooseTopic={this.chooseTopic}
></GraduateTopicItem>
</div>
)
})
}
</Checkbox.Group>
</div>
<Modals
modalsType={modalsType}
modalsTopval={modalsTopval}
modalsBottomval={modalsBottomval}
modalCancel={this.cancelOperateTopic}
modalSave={this.sureOperateTopic}
>
</Modals>
</div>
) : (topicList && topicList.length === 0 ? <NoneData></NoneData> : <div className="clearfix stu_table mt20"></div>)
}
</Spin>
{
totalCount && totalCount > pageSize ?
<div className="padding30 edu-txt-center clearfix">
<Pagination defaultCurrent={page} current={page} pageSize={pageSize} showQuickJumper onChange={this.onChangePage} total={totalCount}></Pagination>
</div>
:
<div></div>
}
<div>
</div>
</React.Fragment>
)
}
}
export default Boards;