Kaynağa Gözat

Merge branch 'dev_1.1.1' of https://git.yishihui.com/DeNet/de-net into dev_1.1.1

wenliming 2 yıl önce
ebeveyn
işleme
60b7311566

+ 1 - 0
src/http/fetch.js

@@ -20,6 +20,7 @@ export async function commonFetch({ url, method = 'POST' , params = {}, baseInfo
         let _url = baseAPIUrl + url
         fetch(_url, {
             method: method, // or 'PUT'
+            cache: 'no-cache',
             headers: {
                 'Content-Type': 'application/json',
             },

+ 7 - 8
src/logic/content/twitter.js

@@ -837,7 +837,7 @@ export function init() {
         return
     }
     twitterPinLogin();
-    if(window.location.host.includes('twitter.com')){
+    if (window.location.host.includes('twitter.com')) {
         showNFTCard()
         showNFTGroupIcon()
         addEventAction();
@@ -1197,7 +1197,7 @@ export function doTaskTwitterAPI({ task_data, task_type }) {
 export function showJoinDialog(data) {
     let iframe = document.querySelector('#nftProjectId')
     iframe.style.display = 'block'
-    iframe.src = chrome.runtime.getURL(`/iframe/buy-nft.html#/group?params=${JSON.stringify(data)}`)
+    iframe.src = chrome.runtime.getURL(`/iframe/buy-nft.html#/group?params=${JSON.stringify(data)}&time=${new Date().getTime()}`)
 }
 
 const TwitterFollowAPI = (item, tweet_Id) => {
@@ -1411,6 +1411,9 @@ const initGroupTip = () => {
     if (location.pathname == '/compose/tweet') {
         return
     }
+    if (!document.querySelector('div[data-testid=UserName]')) {
+        return
+    }
     if (arr.length >= 2) {
         let twitterAccount = arr[1]
         let iframe_banner = document.querySelector('#denet_group_banner')
@@ -1770,12 +1773,8 @@ const getGroupTabNode = () => {
 }
 
 const addGroupTab = () => {
-    let illegalPages = ['notifications', 'explore', 'followers', 'following'];
-    let page = window.location.pathname.split('/');
-    if (page && page.length) {
-        if (illegalPages.indexOf(page[page.length - 1]) > -1) {
-            return;
-        }
+    if (!document.querySelector('div[data-testid=UserName]')) {
+        return
     }
     let tabListDom = document.querySelector('div[role="tablist"]');
     let groupItemTab = getGroupTabNode();

+ 3 - 2
src/view/iframe/group-card/card.vue

@@ -47,7 +47,7 @@
 </template>
 
 <script setup>
-import { reactive, onMounted } from 'vue'
+import { reactive, onBeforeMount } from 'vue'
 import { getTwitterNftGroupInfo } from "@/http/group";
 import { getQueryString } from '@/uilts/help.js';
 import { sendChromeTabMessage, checkIsLogin } from '@/uilts/chromeExtension.js';
@@ -198,11 +198,12 @@ async function clickPost() {
 }
 
 
-onMounted(() => {
+onBeforeMount(() => {
     state.twitterAccount = getQueryString('twitterAccount') || ''
     init(() => {
         sendChromeTabMessage({ actionType: "IFRAME_SHOW_GROUP_TIP" })
     })
+
 })
 </script>
 

+ 21 - 0
src/view/iframe/nft/group-card.vue

@@ -74,6 +74,19 @@ const reSetBindTwtterId = (_params = {}) => {
     })
 }
 
+const getDetail = () => {
+    getPostDetail({
+        params: {
+            postId: postId
+        }
+    }).then(res => {
+        let { data } = res
+        if (data !== null) {
+            detail.value = JSON.parse(data.postBizData)
+        }
+    })
+}
+
 onMounted(() => {
     getPostDetail({
         params: {
@@ -88,7 +101,15 @@ onMounted(() => {
                 return
             }
         }
+    })
 
+    // 登录回调
+    chrome.runtime.onMessage.addListener((req, sender, sendResponse) => {
+        switch (req.actionType) {
+            case 'BG_LOGIN_SET_USERINFO_CB':
+                getDetail();
+                break;
+        }
     })
 })
 </script>