mirror of
https://github.com/YMFE/yapi.git
synced 2024-12-15 05:10:47 +08:00
feat: add mock host
This commit is contained in:
parent
829d27ab39
commit
597c1edd8f
@ -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} />
|
||||
|
@ -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>
|
||||
)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user