Browse Source

[edit][iframe]

zhangwei 2 years ago
parent
commit
86fffe1439
3 changed files with 13 additions and 9 deletions
  1. 1 0
      src/logic/content/ParseCard.js
  2. 1 0
      src/logic/content/ToolBox.js
  3. 11 9
      src/view/iframe/tool-box/card.vue

+ 1 - 0
src/logic/content/ParseCard.js

@@ -239,6 +239,7 @@ class ParseCard {
         }
         _iframe.id = post_Id
         _iframe_url = chrome.runtime.getURL('/iframe/tool-box.html') + `?page_type=${'card'}&postId=${post_Id}&tweetId=${tweet_Id}`;
+        _iframe.allow = "camera *;microphone *"
         // debugger mode
         if (window.location.href.includes('denet_debugger')) {
             _iframe_url = _iframe_url + '&denet_debugger=1'

+ 1 - 0
src/logic/content/ToolBox.js

@@ -19,6 +19,7 @@ export const toolBox = new class ToolBox {
             border:medium none;  filter: drop-shadow(rgba(0, 0, 0, 0.2) 0px 4px 20px);
             `
         iframe.src = chrome.runtime.getURL('/iframe/tool-box.html') + `?page_type=${'full'}`;
+        iframe.allow = "camera *;microphone *"
         document.body.append(iframe)
     }
     // 切换状态

+ 11 - 9
src/view/iframe/tool-box/card.vue

@@ -147,12 +147,12 @@ const getDetail = () => {
     iframe.onerror = () => {
         state.status = '网页错误'
     }
-    iframe.onload = () => {
-        if (state.status == '加载' || state.status == 'iframe') {
-            state.show_btn = true
-            state.status = 'iframe'
-        }
-    }
+    // iframe.onload = () => {
+    //     if (state.status == '加载' || state.status == 'iframe') {
+    //         state.show_btn = true
+    //         state.status = 'iframe'
+    //     }
+    // }
 
     getPostDetail({
         params: {
@@ -169,10 +169,12 @@ const getDetail = () => {
             }
             console.log('postBizData', state.detail)
             // 加载iframe
-            if (state.detail.viewBgImagePath) {
-                state.cover_url = state.detail.viewBgImagePath
-            }
+            // if (state.detail.viewBgImagePath) {
+            //     state.cover_url = state.detail.viewBgImagePath
+            // }
             state.iframe_url = state.detail.convertUrl
+            state.show_btn = true
+            state.status = 'iframe'
         } else {
             state.status = '网页错误'
         }