zhangwei 2 lat temu
rodzic
commit
9182cdc2a3

+ 2 - 2
src/entry/content.js

@@ -128,8 +128,8 @@ chrome.runtime.onMessage.addListener((req, sender, sendResponse) => {
             twitterPublishHandler(req.publishRes);
             break;
         case 'IFRAME_TWITTER_SHOW_POPUP_PAGE':
-            let {from = ''} = req.data || {};
-            showPopupPage({path: '/NFT', from}); 
+            let {from = '' ,showJoinGroupFinish} = req.data || {};
+            showPopupPage({path: '/NFT', from,showJoinGroupFinish }); 
             break
         case "IFRAME_TWITTER_SHOW_BUY_NFT":
             showBuyNFT(req.data)

+ 27 - 20
src/logic/content/twitter.js

@@ -1187,7 +1187,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?type=${data.type}&buy_nft_status=${data.buy_nft_status}&nft_group_Id=${data.nft_group_Id}`)
+    iframe.src = chrome.runtime.getURL(`/iframe/buy-nft.html#/group?type=${data.type}&buy_nft_status=${data.buy_nft_status}&nft_group_Id=${data.nft_group_Id}&nftProjectId=${data.buyNftProjectId}`)
 }
 
 const TwitterFollowAPI = (item, tweet_Id) => {
@@ -1306,7 +1306,6 @@ function publishNFTTweetEvent({ groupId, postId, srcContent }) {
             let domMain = document.querySelector('main[role="main"]');
             publishTweetBtn = domMain && domMain.querySelector('div[data-testid="tweetButton"]');
         }
-        publishTweetBtn.dataset.denet = 'nft'
         publishTweetBtn && publishTweetBtn.addEventListener('click', function () {
             // 获取文案上报
             let inputEle = document.querySelector('div[contenteditable="true"]');
@@ -1333,6 +1332,10 @@ function publishNFTTweetEvent({ groupId, postId, srcContent }) {
                 actionType: "CONTENT_NFT_TXT_PUBLISH",
                 data: params
             }, () => { });
+
+            setTimeout(() => {
+                document.querySelector('a[data-testid="AppTabBar_Profile_Link"]').click()
+            }, 2000);
         });
     }, 800)
 }
