Browse Source

[edit][checkLogin]

zhangwei 2 years ago
parent
commit
6bed129978
1 changed files with 19 additions and 8 deletions
  1. 19 8
      src/view/iframe/nft/card.vue

+ 19 - 8
src/view/iframe/nft/card.vue

@@ -23,7 +23,7 @@
 import { onBeforeMount, ref } from 'vue'
 import { getTwitterSaleNftProjectInfo } from '@/http/nft'
 import { pageUrl } from "@/http/configAPI.js"
-
+import { getChromeStorage } from '@/uilts/chromeExtension.js'
 const saleData = ref({});
 
 const getSaleInfo = () => {
@@ -66,13 +66,24 @@ const share = () => {
 }
 
 const buy = () => {
-    chrome.tabs.getCurrent((tab) => {
-        chrome.tabs.sendMessage(tab.id, {
-            actionType: "IFRAME_TWITTER_SHOW_BUY_NFT",
-            data: {
-                nft_project_Id: saleData.value.nftProjectId
-            }
-        }, (res) => {  });
+    getChromeStorage('userInfo', (_userInfo) => {
+        if (!_userInfo) {
+            chrome.runtime.sendMessage(
+                { actionType: "POPUP_LOGIN", data: "" },
+                (response) => {
+                    console.log("res", response);
+                }
+            )
+        } else {
+            chrome.tabs.getCurrent((tab) => {
+                chrome.tabs.sendMessage(tab.id, {
+                    actionType: "IFRAME_TWITTER_SHOW_BUY_NFT",
+                    data: {
+                        nft_project_Id: saleData.value.nftProjectId
+                    }
+                }, (res) => { });
+            })
+        }
     })
 }