|
|
|
@ -19,7 +19,7 @@ import ErrorResult from '../../../components/errorResult';
|
|
|
|
|
|
|
|
|
|
const numberal = require('numeral');
|
|
|
|
|
|
|
|
|
|
const {reviewResult} = CONST;
|
|
|
|
|
const { reviewResult } = CONST;
|
|
|
|
|
// 表格列
|
|
|
|
|
const columns = [
|
|
|
|
|
{
|
|
|
|
@ -35,7 +35,7 @@ const columns = [
|
|
|
|
|
dataIndex: 'status',
|
|
|
|
|
render: (value, record) => (
|
|
|
|
|
<Link to={`/myproblems/record_detail/${record.id}`}>
|
|
|
|
|
<span style={{ color: value === 0 ? '#28BD8B' : '#E6262E'}}>{reviewResult[value]}</span>
|
|
|
|
|
<span style={{ color: value === 0 ? '#28BD8B' : '#E6262E' }}>{reviewResult[value]}</span>
|
|
|
|
|
</Link>
|
|
|
|
|
)
|
|
|
|
|
},
|
|
|
|
@ -72,28 +72,18 @@ const CommitRecord = (props) => {
|
|
|
|
|
identifier,
|
|
|
|
|
pages,
|
|
|
|
|
commitRecord,
|
|
|
|
|
// excuteState,
|
|
|
|
|
language,
|
|
|
|
|
operateType,
|
|
|
|
|
commitRecordDetail,
|
|
|
|
|
getUserCommitRecord,
|
|
|
|
|
changeRecordPagination
|
|
|
|
|
} = props;
|
|
|
|
|
|
|
|
|
|
const [current, setCurrent] = useState(1);
|
|
|
|
|
// const [pagination, setPagination] = useState(paginationConfig);
|
|
|
|
|
// const [tableData, setTableData] = useState([]);
|
|
|
|
|
const [current, setCurrent] = useState(pages.page);
|
|
|
|
|
// 复制面板
|
|
|
|
|
let clipboard;
|
|
|
|
|
// const [recordDetail, setRecordDetail] = useState({});
|
|
|
|
|
// const [renderCtx, setRenderCtx] = useState(() => {
|
|
|
|
|
// return function () {
|
|
|
|
|
// return '';
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
// 渲染提交记录详情
|
|
|
|
|
const renderRecordDetail = (commitRecordDetail = {}) => {
|
|
|
|
|
const {id, status} = commitRecordDetail;
|
|
|
|
|
const { id, status } = commitRecordDetail;
|
|
|
|
|
if (Object.keys(commitRecordDetail).length > 0) {
|
|
|
|
|
// console.log('当前状态====》》》', status);
|
|
|
|
|
const classes = status === 0 ? 'record_result_suc' : 'record_result_err';
|
|
|
|
@ -105,22 +95,22 @@ const CommitRecord = (props) => {
|
|
|
|
|
<p className={'record_result'}>
|
|
|
|
|
执行结果: <span className={classes}>{reviewResult[status]}</span>
|
|
|
|
|
</p>
|
|
|
|
|
<p
|
|
|
|
|
<p
|
|
|
|
|
id="copyError"
|
|
|
|
|
onClick={clickCopyErrInfo}
|
|
|
|
|
className={showErrorCopy} data-clipboard-target="#errcode">
|
|
|
|
|
<span>
|
|
|
|
|
复制错误信息 <Icon type="copy" className={'icon_style'}/>
|
|
|
|
|
复制错误信息 <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'}/>
|
|
|
|
|
显示详情 <Icon type="right" className={'icon_style'} />
|
|
|
|
|
</Link>
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div id="errcode" className={showErrorCode}>
|
|
|
|
|
<ErrorResult detail={commitRecordDetail} language={language}/>
|
|
|
|
|
<ErrorResult detail={commitRecordDetail} language={language} />
|
|
|
|
|
</div>
|
|
|
|
|
</React.Fragment>
|
|
|
|
|
);
|
|
|
|
@ -131,7 +121,7 @@ const CommitRecord = (props) => {
|
|
|
|
|
// 根据id获取用户提交记录
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
getUserCommitRecord(identifier);
|
|
|
|
|
}, []);
|
|
|
|
|
}, [identifier]);
|
|
|
|
|
// 提交记录变化时,同步到表单数据
|
|
|
|
|
// useEffect(() => {
|
|
|
|
|
// // const len = commitRecord.length;
|
|
|
|
@ -149,9 +139,9 @@ const CommitRecord = (props) => {
|
|
|
|
|
// 复制功能
|
|
|
|
|
let count = 0;
|
|
|
|
|
// useEffect(() => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// }, []);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const clickCopyErrInfo = () => {
|
|
|
|
|
count = 0;
|
|
|
|
|
if (!clipboard) {
|
|
|
|
@ -174,76 +164,27 @@ const CommitRecord = (props) => {
|
|
|
|
|
changeRecordPagination(page);
|
|
|
|
|
// 调用查询接口
|
|
|
|
|
getUserCommitRecord(identifier);
|
|
|
|
|
// setPagination(Object.assign({}, pagination, { current: page}));
|
|
|
|
|
// console.log('======>>>>>>', pagination)
|
|
|
|
|
}
|
|
|
|
|
// console.log(commitRecord);
|
|
|
|
|
|
|
|
|
|
const _style = {
|
|
|
|
|
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'}>
|
|
|
|
|
{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
|
|
|
|
|
<Table
|
|
|
|
|
columns={columns}
|
|
|
|
|
rowKey={function (record) { return `key_${record.id}`}}
|
|
|
|
|
rowKey={function (record) { return `key_${record.id}` }}
|
|
|
|
|
dataSource={commitRecord}
|
|
|
|
|
// pagination={pagination}
|
|
|
|
|
// onChange={handleTableChange}
|
|
|
|
|
pagination={false}
|
|
|
|
|
/>
|
|
|
|
|
<div className="commit_record_pagination" style={_style}>
|
|
|
|
|
<Pagination
|
|
|
|
|
<Pagination
|
|
|
|
|
showQuickJumper
|
|
|
|
|
pageSize={pages.limit}
|
|
|
|
|
current={current}
|
|
|
|
|
current={current}
|
|
|
|
|
total={pages.total}
|
|
|
|
|
onChange={handlePaginationChange}
|
|
|
|
|
/>
|
|
|
|
|