mirror of
https://github.com/YMFE/yapi.git
synced 2024-12-21 05:19:42 +08:00
Merge branch 'dev' of gitlab.corp.qunar.com:mfe/yapi into dev
This commit is contained in:
commit
ab76dbf8c9
@ -33,11 +33,10 @@ export default class Run extends Component {
|
|||||||
query: [],
|
query: [],
|
||||||
bodyForm: [],
|
bodyForm: [],
|
||||||
headers: [],
|
headers: [],
|
||||||
currDomain: '',
|
|
||||||
caseEnv: '',
|
caseEnv: '',
|
||||||
bodyType: '',
|
bodyType: '',
|
||||||
bodyOther: '',
|
bodyOther: '',
|
||||||
isDidMount: false
|
loading: false
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
@ -118,8 +117,12 @@ export default class Run extends Component {
|
|||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
reqRealInterface() {
|
reqRealInterface() {
|
||||||
const { headers, bodyForm, bodyOther, currDomain, method, pathname, query, bodyType } = this.state;
|
if (this.state.loading) {
|
||||||
const urlObj = URL.parse(currDomain);
|
this.setState({ loading: false })
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
const { headers, bodyForm, bodyOther, caseEnv, domains, method, pathname, query, bodyType } = this.state;
|
||||||
|
const urlObj = URL.parse(domains.find(item => item.name === caseEnv).domain);
|
||||||
|
|
||||||
const href = URL.format({
|
const href = URL.format({
|
||||||
protocol: urlObj.protocol || 'http',
|
protocol: urlObj.protocol || 'http',
|
||||||
@ -163,10 +166,10 @@ export default class Run extends Component {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
// @autobind
|
||||||
changeDomain(value) {
|
// changeDomain(value) {
|
||||||
this.setState({ currDomain: value });
|
// this.setState({ currDomain: value });
|
||||||
}
|
// }
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
selectDomain(value) {
|
selectDomain(value) {
|
||||||
@ -405,7 +408,7 @@ export default class Run extends Component {
|
|||||||
|
|
||||||
render () {
|
render () {
|
||||||
|
|
||||||
const { method, domains, pathParam, pathname, query, headers, bodyForm, caseEnv, bodyType, resHeader } = this.state;
|
const { method, domains, pathParam, pathname, query, headers, bodyForm, caseEnv, bodyType, resHeader, loading } = this.state;
|
||||||
const hasPlugin = this.hasCrossRequestPlugin();
|
const hasPlugin = this.hasCrossRequestPlugin();
|
||||||
const isResJson = resHeader && resHeader['content-type'] && resHeader['content-type'].indexOf('application/json') !== -1
|
const isResJson = resHeader && resHeader['content-type'] && resHeader['content-type'].indexOf('application/json') !== -1
|
||||||
let path = pathname;
|
let path = pathname;
|
||||||
@ -467,8 +470,8 @@ export default class Run extends Component {
|
|||||||
onClick={this.reqRealInterface}
|
onClick={this.reqRealInterface}
|
||||||
type="primary"
|
type="primary"
|
||||||
style={{marginLeft: 10}}
|
style={{marginLeft: 10}}
|
||||||
loading={this.state.loading}
|
icon={loading ? 'loading' : ''}
|
||||||
>发送</Button>
|
>{loading ? '取消' : '发送'}</Button>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<Tooltip placement="bottom" title={this.props.saveTip}>
|
<Tooltip placement="bottom" title={this.props.saveTip}>
|
||||||
<Button
|
<Button
|
||||||
|
@ -60,7 +60,7 @@
|
|||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
margin-right: 7px;
|
margin-right: 7px;
|
||||||
padding: 0 5px;
|
padding: 0 5px;
|
||||||
width: 40px;
|
width:auto !important;
|
||||||
}
|
}
|
||||||
.interface-item{
|
.interface-item{
|
||||||
display: inline
|
display: inline
|
||||||
|
Loading…
Reference in New Issue
Block a user