diff --git a/client/components/ModalPostman/MethodsList.js b/client/components/ModalPostman/MethodsList.js
index 946ca86c..dcc627c0 100644
--- a/client/components/ModalPostman/MethodsList.js
+++ b/client/components/ModalPostman/MethodsList.js
@@ -38,7 +38,8 @@ class MethodsList extends Component {
super(props)
this.state = {
list: METHODS_LIST,
- moreFlag: true
+ moreFlag: true,
+ index: 0
}
}
@@ -58,7 +59,12 @@ class MethodsList extends Component {
inputComponent = (props) => {
let clickIndex = props.clickIndex;
let paramsIndex = props.paramsIndex;
- return this.handleParamsChange(e.target.value, clickIndex, paramsIndex)} />
+ return this.handleParamsChange(e.target.value, clickIndex, paramsIndex)}
+ />
}
selectComponent = (props) => {
@@ -76,14 +82,14 @@ class MethodsList extends Component {
// 处理参数输入
handleParamsChange(value, clickIndex, paramsIndex) {
-
+
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);
+ // console.log('list', this.state.list);
this.props.paramsInput(value, clickIndex);
}
@@ -105,19 +111,32 @@ 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;
- const { click, clickValue, clickIndex } = this.props;
- // console.log('click', clickValue);
- let showList = moreFlag ? list.slice(0,4) :list;
+ const { list, moreFlag, index } = this.state;
+ const { click,clickValue, clickIndex } = this.props;
+ console.log('click', clickValue);
+ console.log('state', this.state.index);
+ let showList = moreFlag ? list.slice(0, 4) : list;
return (
方法
-
+ this.handleRadioChange(e} value={clickValue}>
{
showList.map((item, index) => {
return
-
+
{item.name}
{item.type && this.handleComponent(item, clickIndex, index)}
diff --git a/client/components/ModalPostman/index.js b/client/components/ModalPostman/index.js
index e56e24c7..02d380d6 100644
--- a/client/components/ModalPostman/index.js
+++ b/client/components/ModalPostman/index.js
@@ -13,16 +13,19 @@ function deepEqual(state) {
return JSON.parse(JSON.stringify(state))
}
-function closeRightTabsAndAddNewTab(arr, index, curname) {
+function closeRightTabsAndAddNewTab(arr, index, curname, 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:[];
newParamsList[index] = {
...newParamsList[index],
name: curname,
- params: []
+ params: curParams
}
return newParamsList;
@@ -53,9 +56,10 @@ class ModalPostman extends Component {
}
mockClick(index) {
- return (e) => {
+ return (e, params) => {
+ console.log('value', params);
let curname = e.target.value;
- let newParamsList = closeRightTabsAndAddNewTab(this.state.methodsParamsList, index, curname)
+ let newParamsList = closeRightTabsAndAddNewTab(this.state.methodsParamsList, index, curname, params)
this.setState({
methodsParamsList: newParamsList
})
@@ -84,9 +88,9 @@ class ModalPostman extends Component {
render() {
const { visible, handleCancel, handleOk } = this.props
- const { methodsParamsList } = this.state;
+ const { methodsParamsList } = this.state;
const { name } = methodsParamsList[0];
- // console.log('list', this.state.methodsParamsList);
+ console.log('list', this.state.methodsParamsList);
return (
高级参数设置}
@@ -118,8 +122,8 @@ class ModalPostman extends Component {
${'{'}
{
methodsParamsList.map((item, index) => {
- return item.name &&
- {item.name}({item.params})
+ return item.name &&
+ {item.name}({item.params})
})
}
{'}'}