|
|
|
@ -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) |
|
|
|
|
} |
|
|
|
@ -222,8 +222,6 @@ function send_request() { |
|
|
|
|
// 处理按钮状态 |
|
|
|
|
req_loading.value = false |
|
|
|
|
send_btn.value = '发送' |
|
|
|
|
console.log('req_loading.value', req_loading.value) |
|
|
|
|
console.log('send_btn.value', 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 === '<root></root>') { |
|
|
|
|
return [] |
|
|
|
|
} else { |
|
|
|
|
return api.handled['res']['data'] |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -411,7 +416,9 @@ const ace_options = { |
|
|
|
|
<el-input type="text" v-model="UserApiData.api[api['id']].url" :style="{'font-size': '18px'}"></el-input> |
|
|
|
|
</el-col> |
|
|
|
|
<el-col :span="2"> |
|
|
|
|
<el-button type="primary" @click="send_request" :loading="req_loading" :disabled="req_loading">{{send_btn}}</el-button> |
|
|
|
|
<el-button type="primary" @click="send_request" :loading="req_loading" :disabled="req_loading"> |
|
|
|
|
{{ send_btn }} |
|
|
|
|
</el-button> |
|
|
|
|
</el-col> |
|
|
|
|
<el-col :span="8"> |
|
|
|
|
</el-col> |
|
|
|
|