From 26d0fa42ea8c63a87e8ef93d0915f75f46fb1f9c Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 24 三月 2022 11:09:53 +0800 Subject: [PATCH] 2022-03-24 --- src/views/interface/workspace/request/index.jsx | 16 ++++++++++------ 1 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/views/interface/workspace/request/index.jsx b/src/views/interface/workspace/request/index.jsx index 33a114d..5c2536c 100644 --- a/src/views/interface/workspace/request/index.jsx +++ b/src/views/interface/workspace/request/index.jsx @@ -1,7 +1,7 @@ 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' @@ -18,7 +18,8 @@ active: 'raw', body: null, response: null, - status: '' + status: '', + loading: false } UNSAFE_componentWillMount() { @@ -95,7 +96,7 @@ if (config.raw) { try { raws = JSON.parse(config.raw) - } catch { + } catch (e) { Modal.error({ title: '鍙傛暟鏍煎紡閿欒锛屽繀椤讳负JSON鏍煎紡锛�' }) @@ -145,6 +146,8 @@ 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) @@ -180,7 +183,7 @@ body = body.replace(/\n/ig, '<br/>') body = body.replace(/\s/ig, ' ') - } catch { + } catch (e) { body = null } } @@ -193,7 +196,7 @@ body = `璇锋眰寮傚父${status === 'Network Error' ? '锛屽彲鑳藉師鍥狅細1銆佺綉缁滃紓甯革紱2銆佹帴鍙h法鍩熴��' : '锛�'}` } - this.setState({response: res, body, status}) + this.setState({response: res, body, status, loading: false}) } encryptParam (param) { @@ -237,7 +240,7 @@ } 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 @@ -297,6 +300,7 @@ <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> ) -- Gitblit v1.8.0