From cd48b6dd6e8000ed9477889834359e327ef5ac09 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com>
Date: Thu, 26 Mar 2020 22:47:12 +0800
Subject: [PATCH 1/4] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../react/src/common/quillForEditor/index.js | 16 ++-
.../exercise/ExerciseReviewAndAnswer.js | 17 +++
.../courses/exercise/question/Progques.js | 103 ++++++++++++++++++
3 files changed, 130 insertions(+), 6 deletions(-)
create mode 100644 public/react/src/modules/courses/exercise/question/Progques.js
diff --git a/public/react/src/common/quillForEditor/index.js b/public/react/src/common/quillForEditor/index.js
index 46b02b94e..7f0e56e86 100644
--- a/public/react/src/common/quillForEditor/index.js
+++ b/public/react/src/common/quillForEditor/index.js
@@ -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
diff --git a/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js b/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js
index 9f60b3481..483769f62 100644
--- a/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js
+++ b/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js
@@ -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)}
>
}
+ {
+ //编程题
+ item.question_type == 6 &&
+ this.handleShowUploadImage(u)}
+ >
+
+ }
{
//调分理由部分
diff --git a/public/react/src/modules/courses/exercise/question/Progques.js b/public/react/src/modules/courses/exercise/question/Progques.js
new file mode 100644
index 000000000..7a0c7660b
--- /dev/null
+++ b/public/react/src/modules/courses/exercise/question/Progques.js
@@ -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(
+
+
+
+
+
+
+ )
+ }
+}
+export default Progques
From cea66cbe1bab2123ed7d8785c88539033a3afcfa Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 26 Mar 2020 22:53:28 +0800
Subject: [PATCH 2/4] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E6=97=B6=E9=97=B4?=
=?UTF-8?q?=E7=B4=AF=E5=8A=A0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/games_controller.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb
index 614008112..75e2827a2 100644
--- a/app/controllers/games_controller.rb
+++ b/app/controllers/games_controller.rb
@@ -785,7 +785,7 @@ class GamesController < ApplicationController
# REDO:需要添加详细的说明
def cost_time
#return if @game.status >= 2
- cost_time = params[:time].to_i < @game.cost_time.to_i ? (@game.cost_time.to_i + params[:time].to_i) : params[:time].to_i
+ cost_time = params[:time].to_i < @game.cost_time.to_i ? (@game.cost_time.to_i) : params[:time].to_i
@game.update_attribute(:cost_time, cost_time)
end
From 03d1fab1132be9ca9898a8c494251532f9dc87ec Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 26 Mar 2020 22:55:25 +0800
Subject: [PATCH 3/4] =?UTF-8?q?=E4=B8=8D=E8=83=BD=E5=8E=BB=E9=99=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/games_controller.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb
index 75e2827a2..614008112 100644
--- a/app/controllers/games_controller.rb
+++ b/app/controllers/games_controller.rb
@@ -785,7 +785,7 @@ class GamesController < ApplicationController
# REDO:需要添加详细的说明
def cost_time
#return if @game.status >= 2
- cost_time = params[:time].to_i < @game.cost_time.to_i ? (@game.cost_time.to_i) : params[:time].to_i
+ cost_time = params[:time].to_i < @game.cost_time.to_i ? (@game.cost_time.to_i + params[:time].to_i) : params[:time].to_i
@game.update_attribute(:cost_time, cost_time)
end
From 8899e6c0387ddd44592e594a7032e5520206f53c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Fri, 27 Mar 2020 01:09:29 +0800
Subject: [PATCH 4/4] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/react/src/AppConfig.js | 2 +-
public/react/src/common/TextUtil.js | 8 +--
.../exercise/Exercisestatisticalresult.js | 23 +++++---
.../Exercisestatisticalresulttabel.js | 3 -
.../courses/exercise/Exercisetablesmubu.js | 59 ++++++++++++-------
.../courses/exercise/new/JudgeDisplay.js | 25 ++++++--
.../courses/exercise/new/MainDisplay.js | 15 ++++-
.../courses/exercise/new/NullDisplay.js | 14 ++++-
.../exercise/new/QestionDisplayHeader.js | 18 +++++-
.../courses/exercise/new/ShixunDisplay.js | 16 ++++-
.../courses/exercise/new/ShixunProgramming.js | 14 ++++-
.../courses/exercise/new/SingleDisplay.js | 17 +++++-
12 files changed, 166 insertions(+), 48 deletions(-)
diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js
index df3ad315b..c630abf7e 100644
--- a/public/react/src/AppConfig.js
+++ b/public/react/src/AppConfig.js
@@ -46,7 +46,7 @@ debugType = "admin";
// 老师
// debugType="teacher";
// 学生
-debugType="student";
+//debugType="student";
diff --git a/public/react/src/common/TextUtil.js b/public/react/src/common/TextUtil.js
index 8360881e9..ae04e3a1c 100644
--- a/public/react/src/common/TextUtil.js
+++ b/public/react/src/common/TextUtil.js
@@ -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('
{data&&data.commit_results.map((item,key)=>{
@@ -299,9 +301,14 @@ class Exercisestatisticalresult extends Component {
{/*Q{item.ques_position}:*/}
{/*
*/}
-
:
+ >}
{/*
*/}
@@ -319,8 +326,9 @@ class Exercisestatisticalresult extends Component {
正确率 {ite.challenge_percent}%
{
+ 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 =
- {text.value!="有效填写量"&&text.value!="wrong" &&
-
+ {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?:text.value!="有效填写量"&&text.value!="wrong"&&
}
{text.value==="wrong" && "填写了错误答案" }
- {text.value==="有效填写量" && "有效填写量" }
+ {text.value==="有效填写量" && "有效填写量" }
return (
-
+
(text._type === 0 || text._type === 1) ?
{{tagArray[index]}.}
{_content}
: {_content}
)
-
+
},
}, {
title: '小计',
@@ -122,13 +139,15 @@ class Exercisetablesmubus extends Component {
.Exermubu .ant-table-tbody> tr > td{
border-bottom: transparent;
}
-
+ .ql-editor{
+ padding:0px !important;
+ }
`}
-
- {datas===undefined?"":{
+ 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(