From be232f799db9339be108624a5c37ad564f752b14 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 15:38:26 +0800
Subject: [PATCH 01/14] =?UTF-8?q?=E5=8F=91=E9=80=81=E9=A2=98=E5=BA=93?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../modules/testpaper/Paperlibraryseeid.js | 44 ++--
.../testpaper/component/Contentpart.js | 22 +-
.../modules/testpaper/component/Listjihe.js | 6 +-
.../testpaper/component/SendTopicsModel.js | 192 ++++++++++++++++++
4 files changed, 231 insertions(+), 33 deletions(-)
create mode 100644 public/react/src/modules/testpaper/component/SendTopicsModel.js
diff --git a/public/react/src/modules/testpaper/Paperlibraryseeid.js b/public/react/src/modules/testpaper/Paperlibraryseeid.js
index b39ead8d1..4d957f2c6 100644
--- a/public/react/src/modules/testpaper/Paperlibraryseeid.js
+++ b/public/react/src/modules/testpaper/Paperlibraryseeid.js
@@ -20,6 +20,7 @@ import Bottomsubmit from "../../modules/modals/Bottomsubmit";
import Seeoagertit from "./component/Seeoagertit";
import Paperlibraryseeid_item from './component/Paperlibraryseeid_item';
import QuestionModal from "../question/component/QuestionModal";
+import SendTopicsModel from "./component/SendTopicsModel";
//人工组卷预览
class Paperlibraryseeid extends Component {
constructor(props) {
@@ -33,6 +34,8 @@ class Paperlibraryseeid extends Component {
titiless:"",
boolok:"知道了",
exercise_id:0,
+ SendTop:false,
+ paramsid:null,
}
@@ -100,32 +103,18 @@ class Paperlibraryseeid extends Component {
// titilesm: "功能正在内测中,敬请期待",
// titiless: "",
// })
- let id = this.props.match.params.id;
- let url=`/examination_banks/${id}/send_to_course.json`;
- var data={
- course_id:1309
- };
- this.getwangluodata(url,data);
+ // let id = this.props.match.params.id;
+ // let url=`/examination_banks/${id}/send_to_course.json`;
+ // var data={
+ // course_id:1309
+ // };
+ // this.getwangluodata(url,data);
+
// 2413
+ this.submitInfos(true);
}
- getwangluodata=(url,data)=>{
- axios.post(url,data).then((response) => {
- if (response) {
- // console.log("组卷发送");
- // console.log(response);
- if(response.data){
- if(response.data.status===0){
- this.setState({
- exercise_id:response.data.exercise_id
- })
- }
- }
-
- }
- });
- }
setitem_type = (item_type) => {
@@ -152,15 +141,24 @@ class Paperlibraryseeid extends Component {
})
}
+ submitInfos=(bool)=>{
+ this.setState({
+ SendTop:bool,
+ paramsid:this.props.match.params.id
+ })
+ }
render() {
- let {paperlibrartdata,defaultActiveKey,titilesm,titiless,boolok,modalsType} = this.state;
+ let {paperlibrartdata,defaultActiveKey,titilesm,titiless,boolok,modalsType,SendTop,paramsid} = this.state;
const params = this.props && this.props.match && this.props.match.params;
// console.log("params");
// console.log(params);
let urlsysl=`/paperlibrary?defaultActiveKey=${defaultActiveKey}`;
return (
- 温馨提示:选择的试卷将会发送到指定课堂
+ {this.props&&this.props.mypaper===true?
+ "温馨提示:当前试卷将会发送到指定课堂"
+ :
+ "温馨提示:选择的试卷将会发送到指定课堂"
+ }
Date: Thu, 26 Mar 2020 16:20:55 +0800
Subject: [PATCH 03/14] =?UTF-8?q?=E3=80=90OJ=E3=80=91=E8=B0=83=E8=AF=95?=
=?UTF-8?q?=E8=BE=93=E5=87=BA=E5=92=8C=E6=8F=90=E4=BA=A4=E8=AE=B0=E5=BD=95?=
=?UTF-8?q?=E4=B8=AD=E6=89=A7=E8=A1=8C=E7=BB=93=E6=9E=9C=E8=BE=93=E5=87=BA?=
=?UTF-8?q?=E5=86=85=E5=AE=B9=E6=B2=A1=E6=9C=89=E6=8D=A2=E8=A1=8C=20?=
=?UTF-8?q?=E9=AB=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/helpers/application_helper.rb | 6 ++++++
.../hack_user_lastest_codes/record_detail.json.jbuilder | 3 ++-
app/views/hack_user_lastest_codes/result.json.jbuilder | 1 +
3 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 6d5688078..2770a3739 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -33,6 +33,12 @@ module ApplicationHelper
Base64.urlsafe_encode64(content)
end
+ # 替换换行和tab键
+ def regexp_msg content
+ return nil if content.blank?
+ content.gsub(/\n/, '
').gsub(/\t/, " \; \; \; \; \; \; \; \;")
+ end
+
def graduation_navigation graduation
graduation.class.to_s == "GraduationTopic" ? "毕设选题" : "毕设任务"
end
diff --git a/app/views/hack_user_lastest_codes/record_detail.json.jbuilder b/app/views/hack_user_lastest_codes/record_detail.json.jbuilder
index d05b6d799..189b51c46 100644
--- a/app/views/hack_user_lastest_codes/record_detail.json.jbuilder
+++ b/app/views/hack_user_lastest_codes/record_detail.json.jbuilder
@@ -1,8 +1,9 @@
json.status 0
json.message "返回成功"
json.data do
- json.(@hack_user, :id, :status, :error_line, :error_msg, :expected_output,
+ json.(@hack_user, :id, :status, :error_line, :expected_output,
:input, :output, :execute_time, :execute_memory, :created_at, :code)
+ json.error_msg regexp_msg(@hack_user.error_msg)
json.language @hack_user.language
json.name @hack_user.hack.name
json.myproblem_identifier @my_hack.identifier
diff --git a/app/views/hack_user_lastest_codes/result.json.jbuilder b/app/views/hack_user_lastest_codes/result.json.jbuilder
index 0ddd28103..f55ca1d19 100644
--- a/app/views/hack_user_lastest_codes/result.json.jbuilder
+++ b/app/views/hack_user_lastest_codes/result.json.jbuilder
@@ -3,6 +3,7 @@ json.message "评测完成"
json.data do
json.(@result, :id, :status, :error_line, :error_msg,
:input, :output, :execute_time, :execute_memory)
+ json.error_msg regexp_msg(@result.error_msg)
json.passed @my_hack.passed
# 提交模式多了一个预计输出
if @mode == "submit"
From 45318a1d3983c3140f30e70c4782db606db5e957 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Thu, 26 Mar 2020 16:35:08 +0800
Subject: [PATCH 04/14] =?UTF-8?q?=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/hack_user_lastest_codes/record_detail.json.jbuilder | 3 +--
app/views/hack_user_lastest_codes/result.json.jbuilder | 1 -
2 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/app/views/hack_user_lastest_codes/record_detail.json.jbuilder b/app/views/hack_user_lastest_codes/record_detail.json.jbuilder
index 189b51c46..f6e4d5bd1 100644
--- a/app/views/hack_user_lastest_codes/record_detail.json.jbuilder
+++ b/app/views/hack_user_lastest_codes/record_detail.json.jbuilder
@@ -1,9 +1,8 @@
json.status 0
json.message "返回成功"
json.data do
- json.(@hack_user, :id, :status, :error_line, :expected_output,
+ json.(@hack_user, :id, :status, :error_line, :expected_output, :error_msg,
:input, :output, :execute_time, :execute_memory, :created_at, :code)
- json.error_msg regexp_msg(@hack_user.error_msg)
json.language @hack_user.language
json.name @hack_user.hack.name
json.myproblem_identifier @my_hack.identifier
diff --git a/app/views/hack_user_lastest_codes/result.json.jbuilder b/app/views/hack_user_lastest_codes/result.json.jbuilder
index f55ca1d19..0ddd28103 100644
--- a/app/views/hack_user_lastest_codes/result.json.jbuilder
+++ b/app/views/hack_user_lastest_codes/result.json.jbuilder
@@ -3,7 +3,6 @@ json.message "评测完成"
json.data do
json.(@result, :id, :status, :error_line, :error_msg,
:input, :output, :execute_time, :execute_memory)
- json.error_msg regexp_msg(@result.error_msg)
json.passed @my_hack.passed
# 提交模式多了一个预计输出
if @mode == "submit"
From 92f857962c004ead8f894e808da85546626d245c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Thu, 26 Mar 2020 16:41:58 +0800
Subject: [PATCH 05/14] =?UTF-8?q?=E6=95=99=E5=B8=88=E8=A7=86=E8=A7=92?=
=?UTF-8?q?=E9=80=89=E6=8B=A9=E9=A2=98=E3=80=81=E5=88=A4=E6=96=AD=E9=A2=98?=
=?UTF-8?q?=E3=80=81=E5=A1=AB=E7=A9=BA=E9=A2=98=E3=80=81=E7=BC=96=E7=A8=8B?=
=?UTF-8?q?=E9=A2=98quill=E6=B8=B2=E6=9F=93?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/react/src/common/educoder.js | 2 +
.../courses/exercise/ExerciseDisplay.js | 85 +++++++------------
.../courses/exercise/new/JudgeDisplay.js | 56 ++++--------
.../courses/exercise/new/MainDisplay.js | 58 ++++---------
.../courses/exercise/new/NullDisplay.js | 61 +++++--------
.../exercise/new/QestionDisplayHeader.js | 55 ++++++------
.../courses/exercise/new/ShixunDisplay.js | 51 +++++------
.../courses/exercise/new/ShixunProgramming.js | 70 +++++++++++++++
.../courses/exercise/new/SingleDisplay.js | 65 ++++++--------
9 files changed, 228 insertions(+), 275 deletions(-)
create mode 100644 public/react/src/modules/courses/exercise/new/ShixunProgramming.js
diff --git a/public/react/src/common/educoder.js b/public/react/src/common/educoder.js
index c990b5dea..d8194d7f1 100644
--- a/public/react/src/common/educoder.js
+++ b/public/react/src/common/educoder.js
@@ -59,6 +59,8 @@ export { default as ActionBtn } from './course/ActionBtn'
export { default as MarkdownToHtml } from './components/markdown/MarkdownToHtml'
+export { default as QuillForEditor } from './quillForEditor'
+
export { default as DMDEditor } from './components/markdown/DMDEditor'
export { default as Clappr } from './components/media/Clappr'
diff --git a/public/react/src/modules/courses/exercise/ExerciseDisplay.js b/public/react/src/modules/courses/exercise/ExerciseDisplay.js
index 42702e9cb..17d8f1f18 100644
--- a/public/react/src/modules/courses/exercise/ExerciseDisplay.js
+++ b/public/react/src/modules/courses/exercise/ExerciseDisplay.js
@@ -1,30 +1,14 @@
import React,{ Component } from "react";
-
-import {
- Form, Input, InputNumber, Switch, Radio,
- Slider, Button, Upload, Icon, Rate, Checkbox, message,
- Row, Col, Select, Modal, Tooltip
-} from 'antd';
import axios from 'axios'
-import {getUrl, ActionBtn, markdownToHTML} from 'educoder';
-
import SingleDisplay from './new/SingleDisplay'
import JudgeDisplay from './new/JudgeDisplay'
import NullDisplay from './new/NullDisplay'
import MainDisplay from './new/MainDisplay'
import ShixunDisplay from './new/ShixunDisplay'
+import ShixunProgramming from './new/ShixunProgramming'
import './new/common.css'
-const { TextArea } = Input;
-const confirm = Modal.confirm;
-const $ = window.$
-const { Option } = Select;
-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 ExerciseDisplay extends Component{
constructor(props){
@@ -51,7 +35,7 @@ class ExerciseDisplay extends Component{
}
}
componentDidMount = () => {
- const Id = this.props.match.params.Id
+ const Id = this.props.match.params.Id
if (Id) {
const url = `/${this.props.urlPath || 'exercises'}/${Id}.json`
axios.get(url)
@@ -87,20 +71,7 @@ class ExerciseDisplay extends Component{
}
}
render() {
- // let { question_title, question_score, question_type, question_choices, standard_answer,
- // question_id, question_number, index, displayCount,
- // multi_count
- // } = this.props;
const { exercise_questions,exercise,exercise_types} = this.state;
-
- // // const { getFieldDecorator } = this.props.form;
-
- // const isAdmin = this.props.isAdmin()
- // const courseId=this.props.match.params.coursesId;
- // const isEdit = this.isEdit
- // const qNumber = `question_${index}`;
- // let length = 5;
- // const qName = qNameArray[question_type]
const commonHandler = {}
return(
@@ -153,40 +124,46 @@ class ExerciseDisplay extends Component{
{ exercise_questions.map((item, index) => {
if (item.question_type == 0 || item.question_type == 1) {
-
-
- return
-
+
} else if (item.question_type == 2) {
-
-
- return
-
+
} else if (item.question_type == 3) {
-
-
- return
-
+
} else if (item.question_type == 4) {
-
-
- return
-
+
} else if (item.question_type == 5) {
-
-
+
+
return
-
+
+ }else if (item.question_type == 6) {
+
+ return
+
}
return
})}
diff --git a/public/react/src/modules/courses/exercise/new/JudgeDisplay.js b/public/react/src/modules/courses/exercise/new/JudgeDisplay.js
index d340f5fa4..24e753a1d 100644
--- a/public/react/src/modules/courses/exercise/new/JudgeDisplay.js
+++ b/public/react/src/modules/courses/exercise/new/JudgeDisplay.js
@@ -1,24 +1,9 @@
import React,{ Component } from "react";
-
-import {
- Form, Input, InputNumber, Switch, Radio,
- Slider, Button, Upload, Icon, Rate, Checkbox, message,
- Row, Col, Select, Modal, Tooltip
-} from 'antd';
-import axios from 'axios'
-import { qNameArray } from './common'
-import {getUrl, ActionBtn, markdownToHTML, MarkdownToHtml } from 'educoder';
+import {Radio} from 'antd';
+import {QuillForEditor, MarkdownToHtml } from 'educoder';
import QestionDisplayHeader from './QestionDisplayHeader'
-const { TextArea } = Input;
-const confirm = Modal.confirm;
-const $ = window.$
-const { Option } = Select;
-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 JudgeDisplay extends Component{
constructor(props){
@@ -31,7 +16,7 @@ class JudgeDisplay extends Component{
}
}
componentDidMount = () => {
- const Id = this.props.match.params.Id
+ const Id = this.props.match.params.Id
this.isEdit = !!Id
if (Id) {
const url = `/exercises/${Id}/edit.json`
@@ -47,23 +32,14 @@ class JudgeDisplay extends Component{
}
}
render() {
- let { question_title, question_score, question_type, question_choices, standard_answer,
- question_id, question_number, index, displayCount
+ let { question_choices,
+ question_id, index,
} = this.props;
-
- // const { getFieldDecorator } = this.props.form;
- const isAdmin = this.props.isAdmin()
- const courseId=this.props.match.params.coursesId;
- const isEdit = this.isEdit
+
const qNumber = `question_${index}`;
// TODO show模式 isNew为false isEdit为false
- // [true, false, true] -> [0, 2]
-
- // const answerTagArray = standard_answer.map((item, index) => { return item == true ? tagArray[index] : -1 }).filter(item => item != -1);
- let length = 5;
- const qName = qNameArray[question_type]
return(
-
- { standard_answer[0] &&
+
+ { standard_answer[0] &&
参考答案:
-
-
- {/*
-
*/}
-
+ >:
}
+
}
)
}
}
-// RouteHOC()
+
export default (MainDisplay);
\ No newline at end of file
diff --git a/public/react/src/modules/courses/exercise/new/NullDisplay.js b/public/react/src/modules/courses/exercise/new/NullDisplay.js
index f84daf193..8f4d1bd7b 100644
--- a/public/react/src/modules/courses/exercise/new/NullDisplay.js
+++ b/public/react/src/modules/courses/exercise/new/NullDisplay.js
@@ -1,24 +1,7 @@
import React,{ Component } from "react";
-
-import {
- Form, Input, InputNumber, Switch, Radio,
- Slider, Button, Upload, Icon, Rate, Checkbox, message,
- Row, Col, Select, Modal, Tooltip
-} from 'antd';
-import axios from 'axios'
-import { qNameArray } from './common'
-import {getUrl, ActionBtn, markdownToHTML, MarkdownToHtml} from 'educoder';
+import {QuillForEditor,MarkdownToHtml} from 'educoder';
import QestionDisplayHeader from './QestionDisplayHeader'
-const { TextArea } = Input;
-const confirm = Modal.confirm;
-const $ = window.$
-const { Option } = Select;
-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 NullDisplay extends Component{
constructor(props){
@@ -31,7 +14,7 @@ class NullDisplay extends Component{
}
}
componentDidMount = () => {
- const Id = this.props.match.params.Id
+ const Id = this.props.match.params.Id
this.isEdit = !!Id
if (Id) {
const url = `/exercises/${Id}/edit.json`
@@ -47,16 +30,10 @@ class NullDisplay extends Component{
}
}
render() {
- let { question_title, question_score, question_type, question_choices, standard_answer,
- question_id, question_number, index, displayCount,
- multi_count
+ let { question_type, standard_answer,
+ question_id,index,
} = this.props;
-
- // const { getFieldDecorator } = this.props.form;
- const isAdmin = this.props.isAdmin()
- const courseId=this.props.match.params.coursesId;
- const isEdit = this.isEdit
const qNumber = `question_${index}`;
/**
is_ordered: true
@@ -68,8 +45,7 @@ class NullDisplay extends Component{
question_type: 3
standard_answer: [{choice_id: 1, answer_text: ["2", "22"]}]
*/
- let length = 5;
- const qName = qNameArray[question_type]
+
return(
- {/*
答案(填空{index+1}):
-
- { answers.map((item, itemIndex) => {
- return {item}
- })}
-
*/}
- {
+ {
standard_answer.map((answers, _index) => {
return
答案(填空{_index+1}):
{ answers.answer_text.map((item, itemIndex) => {
- return
+ content={item} selector={'null_' + (index + 1) + (_index + 1) + (itemIndex + 1)}
+ >:
+ )
+
})}
- {/* {item} */}
})
}
-
-
+
+
)
diff --git a/public/react/src/modules/courses/exercise/new/QestionDisplayHeader.js b/public/react/src/modules/courses/exercise/new/QestionDisplayHeader.js
index c90d87dac..4dc8370d3 100644
--- a/public/react/src/modules/courses/exercise/new/QestionDisplayHeader.js
+++ b/public/react/src/modules/courses/exercise/new/QestionDisplayHeader.js
@@ -1,17 +1,8 @@
import React,{ Component } from "react";
-
-import {
- Form, Input, InputNumber, Switch, Radio,
- Slider, Button, Upload, Icon, Rate, Checkbox, message,
- Row, Col, Select, Modal, Tooltip
-} from 'antd';
-import axios from 'axios'
+import {Tooltip} from 'antd';
import { qNameArray } from './common'
-import {getUrl, ActionBtn, markdownToHTML, MarkdownToHtml} from 'educoder';
-const { TextArea } = Input;
-const confirm = Modal.confirm;
-const $ = window.$
-const { Option } = Select;
+import {QuillForEditor, MarkdownToHtml} from 'educoder';
+
class QestionDisplayHeader extends Component{
constructor(props){
@@ -19,24 +10,26 @@ class QestionDisplayHeader extends Component{
this.state = {
-
+
}
}
componentDidMount = () => {
-
+
}
render() {
- let { question_title, question_score, question_type, question_choices, standard_answer,
- question_id, question_number, index, displayCount,
+ let { question_title, question_score, question_type,
+ question_id, index, displayCount,
topRight, showActionButton, exerciseIsPublish
} = this.props;
-
- const isAdmin = this.props.isAdmin()
- const courseId=this.props.match.params.coursesId;
- const isEdit = this.isEdit
- const qNumber = `question_${index}`;
-
+
+ // const isAdmin = this.props.isAdmin()
+ // const courseId=this.props.match.params.coursesId;
+ // const isEdit = this.isEdit
+ // const qNumber = `question_${index}`;
+
const qName = qNameArray[question_type]
+
+ // console.log(this.props)
return(
@@ -44,6 +37,9 @@ class QestionDisplayHeader extends Component{
.actionBtns {
height: 28px
}
+ .ql-editor{
+ padding:0px !important;
+ }
`}
{index+1}、{qName}
@@ -80,11 +76,16 @@ class QestionDisplayHeader extends Component{
}
- { question_title &&
-
- // :
+ //
}
diff --git a/public/react/src/modules/courses/exercise/new/ShixunDisplay.js b/public/react/src/modules/courses/exercise/new/ShixunDisplay.js
index e26a00791..f7bccec60 100644
--- a/public/react/src/modules/courses/exercise/new/ShixunDisplay.js
+++ b/public/react/src/modules/courses/exercise/new/ShixunDisplay.js
@@ -1,25 +1,7 @@
import React,{ Component } from "react";
-import {Link} from 'react-router-dom';
-
-import {
- Form, Input, InputNumber, Switch, Radio,
- Slider, Button, Upload, Icon, Rate, Checkbox, message,
- Row, Col, Select, Modal, Tooltip
-} from 'antd';
-import axios from 'axios'
-import { qNameArray } from './common'
-import {getUrl, ActionBtn, markdownToHTML} from 'educoder';
+import {QuillForEditor,markdownToHTML} from 'educoder';
import QestionDisplayHeader from './QestionDisplayHeader'
-const { TextArea } = Input;
-const confirm = Modal.confirm;
-const $ = window.$
-const { Option } = Select;
-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 ShixunDisplay extends Component{
constructor(props){
@@ -32,17 +14,17 @@ class ShixunDisplay extends Component{
componentDidMount = () => {
}
render() {
- let { question_title, question_score, question_type, standard_answer,
- question_id, question_number, index, displayCount,
+ let { question_title,
+ question_id, index,
- shixun_name, shixun, shixun_id, shixun_identifier
+ shixun_name, shixun, shixun_identifier
} = this.props;
-
+
// const { getFieldDecorator } = this.props.form;
- const isAdmin = this.props.isAdmin()
- const courseId=this.props.match.params.coursesId;
- const isEdit = this.isEdit
+ // const isAdmin = this.props.isAdmin()
+ // const courseId=this.props.match.params.coursesId;
+ // const isEdit = this.isEdit
const qNumber = `question_${index}`;
// TODO show模式 isNew为false isEdit为false
@@ -102,8 +84,8 @@ class ShixunDisplay extends Component{
]
}
*/
- let length = 5;
- const qName = qNameArray[question_type]
+ // let length = 5;
+ // const qName = qNameArray[question_type]
return(
+
+
实训详情
+ }
+ >
+
+
+ {/*{this.props.exercise&&this.props.exercise.is_md?
*/}
+ {/*
:
}*/}
+
+ {/*{shixun.map((ch, index) => {*/}
+ {/* return
*/}
+ {/* {`第${index+1}关`} {ch.challenge_name} {ch.challenge_score}分*/}
+ {/*
*/}
+ {/*})}*/}
+
+
+ )
+ }
+}
+// RouteHOC()
+export default (ShixunProgramming);
diff --git a/public/react/src/modules/courses/exercise/new/SingleDisplay.js b/public/react/src/modules/courses/exercise/new/SingleDisplay.js
index 6b84df8ce..1a56fde96 100644
--- a/public/react/src/modules/courses/exercise/new/SingleDisplay.js
+++ b/public/react/src/modules/courses/exercise/new/SingleDisplay.js
@@ -1,31 +1,13 @@
import React,{ Component } from "react";
-
-import {
- Form, Input, InputNumber, Switch, Radio,
- Slider, Button, Upload, Icon, Rate, Checkbox, message,
- Row, Col, Select, Modal, Tooltip
-} from 'antd';
-import axios from 'axios'
+import { Radio, Checkbox } from 'antd';
import QestionDisplayHeader from './QestionDisplayHeader'
-import {getUrl, ActionBtn, markdownToHTML, MarkdownToHtml} from 'educoder';
-const { TextArea } = Input;
-const confirm = Modal.confirm;
-const $ = window.$
-const { Option } = Select;
+import {MarkdownToHtml,QuillForEditor} from 'educoder';
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'
]
-const qNameArray = [
- '单选题',
- '多选题',
- '判断题',
- '填空题',
- '简答题',
- '实训题',
-]
class SingleDisplay extends Component{
constructor(props){
super(props);
@@ -53,25 +35,15 @@ class SingleDisplay extends Component{
}
}
render() {
- let { question_title, question_score, question_type, question_choices, standard_answer,
- question_id, question_number, index, displayCount, showActionButton
+ let { question_type, question_choices,
+ question_id, index,
} = this.props;
- // const { getFieldDecorator } = this.props.form;
- const isAdmin = this.props.isAdmin()
- const courseId=this.props.match.params.coursesId;
- const isEdit = this.isEdit
const qNumber = `question_${index}`;
// TODO show模式 isNew为false isEdit为false
- // [true, false, true] -> [0, 2]
- // const answerTagArray = standard_answer.map((item, index) => { return item == true ? tagArray[index] : -1 }).filter(item => item != -1);
- let length = 5;
- const qName = qNameArray[question_type]
-
- const isPreviewPage = showActionButton == false
return(
@@ -85,6 +57,9 @@ class SingleDisplay extends Component{
.actionBtns {
height: 28px
}
+ .ql-editor{
+ padding:0px !important;
+ }
`}
@@ -103,11 +78,15 @@ class SingleDisplay extends Component{
flexDirection:"row",
}} key={optionIndex}>
{prefix}
- :}
- >
- {/* */}
)
} else {
@@ -117,11 +96,15 @@ class SingleDisplay extends Component{
flexDirection:"row",
}} key={optionIndex}>
{prefix}
-
:
}
- >
- {/*
*/}
)
}
})}
@@ -131,5 +114,5 @@ class SingleDisplay extends Component{
)
}
}
-// RouteHOC()
+
export default (SingleDisplay);
From 5cba3eda8a575a7c6ef1a80bb8f69fd328ce6a68 Mon Sep 17 00:00:00 2001
From: harry
Date: Thu, 26 Mar 2020 16:47:15 +0800
Subject: [PATCH 06/14] execrisenew
---
public/react/package-lock.json | 12 ++
.../courses/Video/video-play/index.jsx | 1 -
.../modules/courses/exercise/ExerciseNew.js | 111 ++++++------------
3 files changed, 49 insertions(+), 75 deletions(-)
diff --git a/public/react/package-lock.json b/public/react/package-lock.json
index ce3ac05c7..7bd937b8b 100644
--- a/public/react/package-lock.json
+++ b/public/react/package-lock.json
@@ -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": {
"version": "1.1.0",
"resolved": "http://registry.npm.taobao.org/read-pkg/download/read-pkg-1.1.0.tgz",
diff --git a/public/react/src/modules/courses/Video/video-play/index.jsx b/public/react/src/modules/courses/Video/video-play/index.jsx
index 3556d4a05..93d04b245 100644
--- a/public/react/src/modules/courses/Video/video-play/index.jsx
+++ b/public/react/src/modules/courses/Video/video-play/index.jsx
@@ -28,7 +28,6 @@ export default ({ src, videoId, logWatchHistory, courseId = null }) => {
const suf = src.split('.').pop()
const isFlv = suf === 'flv'
const el = useRef()
-
const deviceMatch = navigator.userAgent.toLowerCase().match(regex)
const device = deviceMatch ? deviceMatch[0] : 'pc'
diff --git a/public/react/src/modules/courses/exercise/ExerciseNew.js b/public/react/src/modules/courses/exercise/ExerciseNew.js
index 07bd1467c..e605b2f07 100644
--- a/public/react/src/modules/courses/exercise/ExerciseNew.js
+++ b/public/react/src/modules/courses/exercise/ExerciseNew.js
@@ -1,94 +1,57 @@
-import React,{ Component } from "react";
+import React, { Component } from "react";
-import {
- 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 { CBreadcrumb } from 'educoder';
-// 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 '../css/Courses.css'
import ExerciseNewCommon from './ExerciseNewCommon'
-const { TextArea } = Input;
-class ExerciceNew extends Component{
- constructor(props){
+class ExerciceNew extends Component {
+ constructor(props) {
super(props);
-
-
this.state = {
-
+ left_banner_id: null
}
- }
- componentDidMount = () => {
-
}
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() {
- let { left_banner_id } = this.state;
-
-
+ let { left_banner_id } = this.state;
const { current_user } = this.props
-
- const courseId=this.props.match.params.coursesId;
-
- const isEdit = this.isEdit;
-
- document.title=this.props.coursedata&&this.props.coursedata.name;
- return(
-
-
-
+ )
+ }
}
// RouteHOC()
export default (ExerciceNew);
From 5c59c40877e6cc97ae2cca7cc4830508a23abe50 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Thu, 26 Mar 2020 17:15:57 +0800
Subject: [PATCH 07/14] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../courses/exercise/ExerciseDisplay.js | 8 +++----
.../courses/exercise/new/JudgeDisplay.js | 9 +++-----
.../courses/exercise/new/ShixunProgramming.js | 22 +++++++++----------
3 files changed, 17 insertions(+), 22 deletions(-)
diff --git a/public/react/src/modules/courses/exercise/ExerciseDisplay.js b/public/react/src/modules/courses/exercise/ExerciseDisplay.js
index 17d8f1f18..589bbb6f0 100644
--- a/public/react/src/modules/courses/exercise/ExerciseDisplay.js
+++ b/public/react/src/modules/courses/exercise/ExerciseDisplay.js
@@ -125,7 +125,6 @@ class ExerciseDisplay extends Component{
{ exercise_questions.map((item, index) => {
if (item.question_type == 0 || item.question_type == 1) {
-
return
@@ -146,7 +145,7 @@ class ExerciseDisplay extends Component{
} else if (item.question_type == 4) {
-
+ //
return
@@ -163,9 +162,10 @@ class ExerciseDisplay extends Component{
return
-
+ }else{
+ return
}
- return
+
})}
)
diff --git a/public/react/src/modules/courses/exercise/new/JudgeDisplay.js b/public/react/src/modules/courses/exercise/new/JudgeDisplay.js
index 24e753a1d..92e7de752 100644
--- a/public/react/src/modules/courses/exercise/new/JudgeDisplay.js
+++ b/public/react/src/modules/courses/exercise/new/JudgeDisplay.js
@@ -1,10 +1,9 @@
import React,{ Component } from "react";
-import {Radio} from 'antd';
-import {QuillForEditor, MarkdownToHtml } from 'educoder';
+import { Radio } from 'antd';
+import { MarkdownToHtml,QuillForEditor } from 'educoder';
import QestionDisplayHeader from './QestionDisplayHeader'
-
class JudgeDisplay extends Component{
constructor(props){
super(props);
@@ -33,12 +32,10 @@ class JudgeDisplay extends Component{
}
render() {
let { question_choices,
- question_id, index,
+ question_id, index
} = this.props;
-
const qNumber = `question_${index}`;
- // TODO show模式 isNew为false isEdit为false
return(
diff --git a/public/react/src/modules/courses/exercise/new/ShixunProgramming.js b/public/react/src/modules/courses/exercise/new/ShixunProgramming.js
index cf8967b58..5a0b37ee6 100644
--- a/public/react/src/modules/courses/exercise/new/ShixunProgramming.js
+++ b/public/react/src/modules/courses/exercise/new/ShixunProgramming.js
@@ -15,11 +15,10 @@ class ShixunProgramming extends Component{
}
render() {
let { question_title,
- question_id, index,
- shixun_name, shixun_identifier
+ question_id, index, shixun_identifier
} = this.props;
const qNumber = `question_${index}`;
- // TODO show模式 isNew为false isEdit为false
+
console.log(this.props)
// console.log(this.state)
// question_id: 32336
@@ -37,13 +36,13 @@ class ShixunProgramming extends Component{
`}
-
实训详情
- }
- >
+ {/*
实训详情*/}
+ {/* }*/}
+ {/*>*/}
{/*{this.props.exercise&&this.props.exercise.is_md?
Date: Thu, 26 Mar 2020 17:19:35 +0800
Subject: [PATCH 08/14] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/modules/courses/exercise/new/JudgeDisplay.js | 2 +-
.../src/modules/courses/exercise/new/MainDisplay.js | 11 +++--------
.../modules/courses/exercise/new/ShixunProgramming.js | 2 +-
3 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/public/react/src/modules/courses/exercise/new/JudgeDisplay.js b/public/react/src/modules/courses/exercise/new/JudgeDisplay.js
index 92e7de752..cbfbb4906 100644
--- a/public/react/src/modules/courses/exercise/new/JudgeDisplay.js
+++ b/public/react/src/modules/courses/exercise/new/JudgeDisplay.js
@@ -56,7 +56,7 @@ class JudgeDisplay extends Component{
{/* 单选 or 多选 */}
{ question_choices.map((item, optionIndex) => {
- // 单选
+ console.log(item.choice_text)
return (
diff --git a/public/react/src/modules/courses/exercise/new/MainDisplay.js b/public/react/src/modules/courses/exercise/new/MainDisplay.js
index d91cfbc24..fddd29d0e 100644
--- a/public/react/src/modules/courses/exercise/new/MainDisplay.js
+++ b/public/react/src/modules/courses/exercise/new/MainDisplay.js
@@ -1,5 +1,5 @@
import React,{ Component } from "react";
-import { MarkdownToHtml,QuillForEditor} from 'educoder';
+import { MarkdownToHtml } from 'educoder';
import QestionDisplayHeader from './QestionDisplayHeader'
@@ -44,14 +44,9 @@ class MainDisplay extends Component{
参考答案:
- {this.props.exercise&&this.props.exercise.is_md?:}
+ >
}
diff --git a/public/react/src/modules/courses/exercise/new/ShixunProgramming.js b/public/react/src/modules/courses/exercise/new/ShixunProgramming.js
index 5a0b37ee6..14dec06b8 100644
--- a/public/react/src/modules/courses/exercise/new/ShixunProgramming.js
+++ b/public/react/src/modules/courses/exercise/new/ShixunProgramming.js
@@ -19,7 +19,7 @@ class ShixunProgramming extends Component{
} = this.props;
const qNumber = `question_${index}`;
- console.log(this.props)
+ // console.log(this.props)
// console.log(this.state)
// question_id: 32336
// q_position: 4
From 658f7453b155b893d6bb1506e78c8b01b546d8f2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Thu, 26 Mar 2020 17:20:15 +0800
Subject: [PATCH 09/14] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../modules/courses/exercise/new/JudgeDisplay.js | 13 ++++---------
.../src/modules/courses/exercise/new/MainDisplay.js | 11 ++++++++---
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/public/react/src/modules/courses/exercise/new/JudgeDisplay.js b/public/react/src/modules/courses/exercise/new/JudgeDisplay.js
index cbfbb4906..6cf637fc3 100644
--- a/public/react/src/modules/courses/exercise/new/JudgeDisplay.js
+++ b/public/react/src/modules/courses/exercise/new/JudgeDisplay.js
@@ -1,6 +1,6 @@
import React,{ Component } from "react";
import { Radio } from 'antd';
-import { MarkdownToHtml,QuillForEditor } from 'educoder';
+import { MarkdownToHtml } from 'educoder';
import QestionDisplayHeader from './QestionDisplayHeader'
@@ -56,19 +56,14 @@ class JudgeDisplay extends Component{
{/* 单选 or 多选 */}
{ question_choices.map((item, optionIndex) => {
- console.log(item.choice_text)
+ // 单选
return (
- {this.props.exercise&&this.props.exercise.is_md?:}
+ >
)
diff --git a/public/react/src/modules/courses/exercise/new/MainDisplay.js b/public/react/src/modules/courses/exercise/new/MainDisplay.js
index fddd29d0e..d91cfbc24 100644
--- a/public/react/src/modules/courses/exercise/new/MainDisplay.js
+++ b/public/react/src/modules/courses/exercise/new/MainDisplay.js
@@ -1,5 +1,5 @@
import React,{ Component } from "react";
-import { MarkdownToHtml } from 'educoder';
+import { MarkdownToHtml,QuillForEditor} from 'educoder';
import QestionDisplayHeader from './QestionDisplayHeader'
@@ -44,9 +44,14 @@ class MainDisplay extends Component{
参考答案:
-
+ >:}
}
From a51f499f01954c989be900aefbf09e2a4f80ca4e Mon Sep 17 00:00:00 2001
From: harry
Date: Thu, 26 Mar 2020 19:48:11 +0800
Subject: [PATCH 10/14] =?UTF-8?q?=E8=AF=95=E5=8D=B7=E6=96=B0=E5=A2=9E?=
=?UTF-8?q?=E7=BC=96=E8=BE=91=E5=99=A8=E9=80=89=E6=8B=A9=E9=A1=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../modules/courses/exercise/ExerciseNew.js | 3 +-
.../courses/exercise/ExerciseNewCommon.js | 468 +++++++-----------
.../exercise/exercise-new-form/index.jsx | 101 ++++
.../exercise/exercise-new-form/index.scss | 47 ++
4 files changed, 333 insertions(+), 286 deletions(-)
create mode 100644 public/react/src/modules/courses/exercise/exercise-new-form/index.jsx
create mode 100644 public/react/src/modules/courses/exercise/exercise-new-form/index.scss
diff --git a/public/react/src/modules/courses/exercise/ExerciseNew.js b/public/react/src/modules/courses/exercise/ExerciseNew.js
index e605b2f07..f5b60cfd4 100644
--- a/public/react/src/modules/courses/exercise/ExerciseNew.js
+++ b/public/react/src/modules/courses/exercise/ExerciseNew.js
@@ -53,5 +53,4 @@ class ExerciceNew extends Component {
)
}
}
-// RouteHOC()
-export default (ExerciceNew);
+export default ExerciceNew;
diff --git a/public/react/src/modules/courses/exercise/ExerciseNewCommon.js b/public/react/src/modules/courses/exercise/ExerciseNewCommon.js
index 0f61b9942..9101a4974 100644
--- a/public/react/src/modules/courses/exercise/ExerciseNewCommon.js
+++ b/public/react/src/modules/courses/exercise/ExerciseNewCommon.js
@@ -1,19 +1,10 @@
-import React,{ Component } from "react";
+import React, { Component } from "react";
-import {
- 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 TPMMDEditor from '../../tpm/challengesnew/TPMMDEditor';
+import { 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 axios from 'axios'
-// import './board.css'
import "../common/formCommon.css"
-
-// import { RouteHOC } from './common.js'
-import CBreadcrumb from '../common/CBreadcrumb'
-import {getUrl, ActionBtn} from 'educoder';
+import { ActionBtn } from 'educoder';
import SingleEditor from './new/SingleEditor'
import SingleDisplay from './new/SingleDisplay'
@@ -27,22 +18,20 @@ import ShixunEditor from './new/ShixunEditor'
import ShixunDisplay from './new/ShixunDisplay'
import ShixunChooseModal from '../coursesPublic/ShixunChooseModal'
+import ExerciseForm from './exercise-new-form'
+
import update from 'immutability-helper'
import './new/common.css'
import '../css/Courses.css'
-const { TextArea } = Input;
-const confirm = Modal.confirm;
const $ = window.$
-const { Option } = Select;
-const TITLE_MAX_LENGTH = 60;
-class ExerciseNewCommon extends Component{
- constructor(props){
+class ExerciseNewCommon extends Component {
+ constructor(props) {
super(props);
-
this.state = {
exercise_questions: [],
exercise_name: '',
+ is_md: false,
exercise_description: '',
exercise_types: {},
editMode: !this.props.match.params.Id,
@@ -50,30 +39,30 @@ class ExerciseNewCommon extends Component{
}
// 已发布试卷编辑保存的确认弹框
- changeScore = (question_id,answerArray) =>{
+ changeScore = (question_id, answerArray) => {
this.props.confirm({
- content:'修改了标准答案',
- subContent:"是否重新计算学生答题的成绩?",
- onOk:()=>{
- this.sureChangeScore(question_id,answerArray)
+ content: '修改了标准答案',
+ subContent: "是否重新计算学生答题的成绩?",
+ onOk: () => {
+ this.sureChangeScore(question_id, answerArray)
},
- onCancel:()=>{
+ onCancel: () => {
this.addSuccess();
}
})
}
// 已发布试卷修改答案确认修改分数
- sureChangeScore = (question_id,answerArray) =>{
- let url=`/exercise_questions/${question_id}/update_scores.json`
- axios.post((url),{
- standard_answers:answerArray
- }).then((result)=>{
- if(result){
+ sureChangeScore = (question_id, answerArray) => {
+ let url = `/exercise_questions/${question_id}/update_scores.json`
+ axios.post((url), {
+ standard_answers: answerArray
+ }).then((result) => {
+ if (result) {
this.props.showNotification(`${result.data.message}`);
this.addSuccess();
}
- }).catch((error)=>{
+ }).catch((error) => {
console.log(error);
})
}
@@ -82,7 +71,7 @@ class ExerciseNewCommon extends Component{
const Id = this.props.match.params.Id
this.isEdit = this.props.isEdit || !!Id
if (this.isEdit) {
- const url = this.props.exercise_url ? `/${this.props.exercise_url }/${Id}.json` : `/exercises/${Id}/edit.json`
+ const url = this.props.exercise_url ? `/${this.props.exercise_url}/${Id}.json` : `/exercises/${Id}/edit.json`
axios.get(url)
.then((response) => {
if (response.data.exercise) {
@@ -101,7 +90,7 @@ class ExerciseNewCommon extends Component{
console.log(error);
});
} else {
- const courseId=this.props.match.params.coursesId;
+ const courseId = this.props.match.params.coursesId;
const newUrl = `/courses/${courseId}/exercises/new.json`
axios.get(newUrl)
@@ -120,63 +109,54 @@ class ExerciseNewCommon extends Component{
componentDidMount = () => {
this.fetchExercise()
}
- // handleSubmit = (e) => {
- //
- // }
- onSaveExercise = () => {
- const { exercise_name, exercise_description } = this.state;
+
+ onSaveExercise = (data) => {
const exercise_id = this.props.match.params.Id
const courseId = this.props.match.params.coursesId
+
if (this.isEdit) {
- // /exercise_banks/:id.json
const editUrl = `/${this.props.exercise_url ? this.props.exercise_url : 'exercises'}/${exercise_id}.json`
- axios.put(editUrl, {
- exercise_name,
- exercise_description
- })
+ axios.put(editUrl, { ...data })
.then((response) => {
if (response.data.status == 0) {
- this.setState({editMode: false})
+ this.setState({ ...data, editMode: false })
this.props.showNotification('试卷编辑成功')
}
})
.catch(function (error) {
- console.log(error);
+ console.log(error);
});
} else {
const url = `/courses/${courseId}/exercises.json`
axios.post(url, {
- exercise_name,
- exercise_description
+ ...data
})
.then((response) => {
if (response.data.status == 0) {
- this.setState({editMode: false})
-
- this.props.showNotification('试卷新建成功')
- const exercise_id = response.data.data.exercise_id;
- this.isEdit = true;
-
- this.props.history.replace(`/classrooms/${courseId}/exercises/${exercise_id}/edit`);
+ this.setState({ ...data, editMode: false })
+ this.props.showNotification('试卷新建成功')
+ const exercise_id = response.data.data.exercise_id;
+ this.isEdit = true;
+ this.props.history.replace(`/classrooms/${courseId}/exercises/${exercise_id}/edit`);
}
})
.catch(function (error) {
- console.log(error);
+ console.log(error);
});
}
}
exercise_name_change = (e) => {
- this.setState({exercise_name: e.target.value})
+ this.setState({ exercise_name: e.target.value })
}
exercise_description_change = (e) => {
- this.setState({exercise_description: e.target.value})
+ this.setState({ exercise_description: e.target.value })
}
// #问题的类型,0为单选题,1为多选题,2为判断题,3为填空题,4为主观题,5为实训题
_checkIsEditing = () => {
- if (this.editingId && $(this.editingId).length ) {
+ if (this.editingId && $(this.editingId).length) {
this.props.showNotification('请先保存或取消当前正在编辑的问题。')
- $("html").animate({ scrollTop: $(this.editingId).offset().top - 100})
+ $("html").animate({ scrollTop: $(this.editingId).offset().top - 100 })
return true
}
return false
@@ -186,7 +166,7 @@ class ExerciseNewCommon extends Component{
// 找到编辑或新建的item,新建就删掉item,编辑就isNew改为false
const { exercise_questions } = this.state
let index = -1;
- for(let i = 0; i < exercise_questions.length; i++) {
+ for (let i = 0; i < exercise_questions.length; i++) {
if (exercise_questions[i].isNew == true) {
index = i;
break;
@@ -195,14 +175,14 @@ class ExerciseNewCommon extends Component{
if (exercise_questions[index].question_id) { // 编辑
this.setState(
(prevState) => ({
- exercise_questions : update(prevState.exercise_questions, {[index]: { isNew: {$set: false}}})
+ exercise_questions: update(prevState.exercise_questions, { [index]: { isNew: { $set: false } } })
// update(prevState.exercise_questions, {$splice: [[index, 1]]})
})
)
} else { // 新建
this.setState(
(prevState) => ({
- exercise_questions : update(prevState.exercise_questions, {$splice: [[index, 1]]})
+ exercise_questions: update(prevState.exercise_questions, { $splice: [[index, 1]] })
})
)
}
@@ -241,10 +221,6 @@ class ExerciseNewCommon extends Component{
this.refs.shixunChooseModal.setVisible(true)
this.question_id_to_insert_after = question_id_to_insert_after;
return;
- // 拉取实训items
- this.addEditingQuestion(Q_TYPE_SHIXUN, question_id_to_insert_after, {
- shixun_id: 50
- })
}
editQestion = (index) => {
if (this._checkIsEditing()) {
@@ -254,7 +230,7 @@ class ExerciseNewCommon extends Component{
this.setState(
(prevState) => ({
- exercise_questions : update(prevState.exercise_questions, {[index]: { isNew: {$set: true}}})
+ exercise_questions: update(prevState.exercise_questions, { [index]: { isNew: { $set: true } } })
})
)
}
@@ -264,16 +240,16 @@ class ExerciseNewCommon extends Component{
}
const url = `/${this.props.exercise_url_questions || 'exercise_questions'}/${question_id}/up_down.json`
- axios.post(url, { opr: isUp ? 'up' : 'down'})
- .then((response) => {
- if (response.data.status == 0) {
- // this.props.showNotification('移动成功')
- this.fetchExercise()
- }
- })
- .catch(function (error) {
- console.log(error);
- });
+ axios.post(url, { opr: isUp ? 'up' : 'down' })
+ .then((response) => {
+ if (response.data.status == 0) {
+ // this.props.showNotification('移动成功')
+ this.fetchExercise()
+ }
+ })
+ .catch(function (error) {
+ console.log(error);
+ });
}
onSortDown = (index, question_id) => {
this.onSort(index, question_id, false)
@@ -304,7 +280,7 @@ class ExerciseNewCommon extends Component{
}
const _indexBefore = question_id_to_insert_after ? this.findIndexById(question_id_to_insert_after) : this.state.exercise_questions.length - 1
for (let i = _indexBefore; i >= 0; i--) {
- if(this.state.exercise_questions[i].question_type == question_type) {
+ if (this.state.exercise_questions[i].question_type == question_type) {
init_question_score = this.state.exercise_questions[i].question_score
break;
}
@@ -315,7 +291,7 @@ class ExerciseNewCommon extends Component{
let init_question_score = this.getInitScore(question_type, question_id_to_insert_after)
- let questionObj = {
+ let questionObj = {
question_type: question_type, // 需要这个通过类型判断
init_question_score: init_question_score,
isNew: true, // 新建或编辑,用是否有id区分是新建还是编辑
@@ -336,13 +312,13 @@ class ExerciseNewCommon extends Component{
this.editingId = `#question_${newIndex}`
this.setState({ exercise_questions: new_exercise_questions }, () => {
setTimeout(() => {
- $(this.editingId).length && $("html").animate({ scrollTop: $(this.editingId).offset().top - 100})
+ $(this.editingId).length && $("html").animate({ scrollTop: $(this.editingId).offset().top - 100 })
}, 500)
})
}
findIndexById = (id) => {
const { exercise_questions } = this.state
- for(let i = 0; i < exercise_questions.length; i++) {
+ for (let i = 0; i < exercise_questions.length; i++) {
if (exercise_questions[i].question_id == id) {
return i;
}
@@ -354,24 +330,15 @@ class ExerciseNewCommon extends Component{
onOk: () => {
const url = `/${this.props.exercise_url_questions || 'exercise_questions'}/${question_id}.json`
axios.delete(url)
- .then((response) => {
- if (response.data.status == 0) {
- this.props.showNotification('删除成功')
- 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) {
- console.log(error);
- });
+ .then((response) => {
+ if (response.data.status == 0) {
+ this.props.showNotification('删除成功')
+ this.fetchExercise()
+ }
+ })
+ .catch(function (error) {
+ console.log(error);
+ });
}
})
}
@@ -393,40 +360,33 @@ class ExerciseNewCommon extends Component{
const editUrl = this.props.exercise_url_questions ? `/${this.props.exercise_url_questions}/${question_id}.json` : `/exercise_questions/${question_id}.json`
return editUrl;
}
+ onCancel = () => {
+ this.setState({
+ editMode: false
+ })
+ }
render() {
- let { exercise_name, exercise_description, course_id, exercise_types,
- exercise_questions, left_banner_id } = this.state;
- // if (this.isEdit && !exercise_types) {
- // return ''
- // }
- // const { getFieldDecorator } = this.props.form;
+ let { exercise_name, exercise_description, exercise_types, exercise_questions, is_md } = this.state;
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;
- const formItemLayout = {
- labelCol: {
- xs: { span: 24 },
- // sm: { span: 8 },
- sm: { span: 24 },
- },
- wrapperCol: {
- xs: { span: 24 },
- // sm: { span: 16 },
- sm: { span: 24 },
- },
- };
+ q_mains, q_mains_scores, q_nulls, q_nulls_scores, q_shixuns, q_shixuns_scores, q_singles, q_singles_scores } = exercise_types;
+
+ const exerciseFormOpt = {
+ exercise_name,
+ exercise_description,
+ is_md,
+ onCancel: this.onCancel,
+ isEdit: this.isEdit,
+ onSaveHandler: this.onSaveExercise
+ }
- const { current_user } = this.props
- const isAdmin = this.props.isAdmin()
- const courseId=this.props.match.params.coursesId;
const exercise_id = this.props.match.params.Id
- const isEdit = this.isEdit
const commonHandler = {
onQestionDelete: this.onQestionDelete,
addSuccess: this.addSuccess,
addQuestion: this.addQuestion,
onEditorCancel: this.onEditorCancel,
- changeScore:this.changeScore,
+ changeScore: this.changeScore,
editQestion: this.editQestion,
onSortDown: this.onSortDown,
onSortUp: this.onSortUp,
@@ -438,16 +398,16 @@ class ExerciseNewCommon extends Component{
getEditQuestionUrl: this.getEditQuestionUrl,
exercise_url: this.props.exercise_url,
}
- return(
-
-
-
- {!this.state.editMode && }
- {this.state.editMode && }
-
-
-
-
- { !!q_singles && 单选题{q_singles}题,共{q_singles_scores}分}
- { !!q_doubles && 多选题{q_doubles}题,共{q_doubles_scores}分}
- { !!q_judges && 判断题{q_judges}题,共{q_judges_scores}分}
- { !!q_nulls && 填空题{q_nulls}题,共{q_nulls_scores}分}
- { !!q_mains && 简答题{q_mains}题,共{q_mains_scores}分}
- { !!q_shixuns && 实训题{q_shixuns}题,共{q_shixuns_scores}分 }
-
-
- { !!q_counts &&
-
- 合计 {q_counts} 题,
+ {!this.state.editMode && }
+ {this.state.editMode && }
+
+
+
+
+ {!!q_singles && 单选题{q_singles}题,共{q_singles_scores}分}
+ {!!q_doubles && 多选题{q_doubles}题,共{q_doubles_scores}分}
+ {!!q_judges && 判断题{q_judges}题,共{q_judges_scores}分}
+ {!!q_nulls && 填空题{q_nulls}题,共{q_nulls_scores}分}
+ {!!q_mains && 简答题{q_mains}题,共{q_mains_scores}分}
+ {!!q_shixuns && 实训题{q_shixuns}题,共{q_shixuns_scores}分}
+
+
+ {!!q_counts &&
+
+ 合计 {q_counts} 题,
共 100 ? 'color-red font-bd' : 'color-orange'}`}>{q_scores} 分
- }
-
-
-
- { exercise_questions.map((item, index) => {
- if (item.question_type == 0 || item.question_type == 1) {
- if (item.isNew) {
- return
- } else {
- return
- }
- } else if (item.question_type == 2) {
- if (item.isNew) {
- return
- } else {
- return
- }
- } else if (item.question_type == 3) {
- if (item.isNew) {
- return
- } else {
- return
- }
- } else if (item.question_type == 4) {
- if (item.isNew) {
- return
- } else {
- return
- }
- } else if (item.question_type == 5) {
- if (item.isNew) {
- return
- } else {
- return
- }
- }
- return
- })}
+ }
+
+
+
+ {exercise_questions.map((item, index) => {
+ if (item.question_type == 0 || item.question_type == 1) {
+ if (item.isNew) {
+ return
+ } else {
+ return
+ }
+ } else if (item.question_type == 2) {
+ if (item.isNew) {
+ return
+ } else {
+ return
+ }
+ } else if (item.question_type == 3) {
+ if (item.isNew) {
+ return
+ } else {
+ return
+ }
+ } else if (item.question_type == 4) {
+ if (item.isNew) {
+ return
+ } else {
+ return
+ }
+ } else if (item.question_type == 5) {
+ if (item.isNew) {
+ return
+ } else {
+ return
+ }
+ }
+ return
+ })}
- {!commonHandler.exerciseIsPublish &&
-
this.addQuestion(null, Q_TYPE_SINGLE)}>
- 选择题
+ {!commonHandler.exerciseIsPublish &&
+
this.addQuestion(null, Q_TYPE_SINGLE)}>
+ 选择题
-
this.addQuestion(null, Q_TYPE_JUDGE)}>
- 判断题
+ this.addQuestion(null, Q_TYPE_JUDGE)}>
+ 判断题
- this.addQuestion(null, Q_TYPE_NULL)}>
- 填空题
+ this.addQuestion(null, Q_TYPE_NULL)}>
+ 填空题
- this.addQuestion(null, Q_TYPE_MAIN)}>
- 简答题
+ this.addQuestion(null, Q_TYPE_MAIN)}>
+ 简答题
- this.addShixun(null)}>
- 实训题
+ this.addShixun(null)}>
+ 实训题
- {exercise_id && !this.props.hidePreviewButton && this.goToPreview()}>
- {/* */}
- 试卷预览
+ {exercise_id && !this.props.hidePreviewButton && this.goToPreview()}>
+ 试卷预览
}
- {this.props.bottomSection && this.props.bottomSection}
- }
-
-
- )
- }
+ {this.props.bottomSection && this.props.bottomSection}
+
}
+
+
+ )
+ }
}
// RouteHOC()
export default (ExerciseNewCommon);
diff --git a/public/react/src/modules/courses/exercise/exercise-new-form/index.jsx b/public/react/src/modules/courses/exercise/exercise-new-form/index.jsx
new file mode 100644
index 000000000..00b9aec90
--- /dev/null
+++ b/public/react/src/modules/courses/exercise/exercise-new-form/index.jsx
@@ -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 编辑器选择: (请在下方选择一个您想使用的编辑器)
+}
+
+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 (
+
+
+ )
+}
\ No newline at end of file
diff --git a/public/react/src/modules/courses/exercise/exercise-new-form/index.scss b/public/react/src/modules/courses/exercise/exercise-new-form/index.scss
new file mode 100644
index 000000000..e5188d2ff
--- /dev/null
+++ b/public/react/src/modules/courses/exercise/exercise-new-form/index.scss
@@ -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;
+ }
+}
\ No newline at end of file
From 7f56b2f485ac908fd0aa3b43f208325943ac927e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Thu, 26 Mar 2020 19:58:38 +0800
Subject: [PATCH 11/14] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../courses/exercise/ExerciseNewCommon.js | 2 +
.../courses/exercise/new/MainDisplay.js | 2 +-
.../courses/exercise/new/NullDisplay.js | 2 +-
.../exercise/new/QestionDisplayHeader.js | 4 +-
.../courses/exercise/new/ShixunDisplay.js | 2 +-
.../courses/exercise/new/ShixunProgramming.js | 38 +++++++++----------
.../courses/exercise/new/SingleDisplay.js | 4 +-
.../modules/courses/exercise/new/common.js | 2 +
8 files changed, 30 insertions(+), 26 deletions(-)
diff --git a/public/react/src/modules/courses/exercise/ExerciseNewCommon.js b/public/react/src/modules/courses/exercise/ExerciseNewCommon.js
index 9101a4974..677a09f8f 100644
--- a/public/react/src/modules/courses/exercise/ExerciseNewCommon.js
+++ b/public/react/src/modules/courses/exercise/ExerciseNewCommon.js
@@ -398,6 +398,8 @@ class ExerciseNewCommon extends Component {
getEditQuestionUrl: this.getEditQuestionUrl,
exercise_url: this.props.exercise_url,
}
+ console.log(this.props)
+ console.log(this.state)
return (
参考答案:
- {this.props.exercise&&this.props.exercise.is_md?:
{ answers.answer_text.map((item, itemIndex) => {
return(
- this.props.exercise&&this.props.exercise.is_md?:
@@ -77,7 +77,7 @@ class QestionDisplayHeader extends Component{
{ question_title &&
- this.props.exercise&&this.props.exercise.is_md?
:
- {this.props.exercise&&this.props.exercise.is_md?
: {
}
render() {
- let { question_title,
- question_id, index, shixun_identifier
+ let { description,question_title,
+ question_id, index, shixun_identifier,hack_identifier
} = this.props;
const qNumber = `question_${index}`;
@@ -36,24 +36,24 @@ class ShixunProgramming extends Component{
`}
- {/*实训详情*/}
- {/* }*/}
- {/*>*/}
+ 实训详情
+ }
+ >
- {/*{this.props.exercise&&this.props.exercise.is_md?*/}
- {/*
:}*/}
+ {description&&
+ !this.props.exercise||this.props.exercise&&this.props.exercise.is_md?:}
{/*{shixun.map((ch, index) => {*/}
{/* return */}
diff --git a/public/react/src/modules/courses/exercise/new/SingleDisplay.js b/public/react/src/modules/courses/exercise/new/SingleDisplay.js
index 1a56fde96..7c008bb07 100644
--- a/public/react/src/modules/courses/exercise/new/SingleDisplay.js
+++ b/public/react/src/modules/courses/exercise/new/SingleDisplay.js
@@ -78,7 +78,7 @@ class SingleDisplay extends Component{
flexDirection:"row",
}} key={optionIndex}>
{prefix}
- {this.props.exercise&&this.props.exercise.is_md?
:
{prefix}
- {this.props.exercise&&this.props.exercise.is_md?:
Date: Thu, 26 Mar 2020 20:13:35 +0800
Subject: [PATCH 12/14] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/modules/courses/exercise/new/ShixunProgramming.js | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/public/react/src/modules/courses/exercise/new/ShixunProgramming.js b/public/react/src/modules/courses/exercise/new/ShixunProgramming.js
index 9be9dd4cc..80c966267 100644
--- a/public/react/src/modules/courses/exercise/new/ShixunProgramming.js
+++ b/public/react/src/modules/courses/exercise/new/ShixunProgramming.js
@@ -38,13 +38,12 @@ class ShixunProgramming extends Component{
实训详情
}
>
-
-
+
{description&&
!this.props.exercise||this.props.exercise&&this.props.exercise.is_md?
Date: Thu, 26 Mar 2020 20:13:38 +0800
Subject: [PATCH 13/14] =?UTF-8?q?=E5=8F=91=E9=80=81=E9=A2=98=E5=BA=93?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/react/src/AppConfig.js | 2 +-
.../exercise/ExerciseReviewAndAnswer.js | 104 +++++++++++++++---
.../courses/exercise/question/multiple.js | 62 +++++++++--
.../courses/exercise/question/single.js | 67 +++++++++--
.../modules/question/component/Contentpart.js | 2 +-
5 files changed, 197 insertions(+), 40 deletions(-)
diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js
index c630abf7e..df3ad315b 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/modules/courses/exercise/ExerciseReviewAndAnswer.js b/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js
index 337a9b7e9..9f60b3481 100644
--- a/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js
+++ b/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js
@@ -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
+ }
`}
- {/**/}
+ {url?
+ this.handleClose()}>
+ :
+ ""
+ }
0 &&
实训题 {exercise_types.q_shixuns} 题,共 {exercise_types && exercise_types.q_shixuns_scores} 分
}
+ {
+ exercise_types && exercise_types.q_pros > 0 &&
+ 编程题 {exercise_types.q_pros} 题,共 {exercise_types && exercise_types.q_pros_scores} 分
+ }
共 {exercise_types &&exercise_types.q_scores} 分
合计 {exercise_types &&exercise_types.q_counts} 题:
@@ -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(
@@ -869,9 +922,19 @@ class ExerciseReviewAndAnswer extends Component{
{/* */}
-
+ {
+ is_md===true?
+
+ :
+
+ }
+
{
// 选择题和判断题共用
@@ -879,12 +942,14 @@ class ExerciseReviewAndAnswer extends Component{
this.changeOption(index,ids)}
changeQuestionStatus={(No,flag)=>this.changeQuestionStatus(No,flag)}
index={key}
+ handleShowUploadImage={(u)=>this.handleShowUploadImage(u)}
>
}
{
@@ -893,13 +958,14 @@ class ExerciseReviewAndAnswer extends Component{
this.changeOption(index,ids)}
changeQuestionStatus={(No,flag)=>this.changeQuestionStatus(No,flag)}
index={key}
-
+ handleShowUploadImage={(u)=>this.handleShowUploadImage(u)}
>
}
{
@@ -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)}
>
}
{
@@ -922,13 +989,15 @@ class ExerciseReviewAndAnswer extends Component{
this.changeQuestionStatus(No,flag)}
changeA_flag={(index,status)=>this.changeA_flag(index,status)}
index={key}
- >
+ handleShowUploadImage={(u)=>this.handleShowUploadImage(u)}
+ >
}
{
// 实训题
@@ -936,12 +1005,13 @@ class ExerciseReviewAndAnswer extends Component{
this.handleShowUploadImage(u)}
>
}
diff --git a/public/react/src/modules/courses/exercise/question/multiple.js b/public/react/src/modules/courses/exercise/question/multiple.js
index 2e1023faa..f5ba1f864 100644
--- a/public/react/src/modules/courses/exercise/question/multiple.js
+++ b/public/react/src/modules/courses/exercise/question/multiple.js
@@ -1,6 +1,7 @@
import React,{ Component } from "react";
import {Checkbox,Radio, Input} from "antd";
import {markdownToHTML, MarkdownToHtml} from 'educoder'
+import QuillForEditor from "../../../../common/quillForEditor";
import axios from 'axios'
const tagArray = [
@@ -33,29 +34,70 @@ class Multiple extends Component{
console.log(error);
})
}
-
+
render(){
- let {
- questionType ,
+ let {
+ questionType ,
exercise,
- user_exercise_status
+ user_exercise_status,
+ is_md
}=this.props
let isStudent =this.props.isStudent();
console.log(questionType);
return(
+
{
questionType.question_choices && questionType.question_choices.map((item,key)=>{
let prefix = `${tagArray[key]}.`
+ let titename="";
+ if(is_md===true){
+ titename=item.choice_text;
+ }else{
+ try {
+ titename = JSON.parse(item.choice_text);
+ }catch (e) {
+ titename={"ops":[{"insert":item.choice_text}]};
+ }
+ // JSON.parse 有些异常数据是undefined
+ if(titename===undefined){
+ titename={"ops":[{"insert":item.choice_text}]};
+ }
+ try {
+ // JSON.parse 转换的时候如果是数字字符串就转成整数了
+ if(titename>=0){
+ titename={"ops":[{"insert":item.choice_text}]};
+ }
+ }catch (e) {
+ }
+ }
return(
-
+
{prefix}
-
+ {
+ is_md?
+
+ :
+
+
+ }
)
@@ -64,7 +106,7 @@ class Multiple extends Component{
{
// 答案公开,且试卷已经截止
- isStudent && exercise && exercise.answer_open==true && exercise.exercise_status == 3 &&
+ isStudent && exercise && exercise.answer_open==true && exercise.exercise_status == 3 &&
参考答案:
{questionType.standard_answer.map((i,k)=>{
return(
@@ -78,4 +120,4 @@ class Multiple extends Component{
)
}
}
-export default Multiple
\ No newline at end of file
+export default Multiple
diff --git a/public/react/src/modules/courses/exercise/question/single.js b/public/react/src/modules/courses/exercise/question/single.js
index e739b8f1c..e33aa9e4b 100644
--- a/public/react/src/modules/courses/exercise/question/single.js
+++ b/public/react/src/modules/courses/exercise/question/single.js
@@ -1,5 +1,6 @@
import React,{ Component } from "react";
import {Checkbox,Radio, Input} from "antd";
+import QuillForEditor from "../../../../common/quillForEditor";
import {markdownToHTML, MarkdownToHtml} from 'educoder'
import axios from 'axios'
@@ -30,36 +31,80 @@ class single extends Component{
})
}
render(){
- let {
- questionType ,
+ let {
+ questionType ,
exercise,
- user_exercise_status
+ user_exercise_status,
+ is_md
}=this.props
-
+
let isStudent =this.props.isStudent();
let isJudge = questionType.question_type == 2
return(
+
{
questionType.question_choices && questionType.question_choices.map((item,key)=>{
let prefix = isJudge ? undefined : `${tagArray[key]}.`
+
+ let titename="";
+ if(is_md===true){
+ titename=item.choice_text;
+ }else{
+ try {
+ titename = JSON.parse(item.choice_text);
+ }catch (e) {
+ titename={"ops":[{"insert":item.choice_text}]};
+ }
+ // JSON.parse 有些异常数据是undefined
+ if(titename===undefined){
+ titename={"ops":[{"insert":item.choice_text}]};
+ }
+ try {
+ // JSON.parse 转换的时候如果是数字字符串就转成整数了
+ if(titename>=0){
+ titename={"ops":[{"insert":item.choice_text}]};
+ }
+ }catch (e) {
+
+ }
+ }
return(
-
+
{prefix}
-
+ {
+ is_md?
+
+ :
+
+
+ }
+
)
})
}
- {
+ {
// 答案公开,且试卷已经截止
- isStudent && exercise && exercise.answer_open==true && (exercise.exercise_status == 3 || user_exercise_status == 1) &&
+ isStudent && exercise && exercise.answer_open==true && (exercise.exercise_status == 3 || user_exercise_status == 1) &&
参考答案:
{questionType.standard_answer.map((i,k)=>{
return(
@@ -73,4 +118,4 @@ class single extends Component{
)
}
}
-export default single
\ No newline at end of file
+export default single
diff --git a/public/react/src/modules/question/component/Contentpart.js b/public/react/src/modules/question/component/Contentpart.js
index 5cafe5937..06d563a55 100644
--- a/public/react/src/modules/question/component/Contentpart.js
+++ b/public/react/src/modules/question/component/Contentpart.js
@@ -18,7 +18,7 @@ import LoadingSpin from '../../../common/LoadingSpin';
import Contentquestionbank from "./Contentquestionbank";
import Listjihe from "./Listjihe";
import Certifiedprofessional from "../../modals/Certifiedprofessional";
-import QuestionModalPicture from '../component/QuestionModalPicture.js'
+import QuestionModalPicture from '../component/QuestionModalPicture'
const { TabPane } = Tabs;
const Search = Input.Search;
class Contentpart extends Component {
From 0696fd34e28bb68bf8589fde84b23025f75e1c7a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Thu, 26 Mar 2020 21:08:22 +0800
Subject: [PATCH 14/14] =?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/App.js | 2 +-
public/react/src/common/TextUtil.js | 77 ++++++++++---------
.../courses/exercise/new/ShixunProgramming.js | 2 +-
3 files changed, 43 insertions(+), 38 deletions(-)
diff --git a/public/react/src/App.js b/public/react/src/App.js
index 7fc302e9f..512f60e21 100644
--- a/public/react/src/App.js
+++ b/public/react/src/App.js
@@ -439,7 +439,7 @@ class App extends Component {
window.addEventListener('error', (event) => {
const msg = `${event.type}: ${event.message}`;
- console.log(msg)
+ // console.log(msg)
});
}
//修改登录方法
diff --git a/public/react/src/common/TextUtil.js b/public/react/src/common/TextUtil.js
index 4c445dcbf..8360881e9 100644
--- a/public/react/src/common/TextUtil.js
+++ b/public/react/src/common/TextUtil.js
@@ -6,39 +6,44 @@ export function isImageExtension(fileName) {
}
export function markdownToHTML(oldContent, selector) {
- window.$('#md_div').html('')
- // markdown to html
- if (selector && oldContent && oldContent.startsWith('
{
if (item.name.indexOf(uploadNameSizeSeperator) == -1) {
return Object.assign({}, item, {name: `${item.name}${uploadNameSizeSeperator}${bytesToSize(item.size)}`})
- }
+ }
return item
- })
+ })
}
export const uploadNameSizeSeperator = ' '
-export const sortDirections = ["ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend",
- "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend",
- "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend",
+export const sortDirections = ["ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend",
+ "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend",
+ "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend",
"ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", ]
\ No newline at end of file
diff --git a/public/react/src/modules/courses/exercise/new/ShixunProgramming.js b/public/react/src/modules/courses/exercise/new/ShixunProgramming.js
index 80c966267..dbc9b6a6a 100644
--- a/public/react/src/modules/courses/exercise/new/ShixunProgramming.js
+++ b/public/react/src/modules/courses/exercise/new/ShixunProgramming.js
@@ -43,7 +43,7 @@ class ShixunProgramming extends Component{
>实训详情
}
>
-
+
{description&&
!this.props.exercise||this.props.exercise&&this.props.exercise.is_md?