From 8e2923da97cad7d25ccb6b6cb7c37a2458efeea0 Mon Sep 17 00:00:00 2001 From: "gaoxiaolin.gao" Date: Tue, 21 Nov 2017 10:34:54 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=A2=9E=E5=8A=A0=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=8F=82=E6=95=B0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/components/ModalPostman/MethodsList.js | 24 ++----------------- client/components/ModalPostman/MockList.js | 4 +--- client/components/ModalPostman/index.js | 8 +++---- 3 files changed, 7 insertions(+), 29 deletions(-) diff --git a/client/components/ModalPostman/MethodsList.js b/client/components/ModalPostman/MethodsList.js index f9710f4e..105d7be7 100644 --- a/client/components/ModalPostman/MethodsList.js +++ b/client/components/ModalPostman/MethodsList.js @@ -1,10 +1,8 @@ import React, { Component } from 'react' import PropTypes from 'prop-types' -import { Row, Radio, Icon, Input, Select } from 'antd'; +import { Row, Icon, Input, Select } from 'antd'; // import common from 'common/power-string.js' const Option = Select.Option; -const RadioButton = Radio.Button; -const RadioGroup = Radio.Group; // 深拷贝 function deepEqual(state) { @@ -84,11 +82,9 @@ class MethodsList extends Component { let newList = deepEqual(this.state.list); newList[paramsIndex].params[0] = value; - // console.log('newList', newList); this.setState({ list: newList }) - // console.log('list', this.state.list); this.props.paramsInput(value, clickIndex); } @@ -109,17 +105,6 @@ class MethodsList extends Component { } } - handleRadioChange = (e) => { - console.log(e); - this.state.list.forEach(item => { - if (item.name === clickValue) { - - } - }) - this.props.click(e); - // console.log('state', this.state.index); - - } render() { const { list, moreFlag } = this.state; @@ -137,25 +122,20 @@ class MethodsList extends Component { type="flex" align="middle" className={'row methods-row ' + (item.name === clickValue ? 'checked' : '')} - onClick={() => click(item.name)}> + onClick={() => click(item.name,showList[index].params)}> {item.name} {item.type && this.handleComponent(item, clickIndex, index)} - - }) } { moreFlag &&
更多
} - ) - } - } export default MethodsList; \ No newline at end of file diff --git a/client/components/ModalPostman/MockList.js b/client/components/ModalPostman/MockList.js index 122c6e63..34ff3354 100644 --- a/client/components/ModalPostman/MockList.js +++ b/client/components/ModalPostman/MockList.js @@ -1,10 +1,8 @@ import React, { Component } from 'react' import PropTypes from 'prop-types' -import { Row, Input, Radio } from 'antd'; +import { Row, Input } from 'antd'; import constants from '../../constants/variable.js' const wordList = constants.MOCK_SOURCE; -const RadioButton = Radio.Button; -const RadioGroup = Radio.Group; const Search = Input.Search; diff --git a/client/components/ModalPostman/index.js b/client/components/ModalPostman/index.js index 69ea8ba5..48523d74 100644 --- a/client/components/ModalPostman/index.js +++ b/client/components/ModalPostman/index.js @@ -14,14 +14,14 @@ function deepEqual(state) { } function closeRightTabsAndAddNewTab(arr, index, curname, params) { - console.log(params); + // console.log(params); let newParamsList = [].concat(arr); newParamsList.splice(index + 1, newParamsList.length - index); newParamsList.push({ name: '', params: [] }) - let curParams = params&¶ms.name ===curname ? params.params:[]; + let curParams = params || []; newParamsList[index] = { ...newParamsList[index], name: curname, @@ -56,9 +56,9 @@ class ModalPostman extends Component { } mockClick(index) { - return (e, params) => { + return (curname, params) => { console.log('value', params); - let curname = e; + // let curname = e; let newParamsList = closeRightTabsAndAddNewTab(this.state.methodsParamsList, index, curname, params) this.setState({ methodsParamsList: newParamsList