|
|
@ -4,11 +4,11 @@
|
|
|
|
* @Github:
|
|
|
|
* @Github:
|
|
|
|
* @Date: 2019-11-27 09:49:33
|
|
|
|
* @Date: 2019-11-27 09:49:33
|
|
|
|
* @LastEditors : tangjiang
|
|
|
|
* @LastEditors : tangjiang
|
|
|
|
* @LastEditTime: 2019-12-20 19:35:01
|
|
|
|
* @LastEditTime : 2019-12-25 14:45:20
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
import './index.scss';
|
|
|
|
import './index.scss';
|
|
|
|
import React, { useState, useEffect } from 'react';
|
|
|
|
import React, { useState, useEffect } from 'react';
|
|
|
|
import { Table, Icon, message } from 'antd';
|
|
|
|
import { Table, Icon, message, Pagination } from 'antd';
|
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import { Link } from 'react-router-dom';
|
|
|
|
import { Link } from 'react-router-dom';
|
|
|
|
import actions from '../../../../../redux/actions';
|
|
|
|
import actions from '../../../../../redux/actions';
|
|
|
@ -20,6 +20,7 @@ import ErrorResult from '../../../components/errorResult';
|
|
|
|
const numberal = require('numeral');
|
|
|
|
const numberal = require('numeral');
|
|
|
|
|
|
|
|
|
|
|
|
const {reviewResult} = CONST;
|
|
|
|
const {reviewResult} = CONST;
|
|
|
|
|
|
|
|
// 表格列
|
|
|
|
const columns = [
|
|
|
|
const columns = [
|
|
|
|
{
|
|
|
|
{
|
|
|
|
title: '提交时间',
|
|
|
|
title: '提交时间',
|
|
|
@ -60,29 +61,30 @@ const columns = [
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
const paginationConfig = {
|
|
|
|
// const paginationConfig = {
|
|
|
|
total: 1, // 总条数
|
|
|
|
// total: 1, // 总条数
|
|
|
|
pageSize: 10, // 每页显示条数
|
|
|
|
// pageSize: 5, // 每页显示条数
|
|
|
|
current: 1, // 当前页数
|
|
|
|
// current: 1, // 当前页数
|
|
|
|
showQuickJumper: true
|
|
|
|
// showQuickJumper: true
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
const CommitRecord = (props) => {
|
|
|
|
const CommitRecord = (props) => {
|
|
|
|
|
|
|
|
|
|
|
|
const {
|
|
|
|
const {
|
|
|
|
identifier,
|
|
|
|
identifier,
|
|
|
|
|
|
|
|
pages,
|
|
|
|
commitRecord,
|
|
|
|
commitRecord,
|
|
|
|
// excuteState,
|
|
|
|
// excuteState,
|
|
|
|
language,
|
|
|
|
language,
|
|
|
|
operateType,
|
|
|
|
operateType,
|
|
|
|
commitRecordDetail,
|
|
|
|
commitRecordDetail,
|
|
|
|
getUserCommitRecord
|
|
|
|
getUserCommitRecord,
|
|
|
|
|
|
|
|
changeRecordPagination
|
|
|
|
} = props;
|
|
|
|
} = props;
|
|
|
|
|
|
|
|
|
|
|
|
const [pagination, setPagination] = useState(paginationConfig);
|
|
|
|
const [current, setCurrent] = useState(1);
|
|
|
|
const [tableData, setTableData] = useState([]);
|
|
|
|
// const [pagination, setPagination] = useState(paginationConfig);
|
|
|
|
|
|
|
|
// const [tableData, setTableData] = useState([]);
|
|
|
|
|
|
|
|
// 复制面板
|
|
|
|
let clipboard;
|
|
|
|
let clipboard;
|
|
|
|
|
|
|
|
|
|
|
|
// const [recordDetail, setRecordDetail] = useState({});
|
|
|
|
// const [recordDetail, setRecordDetail] = useState({});
|
|
|
|
const [renderCtx, setRenderCtx] = useState(() => {
|
|
|
|
const [renderCtx, setRenderCtx] = useState(() => {
|
|
|
|
return function () {
|
|
|
|
return function () {
|
|
|
@ -140,12 +142,12 @@ const CommitRecord = (props) => {
|
|
|
|
getUserCommitRecord(identifier);
|
|
|
|
getUserCommitRecord(identifier);
|
|
|
|
}, []);
|
|
|
|
}, []);
|
|
|
|
// 提交记录变化时,同步到表单数据
|
|
|
|
// 提交记录变化时,同步到表单数据
|
|
|
|
useEffect(() => {
|
|
|
|
// useEffect(() => {
|
|
|
|
const len = commitRecord.length;
|
|
|
|
// // const len = commitRecord.length;
|
|
|
|
const pageConfig = Object.assign({}, paginationConfig, {total: len});
|
|
|
|
// // const pageConfig = Object.assign({}, paginationConfig, {total: len});
|
|
|
|
setTableData(commitRecord);
|
|
|
|
// setTableData(commitRecord);
|
|
|
|
setPagination(pageConfig);
|
|
|
|
// // setPagination(pageConfig);
|
|
|
|
}, [commitRecord]);
|
|
|
|
// }, [commitRecord]);
|
|
|
|
// 提交详情变化时,显示当前提交信息
|
|
|
|
// 提交详情变化时,显示当前提交信息
|
|
|
|
useEffect(() => {
|
|
|
|
useEffect(() => {
|
|
|
|
// setRecordDetail(commitRecordDetail);
|
|
|
|
// setRecordDetail(commitRecordDetail);
|
|
|
@ -179,21 +181,47 @@ const CommitRecord = (props) => {
|
|
|
|
// });
|
|
|
|
// });
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
//
|
|
|
|
const handleTableChange = (pagination) => {
|
|
|
|
// const handleTableChange = (pagination) => {
|
|
|
|
setPagination(Object.assign({}, pagination));
|
|
|
|
// setPagination(Object.assign({}, pagination));
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const handlePaginationChange = (page) => {
|
|
|
|
|
|
|
|
setCurrent(page);
|
|
|
|
|
|
|
|
changeRecordPagination(page);
|
|
|
|
|
|
|
|
// 调用查询接口
|
|
|
|
|
|
|
|
getUserCommitRecord(identifier);
|
|
|
|
|
|
|
|
// setPagination(Object.assign({}, pagination, { current: page}));
|
|
|
|
|
|
|
|
// console.log('======>>>>>>', pagination)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// console.log(commitRecord);
|
|
|
|
// console.log(commitRecord);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const _style = {
|
|
|
|
|
|
|
|
display: pages.total > pages.limit ? 'block' : 'none'
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<div className={'commit_record_area'}>
|
|
|
|
<div className={'commit_record_area'}>
|
|
|
|
{renderCtx()}
|
|
|
|
{renderCtx()}
|
|
|
|
|
|
|
|
<div className="commit_record_table_pagination">
|
|
|
|
<Table
|
|
|
|
<Table
|
|
|
|
columns={columns}
|
|
|
|
columns={columns}
|
|
|
|
rowKey={function (record) { return `key_${record.id}`}}
|
|
|
|
rowKey={function (record) { return `key_${record.id}`}}
|
|
|
|
dataSource={tableData}
|
|
|
|
dataSource={commitRecord}
|
|
|
|
pagination={pagination}
|
|
|
|
// pagination={pagination}
|
|
|
|
onChange={handleTableChange}
|
|
|
|
// onChange={handleTableChange}
|
|
|
|
|
|
|
|
pagination={false}
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
<div className="commit_record_pagination" style={_style}>
|
|
|
|
|
|
|
|
<Pagination
|
|
|
|
|
|
|
|
showQuickJumper
|
|
|
|
|
|
|
|
pageSize={pages.limit}
|
|
|
|
|
|
|
|
current={current}
|
|
|
|
|
|
|
|
total={pages.total}
|
|
|
|
|
|
|
|
onChange={handlePaginationChange}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -207,7 +235,8 @@ const mapStateToProps = (state) => {
|
|
|
|
commitRecordDetail,
|
|
|
|
commitRecordDetail,
|
|
|
|
commitRecord,
|
|
|
|
commitRecord,
|
|
|
|
hack,
|
|
|
|
hack,
|
|
|
|
operateType
|
|
|
|
operateType,
|
|
|
|
|
|
|
|
pages
|
|
|
|
} = ojForUserReducer;
|
|
|
|
} = ojForUserReducer;
|
|
|
|
const { excuteState } = commonReducer;
|
|
|
|
const { excuteState } = commonReducer;
|
|
|
|
return {
|
|
|
|
return {
|
|
|
@ -216,11 +245,13 @@ const mapStateToProps = (state) => {
|
|
|
|
commitRecord, // 提交记录
|
|
|
|
commitRecord, // 提交记录
|
|
|
|
excuteState, // 代码执行状态
|
|
|
|
excuteState, // 代码执行状态
|
|
|
|
language: hack.language,
|
|
|
|
language: hack.language,
|
|
|
|
operateType
|
|
|
|
operateType,
|
|
|
|
|
|
|
|
pages
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const mapDispatchToProps = (dispatch) => ({
|
|
|
|
const mapDispatchToProps = (dispatch) => ({
|
|
|
|
getUserCommitRecord: (identifier) => dispatch(actions.getUserCommitRecord(identifier))
|
|
|
|
getUserCommitRecord: (identifier) => dispatch(actions.getUserCommitRecord(identifier)),
|
|
|
|
|
|
|
|
changeRecordPagination: (page) => dispatch(actions.changeRecordPagination(page))
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
export default connect(
|
|
|
|
export default connect(
|
|
|
|