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

View File

@ -9,12 +9,13 @@
font-size: .12rem; font-size: .12rem;
.content { .content {
@include row-width-limit; max-width: 11.7rem;
margin: 24px auto; min-width: 11.7rem;
border-radius: 4px; 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; background: #FFF;
padding: 10px 20px 50px 20px; padding: 10px 20px 50px 20px;
margin: 0 auto;
.ant-tabs-content { .ant-tabs-content {
padding: 0 0 50px 0; padding: 0 0 50px 0;

View File

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