From 73825303c9daeb20ef7cc31abbc80adf0aa81bc5 Mon Sep 17 00:00:00 2001 From: RogerWork Date: Mon, 19 Aug 2024 15:24:40 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E6=94=AF=E6=8C=81xml=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E5=8C=96=E6=98=BE=E7=A4=BA=202.=20xml=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E9=80=89=E6=8B=A9=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/HelloWorld.vue | 2 +- src/components/ec_api/TabArea.vue | 25 ++++++++++++++++--------- 2 files changed, 17 insertions(+), 10 deletions(-) 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 }} +