From 7406f2326bded389e37356adb5566c213501a65e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Sat, 14 Mar 2020 16:16:55 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/exercise/new/NullChildEditor.js | 18 +++-- .../courses/exercise/new/NullEditor.js | 66 ++++++++++++------- .../courses/signin/css/Signinstatistics.css | 14 ++++ .../courses/signin/student/Signedinlist.js | 12 ++-- 4 files changed, 72 insertions(+), 38 deletions(-) diff --git a/public/react/src/modules/courses/exercise/new/NullChildEditor.js b/public/react/src/modules/courses/exercise/new/NullChildEditor.js index 5146f05ec..d2f710e55 100644 --- a/public/react/src/modules/courses/exercise/new/NullChildEditor.js +++ b/public/react/src/modules/courses/exercise/new/NullChildEditor.js @@ -19,11 +19,11 @@ const { Option } = Select; class NullChildEditor extends Component{ constructor(props){ super(props); - + this.state = { } } - + // toMDMode = (that) => { // if (this.mdReactObject) { // let mdReactObject = this.mdReactObject; @@ -41,7 +41,7 @@ class NullChildEditor extends Component{ render() { let { question_title, question_score, question_type, question_choices, standard_answers } = this.state; - let { question_id, index, onAnswerChange, addChildAnswer, toMDMode, exerciseIsPublish, + let { question_id, index, onAnswerChange, addChildAnswer, toMDMode, exerciseIsPublish, answers } = this.props; // marginTop: '18px' return( @@ -57,18 +57,24 @@ class NullChildEditor extends Component{ className={'nullChildEditor'} placeholder={`请输入参考答案${itemIndex == 0 ?'':'(可选)'}`} toMDMode={toMDMode} noStorage={true} - mdID={`answer_${index}${itemIndex}`} height={155} + mdID={`answer_${index}${itemIndex}`} height={155} initValue={item} onChange={(val) => onAnswerChange(index, itemIndex, val)} > - {!exerciseIsPublish && + {!exerciseIsPublish && {itemIndex != 0 && - this.props.deleteChildAnswer(index, itemIndex)} style={{float: 'right'}} > } + {itemIndex === 0 && + this.props.deleteChildAnswermain(index, itemIndex)} + style={{float: 'right'}} + > + } { addChildAnswer(index)} diff --git a/public/react/src/modules/courses/exercise/new/NullEditor.js b/public/react/src/modules/courses/exercise/new/NullEditor.js index dcb310396..9b5dcf9ef 100644 --- a/public/react/src/modules/courses/exercise/new/NullEditor.js +++ b/public/react/src/modules/courses/exercise/new/NullEditor.js @@ -38,7 +38,7 @@ class NullEditor extends Component{ answers.answer_text.forEach((item, itemIndex) => { _standard_answers[index].push(item) }) - + }) } this.state = { @@ -53,7 +53,7 @@ class NullEditor extends Component{ this.setState({ is_ordered: e.target.checked}) } - + onSave = () => { const {question_title, question_score, question_type, question_choices, standard_answers, is_ordered } = this.state; const { question_id_to_insert_after, question_id } = this.props @@ -78,8 +78,8 @@ class NullEditor extends Component{ this.props.showNotification('分值:必须大于0'); return; } else if(!question_score || intScore == NaN) { this.props.showNotification('分值:不能为空'); return; - } - + } + let isEmpty = false; standard_answers.forEach((answers, index) => { @@ -91,8 +91,8 @@ class NullEditor extends Component{ answerArray[index].answer_text.push(item) if(!item) { this.refs[`nullChildEditor${index}`].showError(itemIndex) - // this.props.showNotification(`请先输入第${index+1}个填空的第${itemIndex+1}参考答案。`); - this.props.showNotification(`答案:不能为空`); + // this.props.showNotification(`请先输入第${index+1}个填空的第${itemIndex+1}参考答案。`); + this.props.showNotification(`答案:不能为空`); isEmpty = true; } }) @@ -122,7 +122,7 @@ class NullEditor extends Component{ "is_ordered":true } }*/ - const Id = this.props.match.params.Id + const Id = this.props.match.params.Id if (question_id) { const editUrl = this.props.getEditQuestionUrl(question_id); axios.put(editUrl, { @@ -146,7 +146,7 @@ class NullEditor extends Component{ }); } else { const url = this.props.getAddQuestionUrl(); - + axios.post(url, { exercise_bank_id: Id, question_title, @@ -165,13 +165,13 @@ class NullEditor extends Component{ .catch(function (error) { console.log(error); }); - } + } } onCancel = () => { this.props.onEditorCancel() } componentDidMount = () => { - + } on_question_score_change = (e) => { this.setState({ question_score: e }) @@ -195,13 +195,13 @@ class NullEditor extends Component{ this.mdReactObject.toShowMode() } }) - + } - + onAnswerChange = (index, itemIndex, val) => { if (this.state.standard_answers[index]) { this.setState( - (prevState) => ({ + (prevState) => ({ standard_answers : update(prevState.standard_answers , {[index]: {$splice: [[itemIndex, 1, val]]}}), }) @@ -217,6 +217,21 @@ class NullEditor extends Component{ ) } + deleteChildAnswermain=(index, childIndex)=>{ + let newstandard_answers=this.state.standard_answers + + this.props.confirm({ + content: `确认要删除这个参考答案吗?`, + onOk: () => { + newstandard_answers.splice(index,1) + this.setState({ + standard_answers:newstandard_answers + }) + + } + }) + } + deleteChildAnswer = (index, childIndex) => { if(!this.state.standard_answers[index][childIndex]) { this.setState( @@ -258,16 +273,16 @@ class NullEditor extends Component{ } this.mdReactObject = that; } - + render() { let { question_title, question_score, question_type, question_choices, standard_answers , is_ordered } = this.state; let { question_id, index, exerciseIsPublish, - // question_title, - // question_type, + // question_title, + // question_type, // question_score, isNew } = this.props; - + // const { getFieldDecorator } = this.props.form; const isAdmin = this.props.isAdmin() @@ -302,17 +317,17 @@ class NullEditor extends Component{ (客观题,由系统自动评分,允许手动调分,请设置标准答案 ;支持最多5个空,每空得分按照本题的总分平均计算)

- this.setState({ question_title: val})} onPlaceholderChange={this.onPlaceholderChange} showNullButton={exerciseIsPublish ? false : true} ref="titleEditor" > - +
{ standard_answers.map((answers, index) => { - return // answer.map((item, itemIndex) => { // return
@@ -346,16 +362,16 @@ class NullEditor extends Component{ 分 - - + + 取消 保存 - +
- +
) } diff --git a/public/react/src/modules/courses/signin/css/Signinstatistics.css b/public/react/src/modules/courses/signin/css/Signinstatistics.css index 627458052..060793bc6 100644 --- a/public/react/src/modules/courses/signin/css/Signinstatistics.css +++ b/public/react/src/modules/courses/signin/css/Signinstatistics.css @@ -150,6 +150,10 @@ color:#FF835C; } +.color909399{ + color:#909399; +} + .color1890FF{ color:#1890FF; } @@ -185,4 +189,14 @@ .sginboxcolorFF835C .ant-select-arrow{ color: #FF835C !important; +} + + + +.sginboxcolor909399 .ant-select-selection--single{ + border:1px solid #909399 !important; +} + +.sginboxcolor909399 .ant-select-arrow{ + color: #909399 !important; } \ No newline at end of file diff --git a/public/react/src/modules/courses/signin/student/Signedinlist.js b/public/react/src/modules/courses/signin/student/Signedinlist.js index f9c3459a6..16e4c3865 100644 --- a/public/react/src/modules/courses/signin/student/Signedinlist.js +++ b/public/react/src/modules/courses/signin/student/Signedinlist.js @@ -23,12 +23,12 @@ class Signedinlist extends Component { {id:undefined,name:"全部状态"}, {id:"NORMAL",name:"正常签到"}, {id:"LEAVE",name:"请 假"}, - {id:"ABSENCE",name:"旷 课"}, + {id:"ABSENCE",name:this.props.defaultActiveKey ==="2"?"旷 课":"未签到"}, ], newstate:[ {id:"NORMAL",name:"正常签到"}, {id:"LEAVE",name:"请 假"}, - {id:"ABSENCE",name:"旷 课"}, + {id:"ABSENCE",name:this.props.defaultActiveKey ==="2"?"旷 课":"未签到"}, ], course_members_count:'--', attendance_count:'--', @@ -36,8 +36,6 @@ class Signedinlist extends Component { } componentDidMount() { - - this.getdatas(this.props&&this.props.switattendance_id,1,[],undefined) // this.getpath() } @@ -161,7 +159,6 @@ class Signedinlist extends Component { } handleChangestate=(value)=>{ let neval - if(!value){ neval=undefined this.setState({ @@ -214,6 +211,7 @@ class Signedinlist extends Component { this.setState({ member_attendances:newmember_attendances }) + this.props.mygetdatas() } }) .catch(function (error) { @@ -264,14 +262,14 @@ class Signedinlist extends Component {