修改预览与编辑器内容

dev_daiao
tangjiang 5 years ago
parent f5291f9fee
commit d5296fe5c3

@ -81,6 +81,7 @@
<!--需要去build js配置-->
<link rel="stylesheet" type="text/css" href="/css/iconfont.css">
<link rel="stylesheet" type="text/css" href="https://cdn.bootcss.com/quill/1.3.7/quill.core.min.css">
<style>
/*<!--去除浏览器点击操作后有蓝色的底块-->*/
-moz-user-select: none;
@ -187,6 +188,6 @@
<!-- <script type="text/javascript" src="https://testeduplus2.educoder.net/assets/kindeditor/kindeditor.js"></script>
<script type="text/javascript" src="/js/create_kindeditor.js"></script>
<script type="text/javascript" src="https://testeduplus2.educoder.net/javascripts/educoder/edu_application.js"></script> -->
<script type="text/javascript" src="https://cdn.bootcss.com/quill/1.3.7/quill.core.min.js"></script>
</body>
</html>

@ -671,14 +671,12 @@ class App extends Component {
(props)=>(<Ecs {...this.props} {...props} {...this.state}></Ecs>)
}/>
<Route path="/problems/new/:id?" component={NewOrEditTask}
// render={
// (props) => {
// debugger;
// console.log(this.props, props, this.state);
// return (<NewOrEditTask {...this.props} {...props} {...this.state} />)
// }
// }
<Route path="/problems/new/:id?"
render={
(props) => {
return (<NewOrEditTask {...this.props} {...props} {...this.state} />)
}
}
/>
<Route
path="/problems/:id/edit"

