瀏覽代碼

客厅助手

SanHQin 10 月之前
父節點
當前提交
bfcf57763d

文件差異過大導致無法顯示
+ 386 - 157
src/components/classRoomHelper/component/AnnotationCanvas.vue


+ 38 - 18
src/components/classRoomHelper/component/languageAssistant.vue

@@ -60,11 +60,11 @@
         <el-tooltip
           class="item"
           effect="light"
-          content="暂停语音"
+          content="暂停"
           placement="top"
-          v-if="talkLoading"
+          v-if="canTalk"
         >
-          <span @click.stop="stopTalk">
+          <span @click.stop="canNotTalk">
             <img :src="require('../../../assets/icon/course/stop1.png')" />
             <!-- <svg
               @click.stop="recordStart"
@@ -87,11 +87,11 @@
         <el-tooltip
           class="item"
           effect="light"
-          content="朗读"
+          content="开启"
           placement="top"
           v-else
         >
-          <span class="readAloud" @click.stop="talkAllText">
+          <span class="readAloud" @click.stop="canTalkFn">
             <img :src="require('../../../assets/icon/course/start2.png')" />
             <!-- <svg
 							t="1721117381559"
@@ -190,7 +190,8 @@ export default {
       talkLoading: false,
       source: null,
       talkTextList: [],
-      openMessage: true
+      openMessage: true,
+			canTalk:true,
     };
   },
   computed: {
@@ -215,18 +216,18 @@ export default {
     },
     recordStart(_text) {
       try {
-				let iiframe = this.$refs["iiframe"];
-        iiframe.contentWindow.window.document.getElementById(
-          "languageOptions"
-        ).selectedIndex = 2; //普通话
-				iiframe.contentWindow.testdoContinuousPronunciationAssessment();
+				// let iiframe = this.$refs["iiframe"];
+        // iiframe.contentWindow.window.document.getElementById(
+        //   "languageOptions"
+        // ).selectedIndex = 2; //普通话
+				// iiframe.contentWindow.testdoContinuousPronunciationAssessment();
         
-        // return
-        var OpenCC = require("opencc-js");
-        let converter = OpenCC.Converter({
-          from: "hk",
-          to: "cn"
-        });
+        // // return
+        // var OpenCC = require("opencc-js");
+        // let converter = OpenCC.Converter({
+        //   from: "hk",
+        //   to: "cn"
+        // });
 				this.show = true;
         this.showIndex = 0;
 				this.showTextIndex = 0;
@@ -235,12 +236,14 @@ export default {
         this.isOpen = true;
         this.show = true;
         this.aiText = "我是可可同学,我是个小小百事通,你有什么想和我聊一聊?";
+				return;
         iiframe.contentWindow.onRecognizedResult = e => {
           let _msg = converter(e.privText);
 
           console.log("👇");
           console.log(_msg);
           // _msg = converter(_msg)
+					if(!this.canTalk)return;
           if (!_msg) return console.log("输出为空");
           if (this.show == true) {
             if (
@@ -584,7 +587,24 @@ export default {
         }
       }
       this.stopTalk();
-    }
+    },
+		canNotTalk(){
+			this.canTalk = false;
+			this.showIndex = 2;
+			this.chatLoading = false;
+			this.stopTalk();
+			if(this.source){
+				this.source.close();
+				this.source = null;
+			}
+		},
+		canTalkFn(){
+			this.canTalk = true;
+			this.showIndex = 0;
+			this.showTextIndex = 0;
+			this.aiText = "我是可可同学,我是个小小百事通,你有什么想和我聊一聊";
+			this.chatLoading = false;
+		}
   },
   mounted() {
     this.$nextTick(() => {

+ 1 - 0
src/components/classRoomHelper/component/levitatedSphere.vue

@@ -96,6 +96,7 @@ export default {
 		stopOne(){
 			if(this.source){
 				this.source.close();
+				this.source = null;
 			}
 			if (this.talkLoading) {
         this.stopTalk();

部分文件因文件數量過多而無法顯示