Ver código fonte

AI销售参谋接口调试

zhujindu 1 ano atrás
pai
commit
47398e2234
1 arquivos alterados com 28 adições e 20 exclusões
  1. 28 20
      src/views/intelligence/index.vue

+ 28 - 20
src/views/intelligence/index.vue

@@ -15,6 +15,7 @@
       :immediate-check="false">
       <div id="snb" ref="snb1">
         <div style="font-size: 14px" v-for="(item, index) in Ggreet" :key="index">
+          <!-- chatRecordFrom 1:发送内容;2:AI回答内容 -->
           <div style="margin: 14px" v-if="item.chatRecordFrom == 'ai' || item.chatRecordFrom == 2">
             <van-row>
               <van-col span="4" @click="clears"
@@ -86,9 +87,20 @@
                     display: inline-block;
                     float: right;
                   ">
-                  <p style="word-break: break-all" @click="voiceText(item)">
-                    {{ item.chatRecordText }}
-                  </p>
+                  <template v-if="item.type == 'audio'">
+                    <audio>
+                      <source :src="item.audioUrl" type="audio/mpeg" />
+                      <p>
+                        Your browser doesn't support HTML5 audio. Here is a
+                        <a href="myAudio.mp4">link to download the audio</a> instead.
+                      </p>
+                    </audio>
+                  </template>
+                  <template v-else>
+                    <p style="word-break: break-all" @click="voiceText(item)">
+                      {{ item.chatRecordText }}
+                    </p>
+                  </template>
                 </div>
               </van-col>
               <van-col span="4"
@@ -478,6 +490,7 @@ export default {
   //   },
   // },
   activated() {
+    this.isNoData = false;
     this.onLoad();
     // 授权
     getTicketFun(['getLocation', 'startRecord', 'stopRecord', 'onVoiceRecordEnd', 'uploadVoice']);
@@ -613,12 +626,11 @@ export default {
             localId: localId,
             isShowProgressTips: 1, // 默认为1,显示进度提示
             success: (res) => {
-              aiDialogue({ type: 2, content: res.serverId }).then((response) => {
-                if (response.code == 200) {
-                  this.Ggreet.push(...response.rows);
-                  this.garbageManager();
-                }
-                this.show = false;
+              this.shows = false;
+              this.show = false;
+              this.aiDialogueCommon({ type: 2, content: res.serverId }).then((response) => {
+                this.Ggreet.push(...response.rows);
+                this.garbageManager();
               });
             },
           });
@@ -636,17 +648,13 @@ export default {
             localId: localId,
             isShowProgressTips: 1, // 默认为1,显示进度提示
             success: (res) => {
-              this.aiDialogueCommon({ type: 2, content: res.serverId })
-                .then((response) => {
-                  this.Ggreet.push(...response.rows);
-                  this.garbageManager();
-                  this.shows = false;
-                  this.show = false;
-                })
-                .catch(() => {
-                  this.shows = false;
-                  this.show = false;
-                });
+              console.log(res);
+              this.shows = false;
+              this.show = false;
+              this.aiDialogueCommon({ type: 2, content: res.serverId }).then((response) => {
+                this.Ggreet.push(...response.rows);
+                this.garbageManager();
+              });
               // aiDialogue({ type: 2, content: res.serverId }).then((response) => {
               //   if (response.code == 200) {
               //     this.Ggreet.push(...response.rows);