Commit 80969031 809690319ccb724d8c8825f6a9cc0a072a4130ae by zhanghao

commit

1 parent ebc0d00f
<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 {
keyword: this.$route.query.keyword,
runtime: this.$route.query.runtime,
platform: this.$route.query.platform,
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('/tool/nlpApi?'+this.$qs.stringify({
keyword: this.keyword,
runtime: this.runtime,
platform: this.platform
}),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>
......@@ -417,6 +417,36 @@
</el-dialog>
</el-col>
</el-row>
<el-row style="margin-bottom: 15px;">
<el-col :span="8">
<el-form ref="nlpApi" :model="nlpApi" label-width="0px">
<el-card class="darkred" shadow="always">
<div slot="header" class="clearfix">
<span>NLP语义接口测试</span>
</div>
<div class="text item">
<el-form-item>
<el-input placeholder="请输入nlp问题,比如今天天气怎么样" v-model="nlpApi.keyword" clearable></el-input>
</el-form-item>
<el-form-item>
<el-select v-model="nlpApi.huanjing" placeholder="请选择执行环境">
<el-option
v-for="item in nlpApiOptions"
: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="nlpApiSubmit">调用接口</el-button>
</el-form-item>
</div>
</el-card>
</el-form>
</el-col>
</el-row>
</div>
</template>
......@@ -648,7 +678,18 @@
cityOptions: [],
teamOptions: [],
fourOptions: [],
fiveOptions: []
fiveOptions: [],
nlpApi: {
keyword: '',
huanjing: []
},
nlpApiOptions: [{
value: '0',
label: '测试环境'
},{
value: '1',
label: '线上环境'
}],
// activityConfigRules: {
// id: [
// { required: true, message: '请输入活动ID', trigger: 'blur' }
......@@ -1101,6 +1142,11 @@
}).catch(error=>{
console.log(error);
})
},
nlpApiSubmit() {
const {href} = this.$router.resolve({ name:'nlpApi', query:
{keyword: this.nlpApi.keyword, runtime: this.nlpApi.huanjing.toString(), platform: "0"}})
window.open(href, '_blank')
}
}
}
......
......@@ -60,6 +60,36 @@
</el-dialog>
</el-col>
<el-col :span="8">
<el-form ref="nlpApi" :model="nlpApi" label-width="0px">
<el-card class="darkred" shadow="always">
<div slot="header" class="clearfix">
<span>NLP语义接口测试</span>
</div>
<div class="text item">
<el-form-item>
<el-input placeholder="请输入nlp问题,比如今天天气怎么样" v-model="nlpApi.keyword" clearable></el-input>
</el-form-item>
<el-form-item>
<el-select v-model="nlpApi.huanjing" placeholder="请选择执行环境">
<el-option
v-for="item in nlpApiOptions"
: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="nlpApiSubmit">调用接口</el-button>
</el-form-item>
</div>
</el-card>
</el-form>
</el-col>
</el-row>
<el-row style="margin-bottom: 15px;">
<el-col :span="8">
<el-form ref="nlpTestCase" :model="nlpTestCase" label-width="0px">
<el-card class="darkred" shadow="always">
<div slot="header" class="clearfix">
......@@ -161,7 +191,15 @@
label: '线上环境'
}],
dialogQueryPhoneCode: false,
myQueryPhoneCode: ''
myQueryPhoneCode: '',
nlpApi: {
keyword: '',
huanjing: []
},
nlpApiOptions: [{
value: '1',
label: '线上环境'
}],
}
},
mounted() {
......@@ -274,6 +312,11 @@
message: '内容已复制到剪切板!',
type: 'success'
});
},
nlpApiSubmit() {
const {href} = this.$router.resolve({ name:'nlpApi', query:
{keyword: this.nlpApi.keyword, runtime: this.nlpApi.huanjing.toString(), platform: "1"}})
window.open(href, '_blank')
}
}
}
......
......@@ -9,6 +9,7 @@ import apiTest from '@/page/apiTest'
import tjUser from '@/page/tjUser'
import nlp from '@/page/nlp'
import toolAime from '@/page/toolAime'
import nlpApi from '@/page/nlpApi'
Vue.use(Router)
......@@ -92,6 +93,14 @@ export default new Router({
meta: {
title: '测试工具平台'
}
},
{
path: '/nlpApi',
component: nlpApi,
name: 'nlpApi',
meta: {
title: '测试工具平台'
}
}
]
})
......