Commit cdefcee4 cdefcee4852264c60b0b8b4901074be33aef0988 by zhanghao

commit

1 parent 3c451c72
<template xmlns:el-col="http://www.w3.org/1999/html">
<div>
<json-viewer
:value="jsonData"
:expand-depth=10
copyable></json-viewer>
</div>
</template>
<script>
export default {
data() {
return {
method: this.$route.query.method,
biz_data: this.$route.query.biz_data,
phone: this.$route.query.phone,
path: this.$route.query.path,
type: this.$route.query.type,
jsonData: ''
}
},
mounted() {
this.activity()
},
methods: {
activity() {
const loading = this.$loading({
lock: true,
text: '加载中...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
let config = {
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
}
this.$http.get('/aimeTool/apiTest?'+this.$qs.stringify({
method: this.method,
biz_data: this.biz_data,
phone: this.phone,
path: this.path,
type: this.type
}),config).then((res)=>{
console.log(res.data)
this.jsonData=res.data
loading.close();
}).catch(error=>{
console.log(error);
loading.close();
this.$message({
showClose: true,
message: '服务器处理失败,请核对参数!',
type: 'error'
});
})
}
}
}
</script>
......@@ -161,6 +161,50 @@
</span>
</el-dialog>
</el-col>
<el-col :span="8">
<el-form ref="apiTest" :model="apiTest" label-width="0px">
<el-card class="darkred" shadow="always">
<div slot="header" class="clearfix">
<span>接口访问测试</span>
</div>
<div class="text item">
<el-form-item>
<el-select v-model="apiTest.path" placeholder="请选择接口服务">
<el-option
v-for="item in apiTestPathoptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-input placeholder="请输入method" v-model="apiTest.method" clearable></el-input>
</el-form-item>
<el-form-item>
<el-input placeholder="请输入biz_data" v-model="apiTest.biz_data" clearable></el-input>
</el-form-item>
<el-form-item>
<el-input placeholder="请输入手机号,如果token已失效,请在app进行登录" v-model="apiTest.phone" clearable></el-input>
</el-form-item>
<el-form-item>
<el-select v-model="apiTest.huanjing" placeholder="请选择执行环境">
<el-option
v-for="item in apiTestoptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<div style="margin: 15px 0;"></div>
<el-form-item>
<el-button round @click="apiTestSubmit">调用接口</el-button>
</el-form-item>
</div>
</el-card>
</el-form>
</el-col>
</el-row>
</div>
</template>
......@@ -250,6 +294,30 @@
}],
dialogVisible: false,
mybizdata: '',
apiTest: {
path: [],
method: '',
biz_data: '',
phone: '',
huanjing: []
},
apiTestoptions: [{
value: '1',
label: '线上环境'
}],
apiTestPathoptions: [{
value: 'business',
label: 'business'
}, {
value: 'activity',
label: 'activity'
}, {
value: 'ucenter',
label: 'ucenter'
}, {
value: 'peripheral',
label: 'peripheral'
}],
}
},
mounted() {
......@@ -389,7 +457,12 @@
type: 'error'
});
})
}
},
apiTestSubmit() {
const {href} = this.$router.resolve({ name:'apiTestAime', query:
{method: this.apiTest.method, biz_data: this.apiTest.biz_data, phone: this.apiTest.phone, path: this.apiTest.path.toString(), type: this.apiTest.huanjing.toString()}})
window.open(href, '_blank')
},
}
}
</script>
......
......@@ -6,6 +6,7 @@ import activityConfig from '@/page/activityConfig'
import activityConfigRedis from '@/page/activityConfigRedis'
import userInfo from '@/page/userInfo'
import apiTest from '@/page/apiTest'
import apiTestAime from '@/page/apiTestAime'
import tjUser from '@/page/tjUser'
import nlp from '@/page/nlp'
import toolAime from '@/page/toolAime'
......@@ -95,6 +96,14 @@ export default new Router({
}
},
{
path: '/apiTestAime',
component: apiTestAime,
name: 'apiTestAime',
meta: {
title: '测试工具平台'
}
},
{
path: '/nlpApi',
component: nlpApi,
name: 'nlpApi',
......