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

yslnewtiku
杨树林 5 years ago
commit b5713f1585

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2019-12-18 08:49:30 * @Date: 2019-12-18 08:49:30
* @LastEditors : tangjiang * @LastEditors : tangjiang
* @LastEditTime : 2019-12-26 19:36:00 * @LastEditTime : 2019-12-27 10:36:11
*/ */
import './index.scss'; import './index.scss';
import 'quill/dist/quill.core.css'; // 核心样式 import 'quill/dist/quill.core.css'; // 核心样式
@ -121,7 +121,7 @@ function QuillForEditor ({
const previous = quill.getContents() const previous = quill.getContents()
if (value && value.hasOwnProperty('ops')) { if (value && value.hasOwnProperty('ops')) {
console.log(value.ops); // console.log(value.ops);
const ops = value.ops || []; const ops = value.ops || [];
ops.forEach((item, i) => { ops.forEach((item, i) => {
if (item.insert['image']) { if (item.insert['image']) {
@ -131,7 +131,7 @@ function QuillForEditor ({
} }
const current = value const current = value
console.log('+++++', current); // console.log('+++++', current);
if (!deepEqual(previous, current)) { if (!deepEqual(previous, current)) {
setSelection(quill.getSelection()) setSelection(quill.getSelection())
if (typeof value === 'string') { if (typeof value === 'string') {

@ -254,7 +254,7 @@ class DeveloperHome extends React.PureComponent {
content: `确定要删除${record.name}吗?`, content: `确定要删除${record.name}吗?`,
onOk () { onOk () {
// 调用删除接口 // 调用删除接口
console.log(record.identifier); // console.log(record.identifier);
deleteItem(record.identifier); deleteItem(record.identifier);
} }
}); });

@ -3,8 +3,8 @@
* @Author: tangjiang * @Author: tangjiang
* @Github: * @Github:
* @Date: 2019-11-25 17:50:33 * @Date: 2019-11-25 17:50:33
* @LastEditors: tangjiang * @LastEditors : tangjiang
* @LastEditTime: 2019-12-19 19:32:08 * @LastEditTime : 2019-12-27 10:36:54
*/ */
import React, { useState } from 'react'; import React, { useState } from 'react';
import { fromStore, toStore } from 'educoder'; import { fromStore, toStore } from 'educoder';
@ -68,7 +68,7 @@ const SettingDrawer = (props) => {
); );
} else if (Array.isArray(value)) { } else if (Array.isArray(value)) {
const defaultValue = ctx.type === 'font' ? fontSize : theme; const defaultValue = ctx.type === 'font' ? fontSize : theme;
console.log('++', defaultValue); // console.log('++', defaultValue);
if (type === 'select') { if (type === 'select') {
const child = ctx.value.map((opt, i) => { const child = ctx.value.map((opt, i) => {
return ( return (

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2019-11-27 15:02:52 * @Date: 2019-11-27 15:02:52
* @LastEditors : tangjiang * @LastEditors : tangjiang
* @LastEditTime : 2019-12-27 09:22:08 * @LastEditTime : 2019-12-27 10:32:25
*/ */
import './index.scss'; import './index.scss';
import React, { useState, useRef, useEffect } from 'react'; import React, { useState, useRef, useEffect } from 'react';
@ -28,7 +28,8 @@ const maps = {
function MyMonacoEditor (props, ref) { function MyMonacoEditor (props, ref) {
const { const {
code,
notice, notice,
language, language,
identifier, identifier,
@ -41,7 +42,7 @@ function MyMonacoEditor (props, ref) {
} = props; } = props;
const [showDrawer, setShowDrawer] = useState(false); // 控制配置滑框 const [showDrawer, setShowDrawer] = useState(false); // 控制配置滑框
const [editCode, setEditCode] = useState(''); // const [editCode, setEditCode] = useState('');
// const [curLang, setCurLang] = useState('C'); // const [curLang, setCurLang] = useState('C');
const [fontSize, setFontSize] = useState(() => { // 字体 const [fontSize, setFontSize] = useState(() => { // 字体
return +fromStore('oj_fontSize') || 14; return +fromStore('oj_fontSize') || 14;
@ -52,9 +53,9 @@ function MyMonacoEditor (props, ref) {
const [ height, setHeight ] = useState('calc(100% - 56px)'); const [ height, setHeight ] = useState('calc(100% - 56px)');
const editorRef = useRef(null); const editorRef = useRef(null);
useEffect(() => { // useEffect(() => {
setEditCode(props.code || ''); // setEditCode(props.code || '');
}, [props]); // }, [props]);
useEffect(() => { useEffect(() => {
setHeight(showOrHideControl ? 'calc(100% - 378px)' : 'calc(100% - 56px)'); setHeight(showOrHideControl ? 'calc(100% - 378px)' : 'calc(100% - 56px)');
@ -80,11 +81,11 @@ function MyMonacoEditor (props, ref) {
// 文本框内容变化时,记录文本框内容 // 文本框内容变化时,记录文本框内容
const handleEditorChange = (origin, monaco) => { const handleEditorChange = (origin, monaco) => {
editorRef.current = monaco; // 获取当前monaco实例 editorRef.current = monaco; // 获取当前monaco实例
setEditCode(origin); // 保存编辑器初始值 // setEditCode(origin); // 保存编辑器初始值
editorRef.current.onDidChangeModelContent(e => { // 监听编辑器内容的变化 editorRef.current.onDidChangeModelContent(e => { // 监听编辑器内容的变化
// TODO 需要优化 节流 // TODO 需要优化 节流
const val = editorRef.current.getValue(); const val = editorRef.current.getValue();
setEditCode(val); // setEditCode(val);
onCodeChange(val); onCodeChange(val);
// 值一变化保存当前代码值 // 值一变化保存当前代码值
// saveUserInputCode(val); // saveUserInputCode(val);
@ -179,7 +180,7 @@ function MyMonacoEditor (props, ref) {
height={height} height={height}
width="100%" width="100%"
language={language && language.toLowerCase()} language={language && language.toLowerCase()}
value={editCode} value={code || ''}
options={editorOptions} options={editorOptions}
theme={theme} // dark || light theme={theme} // dark || light
editorDidMount={handleEditorChange} editorDidMount={handleEditorChange}
@ -210,12 +211,12 @@ const mapStateToProps = (state) => {
} }
}; };
const mapDispatchToProps = (dispatch) => ({ // const mapDispatchToProps = (dispatch) => ({
// saveUserInputCode: (code) => dispatch(actions.saveUserInputCode(code)), // // saveUserInputCode: (code) => dispatch(actions.saveUserInputCode(code)),
}); // });
// MyMonacoEditor = React.forwardRef(MyMonacoEditor); // MyMonacoEditor = React.forwardRef(MyMonacoEditor);
export default connect( export default connect(
mapStateToProps, mapStateToProps,
mapDispatchToProps // mapDispatchToProps
)(CNotificationHOC() (MyMonacoEditor)); )(CNotificationHOC() (MyMonacoEditor));

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2019-11-21 09:19:38 * @Date: 2019-11-21 09:19:38
* @LastEditors : tangjiang * @LastEditors : tangjiang
* @LastEditTime : 2019-12-26 15:33:01 * @LastEditTime : 2019-12-27 10:37:41
*/ */
import './index.scss'; import './index.scss';
import React from 'react'; import React from 'react';
@ -134,10 +134,10 @@ const AddTestDemo = (props) => {
// }; // };
// const {input = {}, output = {}} = (testCasesValidate[index] = {}); // const {input = {}, output = {}} = (testCasesValidate[index] = {});
const activePane = { // const activePane = {
defaultActiveKey: [isOpen ? '1' : ''] // defaultActiveKey: [isOpen ? '1' : '']
}; // };
console.log(activePane); // console.log(activePane);
// 切换手风琴 // 切换手风琴
const handleChangeCollapse = () => { const handleChangeCollapse = () => {
@ -184,7 +184,7 @@ const AddTestDemo = (props) => {
const mapStateToProps = (state) => { const mapStateToProps = (state) => {
const {identifier, loading} = state.ojFormReducer; const {identifier, loading} = state.ojFormReducer;
console.log(state.ojFormReducer); // console.log(state.ojFormReducer);
return { return {
identifier, identifier,
loading, loading,

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2019-11-20 10:35:40 * @Date: 2019-11-20 10:35:40
* @LastEditors : tangjiang * @LastEditors : tangjiang
* @LastEditTime : 2019-12-26 16:00:57 * @LastEditTime : 2019-12-27 10:37:58
*/ */
import './index.scss'; import './index.scss';
// import 'katex/dist/katex.css'; // import 'katex/dist/katex.css';
@ -175,11 +175,11 @@ class EditTab extends React.Component {
}; };
// 提交测试用例 // 提交测试用例
const handleSubmitTest = (obj) => { const handleSubmitTest = (obj) => {
console.log('提交的测试用例: ', obj); // console.log('提交的测试用例: ', obj);
}; };
// 删除测试用例 // 删除测试用例
const handleDeleteTest = (obj) => { const handleDeleteTest = (obj) => {
console.log('删除的测试用例: ', obj); // console.log('删除的测试用例: ', obj);
deleteTestCase(obj); deleteTestCase(obj);
}; };
const renderTestCase = () => { const renderTestCase = () => {
@ -223,9 +223,9 @@ class EditTab extends React.Component {
// 描述信息变化时 // 描述信息变化时
const handleContentChange = (content, quill) => { const handleContentChange = (content, quill) => {
console.log('描述信息为: ', content); // console.log('描述信息为: ', content);
// if (quill.getText()) // if (quill.getText())
console.log('========>>>>>', quill.getText().length); // console.log('========>>>>>', quill.getText().length);
if (quill.getText().length === 1) { if (quill.getText().length === 1) {
this.handleChangeDescription(''); this.handleChangeDescription('');
} else { } else {

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2019-12-01 10:18:35 * @Date: 2019-12-01 10:18:35
* @LastEditors : tangjiang * @LastEditors : tangjiang
* @LastEditTime : 2019-12-26 13:51:40 * @LastEditTime : 2019-12-27 10:17:07
*/ */
import './index.scss'; import './index.scss';
import React from 'react'; import React from 'react';
@ -17,7 +17,8 @@ function RightPane (props, ref) {
const { const {
// identifier, // identifier,
// code, code,
language,
// onSubmitForm, // onSubmitForm,
saveOjFormCode saveOjFormCode
} = props; } = props;
@ -44,8 +45,8 @@ function RightPane (props, ref) {
return ( return (
<div className={'right_pane_code_wrap'}> <div className={'right_pane_code_wrap'}>
<MyMonacoEditor <MyMonacoEditor
language={props.language} language={language}
code={props.code} code={code}
onCodeChange={handleCodeChange}/> onCodeChange={handleCodeChange}/>
{/* <ControlSetting {/* <ControlSetting
@ -65,7 +66,6 @@ const mapStateToProps = (state) => {
identifier, identifier,
language: ojForm.language, language: ojForm.language,
input: (testCases[0] && testCases[0].input) || '', input: (testCases[0] && testCases[0].input) || '',
} }
}; };
const mapDispatchToProps = (dispatch) => ({ const mapDispatchToProps = (dispatch) => ({

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2019-12-04 08:36:21 * @Date: 2019-12-04 08:36:21
* @LastEditors : tangjiang * @LastEditors : tangjiang
* @LastEditTime : 2019-12-26 14:04:16 * @LastEditTime : 2019-12-27 10:38:42
*/ */
import './index.scss'; import './index.scss';
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
@ -43,7 +43,7 @@ function RecordDetail (props) {
useEffect(() => { useEffect(() => {
setDetail(recordDetail); setDetail(recordDetail);
console.log('详情: ', recordDetail); // console.log('详情: ', recordDetail);
if (recordDetail) { if (recordDetail) {
const { user, myproblem_identifier, code } = recordDetail; const { user, myproblem_identifier, code } = recordDetail;
setUser(user); setUser(user);

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2019-11-23 10:53:19 * @Date: 2019-11-23 10:53:19
* @LastEditors : tangjiang * @LastEditors : tangjiang
* @LastEditTime : 2019-12-26 15:02:12 * @LastEditTime : 2019-12-27 10:25:14
*/ */
import './index.scss'; import './index.scss';
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
@ -90,9 +90,9 @@ function StudentStudy (props) {
const handleClickEditor = (identifier) => { const handleClickEditor = (identifier) => {
if (!identifier) return; if (!identifier) return;
changeShowOrHideControl(false); changeShowOrHideControl(false);
props.saveEditorCodeForDetail(); props.saveEditorCodeForDetail('');
props.history.push(`/problems/${identifier}/edit`);
props.clearOjForUserReducer(); props.clearOjForUserReducer();
props.history.push(`/problems/${identifier}/edit`);
} }
// 处理退出 // 处理退出
const handleClickQuit = () => { const handleClickQuit = () => {
@ -100,7 +100,7 @@ function StudentStudy (props) {
props.clearOjForUserReducer(); props.clearOjForUserReducer();
// 将控制台关闭 // 将控制台关闭
changeShowOrHideControl(false); changeShowOrHideControl(false);
props.saveEditorCodeForDetail(); props.saveEditorCodeForDetail('');
props.history.push('/problems'); props.history.push('/problems');
} }

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2019-11-27 09:49:33 * @Date: 2019-11-27 09:49:33
* @LastEditors : tangjiang * @LastEditors : tangjiang
* @LastEditTime : 2019-12-25 14:45:20 * @LastEditTime : 2019-12-27 10:39:00
*/ */
import './index.scss'; import './index.scss';
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
@ -105,7 +105,7 @@ const CommitRecord = (props) => {
// expected_output // expected_output
} = commitRecordDetail; } = commitRecordDetail;
if (Object.keys(commitRecordDetail).length > 0) { if (Object.keys(commitRecordDetail).length > 0) {
console.log('当前状态====》》》', status); // console.log('当前状态====》》》', status);
const classes = status === 0 ? 'record_result_suc' : 'record_result_err'; const classes = status === 0 ? 'record_result_suc' : 'record_result_err';
const showErrorCode = status !== 0 ? `ecord_error_info show_error_code` : `ecord_error_info`; const showErrorCode = status !== 0 ? `ecord_error_info show_error_code` : `ecord_error_info`;
const showErrorCopy = status !== 0 ? `copy_error show_error_copy` : `copy_error`; const showErrorCopy = status !== 0 ? `copy_error show_error_copy` : `copy_error`;

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2019-11-27 14:59:51 * @Date: 2019-11-27 14:59:51
* @LastEditors : tangjiang * @LastEditors : tangjiang
* @LastEditTime : 2019-12-27 09:23:15 * @LastEditTime : 2019-12-27 10:28:41
*/ */
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import {connect} from 'react-redux'; import {connect} from 'react-redux';

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2019-11-20 16:40:32 * @Date: 2019-11-20 16:40:32
* @LastEditors : tangjiang * @LastEditors : tangjiang
* @LastEditTime : 2019-12-23 10:12:59 * @LastEditTime : 2019-12-27 10:35:06
*/ */
import { Base64 } from 'js-base64'; import { Base64 } from 'js-base64';
import types from '../actions/actionTypes'; import types from '../actions/actionTypes';
@ -174,10 +174,16 @@ const ojFormReducer = (state = initialState, action) => {
* 7. 添加测试用例验证 * 7. 添加测试用例验证
*/ */
const { code = '', description, language, name, hack_sets = [], time_limit, difficult, category, status } = action.payload; const { code = '', description, language, name, hack_sets = [], time_limit, difficult, category, status } = action.payload;
let desc = null;
try {
desc = JSON.parse(description)
} catch (error) {
desc = description;
}
const currentOjForm = { const currentOjForm = {
name, // 任务名称 name, // 任务名称
language, language,
description: JSON.parse(description), description: desc,
difficult, difficult,
category, category,
openOrNot: 1, openOrNot: 1,

Loading…
Cancel
Save