Commit cdefcee4 cdefcee4852264c60b0b8b4901074be33aef0988 by zhanghao

commit

1 parent 3c451c72
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 method: this.$route.query.method,
15 biz_data: this.$route.query.biz_data,
16 phone: this.$route.query.phone,
17 path: this.$route.query.path,
18 type: this.$route.query.type,
19 jsonData: ''
20 }
21 },
22 mounted() {
23 this.activity()
24 },
25 methods: {
26 activity() {
27 const loading = this.$loading({
28 lock: true,
29 text: '加载中...',
30 spinner: 'el-icon-loading',
31 background: 'rgba(0, 0, 0, 0.7)'
32 });
33 let config = {
34 headers: {
35 'Content-Type': 'application/x-www-form-urlencoded'
36 }
37 }
38 this.$http.get('/aimeTool/apiTest?'+this.$qs.stringify({
39 method: this.method,
40 biz_data: this.biz_data,
41 phone: this.phone,
42 path: this.path,
43 type: this.type
44 }),config).then((res)=>{
45 console.log(res.data)
46 this.jsonData=res.data
47 loading.close();
48 }).catch(error=>{
49 console.log(error);
50 loading.close();
51 this.$message({
52 showClose: true,
53 message: '服务器处理失败,请核对参数!',
54 type: 'error'
55 });
56 })
57 }
58 }
59 }
60 </script>
...@@ -161,6 +161,50 @@ ...@@ -161,6 +161,50 @@
161 </span> 161 </span>
162 </el-dialog> 162 </el-dialog>
163 </el-col> 163 </el-col>
164 <el-col :span="8">
165 <el-form ref="apiTest" :model="apiTest" label-width="0px">
166 <el-card class="darkred" shadow="always">
167 <div slot="header" class="clearfix">
168 <span>接口访问测试</span>
169 </div>
170 <div class="text item">
171 <el-form-item>
172 <el-select v-model="apiTest.path" placeholder="请选择接口服务">
173 <el-option
174 v-for="item in apiTestPathoptions"
175 :key="item.value"
176 :label="item.label"
177 :value="item.value">
178 </el-option>
179 </el-select>
180 </el-form-item>
181 <el-form-item>
182 <el-input placeholder="请输入method" v-model="apiTest.method" clearable></el-input>
183 </el-form-item>
184 <el-form-item>
185 <el-input placeholder="请输入biz_data" v-model="apiTest.biz_data" clearable></el-input>
186 </el-form-item>
187 <el-form-item>
188 <el-input placeholder="请输入手机号,如果token已失效,请在app进行登录" v-model="apiTest.phone" clearable></el-input>
189 </el-form-item>
190 <el-form-item>
191 <el-select v-model="apiTest.huanjing" placeholder="请选择执行环境">
192 <el-option
193 v-for="item in apiTestoptions"
194 :key="item.value"
195 :label="item.label"
196 :value="item.value">
197 </el-option>
198 </el-select>
199 </el-form-item>
200 <div style="margin: 15px 0;"></div>
201 <el-form-item>
202 <el-button round @click="apiTestSubmit">调用接口</el-button>
203 </el-form-item>
204 </div>
205 </el-card>
206 </el-form>
207 </el-col>
164 </el-row> 208 </el-row>
165 </div> 209 </div>
166 </template> 210 </template>
...@@ -250,6 +294,30 @@ ...@@ -250,6 +294,30 @@
250 }], 294 }],
251 dialogVisible: false, 295 dialogVisible: false,
252 mybizdata: '', 296 mybizdata: '',
297 apiTest: {
298 path: [],
299 method: '',
300 biz_data: '',
301 phone: '',
302 huanjing: []
303 },
304 apiTestoptions: [{
305 value: '1',
306 label: '线上环境'
307 }],
308 apiTestPathoptions: [{
309 value: 'business',
310 label: 'business'
311 }, {
312 value: 'activity',
313 label: 'activity'
314 }, {
315 value: 'ucenter',
316 label: 'ucenter'
317 }, {
318 value: 'peripheral',
319 label: 'peripheral'
320 }],
253 } 321 }
254 }, 322 },
255 mounted() { 323 mounted() {
...@@ -389,7 +457,12 @@ ...@@ -389,7 +457,12 @@
389 type: 'error' 457 type: 'error'
390 }); 458 });
391 }) 459 })
392 } 460 },
461 apiTestSubmit() {
462 const {href} = this.$router.resolve({ name:'apiTestAime', query:
463 {method: this.apiTest.method, biz_data: this.apiTest.biz_data, phone: this.apiTest.phone, path: this.apiTest.path.toString(), type: this.apiTest.huanjing.toString()}})
464 window.open(href, '_blank')
465 },
393 } 466 }
394 } 467 }
395 </script> 468 </script>
......
...@@ -6,6 +6,7 @@ import activityConfig from '@/page/activityConfig' ...@@ -6,6 +6,7 @@ import activityConfig from '@/page/activityConfig'
6 import activityConfigRedis from '@/page/activityConfigRedis' 6 import activityConfigRedis from '@/page/activityConfigRedis'
7 import userInfo from '@/page/userInfo' 7 import userInfo from '@/page/userInfo'
8 import apiTest from '@/page/apiTest' 8 import apiTest from '@/page/apiTest'
9 import apiTestAime from '@/page/apiTestAime'
9 import tjUser from '@/page/tjUser' 10 import tjUser from '@/page/tjUser'
10 import nlp from '@/page/nlp' 11 import nlp from '@/page/nlp'
11 import toolAime from '@/page/toolAime' 12 import toolAime from '@/page/toolAime'
...@@ -95,6 +96,14 @@ export default new Router({ ...@@ -95,6 +96,14 @@ export default new Router({
95 } 96 }
96 }, 97 },
97 { 98 {
99 path: '/apiTestAime',
100 component: apiTestAime,
101 name: 'apiTestAime',
102 meta: {
103 title: '测试工具平台'
104 }
105 },
106 {
98 path: '/nlpApi', 107 path: '/nlpApi',
99 component: nlpApi, 108 component: nlpApi,
100 name: 'nlpApi', 109 name: 'nlpApi',
......