diff --git a/src/views/market/apitest/index.vue b/src/views/market/apitest/index.vue index 7a9e74f..4a16bc1 100644 --- a/src/views/market/apitest/index.vue +++ b/src/views/market/apitest/index.vue @@ -285,7 +285,7 @@
@@ -384,10 +384,14 @@ export default { if (response.code!=200){ alert(response.msg) }else { - alert(JSON.stringify(myapi)) - this.getproductspecification(myapi) + this.getproduct(myapi) this.dialogVisible1=true - + this.newapi={ + productName: myapi.productName, + productPrice: myapi.productPrice, + productContent: myapi.productContent, + productSpecification: myapi.productSpecification + } } }) }, @@ -413,6 +417,15 @@ export default { this.tableData=response.data }) }, + //选择申请规格 + handleEdit(row){ + this.newapi={ + productName:this.myapi.productName, + productSpecification: row.productSpecificationName, + productPrice: row.middlePrice, + productContent:this.myapi.productContent, + } + }, //测试发送请求 无参数 noForm(ruleForm){ sendrequest2(ruleForm).then(response=>{ @@ -450,9 +463,23 @@ export default { container.appendChild(resultDiv); }) //测试次数-1 - reducetestcount(this.myapi).then(response=>{ - }) }, + reducetestcount(this.myapi).then(response=>{}) + }, + //测试发送请求 单个参数 + submitForm(ruleForm){ + sendrequest(ruleForm).then(response=>{ + const jsonData = response.data; + // 使用JSON.stringify()来格式化JSON数据,并设置缩进为2个空格 + const formattedJson = JSON.stringify(jsonData, null, 2); + // 获取元素并设置其innerHTML为格式化的JSON字符串 + document.getElementById('json-display').innerHTML = formattedJson; + }) + //测试次数-1 + reducetestcount(this.myapi).then(response=>{ + }) + + }, //测试发送请求 多个参数 newsForm(ruleForm) { if (ruleForm.productName=='新闻头条'){ @@ -521,10 +548,6 @@ export default { const jsonData = JSON.parse(jsonData1); }); }}, - handleEdit(row) { - this.selectedRow = row; - console.log(row) - }, confirmSelection(row) { this.dialogVisible1=false if (this.selectedRow) { @@ -563,12 +586,9 @@ export default { // 将结果div添加到容器中 container.appendChild(resultDiv); - }) - } + } //测试次数-1 reducetestcount(this.myapi).then(response=>{}) - - } }, //生命周期 - 创建完成(可以访问当前this实例)", @@ -577,6 +597,8 @@ export default { //生命周期 -` 挂载完成(可以访问DOM元素)", mounted() { this.myapi = this.$route.query.myapi + this.getHeader(this.myapi) + this.getRequest((this.myapi)) if (typeof this.myapi === 'string' && this.myapi.trim() !== '') { try { this.myapi = JSON.parse(this.myapi);