修改基于项目影响的404 科职那边 情况 隐藏 分组作业 毕业设计

dev_local_2
杨树林 5 years ago
parent 136c7207e6
commit 776a1d2c4d

@ -11,23 +11,23 @@ const confirm = Modal.confirm;
const $ = window.$
const MAX_TITLE_LENGTH = 60;
/**
/**
需要注意的props
isGroup
*/
*/
class NewWorkForm extends Component{
constructor(props){
super(props);
this.contentMdRef = React.createRef();
this.answerMdRef = React.createRef();
this.state={
title_value:"",
title_num: 0,
contentFileList: [],
answerFileList: [],
workLoaded: false,
base_on_project: true,
base_on_project: false,
category: {},
min_num: 2,
max_num: 10,
@ -73,7 +73,7 @@ class NewWorkForm extends Component{
// setTimeout(() => {
// this._scrollToTop()
// 阻止setValue的滚动
// $(window).scroll( function() {
// $(window).scroll( function() {
// $("html").scrollTop(0)
// $(window).unbind("scroll");
// });
@ -87,13 +87,13 @@ class NewWorkForm extends Component{
// $('.editormd').parent().css('position', '').css('left', 'auto')
// }, 100);
// }, 500)
this.props.form.setFieldsValue({
title: data.name,
description: data.description || '',
reference_answer: data.reference_answer || '',
});
})
} else { // new
@ -116,7 +116,7 @@ class NewWorkForm extends Component{
}
handleSubmit = () => {
const courseId = this.state.course_id || this.props.match.params.coursesId ;
this.props.form.validateFieldsAndScroll((err, values) => {
if(err && err.personNum) delete err.personNum;
console.log(values)
@ -124,7 +124,7 @@ class NewWorkForm extends Component{
console.log(mdContnet)
values.description = mdContnet;
// return;
{/* max={has_commit ? init_min_num : null } */}
{/* min={has_commit ? init_max_num : (min_num == undefined ? 2 : min_num + 1) } */}
// 已有提交作品,人数范围只能扩大
@ -143,8 +143,8 @@ class NewWorkForm extends Component{
} else if (max_num < min_num) {
this.props.showNotification('最大人数不能小于最小人数');
return;
}
}
if (has_commit) {
if (max_num < init_max_num || min_num > init_min_num) {
this.props.showNotification(`已有提交作品,人数范围只能扩大(原设置为:${init_min_num} - ${init_max_num})`)
@ -160,7 +160,7 @@ class NewWorkForm extends Component{
} else {
this.doNew(courseId, values)
}
} else {
$("html").animate({ scrollTop: $('html').scrollTop() - 100 })
}
@ -181,7 +181,7 @@ class NewWorkForm extends Component{
type: isGroup ? 3 : 1,
name: values.title,
description: values.description,
reference_answer: values.reference_answer,
reference_answer: values.reference_answer,
attachment_ids,
reference_attachment_ids,
@ -200,12 +200,12 @@ class NewWorkForm extends Component{
})
const isGroup = this.props.isGroup()
const { min_num, max_num, base_on_project, category } = this.state
const params = {
type: isGroup ? 3 : 1,
name: values.title,
description: values.description,
reference_answer: values.reference_answer,
reference_answer: values.reference_answer,
attachment_ids,
reference_attachment_ids,
@ -214,7 +214,7 @@ class NewWorkForm extends Component{
base_on_project
}
this.props.doNew && this.props.doNew(params)
}
handleContentUploadChange = (info) => {
@ -229,12 +229,12 @@ class NewWorkForm extends Component{
this.setState({ answerFileList: appendFileSizeToUploadFileAll(answerFileList) });
}
}
onAttachmentRemove = (file, stateName) => {
if(!file.percent || file.percent == 100){
this.props.confirm({
content: '是否确认删除?',
onOk: () => {
this.deleteAttachment(file, stateName)
},
@ -255,7 +255,7 @@ class NewWorkForm extends Component{
const { status } = response.data;
if (status == 0) {
console.log('--- success')
this.setState((state) => {
const index = state[stateName].indexOf(file);
const newFileList = state[stateName].slice();
@ -273,13 +273,13 @@ class NewWorkForm extends Component{
}
max_num_change = (val) => {
if (val < 2) {
// this.setState({
// this.setState({
// max_num: 2,
// })
return;
}
const { min_num } = this.state;
this.setState({
this.setState({
max_num: val,
min_num: val <= min_num ? val - 1 : min_num
})
@ -309,23 +309,23 @@ class NewWorkForm extends Component{
window.$('.groupSetting .ant-form-item-label > label').addClass('ant-form-item-required')
this._scrollToTop()
}
render(){
let {typeId,coursesId,pageType}=this.props.match.params;
const { getFieldDecorator } = this.props.form;
const isGroup = this.props.isGroup()
let{
title_value, contentFileList, answerFileList, max_num, min_num, base_on_project,
init_max_num, init_min_num,
init_max_num, init_min_num,
title_num, course_name, category, has_commit, has_project
}=this.state
const { current_user } = this.props
const courseId = this.state.course_id || this.props.match.params.coursesId ;
const courseId = this.state.course_id || this.props.match.params.coursesId ;
this.isEdit = this.isEdit || this.props.match.url.indexOf('/edit') != -1
if ((this.isEdit) && !this.state.description && this.state.description != '') {
return ''
}
}
const uploadProps = {
width: 600,
fileList: contentFileList,
@ -367,7 +367,7 @@ class NewWorkForm extends Component{
return(
<React.Fragment>
<style>
{
`
@ -383,7 +383,7 @@ class NewWorkForm extends Component{
<Form.Item
label="标题"
className="AboutInputForm"
>
>
{getFieldDecorator('title', {
rules: [{
required: true, message: '请输入标题'
@ -442,7 +442,7 @@ class NewWorkForm extends Component{
{ <Form.Item
label="内容"
className="AboutInputForm workContent mdInForm"
>
>
{getFieldDecorator('description', {
rules: [{
required: true, message: '请输入作业内容和要求',
@ -450,7 +450,7 @@ class NewWorkForm extends Component{
max: 5000 , message:'最大限制5000个字符'
}],
})(
<TPMMDEditor ref={this.contentMdRef} placeholder="请在此输入作业内容和要求,最大限制5000个字符" mdID={'courseContentMD'} refreshTimeout={1500}
<TPMMDEditor ref={this.contentMdRef} placeholder="请在此输入作业内容和要求,最大限制5000个字符" mdID={'courseContentMD'} refreshTimeout={1500}
initValue={this.state.description} noSetValueOnInit={!!this.isEdit}
className="courseMessageMD" ></TPMMDEditor>
)}
@ -461,13 +461,13 @@ class NewWorkForm extends Component{
</Button>
(单个文件150M以内)
</Upload>
{ isGroup &&
{ isGroup &&
<Form.Item
label="分组设置"
className="AboutInputForm groupSetting"
>
>
{getFieldDecorator('personNum', {
validateTrigger: 'onNone',
// rules: [{
@ -481,11 +481,11 @@ class NewWorkForm extends Component{
<p className="clearfix">
<ConditionToolTip condition={has_commit} title={'已有提交作品,人数范围只能扩大'}>
{/* max={has_commit ? init_min_num : null } */}
<InputNumber placeholder="请填写每组最小人数" min={1} className="winput-240-40" value={min_num}
<InputNumber placeholder="请填写每组最小人数" min={1} className="winput-240-40" value={min_num}
onChange={this.min_num_change} style={{width:'180px'}} />
</ConditionToolTip>
<span className="ml15 mr15">~</span>
{/* min={has_commit ? init_max_num : (min_num == undefined ? 2 : min_num + 1) } */}
<ConditionToolTip condition={has_commit} title={'已有提交作品,人数范围只能扩大'}>
@ -494,18 +494,18 @@ class NewWorkForm extends Component{
</ConditionToolTip>
<label className="color-grey-9 ml20 font-14">学生提交作品时需要关联同组成员组内成员作品共享</label>
</p>
<p className="mt20">
<ConditionToolTip condition={has_commit || has_project} title={'已有关联项目或作品,不能修改'}>
<Checkbox checked={base_on_project} onChange={this.base_on_project_change}
disabled={has_project || has_commit}
>基于项目实施</Checkbox>
</ConditionToolTip>
<label className="color-grey-9 ml12 font-14">选中则必须在本平台创建项目项目管理员可以提交作品不选中无需在平台创建项目任意小组成员均可以提交作品</label>
</p>
{/*<p className="mt20">*/}
{/* <ConditionToolTip condition={has_commit || has_project} title={'已有关联项目或作品,不能修改'}>*/}
{/* <Checkbox checked={base_on_project} onChange={this.base_on_project_change}*/}
{/* disabled={has_project || has_commit}*/}
{/* >基于项目实施</Checkbox>*/}
{/* </ConditionToolTip>*/}
{/* */}
{/* /!*<label className="color-grey-9 ml12 font-14">(选中,则必须在本平台创建项目,项目管理员可以提交作品;不选中,无需在平台创建项目,任意小组成员均可以提交作品)</label>*!/*/}
{/*</p>*/}
</div>
)}
</Form.Item>
}
<div className="edu-back-white">
@ -513,13 +513,13 @@ class NewWorkForm extends Component{
label="参考答案"
className="AboutInputForm clearPaddingBottom pr"
style={{"borderBottom":"none"}}
>
>
{getFieldDecorator('reference_answer', {
rules: [{
max: 5000 , message:'最大限制5000个字符'
}],
})(
<TPMMDEditor ref={this.answerMdRef} placeholder="请在此输入作业的参考答案,最大限制5000个字符" mdID={'workAnswerMD'}
<TPMMDEditor ref={this.answerMdRef} placeholder="请在此输入作业的参考答案,最大限制5000个字符" mdID={'workAnswerMD'}
initValue={this.state.reference_answer || ''} noSetValueOnInit={!!this.isEdit}
className="courseMessageMD" refreshTimeout={1500} ></TPMMDEditor>
)}
@ -539,10 +539,10 @@ class NewWorkForm extends Component{
</div>
</Form.Item>
</Form>
</React.Fragment>
)
}
}
const WrappedWorkForm = Form.create({ name: 'NewWorkForm' })(NewWorkForm);
export default WrappedWorkForm;
export default WrappedWorkForm;

@ -120,7 +120,7 @@ class GraduationTaskssettingapp extends Component{
maxnum: result.data.max_num,
max_nums: result.data.max_num,
task_type: result.data.task_type,
baseonproject: result.data.base_on_project,
baseonproject: false,
firstTimes:!result.data.publish_time && !result.data.end_time,
publish_time:result.data.publish_time===null||result.data.publish_time=== ""?"":moment(moment(handleDateString(result.data.publish_time))).format("YYYY-MM-DD HH:mm"),
end_time:result.data.end_time===null||result.data.end_time=== ""?"":moment(moment(handleDateString(result.data.end_time))).format("YYYY-MM-DD HH:mm"),
@ -159,20 +159,20 @@ class GraduationTaskssettingapp extends Component{
if(this.props.isAdmin()===true&&isNaN(id)){
this.editSetting()
}
let tab = this.props.tab;
this.props.setTab && this.props.setTab(tab);
try{
this.props.triggerRef(this)
}catch(e){
}
}
baseprojectfun=(e)=>{
this.setState({
baseonproject:e.target.checked
baseonproject:false
})
}
@ -1023,7 +1023,7 @@ debugger
{numtype===true?<div className={"color-red ml40"}>不能为空</div>:""}
<div>
<Tooltip placement="bottom" title={hascommit===true?"已有关联项目或作品,不能修改":""}>
<Checkbox className="ml40 " checked={baseonproject} disabled={this.props.isAdmin()===true?hascommit===true||hasproject===true?true:flagPageEdit===true?false:true:true} onChange={this.baseprojectfun}>基于项目实施</Checkbox>
{/*<Checkbox className="ml40 " checked={baseonproject} disabled={this.props.isAdmin()===true?hascommit===true||hasproject===true?true:flagPageEdit===true?false:true:true} onChange={this.baseprojectfun}>基于项目实施</Checkbox>*/}
</Tooltip>
<span className={"font-14 color-grey-c"}>选中则必须在本平台创建项目项目管理员可以提交作品不选中无需在平台创建项目任意小组成员均可以提交作品</span>
</div>
@ -1295,7 +1295,7 @@ debugger
{/*<Link to={"/courses/"+courseId+"/graduation_tasks/"+position+"/"+category_id+coursesearch} className="defalutCancelbtn fl">取消</Link>*/}
<a onClick={this.isgoback} className="defalutCancelbtn fl">取消</a>
</div>:"":""}
</div>:""}
</React.Fragment>
@ -1304,4 +1304,4 @@ debugger
}
const GraduationTaskssetting = Form.create({ name: 'coursesNew' })(GraduationTaskssettingapp);
export default GraduationTaskssetting;
export default GraduationTaskssetting;

@ -39,7 +39,7 @@ class GraduationTasksquestions extends Component{
try{
this.props.triggerRef(this)
}catch(e){
}
}
@ -341,11 +341,13 @@ class GraduationTasksquestions extends Component{
<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 className={"mt10"}>*/}
{/* <span className="font-14">基于项目实施</span>*/}
{/* <span className="font-14 color-grey-9"> 各小组必须在educoder平台创建项目</span>*/}
{/*</div>*/}
{questionslist.group_info.base_on_project===true?
""
:<div className="font-14 mt10">不基于项目实施</div>}
</div>:""}
@ -370,7 +372,7 @@ class GraduationTasksquestions extends Component{
<div className={"mt20 course-message"} style={{background: '#fff'}}>
<GraduationTaskssettingReply
memo={{id: task_Id,
memo={{id: task_Id,
user_id: questionslist && questionslist.user_id}}
course_id={courseId} {...this.props}>
</GraduationTaskssettingReply>

@ -30,7 +30,7 @@ class GraduateTopicPostWorksNew extends Component{
}
}
componentDidMount = () => {
const topicId = this.props.match.params.topicId
const cid = this.props.match.params.coursesId
@ -61,7 +61,7 @@ class GraduateTopicPostWorksNew extends Component{
this.props.form.setFieldsValue({
content: data.content,
subject: data.subject,
board_id: data.board_id
board_id: data.board_id
});
this.mdRef.current.setValue(data.content)
const _fileList = data.attachments.map(item => {
@ -133,7 +133,7 @@ class GraduateTopicPostWorksNew extends Component{
return item.response.id
})
}
axios.post(url, {
...values,
course_id: cid,
@ -194,7 +194,7 @@ class GraduateTopicPostWorksNew extends Component{
const { status } = response.data;
if (status == 0) {
console.log('--- success')
this.setState((state) => {
const index = state.fileList.indexOf(file);
const newFileList = state.fileList.slice();
@ -334,7 +334,7 @@ class GraduateTopicPostWorksNew extends Component{
(单个文件150M以内)
</Upload>
</div>
<style>{`
.courseForm .flexBlock.formBlock {
@ -383,18 +383,18 @@ class GraduateTopicPostWorksNew extends Component{
</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>
{/*<Form.Item*/}
{/* label=""*/}
{/* className=" "*/}
{/* style={{ marginLeft: "14px" }}*/}
{/*>*/}
{/* {getFieldDecorator('c', {*/}
{/* rules: [],*/}
{/* })(*/}
{/* <Checkbox >基于项目实施</Checkbox>*/}
{/* )}*/}
{/*</Form.Item>*/}
{/*<span className="tag color-grey9 ">(选中,则必须在本平台创建项目,项目管理员可以提交作品;不选中,无需在平台创建项目,任意小组成员均可以提交作品)</span>*/}
</div>
<div className="formBlock">
@ -412,7 +412,7 @@ class GraduateTopicPostWorksNew extends Component{
mdID={'courseAnswerMD'} initValue={this.editTopic ? this.editTopic.content : ''} className="courseMessageMD"></TPMMDEditor>
)}
</Form.Item>
</div>
</div>
<Form.Item>
<div className="clearfix mt30 mb30">
@ -429,4 +429,4 @@ class GraduateTopicPostWorksNew extends Component{
const WrappedGraduateTopicPostWorksNew = Form.create({ name: 'topicPostWorksNew' })(GraduateTopicPostWorksNew);
// RouteHOC()
export default (WrappedGraduateTopicPostWorksNew);
export default (WrappedGraduateTopicPostWorksNew);

@ -67,14 +67,14 @@ class GroupPackage extends Component {
<span className="ysltextcolor05">{datas&&datas.min_num}~ {datas&&datas.max_num} 学生提交作品时需要关联同组成员组内成员作品共享</span>
</p>
}
{/*<p>*/}
{/* <span className="ysltextcolor66">基于项目实施</span>*/}
{/* <span className="ysltextcolor05">(学生必须在本平台创建项目,项目管理员可以提交作品)</span>*/}
{/*</p>*/}
{
datas===undefined?"":datas.base_on_project===undefined?"":
datas.base_on_project===true?
<p>
<span className="ysltextcolor66">基于项目实施</span>
<span className="ysltextcolor05">学生必须在本平台创建项目项目管理员可以提交作品</span>
</p>
""
:datas.base_on_project===false?
<p>
<span className="ysltextcolor66">不基于项目</span>
@ -93,12 +93,13 @@ class GroupPackage extends Component {
<span className="ysltextcolor05">{datas&&datas.group_info&&datas.group_info.min_number}~ {datas&&datas.group_info&&datas.group_info.max_number} 学生提交作品时需要关联同组成员组内成员作品共享</span>
</p>
}
{/*<p>*/}
{/* <span className="ysltextcolor66">基于项目实施</span>*/}
{/* <span className="ysltextcolor05">(学生必须在本平台创建项目,项目管理员可以提交作品)</span>*/}
{/*</p>*/}
{
datas&&datas.group_info&&datas.group_info.base_on_project===1?
<p>
<span className="ysltextcolor66">基于项目实施</span>
<span className="ysltextcolor05">学生必须在本平台创建项目项目管理员可以提交作品</span>
</p>
""
:datas&&datas.group_info&&datas.group_info.base_on_project===0?
<p>
<span className="ysltextcolor66">不基于项目</span>
@ -111,4 +112,4 @@ class GroupPackage extends Component {
}
}
export default GroupPackage;
export default GroupPackage;

@ -861,15 +861,13 @@ class CoursesNew extends Component {
>
{getFieldDecorator("checkboxgroup", {
initialValue: [
"shixun_homework", "common_homework", "group_homework", "exercise", "attachment", "course_group",
"shixun_homework", "common_homework", "exercise", "attachment", "course_group",
],
})(
<Checkbox.Group style={{width: "800px", marginTop: "10px"}}>
<Checkbox value={"announcement"} className="fl">公告栏</Checkbox>
<Checkbox value={"shixun_homework"} className="fl">实训作业</Checkbox>
<Checkbox value={"common_homework"} className="fl">普通作业</Checkbox>
<Checkbox value={"group_homework"} className="fl">分组作业</Checkbox>
<Checkbox value={"graduation"} className="fl">毕业设计</Checkbox>
<Checkbox value={"exercise"} className="fl">试卷</Checkbox>
<Checkbox value={"poll"} className="fl">问卷</Checkbox>
<Checkbox value={"attachment"} className="fl">资源</Checkbox>
@ -977,4 +975,4 @@ class CoursesNew extends Component {
}
const WrappedCoursesNewApp = Form.create({name: 'coursesNew'})(CoursesNew);
export default WrappedCoursesNewApp;
export default WrappedCoursesNewApp;

Loading…
Cancel
Save