From c56caae7622be5925ef95642ddbe65c7d64ef080 Mon Sep 17 00:00:00 2001 From: qitmac000249 Date: Tue, 15 Aug 2017 12:07:52 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B7=BB=E5=8A=A0=E6=8E=A5=E5=8F=A3view?= =?UTF-8?q?=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../containers/Project/Activity/Activity.js | 3 +- .../Project/Activity/Timeline/Timeline.js | 10 +-- .../Project/Interface/InterfaceList/View.js | 85 ++++++++++++++++++- .../Project/Interface/interface.scss | 13 +++ 4 files changed, 101 insertions(+), 10 deletions(-) diff --git a/client/containers/Project/Activity/Activity.js b/client/containers/Project/Activity/Activity.js index 4025e5e2..fa5832e2 100644 --- a/client/containers/Project/Activity/Activity.js +++ b/client/containers/Project/Activity/Activity.js @@ -9,7 +9,6 @@ import { getMockUrl } from '../../../reducer/modules/news.js' @connect( state => { - console.log(state); return { uid: state.user.uid + '' } @@ -51,7 +50,7 @@ class Activity extends Component {
Mock地址:

{this.state.mockURL}

- +
diff --git a/client/containers/Project/Activity/Timeline/Timeline.js b/client/containers/Project/Activity/Timeline/Timeline.js index 57703c98..e1c1d122 100644 --- a/client/containers/Project/Activity/Timeline/Timeline.js +++ b/client/containers/Project/Activity/Timeline/Timeline.js @@ -3,6 +3,7 @@ import { Timeline, Spin } from 'antd' import PropTypes from 'prop-types' import { connect } from 'react-redux' import { formatTime } from '../../../../common.js'; +import { Link } from 'react-router-dom' import { fetchNewsData, fetchMoreNews } from '../../../../reducer/modules/news.js' function timeago(timestamp) { @@ -93,7 +94,7 @@ class TimeTree extends Component { this.setState({ loading: true }); this.props.fetchMoreNews(this.props.typeid, 'project', this.props.curpage+1, 8).then(function () { that.setState({ loading: false }); - if (that.props.newsData.total + 1 === that.props.curpage) { + if (that.props.newsData.total === that.props.curpage) { that.setState({ bidden: "logbidden" }) } }) @@ -101,18 +102,17 @@ class TimeTree extends Component { } componentWillMount() { + this.props.fetchNewsData(this.props.typeid, 'project', 1, 8) } - render() { - let data = this.props.newsData ? this.props.newsData.list : []; if (data && data.length) { data = data.map(function (item, i) { return ( {timeago(item.add_time)} - {item.username} + {item.username} {item.type} {formatTime(item.add_time)} {item.content} @@ -121,7 +121,7 @@ class TimeTree extends Component { } else { data = ""; } - let pending = this.state.bidden ? 以上为全部内容 : 查看更多; + let pending = this.props.newsData.total <= this.props.curpage ? 以上为全部内容 : 查看更多; if (this.state.loading) { pending = } diff --git a/client/containers/Project/Interface/InterfaceList/View.js b/client/containers/Project/Interface/InterfaceList/View.js index 4fe8a1eb..afe6b978 100644 --- a/client/containers/Project/Interface/InterfaceList/View.js +++ b/client/containers/Project/Interface/InterfaceList/View.js @@ -1,6 +1,85 @@ -import React from 'react' +import '../interface.scss' +import React, { Component } from 'react' +import { connect } from 'react-redux' +import PropTypes from 'prop-types' +import { formatTime } from '../../../../common.js'; -export default () => { - return

接口预览

+// import { Card } from 'antd' +// import { getMockUrl } from '../../reducer/modules/news.js' + +@connect() + +class View extends Component { + constructor(props) { + super(props); + } + static propTypes = { + viewData: PropTypes.object + } + + render () { + return
+ {/**/} +
+ 接口名: + {this.props.viewData.casename} +
+
+ 添加时间: + {formatTime(this.props.viewData.add_time/1000)} +
+
+ 更新时间: + {formatTime(this.props.viewData.up_time/1000)} +
+
+ 测试环境: + {this.props.viewData.env} +
+
+ 域名: + {this.props.viewData.domain} +
+
+ 路径: + {this.props.viewData.path} +
+
+ 请求方法: + {this.props.viewData.method} +
+
+ } } +View.defaultProps = { + viewData: { + casename:"caename", + uid: 107, + col_id: 211, + index: 0, + project_id: 112, + add_time: new Date().getTime(), + up_time: new Date().getTime(), + env: "测试环境", + domain: "域名", + path: "路径", + method: "GET", + req_query: [{ + name: "String", + value: "String" + }], + req_headers: [{ + name: "String", + value: "String" + }], + req_body_type: "json", + res_body_form: [{ + name: "String", + value: "String" + }], + res_body_other: "String" + } +} + +export default View diff --git a/client/containers/Project/Interface/interface.scss b/client/containers/Project/Interface/interface.scss index c2accb43..adc24bc6 100644 --- a/client/containers/Project/Interface/interface.scss +++ b/client/containers/Project/Interface/interface.scss @@ -64,6 +64,19 @@ } } } +.caseContainer{ + padding: 24px; + font-size: 12px; + >div{ + margin: 8px 0px; + padding: 12px; + background-color: #ececec; + .colKey{ + font-weight: bolder; + margin-right: 16px; + } + } +}