PCqiandao
杨树明 5 years ago
parent c6d6ab0950
commit 7406f2326b

@ -19,11 +19,11 @@ const { Option } = Select;
class NullChildEditor extends Component{ class NullChildEditor extends Component{
constructor(props){ constructor(props){
super(props); super(props);
this.state = { this.state = {
} }
} }
// toMDMode = (that) => { // toMDMode = (that) => {
// if (this.mdReactObject) { // if (this.mdReactObject) {
// let mdReactObject = this.mdReactObject; // let mdReactObject = this.mdReactObject;
@ -41,7 +41,7 @@ class NullChildEditor extends Component{
render() { render() {
let { question_title, question_score, question_type, question_choices, standard_answers } = this.state; 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; answers } = this.props;
// marginTop: '18px' // marginTop: '18px'
return( return(
@ -57,18 +57,24 @@ class NullChildEditor extends Component{
className={'nullChildEditor'} className={'nullChildEditor'}
placeholder={`请输入参考答案${itemIndex == 0 ?'':'(可选)'}`} placeholder={`请输入参考答案${itemIndex == 0 ?'':'(可选)'}`}
toMDMode={toMDMode} noStorage={true} toMDMode={toMDMode} noStorage={true}
mdID={`answer_${index}${itemIndex}`} height={155} mdID={`answer_${index}${itemIndex}`} height={155}
initValue={item} onChange={(val) => onAnswerChange(index, itemIndex, val)} initValue={item} onChange={(val) => onAnswerChange(index, itemIndex, val)}
></DMDEditor> ></DMDEditor>
</div> </div>
{!exerciseIsPublish && {!exerciseIsPublish &&
<React.Fragment> <React.Fragment>
{itemIndex != 0 && <Tooltip title="删除"> {itemIndex != 0 && <Tooltip title="删除">
<i className="iconfont icon-htmal5icon19 font-18 color-grey-c ml10" <i className="iconfont icon-htmal5icon19 font-18 color-grey-c ml10"
onClick={() => this.props.deleteChildAnswer(index, itemIndex)} onClick={() => this.props.deleteChildAnswer(index, itemIndex)}
style={{float: 'right'}} style={{float: 'right'}}
></i> ></i>
</Tooltip> } </Tooltip> }
{itemIndex === 0 && <Tooltip title="删除">
<i className="iconfont icon-htmal5icon19 font-18 color-grey-c ml10"
onClick={() => this.props.deleteChildAnswermain(index, itemIndex)}
style={{float: 'right'}}
></i>
</Tooltip> }
{ <Tooltip title={`新增参考答案`}> { <Tooltip title={`新增参考答案`}>
<i className="color-green font-16 iconfont icon-roundaddfill ml6" <i className="color-green font-16 iconfont icon-roundaddfill ml6"
onClick={() => addChildAnswer(index)} onClick={() => addChildAnswer(index)}

@ -38,7 +38,7 @@ class NullEditor extends Component{
answers.answer_text.forEach((item, itemIndex) => { answers.answer_text.forEach((item, itemIndex) => {
_standard_answers[index].push(item) _standard_answers[index].push(item)
}) })
}) })
} }
this.state = { this.state = {
@ -53,7 +53,7 @@ class NullEditor extends Component{
this.setState({ is_ordered: e.target.checked}) this.setState({ is_ordered: e.target.checked})
} }
onSave = () => { onSave = () => {
const {question_title, question_score, question_type, question_choices, standard_answers, is_ordered } = this.state; 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 const { question_id_to_insert_after, question_id } = this.props
@ -78,8 +78,8 @@ class NullEditor extends Component{
this.props.showNotification('分值必须大于0'); return; this.props.showNotification('分值必须大于0'); return;
} else if(!question_score || intScore == NaN) { } else if(!question_score || intScore == NaN) {
this.props.showNotification('分值:不能为空'); return; this.props.showNotification('分值:不能为空'); return;
} }
let isEmpty = false; let isEmpty = false;
standard_answers.forEach((answers, index) => { standard_answers.forEach((answers, index) => {
@ -91,8 +91,8 @@ class NullEditor extends Component{
answerArray[index].answer_text.push(item) answerArray[index].answer_text.push(item)
if(!item) { if(!item) {
this.refs[`nullChildEditor${index}`].showError(itemIndex) this.refs[`nullChildEditor${index}`].showError(itemIndex)
// this.props.showNotification(`请先输入第${index+1}个填空的第${itemIndex+1}参考答案。`); // this.props.showNotification(`请先输入第${index+1}个填空的第${itemIndex+1}参考答案。`);
this.props.showNotification(`答案:不能为空`); this.props.showNotification(`答案:不能为空`);
isEmpty = true; isEmpty = true;
} }
}) })
@ -122,7 +122,7 @@ class NullEditor extends Component{
"is_ordered":true "is_ordered":true
} }
}*/ }*/
const Id = this.props.match.params.Id const Id = this.props.match.params.Id
if (question_id) { if (question_id) {
const editUrl = this.props.getEditQuestionUrl(question_id); const editUrl = this.props.getEditQuestionUrl(question_id);
axios.put(editUrl, { axios.put(editUrl, {
@ -146,7 +146,7 @@ class NullEditor extends Component{
}); });
} else { } else {
const url = this.props.getAddQuestionUrl(); const url = this.props.getAddQuestionUrl();
axios.post(url, { axios.post(url, {
exercise_bank_id: Id, exercise_bank_id: Id,
question_title, question_title,
@ -165,13 +165,13 @@ class NullEditor extends Component{
.catch(function (error) { .catch(function (error) {
console.log(error); console.log(error);
}); });
} }
} }
onCancel = () => { onCancel = () => {
this.props.onEditorCancel() this.props.onEditorCancel()
} }
componentDidMount = () => { componentDidMount = () => {
} }
on_question_score_change = (e) => { on_question_score_change = (e) => {
this.setState({ question_score: e }) this.setState({ question_score: e })
@ -195,13 +195,13 @@ class NullEditor extends Component{
this.mdReactObject.toShowMode() this.mdReactObject.toShowMode()
} }
}) })
} }
onAnswerChange = (index, itemIndex, val) => { onAnswerChange = (index, itemIndex, val) => {
if (this.state.standard_answers[index]) { if (this.state.standard_answers[index]) {
this.setState( this.setState(
(prevState) => ({ (prevState) => ({
standard_answers : update(prevState.standard_answers standard_answers : update(prevState.standard_answers
, {[index]: {$splice: [[itemIndex, 1, val]]}}), , {[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) => { deleteChildAnswer = (index, childIndex) => {
if(!this.state.standard_answers[index][childIndex]) { if(!this.state.standard_answers[index][childIndex]) {
this.setState( this.setState(
@ -258,16 +273,16 @@ class NullEditor extends Component{
} }
this.mdReactObject = that; this.mdReactObject = that;
} }
render() { render() {
let { question_title, question_score, question_type, question_choices, standard_answers let { question_title, question_score, question_type, question_choices, standard_answers
, is_ordered } = this.state; , is_ordered } = this.state;
let { question_id, index, exerciseIsPublish, let { question_id, index, exerciseIsPublish,
// question_title, // question_title,
// question_type, // question_type,
// question_score, // question_score,
isNew } = this.props; isNew } = this.props;
// const { getFieldDecorator } = this.props.form; // const { getFieldDecorator } = this.props.form;
const isAdmin = this.props.isAdmin() const isAdmin = this.props.isAdmin()
@ -302,17 +317,17 @@ class NullEditor extends Component{
<span className="color-grey-9 font-12 fl">客观题由系统自动评分允许手动调分请设置标准答案 支持最多5个空每空得分按照本题的总分平均计算</span> <span className="color-grey-9 font-12 fl">客观题由系统自动评分允许手动调分请设置标准答案 支持最多5个空每空得分按照本题的总分平均计算</span>
</p> </p>
<NullMDEditor {...this.props} mdID={`question_${question_id}`} placeholder="请您输入题目" height={155} <NullMDEditor {...this.props} mdID={`question_${question_id}`} placeholder="请您输入题目" height={155}
initValue={question_title} onChange={(val) => this.setState({ question_title: val})} initValue={question_title} onChange={(val) => this.setState({ question_title: val})}
onPlaceholderChange={this.onPlaceholderChange} showNullButton={exerciseIsPublish ? false : true} onPlaceholderChange={this.onPlaceholderChange} showNullButton={exerciseIsPublish ? false : true}
ref="titleEditor" ref="titleEditor"
></NullMDEditor> ></NullMDEditor>
<div className="clearfix"> <div className="clearfix">
{ {
standard_answers.map((answers, index) => { standard_answers.map((answers, index) => {
return <NullChildEditor return <NullChildEditor
ref={`nullChildEditor${index}`} ref={`nullChildEditor${index}`}
{...this.props} {...this.props}
toMDMode={this.toMDMode} toMDMode={this.toMDMode}
@ -321,6 +336,7 @@ class NullEditor extends Component{
onAnswerChange={this.onAnswerChange} onAnswerChange={this.onAnswerChange}
addChildAnswer={this.addChildAnswer} addChildAnswer={this.addChildAnswer}
deleteChildAnswer={this.deleteChildAnswer} deleteChildAnswer={this.deleteChildAnswer}
deleteChildAnswermain={this.deleteChildAnswermain}
></NullChildEditor> ></NullChildEditor>
// answer.map((item, itemIndex) => { // answer.map((item, itemIndex) => {
// return <DMDEditor // return <DMDEditor
@ -331,7 +347,7 @@ class NullEditor extends Component{
// }) // })
}) })
} }
</div> </div>
<div className="clearfix "> <div className="clearfix ">
@ -346,16 +362,16 @@ class NullEditor extends Component{
<InputNumber step={0.1} precision={1} min={0} max={100} style={{width: 100}} value={question_score} onChange={this.on_question_score_change} <InputNumber step={0.1} precision={1} min={0} max={100} style={{width: 100}} value={question_score} onChange={this.on_question_score_change}
disabled={exerciseIsPublish} placeholder="请填写分数" disabled={exerciseIsPublish} placeholder="请填写分数"
></InputNumber > ></InputNumber >
<span className="fr"> <span className="fr">
<ActionBtn style="greyBack" className="middle mr20" onClick={this.onCancel} <ActionBtn style="greyBack" className="middle mr20" onClick={this.onCancel}
>取消</ActionBtn> >取消</ActionBtn>
<ActionBtn style="blue" className="middle" onClick={this.onSave}>保存</ActionBtn> <ActionBtn style="blue" className="middle" onClick={this.onSave}>保存</ActionBtn>
</span> </span>
</div> </div>
</div> </div>
) )
} }

@ -150,6 +150,10 @@
color:#FF835C; color:#FF835C;
} }
.color909399{
color:#909399;
}
.color1890FF{ .color1890FF{
color:#1890FF; color:#1890FF;
} }
@ -185,4 +189,14 @@
.sginboxcolorFF835C .ant-select-arrow{ .sginboxcolorFF835C .ant-select-arrow{
color: #FF835C !important; color: #FF835C !important;
}
.sginboxcolor909399 .ant-select-selection--single{
border:1px solid #909399 !important;
}
.sginboxcolor909399 .ant-select-arrow{
color: #909399 !important;
} }

@ -23,12 +23,12 @@ class Signedinlist extends Component {
{id:undefined,name:"全部状态"}, {id:undefined,name:"全部状态"},
{id:"NORMAL",name:"正常签到"}, {id:"NORMAL",name:"正常签到"},
{id:"LEAVE",name:"请 假"}, {id:"LEAVE",name:"请 假"},
{id:"ABSENCE",name:"旷 课"}, {id:"ABSENCE",name:this.props.defaultActiveKey ==="2"?"旷 课":"未签到"},
], ],
newstate:[ newstate:[
{id:"NORMAL",name:"正常签到"}, {id:"NORMAL",name:"正常签到"},
{id:"LEAVE",name:"请 假"}, {id:"LEAVE",name:"请 假"},
{id:"ABSENCE",name:"旷 课"}, {id:"ABSENCE",name:this.props.defaultActiveKey ==="2"?"旷 课":"未签到"},
], ],
course_members_count:'--', course_members_count:'--',
attendance_count:'--', attendance_count:'--',
@ -36,8 +36,6 @@ class Signedinlist extends Component {
} }
componentDidMount() { componentDidMount() {
this.getdatas(this.props&&this.props.switattendance_id,1,[],undefined) this.getdatas(this.props&&this.props.switattendance_id,1,[],undefined)
// this.getpath() // this.getpath()
} }
@ -161,7 +159,6 @@ class Signedinlist extends Component {
} }
handleChangestate=(value)=>{ handleChangestate=(value)=>{
let neval let neval
if(!value){ if(!value){
neval=undefined neval=undefined
this.setState({ this.setState({
@ -214,6 +211,7 @@ class Signedinlist extends Component {
this.setState({ this.setState({
member_attendances:newmember_attendances member_attendances:newmember_attendances
}) })
this.props.mygetdatas()
} }
}) })
.catch(function (error) { .catch(function (error) {
@ -264,14 +262,14 @@ class Signedinlist extends Component {
<span> <span>
<Select key={record.index} defaultValue={record.attendance_status} <Select key={record.index} defaultValue={record.attendance_status}
// className={"Signedinlistbox"} // className={"Signedinlistbox"}
className={record.attendance_status==="NORMAL"?"color26C7C9 Signedinlistbox sginboxcolor26C7C9":record.attendance_status==="LEAVE"?"colorEAAE4E Signedinlistbox sginboxcolorEAAE4E":record.attendance_status==="ABSENCE"?"colorFF835C Signedinlistbox sginboxcolorFF835C":"Signedinlistbox"} className={record.attendance_status==="NORMAL"?"color26C7C9 Signedinlistbox sginboxcolor26C7C9":record.attendance_status==="LEAVE"?"colorEAAE4E Signedinlistbox sginboxcolorEAAE4E":record.attendance_status==="ABSENCE"?this.props.defaultActiveKey==="2"?"colorFF835C Signedinlistbox sginboxcolorFF835C":"color909399 Signedinlistbox sginboxcolor909399":"Signedinlistbox"}
style={{ width: 167 }} onChange={(e)=>this.handleChange(e,record.user_id)}> style={{ width: 167 }} onChange={(e)=>this.handleChange(e,record.user_id)}>
{ {
newstate&&newstate.map((item,key)=>{ newstate&&newstate.map((item,key)=>{
return( return(
<Option value={item.id} key={key} <Option value={item.id} key={key}
className={item.name==="正常签到"?"color26C7C9 sginbox":item.name==="请 假"?"colorEAAE4E sginbox":item.name==="旷 课"?"colorFF835C sginbox":""}>{item.name}</Option> className={item.name==="正常签到"?"color26C7C9 sginbox":item.name==="请 假"?"colorEAAE4E sginbox":item.name==="旷 课"?"colorFF835C sginbox": item.name ==="未签到"?"color909399 sginbox":""}>{item.name}</Option>
) )
}) })
} }

Loading…
Cancel
Save