mirror of
https://github.com/YMFE/yapi.git
synced 2025-03-07 14:16:52 +08:00
feat: 接口测完完成部分
This commit is contained in:
parent
d76b0cc678
commit
8399b0305c
@ -10,6 +10,7 @@ import ReqHeader from './ReqHeader/ReqHeader.js'
|
||||
import ReqParams from './ReqParams/ReqParams.js'
|
||||
import ResParams from './ResParams/ResParams.js'
|
||||
import Result from './Result/Result.js'
|
||||
import InterfaceTest from './InterfaceTest/InterfaceTest.js'
|
||||
import {
|
||||
saveForms,
|
||||
getResParams,
|
||||
@ -202,7 +203,9 @@ class AddInterface extends Component {
|
||||
<Result />
|
||||
</TabPane>
|
||||
<TabPane tab="Mock" key="2">mock</TabPane>
|
||||
<TabPane tab="测试" key="3">测试</TabPane>
|
||||
<TabPane tab="测试" key="3">
|
||||
<InterfaceTest />
|
||||
</TabPane>
|
||||
</Tabs>
|
||||
</div>
|
||||
<div className={`loading ${isLoading}`}></div>
|
||||
@ -212,5 +215,3 @@ class AddInterface extends Component {
|
||||
}
|
||||
|
||||
export default AddInterface
|
||||
|
||||
|
||||
|
@ -0,0 +1,59 @@
|
||||
import React, { Component } from 'react'
|
||||
// import PropTypes from 'prop-types'
|
||||
// import { connect } from 'react-redux'
|
||||
import { Button } from 'antd'
|
||||
import { autobind } from 'core-decorators';
|
||||
import crossRequest from 'cross-request';
|
||||
|
||||
import {
|
||||
} from '../../../actions/group.js'
|
||||
|
||||
import './InterfaceTest.scss'
|
||||
|
||||
// @connect(
|
||||
// state => ({
|
||||
// }),
|
||||
// {
|
||||
// }
|
||||
// )
|
||||
export default class InterfaceTest extends Component {
|
||||
|
||||
static propTypes = {
|
||||
}
|
||||
|
||||
state = {
|
||||
res: {}
|
||||
}
|
||||
|
||||
constructor(props) {
|
||||
super(props)
|
||||
}
|
||||
|
||||
@autobind
|
||||
testInterface() {
|
||||
crossRequest({
|
||||
url: 'http://petstore.swagger.io/v2/swagger.json',
|
||||
method: 'GET',
|
||||
data: {
|
||||
a:1
|
||||
},
|
||||
success: (res, header) => {
|
||||
this.setState({res})
|
||||
console.log(header)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
render () {
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Button onClick={this.testInterface}>发送跨域请求</Button>
|
||||
<div>
|
||||
{this.state.res.toString()}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
@ -75,6 +75,9 @@ class InterfaceTable extends Component {
|
||||
<Button type="primary">
|
||||
<Link to={`/AddInterface/edit/${data._id}`}>编辑</Link>
|
||||
</Button>
|
||||
<Button type="primary">
|
||||
<Link to={`/AddInterface/edit/${data._id}`}>测试</Link>
|
||||
</Button>
|
||||
<Button type="danger" onClick={deleteInterface}>删除</Button>
|
||||
</span>
|
||||
)
|
||||
|
@ -19,6 +19,7 @@
|
||||
"axios": "^0.16.2",
|
||||
"babel-plugin-transform-decorators-legacy": "^1.3.4",
|
||||
"core-decorators": "^0.17.0",
|
||||
"cross-request": "^1.0.1",
|
||||
"fs-extra": "^3.0.1",
|
||||
"jsonwebtoken": "^7.4.1",
|
||||
"koa": "^2.0.0",
|
||||
|
Loading…
Reference in New Issue
Block a user