|
|
@ -85,6 +85,7 @@ function initApiData() { |
|
|
|
'type': item.type, |
|
|
|
'type': item.type, |
|
|
|
'url': '', |
|
|
|
'url': '', |
|
|
|
'response': '{"root": "root"}', |
|
|
|
'response': '{"root": "root"}', |
|
|
|
|
|
|
|
'handled': '', |
|
|
|
'sig': '', |
|
|
|
'sig': '', |
|
|
|
'format': 'json', |
|
|
|
'format': 'json', |
|
|
|
'params': store.state.ecApiModule.ec_api_data.api_params[item.id] |
|
|
|
'params': store.state.ecApiModule.ec_api_data.api_params[item.id] |
|
|
@ -200,8 +201,6 @@ function send_request() { |
|
|
|
// 处理按钮状态 |
|
|
|
// 处理按钮状态 |
|
|
|
req_loading.value = true |
|
|
|
req_loading.value = true |
|
|
|
send_btn.value = '请求中' |
|
|
|
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') { |
|
|
|
if (UserApiData.value.api[activeTab.value].format === 'json') { |
|
|
|
UserApiData.value.api[activeTab.value].response = '{"root": "root"}' |
|
|
|
UserApiData.value.api[activeTab.value].response = '{"root": "root"}' |
|
|
@ -211,6 +210,7 @@ function send_request() { |
|
|
|
} |
|
|
|
} |
|
|
|
const data = handle_request_data() |
|
|
|
const data = handle_request_data() |
|
|
|
ec_api_send_request(data).then(res => { |
|
|
|
ec_api_send_request(data).then(res => { |
|
|
|
|
|
|
|
UserApiData.value.api[activeTab.value].handled = JSON.parse(res.handled) |
|
|
|
if (res.format === 'json') { |
|
|
|
if (res.format === 'json') { |
|
|
|
UserApiData.value.api[activeTab.value].response = JSON.stringify(JSON.parse(res.data), null, 2) |
|
|
|
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(); |
|
|
|
const serializer = new XMLSerializer(); |
|
|
|
UserApiData.value.api[activeTab.value].response = serializer.serializeToString(xmlDoc); |
|
|
|
UserApiData.value.api[activeTab.value].response = serializer.serializeToString(xmlDoc); |
|
|
|
} |
|
|
|
} |
|
|
|
// 处理按钮状态 |
|
|
|
// 处理按钮状态 |
|
|
|
req_loading.value = false |
|
|
|
req_loading.value = false |
|
|
|
send_btn.value = '发送' |
|
|
|
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"}') { |
|
|
|
if (api.response === '{"root": "root"}') { |
|
|
|
return [] |
|
|
|
return [] |
|
|
|
} else { |
|
|
|
} 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-input type="text" v-model="UserApiData.api[api['id']].url" :style="{'font-size': '18px'}"></el-input> |
|
|
|
</el-col> |
|
|
|
</el-col> |
|
|
|
<el-col :span="2"> |
|
|
|
<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> |
|
|
|
<el-col :span="8"> |
|
|
|
<el-col :span="8"> |
|
|
|
</el-col> |
|
|
|
</el-col> |
|
|
|