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

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

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

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

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

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

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

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

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

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

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

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

Loading…
Cancel
Save