|
|
|
@ -4,7 +4,7 @@
|
|
|
|
|
* @Github:
|
|
|
|
|
* @Date: 2019-11-27 09:49:33
|
|
|
|
|
* @LastEditors : tangjiang
|
|
|
|
|
* @LastEditTime : 2019-12-27 22:40:32
|
|
|
|
|
* @LastEditTime : 2020-01-09 14:06:34
|
|
|
|
|
*/
|
|
|
|
|
import './index.scss';
|
|
|
|
|
import React, { useState, useEffect } from 'react';
|
|
|
|
@ -86,24 +86,14 @@ const CommitRecord = (props) => {
|
|
|
|
|
// 复制面板
|
|
|
|
|
let clipboard;
|
|
|
|
|
// const [recordDetail, setRecordDetail] = useState({});
|
|
|
|
|
const [renderCtx, setRenderCtx] = useState(() => {
|
|
|
|
|
return function () {
|
|
|
|
|
return '';
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
// const [renderCtx, setRenderCtx] = useState(() => {
|
|
|
|
|
// return function () {
|
|
|
|
|
// return '';
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
// 渲染提交记录详情
|
|
|
|
|
const renderRecordDetail = () => {
|
|
|
|
|
const {
|
|
|
|
|
id,
|
|
|
|
|
// error_line,
|
|
|
|
|
error_msg,
|
|
|
|
|
// execute_memory,
|
|
|
|
|
// execute_time,
|
|
|
|
|
// input,
|
|
|
|
|
// output,
|
|
|
|
|
status,
|
|
|
|
|
// expected_output
|
|
|
|
|
} = commitRecordDetail;
|
|
|
|
|
const renderRecordDetail = (commitRecordDetail = {}) => {
|
|
|
|
|
const {id, status} = commitRecordDetail;
|
|
|
|
|
if (Object.keys(commitRecordDetail).length > 0) {
|
|
|
|
|
// console.log('当前状态====》》》', status);
|
|
|
|
|
const classes = status === 0 ? 'record_result_suc' : 'record_result_err';
|
|
|
|
@ -150,17 +140,25 @@ const CommitRecord = (props) => {
|
|
|
|
|
// // setPagination(pageConfig);
|
|
|
|
|
// }, [commitRecord]);
|
|
|
|
|
// 提交详情变化时,显示当前提交信息
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
// setRecordDetail(commitRecordDetail);
|
|
|
|
|
if (operateType === 'submit') {
|
|
|
|
|
setRenderCtx(() => (renderRecordDetail))
|
|
|
|
|
}
|
|
|
|
|
}, [commitRecordDetail, operateType]);
|
|
|
|
|
// useEffect(() => {
|
|
|
|
|
// // setRecordDetail(commitRecordDetail);
|
|
|
|
|
// if (operateType === 'submit') {
|
|
|
|
|
// setRenderCtx(() => (renderRecordDetail))
|
|
|
|
|
// }
|
|
|
|
|
// }, [commitRecordDetail, operateType]);
|
|
|
|
|
// 复制功能
|
|
|
|
|
let count = 0;
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
clipboard = new ClipboardJS('#copyError');
|
|
|
|
|
clipboard && clipboard.on('success', (e) => {
|
|
|
|
|
// useEffect(() => {
|
|
|
|
|
|
|
|
|
|
// }, []);
|
|
|
|
|
|
|
|
|
|
const clickCopyErrInfo = () => {
|
|
|
|
|
count = 0;
|
|
|
|
|
if (!clipboard) {
|
|
|
|
|
console.log('==========>>>>>>>', 11111111111);
|
|
|
|
|
clipboard = new ClipboardJS('#copyError');
|
|
|
|
|
}
|
|
|
|
|
clipboard.on('success', (e) => {
|
|
|
|
|
e.clearSelection();
|
|
|
|
|
if (count > 0) return;
|
|
|
|
|
count++;
|
|
|
|
@ -169,26 +167,7 @@ const CommitRecord = (props) => {
|
|
|
|
|
message.destroy();
|
|
|
|
|
}, 3000);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return () => {
|
|
|
|
|
clipboard = null;
|
|
|
|
|
}
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
const clickCopyErrInfo = () => {
|
|
|
|
|
count = 0;
|
|
|
|
|
}
|
|
|
|
|
// if (commitRecordDetail.status !== 0) {
|
|
|
|
|
// clipboard.on('success', (e) => {
|
|
|
|
|
// console.log('成功=====》》》》》');
|
|
|
|
|
// message.success('复制成功');
|
|
|
|
|
// e.clearSelection();
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// const handleTableChange = (pagination) => {
|
|
|
|
|
// setPagination(Object.assign({}, pagination));
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
const handlePaginationChange = (page) => {
|
|
|
|
|
setCurrent(page);
|
|
|
|
@ -204,9 +183,53 @@ const CommitRecord = (props) => {
|
|
|
|
|
display: pages.total > pages.limit ? 'block' : 'none'
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const {status, id} = commitRecordDetail || {};
|
|
|
|
|
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`;
|
|
|
|
|
|
|
|
|
|
// if (!clipboard) {
|
|
|
|
|
// console.log('==========>>>>>>>', 11111111111);
|
|
|
|
|
// clipboard = new ClipboardJS('#copyError');
|
|
|
|
|
// }
|
|
|
|
|
// clipboard.on('success', (e) => {
|
|
|
|
|
// e.clearSelection();
|
|
|
|
|
// // if (count > 0) return;
|
|
|
|
|
// // count++;
|
|
|
|
|
// message.success('复制成功');
|
|
|
|
|
// setTimeout(() => {
|
|
|
|
|
// message.destroy();
|
|
|
|
|
// }, 3000);
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
// return () => {
|
|
|
|
|
// clipboard = null;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className={'commit_record_area'}>
|
|
|
|
|
{renderCtx()}
|
|
|
|
|
{renderRecordDetail(commitRecordDetail)}
|
|
|
|
|
{/* <div className={'record_header'}>
|
|
|
|
|
<p className={'record_result'}>
|
|
|
|
|
执行结果: <span className={classes}>{reviewResult[status]}</span>
|
|
|
|
|
</p>
|
|
|
|
|
<p
|
|
|
|
|
id="copyError"
|
|
|
|
|
onClick={clickCopyErrInfo}
|
|
|
|
|
className={showErrorCopy} data-clipboard-target="#errcode">
|
|
|
|
|
<span>
|
|
|
|
|
复制错误信息 <Icon type="copy" className={'icon_style'}/>
|
|
|
|
|
</span>
|
|
|
|
|
</p>
|
|
|
|
|
<p className={'show_detail'} style={{ visibility: id ? 'visible' : 'hidden' }}>
|
|
|
|
|
<Link to={`/myproblems/record_detail/${id}`}>
|
|
|
|
|
显示详情 <Icon type="right" className={'icon_style'}/>
|
|
|
|
|
</Link>
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div id="errcode" className={showErrorCode}>
|
|
|
|
|
<ErrorResult detail={commitRecordDetail} language={language}/>
|
|
|
|
|
</div> */}
|
|
|
|
|
<div className="commit_record_table_pagination">
|
|
|
|
|
<Table
|
|
|
|
|
columns={columns}
|
|
|
|
|