Parcourir la source

[edit] tab bar

wenliming il y a 2 ans
Parent
commit
ce37ba693e
1 fichiers modifiés avec 14 ajouts et 7 suppressions
  1. 14 7
      src/view/popup/components/tabbar.vue

+ 14 - 7
src/view/popup/components/tabbar.vue

@@ -37,6 +37,7 @@ import { setBadgeInfo, hideBadge } from "@/logic/background/twitter";
 
 import { nftListMine } from "@/http/nft.js";
 import { getAllMessageInfo } from "@/http/messageApi"
+import { getChromeStorage } from "@/uilts/chromeExtension";
 
 
 const props = defineProps({
@@ -129,10 +130,8 @@ const setActiveTab = () => {
     })
 };
 
-const getNFTListMine = (isNeedProps = true) => {
-    if(isNeedProps) {
-        if(!props.userInfo.accessToken) return;
-    }
+const getNFTListMine = (params = {}) => {
+    if(!props.userInfo.accessToken && !params.accessToken) return;
     nftListMine({
         params: NFTReqParams.params,
     }).then((res) => {
@@ -172,7 +171,7 @@ const msgListener = (req, sender, sendResponse) => {
     switch (req.actionType) {
         case 'CONTENT_POPUP_PAGE_SHOW':
             init();
-            getNFTListMine(false);
+            getNFTListMine();
             break;
     }
 }
@@ -188,12 +187,20 @@ const onPageVisbile = () => {
         let isHidden = document.hidden;
         if (!isHidden) {
             setTimeout(() => {
-                getNFTListMine(false);
-            }, 1200)
+                getUserInfo((res) => {
+                    getNFTListMine(res);
+                })
+            }, 1200);
         }
     });
 }
 
+const getUserInfo = (cb) => {
+    getChromeStorage("userInfo", (res) => {
+        cb && cb(res || {});
+    });
+};
+
 onMounted(() => {
     onMessage();
     init();