Merge branch 'dev' of gitlab.corp.qunar.com:mfe/yapi into dev

This commit is contained in:
zwjamnsss 2017-07-28 10:53:20 +08:00
commit 40072d9896
3 changed files with 17 additions and 9 deletions

View File

@ -76,7 +76,8 @@ class AddInterface extends Component {
isLoading: '',
isSave: false,
mockJson: '',
mockURL: ''
mockURL: '',
projectData: {}
}
}
@ -128,7 +129,8 @@ class AddInterface extends Component {
const { protocol, prd_host, basepath } = data.data.data
const mockURL = `${protocol}://${prd_host}${basepath}${result.path}`
this.setState({
mockURL: mockURL
mockURL: mockURL,
projectData: data.data.data
})
})
}
@ -136,7 +138,9 @@ class AddInterface extends Component {
editState (data) {
const props = this.props
const { path, title, req_params_other, res_body, req_headers, project_id, method } = data
this.setState({
apiData: data
})
props.pushInputValue(path)
props.pushInterfaceMethod(method)
props.pushInterfaceName(title)
@ -254,7 +258,7 @@ class AddInterface extends Component {
<ReqMethod />
<ReqHeader />
<ReqParams data={this.props} />
<MockUrl mockURL={mockURL} serverIp={server_ip} />
<MockUrl mockURL={mockURL} serverIp={server_ip} projectData={this.state.projectData} />
<h3 className="req-title">返回部分</h3>
<ResParams />
<Result isSave={isSave} mockJson={mockJson} />

View File

@ -9,12 +9,13 @@
font-size: .12rem;
.content {
@include row-width-limit;
margin: 24px auto;
max-width: 11.7rem;
min-width: 11.7rem;
border-radius: 4px;
box-shadow: 0 2px 4px 0 rgba(0,0,0,0.20);
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2);
background: #FFF;
padding: 10px 20px 50px 20px;
margin: 0 auto;
.ant-tabs-content {
padding: 0 0 50px 0;

View File

@ -11,7 +11,9 @@ const success = () => {
class MockUrl extends Component {
static propTypes = {
mockURL: PropTypes.string,
serverIp: PropTypes.string
serverIp: PropTypes.string,
mockData: PropTypes.string,
projectData: PropTypes.object
}
constructor(props) {
@ -35,13 +37,14 @@ class MockUrl extends Component {
}
render () {
console.log(this.props)
const { serverIp } = this.props
return (
<section className="mock-url-box">
<span className="title">mock地址 : </span>
<p id="mock-p">{this.props.mockURL}</p>
<Button type="primary" id="mock-clipboard">复制</Button>
<div className="host">请配置host ***.***.***.*** { serverIp }</div>
<div className="host"><label>请配置host:</label> {this.props.projectData.prd_host} { serverIp }</div>
</section>
)
}