Commit 80969031 809690319ccb724d8c8825f6a9cc0a072a4130ae by zhanghao

commit

1 parent ebc0d00f
1 <template xmlns:el-col="http://www.w3.org/1999/html">
2 <div>
3 <json-viewer
4 :value="jsonData"
5 :expand-depth=10
6 copyable></json-viewer>
7 </div>
8 </template>
9
10 <script>
11 export default {
12 data() {
13 return {
14 keyword: this.$route.query.keyword,
15 runtime: this.$route.query.runtime,
16 platform: this.$route.query.platform,
17 jsonData: ''
18 }
19 },
20 mounted() {
21 this.activity()
22 },
23 methods: {
24 activity() {
25 const loading = this.$loading({
26 lock: true,
27 text: '加载中...',
28 spinner: 'el-icon-loading',
29 background: 'rgba(0, 0, 0, 0.7)'
30 });
31 let config = {
32 headers: {
33 'Content-Type': 'application/x-www-form-urlencoded'
34 }
35 }
36 this.$http.get('/tool/nlpApi?'+this.$qs.stringify({
37 keyword: this.keyword,
38 runtime: this.runtime,
39 platform: this.platform
40 }),config).then((res)=>{
41 console.log(res.data)
42 this.jsonData=res.data
43 loading.close();
44 }).catch(error=>{
45 console.log(error);
46 loading.close();
47 this.$message({
48 showClose: true,
49 message: '服务器处理失败,请核对参数!',
50 type: 'error'
51 });
52 })
53 }
54 }
55 }
56 </script>
...@@ -417,6 +417,36 @@ ...@@ -417,6 +417,36 @@
417 </el-dialog> 417 </el-dialog>
418 </el-col> 418 </el-col>
419 </el-row> 419 </el-row>
420 <el-row style="margin-bottom: 15px;">
421 <el-col :span="8">
422 <el-form ref="nlpApi" :model="nlpApi" label-width="0px">
423 <el-card class="darkred" shadow="always">
424 <div slot="header" class="clearfix">
425 <span>NLP语义接口测试</span>
426 </div>
427 <div class="text item">
428 <el-form-item>
429 <el-input placeholder="请输入nlp问题,比如今天天气怎么样" v-model="nlpApi.keyword" clearable></el-input>
430 </el-form-item>
431 <el-form-item>
432 <el-select v-model="nlpApi.huanjing" placeholder="请选择执行环境">
433 <el-option
434 v-for="item in nlpApiOptions"
435 :key="item.value"
436 :label="item.label"
437 :value="item.value">
438 </el-option>
439 </el-select>
440 </el-form-item>
441 <div style="margin: 15px 0;"></div>
442 <el-form-item>
443 <el-button round @click="nlpApiSubmit">调用接口</el-button>
444 </el-form-item>
445 </div>
446 </el-card>
447 </el-form>
448 </el-col>
449 </el-row>
420 </div> 450 </div>
421 </template> 451 </template>
422 452
...@@ -648,7 +678,18 @@ ...@@ -648,7 +678,18 @@
648 cityOptions: [], 678 cityOptions: [],
649 teamOptions: [], 679 teamOptions: [],
650 fourOptions: [], 680 fourOptions: [],
651 fiveOptions: [] 681 fiveOptions: [],
682 nlpApi: {
683 keyword: '',
684 huanjing: []
685 },
686 nlpApiOptions: [{
687 value: '0',
688 label: '测试环境'
689 },{
690 value: '1',
691 label: '线上环境'
692 }],
652 // activityConfigRules: { 693 // activityConfigRules: {
653 // id: [ 694 // id: [
654 // { required: true, message: '请输入活动ID', trigger: 'blur' } 695 // { required: true, message: '请输入活动ID', trigger: 'blur' }
...@@ -1101,6 +1142,11 @@ ...@@ -1101,6 +1142,11 @@
1101 }).catch(error=>{ 1142 }).catch(error=>{
1102 console.log(error); 1143 console.log(error);
1103 }) 1144 })
1145 },
1146 nlpApiSubmit() {
1147 const {href} = this.$router.resolve({ name:'nlpApi', query:
1148 {keyword: this.nlpApi.keyword, runtime: this.nlpApi.huanjing.toString(), platform: "0"}})
1149 window.open(href, '_blank')
1104 } 1150 }
1105 } 1151 }
1106 } 1152 }
......
...@@ -60,6 +60,36 @@ ...@@ -60,6 +60,36 @@
60 </el-dialog> 60 </el-dialog>
61 </el-col> 61 </el-col>
62 <el-col :span="8"> 62 <el-col :span="8">
63 <el-form ref="nlpApi" :model="nlpApi" label-width="0px">
64 <el-card class="darkred" shadow="always">
65 <div slot="header" class="clearfix">
66 <span>NLP语义接口测试</span>
67 </div>
68 <div class="text item">
69 <el-form-item>
70 <el-input placeholder="请输入nlp问题,比如今天天气怎么样" v-model="nlpApi.keyword" clearable></el-input>
71 </el-form-item>
72 <el-form-item>
73 <el-select v-model="nlpApi.huanjing" placeholder="请选择执行环境">
74 <el-option
75 v-for="item in nlpApiOptions"
76 :key="item.value"
77 :label="item.label"
78 :value="item.value">
79 </el-option>
80 </el-select>
81 </el-form-item>
82 <div style="margin: 15px 0;"></div>
83 <el-form-item>
84 <el-button round @click="nlpApiSubmit">调用接口</el-button>
85 </el-form-item>
86 </div>
87 </el-card>
88 </el-form>
89 </el-col>
90 </el-row>
91 <el-row style="margin-bottom: 15px;">
92 <el-col :span="8">
63 <el-form ref="nlpTestCase" :model="nlpTestCase" label-width="0px"> 93 <el-form ref="nlpTestCase" :model="nlpTestCase" label-width="0px">
64 <el-card class="darkred" shadow="always"> 94 <el-card class="darkred" shadow="always">
65 <div slot="header" class="clearfix"> 95 <div slot="header" class="clearfix">
...@@ -161,7 +191,15 @@ ...@@ -161,7 +191,15 @@
161 label: '线上环境' 191 label: '线上环境'
162 }], 192 }],
163 dialogQueryPhoneCode: false, 193 dialogQueryPhoneCode: false,
164 myQueryPhoneCode: '' 194 myQueryPhoneCode: '',
195 nlpApi: {
196 keyword: '',
197 huanjing: []
198 },
199 nlpApiOptions: [{
200 value: '1',
201 label: '线上环境'
202 }],
165 } 203 }
166 }, 204 },
167 mounted() { 205 mounted() {
...@@ -274,6 +312,11 @@ ...@@ -274,6 +312,11 @@
274 message: '内容已复制到剪切板!', 312 message: '内容已复制到剪切板!',
275 type: 'success' 313 type: 'success'
276 }); 314 });
315 },
316 nlpApiSubmit() {
317 const {href} = this.$router.resolve({ name:'nlpApi', query:
318 {keyword: this.nlpApi.keyword, runtime: this.nlpApi.huanjing.toString(), platform: "1"}})
319 window.open(href, '_blank')
277 } 320 }
278 } 321 }
279 } 322 }
......
...@@ -9,6 +9,7 @@ import apiTest from '@/page/apiTest' ...@@ -9,6 +9,7 @@ import apiTest from '@/page/apiTest'
9 import tjUser from '@/page/tjUser' 9 import tjUser from '@/page/tjUser'
10 import nlp from '@/page/nlp' 10 import nlp from '@/page/nlp'
11 import toolAime from '@/page/toolAime' 11 import toolAime from '@/page/toolAime'
12 import nlpApi from '@/page/nlpApi'
12 13
13 Vue.use(Router) 14 Vue.use(Router)
14 15
...@@ -92,6 +93,14 @@ export default new Router({ ...@@ -92,6 +93,14 @@ export default new Router({
92 meta: { 93 meta: {
93 title: '测试工具平台' 94 title: '测试工具平台'
94 } 95 }
96 },
97 {
98 path: '/nlpApi',
99 component: nlpApi,
100 name: 'nlpApi',
101 meta: {
102 title: '测试工具平台'
103 }
95 } 104 }
96 ] 105 ]
97 }) 106 })
......