Jelajahi Sumber

AI参谋跳转高销额列表

zhujindu 1 tahun lalu
induk
melakukan
31e9a8adaf
1 mengubah file dengan 60 tambahan dan 14 penghapusan
  1. 60 14
      src/views/intelligence/index.vue

+ 60 - 14
src/views/intelligence/index.vue

@@ -539,10 +539,8 @@ export default {
         message: '发送中...',
         forbidClick: true,
       });
-      aiDialogue({ type: 3, pageNum: this.pageNum, pageSize: 10 }).then((response) => {
-        loading1.clear();
-        this.loading = false;
-        if (response.code == 200) {
+      this.aiDialogueCommon({ type: 3, pageNum: this.pageNum, pageSize: 10 })
+        .then((response) => {
           this.Ggreet = response.rows.concat(this.Ggreet);
           if (this.Ggreet.length >= response.total) {
             this.isNoData = true;
@@ -552,8 +550,28 @@ export default {
           if (this.pageNum == 1) {
             this.garbageManager();
           }
-        }
-      });
+          loading1.clear();
+          this.loading = false;
+        })
+        .catch(() => {
+          loading1.clear();
+          this.loading = false;
+        });
+      // aiDialogue({ type: 3, pageNum: this.pageNum, pageSize: 10 }).then((response) => {
+      //   loading1.clear();
+      //   this.loading = false;
+      //   if (response.code == 200) {
+      //     this.Ggreet = response.rows.concat(this.Ggreet);
+      //     if (this.Ggreet.length >= response.total) {
+      //       this.isNoData = true;
+      //     } else {
+      //       this.isNoData = false;
+      //     }
+      //     if (this.pageNum == 1) {
+      //       this.garbageManager();
+      //     }
+      //   }
+      // });
     },
     Submit() {
       if (this.content.trim() == '') {
@@ -618,21 +636,49 @@ export default {
             localId: localId,
             isShowProgressTips: 1, // 默认为1,显示进度提示
             success: (res) => {
-              aiDialogue({ type: 2, content: res.serverId }).then((response) => {
-                if (response.code == 200) {
+              this.aiDialogueCommon({ type: 2, content: res.serverId })
+                .then((response) => {
                   this.Ggreet.push(...response.rows);
                   this.garbageManager();
-                }
-                this.shows = false;
-                this.show = false;
-              });
+                  this.shows = false;
+                  this.show = false;
+                })
+                .catch(() => {
+                  this.shows = false;
+                  this.show = false;
+                });
+              // aiDialogue({ type: 2, content: res.serverId }).then((response) => {
+              //   if (response.code == 200) {
+              //     this.Ggreet.push(...response.rows);
+              //     this.garbageManager();
+              //   }
+              //   this.shows = false;
+              //   this.show = false;
+              // });
             },
           });
         },
       });
     },
-    // AI对话接口
-    // aiDialogue
+    //AI对话接口
+    // type:类型:1-用户文本对话 2-用户语音对话 3-欢迎语/查询历史 4-点击AI回答进行匹配结果
+    aiDialogueCommon() {
+      return new Promise((resolve, rejectt) => {
+        aiDialogue({ ...arguments[0] })
+          .then((response) => {
+            if (response.code == 200) {
+              resolve(response);
+            } else {
+              console.log(response.msg);
+              rejectt(response);
+            }
+          })
+          .catch((err) => {
+            console.log(err);
+            rejectt('aiDialogue接口失败');
+          });
+      });
+    },
     typw(val) {
       if (val == 1) {
         this.one14 = true;