From 505cceb98c0d938321b676cde8bad2e94be76c1b Mon Sep 17 00:00:00 2001 From: "waliang.wang" Date: Wed, 26 Jul 2017 19:07:29 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../InterfaceTest/InterfaceTest.js | 3 +-- .../AddInterface/MockUrl/MockUrl.js | 2 +- .../AddInterface/ReqHeader/ReqList.js | 23 ++++++++++++++++--- .../AddInterface/ReqMethod/ReqMethod.js | 3 ++- .../containers/AddInterface/Result/Result.js | 2 +- client/containers/Interface/Interface.js | 2 +- .../InterfaceTable/InterfaceTable.js | 1 - 7 files changed, 26 insertions(+), 10 deletions(-) diff --git a/client/containers/AddInterface/InterfaceTest/InterfaceTest.js b/client/containers/AddInterface/InterfaceTest/InterfaceTest.js index ae5f1161..f02c19df 100644 --- a/client/containers/AddInterface/InterfaceTest/InterfaceTest.js +++ b/client/containers/AddInterface/InterfaceTest/InterfaceTest.js @@ -85,8 +85,7 @@ export default class InterfaceTest extends Component { data: { a:1 }, - success: (res, header) => { - console.log(header) + success: (res) => { this.setState({res}) } }) diff --git a/client/containers/AddInterface/MockUrl/MockUrl.js b/client/containers/AddInterface/MockUrl/MockUrl.js index cfc8b81b..0dce9dac 100644 --- a/client/containers/AddInterface/MockUrl/MockUrl.js +++ b/client/containers/AddInterface/MockUrl/MockUrl.js @@ -24,7 +24,7 @@ class MockUrl extends Component { clipboard () { const btn = document.querySelector('#mock-clipboard') const txt = document.querySelector('#mock-p').innerHTML - console.log('txt', txt) + new Clipboard(btn, { text: () => txt, target () { diff --git a/client/containers/AddInterface/ReqHeader/ReqList.js b/client/containers/AddInterface/ReqHeader/ReqList.js index 21db94e1..47e8da5a 100644 --- a/client/containers/AddInterface/ReqHeader/ReqList.js +++ b/client/containers/AddInterface/ReqHeader/ReqList.js @@ -6,7 +6,8 @@ import { autobind } from 'core-decorators' import { reqTagValue, reqHeaderValue, - deleteReqHeader + deleteReqHeader, + addReqHeader } from '../../../actions/addInterface.js' @connect( @@ -20,7 +21,8 @@ import { { reqTagValue, reqHeaderValue, - deleteReqHeader + deleteReqHeader, + addReqHeader } ) @@ -30,6 +32,7 @@ class ReqList extends Component { reqTagValue: PropTypes.func, reqHeaderValue: PropTypes.func, deleteReqHeader: PropTypes.func, + addReqHeader: PropTypes.func, _id: PropTypes.number, dataNum: PropTypes.number, value: PropTypes.object @@ -43,12 +46,20 @@ class ReqList extends Component { handleChange (value) { const dir = 'AddInterface/edit' const url = location.href + const newObject = [] + if (url.includes(dir)) { const { seqGroup, value: { id } } = this.props seqGroup[id].name = value + seqGroup.forEach(v => { + const {id, name, value} = v + newObject.push({id, name, value}) + }) + this.props.addReqHeader( newObject ) } else { const { seqGroup, dataNum } = this.props seqGroup[dataNum].name = value + this.props.addReqHeader(Object.create(seqGroup)) } } @@ -56,7 +67,13 @@ class ReqList extends Component { handleBlur (e) { const value = e.target.value const { seqGroup, value: { id } } = this.props + const newObject = [] seqGroup[id].value = value + seqGroup.forEach(v => { + const {id, name, value} = v + newObject.push({id, name, value}) + }) + this.props.addReqHeader(newObject) } @autobind @@ -82,7 +99,7 @@ class ReqList extends Component { return (
  • 头部标签 - diff --git a/client/containers/AddInterface/ReqMethod/ReqMethod.js b/client/containers/AddInterface/ReqMethod/ReqMethod.js index 286120a8..2be444e2 100644 --- a/client/containers/AddInterface/ReqMethod/ReqMethod.js +++ b/client/containers/AddInterface/ReqMethod/ReqMethod.js @@ -58,6 +58,7 @@ class ReqMethod extends Component { render () { const { Option } = Select const { url, interfaceName, method } = this.props + return ( @@ -65,7 +66,7 @@ class ReqMethod extends Component {
    协议 : 请求方式 - diff --git a/client/containers/AddInterface/Result/Result.js b/client/containers/AddInterface/Result/Result.js index ee2ad149..25c2149b 100644 --- a/client/containers/AddInterface/Result/Result.js +++ b/client/containers/AddInterface/Result/Result.js @@ -27,7 +27,7 @@ class Result extends Component { render () { const TabPane = Tabs.TabPane const { mockJson } = this.props - console.log('mockJson', typeof mockJson, mockJson) + return (
    diff --git a/client/containers/Interface/Interface.js b/client/containers/Interface/Interface.js index 161c6063..6903506c 100644 --- a/client/containers/Interface/Interface.js +++ b/client/containers/Interface/Interface.js @@ -58,7 +58,7 @@ class Interface extends Component { .then(result => { result = result.data.data result.map(value => { - value.add_time = moment(value.add_time).format('YYYY-MM-DD HH:mm:ss') + value.add_time = moment(value.add_time*1000).format('YYYY-MM-DD HH:mm:ss') return value }) this.props.fetchInterfaceData(result) diff --git a/client/containers/Interface/InterfaceTable/InterfaceTable.js b/client/containers/Interface/InterfaceTable/InterfaceTable.js index 8df22ee6..7c5d4004 100644 --- a/client/containers/Interface/InterfaceTable/InterfaceTable.js +++ b/client/containers/Interface/InterfaceTable/InterfaceTable.js @@ -81,7 +81,6 @@ class InterfaceTable extends Component { title: '功能', 'key': 'action', render: (data) => { - // const deleteInterface = this.deleteInterface.bind(this, data._id) const confirm = this.confirm.bind(this, data._id) return (