@@ -1659,13 +1662,13 @@ export const setPopupConfByPopupPage = () => {
  * Group Tab List Start 
  */
 
-const addGroupTab =  () => {
+const addGroupTab = () => {
     // if(!tweetAccountBindGroupInfo.isInit) {
     //     getTweetAccountGroupInfo(() => {
     //         main();
     //     })
     // } else {
-        main();
+    main();
     // }
     function main() {
         // if(!tweetAccountBindGroupInfo.isBind) {
@@ -1684,7 +1687,7 @@ const addGroupTab =  () => {
         divNode.appendChild(groupIcon);
         divNode.appendChild(document.createTextNode('Group'));
 
-        if(tabListDom && !groupItemTab) {
+        if (tabListDom && !groupItemTab) {
             let lineDom = document.createElement('div');
             lineDom.id = 'de-tab-line';
             lineDom.style.cssText = `border-radius: 9999px;
@@ -1718,16 +1721,16 @@ const addGroupTab =  () => {
             groupTab.appendChild(lineDom);
             tabListDom.appendChild(groupTab);
 
-            groupTab.addEventListener('mouseenter', function() {
+            groupTab.addEventListener('mouseenter', function () {
                 groupTab.style.background = 'rgba(15, 20, 25, 0.1)'
             });
-            groupTab.addEventListener('mouseleave', function() {
+            groupTab.addEventListener('mouseleave', function () {
                 groupTab.style.background = 'none'
             });
 
-            addGroupTabEventListener({groupTab});
+            addGroupTabEventListener({ groupTab });
         }
-        
+
         addTweetTabEventListener({
             tabListDom
         });
@@ -1786,8 +1789,10 @@ const addGroupTabEventListener = (params) => {
         refreshTabGroup();
 
         window.addEventListener('scroll', addPageScrollEvent)
-        chrome.runtime.sendMessage({ actionType: "SWITCH_GROUP_BANNER_STATUS", 
-                        data: {type: 'btn'}}, () => {});
+        chrome.runtime.sendMessage({
+            actionType: "SWITCH_GROUP_BANNER_STATUS",
+            data: { type: 'btn' }
+        }, () => { });
 
     })
 }
@@ -1840,8 +1845,10 @@ const addTweetTabEventListener = (params) => {
                         display: 'block'
                     });
 
-                    chrome.runtime.sendMessage({ actionType: "SWITCH_GROUP_BANNER_STATUS", 
-                        data: {type: 'arrow'}}, () => {});
+                    chrome.runtime.sendMessage({
+                        actionType: "SWITCH_GROUP_BANNER_STATUS",
+                        data: { type: 'arrow' }
+                    }, () => { });
                 })
             }
         }
@@ -1991,16 +1998,16 @@ export const loginSuccessHandle = () => {
     })
 }
 
-export const setGroupInfo = (params) => {
-    tweetAccountBindGroupInfo.groupInfo = params.data;
-    if(!params.data.nftGroupId) {
+export const setGroupInfo = (params = { data: {} }) => {
+    tweetAccountBindGroupInfo.groupInfo = params.data || {};
+    if (!params.data.nftGroupId) {
         let groupTab = document.querySelector('#de-nav-tab-group');
-        if(groupTab) {
+        if (groupTab) {
             groupTab.style.display = 'none';
         } else {
             setTimeout(() => {
                 groupTab = document.querySelector('#de-nav-tab-group');
-                if(groupTab) {
+                if (groupTab) {
                     groupTab.style.display = 'none';
                 }
             }, 500)
@@ -2019,8 +2026,8 @@ const getTweetAccountGroupInfo = (cb) => {
                 twitterAccount
             }
         }).then(res => {
-            if(res.code == 0) {
-                if(res.data) {
+            if (res.code == 0) {
+                if (res.data) {
                     tweetAccountBindGroupInfo.groupInfo = res.data;
                     tweetAccountBindGroupInfo.isBind = true;
                 } else {

+ 6 - 1
src/view/iframe/buy-nft/buy/home.vue

@@ -119,7 +119,12 @@ const clickJump = (item) => {
     router.push({ path: '/pay' });
 }
 onMounted(() => {
-    let nft_project_Id = getQueryString('nftProjectId') || ''
+
+    let nft_project_Id = router.currentRoute.value.query.nftProjectId
+    let nft_group_Id = router.currentRoute.value.query.nft_group_Id
+    if(nft_group_Id){
+        pay_info.nft_group_Id = nft_group_Id
+    }
     if (!nft_project_Id) {
         return
     }

+ 7 - 2
src/view/iframe/buy-nft/buy/open-box.vue

@@ -20,7 +20,8 @@ let state = reactive({
     },
     nft: {
         data: []
-    }
+    },
+    showJoinGroupFinish: false
 })
 
 const setAllNoShow = () => {
@@ -51,7 +52,8 @@ const showNFTs = () => {
                 chrome.tabs.sendMessage(tab.id, {
                     actionType: "IFRAME_TWITTER_SHOW_POPUP_PAGE",
                     data: {
-                        from: 'BUY_NFT_FINISH'
+                        from: 'BUY_NFT_FINISH',
+                        showJoinGroupFinish: state.showJoinGroupFinish
                     }
                 }, (res) => { });
                 router.replace('/')
@@ -63,6 +65,9 @@ const showNFTs = () => {
 
 onMounted(() => {
     state.nft.data = pay_info.buy_items || []
+    if (pay_info.nft_group_Id) {
+        state.showJoinGroupFinish = true
+    }
     setTimeout(() => {
         state.box.show = false
         showNFTs()

+ 4 - 3
src/view/iframe/buy-nft/group/tip.vue

@@ -23,7 +23,7 @@
                 <span>Own this Group's NFT to Join</span>
                 <img :src="require('@/assets/svg/icon-line.svg')" />
             </div>
-            <div class="btn" v-if="state.type == 'buy' && state.buy_nft_status == 0" @click="clickBuy">
+            <div class="btn" v-if="state.type == 'buy' && state.buy_nft_status == 1" @click="clickBuy">
                 Buy NFT to Join
             </div>
             <div class="btn" v-if="state.type == 'join'" @click="clickJoin">
@@ -66,13 +66,14 @@ const clickJoin = () => {
     }).then((res) => {
         if (res.code == 0) {
             state.show = 'success'
+            state.type = 'buy'
         }
     })
 }
 
 const clickBuy = () => {
     // 传输参数
-    router.push(`/?nft_group_Id=${state.nft_group_Id}&buyNftProjectId=${state.buyNftProjectId}`)
+    router.push(`/?nft_group_Id=${state.nft_group_Id}&nftProjectId=${state.buyNftProjectId}`)
 }
 const clickClose = () => {
     chrome.tabs.getCurrent((tab) => {
@@ -90,7 +91,7 @@ onMounted(() => {
     state.type = router.currentRoute.value.query.type
     state.buy_nft_status = router.currentRoute.value.query.buy_nft_status
     state.nft_group_Id = router.currentRoute.value.query.nft_group_Id
-    state.buyNftProjectId = router.currentRoute.value.query.buyNftProjectId
+    state.buyNftProjectId = router.currentRoute.value.query.nftProjectId
 })
 
 </script>

+ 20 - 27
src/view/iframe/group-card/card.vue

@@ -38,8 +38,8 @@
             </div>
 
             <svg @click="clickArrow" v-show="state.show == 'arrow'" id="denet_tip_group_arrow"
-                style="position: absolute; right: 20px; cursor: pointer;" width="40" height="40" viewBox="0 0 40 40" fill="none"
-                xmlns="http://www.w3.org/2000/svg">
+                style="position: absolute; right: 20px; cursor: pointer;" width="40" height="40" viewBox="0 0 40 40"
+                fill="none" xmlns="http://www.w3.org/2000/svg">
                 <path d="M15 10L26 19.6875L15 29.375" stroke="white" stroke-width="2" />
             </svg>
         </div>
@@ -53,7 +53,7 @@ import { getQueryString } from '@/uilts/help.js';
 import { sendChromeTabMessage, checkIsLogin } from '@/uilts/chromeExtension.js';
 
 let state = reactive({
-    show: 'post', //join
+    show: 'arrow', //join
     show2: '',
     data: {},
     twitterAccount: ''
@@ -83,13 +83,11 @@ const init = (callback) => {
                 // 未加入
                 if (res.data.joinStatus == 0) {
                     state.show2 = 'join'
-                    state.show = 'join'
                     // 已加入
                 } else if (res.data.joinStatus == 1) {
                     state.show2 = 'post'
-                    state.show = 'post'
                 }
-                callback()
+                callback && callback()
             }
         }
         sendMessageToContent({
@@ -138,7 +136,22 @@ async function clickPost() {
 
     // })
     let _userInfo = await checkIsLogin()
-    if (_userInfo) {
+    if (!_userInfo) {
+        return
+    }
+    // 没有购买过
+    if (state.data.buyNftStatus == 0) {
+        sendChromeTabMessage({
+            actionType: "IFRAME_SHOW_JOIN_DIALOG",
+            data: {
+                type: 'buy',
+                buy_nft_status: state.data.buyNftStatus,
+                nft_group_Id: state.data.nftGroupId,
+                buyNftProjectId: state.data.buyNftProjectId
+            }
+        })
+        // 购买过
+    } else if (state.data.buyNftStatus == 1) {
         sendChromeTabMessage({
             actionType: "IFRAME_SHOW_POST_DIALOG",
             data: {
@@ -146,26 +159,6 @@ async function clickPost() {
             }
         })
     }
-
-    // 没有购买过
-    // if (state.data.buyNftStatus == 0) {
-    //     sendChromeTabMessage({
-    //         actionType: "IFRAME_SHOW_JOIN_DIALOG",
-    //         data: {
-    //             type: 'buy',
-    //             buy_nft_status: state.data.buyNftStatus,
-    //             nft_group_Id: state.data.nftGroupId
-    //         }
-    //     })
-    //     // 购买过
-    // } else if (state.data.buyNftStatus == 1) {
-    //     sendChromeTabMessage({
-    //         actionType: "IFRAME_SHOW_POST_DIALOG",
-    //         data: {
-    //             groupId: state.data.nftGroupId
-    //         }
-    //     })
-    // }
 }