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

dev_chen
cxt 5 years ago
commit 196c40b2ea

@ -46,7 +46,7 @@ debugType = "admin";
// 老师
// debugType="teacher";
// 学生
debugType="student";
//debugType="student";

@ -6,11 +6,8 @@ export function isImageExtension(fileName) {
}
export function markdownToHTML(oldContent, selector) {
console.log(oldContent)
console.log(selector)
if(oldContent){
try {
window.$('#md_div').html('')
// markdown to html
if (selector && oldContent && oldContent.startsWith('<p')) { // 普通html处理
window.$('#' + selector).addClass('renderAsHtml')
window.$('#' + selector).html(oldContent)
@ -42,8 +39,9 @@ export function markdownToHTML(oldContent, selector) {
}
return content
}
}
}catch (e) {
}
}
function _doDownload(options) {
$.fileDownload(getUrl() + "/api" + options.url, {

@ -209,12 +209,16 @@ function QuillForEditor({
if (value && value.hasOwnProperty('ops')) {
// console.log(value.ops);
const ops = value.ops || [];
ops.forEach((item, i) => {
if (item.insert['image']) {
item.insert['image'] = Object.assign({}, item.insert['image'], { style: { cursor: 'pointer' }, onclick: (url) => showUploadImage(url) });
}
});
try {
const ops = value.ops || [];
ops.forEach((item, i) => {
if (item.insert['image']) {
item.insert['image'] = Object.assign({}, item.insert['image'], { style: { cursor: 'pointer' }, onclick: (url) => showUploadImage(url) });
}
});
}catch (e) {
}
}
const current = value

@ -13,6 +13,7 @@ import CoursesListType from '../coursesPublic/CoursesListType';
import QuillForEditor from "../../../common/quillForEditor";
import Multiple from './question/multiple';
import Single from './question/single';
import Progques from './question/Progques';
import FillEmpty from './question/fillEmpty';
import SimpleAnswer from './question/simpleAnswer';
import ShixunAnswer from './question/shixunAnswer';
@ -1014,6 +1015,22 @@ class ExerciseReviewAndAnswer extends Component{
handleShowUploadImage={(u)=>this.handleShowUploadImage(u)}
></ShixunAnswer>
}
{
//编程题
item.question_type == 6 &&
<Progques
{...this.props}
{...this.state}
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)}
></Progques>
}
{
//调分理由部分

@ -1,7 +1,6 @@
import React, {Component} from "react";
import {WordsBtn,markdownToHTML, MarkdownToHtml} from 'educoder';
import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal, Table, Divider,InputNumber, Tag,DatePicker,Radio,Tooltip,Pagination} from "antd";
import {Link,Switch,Route,Redirect} from 'react-router-dom';
import {QuillForEditor, MarkdownToHtml} from 'educoder';
import {Checkbox,Pagination} from "antd";
import axios from 'axios';
import Exercisetablesmubu from './Exercisetablesmubu';
import Exercisestatisticalresulttabel from './Exercisestatisticalresulttabel';
@ -287,6 +286,9 @@ class Exercisestatisticalresult extends Component {
.Exermubu .editormd-html-preview, .Exermubu .editormd-preview-container {
background: transparent;
}
.ql-editor{
padding:0px !important;
}
`}
</style>
{data&&data.commit_results.map((item,key)=>{
@ -299,9 +301,14 @@ class Exercisestatisticalresult extends Component {
<div>
{/*Q{item.ques_position}*/}
{/* <div className={"markdown-body"} dangerouslySetInnerHTML={{__html: markdownToHTML1(item.ques_title).replace(/▁/g,"▁▁▁")}}></div> */}
<MarkdownToHtml content={item.ques_title} selector={'ques_title_' + key}
{this.state&&this.state.data.is_md===false&&item.ques_type!=6?<QuillForEditor
style={{ display: 'inline-block', width:'100%' , margin: '1px',padding:'0px'}}
readOnly={true}
value={item.ques_title?JSON.parse(item.ques_title):""}
// showUploadImage={this.handleShowUploadImage}
/>:<MarkdownToHtml content={item.ques_title} selector={'ques_title_' + key}
className=""
></MarkdownToHtml>
></MarkdownToHtml>}
{/*<span className="markdown-body" dangerouslySetInnerHTML={createMarkup(item.ques_title)}></span>*/}
</div>
</div>
@ -319,8 +326,9 @@ class Exercisestatisticalresult extends Component {
<div className="fr shixunreporttitles">正确率<span style={{color:'#FF6800'}}> {ite.challenge_percent}%</span></div>
</div>
<Exercisetablesmubu
{...this.state}
tableNum={`${key}${k}`}
data={ite.challenge_details}
datass={ite.challenge_details}
type={item.ques_type}
effictive_counts={item.effictive_counts}
choicetype={choicetype}
@ -329,8 +337,9 @@ class Exercisestatisticalresult extends Component {
)
}):
<Exercisetablesmubu
{...this.state}
tableNum={key}
data={item.ques_details}
datass={item.ques_details}
type={item.ques_type}
effictive_counts={item.effictive_counts}
choicetype={choicetype}

@ -1,8 +1,5 @@
import React, {Component} from "react";
import {WordsBtn} from 'educoder';
import {Table} from "antd";
import {Link,Switch,Route,Redirect} from 'react-router-dom';
class OfficialAcademicTranscript extends Component {
constructor(props) {

@ -1,11 +1,11 @@
import React, {Component} from "react";
import {WordsBtn, MarkdownToHtml} from 'educoder';
import {MarkdownToHtml,QuillForEditor} from 'educoder';
import {Table,Progress} from "antd";
import {Link,Switch,Route,Redirect} from 'react-router-dom';
const tagArray = [
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R',
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R',
'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'
]
@ -15,7 +15,6 @@ class Exercisetablesmubus extends Component {
super(props);
this.state = {
loadingstate:true,
datas:undefined
}
}
@ -23,13 +22,26 @@ class Exercisetablesmubus extends Component {
}
setdata=(value)=>{
let newvalue;
try {
newvalue=JSON.parse(value);
}catch (e) {
newvalue={"ops":[{"insert":value}]};
}
if(value===undefined){
newvalue={"ops":[{"insert":""}]};
}
return newvalue
}
render() {
let {data,type,effictive_counts,choicetype, tableNum}=this.props;
let datas=[];
let {datass,type,effictive_counts,choicetype, tableNum}=this.props;
let list=[];
data&&data.forEach((item,key)=>{
datas.push({
datass&&datass.forEach((item,key)=>{
list.push({
commit_percent:{
num:item.choice_position,
value:type===4||type===5?choicetype[item.choice_text-1]:item.choice_text,
@ -40,33 +52,38 @@ class Exercisetablesmubus extends Component {
max_score:item.choice_percent,
})
})
datas.push({
list.push({
commit_percent: {num:null,value:"有效填写量"},
min_score:{value:effictive_counts},
})
let columns=[]
if(datas.length!=0){
if(list.length!=0){
columns=[{
title: '选项',
dataIndex: 'commit_percent',
key: 'commit_percent',
render: (text, record, index) => {
const _content = <span style={{color:text.type===true? "#29BD8B":'#333333', width: '100%'}}>
{text.value!="有效填写量"&&text.value!="wrong" &&
<MarkdownToHtml content={text.value} selector={(tableNum+1) + '' + (index+1)}></MarkdownToHtml>
{text.value>0&&text.value!="有效填写量"&&text.value!="wrong"||!text.value&&text.value!="有效填写量"&&text.value!="wrong"?text.value:text.value!="有效填写量"&&text.value!="wrong" &&
this.props&&this.props.data.is_md===false?<QuillForEditor
style={{ display: 'inline-block', width:'100%' , margin: '1px',padding:'0px'}}
readOnly={true}
value={this.setdata(text.value)}
// showUploadImage={this.handleShowUploadImage}
/>:text.value!=""&&text.value!="wrong"&&<MarkdownToHtml content={text.value} selector={(tableNum+1) + '' + (index+1)}></MarkdownToHtml>
}
{text.value==="wrong" && "填写了错误答案" }
{text.value==="有效填写量" && "有效填写量" }
{text.value==="有效填写量" && "有效填写量" }
</span>
return (
(text._type === 0 || text._type === 1) ? <div style={{ display: 'flex'}}>
{<span style={{ 'margin-right': '4px', 'margin-top': '-2px'}}>{tagArray[index]}.</span>}
{_content}
</div> : <React.Fragment>{_content}</React.Fragment>
)
},
}, {
title: '小计',
@ -122,13 +139,15 @@ class Exercisetablesmubus extends Component {
.Exermubu .ant-table-tbody> tr > td{
border-bottom: transparent;
}
.ql-editor{
padding:0px !important;
}
`}
</style>
{datas===undefined?"":<Table
{list===undefined?"":<Table
className={"Exermubu"}
dataSource={datas}
dataSource={list}
columns={columns}
pagination={false}
// loading={loadingstate}

@ -1,6 +1,6 @@
import React,{ Component } from "react";
import { Radio } from 'antd';
import { MarkdownToHtml } from 'educoder';
import { MarkdownToHtml,QuillForEditor } from 'educoder';
import QestionDisplayHeader from './QestionDisplayHeader'
@ -30,13 +30,25 @@ class JudgeDisplay extends Component{
// });
}
}
setdata=(value)=>{
let newvalue;
try {
newvalue=JSON.parse(value);
}catch (e) {
newvalue={"ops":[{"insert":value}]};
}
if(value===undefined){
newvalue={"ops":[{"insert":""}]};
}
return newvalue
}
render() {
let { question_choices,
question_id, index
} = this.props;
const qNumber = `question_${index}`;
console.log(this.props)
return(
<div className="bor-bottom-greyE padding20-30" id={qNumber} _id={question_id}>
<style>{`
@ -61,9 +73,14 @@ class JudgeDisplay extends Component{
<div key={optionIndex} className="fl mr30 df">
<Radio disabled className="lineh-25" checked={item.standard_boolean}></Radio>
<MarkdownToHtml content={item.choice_text} selector={'judge_' + (index + 1) + optionIndex}
{!this.props.exercise||this.props.exercise&&this.props.exercise.is_md?<MarkdownToHtml content={item.choice_text} selector={'judge_' + (index + 1) + optionIndex}
className=""
></MarkdownToHtml>
></MarkdownToHtml>:<QuillForEditor
readOnly={true}
style={{ float: 'left', display: 'inline-block' ,padding:'0px',margin: '2px 0px 0px'}}
value={this.setdata(item.choice_text)}
// showUploadImage={this.handleShowUploadImage}
/>}
</div>)

@ -14,6 +14,19 @@ class MainDisplay extends Component{
}
componentDidMount = () => {
}
setdata=(value)=>{
let newvalue;
try {
newvalue=JSON.parse(value);
}catch (e) {
newvalue={"ops":[{"insert":value}]};
}
if(value===undefined){
newvalue={"ops":[{"insert":""}]};
}
return newvalue
}
render() {
let {standard_answer,
question_id, index
@ -49,7 +62,7 @@ class MainDisplay extends Component{
></MarkdownToHtml>:<QuillForEditor
readOnly={true}
style={{ float: 'left', display: 'inline-block' ,padding:'0px',margin: '2px 0px 0px'}}
value={standard_answer[0]?JSON.parse(standard_answer[0]):""}
value={this.setdata(standard_answer[0])}
// showUploadImage={this.handleShowUploadImage}
/>}
</React.Fragment>

@ -29,6 +29,18 @@ class NullDisplay extends Component{
// });
}
}
setdata=(value)=>{
let newvalue;
try {
newvalue=JSON.parse(value);
}catch (e) {
newvalue={"ops":[{"insert":value}]};
}
if(value===undefined){
newvalue={"ops":[{"insert":""}]};
}
return newvalue
}
render() {
let { question_type, standard_answer,
question_id,index,
@ -88,7 +100,7 @@ class NullDisplay extends Component{
></MarkdownToHtml>:<QuillForEditor
readOnly={true}
style={{ float: 'left', display: 'inline-block' ,padding:'0px',margin: '2px 0px 0px'}}
value={item?JSON.parse(item):""}
value={this.setdata(item)}
// showUploadImage={this.handleShowUploadImage}
/>
)

@ -16,6 +16,20 @@ class QestionDisplayHeader extends Component{
componentDidMount = () => {
}
setdata=(value)=>{
let newvalue;
try {
newvalue=JSON.parse(value);
}catch (e) {
newvalue={"ops":[{"insert":value}]};
}
if(value===undefined){
newvalue={"ops":[{"insert":""}]};
}
return newvalue
}
render() {
let { question_title, question_score, question_type,
question_id, index, displayCount,
@ -29,7 +43,7 @@ class QestionDisplayHeader extends Component{
const qName = qNameArray[question_type]
console.log(this.props)
// console.log(this.props)
return(
<React.Fragment>
<div className="new_li">
@ -82,7 +96,7 @@ class QestionDisplayHeader extends Component{
></MarkdownToHtml>:<QuillForEditor
style={{ display: 'inline-block', width:'100%' , margin: '10px 0px 15px',padding:'0px'}}
readOnly={true}
value={question_title?JSON.parse(question_title):""}
value={this.setdata(question_title)}
// showUploadImage={this.handleShowUploadImage}
/>
// <div className="markdown-body" dangerouslySetInnerHTML={{__html: markdownToHTML1(question_title)}}

@ -12,6 +12,20 @@ class ShixunDisplay extends Component{
}
}
componentDidMount = () => {
}
setdata=(value)=>{
let newvalue;
try {
newvalue=JSON.parse(value);
}catch (e) {
newvalue={"ops":[{"insert":value}]};
}
if(value===undefined){
newvalue={"ops":[{"insert":""}]};
}
return newvalue
}
render() {
let { question_title,
@ -111,7 +125,7 @@ class ShixunDisplay extends Component{
</div>:<QuillForEditor
readOnly={true}
style={{ float: 'left', display: 'inline-block' ,padding:'0px',margin: '2px 0px 0px'}}
value={question_title?JSON.parse(question_title):""}
value={this.setdata(question_title)}
// showUploadImage={this.handleShowUploadImage}
/>}

@ -13,6 +13,18 @@ class ShixunProgramming extends Component{
}
componentDidMount = () => {
}
setdata=(value)=>{
let newvalue;
try {
newvalue=JSON.parse(value);
}catch (e) {
newvalue={"ops":[{"insert":value}]};
}
if(value===undefined){
newvalue={"ops":[{"insert":""}]};
}
return newvalue
}
render() {
let { description,question_title,
question_id, index, shixun_identifier,hack_identifier
@ -50,7 +62,7 @@ class ShixunProgramming extends Component{
></MarkdownToHtml>:<QuillForEditor
style={{ display: 'inline-block', width:'100%' , margin: '10px 0px 15px',padding:'0px'}}
readOnly={true}
value={description?JSON.parse(description):""}
value={this.setdata(description)}
// showUploadImage={this.handleShowUploadImage}
/>}

@ -34,6 +34,19 @@ class SingleDisplay extends Component{
// });
}
}
setdata=(value)=>{
let newvalue;
try {
newvalue=JSON.parse(value);
}catch (e) {
newvalue={"ops":[{"insert":value}]};
}
if(value===undefined){
newvalue={"ops":[{"insert":""}]};
}
return newvalue
}
render() {
let { question_type, question_choices,
question_id, index,
@ -83,7 +96,7 @@ class SingleDisplay extends Component{
></MarkdownToHtml>:<QuillForEditor
readOnly={true}
style={{ float: 'left', display: 'inline-block',padding:'0px',margin: '2px 0px 0px'}}
value={item.choice_text?JSON.parse(item.choice_text):""}
value={this.setdata(item.choice_text)}
// showUploadImage={this.handleShowUploadImage}
/>}
@ -101,7 +114,7 @@ class SingleDisplay extends Component{
></MarkdownToHtml>:<QuillForEditor
readOnly={true}
style={{ float: 'left', display: 'inline-block' ,padding:'0px',margin: '2px 0px 0px'}}
value={item.choice_text?JSON.parse(item.choice_text):""}
value={this.setdata(item.choice_text)}
// showUploadImage={this.handleShowUploadImage}
/>}

@ -0,0 +1,103 @@
import React,{ Component } from "react";
import {Checkbox,Radio, Input} from "antd";
import {DMDEditor,markdownToHTML, MarkdownToHtml } from 'educoder'
import QuillForEditor from "../../../../common/quillForEditor";
import axios from 'axios'
const tagArray = [
// 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
// 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R',
// 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'
]
class Progques extends Component{
constructor(props){
super(props);
}
toMDMode = (that) => {
}
onOptionContentChange = (value, index) => {
}
onBlurEmpty=(index,number)=>{
}
render(){
let {
questionType ,
exercise ,
user_exercise_status,
is_md
}=this.props
let isAdmin = this.props.isAdmin();
let isStudent = this.props.isStudent();
let item=questionType;
let titename="";
if(item){
if(is_md===true){
titename=item.description;
}else{
try {
titename = JSON.parse(item.description);
}catch (e) {
titename={"ops":[{"insert":item.description}]};
}
// JSON.parse 有些异常数据是undefined
if(titename===undefined){
titename={"ops":[{"insert":item.description}]};
}
try {
// JSON.parse 转换的时候如果是数字字符串就转成整数了
if(titename>=0){
titename={"ops":[{"insert":item.description}]};
}
}catch (e) {
}
}
}
return(
<div className="pl30 pr30">
<style>{`
.emptyPanel div#content_editorMd_show{
width: 100%;
border-radius: 4px;
// height: 35px;
margin-top:0px;
background-color:#fafafa;
color:#999;
// line-height:25px;
}
.answerStyle{
background:#f5f5f5;
border-radius:4px;
border: 1px solid #eaeaea;
padding:5px;
min-height:35px;
box-sizing:border-box;
}
.emptyPanel .quill_editor_for_react_area{
width: 100% !important;
}
`}</style>
<li className="df mb10 emptyPanel">
<QuillForEditor
readOnly={true}
value={titename}
showUploadImage={this.props.handleShowUploadImage}
/>
</li>
</div>
)
}
}
export default Progques
Loading…
Cancel
Save