SanHQin 11 mesi fa
parent
commit
986945355e
1 ha cambiato i file con 17 aggiunte e 12 eliminazioni
  1. 17 12
      src/components/classRoomHelper/component/levitatedSphere.vue

+ 17 - 12
src/components/classRoomHelper/component/levitatedSphere.vue

@@ -115,8 +115,8 @@ export default {
         } else if (this.show == true) {
           if (this.showTextIndex == 2 || this.chatLoading || this.talkLoading) {
             return console.log("组织语言中");
-					// }else if(_msg.indexOf('可可同学') && _msg.indexOf("停止")){
-					// 	this.stopTalk();
+					}else if(_msg.indexOf('可可同学') && _msg.indexOf("停止")){
+						this.stopTalk();
           } else {
             this.showTextIndex = 1;
             this.aiText = "";
@@ -237,6 +237,9 @@ export default {
       iiframe.contentWindow.window.document
         .getElementById("scenarioStopButton")
         .click();
+				if(this.talkLoading){
+					this.stopTalk();
+				}
 			// this.stopTalk();
       // 录音借宿
       iiframe.contentWindow.onSessionStopped = (s, e) => {
@@ -393,19 +396,18 @@ export default {
           this.timer = null;
         }
         console.log(`👉转语音:${_text}`);
-				if(this.talkTextList.length==0){
-					console.log("👉最后一个了,执行结束 👈")
-					_talkTextIiframe2.contentWindow.closesynthesizer();
-				}
+				// if(this.talkTextList.length==0){
+				// 	console.log("👉最后一个了,执行结束 👈")
+				// 	_talkTextIiframe2.contentWindow.closesynthesizer();
+				// }
         // setTimeout(()=>{
         // 	this.talkText();
         // },2000)
         _talkTextIiframe2.contentWindow.texttospeech(_text, this.talkText,this.endTalk);
-      }
-			//  else {
-      //   console.log("👉转语音结束👈");
-      //   _talkTextIiframe2.contentWindow.closesynthesizer();
-      //   this.talkLoading = false;
+      }else {
+        // console.log("👉转语音结束👈");
+        _talkTextIiframe2.contentWindow.closesynthesizer();
+        // this.talkLoading = false;
         // this.timer = setTimeout(() => {
         //   this.showTextIndex = 3;
         //   this.aiStatus = 2;
@@ -413,7 +415,7 @@ export default {
         //   this.userText = "";
         // 	this.time = null;
         // }, 5000);
-      // }
+      }
     },
 		endTalk(){
 			console.log("👉转语音结束👈");
@@ -423,10 +425,13 @@ export default {
 		},
 		stopTalk(){
 			this.talkTextList = [];
+
 			let _talkTextIiframe2 = this.$refs.iiframe2;
 			_talkTextIiframe2.contentWindow.closesynthesizer();
+			_talkTextIiframe2.contentWindow.pausesynthesizer();
 			this.talkLoading = false;
 			// this.talkLoading = false;
+			// this.talkLoading = false;
 			// let _talkTextIiframe2 = this.$refs.iiframe2;
 			// _talkTextIiframe2.contentWindow.closesynthesizer();
 		},