2017-07-17 12:15:21 +08:00
|
|
|
|
import './News.scss'
|
|
|
|
|
import React, { Component } from 'react'
|
|
|
|
|
import NewsTimeline from './NewsTimeline/NewsTimeline'
|
|
|
|
|
import { connect } from 'react-redux'
|
|
|
|
|
import PropTypes from 'prop-types'
|
2017-08-09 16:08:37 +08:00
|
|
|
|
import Breadcrumb from '../../components/Breadcrumb/Breadcrumb'
|
|
|
|
|
import { Button } from 'antd'
|
2017-08-09 18:00:45 +08:00
|
|
|
|
import { getMockUrl } from '../../reducer/modules/news.js'
|
2017-07-17 12:15:21 +08:00
|
|
|
|
|
|
|
|
|
@connect(
|
|
|
|
|
state => {
|
2017-08-09 16:08:37 +08:00
|
|
|
|
console.log(state);
|
2017-07-17 12:15:21 +08:00
|
|
|
|
return {
|
2017-08-09 16:08:37 +08:00
|
|
|
|
uid: state.login.uid + ''
|
2017-07-17 12:15:21 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
2017-08-09 18:00:45 +08:00
|
|
|
|
getMockUrl: getMockUrl
|
2017-07-17 12:15:21 +08:00
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
class News extends Component {
|
|
|
|
|
constructor(props) {
|
2017-08-09 18:00:45 +08:00
|
|
|
|
super(props);
|
|
|
|
|
this.state = {
|
|
|
|
|
mockURL:""
|
|
|
|
|
}
|
2017-07-17 12:15:21 +08:00
|
|
|
|
}
|
|
|
|
|
static propTypes = {
|
2017-08-09 18:00:45 +08:00
|
|
|
|
uid: PropTypes.string,
|
|
|
|
|
getMockUrl: PropTypes.func
|
|
|
|
|
}
|
|
|
|
|
componentWillMount(){
|
|
|
|
|
const that = this;
|
|
|
|
|
this.props.getMockUrl(2724).then(function(data){
|
|
|
|
|
const { prd_host, basepath, protocol } = data.payload.data.data;
|
|
|
|
|
const mockURL = `${protocol}://${prd_host}${basepath}/{path}`;
|
|
|
|
|
that.setState({
|
|
|
|
|
mockURL: mockURL
|
|
|
|
|
})
|
|
|
|
|
})
|
2017-07-20 16:30:55 +08:00
|
|
|
|
}
|
2017-07-17 12:15:21 +08:00
|
|
|
|
render () {
|
|
|
|
|
return (
|
|
|
|
|
<section className="news-box">
|
2017-08-09 16:08:37 +08:00
|
|
|
|
<div className="logHead">
|
|
|
|
|
<Breadcrumb />
|
|
|
|
|
<div className="Mockurl">
|
|
|
|
|
<span>Mock地址:</span>
|
2017-08-09 18:00:45 +08:00
|
|
|
|
<p>{this.state.mockURL}</p>
|
2017-08-09 16:08:37 +08:00
|
|
|
|
<Button type="primary">下载Mock数据</Button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<NewsTimeline/>
|
2017-07-17 12:15:21 +08:00
|
|
|
|
</section>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default News
|