Merge branch 'dev_chen' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_chen

dev_chen
杨树林 5 years ago
commit bdcfe44074

@ -15012,6 +15012,18 @@
} }
} }
}, },
"react-zmage": {
"version": "0.8.5-beta.31",
"resolved": "https://registry.npm.taobao.org/react-zmage/download/react-zmage-0.8.5-beta.31.tgz",
"integrity": "sha1-kc+7Hs+Y0fYFEdDFfZEt4K+53ZY=",
"requires": {
"classnames": "^2.2.6",
"lodash.memoize": "^4.1.2",
"prop-types": "^15.6.2",
"react": "^16.6.3",
"react-dom": "^16.6.3"
}
},
"read-pkg": { "read-pkg": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "http://registry.npm.taobao.org/read-pkg/download/read-pkg-1.1.0.tgz", "resolved": "http://registry.npm.taobao.org/read-pkg/download/read-pkg-1.1.0.tgz",

@ -28,7 +28,6 @@ export default ({ src, videoId, logWatchHistory, courseId = null }) => {
const suf = src.split('.').pop() const suf = src.split('.').pop()
const isFlv = suf === 'flv' const isFlv = suf === 'flv'
const el = useRef() const el = useRef()
const deviceMatch = navigator.userAgent.toLowerCase().match(regex) const deviceMatch = navigator.userAgent.toLowerCase().match(regex)
const device = deviceMatch ? deviceMatch[0] : 'pc' const device = deviceMatch ? deviceMatch[0] : 'pc'

@ -1,65 +1,29 @@
import React, { Component } from "react"; import React, { Component } from "react";
import { import { CBreadcrumb } from 'educoder';
Form, Input, InputNumber, Switch, Radio,
Slider, Button, Upload, Icon, Rate, Checkbox, message,
Row, Col, Select, Modal, Tooltip
} from 'antd';
import axios from 'axios'
// import './board.css'
// import "../common/formCommon.css"
// import { RouteHOC } from './common.js'
// import { Q_TYPE_SINGLE, Q_TYPE_MULTI, Q_TYPE_JUDGE, Q_TYPE_NULL, Q_TYPE_MAIN, Q_TYPE_SHIXUN } from './new/common'
// import TPMMDEditor from '../../tpm/challengesnew/TPMMDEditor';
// import CBreadcrumb from '../common/CBreadcrumb'
import {getUrl, ActionBtn, CBreadcrumb} from 'educoder';
// import SingleEditor from './new/SingleEditor'
// import SingleDisplay from './new/SingleDisplay'
// import JudgeEditor from './new/JudgeEditor'
// import JudgeDisplay from './new/JudgeDisplay'
// import NullEditor from './new/NullEditor'
// import NullDisplay from './new/NullDisplay'
// import MainEditor from './new/MainEditor'
// import MainDisplay from './new/MainDisplay'
// import ShixunEditor from './new/ShixunEditor'
// import ShixunDisplay from './new/ShixunDisplay'
import update from 'immutability-helper'
import './new/common.css' import './new/common.css'
import '../css/Courses.css' import '../css/Courses.css'
import ExerciseNewCommon from './ExerciseNewCommon' import ExerciseNewCommon from './ExerciseNewCommon'
const { TextArea } = Input;
class ExerciceNew extends Component { class ExerciceNew extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
left_banner_id: null
} }
}
componentDidMount = () => {
} }
initData = (data) => { initData = (data) => {
this.setState({ left_banner_id: data.left_banner_id }) this.setState({ left_banner_id: data.left_banner_id })
} }
componentDidMount() {
document.title = this.props.coursedata && this.props.coursedata.name;
}
render() { render() {
let { left_banner_id } = this.state; let { left_banner_id } = this.state;
const { current_user } = this.props const { current_user } = this.props
const courseId = this.props.match.params.coursesId; const courseId = this.props.match.params.coursesId;
const isEdit = this.isEdit;
document.title=this.props.coursedata&&this.props.coursedata.name;
return ( return (
<div className="newMain exerciseNew"> <div className="newMain exerciseNew">
@ -73,7 +37,6 @@ class ExerciceNew extends Component{
<p className="clearfix mt20 mb20"> <p className="clearfix mt20 mb20">
<span className="fl font-24 color-grey-3">{this.isEdit ? "编辑" : "新建"}试卷</span> <span className="fl font-24 color-grey-3">{this.isEdit ? "编辑" : "新建"}试卷</span>
<a href="javascript:void(0)" className="color-grey-6 fr font-16 mr2" <a href="javascript:void(0)" className="color-grey-6 fr font-16 mr2"
// () => this.props.history.length == 1 ? : this.props.history.goBack()
onClick={() => this.props.history.push(`/classrooms/${courseId}/exercises/${left_banner_id}`)}> onClick={() => this.props.history.push(`/classrooms/${courseId}/exercises/${left_banner_id}`)}>
返回 返回
</a> </a>
@ -90,5 +53,4 @@ class ExerciceNew extends Component{
) )
} }
} }
// RouteHOC() export default ExerciceNew;
export default (ExerciceNew);

