| | |
| | | import React, {Component} from 'react' |
| | | import { fromJS } from 'immutable' |
| | | import md5 from 'md5' |
| | | import { Input, Select, Button, Tabs, Radio, Modal } from 'antd' |
| | | import { Input, Select, Button, Tabs, Radio, Modal, Spin } from 'antd' |
| | | |
| | | import Api from '@/views/interface/api' |
| | | import Utils from '@/utils/utils.js' |
| | |
| | | active: 'raw', |
| | | body: null, |
| | | response: null, |
| | | status: '' |
| | | status: '', |
| | | loading: false |
| | | } |
| | | |
| | | UNSAFE_componentWillMount() { |
| | |
| | | n = JSON.stringify(n) |
| | | } |
| | | |
| | | this.setState({loading: true}) |
| | | |
| | | if (/logon/ig.test(url)) { |
| | | Api.dologon(url, config.method, header, n).then(res => { |
| | | this.handleResponse(res) |
| | |
| | | body = `请求异常${status === 'Network Error' ? ',可能原因:1、网络异常;2、接口跨域。' : '!'}` |
| | | } |
| | | |
| | | this.setState({response: res, body, status}) |
| | | this.setState({response: res, body, status, loading: false}) |
| | | } |
| | | |
| | | encryptParam (param) { |
| | |
| | | } |
| | | |
| | | render () { |
| | | const { active, config, response, body, status } = this.state |
| | | const { active, config, response, body, status, loading } = this.state |
| | | |
| | | let hasParam = config.params.filter(item => item.selected && item.key).length > 0 |
| | | let hasHeader = config.headers.filter(item => item.selected && item.key).length |
| | |
| | | <span className="empty">Hit the Send button to get a response.</span> |
| | | </div>} |
| | | <div style={{paddingLeft: '3px', paddingTop: '3px'}} dangerouslySetInnerHTML={{__html: body}}></div> |
| | | {loading ? <div className="pending"><Spin size="large"/></div> : null} |
| | | </div> |
| | | </div> |
| | | ) |