diff --git a/src/components/HelloWorld.vue b/src/components/HelloWorld.vue index 47b4fd3..87abec8 100644 --- a/src/components/HelloWorld.vue +++ b/src/components/HelloWorld.vue @@ -5,7 +5,7 @@ diff --git a/src/components/ec_api/TabArea.vue b/src/components/ec_api/TabArea.vue index 5e468b2..c7ea257 100644 --- a/src/components/ec_api/TabArea.vue +++ b/src/components/ec_api/TabArea.vue @@ -85,6 +85,7 @@ function initApiData() { 'type': item.type, 'url': '', 'response': '{"root": "root"}', + 'handled': '', 'sig': '', 'format': 'json', 'params': store.state.ecApiModule.ec_api_data.api_params[item.id] @@ -200,8 +201,6 @@ function send_request() { // 处理按钮状态 req_loading.value = true send_btn.value = '请求中' - console.log('req_loading.value', req_loading.value) - console.log('send_btn.value', send_btn.value) // 处理请求 if (UserApiData.value.api[activeTab.value].format === 'json') { UserApiData.value.api[activeTab.value].response = '{"root": "root"}' @@ -211,6 +210,7 @@ function send_request() { } const data = handle_request_data() ec_api_send_request(data).then(res => { + UserApiData.value.api[activeTab.value].handled = JSON.parse(res.handled) if (res.format === 'json') { UserApiData.value.api[activeTab.value].response = JSON.stringify(JSON.parse(res.data), null, 2) } @@ -219,11 +219,9 @@ function send_request() { const serializer = new XMLSerializer(); UserApiData.value.api[activeTab.value].response = serializer.serializeToString(xmlDoc); } - // 处理按钮状态 - req_loading.value = false - send_btn.value = '发送' - console.log('req_loading.value', req_loading.value) - console.log('send_btn.value', send_btn.value) + // 处理按钮状态 + req_loading.value = false + send_btn.value = '发送' } ) @@ -274,7 +272,14 @@ const showList = computed(() => { if (api.response === '{"root": "root"}') { return [] } else { - return JSON.parse(api.response)['res']['data'] + return api.handled['res']['data'] + } + } + if (api.format === 'xml' || api.format === 'html') { + if (api.response === '') { + return [] + } else { + return api.handled['res']['data'] } } } @@ -411,7 +416,9 @@ const ace_options = { - {{send_btn}} + + {{ send_btn }} +