-1){
- // console.log( childNodes[i].className.splice);
- let className = childNodes[j].className;
- className = className.split('');
- className.splice(i,6);
- childNodes[j].className = className.join('');
- }
- }
- e.className = e.className + ' active';
+ getLogData(e){
+ // page,size,logId
+ // console.log(e.key);
+ this.setState({
+ selectedKeys: +e.key
+ })
+ const that = this;
+ this.props.setLoading(true);
+ this.props.fetchNewsData(+e.key).then(function(){
+ that.props.setLoading(false);
+ })
}
render () {
return (
-
- {/*- 全部消息
*/}
- - 未读消息
- - 已读消息
-
+
+
日志类型
+
+
)
}
}
diff --git a/client/containers/News/NewsTimeline/NewsTimeline.js b/client/containers/News/NewsTimeline/NewsTimeline.js
index ee9e9139..953bc55e 100644
--- a/client/containers/News/NewsTimeline/NewsTimeline.js
+++ b/client/containers/News/NewsTimeline/NewsTimeline.js
@@ -1,5 +1,5 @@
import React, { Component } from 'react'
-import { Table, Icon, Popconfirm } from 'antd'
+import { Table, Popconfirm } from 'antd'
import PropTypes from 'prop-types'
import { connect } from 'react-redux'
import { fetchMoreNews } from '../../../actions/news.js'
@@ -20,25 +20,39 @@ const removeConfirm = function(e){
class NewsTimeline extends Component {
static propTypes = {
- newsData: PropTypes.array,
- fetchMoreNews: PropTypes.func
+ newsData: PropTypes.object,
+ fetchMoreNews: PropTypes.func,
+ setLoading: PropTypes.func,
+ loading: PropTypes.bool
}
constructor(props) {
super(props);
+ this.state = {
+ pagination: {
+ pageSize: 10,
+ total: 34
+ }
+ };
}
- removeOneNews(id){
- return ()=>{
- console.log(id);
- }
+
+ handleChange(pagination){
+ const pager = { ...this.state.pagination };
+ pager.current = pagination.current;
+ this.props.setLoading(true);
+ const that = this;
+ this.props.fetchMoreNews(pagination.current,pagination.pageSize).then(function(){
+ that.props.setLoading(false);
+ })
}
render () {
const columns = [
- { title: '类型',width:100, dataIndex: 'type', key: 'type' },
- { title: '消息', dataIndex: 'news', key: 'news' },
- { title: '发布时间',width:150, dataIndex: 'time', key: 'time' }
+ { title: '操作用户',width:100, dataIndex: 'username', key: 'username' },
+ { title: '日志标题',width: 200, dataIndex: 'title', key: 'title' },
+ { title: '具体改动描述', dataIndex: 'content', key: 'content' },
+ { title: '时间',width: 150, dataIndex: 'time', key: 'time' }
];
- const data = this.props.newsData;
+ const data = this.props.newsData.newsList;
return (
@@ -47,9 +61,12 @@ class NewsTimeline extends Component {
}
+ expandedRowRender={record => }
dataSource={data}
+ pagination={{...this.state.pagination,total:this.props.newsData.totalPage}}
+ onChange={this.handleChange.bind(this)}
/>
)
diff --git a/client/reducer/news/news.js b/client/reducer/news/news.js
index 4a27c566..3762f200 100644
--- a/client/reducer/news/news.js
+++ b/client/reducer/news/news.js
@@ -4,22 +4,24 @@ import {
} from '../../constants/action-types.js'
const initialState = {
- newsData: []
+ newsData: {}
}
export default (state = initialState, action) => {
switch (action.type) {
case FETCH_NEWS_DATA: {
-
return {
...state,
newsData: action.payload
};
}
case FETCH_MORE_NEWS: {
- state.newsData.push(...action.payload);
+ // console.log(action.payload);
return {
- ...state
+ newsData: {
+ ...state.newsData,
+ newsList: action.payload
+ }
}
}
default: