Просмотр исходного кода

Merge branch 'v5.0.0dev' of https://gitee.com/ZhongBangKeJi/CRMEB into v5.0.0dev

liaofei 2 лет назад
Родитель
Сommit
966fbac132

+ 1 - 1
template/admin/src/pages/kefu/pc/index.vue

@@ -646,7 +646,7 @@ export default {
   display: flex;
   flex-direction: column;
   width: 1200px;
-  height: 808px;
+  height: 810px;
   margin: 0 auto;
   background: #fff;
 

+ 21 - 2
template/admin/src/pages/system/backendRouting/debugging.vue

@@ -86,7 +86,12 @@
         <Button class="mt10" type="primary" @click="insertEvent('xTable')">添加参数</Button>
       </div>
       <div v-show="paramsType === 'Body'">
+        <RadioGroup v-model="bodyType" class="mt10">
+          <Radio label="form-data"></Radio>
+          <Radio label="json"></Radio>
+        </RadioGroup>
         <vxe-table
+          v-if="bodyType == 'form-data'"
           class="mt10"
           resizable
           show-overflow
@@ -151,8 +156,14 @@
             </template>
           </vxe-column>
         </vxe-table>
-        <Button class="mt10" type="primary" @click="insertEvent('yTable')">添加参数</Button>
+        <div v-else>
+          <Input v-model="jsonBody" type="textarea" :rows="8" placeholder="请求数据" />
+        </div>
+        <Button v-if="bodyType == 'form-data'" class="mt10" type="primary" @click="insertEvent('yTable')"
+          >添加参数</Button
+        >
       </div>
+
       <div v-show="paramsType === 'Header'">
         <vxe-table
           class="mt10"
@@ -290,10 +301,12 @@ export default {
   },
   data() {
     return {
+      bodyType: 'form-data',
       interfaceData: undefined,
       paramsType: 'Params',
       editor: '', //当前编辑器对象
       codes: '',
+      jsonBody: '',
     };
   },
   created() {
@@ -332,7 +345,10 @@ export default {
       url = this.interfaceData.app_name + '/' + this.interfaceData.path;
       method = this.interfaceData.method;
       params = this.filtersData((await this.$refs.xTable.getTableData().tableData) || []);
-      body = this.filtersData((await this.$refs.yTable.getTableData().tableData) || []);
+      body =
+        this.bodyType === 'json'
+          ? this.jsonBody
+          : this.filtersData((await this.$refs.yTable.getTableData().tableData) || []);
       let h = this.filtersData((await this.$refs.zTable.getTableData().tableData) || []);
       let h1 = this.filtersData((await this.$refs.zaTable.getTableData().tableData) || []);
       headers = {
@@ -340,11 +356,14 @@ export default {
         ...h1,
       };
       console.log(url, method, params, body, headers);
+      this.codes = '';
       requestMethod(url, method, params, body, headers)
         .then((res) => {
+          console.log(res, 'res');
           this.codes = JSON.stringify(res);
         })
         .catch((err) => {
+          console.log(err, 'err');
           this.codes = JSON.stringify(err);
         });
     },

+ 17 - 11
template/admin/src/pages/system/backendRouting/index.vue

@@ -13,7 +13,8 @@
         <div class="tree">
           <div class="main-btn">
             <Button class="mb5 mr10" style="flex: 1" type="primary" @click="clickMenu(4)" long>新增分类</Button>
-            <Button type="success" @click="syncRoute()">同步</Button>
+            <Button type="success mr10" @click="syncRoute()">同步</Button>
+            <Button type="info" @click="debugging()">调试</Button>
           </div>
 
           <vue-tree-list
@@ -91,7 +92,7 @@
               {{ formValidate.name }}
             </div>
             <div>
-              <Button type="primary" class="submission mr20" @click="debugging()">调试</Button>
+              <!-- <Button type="primary" class="submission mr20" @click="debugging()">调试</Button> -->
               <Button v-if="formValidate.id" type="primary" class="submission mr20" @click="isEdit = !isEdit">{{
                 isEdit ? '返回' : '编辑'
               }}</Button>
@@ -521,6 +522,7 @@ export default {
       },
       methodColor: '#fff',
       app_name: 'adminapi',
+      paramsId: 0,
     };
   },
   watch: {
@@ -605,19 +607,23 @@ export default {
       try {
         if (params.method) {
           this.isEdit = false;
-          routeDet(params.id)
-            .then((res) => {
-              this.formValidate = res.data;
-            })
-            .catch((err) => {
-              console.log(err);
-              this.$Message.error(err);
-            });
+          this.paramsId = params.id;
+          this.getRoteData(params.id);
         }
       } catch (error) {
         console.log(error);
       }
     },
+    getRoteData(id) {
+      routeDet(id)
+        .then((res) => {
+          this.formValidate = res.data;
+        })
+        .catch((err) => {
+          console.log(err);
+          this.$Message.error(err);
+        });
+    },
     async handleSubmit() {
       if (!this.formValidate.name) {
         return this.$Message.warning('请输入接口名称');
@@ -634,7 +640,7 @@ export default {
         .then((res) => {
           this.isEdit = false;
           this.$Message.success(res.msg);
-          this.getInterfaceList();
+          this.getRoteData(this.paramsId);
         })
         .catch((err) => {
           this.$Message.error(err);