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

fix(kwlPage,questionsAndAnswers): 适配多语言场景设置默认选中的语音选项

根据当前语言环境分别设置iframe内语言选择框的选中索引,com环境设为8,hk环境设为4,其他环境保持默认的2
lsc 14 часов назад
Родитель
Сommit
98be086034

+ 13 - 4
src/components/pages/workPage/components/kwlPage.vue

@@ -326,10 +326,19 @@ export default {
         return;
       }
       try {
-        iframe.contentWindow.window.document.getElementById(
-          "languageOptions"
-        ).selectedIndex = 2;
-
+        if(this.lang.lang == 'com'){
+          iframe.contentWindow.window.document.getElementById(
+            "languageOptions"
+          ).selectedIndex = 8;
+        }else if(this.lang.lang == 'hk'){
+          iframe.contentWindow.window.document.getElementById(
+            "languageOptions"
+          ).selectedIndex = 4;
+        }else{
+          iframe.contentWindow.window.document.getElementById(
+            "languageOptions"
+          ).selectedIndex = 2;
+        }
         iframe.contentWindow.window.onRecognizedResult = (e) => {
           let privText = e.privText;
           if (!privText) {

+ 14 - 4
src/components/pages/workPage/components/questionsAndAnswers.vue

@@ -127,10 +127,20 @@ export default {
     // 开始录音
     startRecord() {
       let iframe = this.$refs["iframeRef"];
-      iframe.contentWindow.window.document.getElementById(
-        "languageOptions"
-      ).selectedIndex = 2;
-
+      if(this.lang.lang == 'com'){
+        iframe.contentWindow.window.document.getElementById(
+          "languageOptions"
+        ).selectedIndex = 8;
+      }else if(this.lang.lang == 'hk'){
+        iframe.contentWindow.window.document.getElementById(
+          "languageOptions"
+        ).selectedIndex = 4;
+      }else{
+        iframe.contentWindow.window.document.getElementById(
+          "languageOptions"
+        ).selectedIndex = 2;
+      }
+      
       iframe.contentWindow.window.onRecognizedResult = e => {
         console.log("onRecognizedResult", e)
         let privText = e.privText;