@ -10,7 +10,6 @@ broadcastChannelOnmessage('refreshPage', () => {
})
function locationurl(list){
debugger
if (window.location.port === "3007") {
} else {

@ -180,6 +180,7 @@ class DeveloperHome extends React.PureComponent {
// 是否是我的,如果是我的 显示编辑按钮
const { isMySource } = this.props;
console.log(this.props);
if (isMySource) {
this.handleFilterSearch({come_from: 'mine'});
let _columns = this.columns.concat([this.options]);

@ -4,7 +4,7 @@
* @Github:
* @Date: 2019-11-27 15:02:52
* @LastEditors: tangjiang
* @LastEditTime: 2019-12-04 11:36:16
* @LastEditTime: 2019-12-05 10:17:04
*/
import './index.scss';
import React, { useState, useRef, useEffect } from 'react';
@ -21,13 +21,13 @@ function MyMonacoEditor (props, ref) {
const {
language,
code,
identifier,
showOrHideControl,
// saveUserInputCode,
onCodeChange,
onRestoreInitialCode
} = props;
const [showDrawer, setShowDrawer] = useState(false); // 控制配置滑框
const [editCode, setEditCode] = useState('');
// const [curLang, setCurLang] = useState('C');
@ -36,10 +36,10 @@ function MyMonacoEditor (props, ref) {
const editorRef = useRef(null);
useEffect(() => {
if (code) {
setEditCode(code);
if (props.code) {
setEditCode(props.code);
}
}, [code]);
}, [props]);
useEffect(() => {
setHeight(showOrHideControl ? 'calc(100% - 382px)' : 'calc(100% - 112px)');
@ -81,7 +81,6 @@ function MyMonacoEditor (props, ref) {
// 恢复初始代码
const handleRestoreCode = () => {
console.log('点击了恢复初始代码');
Modal.confirm({
content: '确定要恢复代码吗?',
okText: '确定',

@ -58,6 +58,7 @@
}
.dropdonw-style{
margin-right: 50px;
cursor: pointer;
.dropdown-span{
cursor: pointer;
margin-right: 10px;

@ -4,7 +4,7 @@
* @Github:
* @Date: 2019-11-20 10:35:40
* @LastEditors: tangjiang
* @LastEditTime: 2019-12-04 15:49:37
* @LastEditTime: 2019-12-04 19:56:43
*/
import 'quill/dist/quill.core.css';
import 'quill/dist/quill.bubble.css';
@ -25,9 +25,9 @@ const { Option } = Select;
const maps = {
language: [
{ title: 'C', key: 'C' },
{ title: 'C++', key: 'C++' },
{ title: 'Python', key: 'Python' },
{ title: 'Java', key: 'Java' }
// { title: 'C++', key: 'C++' },
// { title: 'Python', key: 'Python' },
// { title: 'Java', key: 'Java' }
],
difficult: [
{ title: '简单', key: '1' },
@ -219,6 +219,16 @@ class EditTab extends React.Component {
this.scrollToBottom();
}
const quillConfig = [
[{ header: [1, 2, 3, 4, 5, 6, false] }],
['bold', 'italic', 'underline', 'strike'], // 切换按钮
['blockquote', 'code-block'], // 代码块
[{ 'list': 'ordered' }, { 'list': 'bullet' }], // 列表
[{ 'script': 'sub'}, { 'script': 'super' }],
[{ 'color': [] }, { 'background': [] }], // 字体颜色与背景色
['formula', 'image', 'video'], // 数学公式、图片、视频
['clean'], // 清除格式
];
return (
<div className={'editor_area'} id="textCase">
<Form className={'editor_form'}>
@ -260,6 +270,7 @@ class EditTab extends React.Component {
placeholder="请输入描述信息"
onEditorChange={this.handleChangeDescription}
htmlCtx={ojForm.description}
options={quillConfig}
/>
</FormItem>
<FormItem

@ -4,43 +4,74 @@
* @Github:
* @Date: 2019-11-24 10:09:55
* @LastEditors: tangjiang
* @LastEditTime: 2019-11-27 19:30:51
* @LastEditTime: 2019-12-04 23:38:37
*/
import './index.scss';
import React, { useEffect, useState } from 'react';
import React, { useEffect, useState, useRef } from 'react';
import { connect } from 'react-redux';
import {Empty} from 'antd';
import QuillEditor from '../../../quillEditor';
// import QuillEditor from '../../../quillEditor';
const Quill = window.Quill;
const PrevTab = (props) => {
// const { } = props;
const {
description
} = props;
const prevRef = useRef(null);
const [desc, setDesc] = useState('');
const [renderCtx, setRenderCtx] = useState(() => {
return function () {
return '';
}
});
// 空内容
const renderTxt = () => (
<div className='no_result'>
<Empty />
</div>
);
// 渲染内容
const renderQuill = () => (
<div
id="quill_editor"
style = {{ height: '100%', width: '100%'}}
ref={prevRef}>
</div>
);
useEffect(() => {
setDesc(props.description);
}, [props.description]);
const renderHtml = () => {
if (!desc) {
return (
<div className={'no_result'}>
<Empty />
</div>
);
setDesc(description);
}, [description]);
useEffect(() => {
if (description) {
setRenderCtx(() => renderQuill);
let count = 0;
let timer = setInterval(() => {
count++;
if (count >= 10 || prevRef.current) {
clearInterval(timer);
timer = null;
if (prevRef.current) {
const quillEditor = new Quill(prevRef.current, {
readOnly: true,
theme: 'bubble'
});
quillEditor.container.firstChild.innerHTML = description;
}
}
}, 50);
} else {
return (
<div className={'render_html'} dangerouslySetInnerHTML={{ __html: desc }}></div>
)
setRenderCtx(() => renderTxt);
}
}
}, [description]);
return (
<div className={`prev_area`}>
{/* {renderHtml()} */}
{/* <div dangerouslySetInnerHTML={{ __html: desc }}></div> */}
<QuillEditor
style={{ height: 'calc(100% - 45px)', overflowY: 'auto' }}
options={[]}
readOnly={true}
htmlCtx={props.description}/>
{renderCtx()}
</div>
)

@ -8,4 +8,10 @@
.render_html{
padding: 20px 30px;
}
.prev_area{
// padding: 0 30px;
padding-left: 20px;
height: calc(100vh - 110px);
}

@ -4,12 +4,12 @@
* @Github:
* @Date: 2019-11-25 09:46:03
* @LastEditors: tangjiang
* @LastEditTime: 2019-12-02 16:34:29
* @LastEditTime: 2019-12-04 23:09:38
*/
import 'quill/dist/quill.core.css';
import 'quill/dist/quill.bubble.css';
import 'quill/dist/quill.snow.css';
import 'katex/dist/katex.css';
// import 'quill/dist/quill.core.css';
// import 'quill/dist/quill.bubble.css';
// import 'quill/dist/quill.snow.css';
// import 'katex/dist/katex.css';
import './index.scss';
import React from 'react';
import katex from 'katex';
@ -17,7 +17,7 @@ const Quill = require('quill');
// 将katex挂载到window上
window.katex = katex;
window.Quill = Quill;
// const Quill = window.Quill;
// 指定 Quill 默认配置项
const defaultOptions = [
[{ header: [1, 2, 3, 4, 5, 6, false] }], // 自定义标题大小
@ -61,7 +61,7 @@ class QuillEditor extends React.Component {
componentDidMount () {
const { options, placeholder = '', readOnly = false } = this.props;
let { quillEditor } = this.state;
console.log(placeholder);
// console.log(placeholder);
const renderOptions = options || defaultOptions;
const editorOption = {
@ -83,11 +83,10 @@ class QuillEditor extends React.Component {
this.timer = setInterval(() => {
count++;
if (count >= 10 || this.props.htmlCtx) {
quillEditor.container.firstChild.innerHTML = this.props.htmlCtx;
quillEditor.container.firstChild.innerHTML = this.props.htmlCtx || '';
clearInterval(this.timer);
this.timer = null;
}
// console.log('定时器====>>>>>', count);
}, 50);
// quillEditor.setText('<p>aaa</p>');

@ -4,7 +4,7 @@
* @Github:
* @Date: 2019-12-04 08:36:21
* @LastEditors: tangjiang
* @LastEditTime: 2019-12-04 10:36:06
* @LastEditTime: 2019-12-05 13:52:04
*/
import './index.scss';
import React, { useState, useEffect } from 'react';
@ -25,19 +25,22 @@ function RecordDetail (props) {
match: { params },
mygetHelmetapi = {},
recordDetail,
identifier,
getUserCommitRecordDetail
} = props;
const identifier = params.id;
const id = params.id;
const [detail, setDetail] = useState({});
useEffect(() => {
// 根据id获取记录详情
getUserCommitRecordDetail(identifier, 'detail');
console.log('提交记录详情', recordDetail);
getUserCommitRecordDetail(id, 'detail');
}, []);
useEffect(() => {
setDetail(recordDetail);
}, [recordDetail]);
return (
<div className="record_detail_area">
@ -53,7 +56,7 @@ function RecordDetail (props) {
</div>
<div className={'study_quit'}>
<Button>
<Link to="/myproblems">返回该题</Link>
<Link to={`/myproblems/${identifier}`}>返回该题</Link>
</Button>
</div>
</div>
@ -67,7 +70,7 @@ function RecordDetail (props) {
</span>
<span className="status_label">
提交时间: <span className="status_label_sub">
{/* moment(detail.) */}
{moment(detail.created_at).format('YYYY-MM-DD HH:mm')}
</span>
</span>
<span className="status_label">
@ -85,9 +88,10 @@ function RecordDetail (props) {
<MonacoEditor
height="100%"
width="100%"
language={'c'}
value={'// init code'}
language={(detail.language && detail.language.toLowerCase()) || ''}
value={detail.code || ''}
theme="dark"
readOnly={true}
/>
</div>
</div>
@ -96,8 +100,9 @@ function RecordDetail (props) {
}
const mapStateToProps = (state) => {
const {recordDetail} = state.ojForUserReducer;
const {recordDetail, user_program_identifier} = state.ojForUserReducer;
return {
identifier: user_program_identifier,
recordDetail
}
}

@ -16,6 +16,7 @@
top: 14px;
}
.detail_ctx_status{
height: 18px;
line-height: 18px;
.status_label{
color: rgba(153,153,153,1);
@ -33,7 +34,11 @@
}
.result_code_area{
height: 500px;
// height: 500px;
height: calc(100vh - 360px);
}
.result_error_area{
margin-top: 15px;
}
}
}

@ -4,7 +4,7 @@
* @Github:
* @Date: 2019-11-27 09:49:33
* @LastEditors: tangjiang
* @LastEditTime: 2019-12-04 10:37:33
* @LastEditTime: 2019-12-05 10:38:49
*/
import './index.scss';
import React, { useState, useEffect } from 'react';
@ -32,7 +32,11 @@ const columns = [
{
title: '提交结果',
dataIndex: 'status',
render: (value) => (<span style={{ color: value === 0 ? '#28BD8B' : '#E6262E'}}>{reviewResult[value]}</span>)
render: (value, record) => (
<Link to={`/myproblems/record_detail/${record.id}`}>
<span style={{ color: value === 0 ? '#28BD8B' : '#E6262E'}}>{reviewResult[value]}</span>
</Link>
)
},
{
title: '执行用时',
@ -84,6 +88,7 @@ const CommitRecord = (props) => {
// 渲染提交记录详情
const renderRecordDetail = () => {
const {
id,
error_line,
error_msg,
execute_memory,
@ -110,7 +115,7 @@ const CommitRecord = (props) => {
</span>
</p>
<p className={'show_detail'}>
<Link to={`/myproblems/record_detail/${identifier}`}>
<Link to={`/myproblems/record_detail/${id}`}>
显示详情 <Icon type="right" className={'icon_style'}/>
</Link>
</p>

@ -4,9 +4,9 @@
* @Github:
* @Date: 2019-11-27 14:59:51
* @LastEditors: tangjiang
* @LastEditTime: 2019-12-04 10:57:49
* @LastEditTime: 2019-12-05 10:15:25
*/
import React from 'react';
import React, { useState, useEffect } from 'react';
import {connect} from 'react-redux';
import MyMonacoEditor from '../../components/myMonacoEditor';
import ControlSetting from '../../components/controlSetting';
@ -19,18 +19,25 @@ const RightPane = (props) => {
submitInput,
submitUserCode,
input,
hack,
updateCode,
saveUserInputCode,
restoreInitialCode
} = props;
const [editorCode, setEditorCode] = useState('');
useEffect(() => {
setEditorCode(hack.code);
}, [hack]);
const handleSubmitForm = () => {
console.log('提交了表单内容');
// 提交时, 先调用提交接口,提交成功后,循环调用测评接口
submitUserCode(identifier, submitInput, 'submit');
// // 提交时,先调用评测接口, 评测通过后才调用保存接口
// updateCode(identifier, submitInput, 'submit');
}
// 代码块内容变化时
const handleCodeChange = (code) => {
// 保存用户提交的代码块
@ -52,8 +59,8 @@ const RightPane = (props) => {
<div className={'right_pane_code_wrap'}>
<MyMonacoEditor
identifier={identifier}
language={props.language}
code={props.code}
language={hack.language}
code={editorCode}
onCodeChange={handleCodeChange}
onRestoreInitialCode={handleRestoreInitialCode}
/>
@ -69,10 +76,9 @@ const RightPane = (props) => {
const mapStateToProps = (state) => {
const {user_program_identifier, hack, userTestInput} = state.ojForUserReducer;
const { language, code } = hack;
// const { language, code } = hack;
return {
language,
code,
hack,
input: userTestInput,
submitInput: hack.input,
identifier: user_program_identifier

@ -469,6 +469,7 @@ class LoginDialog extends Component {
autologin:isGoingValue
}
).then((response) => {
debugger;
if(response===undefined){
return
}

@ -37,6 +37,11 @@ class VNCContainer extends Component {
}
}
shouldComponentUpdate () {
return false;
}
getSecondDrawerWidth = () => {
return $('#game_right_contents').width() - firstDrawerWidth
}

@ -47,7 +47,7 @@ const five_min = 5 * 60 * 1000;
倒计时为0时出现重启按钮
*/
const isSSHInIframe = false;
class WebSSHTimer extends Component {
class WebSSHTimer extends React.PureComponent {
constructor(props) {
super(props)
@ -63,6 +63,7 @@ class WebSSHTimer extends Component {
}
init() {
console.log('调用定时器开始: =========>>>>>>>>>>>>');
// 20分钟倒计时
this.timeRemain = 20 * 60 * 1000;
this.startTimeRemain = 0
@ -85,7 +86,6 @@ class WebSSHTimer extends Component {
return;
}
let _timeRemain = this.timeRemain;
$('.webSSHTimer').html(moment(_timeRemain).format('mm:ss'))
_timeRemain -= 1000
this.timeRemain = _timeRemain;
@ -165,6 +165,7 @@ class WebSSHTimer extends Component {
})
}
componentDidUpdate(prevProps, prevState, snapshot) {
console.log('======',prevProps, this.state, this.startTimeRemain);
// 仅初始化一次
if (prevProps.showTimerProp === false && this.props.showTimerProp === true) {
if (this.intervalHandler) {
@ -320,7 +321,7 @@ class WebSSHTimer extends Component {
{ this.props.showTimerProp === true && showTimer === true &&
<Popconfirm
title={<span><p>实验环境将恢复到初始状态</p><p>?</p></span>}
title={<React.Fragment><p>实验环境将恢复到初始状态</p><p>?</p></React.Fragment>}
placement="bottom"
onConfirm={this.resetSsh} okText="确定" cancelText="取消">

@ -4,7 +4,7 @@
* @Github:
* @Date: 2019-11-27 13:42:11
* @LastEditors: tangjiang
* @LastEditTime: 2019-12-04 15:50:54
* @LastEditTime: 2019-12-05 10:44:17
*/
import types from "./actionTypes";
import { Base64 } from 'js-base64';
@ -32,9 +32,18 @@ export const startProgramQuestion = (id, props) => {
payload: identifier
});
// 跳转至开启编程
debugger;
props.history.push(`/myproblems/${identifier}`);
// Redirect.to
if (identifier) {
// let data = Object.assign({}, props);
// const path = {
// pathname: `/myproblems/${identifier}`,
// state: data
// }
// console.log(path);
// props.history.push(`/myproblems/${identifier}`);
props.history.push({
pathname: `/myproblems/${identifier}`,
});
}
}
})
}
@ -55,6 +64,7 @@ export const getUserProgramDetail = (identifier, type) => {
fetchUserProgramDetail(identifier).then(res => {
const { status, data = {} } = res;
if (status === 200) {
if (data.status === 401) return;
if (!type) {
dispatch({
type: types.USER_PROGRAM_DETAIL,
@ -86,6 +96,13 @@ export const updateCode = (identifier, inputValue, type) => {
}).then(res => {
// 是否更新了代码, 目的是当代码没有更新时不调用更新代码接口,目录没有实现
// TODO 需要优化
if (res.data.status === 401) {
dispatch({ // 改变 loading 值
type: types.LOADING_STATUS,
payload: false
});
return;
};
dispatch({
type: types.IS_UPDATE_CODE,
flag: false
@ -118,7 +135,7 @@ export const debuggerCode = (identifier,value, type) => {
payload: 'loading'
});
}
fetchDebuggerCode(identifier, value).then(res => {
// console.log('调用调试代码成功并返回结果: ', res);
const { status } = res;
@ -132,7 +149,13 @@ export const debuggerCode = (identifier,value, type) => {
* @param {*} count 执行次数
* @param {*} timer 定时器
*/
if (res.data.status === 401) {
dispatch({ // 改变 loading 值
type: types.LOADING_STATUS,
payload: false
});
return;
};
function getCodeSubmit (intervalTime, finalTime, count, timer){
const excuteTime = (count++) * intervalTime; // 当前执行时间
fetchCodeSubmit(identifier, { mode: type }).then(res => {
@ -241,6 +264,10 @@ export const getUserCommitRecordDetail = (identifier) => {
return (dispatch) => {
fetchUserCommitRecordDetail(identifier).then(res => {
console.log('提交记录详情======》》》》', res);
dispatch({
type: types.GET_COMMIT_RECORD_DETAIL_BY_ID,
payload: res.data
})
});
}
}
@ -280,6 +307,13 @@ export const submitUserCode = (identifier, inputValue, type) => {
fetchUserCodeSubmit(identifier).then(res => {
// console.log('用户提交代码成功======》》》》》', res);
if (res.status === 200) {
if (res.data.status === 401) {
dispatch({
type: types.SUBMIT_LOADING_STATUS,
payload: false
});
return;
};
dispatch(debuggerCode(identifier, inputValue, type || 'submit'));
}
}).catch(() => {
@ -295,6 +329,13 @@ export const submitUserCode = (identifier, inputValue, type) => {
}).then(res => {
// 是否更新了代码, 目的是当代码没有更新时不调用更新代码接口,目录没有实现
// TODO 需要优化
if (res.data.status === 401) {
dispatch({
type: types.SUBMIT_LOADING_STATUS,
payload: false
});
return;
};
dispatch({
type: types.IS_UPDATE_CODE,
flag: false
@ -312,10 +353,19 @@ export const submitUserCode = (identifier, inputValue, type) => {
}
}
// 恢复初始代码
export const restoreInitialCode = (identifier) => {
return (dispatch) => {
fetchRestoreInitialCode(identifier).then(res => {
if (res.data.status === 401) return;
console.log('恢复初始代码====》》》》', res);
const {status, data} = res;
if (status === 200) {
dispatch({
type: types.RESTORE_INITIAL_CODE,
payload: data.code
})
}
});
}
}

@ -4,7 +4,7 @@
* @Github:
* @Date: 2019-11-20 16:35:46
* @LastEditors: tangjiang
* @LastEditTime: 2019-12-02 19:22:58
* @LastEditTime: 2019-12-05 08:47:50
*/
import types from './actionTypes';
import CONST from '../../constants';
@ -83,7 +83,7 @@ const payloadInfo = (key, value, errMsg, validateInfo) => ({
export const validateOjForm = (props, type) => {
return (dispatch, getState) => {
const {ojForm, testCases, identifier, code } = getState().ojFormReducer;
console.log('code', code);
// console.log('code', code);
let keys = Object.keys(ojForm);
// 循环判断每个字段是否为空
let hasSuccess = true;
@ -125,13 +125,13 @@ export const validateOjForm = (props, type) => {
});
}
if (!code) {
hasSuccess = false;
notification['error']({
message: '必填',
description: '代码块内容必须输入!'
});
}
// if (!code) {
// hasSuccess = false;
// notification['error']({
// message: '必填',
// description: '代码块内容必须输入!'
// });
// }
// 更改测试用例验证结果
dispatch({
type: types.UPDATE_TEST_AND_VALIDATE,
@ -219,24 +219,33 @@ export const validateOjForm = (props, type) => {
if (res.status === 200) { // 保存成功后,重新跳转至列表页
const {identifier} = res.data
if (type === 'publish') { // 存在发布时,直接调用发布接口
identifier && publishTask(identifier).then(res => {
if (res.status === 200) {
message.success('发布成功!');
linkToDev();
}
dispatch({
type: types.PUBLISH_LOADING_STATUS,
payload: false
if (identifier) {
publishTask(identifier).then(res => {
if (res.data.status === 0) {
message.success('发布成功!');
linkToDev();
}
dispatch({
type: types.PUBLISH_LOADING_STATUS,
payload: false
});
}).catch(() => {
dispatch({
type: types.PUBLISH_LOADING_STATUS,
payload: false
});
});
}).catch(() => {
} else {
dispatch({
type: types.PUBLISH_LOADING_STATUS,
payload: false
});
});
}
} else {
message.success('保存成功!');
linkToDev();
if (res.data.identifier) {
message.success('保存成功!');
linkToDev();
}
dispatch({
type: types.SUBMIT_LOADING_STATUS,
payload: false

@ -4,7 +4,7 @@
* @Github:
* @Date: 2019-11-27 13:41:48
* @LastEditors: tangjiang
* @LastEditTime: 2019-12-04 09:02:30
* @LastEditTime: 2019-12-05 13:37:17
*/
import types from "../actions/actionTypes";
import { Base64 } from 'js-base64';
@ -23,6 +23,7 @@ const initialState = {
};
const ojForUserReducer = (state = initialState, action) => {
let tempDetail = null;
switch (action.type) {
case types.SAVE_USER_PROGRAM_ID:
return {
@ -80,9 +81,33 @@ const ojForUserReducer = (state = initialState, action) => {
userCodeTab: action.payload
}
case types.GET_COMMIT_RECORD_DETAIL_BY_ID:
tempDetail = action.payload;
if (tempDetail['error_msg']) {
tempDetail['error_msg'] = Base64.decode(tempDetail['error_msg']);
}
if (tempDetail['expected_output']) {
tempDetail['expected_output'] = Base64.decode(tempDetail['expected_output']);
}
if (tempDetail['output']) {
tempDetail['output'] = Base64.decode(tempDetail['output']);
}
if (tempDetail['code']) {
tempDetail['code'] = Base64.decode(tempDetail['code']);
}
return {
...state,
recordDetail: tempDetail
}
case types.RESTORE_INITIAL_CODE:
const curHack = state.hack;
let restoreCode = action.payload
if (restoreCode) {
curHack['code'] = Base64.decode(restoreCode);
}
console.log('当前的代码内容:', curHack);
return {
...state,
recordDetail: action.payload
hack: Object.assign({}, curHack)
}
default:
return state;

@ -4,7 +4,7 @@
* @Github:
* @Date: 2019-11-20 16:40:32
* @LastEditors: tangjiang
* @LastEditTime: 2019-12-04 15:36:26
* @LastEditTime: 2019-12-05 09:35:29
*/
import { Base64 } from 'js-base64';
import types from '../actions/actionTypes';
@ -262,12 +262,18 @@ const ojFormReducer = (state = initialState, action) => {
}
case types.UPDATE_TEST_AND_VALIDATE: // 保存或更新测试用例值
const tempValitate = action.payload.testCaseValidate;
const openColArrs = [];
const curOjTestCaseValidate = state.testCasesValidate.map((tc, i) => {
if (tempValitate[i].input.errMsg || tempValitate[i].output.errMsg) {
openColArrs.push(i);
}
return Object.assign({}, tc, tempValitate[i]);
});
// console.log('+++++++++++', openColArrs);
return {
...state,
testCasesValidate: [...curOjTestCaseValidate]
testCasesValidate: [...curOjTestCaseValidate],
openTestCodeIndex: openColArrs
}
case types.UPDATE_OPEN_TESTCASE_INDEX:
const tempArr = [];

@ -4,7 +4,7 @@
* @Github:
* @Date: 2019-11-20 10:55:38
* @LastEditors: tangjiang
* @LastEditTime: 2019-12-04 10:53:41
* @LastEditTime: 2019-12-04 18:05:10
*/
import axios from 'axios';
@ -73,7 +73,6 @@ export async function fetchUserCommitRecord (identifier) {
// 获取提交记录详情
export async function fetchUserCommitRecordDetail (identifier) {
const url = `/myproblems/record_detail.json`;
debugger;
const params = {id: identifier};
return axios.get(url, {params});
}

Loading…
Cancel
Save