From 7af09e42b49cd18f160c19297f47c4622b1eedc3 Mon Sep 17 00:00:00 2001
From: liyj <1003249715@qq.com>
Date: Wed, 24 Jun 2020 17:14:37 +0800
Subject: [PATCH] ...
---
src/components/common/TopListTableView/index.jsx | 44 +++++++++++++++++++++++++++++++-------------
1 files changed, 31 insertions(+), 13 deletions(-)
diff --git a/src/components/common/TopListTableView/index.jsx b/src/components/common/TopListTableView/index.jsx
index 6adcb29..69f34c1 100644
--- a/src/components/common/TopListTableView/index.jsx
+++ b/src/components/common/TopListTableView/index.jsx
@@ -7,6 +7,9 @@
/** 榜单table列表 */
import React, { ReactNode, ReactEventHandler, Component } from 'react';
import { Table, Row, Col } from 'antd';
+import { tagList, tag } from './tagList';
+import fetch from '../../../api/request';
+
import './index.scss';
@@ -16,23 +19,38 @@
this.config = {
};
this.state = {
+ topList: []
};
}
- componentWillMount() { }
+ componentWillMount() {
+ fetch({
+ url: `api/merits/queryMerits`
+ }).then(res => {
+ if( res) {
+ this.setState({
+ topList: [
+ { ...tag['latenessRanking'], dataSource: res['latenessRanking'] },
+ { ...tag['earlyRanking'], dataSource: res['earlyRanking'] },
+ { ...tag['meritsRanking'], dataSource: res['meritsRanking'] },
+ { ...tag['defectRanking'], dataSource: res['defectRanking'] },
+ ]
+ })
+ }
+ })
+ }
componentDidMount() { }
- renderDom = () => {
- return <div className="top-list-table-view-main-table">
- <div className="top-list-table-view-main-table-title">主题</div>
+ renderDom = ({ name, columns, dataSource }) => {
+ return <div className="top-list-table-view-main-table h-100">
+ <div className="top-list-table-view-main-table-title">{name}
+ {/* <span className="top-list-table-view-main-table-title-fuc">查看</span> */}
+ </div>
<Table
- dataSource={[{ age: 1 }]}
- columns={[{
- title: '年龄',
- dataIndex: 'age',
- key: 'age'
- }]}
+ scroll={{ y: 130 }}
+ dataSource={dataSource ? dataSource.map((a, idx) => ({ ...a, key: idx })) : []}
+ columns={columns}
size="small"
bordered={false}
pagination={false}
@@ -41,13 +59,13 @@
}
render() {
-
+ let { topList } = this.state;
return (
<div className="top-list-table-view-main">
<Row type="flex" gutter={12}>
{
- [1, 2, 3].map((item, idx) => {
- return <Col span={24 / 3} key={idx}>{this.renderDom()}</Col>;
+ topList.map((item, idx) => {
+ return <Col span={24 / topList.length} key={idx} >{this.renderDom(item)}</Col>;
})
}
</Row>
--
Gitblit v1.8.0