From eada0a6f795027cd8ae38e2db440948f404fb9ff Mon Sep 17 00:00:00 2001 From: tangjiang <465264938@qq.com> Date: Mon, 30 Dec 2019 09:21:01 +0800 Subject: [PATCH 01/29] update edit page --- public/react/src/constants/index.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/public/react/src/constants/index.js b/public/react/src/constants/index.js index 3e7aceab0..c0e6074fc 100644 --- a/public/react/src/constants/index.js +++ b/public/react/src/constants/index.js @@ -3,8 +3,8 @@ * @Author: tangjiang * @Github: * @Date: 2019-11-20 23:10:48 - * @LastEditors: tangjiang - * @LastEditTime: 2019-12-06 15:53:27 + * @LastEditors : tangjiang + * @LastEditTime : 2019-12-30 09:19:52 */ const CONST = { jcLabel: { @@ -12,9 +12,10 @@ const CONST = { language: '编程语言', description: '描述', difficult: '难易度', - category: '分类', + category: '课程', openOrNot: '公开程序', - timeLimit: '时间限制' + timeLimit: '时间限制', + // knowledge: '知识点' }, fontSetting: { title: '代码格式', From bbc079b7036e61483a1c3f5c3018f7efd869c515 Mon Sep 17 00:00:00 2001 From: tangjiang <465264938@qq.com> Date: Mon, 30 Dec 2019 11:09:01 +0800 Subject: [PATCH 02/29] add course question --- .../newOrEditTask/leftpane/editorTab/index.js | 92 +++++++++++++++++-- .../modules/developer/split_pane_resizer.scss | 4 + public/react/src/redux/actions/actionTypes.js | 2 + public/react/src/redux/actions/index.js | 3 + public/react/src/redux/actions/ojForm.js | 23 ++++- .../react/src/redux/reducers/ojFormReducer.js | 8 +- public/react/src/services/ojService.js | 8 +- 7 files changed, 127 insertions(+), 13 deletions(-) diff --git a/public/react/src/modules/developer/newOrEditTask/leftpane/editorTab/index.js b/public/react/src/modules/developer/newOrEditTask/leftpane/editorTab/index.js index d4fc12b9c..8172a7778 100644 --- a/public/react/src/modules/developer/newOrEditTask/leftpane/editorTab/index.js +++ b/public/react/src/modules/developer/newOrEditTask/leftpane/editorTab/index.js @@ -4,12 +4,12 @@ * @Github: * @Date: 2019-11-20 10:35:40 * @LastEditors : tangjiang - * @LastEditTime : 2019-12-27 14:30:55 + * @LastEditTime : 2019-12-30 11:05:14 */ import './index.scss'; // import 'katex/dist/katex.css'; import React from 'react'; -import { Form, Input, Select, InputNumber, Button } from 'antd'; +import { Form, Input, Select, InputNumber, Button, Cascader } from 'antd'; import { connect } from 'react-redux'; import AddTestDemo from './AddTestDemo'; // import QuillEditor from '../../../quillEditor'; @@ -77,6 +77,10 @@ class EditTab extends React.Component { }, () => { this.state.scrollEl.addEventListener('scroll', this.handleScroll, false); }); + // 获取题库 + this.props.getQuestion({ + source: 'question' + }); } componentWillUnmount () { @@ -127,7 +131,8 @@ class EditTab extends React.Component { } // 改变分类 handleChangeCategory = (value) => { - this.props.validateOjCategory(value); + console.log(value); + // this.props.validateOjCategory(value); } // 改变公开程序 handleChangeOpenOrNot = (value) => { @@ -146,7 +151,8 @@ class EditTab extends React.Component { addTestCase, // 添加测试用例 deleteTestCase, // 删除测试用例 testCasesValidate, - openTestCodeIndex = [] + openTestCodeIndex = [], + courseQuestions } = this.props; // 表单label const myLabel = (name, subTitle) => { @@ -244,6 +250,59 @@ class EditTab extends React.Component { ['image', 'formula'], // 数学公式、图片、视频 ['clean'], // 清除格式 ]; + + const renderCourseQuestion = (arrs) => { + const tempArr = []; + function loop (arrs, tempArr) { + arrs.forEach(item => { + const obj = {}; + obj.value = item.id; + obj.label = item.name; + // 当item下还有子元素时,递归调用 + if (item.sub_disciplines || item.tag_disciplines) { + arrs = item.sub_disciplines || item.tag_disciplines; + obj.children = []; + loop(arrs, obj.children); + } + tempArr.push(obj); + }); + } + loop(arrs, tempArr); + // arrs.forEach(item => { + // const obj = Object.create(null); + // obj.value = item.id; + // obj.label = item.name; + // if (item.sub_disciplines) { + // obj.children = []; + // item.sub_disciplines.forEach(sub => { + // const subObj = Object.create(null); + // subObj.value = sub.id; + // subObj.label = sub.name; + + // if (sub.tag_disciplines) { + // subObj.children = []; + // sub.tag_disciplines.forEach(tag => { + // const tabObj = Object.create(null); + // tabObj.value = tag.id; + // tabObj.label = tag.name; + // subObj.children.push(tabObj); + // }); + // } + // obj.children.push(subObj); + // }) + // } + // tempArr.push(obj); + // }); + console.log(tempArr); + return ( + + ) + } return (
@@ -262,14 +321,24 @@ class EditTab extends React.Component { {myLabel(jcLabel['category'], '合理的分类有利于快速检索')}} + label={{myLabel(jcLabel['category'], '合理的课程分类有利于快速检索')}} validateStatus={ojFormValidate.category.validateStatus} help={ojFormValidate.category.errMsg} colon={ false } > - {getOptions('category')} - + */} + {/* */} + { renderCourseQuestion(courseQuestions)} + + + + { testCases, openTestCodeIndex, testCasesValidate, - ojFormValidate} = ojFormReducer; + ojFormValidate, + courseQuestions + } = ojFormReducer; return { ojForm, testCases, testCasesValidate, ojFormValidate, position, - openTestCodeIndex + openTestCodeIndex, + courseQuestions }; }; @@ -390,6 +462,8 @@ const mapDispatchToProps = (dispatch) => ({ addTestCase: (value) => dispatch(actions.addTestCase(value)), // 删除测试用例 deleteTestCase: (value) => dispatch(actions.deleteTestCase(value)), + // 获取题库 + getQuestion: (params) => dispatch(actions.getQuestion(params)) }); export default connect( diff --git a/public/react/src/modules/developer/split_pane_resizer.scss b/public/react/src/modules/developer/split_pane_resizer.scss index 8fc8b525f..26fc21479 100644 --- a/public/react/src/modules/developer/split_pane_resizer.scss +++ b/public/react/src/modules/developer/split_pane_resizer.scss @@ -23,6 +23,8 @@ } .header_title{ + font-size: 16px; + font-weight: bold; text-align: center; } @@ -82,6 +84,8 @@ bottom: 0; top: 0; text-align: center; + font-size: 16px; + font-weight: bold; } } } diff --git a/public/react/src/redux/actions/actionTypes.js b/public/react/src/redux/actions/actionTypes.js index 73e3ea0b2..e3ae7044b 100644 --- a/public/react/src/redux/actions/actionTypes.js +++ b/public/react/src/redux/actions/actionTypes.js @@ -32,6 +32,8 @@ const types = { TEST_CASE_INPUT_CHANGE: 'TEST_CASE_INPUT_CHANGE', // 测试用例输入值改变时 TEST_CASE_OUTPUT_CHANGE: 'TEST_CASE_OUTPUT_CHANGE', // 测试用例输出值改变时 DEBUGGER_CODE: 'DEBUGGER_CODE', // 调试代码 + GET_COURSE_QUESTION: 'GET_COURSE_QUESTION', // 获取编辑题 + // study SAVE_USER_PROGRAM_ID: 'SAVE_USER_PROGRAM_ID',// 保存用户编程题id值 USER_PROGRAM_DETAIL: 'USER_PROGRAM_DETAIL', // 用户编程题详情 SHOW_OR_HIDE_CONTROL: 'SHOW_OR_HIDE_CONTROL', // 显示或隐藏控制台 diff --git a/public/react/src/redux/actions/index.js b/public/react/src/redux/actions/index.js index 988a0a469..263e367df 100644 --- a/public/react/src/redux/actions/index.js +++ b/public/react/src/redux/actions/index.js @@ -32,6 +32,7 @@ import { updateTestAndValidate, updateOpenTestCaseIndex, handleClickCancelPublish, + getQuestion } from './ojForm'; import { @@ -110,6 +111,8 @@ export default { validateOjCategory, validateOpenOrNot, handleClickCancelPublish, + getQuestion, + // addTestCase, deleteTestCase, testCaseInputChange, diff --git a/public/react/src/redux/actions/ojForm.js b/public/react/src/redux/actions/ojForm.js index 118295802..401c4f203 100644 --- a/public/react/src/redux/actions/ojForm.js +++ b/public/react/src/redux/actions/ojForm.js @@ -4,7 +4,7 @@ * @Github: * @Date: 2019-11-20 16:35:46 * @LastEditors : tangjiang - * @LastEditTime : 2019-12-27 22:19:15 + * @LastEditTime : 2019-12-30 09:56:39 */ import types from './actionTypes'; import CONST from '../../constants'; @@ -12,7 +12,8 @@ import { fetchPostOjForm, fetchGetOjById, publishTask, - cancelPublicTask + cancelPublicTask, + fetchQuestion } from '../../services/ojService'; import { Base64 } from 'js-base64'; import { notification } from 'antd'; @@ -644,3 +645,21 @@ export const updateOpenTestCaseIndex = (value) => { payload: value } } + +// 获取课程题库 +export const getQuestion = (params) => { + // return { + // type: types.GET_COURSE_QUESTION, + // } + return (dispatch) => { + fetchQuestion(params).then(res => { + const { data = {} } = res; + const { disciplines = [] } = data; + console.log('获取课程题库成功: ', res); + dispatch({ + type: types.GET_COURSE_QUESTION, + payload: disciplines + }) + }) + } +} diff --git a/public/react/src/redux/reducers/ojFormReducer.js b/public/react/src/redux/reducers/ojFormReducer.js index 952919aca..5beba6653 100644 --- a/public/react/src/redux/reducers/ojFormReducer.js +++ b/public/react/src/redux/reducers/ojFormReducer.js @@ -4,7 +4,7 @@ * @Github: * @Date: 2019-11-20 16:40:32 * @LastEditors : tangjiang - * @LastEditTime : 2019-12-27 20:00:26 + * @LastEditTime : 2019-12-30 09:55:37 */ import { Base64 } from 'js-base64'; import types from '../actions/actionTypes'; @@ -67,6 +67,7 @@ const init = { testCodeStatus: 'default', // 调试代码状态 default(默认值) | loading(加载中) | loaded(加载完成) | userCase(用户自定义测试用例) | finish(测试完成) openTestCodeIndex: [0], // 展开的测试用例: 数组, 当出错时,展开所有出错的测试用例, 默认展开第一个 isPublish: 0, // 是否是发布状态: 0 未发布 1 已发布 + courseQuestions: [], // 课程题库 } const tcValidateObj = { @@ -306,6 +307,11 @@ const ojFormReducer = (state = initialState, action) => { ...state, openTestCodeIndex: tempArr } + case types.GET_COURSE_QUESTION: + return { + ...state, + courseQuestions: action.payload + } default: return state; } diff --git a/public/react/src/services/ojService.js b/public/react/src/services/ojService.js index 04fde2224..59151e687 100644 --- a/public/react/src/services/ojService.js +++ b/public/react/src/services/ojService.js @@ -4,7 +4,7 @@ * @Github: * @Date: 2019-11-20 10:55:38 * @LastEditors : tangjiang - * @LastEditTime : 2019-12-27 11:06:27 + * @LastEditTime : 2019-12-30 09:44:56 */ import axios from 'axios'; @@ -142,4 +142,10 @@ export async function fetchUploadImageUrl (id) { export async function fetchAddNotes (identifier, params) { const url = `/myproblems/${identifier}/add_notes.json`; return axios.post(url, params); +} + +// 获取课程体系 +export async function fetchQuestion (params) { + const url = `/disciplines.json`; + return axios.get(url, { params }); } \ No newline at end of file From 1075b49f6acc0a27accc16bbeae3fd1e9b60ab58 Mon Sep 17 00:00:00 2001 From: tangjiang <465264938@qq.com> Date: Mon, 30 Dec 2019 14:23:40 +0800 Subject: [PATCH 03/29] add selector --- .../developer/components/knowledge/index.js | 47 +++++++++++++++++++ .../developer/components/knowledge/index.scss | 0 2 files changed, 47 insertions(+) create mode 100644 public/react/src/modules/developer/components/knowledge/index.js create mode 100644 public/react/src/modules/developer/components/knowledge/index.scss diff --git a/public/react/src/modules/developer/components/knowledge/index.js b/public/react/src/modules/developer/components/knowledge/index.js new file mode 100644 index 000000000..b4328376d --- /dev/null +++ b/public/react/src/modules/developer/components/knowledge/index.js @@ -0,0 +1,47 @@ +/* + * @Description: 知识点 + * @Author: tangjiang + * @Github: + * @Date: 2019-12-30 13:51:19 + * @LastEditors : tangjiang + * @LastEditTime : 2019-12-30 14:20:50 + */ +import './index.scss'; +import React, { useState } from 'react'; +import { Select } from 'antd'; + +function KnowLedge (props) { + + const { + options = [], // 下拉选项 + values = [], // 已选择的下拉项 + } = props; + + // 显示的下拉项 + const [selectOptions, setSelectOptions] = useState(options); + // 已选择的下拉项 + const [selectValue, setSelectValue] = useState(values); + + // 渲染下拉选项 + // 渲染下拉列表 + const renderSelect = (options, values) => { + return ( + + ) + } + + return ( +
+ { renderSelect(selectOptions, selectValue) } +
+ +
+
+ ); +} + +export default KnowLedge; diff --git a/public/react/src/modules/developer/components/knowledge/index.scss b/public/react/src/modules/developer/components/knowledge/index.scss new file mode 100644 index 000000000..e69de29bb From 9a97db2893bfbc6c35c7cc9d0660ba0f023af0fe Mon Sep 17 00:00:00 2001 From: tangjiang <465264938@qq.com> Date: Mon, 30 Dec 2019 14:31:13 +0800 Subject: [PATCH 04/29] add selector --- .../modules/developer/components/knowledge/index.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/developer/components/knowledge/index.js b/public/react/src/modules/developer/components/knowledge/index.js index b4328376d..81e9f770a 100644 --- a/public/react/src/modules/developer/components/knowledge/index.js +++ b/public/react/src/modules/developer/components/knowledge/index.js @@ -4,7 +4,7 @@ * @Github: * @Date: 2019-12-30 13:51:19 * @LastEditors : tangjiang - * @LastEditTime : 2019-12-30 14:20:50 + * @LastEditTime : 2019-12-30 14:28:17 */ import './index.scss'; import React, { useState } from 'react'; @@ -23,13 +23,22 @@ function KnowLedge (props) { const [selectValue, setSelectValue] = useState(values); // 渲染下拉选项 + const renderOptions = () => { + + } + const handleSelectChange = (value) => { + console.log(value); + } + // 渲染下拉列表 const renderSelect = (options, values) => { return ( ) } From 8ac904a82d24f640b7f39e211556ad3fd5f7b785 Mon Sep 17 00:00:00 2001 From: tangjiang <465264938@qq.com> Date: Mon, 30 Dec 2019 16:58:10 +0800 Subject: [PATCH 05/29] add selector --- public/react/src/constants/index.js | 4 +- .../developer/components/knowledge/index.js | 14 +++++-- .../newOrEditTask/leftpane/editorTab/index.js | 41 ++++++++++++++----- 3 files changed, 44 insertions(+), 15 deletions(-) diff --git a/public/react/src/constants/index.js b/public/react/src/constants/index.js index c0e6074fc..623cff362 100644 --- a/public/react/src/constants/index.js +++ b/public/react/src/constants/index.js @@ -4,7 +4,7 @@ * @Github: * @Date: 2019-11-20 23:10:48 * @LastEditors : tangjiang - * @LastEditTime : 2019-12-30 09:19:52 + * @LastEditTime : 2019-12-30 14:44:45 */ const CONST = { jcLabel: { @@ -15,7 +15,7 @@ const CONST = { category: '课程', openOrNot: '公开程序', timeLimit: '时间限制', - // knowledge: '知识点' + knowledge: '知识点' }, fontSetting: { title: '代码格式', diff --git a/public/react/src/modules/developer/components/knowledge/index.js b/public/react/src/modules/developer/components/knowledge/index.js index 81e9f770a..63d99b762 100644 --- a/public/react/src/modules/developer/components/knowledge/index.js +++ b/public/react/src/modules/developer/components/knowledge/index.js @@ -4,12 +4,14 @@ * @Github: * @Date: 2019-12-30 13:51:19 * @LastEditors : tangjiang - * @LastEditTime : 2019-12-30 14:28:17 + * @LastEditTime : 2019-12-30 16:54:30 */ import './index.scss'; import React, { useState } from 'react'; import { Select } from 'antd'; +const { Option } = Select; + function KnowLedge (props) { const { @@ -23,8 +25,11 @@ function KnowLedge (props) { const [selectValue, setSelectValue] = useState(values); // 渲染下拉选项 - const renderOptions = () => { - + const renderOptions = (options = []) => { + console.log('下拉选择: ', options); + return options.map((opt, i) => ( + + )); } const handleSelectChange = (value) => { console.log(value); @@ -34,9 +39,12 @@ function KnowLedge (props) { const renderSelect = (options, values) => { return ( diff --git a/public/react/src/modules/developer/newOrEditTask/leftpane/editorTab/index.js b/public/react/src/modules/developer/newOrEditTask/leftpane/editorTab/index.js index 8172a7778..4672a3be7 100644 --- a/public/react/src/modules/developer/newOrEditTask/leftpane/editorTab/index.js +++ b/public/react/src/modules/developer/newOrEditTask/leftpane/editorTab/index.js @@ -4,7 +4,7 @@ * @Github: * @Date: 2019-11-20 10:35:40 * @LastEditors : tangjiang - * @LastEditTime : 2019-12-30 11:05:14 + * @LastEditTime : 2019-12-30 16:42:36 */ import './index.scss'; // import 'katex/dist/katex.css'; @@ -18,6 +18,7 @@ import CONST from '../../../../../constants'; import { toStore } from 'educoder'; // 保存和读取store值 // import Wrapper from '../../../../../common/reactQuill'; import QuillForEditor from '../../../../../common/quillForEditor'; +import KnowLedge from '../../../components/knowledge'; const scrollIntoView = require('scroll-into-view'); const {jcLabel} = CONST; const FormItem = Form.Item; @@ -59,7 +60,8 @@ class EditTab extends React.Component { scrollHeight: 0, // 滚动元素的高度 top: 500, bottom: 20, - offsetTop: 0 + offsetTop: 0, + knowledges: ['HTML', 'CSS', 'JS', 'REACT'] } } @@ -131,8 +133,21 @@ class EditTab extends React.Component { } // 改变分类 handleChangeCategory = (value) => { - console.log(value); - // this.props.validateOjCategory(value); + // 课程下拉值变化时, 同步更新知识点 + const { courseQuestions } = this.props; + courseQuestions.forEach(item => { + if (value[0] && item.id === value[0]) { + item.sub_disciplines && item.sub_disciplines.forEach(c => { + if (value[1] && c.id === value[1]) { + // tempArr = c.tag_disciplines || []; + console.log('+++++', c.tag_disciplines); + this.setState({ + knowledges: c.tag_disciplines || [] + }); + } + }); + } + }); } // 改变公开程序 handleChangeOpenOrNot = (value) => { @@ -154,6 +169,7 @@ class EditTab extends React.Component { openTestCodeIndex = [], courseQuestions } = this.props; + const {knowledges} = this.state; // 表单label const myLabel = (name, subTitle) => { if (subTitle) { @@ -259,8 +275,8 @@ class EditTab extends React.Component { obj.value = item.id; obj.label = item.name; // 当item下还有子元素时,递归调用 - if (item.sub_disciplines || item.tag_disciplines) { - arrs = item.sub_disciplines || item.tag_disciplines; + if (item.sub_disciplines) { + arrs = item.sub_disciplines; obj.children = []; loop(arrs, obj.children); } @@ -297,7 +313,6 @@ class EditTab extends React.Component { return ( @@ -337,10 +352,16 @@ class EditTab extends React.Component { { renderCourseQuestion(courseQuestions)}
- - + {myLabel(jcLabel['knowledge'])}} + > + - + {myLabel(jcLabel['timeLimit'], '程序允许时间限制时长,单位:秒')}} From f7f4c413719265b125a0bd78f678384f1a954dcd Mon Sep 17 00:00:00 2001 From: tangjiang <465264938@qq.com> Date: Mon, 30 Dec 2019 18:28:27 +0800 Subject: [PATCH 06/29] add selector --- .../src/modules/developer/components/knowledge/index.js | 9 +++------ .../modules/developer/components/knowledge/index.scss | 5 +++++ .../developer/newOrEditTask/leftpane/editorTab/index.js | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/public/react/src/modules/developer/components/knowledge/index.js b/public/react/src/modules/developer/components/knowledge/index.js index 63d99b762..17cf11624 100644 --- a/public/react/src/modules/developer/components/knowledge/index.js +++ b/public/react/src/modules/developer/components/knowledge/index.js @@ -4,7 +4,7 @@ * @Github: * @Date: 2019-12-30 13:51:19 * @LastEditors : tangjiang - * @LastEditTime : 2019-12-30 16:54:30 + * @LastEditTime : 2019-12-30 18:02:20 */ import './index.scss'; import React, { useState } from 'react'; @@ -33,6 +33,8 @@ function KnowLedge (props) { } const handleSelectChange = (value) => { console.log(value); + const _result = selectOptions.filter(item => item !== value); + setSelectOptions(_result); } // 渲染下拉列表 @@ -43,8 +45,6 @@ function KnowLedge (props) { placeholder="请选择" style={{ width: '100%' }} onChange={handleSelectChange} - autoClearSearchValue={true} - maxTagCount={0} > {renderOptions(options)} @@ -54,9 +54,6 @@ function KnowLedge (props) { return (
{ renderSelect(selectOptions, selectValue) } -
- -
); } diff --git a/public/react/src/modules/developer/components/knowledge/index.scss b/public/react/src/modules/developer/components/knowledge/index.scss index e69de29bb..a38f42c70 100644 --- a/public/react/src/modules/developer/components/knowledge/index.scss +++ b/public/react/src/modules/developer/components/knowledge/index.scss @@ -0,0 +1,5 @@ +.knowledge-select-area{ + .ant-select-selection__rendered{ + margin-bottom: 0 !important; + } +} diff --git a/public/react/src/modules/developer/newOrEditTask/leftpane/editorTab/index.js b/public/react/src/modules/developer/newOrEditTask/leftpane/editorTab/index.js index 4672a3be7..4c5d89dce 100644 --- a/public/react/src/modules/developer/newOrEditTask/leftpane/editorTab/index.js +++ b/public/react/src/modules/developer/newOrEditTask/leftpane/editorTab/index.js @@ -4,7 +4,7 @@ * @Github: * @Date: 2019-11-20 10:35:40 * @LastEditors : tangjiang - * @LastEditTime : 2019-12-30 16:42:36 + * @LastEditTime : 2019-12-30 17:53:18 */ import './index.scss'; // import 'katex/dist/katex.css'; From f7fc049d7e51d7523a3cd114fb255db28227eaeb Mon Sep 17 00:00:00 2001 From: tangjiang <465264938@qq.com> Date: Mon, 30 Dec 2019 19:30:56 +0800 Subject: [PATCH 07/29] add --- public/react/src/AppConfig.js | 13 +++++++------ .../modules/developer/components/knowledge/index.js | 12 ++++++++---- .../developer/components/knowledge/index.scss | 4 ++++ .../newOrEditTask/leftpane/editorTab/index.js | 2 +- 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index 859b5f579..4e91938c8 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -63,11 +63,11 @@ export function initAxiosInterceptors(props) { const requestMap = {}; window.railsgettimes = function(proxy) { - $.ajax({url:`${proxy}/api/main/first_stamp.json`,async:false,success:function(data,status){ - if(data.status===0){ - return data.message; - } - }}); + // $.ajax({url:`${proxy}/api/main/first_stamp.json`,async:false,success:function(data,status){ + // if(data.status===0){ + // return data.message; + // } + // }}); } window.setfalseInRequestMap = function(keyName) { @@ -101,8 +101,9 @@ export function initAxiosInterceptors(props) { } } if(`${config[0]}`!=`true`){ + let timestamp = Date.parse(new Date())/1000; if (window.location.port === "3007") { - let timestamp=railsgettimes(proxy); + // let timestamp=railsgettimes(proxy); console.log(timestamp) let newopens=md5(opens+timestamp) config.url = `${proxy}${url}`; diff --git a/public/react/src/modules/developer/components/knowledge/index.js b/public/react/src/modules/developer/components/knowledge/index.js index 17cf11624..5677d3630 100644 --- a/public/react/src/modules/developer/components/knowledge/index.js +++ b/public/react/src/modules/developer/components/knowledge/index.js @@ -4,7 +4,7 @@ * @Github: * @Date: 2019-12-30 13:51:19 * @LastEditors : tangjiang - * @LastEditTime : 2019-12-30 18:02:20 + * @LastEditTime : 2019-12-30 19:21:56 */ import './index.scss'; import React, { useState } from 'react'; @@ -23,6 +23,8 @@ function KnowLedge (props) { const [selectOptions, setSelectOptions] = useState(options); // 已选择的下拉项 const [selectValue, setSelectValue] = useState(values); + // + const [value] = useState([]); // 渲染下拉选项 const renderOptions = (options = []) => { @@ -32,8 +34,9 @@ function KnowLedge (props) { )); } const handleSelectChange = (value) => { - console.log(value); - const _result = selectOptions.filter(item => item !== value); + console.log('过滤结果Start=====》》》》》', selectOptions, value); + const _result = selectOptions.filter(item => item !== value.join('')); + console.log('过滤结果=====》》》》》', _result, selectOptions); setSelectOptions(_result); } @@ -41,7 +44,8 @@ function KnowLedge (props) { const renderSelect = (options, values) => { return ( { if (value[1] && c.id === value[1]) { - // tempArr = c.tag_disciplines || []; - console.log('+++++', c.tag_disciplines); this.setState({ - knowledges: c.tag_disciplines || [] + knowledges: [...c.tag_disciplines] + }); + } else { + this.setState({ + knowledges: [] }); } }); + } else { + this.setState({ + knowledges: [] + }); } }); } From a2e80d190ca8c310ff12aae3af942309592f542a Mon Sep 17 00:00:00 2001 From: tangjiang <465264938@qq.com> Date: Mon, 30 Dec 2019 20:47:08 +0800 Subject: [PATCH 11/29] add --- .../developer/components/knowledge/index.js | 33 +++++++++++++------ .../newOrEditTask/leftpane/editorTab/index.js | 11 +++---- 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/public/react/src/modules/developer/components/knowledge/index.js b/public/react/src/modules/developer/components/knowledge/index.js index 36060e8e8..5d21b1420 100644 --- a/public/react/src/modules/developer/components/knowledge/index.js +++ b/public/react/src/modules/developer/components/knowledge/index.js @@ -4,7 +4,7 @@ * @Github: * @Date: 2019-12-30 13:51:19 * @LastEditors : tangjiang - * @LastEditTime : 2019-12-30 20:08:09 + * @LastEditTime : 2019-12-30 20:44:38 */ import './index.scss'; import React, { useState, useEffect } from 'react'; @@ -32,26 +32,35 @@ function KnowLedge (props) { // 渲染下拉选项 const renderOptions = (options = []) => { - console.log('下拉选择: ', options); return options.map((opt, i) => ( )); } + // 过滤下拉列表项 const handleSelectChange = (value) => { - console.log('过滤结果Start=====》》》》》', selectOptions, value); + value = +value.join(''); + const tempArr = [...selectValue]; const _result = selectOptions.filter(item => { - if (item === value) { - + if (item.id === value && tempArr.findIndex(t => t.id === value) === -1) { + tempArr.push(item); } - return item !== value; + return item.id !== value; }); - console.log('过滤结果=====》》》》》', _result, selectOptions); + console.log(tempArr) + setSelectValue(tempArr); setSelectOptions(_result); } + // 渲染下拉结果 + const renderResult = (arrs) => { + return arrs.map(item => ( +
+ +
+ )); + } // 渲染下拉列表 - const renderSelect = (options, values) => { - console.log('==========>>>>>>>>', options); + const renderSelect = (options) => { return ( { getUserInfoForNew, handleCancelPublish, validateOjForm, + getQuestion // updateTestAndValidate, } = props; @@ -53,6 +54,10 @@ const NewOrEditTask = (props) => { useEffect(() => { // 获取用户信息 getUserInfoForNew(); + // 获取课程列表 + getQuestion({ + source: 'question' + }); // console.log('获取路由参数: ====', props.match.params); const id = props.match.params.id; // 保存OJForm的id号,指明是编辑还是新增 @@ -273,7 +278,8 @@ const mapDispatchToProps = (dispatch) => ({ startProgramQuestion: (id, props) => dispatch(actions.startProgramQuestion(id, props)), // 新建时获取信息 getUserInfoForNew: () => dispatch(actions.getUserInfoForNew()), - validateOjForm: (props, type, cb) => dispatch(actions.validateOjForm(props, type, cb)) + validateOjForm: (props, type, cb) => dispatch(actions.validateOjForm(props, type, cb)), + getQuestion: (params) => dispatch(actions.getQuestion(params)) }); export default withRouter(connect( diff --git a/public/react/src/modules/developer/newOrEditTask/leftpane/editorTab/index.js b/public/react/src/modules/developer/newOrEditTask/leftpane/editorTab/index.js index be692ef59..578f4a94e 100644 --- a/public/react/src/modules/developer/newOrEditTask/leftpane/editorTab/index.js +++ b/public/react/src/modules/developer/newOrEditTask/leftpane/editorTab/index.js @@ -4,7 +4,7 @@ * @Github: * @Date: 2019-11-20 10:35:40 * @LastEditors : tangjiang - * @LastEditTime : 2019-12-31 15:17:08 + * @LastEditTime : 2020-01-02 17:42:04 */ import './index.scss'; // import 'katex/dist/katex.css'; @@ -61,7 +61,8 @@ class EditTab extends React.Component { top: 500, bottom: 20, offsetTop: 0, - knowledges: [] + // knowledges: [], + // coursers: [] // 选中的课程 } } @@ -80,12 +81,16 @@ class EditTab extends React.Component { this.state.scrollEl.addEventListener('scroll', this.handleScroll, false); }); // 获取题库 - this.props.getQuestion({ - source: 'question' - }); + // this.props.getQuestion({ + // source: 'question' + // }); } - componentWillUnmount () { + // componentDidUpdate (nextProp) { + // console.log(nextProp); + // } + + componentWillUnmount (nextPro) { this.state.scrollEl.removeEventListener('scroll', this.handleScroll, false); } @@ -131,30 +136,25 @@ class EditTab extends React.Component { handleTimeLimitChange = (value) => { this.props.validateOjTimeLimit(value); } - // 改变分类 - handleChangeCategory = (value) => { + // 改变方向 + handleChangeSubDisciplineId = (value) => { // 课程下拉值变化时, 同步更新知识点 - const { courseQuestions } = this.props; - this.setState({ - knowledges: [] - }); + const { courseQuestions, saveKnowledge } = this.props; + saveKnowledge([]); // 获取当前分类下的知识点 courseQuestions.forEach(item => { if (value[0] && item.id === value[0]) { item.sub_disciplines && item.sub_disciplines.forEach(c => { if (value[1] && c.id === value[1]) { - this.setState({ - knowledges: [...c.tag_disciplines] - }); + saveKnowledge(...c.tag_disciplines) } else if (!value[1]) { - this.setState({ - knowledges: [] - }); + saveKnowledge([]); } }); } }); - this.props.validateOjCategory(value[1] || ''); + // this.props.validateOjCategory(value[1] || ''); + this.props.validateOjSubDisciplineId(value[1] || ''); } // 改变公开程序 handleChangeOpenOrNot = (value) => { @@ -174,9 +174,12 @@ class EditTab extends React.Component { deleteTestCase, // 删除测试用例 testCasesValidate, openTestCodeIndex = [], - courseQuestions + courseQuestions, + tag_discipline_id, + knowledges } = this.props; - const {knowledges} = this.state; + console.log('+++++++++', knowledges); + // const {knowledges} = this.state; // 表单label const myLabel = (name, subTitle, nostar) => { if (subTitle) { @@ -285,6 +288,7 @@ class EditTab extends React.Component { const renderCourseQuestion = (arrs) => { const tempArr = []; + const sub_id = this.props.ojForm.sub_discipline_id; function loop (arrs, tempArr) { arrs.forEach(item => { const obj = {}; @@ -300,37 +304,30 @@ class EditTab extends React.Component { }); } loop(arrs, tempArr); - // arrs.forEach(item => { - // const obj = Object.create(null); - // obj.value = item.id; - // obj.label = item.name; - // if (item.sub_disciplines) { - // obj.children = []; - // item.sub_disciplines.forEach(sub => { - // const subObj = Object.create(null); - // subObj.value = sub.id; - // subObj.label = sub.name; - - // if (sub.tag_disciplines) { - // subObj.children = []; - // sub.tag_disciplines.forEach(tag => { - // const tabObj = Object.create(null); - // tabObj.value = tag.id; - // tabObj.label = tag.name; - // subObj.children.push(tabObj); - // }); - // } - // obj.children.push(subObj); - // }) - // } - // tempArr.push(obj); - // }); - console.log(tempArr); + + // 获取选中的下拉值 + let choid_ids = []; + // let tempKnowledges = []; + tempArr.forEach(t => { + // debugger; + if (sub_id && t.children) { + t.children.forEach(c => { + if (c.value === sub_id) { + choid_ids = [t.value, c.value]; + // tempKnowledges = c.children || []; + } + }); + } + }); + + console.log(choid_ids); return ( ) } @@ -342,6 +339,8 @@ class EditTab extends React.Component { _result.push(v.id); }); console.log('下拉选择的值:===>>>', _result); + // 保存选择的知识点 + this.props.saveTagDisciplineId(_result); } return ( @@ -361,9 +360,9 @@ class EditTab extends React.Component { {myLabel(jcLabel['category'], '合理的课程分类有利于快速检索')}} - validateStatus={ojFormValidate.category.validateStatus} - help={ojFormValidate.category.errMsg} + label={{myLabel(jcLabel['sub_discipline_id'], '合理的课程分类有利于快速检索')}} + validateStatus={ojFormValidate.sub_discipline_id.validateStatus} + help={ojFormValidate.sub_discipline_id.errMsg} colon={ false } > {/* { if (value[1] && c.id === value[1]) { - saveKnowledge(...c.tag_disciplines) + saveKnowledge(c.tag_disciplines) + console.log(c.tag_disciplines); } else if (!value[1]) { saveKnowledge([]); } @@ -178,7 +179,7 @@ class EditTab extends React.Component { tag_discipline_id, knowledges } = this.props; - console.log('+++++++++', knowledges); + console.log('knowledge======>>>>>>', knowledges); // const {knowledges} = this.state; // 表单label const myLabel = (name, subTitle, nostar) => { From 8ba177142cf8112082f993e7905ad81f9e832053 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, 3 Jan 2020 10:03:11 +0800 Subject: [PATCH 23/29] =?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/tpm/shixunchild/Collaborators/Collaborators.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/tpm/shixunchild/Collaborators/Collaborators.css b/public/react/src/modules/tpm/shixunchild/Collaborators/Collaborators.css index 075a5af0f..a628787e5 100644 --- a/public/react/src/modules/tpm/shixunchild/Collaborators/Collaborators.css +++ b/public/react/src/modules/tpm/shixunchild/Collaborators/Collaborators.css @@ -160,7 +160,7 @@ .newyslusercjz{ display: inline-block; position: absolute; - bottom: 0px; + bottom: 10px; left: -18px; width: 44px; height: 18px; From b64847d7cf1dc6722e4ae8552ad52ec729afc241 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 3 Jan 2020 10:04:13 +0800 Subject: [PATCH 24/29] =?UTF-8?q?git=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admins/customers_controller.rb | 1 + app/controllers/shixuns_controller.rb | 9 +++++++++ app/services/jupyter_service.rb | 3 ++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/controllers/admins/customers_controller.rb b/app/controllers/admins/customers_controller.rb index 80b01757b..1901b5490 100644 --- a/app/controllers/admins/customers_controller.rb +++ b/app/controllers/admins/customers_controller.rb @@ -1,4 +1,5 @@ class Admins::CustomersController < Admins::BaseController + skip_before_action :check_sign helper_method :current_partner def index diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 3de5970b6..b76704c07 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -896,6 +896,15 @@ class ShixunsController < ApplicationController render_ok end + def upload_git_folder + raise("文件夹名不合法") if params[:folder_name] =~ /^[^\\\/\?\*\"\>\<\:\|]*$/ + + end + + def delete_git_file + + end + def add_collaborators member_ids = "(" + @shixun.shixun_members.map(&:user_id).join(',') + ")" user_name = "%#{params[:user_name].to_s.strip}%" diff --git a/app/services/jupyter_service.rb b/app/services/jupyter_service.rb index 2d43a0987..bbe0330bb 100644 --- a/app/services/jupyter_service.rb +++ b/app/services/jupyter_service.rb @@ -8,7 +8,8 @@ module JupyterService uri = "#{shixun_tomcat}/bridge/jupyter/get" tpiID = "tpm#{shixun.id}" mount = shixun.data_sets.present? - params = {tpiID: tpiID, identifier: shixun.identifier, needMount: mount, gitUrl: '', + gitUrl = "#{edu_setting('git_address_domain')}/#{shixun.repo_path}" + params = {tpiID: tpiID, identifier: shixun.identifier, needMount: mount, gitUrl: gitUrl, :containers => "#{Base64.urlsafe_encode64(shixun_container_limit(shixun))}"} logger.info "test_juypter: uri->#{uri}, params->#{params}" From b7a0d1c867572d3512ad673c9ebd4d5540f55c7f Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 3 Jan 2020 10:23:54 +0800 Subject: [PATCH 25/29] 1 --- app/controllers/shixuns_controller.rb | 8 ++++---- config/routes.rb | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index b76704c07..e84e83c71 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -18,9 +18,9 @@ class ShixunsController < ApplicationController before_action :find_repo_name, only: [:repository, :commits, :file_content, :update_file, :shixun_exec, :copy, :add_file, :jupyter_exec] - before_action :allowed, only: [:update, :close, :update_propaedeutics, :settings, :publish, :apply_public, + before_action :allowed, only: [:update, :close, :update_propaedeutics, :settings, :publish, :apply_public, :upload_git_folder, :shixun_members_added, :change_manager, :collaborators_delete, :upload_git_file, - :cancel_apply_public, :cancel_publish, :add_collaborators, :add_file] + :cancel_apply_public, :cancel_publish, :add_collaborators, :add_file, :delete_git_file] before_action :portion_allowed, only: [:copy] before_action :special_allowed, only: [:send_to_course, :search_user_courses] @@ -897,12 +897,12 @@ class ShixunsController < ApplicationController end def upload_git_folder - raise("文件夹名不合法") if params[:folder_name] =~ /^[^\\\/\?\*\"\>\<\:\|]*$/ - + render_ok end def delete_git_file + render_ok end def add_collaborators diff --git a/config/routes.rb b/config/routes.rb index 69d6d9377..2e860b0b0 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -280,6 +280,8 @@ Rails.application.routes.draw do post :commits post :file_content post :upload_git_file + post :upload_git_folder + delete :delete_git_file post :update_file post :close post :add_file From 013f556c863b2eaab956f13da3113ac50447cd82 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 3 Jan 2020 10:48:07 +0800 Subject: [PATCH 26/29] =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admins/customers_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/admins/customers_controller.rb b/app/controllers/admins/customers_controller.rb index 1901b5490..8235bdb80 100644 --- a/app/controllers/admins/customers_controller.rb +++ b/app/controllers/admins/customers_controller.rb @@ -1,5 +1,5 @@ class Admins::CustomersController < Admins::BaseController - skip_before_action :check_sign + # skip_before_action :check_sign helper_method :current_partner def index From 2e9d71a9f6826b8cefd04105f7f89c03ad4cce55 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 3 Jan 2020 11:01:58 +0800 Subject: [PATCH 27/29] =?UTF-8?q?=E5=90=88=E4=BD=9C=E4=BC=99=E4=BC=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/partners_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/partners_controller.rb b/app/controllers/partners_controller.rb index 7875e1780..dfa1b2017 100644 --- a/app/controllers/partners_controller.rb +++ b/app/controllers/partners_controller.rb @@ -1,4 +1,5 @@ class PartnersController < ApplicationController + skip_before_action :check_sign include Base::PaginateHelper include Admins::RenderHelper From 56f5cd4e16c099985a296778926256f641d6b767 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, 3 Jan 2020 11:05:27 +0800 Subject: [PATCH 28/29] =?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/shixunHomework/Trainingjobsetting.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js index 58de030d3..2ce9c0e53 100644 --- a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js +++ b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js @@ -2671,13 +2671,13 @@ class Trainingjobsetting extends Component { className="ml15 font-14" style={{textAlign: "left", color: "#FF8204"}}>(总分值 = 效率分+ 关卡任务总分)
-
-
+
+
效率分(选中,则学生最终成绩包含效率分。效率分在作业截止或者补交结束后由系统自动生成)
@@ -2686,7 +2686,7 @@ class Trainingjobsetting extends Component {
-
+

From 5a590dc231189b00e854dbab18121fa2c761ebe0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 3 Jan 2020 11:13:08 +0800 Subject: [PATCH 29/29] =?UTF-8?q?=E8=AF=95=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 | 4 +- .../modules/paths/PathDetail/DetailCards.js | 4 +- .../src/modules/question/Paperreview_item.js | 849 +++++++++++------- .../modules/question/Paperreview_single.js | 146 +-- .../question/questioncss/questioncom.css | 66 +- 5 files changed, 641 insertions(+), 428 deletions(-) diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index 9d856d899..cb5f16055 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -82,8 +82,8 @@ export function initAxiosInterceptors(props) { // proxy = "https://testeduplus2.educoder.net" //proxy="http://47.96.87.25:48080" proxy="https://pre-newweb.educoder.net" - proxy="https://test-newweb.educoder.net" - // proxy="https://test-jupyterweb.educoder.net" + // proxy="https://test-newweb.educoder.net" + proxy="https://test-jupyterweb.educoder.net" //proxy="http://192.168.2.63:3001" // 在这里使用requestMap控制,避免用户通过双击等操作发出重复的请求; diff --git a/public/react/src/modules/paths/PathDetail/DetailCards.js b/public/react/src/modules/paths/PathDetail/DetailCards.js index 35efec643..604d8fefe 100644 --- a/public/react/src/modules/paths/PathDetail/DetailCards.js +++ b/public/react/src/modules/paths/PathDetail/DetailCards.js @@ -510,7 +510,7 @@ class DetailCards extends Component{ {this.props.current_user&&this.props.current_user.admin===true||this.props.current_user&&this.props.current_user.business===true? item.shixuns_list && item.shixuns_list.map((line,index)=>{ return( -

this.showparagraph(key,index)} onMouseLeave={this.hideparagraph}> +
  • @@ -681,4 +681,4 @@ export default DetailCards; // // //
  • -// } \ No newline at end of file +// } diff --git a/public/react/src/modules/question/Paperreview_item.js b/public/react/src/modules/question/Paperreview_item.js index 7fb58cb67..9609b8a60 100644 --- a/public/react/src/modules/question/Paperreview_item.js +++ b/public/react/src/modules/question/Paperreview_item.js @@ -17,7 +17,7 @@ import NoneData from './component/NoneData'; import './questioncss/questioncom.css'; import '../tpm/newshixuns/css/Newshixuns.css'; import Paperreview_single from './Paperreview_single'; -import {DragDropContext,Draggable, Droppable} from 'react-beautiful-dnd'; +import {DragDropContext, Draggable, Droppable} from 'react-beautiful-dnd'; import PaperDeletModel from './component/PaperDeletModel'; import PaperDeletModels from './component/PaperDeletModels'; import Paperreview_itemModel from './component/Paperreview_itemModel'; @@ -36,14 +36,19 @@ class Paperreview_item extends Component { super(props); this.state = { - questions:0, - totalscore:0, - total:0, - modalsTypedel:false, - modalsTypey:false, - modalsTypedels:false, - titilesm:"", - titilesms:"", + questions: 0, + totalscore: 0, + total: 0, + modalsTypedel: false, + modalsTypey: false, + modalsTypedels: false, + titilesm: "", + titilesms: "", + singlebool: false, + multiplebool: false, + judgmentbool: false, + programbool: false, + paperreviewsingleindex: "无" } } @@ -52,8 +57,6 @@ class Paperreview_item extends Component { componentDidMount() { - - } @@ -64,8 +67,6 @@ class Paperreview_item extends Component { preservation = () => { - - } @@ -73,14 +74,14 @@ class Paperreview_item extends Component { } - onDragEnd=(result)=>{ + onDragEnd = (result) => { - const ids=this.props.single_questions.questions[result.source.index].id; - const positions=this.props.single_questions.questions[result.destination.index].position; + const ids = this.props.single_questions.questions[result.source.index].id; + const positions = this.props.single_questions.questions[result.destination.index].position; - const url=`/item_baskets/${ids}/adjust_position.json` - var data={ - position:positions + const url = `/item_baskets/${ids}/adjust_position.json` + var data = { + position: positions } axios.post(url, data) .then((result) => { @@ -93,13 +94,13 @@ class Paperreview_item extends Component { }) } - onDragEnds=(result)=>{ + onDragEnds = (result) => { - const ids=this.props.multiple_questions.questions[result.source.index].id; - const positions=this.props.multiple_questions.questions[result.destination.index].position; - const url=`/item_baskets/${ids}/adjust_position.json` - var data={ - position:positions + const ids = this.props.multiple_questions.questions[result.source.index].id; + const positions = this.props.multiple_questions.questions[result.destination.index].position; + const url = `/item_baskets/${ids}/adjust_position.json` + var data = { + position: positions } axios.post(url, data) .then((result) => { @@ -115,12 +116,12 @@ class Paperreview_item extends Component { } - onDragEndss=(result)=>{ - const ids=this.props.judgement_questions.questions[result.source.index].id; - const positions=this.props.judgement_questions.questions[result.destination.index].position; - const url=`/item_baskets/${ids}/adjust_position.json` - var data={ - position:positions + onDragEndss = (result) => { + const ids = this.props.judgement_questions.questions[result.source.index].id; + const positions = this.props.judgement_questions.questions[result.destination.index].position; + const url = `/item_baskets/${ids}/adjust_position.json` + var data = { + position: positions } axios.post(url, data) .then((result) => { @@ -134,13 +135,13 @@ class Paperreview_item extends Component { } - onDragEndsss=(result)=>{ + onDragEndsss = (result) => { - const ids=this.props.judgement_questions.questions[result.source.index].id; - const positions=this.props.judgement_questions.questions[result.destination.index].position; - const url=`/item_baskets/${ids}/adjust_position.json` - var data={ - position:positions + const ids = this.props.judgement_questions.questions[result.source.index].id; + const positions = this.props.judgement_questions.questions[result.destination.index].position; + const url = `/item_baskets/${ids}/adjust_position.json` + var data = { + position: positions } axios.post(url, data) .then((result) => { @@ -153,76 +154,78 @@ class Paperreview_item extends Component { }) } - Singlemagazine=(name,bool)=>{ - if(bool===true){ + Singlemagazine = (name, bool) => { + if (bool === true) { this.setState({ - modalsTypey:true, - titilesm:name + modalsTypey: true, + titilesm: name }) - }else { + } else { this.setState({ - modalsTypey:false, - titilesm:"" + modalsTypey: false, + titilesm: "" }) } } - setDownloady=(fenshu)=>{ - const url ="/item_baskets/batch_set_score.json"; - var data ={ - score:fenshu, - item_type:this.state.titilesm==="单选题"?"SINGLE":this.state.titilesm==="多选题"?"MULTIPLE":this.state.titilesm==="判断题"?"JUDGMENT":this.state.titilesm==="编程题"?"PROGRAM":'', + setDownloady = (fenshu) => { + const url = "/item_baskets/batch_set_score.json"; + var data = { + score: fenshu, + item_type: this.state.titilesm === "单选题" ? "SINGLE" : this.state.titilesm === "多选题" ? "MULTIPLE" : this.state.titilesm === "判断题" ? "JUDGMENT" : this.state.titilesm === "编程题" ? "PROGRAM" : '', - } + } axios.post(url, data) .then((result) => { if (result.data.status == 0) { this.props.showNotification(`调分成功`); this.props.getdata({}); - this.Singlemagazine("",false); + this.Singlemagazine("", false); } }).catch((error) => { console.log(error); }) } - setmodalsTypedel=(bool,type,names)=>{ - if(type===1){ + setmodalsTypedel = (bool, type, names) => { + if (type === 1) { this.setState({ - modalsTypedel:bool, - titilesms:names + modalsTypedel: bool, + titilesms: names }) - }else{ + } else { this.setState({ - modalsTypedel:bool, - modalsTypedels:true, - titilesms:names + modalsTypedel: bool, + modalsTypedels: true, + titilesms: names }) } } - setmodalsTypedels=(bool,type)=>{ - if(type===1){ + setmodalsTypedels = (bool, type) => { + if (type === 1) { this.setState({ - modalsTypedels:bool, - titilesms:"" + modalsTypedels: bool, + titilesms: "" }) - }else { + } else { //确定 - const url=`/item_baskets/delete_item_type.json`; - axios.delete((url), { data: { - item_type:this.state.titilesms - }}) + const url = `/item_baskets/delete_item_type.json`; + axios.delete((url), { + data: { + item_type: this.state.titilesms + } + }) .then((response) => { if (response.data.status == 0) { this.props.showNotification('删除成功'); this.props.getdata({}); this.setState({ - titilesms:"" - }) + titilesms: "" + }) } }) .catch(function (error) { @@ -230,298 +233,452 @@ class Paperreview_item extends Component { }); this.setState({ - modalsTypedels:bool, + modalsTypedels: bool, + }) + } + + } + + hideparagraph = (name) => { + console.log("hideparagraph"); + + } + + hideparagraphs = () => { + this.setState({ + singlebool: false, + multiplebool: false, + judgmentbool: false, + programbool: false, + }) + } + showparagraph = (name) => { + console.log("showparagraph"); + if (name === "SINGLE") { + this.setState({ + singlebool: true, + multiplebool: false, + judgmentbool: false, + programbool: false, + + }) + + } else if (name === "MULTIPLE") { + this.setState({ + singlebool: false, + multiplebool: true, + judgmentbool: false, + programbool: false, + + }) + } else if (name === "JUDGMENT") { + this.setState({ + singlebool: false, + multiplebool: false, + judgmentbool: true, + programbool: false, + + }) + } else if (name === "PROGRAM") { + this.setState({ + singlebool: false, + multiplebool: false, + judgmentbool: false, + programbool: true, }) + } + } + jixuxuantioncli = () => { + this.props.history.replace("/question"); } + showparagraphs = (e) => { + console.log("showparagraphs"); + console.log(e); + this.setState({ + paperreviewsingleindex: e, + }) + } render() { - let {questions,totalscore,total,modalsTypedel,modalsTypey,modalsTypedels} = this.state; - let {single_questions,multiple_questions,judgement_questions,program_questions,all_score}=this.props; + let { + questions, totalscore, total, modalsTypedel, modalsTypey, modalsTypedels, + singlebool, + multiplebool, + judgmentbool, + programbool, + paperreviewsingleindex + } = this.state; + let {single_questions, multiple_questions, judgement_questions, program_questions, all_score} = this.props; return (
    { - modalsTypedel===true? - this.setmodalsTypedel(bool,type,name)}> - :"" + modalsTypedel === true ? + this.setmodalsTypedel(bool, type, name)}> + : "" } { - modalsTypey===true? - this.setDownloady(fs)} Singlemagazine={(name,bool)=>this.Singlemagazine(name,bool)}> - :"" + modalsTypey === true ? + this.setDownloady(fs)} + Singlemagazine={(name, bool) => this.Singlemagazine(name, bool)}> + : "" } { - modalsTypedels===true? - this.setmodalsTypedels(bool,type)}> - :"" + modalsTypedels === true ? + this.setmodalsTypedels(bool, type)}> + : "" } -
    -
    -

    题数:{this.props.all_score}

    -

    总分:{this.props.all_questions_count}

    +
    +
    +
    +

    题数:{this.props.all_score}

    +

    总分:{this.props.all_questions_count}

    +
    +
    +
    this.jixuxuantioncli()}> + 继续选题 +
    +
    -
    -
    -
    拖动试题可调整排序
    -
    共{single_questions&&single_questions.questions_count}个试题
    - -
    - - {/*单选题*/} - { - single_questions&&single_questions? -
    - -
    -
    -

    一、单选题

    (共{single_questions&&single_questions.questions_count}题;共{single_questions&&single_questions.questions_score}分)

    -
    -
    -
    this.setmodalsTypedel(true,1,"SINGLE")}>删除
    -
    this.Singlemagazine("单选题",true)} >设置得分
    -
    - - - {(provided, snapshot) => ( -
    - { - single_questions&&single_questions.questions.map((object, index) => { - return ( - - {(provided, snapshot) => ( -
    - -
    - )} -
    - ) - }) - - } -
    - )} -
    -
    - - -
    -
    - - :"" - } - - - { - multiple_questions&&multiple_questions? -
    -
    -
    -
    -

    {single_questions===null?"一":"二"}、多选题

    (共{multiple_questions&&multiple_questions.questions_count}题;共{multiple_questions&&multiple_questions.questions_score}分)

    -
    -
    -
    this.setmodalsTypedel(true,1,"MULTIPLE")}>删除
    -
    this.Singlemagazine("多选题",true)}>设置得分
    -
    - - - - {(provided, snapshot) => ( -
    - { - multiple_questions&&multiple_questions.questions.map((object, index) => { - return ( - - {(provided, snapshot) => ( -
    - -
    - )} -
    - ) - }) - - } -
    - )} -
    -
    - - -
    -
    - : - "" - } - - { - judgement_questions&&judgement_questions? -
    - -
    -
    -

    {single_questions===null&&multiple_questions===null?"一":single_questions===null&&multiple_questions!==null?"二" - :single_questions!==null&&multiple_questions===null?"二" - :"三"}、判断题

    (共{judgement_questions&&judgement_questions.questions_count}题;共{judgement_questions&&judgement_questions.questions_score}分)

    -
    -
    -
    this.setmodalsTypedel(true,1,"JUDGMENT")}>删除
    -
    this.Singlemagazine("判断题",true)}>设置得分
    -
    - - - - {(provided, snapshot) => ( -
    - { - judgement_questions&&judgement_questions.questions.map((object, index) => { - return ( - - {(provided, snapshot) => ( -
    - -
    - )} -
    - ) - }) - - } -
    - )} -
    -
    -
    -
    - :"" - } - - - { - program_questions&&program_questions? -
    - -
    -
    -

    - {single_questions===null&&multiple_questions===null&&program_questions===null?"一" - :single_questions===null&&multiple_questions===null&&program_questions!==null?"二" - :single_questions!==null&&multiple_questions===null&&program_questions===null?"二" - :single_questions===null&&multiple_questions!==null&&program_questions===null?"二" - :single_questions!==null&&multiple_questions!==null&&program_questions===null?"三" - :single_questions===null&&multiple_questions!==null&&program_questions!==null?"三" - :single_questions!==null&&multiple_questions==null&&program_questions!==null?"三": - "四"} - 、编程题

    (共{program_questions&&program_questions.questions_count}题;共{program_questions&&program_questions.questions_score}分)

    -
    -
    -
    this.setmodalsTypedel(true,1,"PROGRAM")}>删除
    -
    this.Singlemagazine("编程题",true)}>设置得分
    -
    - - - {(provided, snapshot) => ( -
    - { - program_questions&&program_questions.questions.map((object, index) => { - return ( - - {(provided, snapshot) => ( -
    - -
    - )} -
    - ) - }) - - } -
    - )} -
    -
    - - -
    -
    - : - "" - } - - -
    +
    +
    +
    拖动试题可调整排序
    +
    共{single_questions && single_questions.questions_count}个试题 +
    + +
    + + {/*单选题*/} + { + single_questions && single_questions ? +
    + +
    +
    this.showparagraph("SINGLE")} onMouseLeave={() => this.hideparagraph("SINGLE")}> +

    一、单选题

    (共{single_questions && single_questions.questions_count}题;共{single_questions && single_questions.questions_score}分)

    +
    + { + singlebool === true ? +
    +
    this.setmodalsTypedel(true, 1, "SINGLE")}>删除
    +
    this.Singlemagazine("单选题", true)}>批量设置得分
    +
    : "" + } + + + {(provided, snapshot) => ( +
    + { + single_questions && single_questions.questions.map((object, index) => { + return ( + + {(provided, snapshot) => ( +
    + + +
    +
    删除
    +
    设置得分
    +
    + + this.showparagraphs(e)} + objectsingle={object} key={index} indexx={index + 1} + indexxy={index} + hideparagraphs={() => this.hideparagraphs()}> +
    + )} +
    + ) + }) + + } +
    + )} +
    +
    + + +
    +
    + + : "" + } + + + { + multiple_questions && multiple_questions ? +
    +
    +
    +
    this.showparagraph("MULTIPLE")} + onMouseLeave={() => this.hideparagraph("MULTIPLE")}> +

    {single_questions === null ? "一" : "二"}、多选题

    +

    (共{multiple_questions && multiple_questions.questions_count}题;共{multiple_questions && multiple_questions.questions_score}分)

    +
    + { + multiplebool === true ? +
    +
    this.setmodalsTypedel(true, 1, "MULTIPLE")}>删除 +
    +
    this.Singlemagazine("多选题", true)}>批量设置得分
    +
    + + : "" + } + + + + + {(provided, snapshot) => ( +
    + { + multiple_questions && multiple_questions.questions.map((object, index) => { + return ( + + {(provided, snapshot) => ( +
    + +
    +
    删除
    +
    设置得分
    +
    + this.hideparagraphs()}> +
    + )} +
    + ) + }) + + } +
    + )} +
    +
    + + +
    +
    + : + "" + } + + { + judgement_questions && judgement_questions ? +
    +
    +
    +
    this.showparagraph("JUDGMENT")} + onMouseLeave={() => this.hideparagraph("JUDGMENT")}> +

    {single_questions === null && multiple_questions === null ? "一" : single_questions === null && multiple_questions !== null ? "二" + : single_questions !== null && multiple_questions === null ? "二" + : "三"}、判断题

    (共{judgement_questions && judgement_questions.questions_count}题;共{judgement_questions && judgement_questions.questions_score}分)

    +
    + { + judgmentbool === true ? +
    +
    this.setmodalsTypedel(true, 1, "JUDGMENT")}>删除 +
    +
    this.Singlemagazine("判断题", true)}>批量设置得分
    +
    + : ""} + + + + {(provided, snapshot) => ( +
    + { + judgement_questions && judgement_questions.questions.map((object, index) => { + return ( + + {(provided, snapshot) => ( +
    + +
    +
    删除
    +
    设置得分
    +
    + this.hideparagraphs()}> +
    + )} +
    + ) + }) + + } +
    + )} +
    +
    +
    +
    + : "" + } + + + { + program_questions && program_questions ? +
    + +
    +
    +
    this.showparagraph("PROGRAM")} + onMouseLeave={() => this.hideparagraph("PROGRAM")}> +

    + {single_questions === null && multiple_questions === null && program_questions === null ? "一" + : single_questions === null && multiple_questions === null && program_questions !== null ? "二" + : single_questions !== null && multiple_questions === null && program_questions === null ? "二" + : single_questions === null && multiple_questions !== null && program_questions === null ? "二" + : single_questions !== null && multiple_questions !== null && program_questions === null ? "三" + : single_questions === null && multiple_questions !== null && program_questions !== null ? "三" + : single_questions !== null && multiple_questions == null && program_questions !== null ? "三" : + "四"} + 、编程题

    (共{program_questions && program_questions.questions_count}题;共{program_questions && program_questions.questions_score}分)

    +
    + { + programbool === true ? +
    +
    this.setmodalsTypedel(true, 1, "PROGRAM")}>删除
    +
    this.Singlemagazine("编程题", true)}>批量设置得分
    +
    + : "" + } + + + + {(provided, snapshot) => ( +
    + { + program_questions && program_questions.questions.map((object, index) => { + return ( + + {(provided, snapshot) => ( +
    + +
    +
    删除
    +
    设置得分
    +
    + this.hideparagraphs()}> +
    + )} +
    + ) + }) + + } +
    + )} +
    +
    + + +
    +
    + : + "" + } + + +
    ) diff --git a/public/react/src/modules/question/Paperreview_single.js b/public/react/src/modules/question/Paperreview_single.js index 73928ed88..4b6a964fa 100644 --- a/public/react/src/modules/question/Paperreview_single.js +++ b/public/react/src/modules/question/Paperreview_single.js @@ -1,6 +1,6 @@ import React, {Component} from "react"; import {Link, NavLink} from 'react-router-dom'; -import {WordsBtn, ActionBtn, getImageUrl,markdownToHTML} from 'educoder'; +import {WordsBtn, ActionBtn, getImageUrl, markdownToHTML} from 'educoder'; import axios from 'axios'; import { notification, @@ -17,21 +17,22 @@ import Itembankstop from "./component/Itembankstop"; import NoneData from './component/NoneData'; import './questioncss/questioncom.css'; import '../tpm/newshixuns/css/Newshixuns.css'; + 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 Paperreview_single extends Component { constructor(props) { super(props); this.state = { - questions:0, - totalscore:0, - total:0, - + questions: 0, + totalscore: 0, + total: 0, } } @@ -40,8 +41,6 @@ class Paperreview_single extends Component { componentDidMount() { - - } @@ -52,37 +51,43 @@ class Paperreview_single extends Component { preservation = () => { + } + + + setitem_type = (item_type) => { } + showparagraph = (indexx) => { - setitem_type = (item_type) => { + } + setmodalsTypedels = () => { + } + + Singlemagaziness = () => { } render() { - let {questions,totalscore,total,items} = this.state; - let {objectsingle} =this.props; - // //console.log(params); - - const objectsingleid=objectsingle.id; - const objectsinglescore=`(${objectsingle.score}分)`; + let {questions, totalscore, total, items} = this.state; + let {objectsingle, indexx, paperreviewsingleindex, indexxy} = this.props; return ( -
    this.props.showparagraphs(indexxy)} style={{ minHeight: "114px", }}> - - {/*顶部*/} -
    - {/*
    */} - {/*

    {objectsingleid}

    ({objectsinglescore}分)

    */} - {/*
    */} - -
    -
    -
    - {/*内容*/} -
    - - - { - objectsingle.item_type==="JUDGMENT"? -

    - { - objectsingle === undefined ||objectsingle === null? "" : objectsingle.choices.map((object, index) => { - return ( -

    - - {object.choice_text} - -

    - ) - }) - } -

    - : - objectsingle.item_type==="PROGRAM"? -

    -

    -

    -

    + } + +
    +
    +
    + {/*内容*/} +
    + + + { + objectsingle.item_type === "JUDGMENT" ? +

    + { + objectsingle === undefined || objectsingle === null ? "" : objectsingle.choices.map((object, index) => { + return ( +

    + + {object.choice_text} + +

    + ) + }) + }

    : -

    - { - objectsingle === undefined ||objectsingle === null? "" : objectsingle.choices.map((object, index) => { - return ( -

    - {tagArray[index]} -

    -

    - ) - }) - } -

    - } - - -
    + objectsingle.item_type === "PROGRAM" ? +

    +

    +

    +

    +

    + : +

    + { + objectsingle === undefined || objectsingle === null ? "" : objectsingle.choices.map((object, index) => { + return ( +

    + {tagArray[index]} +

    +

    + ) + }) + } +

    + } +
    diff --git a/public/react/src/modules/question/questioncss/questioncom.css b/public/react/src/modules/question/questioncss/questioncom.css index cb8b922a5..eef7dcf12 100644 --- a/public/react/src/modules/question/questioncss/questioncom.css +++ b/public/react/src/modules/question/questioncss/questioncom.css @@ -688,26 +688,44 @@ right: 2px; top: 11px; } - +.postitonrelatiss{ + position: absolute; + right: 2px; + top: -41px; +} +.postitonrelatisss{ + position: absolute; + right: 2px; + top: -39px; +} +.postitonrelatisssy{ + position: absolute; + right: 1px; + top: 52px; +} +.mt50{ + margin-top: 50px; +} .szdfd{ - width:88px; - height:34px; + width:100px; + height:40px; background:rgba(51,189,140,1); border-radius:4px 4px 0px 0px; text-align: center; color: #ffffff; - line-height: 32px; + line-height: 40px; margin-right: 27px; + font-size:12px; } .scd{ - width:88px; - height:34px; + width:100px; + height:40px; background:#4CACFF; border-radius:4px 4px 0px 0px; text-align: center; color: #ffffff; - line-height: 32px; - + line-height: 40px; + font-size:12px; } @@ -757,3 +775,35 @@ .mt7{ margin-top: 7px; } +.ml18{ + margin-left: 18px; +} +.btques{ + width:1021px; + background:rgba(249,249,249,1); + border:1px solid rgba(221,221,221,1); +} + +.borderwdswuhques { + width: 1020px !important; + background: #F9F9F9; + border: 1px solid #DDDDDD; + min-height: 42px; +} + +.jixuxuanti{ + width:106px; + height:34px; + background:rgba(51,189,140,1); + border-radius:4px; + color:#ffffff ; + line-height: 34px; + text-align: center; +} +.lh34{ + line-height: 34px; +} + +.mr2{ + margin-right: 2px; +}