diff --git a/src/views/market/apitest/index.vue b/src/views/market/apitest/index.vue index 5ad4004..66c3c60 100644 --- a/src/views/market/apitest/index.vue +++ b/src/views/market/apitest/index.vue @@ -86,7 +86,7 @@ - +
@@ -107,10 +107,22 @@ 说明:是否只返回有内容详情的新闻, 1:是, 默认0
- +
+ + + + + + + + + 传1时返回单号,默认不返回单号(建议传入) + +
+ 发送请求 - + 发送请求 @@ -320,41 +332,41 @@ export default { }, //测试发送请求 多个参数 newsForm(ruleForm) { - sendrequest1(ruleForm).then(response => { - console.log(response) - const jsonData1 = response.data; // 假设response.data是解析后的JSON对象 + if (ruleForm.productName=='新闻头条'){ + sendrequest1(ruleForm).then(response => { + console.log(response) + const jsonData1 = response.data; // 假设response.data是解析后的JSON对象 - // 解析JSON字符串为JavaScript对象 - const jsonData = JSON.parse(jsonData1); + // 解析JSON字符串为JavaScript对象 + const jsonData = JSON.parse(jsonData1); - // 创建一个容器来展示数据 - var container = document.getElementById('news-list'); - // 清空容器内容 - container.innerHTML = ''; + // 创建一个容器来展示数据 + var container = document.getElementById('news-list'); + // 清空容器内容 + container.innerHTML = ''; - // 创建一个div来存放结果 - var resultDiv = document.createElement('div'); + // 创建一个div来存放结果 + var resultDiv = document.createElement('div'); - // 检查jsonData.reason - if (jsonData.reason !== undefined) { - // 移除reason中的感叹号(如果存在) - resultDiv.innerHTML += '

Reason: ' + jsonData.reason.replace(/!/g, '') + '

'; - } else { - resultDiv.innerHTML += '

Reason: Not available

'; - } + // 检查jsonData.reason + if (jsonData.reason !== undefined) { + // 移除reason中的感叹号(如果存在) + resultDiv.innerHTML += '

Reason: ' + jsonData.reason.replace(/!/g, '') + '

'; + } else { + resultDiv.innerHTML += '

Reason: Not available

'; + } + // 检查jsonData.result + if (jsonData.result !== undefined) { + // 添加其他结果信息 + resultDiv.innerHTML += '

Stat: ' + jsonData.result.stat + '

'; + resultDiv.innerHTML += '

Page: ' + jsonData.result.page + '

'; + resultDiv.innerHTML += '

Page Size: ' + jsonData.result.pageSize + '

'; - // 检查jsonData.result - if (jsonData.result !== undefined) { - // 添加其他结果信息 - resultDiv.innerHTML += '

Stat: ' + jsonData.result.stat + '

'; - resultDiv.innerHTML += '

Page: ' + jsonData.result.page + '

'; - resultDiv.innerHTML += '

Page Size: ' + jsonData.result.pageSize + '

'; - - // 检查jsonData.result.data - if (Array.isArray(jsonData.result.data)) { - // 遍历数据并生成HTML - jsonData.result.data.forEach(item => { - resultDiv.innerHTML += ` + // 检查jsonData.result.data + if (Array.isArray(jsonData.result.data)) { + // 遍历数据并生成HTML + jsonData.result.data.forEach(item => { + resultDiv.innerHTML += `

${item.title}

Unique Key: ${item.uniquekey}

@@ -364,18 +376,57 @@ export default {

URL: ${item.url}

`; - }); + }); + } else { + resultDiv.innerHTML += '

No data available.

'; + } } else { - resultDiv.innerHTML += '

No data available.

'; + resultDiv.innerHTML += '

Result information is not available.

'; } - } else { - resultDiv.innerHTML += '

Result information is not available.

'; - } - // 将结果div添加到容器中 - container.appendChild(resultDiv); + // 将结果div添加到容器中 + container.appendChild(resultDiv); - }); + }); + } + if (ruleForm.productName=='身份证实名认证'){ + sendrequest1(ruleForm).then(response => { + console.log(response) + const jsonData1 = response.data; // 假设response.data是解析后的JSON对象 + + // 解析JSON字符串为JavaScript对象 + const jsonData = JSON.parse(jsonData1); + + // 创建一个容器来展示数据 + var container = document.getElementById('news-list'); + // 清空容器内容 + container.innerHTML = ''; + + // 创建一个div来存放结果 + var resultDiv = document.createElement('div'); + + // 检查jsonData.reason + if (jsonData.reason !== undefined) { + // 移除reason中的感叹号(如果存在) + resultDiv.innerHTML += '

Reason: ' + jsonData.reason.replace(/!/g, '') + '

'; + } else { + resultDiv.innerHTML += '

Reason: Not available

'; + } + // 检查jsonData.result + if (jsonData.result !== undefined) { + // 添加result中的信息 + resultDiv.innerHTML += '

Real Name: ' + jsonData.result.realname + '

'; + resultDiv.innerHTML += '

ID Card: ' + jsonData.result.idcard + '

'; + resultDiv.innerHTML += '

Order ID: ' + jsonData.result.orderid + '

'; + resultDiv.innerHTML += '

Result: ' + jsonData.result.res + '

'; + } else { + resultDiv.innerHTML += '

Result information is not available.

'; + } + + // 将结果div添加到容器中 + container.appendChild(resultDiv); + }) + } //测试次数-1 reducetestcount(this.myapi).then(response=>{ }) diff --git a/src/views/market/myapi/index.vue b/src/views/market/myapi/index.vue index b719245..7644a11 100644 --- a/src/views/market/myapi/index.vue +++ b/src/views/market/myapi/index.vue @@ -8,19 +8,18 @@
- - - - + + + + + + + + 提交
-
新增数据