|
|
|
@ -10,12 +10,13 @@ import moment from 'moment';
|
|
|
|
|
import { WordsBtn,markdownToHTML,ActionBtn,getImageUrl, MarkdownToHtml } from 'educoder';
|
|
|
|
|
import Modals from '../../modals/Modals';
|
|
|
|
|
import CoursesListType from '../coursesPublic/CoursesListType';
|
|
|
|
|
|
|
|
|
|
import QuillForEditor from "../../../common/quillForEditor";
|
|
|
|
|
import Multiple from './question/multiple';
|
|
|
|
|
import Single from './question/single';
|
|
|
|
|
import FillEmpty from './question/fillEmpty';
|
|
|
|
|
import SimpleAnswer from './question/simpleAnswer';
|
|
|
|
|
import ShixunAnswer from './question/shixunAnswer';
|
|
|
|
|
import QuestionModalPicture from '../../question/component/QuestionModalPicture'
|
|
|
|
|
|
|
|
|
|
import update from 'immutability-helper';
|
|
|
|
|
|
|
|
|
@ -37,7 +38,7 @@ const tagArray = [
|
|
|
|
|
const $ = window.$;
|
|
|
|
|
const statudmap={1:"未发布",2:"已发布",3:"已截止"}
|
|
|
|
|
|
|
|
|
|
const type=["单选题","多选题","判断题","填空题","简答题","实训题"]
|
|
|
|
|
const type=["单选题","多选题","判断题","填空题","简答题","实训题","编程题"]
|
|
|
|
|
|
|
|
|
|
const format="YYYY-MM-DD HH:mm"
|
|
|
|
|
class ExerciseReviewAndAnswer extends Component{
|
|
|
|
@ -86,8 +87,12 @@ class ExerciseReviewAndAnswer extends Component{
|
|
|
|
|
// 加载效果
|
|
|
|
|
isSpin:false,
|
|
|
|
|
// 调分数组
|
|
|
|
|
ajustSore:undefined
|
|
|
|
|
}
|
|
|
|
|
ajustSore:undefined,
|
|
|
|
|
//是否是md编辑器
|
|
|
|
|
is_md:false,
|
|
|
|
|
url: "",
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
componentDidUpdate (prevProps) {
|
|
|
|
|
// 需要等get_user_info执行完才能getInfo
|
|
|
|
@ -102,6 +107,18 @@ class ExerciseReviewAndAnswer extends Component{
|
|
|
|
|
|
|
|
|
|
//window.addEventListener('scroll', this.handleScroll);
|
|
|
|
|
}
|
|
|
|
|
handleShowUploadImage = (url) => {
|
|
|
|
|
// console.log('==============>>>>>>>>>>>>',url);
|
|
|
|
|
// setUrl(url);
|
|
|
|
|
this.setState({
|
|
|
|
|
url:url
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
handleClose=()=>{
|
|
|
|
|
this.setState({
|
|
|
|
|
url:'',
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
remainTime=(time)=>{
|
|
|
|
|
// let { time } = this.state;
|
|
|
|
@ -206,6 +223,7 @@ class ExerciseReviewAndAnswer extends Component{
|
|
|
|
|
data:result.data,
|
|
|
|
|
e_ReviewInfo:result.data,
|
|
|
|
|
exercise:result.data.exercise,
|
|
|
|
|
is_md:result.data.exercise.is_md,
|
|
|
|
|
exercise_types:result.data.exercise_scores.exercise_types,
|
|
|
|
|
exercise_scores:result.data.exercise_scores,
|
|
|
|
|
exercise_start_at:result.data.exercise_answer_user.start_at,
|
|
|
|
@ -633,7 +651,9 @@ class ExerciseReviewAndAnswer extends Component{
|
|
|
|
|
Loadtype,
|
|
|
|
|
exerciseTotalScore,
|
|
|
|
|
isSpin,
|
|
|
|
|
ajustSore
|
|
|
|
|
ajustSore,
|
|
|
|
|
is_md,
|
|
|
|
|
url
|
|
|
|
|
}=this.state
|
|
|
|
|
let isAdmin = this.props.isAdmin();
|
|
|
|
|
let isStudent =this.props.isStudent();
|
|
|
|
@ -670,8 +690,15 @@ class ExerciseReviewAndAnswer extends Component{
|
|
|
|
|
.standardAnswer.editormd-html-preview,.answerStyle.editormd-html-preview{
|
|
|
|
|
width:100%!important
|
|
|
|
|
}
|
|
|
|
|
.ql-editor{
|
|
|
|
|
padding:0px !important
|
|
|
|
|
}
|
|
|
|
|
`}</style>
|
|
|
|
|
{/*<p style={{height:"60px"}}></p>*/}
|
|
|
|
|
{url?
|
|
|
|
|
<QuestionModalPicture {...this.props} {...this.state} handleClose={()=>this.handleClose()}></QuestionModalPicture>
|
|
|
|
|
:
|
|
|
|
|
""
|
|
|
|
|
}
|
|
|
|
|
<Modals
|
|
|
|
|
modalsType={Modalstype}
|
|
|
|
|
modalsTopval={Modalstopval}
|
|
|
|
@ -745,6 +772,10 @@ class ExerciseReviewAndAnswer extends Component{
|
|
|
|
|
exercise_types && exercise_types.q_shixuns > 0 &&
|
|
|
|
|
<span className="color-grey-9 mr15">实训题 {exercise_types.q_shixuns} 题,共 {exercise_types && exercise_types.q_shixuns_scores} 分</span>
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
exercise_types && exercise_types.q_pros > 0 &&
|
|
|
|
|
<span className="color-grey-9 mr15">编程题 {exercise_types.q_pros} 题,共 {exercise_types && exercise_types.q_pros_scores} 分</span>
|
|
|
|
|
}
|
|
|
|
|
<span className="color-grey-3 fr">共<span className="color-orange-tip"> {exercise_types &&exercise_types.q_scores} </span>分</span>
|
|
|
|
|
<span className="color-grey-3 fr">合计<span className="color-blue"> {exercise_types &&exercise_types.q_counts} </span>题:</span>
|
|
|
|
|
</p>
|
|
|
|
@ -831,6 +862,28 @@ class ExerciseReviewAndAnswer extends Component{
|
|
|
|
|
{
|
|
|
|
|
exercise_questions && exercise_questions.map((item,key)=>{
|
|
|
|
|
let list = ajustSore && ajustSore.filter(obj => obj.id === item.question_id);
|
|
|
|
|
let titename="";
|
|
|
|
|
if(is_md===true){
|
|
|
|
|
console.log(is_md);
|
|
|
|
|
titename=(item.question_type == 5 ? item.shixun_name : item.question_title);
|
|
|
|
|
}else{
|
|
|
|
|
try {
|
|
|
|
|
titename = JSON.parse(item.question_title);
|
|
|
|
|
}catch (e) {
|
|
|
|
|
titename={"ops":[{"insert":item.question_title}]};
|
|
|
|
|
}
|
|
|
|
|
if(titename===undefined){
|
|
|
|
|
titename={"ops":[{"insert":item.question_title}]};
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
// JSON.parse 转换的时候如果是数字字符串就转成整数了
|
|
|
|
|
if(titename>=0){
|
|
|
|
|
titename={"ops":[{"insert":item.question_title}]};
|
|
|
|
|
}
|
|
|
|
|
}catch (e) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return(
|
|
|
|
|
<div className="bor-top-greyE pt30 pb30" id={"Anchor_"+parseInt(key+1)}>
|
|
|
|
|
<p className="clearfix font-16 pl30 pr30">
|
|
|
|
@ -869,9 +922,19 @@ class ExerciseReviewAndAnswer extends Component{
|
|
|
|
|
</p>
|
|
|
|
|
<li className="break_word mt15 mb15 pl30 pr30">
|
|
|
|
|
{/* <p className="standardAnswer markdown-body" dangerouslySetInnerHTML={{__html: markdownToHTML1(item.question_type == 5 ? item.shixun_name : item.question_title).replace(/▁/g,"▁▁▁")}}></p> */}
|
|
|
|
|
<MarkdownToHtml content={(item.question_type == 5 ? item.shixun_name : item.question_title)} selector={'answer_' + key}
|
|
|
|
|
className="standardAnswer"
|
|
|
|
|
></MarkdownToHtml>
|
|
|
|
|
{
|
|
|
|
|
is_md===true?
|
|
|
|
|
<MarkdownToHtml content={titename} selector={'answer_' + key}
|
|
|
|
|
className="standardAnswer"
|
|
|
|
|
></MarkdownToHtml>
|
|
|
|
|
:
|
|
|
|
|
<QuillForEditor
|
|
|
|
|
readOnly={true}
|
|
|
|
|
value={titename}
|
|
|
|
|
showUploadImage={this.handleShowUploadImage}
|
|
|
|
|
/>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</li>
|
|
|
|
|
{
|
|
|
|
|
// 选择题和判断题共用
|
|
|
|
@ -879,12 +942,14 @@ class ExerciseReviewAndAnswer extends Component{
|
|
|
|
|
<Single
|
|
|
|
|
{...this.props}
|
|
|
|
|
{...this.state}
|
|
|
|
|
is_md={is_md}
|
|
|
|
|
exercise={exercise}
|
|
|
|
|
questionType={item}
|
|
|
|
|
user_exercise_status={user_exercise_status}
|
|
|
|
|
changeOption={(index,ids)=>this.changeOption(index,ids)}
|
|
|
|
|
changeQuestionStatus={(No,flag)=>this.changeQuestionStatus(No,flag)}
|
|
|
|
|
index={key}
|
|
|
|
|
handleShowUploadImage={(u)=>this.handleShowUploadImage(u)}
|
|
|
|
|
></Single>
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
@ -893,13 +958,14 @@ class ExerciseReviewAndAnswer extends Component{
|
|
|
|
|
<Multiple
|
|
|
|
|
{...this.props}
|
|
|
|
|
{...this.state}
|
|
|
|
|
exercise={exercise}
|
|
|
|
|
is_md={is_md}
|
|
|
|
|
exercise={exercise}
|
|
|
|
|
questionType={item}
|
|
|
|
|
user_exercise_status={user_exercise_status}
|
|
|
|
|
changeOption={(index,ids)=>this.changeOption(index,ids)}
|
|
|
|
|
changeQuestionStatus={(No,flag)=>this.changeQuestionStatus(No,flag)}
|
|
|
|
|
index={key}
|
|
|
|
|
|
|
|
|
|
handleShowUploadImage={(u)=>this.handleShowUploadImage(u)}
|
|
|
|
|
></Multiple>
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
@ -910,10 +976,11 @@ class ExerciseReviewAndAnswer extends Component{
|
|
|
|
|
{...this.state}
|
|
|
|
|
exercise={exercise}
|
|
|
|
|
questionType={item}
|
|
|
|
|
user_exercise_status={user_exercise_status}
|
|
|
|
|
is_md={is_md}
|
|
|
|
|
user_exercise_status={user_exercise_status}
|
|
|
|
|
changeQuestionStatus={(No,flag)=>this.changeQuestionStatus(No,flag)}
|
|
|
|
|
index={key}
|
|
|
|
|
|
|
|
|
|
handleShowUploadImage={(u)=>this.handleShowUploadImage(u)}
|
|
|
|
|
></FillEmpty>
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
@ -922,13 +989,15 @@ class ExerciseReviewAndAnswer extends Component{
|
|
|
|
|
<SimpleAnswer
|
|
|
|
|
{...this.props}
|
|
|
|
|
{...this.state}
|
|
|
|
|
exercise={exercise}
|
|
|
|
|
is_md={is_md}
|
|
|
|
|
exercise={exercise}
|
|
|
|
|
questionType={item}
|
|
|
|
|
user_exercise_status={user_exercise_status}
|
|
|
|
|
changeQuestionStatus={(No,flag)=>this.changeQuestionStatus(No,flag)}
|
|
|
|
|
changeA_flag={(index,status)=>this.changeA_flag(index,status)}
|
|
|
|
|
index={key}
|
|
|
|
|
></SimpleAnswer>
|
|
|
|
|
handleShowUploadImage={(u)=>this.handleShowUploadImage(u)}
|
|
|
|
|
></SimpleAnswer>
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
// 实训题
|
|
|
|
@ -936,12 +1005,13 @@ class ExerciseReviewAndAnswer extends Component{
|
|
|
|
|
<ShixunAnswer
|
|
|
|
|
{...this.props}
|
|
|
|
|
{...this.state}
|
|
|
|
|
exercise={exercise}
|
|
|
|
|
is_md={is_md}
|
|
|
|
|
exercise={exercise}
|
|
|
|
|
questionType={item}
|
|
|
|
|
user_exercise_status={user_exercise_status}
|
|
|
|
|
id={this.state.Id}
|
|
|
|
|
index={key}
|
|
|
|
|
|
|
|
|
|
handleShowUploadImage={(u)=>this.handleShowUploadImage(u)}
|
|
|
|
|
></ShixunAnswer>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|