nieyuge 2 년 전
부모
커밋
cea42373b5
2개의 변경된 파일64개의 추가작업 그리고 22개의 파일을 삭제
  1. 47 21
      src/view/iframe/tool-box/card.vue
  2. 17 1
      src/view/iframe/tool-box/full.vue

+ 47 - 21
src/view/iframe/tool-box/card.vue

@@ -116,6 +116,10 @@ chrome.runtime.onMessage.addListener((req, sender, sendResponse) => {
                 state.show_btn = true
                 state.status = 'iframe'
                 state.iframe_url = req.data.iframe_url
+                nftAuthINfo.value = req.data.nftAuthINfo
+                state.showMask = req.data.showMask
+                state.detail = req.data.detail
+                state.postId = req.data.postId
             }
             break
     }
@@ -294,13 +298,24 @@ const clickCancel = () => {
 }
 
 const clickFixed = () => {
-    state.handle_type = '固定右上角'
-    getChromeStorage('fullCheck', (res) => {
-        if (res && res.fullCheck) {
-            // 固定
-            handleFixed()
+    getChromeStorage('userInfo', (_userInfo) => {
+        if (!_userInfo) {
+            chrome.runtime.sendMessage(
+                { actionType: "POPUP_LOGIN", data: "" },
+                (response) => {
+                    console.log("res", response);
+                }
+            )
         } else {
-            state.show_alert = true
+            state.handle_type = '固定右上角'
+            getChromeStorage('fullCheck', (res) => {
+                if (res && res.fullCheck) {
+                    // 固定
+                    handleFixed()
+                } else {
+                    state.show_alert = true
+                }
+            })
         }
     })
 }
@@ -310,23 +325,34 @@ const handleFull = () => {
     if (state.status != 'iframe' || !state.iframe_url) {
         return
     }
-    // 切换状态
-    state.status = '固定右上角'
-    state.show_btn = false
-    sendChromeTabMessage({
-        actionType: 'Set_ToolBox_Fixed',
-        data: {
-            type: '全屏',
-            iframe_url: state.iframe_url,
-            tweetId: state.tweetId,
-            nftAuthINfo: nftAuthINfo.value,
-            showMask: state.showMask,
-            detail: state.detail,
-            postId: state.postId,
+    getChromeStorage('userInfo', (_userInfo) => {
+        if (!_userInfo) {
+            chrome.runtime.sendMessage(
+                { actionType: "POPUP_LOGIN", data: "" },
+                (response) => {
+                    console.log("res", response);
+                }
+            )
+        } else {
+            // 切换状态
+            state.status = '固定右上角'
+            state.show_btn = false
+            sendChromeTabMessage({
+                actionType: 'Set_ToolBox_Fixed',
+                data: {
+                    type: '全屏',
+                    iframe_url: state.iframe_url,
+                    tweetId: state.tweetId,
+                    nftAuthINfo: nftAuthINfo.value,
+                    showMask: state.showMask,
+                    detail: state.detail,
+                    postId: state.postId,
+                }
+            })
+            // 清除当前iframe src
+            state.iframe_url = ''
         }
     })
-    // 清除当前iframe src
-    state.iframe_url = ''
 }
 
 // 全屏

+ 17 - 1
src/view/iframe/tool-box/full.vue

@@ -26,7 +26,7 @@
 <script setup>
 import { reactive, ref } from "vue";
 import { ElMessage } from 'element-plus'
-import { getChromeStorage, sendChromeTabMessage } from "@/uilts/chromeExtension";
+import { getChromeStorage, setChromeStorage, sendChromeTabMessage } from "@/uilts/chromeExtension";
 import "element-plus/es/components/message/style/css";
 
 let state = reactive({
@@ -93,6 +93,10 @@ const changeFixed = () => {
             type: '固定右上角',
             iframe_url: state.iframe_url,
             tweetId: state.tweetId,
+            nftAuthINfo: nftAuthINfo.value,
+            showMask: showMask.value,
+            detail: detail.value,
+            postId: postId.value,
         }
     })
 }
@@ -108,6 +112,10 @@ const sendClose = () => {
             type: '关闭',
             iframe_url: state.iframe_url,
             tweetId: state.tweetId,
+            nftAuthINfo: nftAuthINfo.value,
+            showMask: showMask.value,
+            detail: detail.value,
+            postId: postId.value,
         }
     })
     state.iframe_url = ''
@@ -144,6 +152,14 @@ const succBack = () => {
         type: 'success'
     })
     showMask.value = false;
+    // 记录解锁
+    getChromeStorage('post_id_list', (list) => {
+        let originList = list ? list : [];
+        if (originList.indexOf(postId.value) === -1) {
+            originList.push(postId.value)
+            setChromeStorage({ post_id_list: JSON.stringify(originList) })
+        }
+    })
 }
 
 const hideMask = (data) => {