opti: 优化运行

This commit is contained in:
zwjamnsss 2017-08-28 15:47:57 +08:00
parent acb8c1e025
commit 6f4d70ecd4

View File

@ -448,16 +448,16 @@ export default class Run extends Component {
<Card title="请求部分" noHovering className="req-part">
<div className="url">
<InputGroup compact style={{display: 'flex'}}>
<Select value={method} style={{flexBasis: 60}} onChange={this.changeMethod} >
<Select disabled value={method} style={{flexBasis: 60}} onChange={this.changeMethod} >
<Option value="GET">GET</Option>
<Option value="POST">POST</Option>
</Select>
<Select value={currDomain} mode="combobox" filterOption={() => true} style={{flexBasis: 180, flexGrow: 1}} onChange={this.changeDomain} onSelect={this.selectDomain}>
<Select disabled value={currDomain} mode="combobox" filterOption={() => true} style={{flexBasis: 180, flexGrow: 1}} onChange={this.changeDomain} onSelect={this.selectDomain}>
{
domains.map((item, index) => (<Option value={item.domain} key={index}>{item.name + '' + item.domain}</Option>))
}
</Select>
<Input value={path + search} onChange={this.changePath} spellCheck="false" style={{flexBasis: 180, flexGrow: 1}} />
<Input disabled value={path + search} onChange={this.changePath} spellCheck="false" style={{flexBasis: 180, flexGrow: 1}} />
</InputGroup>
<Tooltip placement="bottom" title="请求真实接口">
<Button
@ -478,57 +478,57 @@ export default class Run extends Component {
</div>
<Collapse defaultActiveKey={['0', '1', '2', '3']} bordered={true}>
<Panel header="PATH PARAMETERS" key="0" className={pathParam.length === 0 ? 'hidden' : ''}>
<Panel header="PATH PARAMETERS" key="0" className={pathParam.length === 0 ? 'none' : ''}>
{
pathParam.map((item, index) => {
return (
<div key={index} className="key-value-wrap">
<Input value={item.name} onChange={e => this.changePathParam(e, index, true)} className="key" />
<Input disabled value={item.name} onChange={e => this.changePathParam(e, index, true)} className="key" />
<span className="eq-symbol">=</span>
<Input value={item.value} onChange={e => this.changePathParam(e, index)} className="value" />
<Icon type="delete" className="icon-btn" onClick={() => this.deletePathParam(index)} />
<Icon style={{display: 'none'}} type="delete" className="icon-btn" onClick={() => this.deletePathParam(index)} />
</div>
)
})
}
<Button type="primary" icon="plus" onClick={this.addPathParam}>添加Path参数</Button>
<Button style={{display: 'none'}} type="primary" icon="plus" onClick={this.addPathParam}>添加Path参数</Button>
</Panel>
<Panel header="QUERY PARAMETERS" key="1">
{
query.map((item, index) => {
return (
<div key={index} className="key-value-wrap">
<Input value={item.name} onChange={e => this.changeQuery(e, index, true)} className="key" />
<Input disabled value={item.name} onChange={e => this.changeQuery(e, index, true)} className="key" />
<span className="eq-symbol">=</span>
<Input value={item.value} onChange={e => this.changeQuery(e, index)} className="value" />
<Icon type="delete" className="icon-btn" onClick={() => this.deleteQuery(index)} />
<Icon style={{display: 'none'}} type="delete" className="icon-btn" onClick={() => this.deleteQuery(index)} />
</div>
)
})
}
<Button type="primary" icon="plus" onClick={this.addQuery}>添加Query参数</Button>
<Button style={{display: 'none'}} type="primary" icon="plus" onClick={this.addQuery}>添加Query参数</Button>
</Panel>
<Panel header="HEADERS" key="2" >
{
headers.map((item, index) => {
return (
<div key={index} className="key-value-wrap">
<Input value={item.name} onChange={e => this.changeHeader(e, index, true)} className="key" />
<Input disabled value={item.name} onChange={e => this.changeHeader(e, index, true)} className="key" />
<span className="eq-symbol">=</span>
<Input value={item.value} onChange={e => this.changeHeader(e, index)} className="value" />
<Icon type="delete" className="icon-btn" onClick={() => this.deleteHeader(index)} />
<Icon style={{display: 'none'}} type="delete" className="icon-btn" onClick={() => this.deleteHeader(index)} />
</div>
)
})
}
<Button type="primary" icon="plus" onClick={this.addHeader}>添加Header</Button>
<Button style={{display: 'none'}} type="primary" icon="plus" onClick={this.addHeader}>添加Header</Button>
</Panel>
<Panel
header={
<div style={{display: 'flex', justifyContent: 'space-between'}}>
<div>BODY</div>
<div onClick={e => e.stopPropagation()} style={{marginRight: 5}}>
<Select value={bodyType !== 'form' && bodyType !== 'file' ? 'text' : bodyType} onChange={this.changeBodyType} className={method === 'POST' ? '' : 'hidden'}>
<Select disabled value={bodyType !== 'form' && bodyType !== 'file' ? 'text' : bodyType} onChange={this.changeBodyType} className={method === 'POST' ? '' : 'none'}>
<Option value="text">Text</Option>
<Option value="file">File</Option>
<Option value="form">Form</Option>
@ -540,7 +540,7 @@ export default class Run extends Component {
>
{ method === 'POST' && bodyType !== 'form' && bodyType !== 'file' &&
<div>
<RadioGroup value={bodyType} onChange={(e) => this.changeBodyType(e.target.value)}>
<RadioGroup disabled value={bodyType} onChange={(e) => this.changeBodyType(e.target.value)}>
<RadioButton value="json">JSON</RadioButton>
<RadioButton value="text">TEXT</RadioButton>
<RadioButton value="xml">XML</RadioButton>
@ -555,9 +555,9 @@ export default class Run extends Component {
bodyForm.map((item, index) => {
return (
<div key={index} className="key-value-wrap">
<Input value={item.name} onChange={e => this.changeBody(e, index, 'key')} className="key" />
<Input disabled value={item.name} onChange={e => this.changeBody(e, index, 'key')} className="key" />
<span>[</span>
<Select value={item.type} onChange={e => this.changeBody(e, index, 'type')}>
<Select disabled value={item.type} onChange={e => this.changeBody(e, index, 'type')}>
<Option value="file">File</Option>
<Option value="text">Text</Option>
</Select>
@ -567,12 +567,12 @@ export default class Run extends Component {
item.type === 'file' ? <Input type="file" id={'file_' + index} onChange={e => this.changeBody(e, index, 'value')} multiple className="value" /> :
<Input value={item.value} onChange={e => this.changeBody(e, index, 'value')} className="value" />
}
<Icon type="delete" className="icon-btn" onClick={() => this.deleteBody(index)} />
<Icon style={{display: 'none'}} type="delete" className="icon-btn" onClick={() => this.deleteBody(index)} />
</div>
)
})
}
<Button type="primary" icon="plus" onClick={this.addBody}>添加Form参数</Button>
<Button style={{display: 'none'}} type="primary" icon="plus" onClick={this.addBody}>添加Form参数</Button>
</div>
}
{