SanHQin 1 day ago
parent
commit
ad0d2d23d4

+ 1 - 1
dist/index.html

@@ -32,7 +32,7 @@
     html,
     body{
       font-family: '黑体';
-    }</style><link href=./static/css/app.11f3b4be875c1bb5ac3aa39b0767f197.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=./static/js/manifest.3ad1d5771e9b13dbdad2.js></script><script type=text/javascript src=./static/js/vendor.becc9317549795ada446.js></script><script type=text/javascript src=./static/js/app.8c9a6d64fc3d8bfa2add.js></script></body></html><script>function stopSafari() {
+    }</style><link href=./static/css/app.d53c2a296820a76b84fd4a28c7f618a0.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=./static/js/manifest.3ad1d5771e9b13dbdad2.js></script><script type=text/javascript src=./static/js/vendor.becc9317549795ada446.js></script><script type=text/javascript src=./static/js/app.8d1851aa4b0b3cae00b9.js></script></body></html><script>function stopSafari() {
     //阻止safari浏览器双击放大功能
     let lastTouchEnd = 0  //更新手指弹起的时间
     document.documentElement.addEventListener("touchstart", function (event) {

File diff suppressed because it is too large
+ 0 - 0
dist/static/css/app.d53c2a296820a76b84fd4a28c7f618a0.css


File diff suppressed because it is too large
+ 0 - 0
dist/static/css/app.d53c2a296820a76b84fd4a28c7f618a0.css.map


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/app.8d1851aa4b0b3cae00b9.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/app.8d1851aa4b0b3cae00b9.js.map


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/manifest.3ad1d5771e9b13dbdad2.js.map


+ 29 - 31
src/components/pptEasyClass/index.vue

@@ -365,21 +365,21 @@ export default {
         window.recordingData.text = this.transcriptionData.content;
         window.recordingData.textList = this.recordedForm.textList;
         // 将录音文件转为base64并存入localStorage
-        const reader = new FileReader();
-        reader.onload = function(e) {
-          const base64data = e.target.result;
-          try {
-            localStorage.setItem("recordedFileBase64", base64data);
-            localStorage.setItem('recordedFileName', file.name);
-            localStorage.setItem('recordedFileType', file.type);
-            resolve(true)
-            console.log("录音数据已存储到全局对象:", window.recordingData);
-          } catch (err) {
-            resolve(false)
-            console.error("localStorage存储base64文件失败:", err);
-          }
-        };
-        reader.readAsDataURL(file);
+        // const reader = new FileReader();
+        // reader.onload = function(e) {
+        //   const base64data = e.target.result;
+        //   try {
+        //     localStorage.setItem("recordedFileBase64", base64data);
+        //     localStorage.setItem('recordedFileName', file.name);
+        //     localStorage.setItem('recordedFileType', file.type);
+        //     resolve(true)
+        //     console.log("录音数据已存储到全局对象:", window.recordingData);
+        //   } catch (err) {
+        //     resolve(false)
+        //     console.error("localStorage存储base64文件失败:", err);
+        //   }
+        // };
+        // reader.readAsDataURL(file);
       })
     },
     openObserveDialog(pptid,file) {
@@ -388,45 +388,43 @@ export default {
 
       const url = `https://observe.cocorobo.cn/#/newClassroom?userid=${this.userid}&oid=${this.oid}&org=${this.org}&pptid=${pptid}`;
       const _pageWindow = window.open(url, '_blank');
-      // 优化:等待新窗口加载完成后再传递消息,避免部分浏览器下页面未初始化无法接收消息的问题
+
+      // 优化:仅通过轮询方式检查窗口是否加载完成并发送消息,被打开页面无需做任何处理
       const sendFileData = () => {
-        if (!_pageWindow) {
-          console.error("新窗口未成功打开!");
-          return;
+        if (_pageWindow && !_pageWindow.closed) {
+          _pageWindow.postMessage(
+            {
+              type: 'fileData',
+              file,
+            },
+            '*'
+          );
         }
-        _pageWindow.postMessage(
-          {
-            type: 'fileData',
-            file,
-          },
-          '*'
-        );
       };
 
-      // 轮询检测新窗口加载完成(避免跨域无法onload的情况)
       let checkCount = 0;
       const checkLoadedInterval = setInterval(() => {
-        if (_pageWindow.closed) {
+        if (!_pageWindow || _pageWindow.closed) {
           clearInterval(checkLoadedInterval);
           return;
         }
         try {
-          // 有的情况下,如果页面已加载会有document.body等属性
           if (_pageWindow.document && _pageWindow.document.readyState === 'complete') {
             clearInterval(checkLoadedInterval);
             sendFileData();
           }
         } catch (err) {
-          // 跨域时会报错,直接尝试发送
+          // 跨域直接尝试发送
           clearInterval(checkLoadedInterval);
           sendFileData();
         }
-        // 最多检测2秒(20次),防止死循环
         if (++checkCount > 20) {
+          // 最多检测2秒(20次)
           clearInterval(checkLoadedInterval);
           sendFileData();
         }
       }, 100);
+
       setTimeout(()=>{
         window.focus()
       },100)

Some files were not shown because too many files changed in this diff