Prechádzať zdrojové kódy

一次购买后不再显示锁

nieyuge 2 rokov pred
rodič
commit
180e82bcd6

+ 22 - 0
src/view/iframe/tool-box/card.vue

@@ -152,6 +152,14 @@ onMounted(() => {
     })
 
     chrome.runtime.onMessage.addListener(msgListener)
+
+    // 页面返回重试状态
+    document.addEventListener('visibilitychange', function () {
+        let isHidden = document.hidden;
+        if (!isHidden && !nftAuthINfo.value) {
+            getDetail();
+        }
+    });
 })
 
 onBeforeUnmount(() => {
@@ -215,6 +223,12 @@ const getNftInfoStatus = () => {
         let { code, data } = res;
         if ( code === 0 ) {
             nftAuthINfo.value = data;
+            // checkMask
+            getChromeStorage('post_id_list', (list) => {
+                if (list && list.indexOf(state.postId) !== -1 && nftAuthINfo.value?.certStatus === 1) {
+                    state.showMask = false;
+                }
+            })
         }
     })
 }
@@ -249,6 +263,14 @@ const succBack = () => {
         type: 'success'
     })
     state.showMask = false;
+    // 记录解锁
+    getChromeStorage('post_id_list', (list) => {
+        let originList = list ? list : [];
+        if (originList.indexOf(state.postId) === -1) {
+            originList.push(state.postId)
+            setChromeStorage({ post_id_list: JSON.stringify(originList) })
+        }
+    })
 }
 
 const hideMask = (data) => {

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

@@ -41,7 +41,6 @@ let showMask = ref(false)
 let postId = ref('')
 
 chrome.runtime.onMessage.addListener((req, sender, sendResponse) => {
-console.log(3333, req);
     switch (req.actionType) {
         // 事件传输
         case 'Set_ToolBox_Fixed':