|
@@ -1,5 +1,5 @@
|
|
import React from 'react';
|
|
import React from 'react';
|
|
-import { Icon, Button, Spin, message, Table, Input, Modal, DatePicker, Upload, Select } from 'antd';
|
|
|
|
|
|
+import { Icon, Button, Spin, message, Table, Input, Modal, DatePicker, Upload, Select, Pagination } from 'antd';
|
|
import { beforeUpload, getBase64 } from '../../../tools';
|
|
import { beforeUpload, getBase64 } from '../../../tools';
|
|
import moment from 'moment';
|
|
import moment from 'moment';
|
|
import ajax from 'jquery/src/ajax/xhr.js';
|
|
import ajax from 'jquery/src/ajax/xhr.js';
|
|
@@ -61,13 +61,13 @@ const Lecture = React.createClass({
|
|
},
|
|
},
|
|
success: function (data) {
|
|
success: function (data) {
|
|
let theArr = [];
|
|
let theArr = [];
|
|
- if (!data.data) {
|
|
|
|
|
|
+ if (!data.data || !data.data.list) {
|
|
if (data.error && data.error.length) {
|
|
if (data.error && data.error.length) {
|
|
message.warning(data.error[0].message);
|
|
message.warning(data.error[0].message);
|
|
};
|
|
};
|
|
} else {
|
|
} else {
|
|
- for (let i = 0; i < data.data.length; i++) {
|
|
|
|
- let thisdata = data.data[i];
|
|
|
|
|
|
+ for (let i = 0; i < data.data.list.length; i++) {
|
|
|
|
+ let thisdata = data.data.list[i];
|
|
theArr.push({
|
|
theArr.push({
|
|
key: i,
|
|
key: i,
|
|
id: thisdata.id, //主键
|
|
id: thisdata.id, //主键
|
|
@@ -81,8 +81,8 @@ const Lecture = React.createClass({
|
|
endDate: thisdata.endDate //广告图结束时间
|
|
endDate: thisdata.endDate //广告图结束时间
|
|
});
|
|
});
|
|
};
|
|
};
|
|
- this.state.pagination.current = data.data.pageNo;
|
|
|
|
- this.state.pagination.total = data.data.totalCount;
|
|
|
|
|
|
+ this.state.pagination.pageNo = pageNo || 1;
|
|
|
|
+ this.state.pagination.total = data.data.total || 0;
|
|
};
|
|
};
|
|
this.setState({
|
|
this.setState({
|
|
tableData: theArr,
|
|
tableData: theArr,
|
|
@@ -137,16 +137,9 @@ const Lecture = React.createClass({
|
|
keysObj: {},
|
|
keysObj: {},
|
|
RowData: {},
|
|
RowData: {},
|
|
pagination: {
|
|
pagination: {
|
|
- defaultCurrent: 1,
|
|
|
|
- defaultPageSize: 10,
|
|
|
|
- showQuickJumper: true,
|
|
|
|
|
|
+ pageNo: 1,
|
|
pageSize: 10,
|
|
pageSize: 10,
|
|
- onChange: function (page) {
|
|
|
|
- this.loadData(page);
|
|
|
|
- }.bind(this),
|
|
|
|
- showTotal: function (total) {
|
|
|
|
- return '共' + total + '条数据';
|
|
|
|
- }
|
|
|
|
|
|
+ total: 0
|
|
},
|
|
},
|
|
columns: [
|
|
columns: [
|
|
{
|
|
{
|
|
@@ -316,6 +309,7 @@ const Lecture = React.createClass({
|
|
}
|
|
}
|
|
};
|
|
};
|
|
const hasSelected = this.state.selectedRowKeys.length > 0;
|
|
const hasSelected = this.state.selectedRowKeys.length > 0;
|
|
|
|
+ const { pageNo, pageSize, total } = this.state.pagination;
|
|
return (
|
|
return (
|
|
<div className="admin-content" >
|
|
<div className="admin-content" >
|
|
<div className="admin-content-title">广告图管理</div>
|
|
<div className="admin-content-title">广告图管理</div>
|
|
@@ -342,9 +336,17 @@ const Lecture = React.createClass({
|
|
<Spin spinning={this.state.loading}>
|
|
<Spin spinning={this.state.loading}>
|
|
<Table className="no-all-select" columns={this.state.columns}
|
|
<Table className="no-all-select" columns={this.state.columns}
|
|
dataSource={this.state.tableData}
|
|
dataSource={this.state.tableData}
|
|
- pagination={this.state.pagination}
|
|
|
|
|
|
+ pagination={false}
|
|
rowSelection={rowSelection}
|
|
rowSelection={rowSelection}
|
|
onRowClick={this.tableRowClick} />
|
|
onRowClick={this.tableRowClick} />
|
|
|
|
+ <div className="clearfix">
|
|
|
|
+ <Pagination style={{ marginTop: '10px', float: 'right' }}
|
|
|
|
+ onChange={(e) => { this.loadData(e); }}
|
|
|
|
+ total={total}
|
|
|
|
+ showTotal={() => { return '共' + total + '条数据' }}
|
|
|
|
+ current={pageNo}
|
|
|
|
+ pageSize={pageSize} />
|
|
|
|
+ </div>
|
|
</Spin>
|
|
</Spin>
|
|
</div>
|
|
</div>
|
|
<Modal title="广告图详情" width={1000}
|
|
<Modal title="广告图详情" width={1000}
|