@ -1,19 +1,10 @@
import React, { Component } from "react"; import React, { Component } from "react";
import { import { Tooltip } from 'antd'
Form, Input, InputNumber, Switch, Radio,
Slider, Button, Upload, Icon, Rate, Checkbox, message,
Row, Col, Select, Modal, Tooltip
} from 'antd';
import { Q_TYPE_SINGLE, Q_TYPE_MULTI, Q_TYPE_JUDGE, Q_TYPE_NULL, Q_TYPE_MAIN, Q_TYPE_SHIXUN } from './new/common' import { Q_TYPE_SINGLE, Q_TYPE_MULTI, Q_TYPE_JUDGE, Q_TYPE_NULL, Q_TYPE_MAIN, Q_TYPE_SHIXUN } from './new/common'
import TPMMDEditor from '../../tpm/challengesnew/TPMMDEditor';
import axios from 'axios' import axios from 'axios'
// import './board.css'
import "../common/formCommon.css" import "../common/formCommon.css"
import { ActionBtn } from 'educoder';
// import { RouteHOC } from './common.js'
import CBreadcrumb from '../common/CBreadcrumb'
import {getUrl, ActionBtn} from 'educoder';
import SingleEditor from './new/SingleEditor' import SingleEditor from './new/SingleEditor'
import SingleDisplay from './new/SingleDisplay' import SingleDisplay from './new/SingleDisplay'
@ -27,22 +18,20 @@ import ShixunEditor from './new/ShixunEditor'
import ShixunDisplay from './new/ShixunDisplay' import ShixunDisplay from './new/ShixunDisplay'
import ShixunChooseModal from '../coursesPublic/ShixunChooseModal' import ShixunChooseModal from '../coursesPublic/ShixunChooseModal'
import ExerciseForm from './exercise-new-form'
import update from 'immutability-helper' import update from 'immutability-helper'
import './new/common.css' import './new/common.css'
import '../css/Courses.css' import '../css/Courses.css'
const { TextArea } = Input;
const confirm = Modal.confirm;
const $ = window.$ const $ = window.$
const { Option } = Select;
const TITLE_MAX_LENGTH = 60;
class ExerciseNewCommon extends Component { class ExerciseNewCommon extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
exercise_questions: [], exercise_questions: [],
exercise_name: '', exercise_name: '',
is_md: false,
exercise_description: '', exercise_description: '',
exercise_types: {}, exercise_types: {},
editMode: !this.props.match.params.Id, editMode: !this.props.match.params.Id,
@ -120,23 +109,17 @@ class ExerciseNewCommon extends Component{
componentDidMount = () => { componentDidMount = () => {
this.fetchExercise() this.fetchExercise()
} }
// handleSubmit = (e) => {
// onSaveExercise = (data) => {
// }
onSaveExercise = () => {
const { exercise_name, exercise_description } = this.state;
const exercise_id = this.props.match.params.Id const exercise_id = this.props.match.params.Id
const courseId = this.props.match.params.coursesId const courseId = this.props.match.params.coursesId
if (this.isEdit) { if (this.isEdit) {
// /exercise_banks/:id.json
const editUrl = `/${this.props.exercise_url ? this.props.exercise_url : 'exercises'}/${exercise_id}.json` const editUrl = `/${this.props.exercise_url ? this.props.exercise_url : 'exercises'}/${exercise_id}.json`
axios.put(editUrl, { axios.put(editUrl, { ...data })
exercise_name,
exercise_description
})
.then((response) => { .then((response) => {
if (response.data.status == 0) { if (response.data.status == 0) {
this.setState({editMode: false}) this.setState({ ...data, editMode: false })
this.props.showNotification('试卷编辑成功') this.props.showNotification('试卷编辑成功')
} }
}) })
@ -146,17 +129,14 @@ class ExerciseNewCommon extends Component{
} else { } else {
const url = `/courses/${courseId}/exercises.json` const url = `/courses/${courseId}/exercises.json`
axios.post(url, { axios.post(url, {
exercise_name, ...data
exercise_description
}) })
.then((response) => { .then((response) => {
if (response.data.status == 0) { if (response.data.status == 0) {
this.setState({editMode: false}) this.setState({ ...data, editMode: false })
this.props.showNotification('试卷新建成功') this.props.showNotification('试卷新建成功')
const exercise_id = response.data.data.exercise_id; const exercise_id = response.data.data.exercise_id;
this.isEdit = true; this.isEdit = true;
this.props.history.replace(`/classrooms/${courseId}/exercises/${exercise_id}/edit`); this.props.history.replace(`/classrooms/${courseId}/exercises/${exercise_id}/edit`);
} }
@ -241,10 +221,6 @@ class ExerciseNewCommon extends Component{
this.refs.shixunChooseModal.setVisible(true) this.refs.shixunChooseModal.setVisible(true)
this.question_id_to_insert_after = question_id_to_insert_after; this.question_id_to_insert_after = question_id_to_insert_after;
return; return;
// 拉取实训items
this.addEditingQuestion(Q_TYPE_SHIXUN, question_id_to_insert_after, {
shixun_id: 50
})
} }
editQestion = (index) => { editQestion = (index) => {
if (this._checkIsEditing()) { if (this._checkIsEditing()) {
@ -358,15 +334,6 @@ class ExerciseNewCommon extends Component{
if (response.data.status == 0) { if (response.data.status == 0) {
this.props.showNotification('删除成功') this.props.showNotification('删除成功')
this.fetchExercise() this.fetchExercise()
// const { exercise_questions } = this.state
// const index = this.findIndexById(question_id)
// this.setState(
// (prevState) => ({
// exercise_questions : update(prevState.exercise_questions, {$splice: [[index, 1]]})
// })
// )
} }
}) })
.catch(function (error) { .catch(function (error) {
@ -393,34 +360,27 @@ class ExerciseNewCommon extends Component{
const editUrl = this.props.exercise_url_questions ? `/${this.props.exercise_url_questions}/${question_id}.json` : `/exercise_questions/${question_id}.json` const editUrl = this.props.exercise_url_questions ? `/${this.props.exercise_url_questions}/${question_id}.json` : `/exercise_questions/${question_id}.json`
return editUrl; return editUrl;
} }
onCancel = () => {
this.setState({
editMode: false
})
}
render() { render() {
let { exercise_name, exercise_description, course_id, exercise_types, let { exercise_name, exercise_description, exercise_types, exercise_questions, is_md } = this.state;
exercise_questions, left_banner_id } = this.state;
// if (this.isEdit && !exercise_types) {
// return ''
// }
// const { getFieldDecorator } = this.props.form;
const { q_counts, q_scores, q_doubles, q_doubles_scores, q_judges, q_judges_scores, const { q_counts, q_scores, q_doubles, q_doubles_scores, q_judges, q_judges_scores,
q_mains, q_mains_scores, q_nulls, q_nulls_scores, q_shixuns, q_shixuns_scores, q_singles, q_singles_scores } = exercise_types; q_mains, q_mains_scores, q_nulls, q_nulls_scores, q_shixuns, q_shixuns_scores, q_singles, q_singles_scores } = exercise_types;
const formItemLayout = {
labelCol: {
xs: { span: 24 },
// sm: { span: 8 },
sm: { span: 24 },
},
wrapperCol: {
xs: { span: 24 },
// sm: { span: 16 },
sm: { span: 24 },
},
};
const { current_user } = this.props const exerciseFormOpt = {
const isAdmin = this.props.isAdmin() exercise_name,
const courseId=this.props.match.params.coursesId; exercise_description,
is_md,
onCancel: this.onCancel,
isEdit: this.isEdit,
onSaveHandler: this.onSaveExercise
}
const exercise_id = this.props.match.params.Id const exercise_id = this.props.match.params.Id
const isEdit = this.isEdit
const commonHandler = { const commonHandler = {
onQestionDelete: this.onQestionDelete, onQestionDelete: this.onQestionDelete,
addSuccess: this.addSuccess, addSuccess: this.addSuccess,
@ -438,6 +398,8 @@ class ExerciseNewCommon extends Component{
getEditQuestionUrl: this.getEditQuestionUrl, getEditQuestionUrl: this.getEditQuestionUrl,
exercise_url: this.props.exercise_url, exercise_url: this.props.exercise_url,
} }
console.log(this.props)
console.log(this.state)
return ( return (
<React.Fragment> <React.Fragment>
<ShixunChooseModal <ShixunChooseModal
@ -472,66 +434,7 @@ class ExerciseNewCommon extends Component{
></div> ></div>
</div>} </div>}
{this.state.editMode && <Form {...formItemLayout} {this.state.editMode && <ExerciseForm {...exerciseFormOpt} />}
// onSubmit={this.handleSubmit}
>
<div className="formBlock" style={{paddingBottom: '2px',borderBottom:"none"}}>
<Form.Item
label="试卷标题"
required
className="topicTitle "
>
{/* {getFieldDecorator('subject', {
rules: [{
required: true, message: '请输入标题',
}, {
max: 20, message: '最大限制为20个字符',
}],
})( */}
<style>
{
`
.exercicenewinputysl .ant-input{
border-right: none !important;
height: 40px !important;
}
`
}
</style>
<Input placeholder={`请输入试卷标题,最大限制${TITLE_MAX_LENGTH}个字符`} maxLength={TITLE_MAX_LENGTH} className="mt5 exercicenewinputysl" value={exercise_name}
onChange={this.exercise_name_change} addonAfter={`${exercise_name ? exercise_name.length : 0}/${TITLE_MAX_LENGTH}`}
/>
{/* )} */}
</Form.Item>
<Form.Item
label="&nbsp;&nbsp;试卷须知"
>
{/* {getFieldDecorator('select_board_id', {
// initialValue: '3779',
})( */}
<TextArea placeholder="请在此输入本次试卷答题的相关说明最大限制100个字符" className="mt5" style={{height:"120px"}} value={exercise_description}
onChange={this.exercise_description_change}
/>
{/* )} */}
</Form.Item>
<Form.Item>
{/* defalutSubmitbtn */}
<a className="task-btn task-btn-orange fr mt4" style={{height: '30px', width: '70px'}}
onClick={this.onSaveExercise}
>保存</a>
{ this.isEdit && <a onClick={() => this.setState({editMode: false})} className="defalutCancelbtn fr mt4"
style={{height: '30px', width: '70px', fontSize: '14px', lineHeight: '30px', marginRight: '16px'}}>取消</a>}
{/* <Button type="primary" onClick={this.onSaveExercise} className="fr">保存</Button> */}
</Form.Item>
</div>
{/* <div className="clearfix mt30 mb30">
<a className="defalutCancelbtn fl" onClick={() => {}}>取消</ a>
</div> */}
</Form>}
<p className="clearfix padding20-30 color-grey-9"> <p className="clearfix padding20-30 color-grey-9">
@ -610,7 +513,6 @@ class ExerciseNewCommon extends Component{
</ActionBtn> </ActionBtn>
{exercise_id && !this.props.hidePreviewButton && <ActionBtn style="blue" className="fr" onClick={() => this.goToPreview()}> {exercise_id && !this.props.hidePreviewButton && <ActionBtn style="blue" className="fr" onClick={() => this.goToPreview()}>
{/* <i className="iconfont icon-tianjiafangda color-white font-14 mr5" style={{ marginTop: '-1px', display: 'inline-block'}}></i> */}
试卷预览 试卷预览
</ActionBtn>} </ActionBtn>}

@ -0,0 +1,101 @@
import React, { useState } from 'react'
import { Input, Form, Radio } from 'antd'
import './index.scss'
import { QuillForEditor } from 'educoder'
import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor'
const formItemLayout = {
labelCol: {
xs: { span: 24 },
sm: { span: 24 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 24 },
},
}
const { TextArea } = Input
const TITLE_MAX_LENGTH = 60
function EditorTip() {
return <p className='editor-tip'>编辑器选择<span> (请在下方选择一个您想使用的编辑器) </span></p>
}
const quillOpt = [
'bold',
'italic',
'underline', // 线
{ align: [] }, //
{ list: 'ordered' }, //
{ list: 'bullet' }, //
{ script: 'sub' }, // x2
{ script: 'super' }, // (x2)
{ 'color': [] }, //
{ 'background': [] }, //
'blockquote', //
'image', //
'formula', //
'clean' //
]
export default ({ exercise_name = '', exercise_description, is_md, onSaveHandler, isEdit, onCancel }) => {
const [data, setData] = useState({
exercise_name,
exercise_description,
is_md
})
function onChange(prop, value) {
setData({ ...data, [prop]: value })
}
function onNameChange(e) {
onChange('exercise_name', e.target.value)
}
function onDescChange(e) {
onChange('exercise_description', e.target.value)
}
function onEditorChange(e) {
onChange('is_md', e.target.value)
}
function onSave() {
onSaveHandler(data)
}
return (
<Form {...formItemLayout}>
<div className='exercise-new-form'>
<Form.Item label="试卷标题" required className="topicTitle " >
<Input placeholder={`请输入试卷标题,最大限制${TITLE_MAX_LENGTH}个字符`} maxLength={TITLE_MAX_LENGTH} className="mt5 exercicenewinputysl" value={data.exercise_name}
onChange={onNameChange} addonAfter={`${data.exercise_name.length}/${TITLE_MAX_LENGTH}`}
/>
</Form.Item>
<Form.Item label="&nbsp;&nbsp;试卷须知" >
<TextArea placeholder="请在此输入本次试卷答题的相关说明最大限制100个字符" className="mt5" style={{ height: "120px" }} value={data.exercise_description} onChange={onDescChange} />
</Form.Item>
<Form.Item label={<EditorTip />} colon={false}>
<Radio.Group onChange={onEditorChange} value={data.is_md}>
<Radio value={true}>Markdown 编辑器</Radio>
<Radio value={false}>富文本编辑器</Radio>
</Radio.Group>
</Form.Item>
<Form.Item>
{data.is_md ? <TPMMDEditor height={183} placeholder="体验过程输入的内容不会保存" refreshTimeout={1500} className="courseMessageMD" />
: <QuillForEditor placeholder='体验过程输入的内容不会保存' options={quillOpt} style={{ height: 123 }} />}
</Form.Item>
<Form.Item>
<a className="task-btn task-btn-orange fr mt4" onClick={onSave} >保存</a>
{isEdit && <a onClick={onCancel} className="defalutCancelbtn fr mt4">取消</a>}
</Form.Item>
</div>
</Form >
)
}

@ -0,0 +1,47 @@
.exercise-new-form {
padding: 20px 30px 2px 30px;
background: #fff;
.ant-input {
border-right: none;
height: 40px;
}
.task-btn-orange {
height: 30px;
width: 70px;
}
.defalutCancelbtn {
height: '30px';
width: '70px';
font-size: '14px';
line-height: '30px';
margin-right: '16px';
}
.editor-tip {
font-size: 16px;
font-family: PingFangSC-Semibold, PingFang SC;
font-weight: 600;
color: rgba(51, 51, 51, 1);
padding-left: 12px;
line-height: 22px;
span {
font-size: 14px;
font-weight: normal;
font-family: MicrosoftYaHei;
color: rgba(136, 136, 136, 1);
line-height: 19px;
}
}
.ant-form-item label {
overflow: hidden;
}
.ant-form-item-label {
height: 40px;
}
}

@ -44,7 +44,7 @@ class MainDisplay extends Component{
<React.Fragment> <React.Fragment>
<div style={{color: '#05101A'}} className="font-16 mb5 font-bd">参考答案</div> <div style={{color: '#05101A'}} className="font-16 mb5 font-bd">参考答案</div>
{this.props.exercise&&this.props.exercise.is_md?<MarkdownToHtml content={standard_answer[0]} selector={'answer_' + qNumber} {!this.props.exercise||this.props.exercise&&this.props.exercise.is_md?<MarkdownToHtml content={standard_answer[0]} selector={'answer_' + qNumber}
className="" className=""
></MarkdownToHtml>:<QuillForEditor ></MarkdownToHtml>:<QuillForEditor
readOnly={true} readOnly={true}

@ -82,7 +82,7 @@ class NullDisplay extends Component{
<div className="answers"> <div className="answers">
{ answers.answer_text.map((item, itemIndex) => { { answers.answer_text.map((item, itemIndex) => {
return( return(
this.props.exercise&&this.props.exercise.is_md?<MarkdownToHtml !this.props.exercise||this.props.exercise&&this.props.exercise.is_md?<MarkdownToHtml
className="answer" key={itemIndex} className="answer" key={itemIndex}
content={item} selector={'null_' + (index + 1) + (_index + 1) + (itemIndex + 1)} content={item} selector={'null_' + (index + 1) + (_index + 1) + (itemIndex + 1)}
></MarkdownToHtml>:<QuillForEditor ></MarkdownToHtml>:<QuillForEditor

@ -29,7 +29,7 @@ class QestionDisplayHeader extends Component{
const qName = qNameArray[question_type] const qName = qNameArray[question_type]
// console.log(this.props) console.log(this.props)
return( return(
<React.Fragment> <React.Fragment>
<div className="new_li"> <div className="new_li">
@ -77,7 +77,7 @@ class QestionDisplayHeader extends Component{
</div> </div>
</div> </div>
{ question_title && { question_title &&
this.props.exercise&&this.props.exercise.is_md?<MarkdownToHtml content={question_title} selector={'qtitle_' + (index + 1)} style={{ display: 'inline-block', width:'100%' , margin: '10px 0px 15px' }} !this.props.exercise||this.props.exercise&&this.props.exercise.is_md||this.props.question_type===6?<MarkdownToHtml content={question_title} selector={'qtitle_' + (index + 1)} style={{ display: 'inline-block', width:'100%' , margin: '10px 0px 15px' }}
></MarkdownToHtml>:<QuillForEditor ></MarkdownToHtml>:<QuillForEditor
style={{ display: 'inline-block', width:'100%' , margin: '10px 0px 15px',padding:'0px'}} style={{ display: 'inline-block', width:'100%' , margin: '10px 0px 15px',padding:'0px'}}

@ -105,7 +105,7 @@ class ShixunDisplay extends Component{
></QestionDisplayHeader> ></QestionDisplayHeader>
{this.props.exercise&&this.props.exercise.is_md?<div className="mainQuestionDisplay color-grey-9 markdown-body" {!this.props.exercise||this.props.exercise&&this.props.exercise.is_md?<div className="mainQuestionDisplay color-grey-9 markdown-body"
dangerouslySetInnerHTML={{__html: markdownToHTML(question_title)}} dangerouslySetInnerHTML={{__html: markdownToHTML(question_title)}}
> >
</div>:<QuillForEditor </div>:<QuillForEditor

@ -1,5 +1,5 @@
import React,{ Component } from "react"; import React,{ Component } from "react";
import {QuillForEditor,markdownToHTML} from 'educoder'; import {MarkdownToHtml,QuillForEditor} from 'educoder';
import QestionDisplayHeader from './QestionDisplayHeader' import QestionDisplayHeader from './QestionDisplayHeader'
@ -14,8 +14,8 @@ class ShixunProgramming extends Component{
componentDidMount = () => { componentDidMount = () => {
} }
render() { render() {
let { question_title, let { description,question_title,
question_id, index, shixun_identifier question_id, index, shixun_identifier,hack_identifier
} = this.props; } = this.props;
const qNumber = `question_${index}`; const qNumber = `question_${index}`;
@ -36,24 +36,23 @@ class ShixunProgramming extends Component{
`}</style> `}</style>
{/*<QestionDisplayHeader {...this.props} question_title={question_title}*/} <QestionDisplayHeader {...this.props} question_title={question_title}
{/* topRight={*/} topRight={
{/* <a target="_blank" href={`/shixuns/${shixun_identifier}/challenges`} className="mr30"*/} <a target="_blank" href={`/problems/${hack_identifier}/edit`} className="mr30"
{/* style={{color: '#4CACFF'}}*/} style={{color: '#4CACFF'}}
{/* >实训详情</a>*/} >实训详情</a>
{/* }*/} }
{/*></QestionDisplayHeader>*/} ></QestionDisplayHeader>
{description&&
!this.props.exercise||this.props.exercise&&this.props.exercise.is_md?<MarkdownToHtml content={description} selector={'qtitle_' + (index + 1)} style={{ display: 'inline-block', width:'100%' , margin: '10px 0px 15px' }}
{/*{this.props.exercise&&this.props.exercise.is_md?<div className="mainQuestionDisplay color-grey-9 markdown-body"*/} ></MarkdownToHtml>:<QuillForEditor
{/* dangerouslySetInnerHTML={{__html: markdownToHTML(question_title)}}*/} style={{ display: 'inline-block', width:'100%' , margin: '10px 0px 15px',padding:'0px'}}
{/*>*/} readOnly={true}
{/*</div>:<QuillForEditor*/} value={description?JSON.parse(description):""}
{/* readOnly={true}*/} // showUploadImage={this.handleShowUploadImage}
{/* style={{ float: 'left', display: 'inline-block' ,padding:'0px',margin: '2px 0px 0px'}}*/} />}
{/* value={question_title?JSON.parse(question_title):""}*/}
{/* // showUploadImage={this.handleShowUploadImage}*/}
{/*/>}*/}
{/*{shixun.map((ch, index) => {*/} {/*{shixun.map((ch, index) => {*/}
{/* return <div>*/} {/* return <div>*/}

@ -78,7 +78,7 @@ class SingleDisplay extends Component{
flexDirection:"row", flexDirection:"row",
}} key={optionIndex}> }} key={optionIndex}>
<Radio disabled className="fl lineh-25 w50" checked={item.standard_boolean}>{prefix}</Radio> <Radio disabled className="fl lineh-25 w50" checked={item.standard_boolean}>{prefix}</Radio>
{this.props.exercise&&this.props.exercise.is_md?<MarkdownToHtml content={item.choice_text} selector={'single_' + (index + 1) + '' + (optionIndex + 1)} style={{ float: 'left', display: 'inline-block' }} {!this.props.exercise||this.props.exercise&&this.props.exercise.is_md?<MarkdownToHtml content={item.choice_text} selector={'single_' + (index + 1) + '' + (optionIndex + 1)} style={{ float: 'left', display: 'inline-block' }}
></MarkdownToHtml>:<QuillForEditor ></MarkdownToHtml>:<QuillForEditor
readOnly={true} readOnly={true}
@ -96,7 +96,7 @@ class SingleDisplay extends Component{
flexDirection:"row", flexDirection:"row",
}} key={optionIndex}> }} key={optionIndex}>
<Checkbox disabled className="fl lineh-25 w50" checked={item.standard_boolean}>{prefix}</Checkbox> <Checkbox disabled className="fl lineh-25 w50" checked={item.standard_boolean}>{prefix}</Checkbox>
{this.props.exercise&&this.props.exercise.is_md?<MarkdownToHtml content={item.choice_text} selector={'single_' + (index + 1)+ '' + (optionIndex + 1)} style={{ float: 'left', display: 'inline-block' }} {!this.props.exercise||this.props.exercise&&this.props.exercise.is_md?<MarkdownToHtml content={item.choice_text} selector={'single_' + (index + 1)+ '' + (optionIndex + 1)} style={{ float: 'left', display: 'inline-block' }}
></MarkdownToHtml>:<QuillForEditor ></MarkdownToHtml>:<QuillForEditor
readOnly={true} readOnly={true}

@ -4,6 +4,7 @@ export const Q_TYPE_JUDGE = 2 // 判断
export const Q_TYPE_NULL = 3 // 填空 export const Q_TYPE_NULL = 3 // 填空
export const Q_TYPE_MAIN = 4 // 填空 export const Q_TYPE_MAIN = 4 // 填空
export const Q_TYPE_SHIXUN = 5 // 实训 export const Q_TYPE_SHIXUN = 5 // 实训
export const Q_TYPE_SHIXUN_BIANCHENG = 6 // 编程题
export const qNameArray = [ export const qNameArray = [
'单选题', '单选题',
@ -12,4 +13,5 @@ export const qNameArray = [
'填空题', '填空题',
'简答题', '简答题',
'实训题', '实训题',
'编程题'
] ]
Loading…
Cancel
Save