浏览代码

[bug][跳转推文详情页]

zhangwei 2 年之前
父节点
当前提交
5f137ec3f1

+ 20 - 0
src/logic/content/help/twitter.js

@@ -0,0 +1,20 @@
+
+// 根据提示dom 跳转到推文详情页面
+export const jumpTwitterDetailByAlert = () => {
+    let num = 10
+    let timer = setInterval(() => {
+        if (num <= 0) {
+            clearInterval(timer)
+            return
+        }
+        let alert = document.querySelector('div[role=alert]')
+        if (alert) {
+            let a = alert.querySelector('a')
+            if (a) {
+                clearInterval(timer)
+                a.click()
+            }
+        }
+        num--
+    }, 500)
+}

+ 21 - 11
src/logic/content/twitter.js

@@ -1,11 +1,12 @@
 import { getChromeStorage, setChromeStorage } from '@/uilts/chromeExtension.js'
-import { throttle, getQueryString, getCookie, nextTick ,getQueryStringByUrl} from '@/uilts/help'
+import { throttle, getQueryString, getCookie, nextTick, getQueryStringByUrl } from '@/uilts/help'
 import { discordAuthRedirectUri } from '@/http/configAPI'
 import { reportSrcPublishEvent } from '@/http/publishApi'
 import Report from "@/log-center/log"
 import { fetchAddFinishEvent } from '@/logic/background/fetch/facebook';
 import { showNFTGroupIcon, hideNFTGroupList, checkUserJoinGroup, elemAddEventListener, addJoinedGroupList } from '@/logic/content/nft';
 import { getTwitterNftGroupInfo } from '@/http/nft'
+import { jumpTwitterDetailByAlert } from '@/logic/content/help/twitter.js'
 
 let dom = {};
 
@@ -658,6 +659,7 @@ function bindTwitterArtMethod() {
 
 import parseCard from './ParseCard'
 import { renderThumbStyle } from 'element-plus'
+import { defaultNavigator } from '_@vueuse_core@8.7.4@@vueuse/core'
 
 // 检测dom改变 
 // 获取短链接 
@@ -1288,7 +1290,15 @@ const TwitterLikeAPI = (tweet_Id) => {
     })
 }
 
+
+
+let click_old_time = new Date().getTime()
 export const showTwitterPost = (data) => {
+    let click_new_time = new Date().getTime()
+    if ((click_new_time - click_old_time) < 3000) {
+        return
+    }
+    click_old_time = click_new_time
     let bigBtn = document.querySelector('a[data-testid="SideNav_NewTweet_Button"]');
     if (bigBtn) {
         bigBtn.click();
@@ -1350,9 +1360,8 @@ export function publishNFTTweetEvent({ groupId, postId, srcContent }) {
                 actionType: "CONTENT_NFT_TXT_PUBLISH",
                 data: params
             }, () => { });
-
+            jumpTwitterDetailByAlert()
             setTimeout(() => {
-                document.querySelector('a[data-testid="AppTabBar_Profile_Link"]').click();
                 setGroupTabSelfStyle({
                     groupColor: 'rgb(83, 100, 113)',
                     groupFontWeight: '500',
@@ -1381,12 +1390,13 @@ export const setTwitterTextarea = (params) => {
     if (inputEle) {
         inputEle.focus();
         document.execCommand("insertText", false, '');
-    }
-    setTimeout(() => {
-        document.execCommand("insertText", false, params.srcContent);
-    }, 1000);
 
-    publishNFTTweetEvent(params)
+        setTimeout(() => {
+            document.execCommand("insertText", false, params.srcContent);
+        }, 1000);
+
+        publishNFTTweetEvent(params)
+    }
 }
 
 
@@ -1767,9 +1777,9 @@ const addGroupTab = () => {
 const hiddenMaskWeb3Tab = (count) => {
     setTimeout(() => {
         count++;
-        if(count < 6) {
+        if (count < 6) {
             let tab = getMaskWeb3Tab();
-            if(tab) {
+            if (tab) {
                 tab.style.display = 'none'
             } else {
                 hiddenMaskWeb3Tab(count);
@@ -1831,7 +1841,7 @@ const addGroupTabEventListener = (params) => {
         window.addEventListener('scroll', addPageScrollEvent);
 
         let tipsDom = document.querySelector('#denet_group_tip');
-        if(tipsDom) {
+        if (tipsDom) {
             chrome.runtime.sendMessage({
                 actionType: "SWITCH_GROUP_BANNER_STATUS",
                 data: { type: 'btn' }

+ 16 - 2
src/view/iframe/buy-nft/group/tip.vue

@@ -51,10 +51,11 @@
 import { reactive, onMounted } from 'vue'
 import { useRouter } from 'vue-router'
 import { setGroupJoin } from '@/http/group.js'
+import { ElMessage } from 'element-plus'
 import { sendChromeTabMessage } from '@/uilts/chromeExtension.js';
 let state = reactive({
     show: 'tip',
-    params:{}
+    params: {}
 })
 const router = useRouter()
 
@@ -69,6 +70,20 @@ const clickJoin = () => {
             state.show = 'success'
             state.params.type = 'buy'
             sendChromeTabMessage({ actionType: "FINISH_GROUP_BANNNER" }, () => { })
+        } else {
+            let msg = ''
+            switch(res.code.toSrting()){
+                case '':
+                    break
+                default:
+                    msg = res.msg
+            }
+            ElMessage({
+                message: msg,
+                grouping: true,
+                type: 'warning',
+                appendTo: document.body
+            })
         }
     })
 }
@@ -91,7 +106,6 @@ const clickFinish = () => {
 
 onMounted(() => {
     let params = router.currentRoute.value.query.params || {}
-    debugger
     state.params = JSON.parse(params)
 })
 

+ 1 - 0
src/view/iframe/group-card/card.vue

@@ -93,6 +93,7 @@ const init = (callback) => {
                 } else if (res.data.joinStatus == 1) {
                     state.show2 = 'post'
                 }
+                // state.show2 = 'join'
                 callback && callback()
             }
         }