浏览代码

Merge branch 'dev_1.1.7.1' of DeNet/de-net into master

jihuaqiang 2 年之前
父节点
当前提交
f2a04f9733
共有 45 个文件被更改,包括 1599 次插入762 次删除
  1. 二进制
      src/assets/img/icon-loading-redbag.png
  2. 19 2
      src/entry/content.js
  3. 16 1
      src/http/help.js
  4. 17 1
      src/http/toolBoxApi.js
  5. 18 1
      src/http/treasure.js
  6. 10 7
      src/log-center/logEnum.js
  7. 16 14
      src/logic/background/facebook.js
  8. 108 34
      src/logic/content/ParseCard.js
  9. 6 4
      src/logic/content/ToolBox.js
  10. 2 2
      src/logic/content/facebook.js
  11. 38 38
      src/logic/content/nft.js
  12. 189 107
      src/logic/content/twitter.js
  13. 2 2
      src/manifest.json
  14. 1 0
      src/uilts/chromeExtension.js
  15. 6 0
      src/uilts/denet.js
  16. 13 1
      src/uilts/help.js
  17. 9 9
      src/uilts/messageCenter/index.js
  18. 39 0
      src/uilts/messageCenter/messageContent.js
  19. 25 0
      src/uilts/messageCenter/messageEnum.js
  20. 12 1
      src/view/components/currency-list.vue
  21. 4 4
      src/view/components/custom-card-cover.vue
  22. 12 9
      src/view/content/message/index.vue
  23. 26 27
      src/view/iframe/buy-nft/buy/pay.vue
  24. 18 0
      src/view/iframe/nft/card.vue
  25. 13 21
      src/view/iframe/publish/components/give-dialog-head.vue
  26. 4 4
      src/view/iframe/publish/components/giveaway-poster.vue
  27. 1 1
      src/view/iframe/publish/components/nft-setting.vue
  28. 22 22
      src/view/iframe/publish/components/pay-button.vue
  29. 2 2
      src/view/iframe/publish/components/preview-card.vue
  30. 72 16
      src/view/iframe/publish/give-dialog.vue
  31. 55 77
      src/view/iframe/publish/tool-box/child/editor.vue
  32. 107 12
      src/view/iframe/publish/tool-box/child/preview.vue
  33. 90 5
      src/view/iframe/publish/tool-box/index.vue
  34. 18 16
      src/view/iframe/red-packet/luck-draw.vue
  35. 22 18
      src/view/iframe/red-packet/red-packet.vue
  36. 3 3
      src/view/iframe/tool-box/buy-nft.vue
  37. 2 2
      src/view/iframe/tool-box/card.vue
  38. 2 2
      src/view/iframe/tool-box/full.vue
  39. 2 2
      src/view/iframe/treasure-hunt/components/btn.vue
  40. 80 18
      src/view/iframe/treasure-hunt/components/invite-friends.vue
  41. 61 24
      src/view/iframe/treasure-hunt/components/invite-list.vue
  42. 196 47
      src/view/iframe/treasure-hunt/cover.vue
  43. 58 11
      src/view/iframe/treasure-hunt/index.vue
  44. 5 8
      src/view/iframe/treasure-hunt/invite.vue
  45. 178 187
      src/view/popup/currency-detail.vue

二进制
src/assets/img/icon-loading-redbag.png


+ 19 - 2
src/entry/content.js

@@ -37,7 +37,10 @@ import {
     refreshTabGroup,
     groupTipsSelectGroupTab,
     TwitterApiUserByScreenName,
-    showPublishDialog
+    showPublishDialog,
+    getTweetUserFollowStatus,
+    sendContentByTwitterID,
+    getExtensionStorgeDataForIframe
 } from "@/logic/content/twitter.js";
 
 import { httpBackToContentCallBack } from '@/uilts/chromeExtension.js'
@@ -114,6 +117,14 @@ window.onmessage = (res) => {
             case 'IFRAME_PAGE_JUMP':
                 pageJumpHandler(res.data.data);
                 break;
+            case 'IFRAME_GET_EXTENSION_STORGE_DATA':
+                getExtensionStorgeDataForIframe(res.data.data);
+                break;
+            case 'IFRAME_DO_TASK_CREATE_TWEET':
+                // 做任务
+                // 接受数据,sendmessage
+                console.log('IFRAME_DO_TASK_CREATE_TWEET', res)
+                break
         }
     }
 };
@@ -222,6 +233,12 @@ chrome.runtime.onMessage.addListener((req, sender, sendResponse) => {
         case 'Hide_ToolBox_By_Nft':
             toolBox.hideBuyNft(req)
             break;
+        case 'IFRAME_API_GET_TWEET_USER_FOLLOW_STATUS':
+            getTweetUserFollowStatus(req);
+            break;
+        case 'GET_CONTENT_BY_TWITTER_ID':
+            sendContentByTwitterID(req.data.tweet_Id)
+            break
     }
     sendResponse && sendResponse('ok');
-})
+})

+ 16 - 1
src/http/help.js

@@ -1,6 +1,6 @@
 import { getChromeStorage } from '@/uilts/chromeExtension.js'
 import { srcPublishSuccess } from '@/http/publishApi'
-import { bindRepost } from '@/http/treasure'
+import { bindRepost, bindPostContent } from '@/http/treasure'
 
 // 重新绑定推文id
 export const reSetBindTwtterId = ({
@@ -39,3 +39,18 @@ export const reSetBindRepost = (params, callback) => {
     })
 }
 
+
+
+export const reSetBindPostContent = (params, callback) => {
+    getChromeStorage('userInfo', (_userInfo) => {
+        if (_userInfo && _userInfo.uid) {
+            bindPostContent({
+                params
+            }).then((res) => {
+                if (res.code == 0 || res.code == 3003) {
+                    callback && callback()
+                }
+            })
+        }
+    })
+}

+ 17 - 1
src/http/toolBoxApi.js

@@ -18,7 +18,7 @@ export function getAllPostEditorAppData(params) {
 
 export function screenshotWebsite(params) {
     return service({
-        url: `/post/editor/screenshotWebsite`,
+        url: `/post/editor/screenshotWebsiteV2`,
         method: 'post',
         data: params
     })
@@ -47,3 +47,19 @@ export function unlockNftCert(params) {
         data: params
     })
 }
+
+export function getContentTypeConfig(params) {
+  return service({
+      url: `/post/editor/getContentTypeConfig`,
+      method: 'post',
+      data: params
+  })
+}
+
+export function getPostEditorConfig(params) {
+  return service({
+      url: `/post/editor/getConfig`,
+      method: 'post',
+      data: params
+  })
+}

+ 18 - 1
src/http/treasure.js

@@ -27,12 +27,21 @@ export function inviteDetail(params) {
 
 export function inviteList(params) {
     return service({
-        url: `/post/treasure/invite/list`,
+        url: `/post/treasure/invite/list/v2`,
         method: "post",
         data: params,
     });
 }
 
+export function inviteListRefresh(params) {
+    return service({
+        url: `/post/treasure/invite/list/refresh`,
+        method: "post",
+        data: params,
+    });
+
+}
+
 export function treasureOpen(params) {
     return service({
         url: `/post/treasure/open`,
@@ -74,4 +83,12 @@ export function bindRepost(params) {
         method: "post",
         data: params,
     });
+}
+
+export function bindPostContent(params) {
+    return service({
+        url: `/post/bindPostSrcContent`,
+        method: "post",
+        data: params,
+    });
 }

+ 10 - 7
src/log-center/logEnum.js

@@ -26,6 +26,8 @@ export const objectType = {
     loginButton: "login-button",
     withdrawButton: "withdraw-button",
     topupButton: "topup-button",
+    previewNextButton: 'preview-next-button',
+    setPublishContent: 'set-publish-content',
 
 
     getMoreGiveaway: "get-more-giveaway",
@@ -68,7 +70,7 @@ export const objectType = {
     // background文件安装catch异常
     background_function_catch: 'background-function-catch',
     // background 文件chrome 函数 try
-    background_function_try:'background-function-try',
+    background_function_try: 'background-function-try',
     // create Nft
     create_nfts_button: 'create-nfts-button',
     confirm_transfer_button: 'confirm-transfer-button',
@@ -82,6 +84,7 @@ export const objectType = {
     top_right_button: 'top-right-button',
     fullscreen_button: 'fullscreen-button',
     encrypte_nft_button: 'encrypte-nft-button',
+    preRepost: 'preRepost',
 }
 
 export const pageSource = {
@@ -150,11 +153,11 @@ export const bizType = {
 }
 
 export const getCurrentBizType = (type) => {
-  let obj = {};
-  obj[PlayType.common] = bizType.RedPacket;
-  obj[PlayType.lottery] = bizType.Lottery;
-  obj[PlayType.treasure] = bizType.Treasure;
-  obj[PlayType.postEditor] = bizType.ToolBox;
+    let obj = {};
+    obj[PlayType.common] = bizType.RedPacket;
+    obj[PlayType.lottery] = bizType.Lottery;
+    obj[PlayType.treasure] = bizType.Treasure;
+    obj[PlayType.postEditor] = bizType.ToolBox;
 
-  return obj[type];
+    return obj[type];
 }

+ 16 - 14
src/logic/background/facebook.js

@@ -10,21 +10,23 @@ export function facebookShareSuccess(params, sender) {
         let { id } = sender.tab || {};
         chrome.tabs.remove(id);
 
-        fetchAddFinishEvent({
+        if(!data.bizType) {
+          fetchAddFinishEvent({
             eventType: data.type,
             luckdropId: data.taskLuckdropId
-        }).then(res => {
-            if (res.code == 0) {
-                setTimeout(() => {
-                    sendActivetabMessage({
-                        actionType: 'BG_FACEBOOK_SHARE_SUCCESS',
-                        data: data
-                    });
-                })
-            }
-        }).catch((error) => {
-            console.log('catch', error)
-        })
+          }).then(res => {
+              if (res.code == 0) {
+                  setTimeout(() => {
+                      sendActivetabMessage({
+                          actionType: 'BG_FACEBOOK_SHARE_SUCCESS',
+                          data: data
+                      });
+                  })
+              }
+          }).catch((error) => {
+              console.log('catch', error)
+          })
+        }
     } catch (error) {
         Report.reportLog({
             objectType: Report.objectType.background_function_catch,
@@ -52,4 +54,4 @@ function sendActivetabMessage(message = {}) {
             errMsg: error.message
         })
     }
-}
+}

+ 108 - 34
src/logic/content/ParseCard.js

@@ -1,7 +1,9 @@
+import { iframeHost } from '@/http/configAPI'
 import { getChromeStorage, setChromeStorage } from '@/uilts/chromeExtension.js'
 import ToolBox from '@/view/content/tool-box/index.vue'
 import { createApp } from 'vue'
-
+import { getStorage, setStorage, guid } from '@/uilts/help'
+import { chromeExtensionUrl } from '@/uilts/chromeExtension'
 // 解析卡片类
 // 1.dom匹配
 // 2.找出网页匹配 获取twitterid
@@ -61,19 +63,29 @@ class ParseCard {
         // 是否有#DeNet
         return has_denet
     }
-    parseAllDeNetCard() {
+    parseAllDeNetCard(has_iframe = false) {
         let de_net_card = []
         try {
             let arr_article = document.querySelectorAll('article') || []
             let _txt
             for (let i in arr_article) {
                 _txt = arr_article[i].innerText || ''
-                if ((_txt.includes('#DeNet') || _txt.includes('#DNFT') || this.compatibleMask(arr_article[i])) && !this.isHasIframeByArticle(arr_article[i])) {
-                    de_net_card.push({
-                        time: new Date().getTime(),
-                        dom: arr_article[i]
-                    })
+                if (has_iframe) {
+                    if ((_txt.includes('#DeNet') || _txt.includes('#DNFT') || this.compatibleMask(arr_article[i]))) {
+                        de_net_card.push({
+                            time: new Date().getTime(),
+                            dom: arr_article[i]
+                        })
+                    }
+                } else {
+                    if ((_txt.includes('#DeNet') || _txt.includes('#DNFT') || this.compatibleMask(arr_article[i])) && !this.isHasIframeByArticle(arr_article[i])) {
+                        de_net_card.push({
+                            time: new Date().getTime(),
+                            dom: arr_article[i]
+                        })
+                    }
                 }
+
             }
         } catch (error) {
         }
@@ -154,9 +166,9 @@ class ParseCard {
             return
         }
     }
-    parseAllDeNetCardParmas() {
+    parseAllDeNetCardParmas(has_iframe = false) {
         let json_data = []
-        this.parseAllDeNetCard().forEach((item) => {
+        this.parseAllDeNetCard(has_iframe).forEach((item) => {
             let _obj = this.parseCardParmas(item.dom)
             if (_obj.tweet_Id && _obj.short_url && _obj.dom_card) {
                 _obj.time = item.time
@@ -178,23 +190,24 @@ class ParseCard {
     }
     // 获取短链接和渲染卡片数据
     async getCardParmas(card_json_data) {
-        let sort_link_data = await getChromeStorage('cardData') || []
+        let sort_link_data = getStorage('denetCardData') || []
+        // let sort_link_data = await getChromeStorage('cardData') || []
         let has_post_Id_card_data = this.getLocalHasPostIdData(sort_link_data, card_json_data)
-        let need_net_short_url = this.filterShortUrl(sort_link_data, card_json_data)
+        let need_net_short_urls = this.filterShortUrl(sort_link_data, card_json_data)
 
         // 校验存储大小
         let new_item = this.checkShortUrlArraySize(sort_link_data)
         if (sort_link_data.length != new_item.length) {
-            setChromeStorage({ cardData: JSON.stringify(new_item) })
+            setStorage('denetCardData', new_item)
         }
         return {
             has_post_Id_card_data,
-            need_net_short_url
+            need_net_short_urls
         }
     }
     filterShortUrl(sort_link_data, card_json_data) {
         let has = false
-        let need_net_short_url = []
+        let need_net_short_urls = []
 
         card_json_data.forEach((card_item) => {
             has = false
@@ -204,11 +217,11 @@ class ParseCard {
                 }
             })
             if (!has) {
-                need_net_short_url.push(card_item.short_url)
+                need_net_short_urls.push(card_item.short_url)
             }
         })
         // 返回的是没有postid的
-        return need_net_short_url
+        return need_net_short_urls
     }
     getLocalHasPostIdData(sort_link_data = [], card_json_data = []) {
         // 
@@ -224,8 +237,53 @@ class ParseCard {
         })
         return has_post_Id_card_data
     }
+    netShortUrl(need_net_short_urls = [], callback) {
+        // 1. 获取短链接
+        let denetCardData = getStorage('denetCardData') || []
+
+        need_net_short_urls.forEach((short_url) => {
+            // // 本地没有 存储 
+            if (denetCardData.filter((item) => { return item.short_url == short_url }).length == 0) {
+                denetCardData.push({
+                    short_url
+                })
+            }
+        })
+
+        setStorage('denetCardData', denetCardData)
+
+        // 发起网络请求
+        if (!navigator.onLine) {
+            return
+        }
+        let now_time
+        for (let i in denetCardData) {
+            now_time = new Date().getTime()
+            // 没请求过 || 现在时间 - 网络请求时间 >= 3s && 没有post_Id
+            if ((!denetCardData[i].fetch_time || (now_time - denetCardData[i].fetch_time) >= 3000) && !denetCardData[i].post_Id) {
+                // 发起网络请求请求
+                denetCardData[i].fetch_time = now_time
+                fetch(denetCardData[i].short_url) // 返回一个Promise对象 
+                    .then((res) => {
+                        return res.text() // res.text()是一个Promise对象
+                    }).then((res) => {
+                        res = res.toString()
+                        let str_arr = res.match(/denetme.net\/([\s\S]*?)"/) || []
+                        let post_Id = str_arr[1] || ''
+                        if (!post_Id) {
+                            return
+                        }
+                        denetCardData[i].post_Id = post_Id
+                        setStorage('denetCardData', denetCardData)
+                        callback && callback()
+                    }).catch((error) => {
+                        console.log('catch', error)
+                    })
+            }
+        }
+    }
     checkShortUrlArraySize(_array) {
-        if (new Blob(_array).size >= 1024 * 1024) {
+        if (new Blob(_array).size >= 1024 * 1024 * 4) {
             _array.splice(0, parseInt(_array.length / 2))
         }
         return _array
@@ -238,7 +296,7 @@ class ParseCard {
             tweet_str = `&tweetId=${tweet_Id}`
         }
         _iframe.id = post_Id
-        _iframe_url = chrome.runtime.getURL('/iframe/tool-box.html') + `?page_type=${'card'}&postId=${post_Id}&tweetId=${tweet_Id}`;
+        _iframe_url = chromeExtensionUrl + ('iframe/tool-box.html') + `?page_type=${'card'}&postId=${post_Id}&tweetId=${tweet_Id}`;
         _iframe.allow = "camera *;microphone *"
         // debugger mode
         if (window.location.href.includes('denet_debugger')) {
@@ -257,7 +315,7 @@ class ParseCard {
             tweet_str = `&tweetId=${tweet_Id}`
         }
         _iframe.id = post_Id
-        _iframe_url = chrome.runtime.getURL('/iframe/red-packet.html') + `?postId=${post_Id}${tweet_str}&tweet_author=${tweet_author}&window_origin=${window.location.origin}&page_type=${page_type}`;
+        _iframe_url = chromeExtensionUrl + ('iframe/red-packet.html') + `?postId=${post_Id}${tweet_str}&tweet_author=${tweet_author}&window_origin=${window.location.origin}&page_type=${page_type}`;
         // debugger mode
         if (window.location.href.includes('denet_debugger')) {
             _iframe_url = _iframe_url + '&denet_debugger=1'
@@ -274,21 +332,21 @@ class ParseCard {
         let projectId = project_arr[0]
         let _iframe = document.createElement('iframe')
         _iframe.id = project_Id
-        _iframe.src = chrome.runtime.getURL('/iframe/nft-card.html') + `?projectId=${projectId}&tweetId=${tweet_Id}&twitterAccount=${project_arr[1]}`;
+        _iframe.src = chromeExtensionUrl + ('iframe/nft-card.html') + `?projectId=${projectId}&tweetId=${tweet_Id}&twitterAccount=${project_arr[1]}`;
         _iframe.style.cssText = 'border:medium none; width:375px; min-height:300px;'
         return _iframe
     }
     createNftGroupIframe({ project_Id, tweet_Id }) {
         let _iframe = document.createElement('iframe')
         _iframe.id = project_Id
-        _iframe.src = chrome.runtime.getURL('/iframe/nft-group-card.html') + `?projectId=${project_Id}&tweet_Id=${tweet_Id}`;
+        _iframe.src = chromeExtensionUrl + ('iframe/nft-group-card.html') + `?projectId=${project_Id}&tweet_Id=${tweet_Id}`;
         _iframe.style.cssText = 'border:medium none; width:505px; min-height:180px;'
         return _iframe
     }
     createTreasureIframe(params = { page_type, tweet_Id, post_Id, invite_code }) {
         let _iframe = document.createElement('iframe')
         _iframe.id = params.post_Id
-        _iframe.src = chrome.runtime.getURL('/iframe/treasure-hunt.html') + `?params=${JSON.stringify(params)}`;
+        _iframe.src = chromeExtensionUrl + ('iframe/treasure-hunt.html') + `?params=${JSON.stringify(params)}&iframeId=${guid()}`;
         _iframe.style.cssText = 'border:medium none; width:375px; min-height:500px; border: 1px solid #DCDCDC; border-radius: 20px;'
         return _iframe
     }
@@ -528,28 +586,34 @@ class ParseCard {
         if (!dom_card || !dom_card.parentElement) {
             return
         }
-        let dom = dom_card.querySelector('div[id^=jsc_c_]').parentElement
-        dom.style = 'min-height:500px'
+        let card = dom_card.querySelector('div[id^=jsc_c_]');
+        let dom = card && card.parentElement;
         if (dom) {
-            for (let i = 0; i < dom.childNodes.length; i++) {
-                if (dom.childNodes[i].dataset && dom.childNodes[i].dataset.testid && dom.childNodes[i].dataset.testid == 'card.wrapper') {
-                    dom.children[i].style.display = 'none'
-                }
-            }
-
-            if (dom.nextElementSibling && dom.nextElementSibling.id && dom.nextElementSibling.id.indexOf('jsc_c_') >= 0) {
-                dom.nextElementSibling.style.display = 'none'
-            }
             let originUrl = new URL(short_url);
             let post_Id = originUrl.pathname.slice(1);
 
             if (post_Id.indexOf('luckdraw/') >= 0) {
+                hideImage(dom);
+                dom.style = 'min-height:500px'
                 post_Id = post_Id.replace('luckdraw/', '');
                 dom.appendChild(this.createIframe({ post_Id, tweet_author, page_type: '抽奖' }, true))
-            } else if (!post_Id.includes('/')) {
+            } else if (post_Id.indexOf('/') === -1) {
+                hideImage(dom);
+                dom.style = 'min-height:500px'
                 dom.appendChild(this.createIframe({ post_Id, tweet_author }, true))
             }
         }
+
+        function hideImage(dom) {
+            for (let i = 0; i < dom.childNodes.length; i++) {
+                if (dom.childNodes[i].dataset && dom.childNodes[i].dataset.testid && dom.childNodes[i].dataset.testid == 'card.wrapper') {
+                    dom.children[i].style.display = 'none'
+                }
+            }
+            if (dom.nextElementSibling && dom.nextElementSibling.id && dom.nextElementSibling.id.indexOf('jsc_c_') >= 0) {
+                dom.nextElementSibling.style.display = 'none'
+            }
+        }
     }
     replaceNftGroupDomRedPacket({ dom_card, tweet_Id, post_Id, time, short_url }) {
         if (!dom_card || !dom_card.parentElement) {
@@ -572,5 +636,15 @@ class ParseCard {
             dom.appendChild(this.createNftGroupIframe({ project_Id, tweet_Id }))
         }
     }
+    // 根据推特id获取文章推文
+    getContentByTwitterId(tweet_Id) {
+        let txt = ''
+        let card_json_data = this.parseAllDeNetCardParmas(true)
+        let result = card_json_data.filter((item) => { return item.tweet_Id == tweet_Id }) || []
+        if (result.length > 0 && result[0].dom_card) {
+            txt = result[0].dom_card.querySelector('[data-testid="tweetText"]').innerText.replace('…', ' ')
+        }
+        return txt
+    }
 }
 export default new ParseCard()

+ 6 - 4
src/logic/content/ToolBox.js

@@ -1,4 +1,6 @@
 import { $ } from "@/uilts/help";
+import { chromeExtensionUrl } from '@/uilts/chromeExtension'
+
 export let toolbox_fixed_tweetId = ''
 
 export const toolBox = new class ToolBox {
@@ -18,7 +20,7 @@ export const toolBox = new class ToolBox {
             display:none;
             border:medium none;  filter: drop-shadow(rgba(0, 0, 0, 0.2) 0px 4px 20px);
             `
-        iframe.src = chrome.runtime.getURL('/iframe/tool-box.html') + `?page_type=${'full'}`;
+        iframe.src = chromeExtensionUrl + ('iframe/tool-box.html') + `?page_type=${'full'}`;
         iframe.allow = "camera *;microphone *"
         document.body.append(iframe)
     }
@@ -59,12 +61,12 @@ export const toolBox = new class ToolBox {
     // 购买NFT
     buyNft(req) {
         let iframe = document.createElement('iframe')
-            iframe.src = chrome.runtime.getURL('/iframe/tool-box-buy-nft.html') + `?postId=${req.data.postId}`;
+        iframe.src = chromeExtensionUrl + ('iframe/tool-box-buy-nft.html') + `?postId=${req.data.postId}`;
         let ifAppend = document.querySelector('#denet-tool-box-buy-nft')
         if (ifAppend) return;
         let div = document.createElement(`div`);
-            div.id = 'denet-tool-box-buy-nft';
-            div.innerHTML = `
+        div.id = 'denet-tool-box-buy-nft';
+        div.innerHTML = `
                 ${iframe.outerHTML}
                 <div class="mask_bg"></div>
                 <style>

+ 2 - 2
src/logic/content/facebook.js

@@ -17,7 +17,7 @@ export function initFacebookContent() {
 
 /**
  * 注入分享页面逻辑
- * @returns 
+ * @returns
  */
 function injectShareCode() {
     const {href, pathname} = window.location;
@@ -66,4 +66,4 @@ function shareCallback() {
             chrome.runtime.sendMessage({ actionType: "CONTENT_FACEBOOK_SHARE_SUCCESS", data: params })
         }
     }
-}
+}

+ 38 - 38
src/logic/content/nft.js

@@ -1,6 +1,6 @@
 import { getOffsetRect, nextTick } from '@/uilts/help'
 import { listJoinNftGroup } from '@/http/nft';
-import { getChromeStorage } from '@/uilts/chromeExtension.js'
+import { getChromeStorage, chromeExtensionUrl } from '@/uilts/chromeExtension.js'
 import { _setPublishContent, publishNFTTweetPost, bindTwitterArt, bindTwitterArtMethod } from './twitter';
 import { jumpTwitterDetailByAlert } from '@/logic/content/help/twitter.js'
 import Report from "@/log-center/log"
@@ -18,29 +18,29 @@ export const showNFTGroupIcon = () => {
     let where = isTwitter && toolElem && !isAppend && ifShowNftGroup;
     if (where) {
         let oDiv = document.createElement(`div`);
-            oDiv.id = 'de-nft-group-enter';
+        oDiv.id = 'de-nft-group-enter';
         let oImg = document.createElement('img');
-            oImg.src = groupImgNoSelect;
-            oImg.className = 'addGroup';
-            oDiv.innerHTML = `
+        oImg.src = groupImgNoSelect;
+        oImg.className = 'addGroup';
+        oDiv.innerHTML = `
                 ${oImg.outerHTML}
                 <style>
                     #de-nft-group-enter {position:relative; display:flex; padding:0 8px;}
                     #de-nft-group-enter .addGroup {cursor:pointer; height:32px;}
                 </style>
             `;
-            oDiv.addEventListener('click', (e) => {
-                showNFTGroupList(e);
-                e.stopPropagation();
-                // report
-                Report.reportLog({
-                    pageSource: Report.pageSource.mainPage,
-                    businessType: Report.businessType.buttonClick,
-                    objectType: Report.objectType.buttonSecond
-                }, {
-                    type: 2
-                });
-            })
+        oDiv.addEventListener('click', (e) => {
+            showNFTGroupList(e);
+            e.stopPropagation();
+            // report
+            Report.reportLog({
+                pageSource: Report.pageSource.mainPage,
+                businessType: Report.businessType.buttonClick,
+                objectType: Report.objectType.buttonSecond
+            }, {
+                type: 2
+            });
+        })
         toolElem.firstChild.appendChild(oDiv)
         // report
         Report.reportLog({
@@ -61,11 +61,11 @@ export const showNFTGroupList = (e) => {
     let wHeight = document.body.offsetHeight || document.body.clientHeight;
     if ((top + height + 290) > wHeight) oTop = top - 290;
     let iframe = document.createElement('iframe');
-        iframe.src = chrome.runtime.getURL(`/iframe/nft-group.html`)
-        iframe.style.cssText = 'border:medium none; width:315px; height:260px;';
+    iframe.src = chromeExtensionUrl + (`iframe/nft-group.html`)
+    iframe.style.cssText = 'border:medium none; width:315px; height:260px;';
     let html = document.createElement('div');
-        html.id = 'de-nft-group-list';
-        html.innerHTML = `
+    html.id = 'de-nft-group-list';
+    html.innerHTML = `
             <div class="de-nft-group-div">
                 ${iframe.outerHTML}
             </div>
@@ -141,11 +141,11 @@ export const endPostContent = () => {
     return new Promise((resolve) => {
         let inputEle = document.querySelector('div[contenteditable="true"]');
         let range = document.createRange();
-            range.selectNodeContents(inputEle);
-            range.collapse(false);
+        range.selectNodeContents(inputEle);
+        range.collapse(false);
         let sel = window.getSelection();
-            sel.removeAllRanges();
-            sel.addRange(range);
+        sel.removeAllRanges();
+        sel.addRange(range);
         resolve()
     })
 }
@@ -171,7 +171,7 @@ export const setNFTGroupContent = (res) => {
         nextTick(() => {
             _addTweetButtonListen()
         }, 100)
-        
+
     } else {
         endPostContent().then(() => {
             let inputEle = document.querySelector('div[contenteditable="true"]');
@@ -195,38 +195,38 @@ export const elemAddEventListener = (elem, action, fn) => {
 
 
 export const addJoinedGroupList = () => {
-    if(ifShowNftGroup) {
-        let {pathname} = window.location;
+    if (ifShowNftGroup) {
+        let { pathname } = window.location;
 
         let iframe = document.createElement('iframe');
-            iframe.id = 'de-joined-group-list';
-            iframe.src = chrome.runtime.getURL('/iframe/joined-group-list.html');
-            iframe.style.cssText = `border: medium none;height: 120px;border-radius: 16px;margin-bottom: 16px`
+        iframe.id = 'de-joined-group-list';
+        iframe.src = chromeExtensionUrl + ('iframe/joined-group-list.html');
+        iframe.style.cssText = `border: medium none;height: 120px;border-radius: 16px;margin-bottom: 16px`
 
         let iframeContent = document.getElementById('de-joined-group-list');
 
         if (!iframeContent && pathname == '/home') {
             let sidebarColumn = document.querySelector('div[data-testid="sidebarColumn"]');
-            if(sidebarColumn) {
+            if (sidebarColumn) {
                 let searchDom = sidebarColumn.querySelector('form[role="search"]');
-                if(searchDom) {
+                if (searchDom) {
                     let listWrapperDom = searchDom.parentElement.parentElement.parentElement.parentElement;
-                    if(listWrapperDom) {
+                    if (listWrapperDom) {
                         let listParent = listWrapperDom.parentElement;
-                        if(listParent) {
+                        if (listParent) {
                             listParent.insertBefore(iframe, listWrapperDom.nextElementSibling.nextElementSibling);
                         }
                     }
                 }
-            } 
+            }
         }
     }
 };
 
 export const setJoinedGroupIframeStyle = (params) => {
-    let {height = '321px'} = params;
+    let { height = '321px' } = params;
     let iframeContent = document.getElementById('de-joined-group-list');
-    if(iframeContent) {
+    if (iframeContent) {
         iframeContent.style.height = height;
     }
 }

+ 189 - 107
src/logic/content/twitter.js

@@ -1,7 +1,8 @@
-import { getChromeStorage, setChromeStorage } from '@/uilts/chromeExtension.js'
-import { throttle, getQueryString, getCookie, nextTick, getQueryStringByUrl } from '@/uilts/help'
+import { getChromeStorage, setChromeStorage, chromeExtensionUrl } from '@/uilts/chromeExtension.js'
+import { throttle, getQueryString, getCookie, nextTick, getQueryStringByUrl, getStorage, setStorage, getInnerIframeURL } from '@/uilts/help'
 import { discordAuthRedirectUri, iframeHost } 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';
@@ -10,6 +11,8 @@ import { clearPostContent, setGroupIconStatus } from '@/logic/content/nft.js'
 import { toolBox } from '@/logic/content/ToolBox'
 import axios from 'axios';
 import messageCenter from '@/uilts/messageCenter';
+import { PlayType } from '@/types';
+import { reSetBindPostContent } from '@/http/help.js'
 
 let dom = {};
 
@@ -23,6 +26,7 @@ let systemInfo = {
     theme: 'light'
 }
 
+
 let fixProfileTabAutoTimer = null;
 
 
@@ -116,6 +120,13 @@ export function showTwitterPublishDialogHandler(publishRes) {
     // _setPublishContent(publishRes.srcContent);
     setDialogPublishContent(publishRes.srcContent);
     _publishTweetEvent(publishRes, bindTwitterArtMethod);
+
+    Report.reportLog({
+        businessType: Report.businessType.pageView,
+        objectType: Report.objectType.setPublishContent,
+        postId: publishRes.postId
+    }, {
+    });
 }
 
 export function twitterPublishHandler(res) {
@@ -225,12 +236,30 @@ function _publishTweetEvent(params, cb) {
             bindTwitterArt.needBind = true;
             bindTwitterArt.postId = params.postId;
             tweetPublishStore.showPublishDialog = false;
+
+            bindContentStr(params);
             // checkIsShowReSend(dialog, params);
             cb && cb()
         });
     }, 800)
 }
 
+function bindContentStr(params) {
+    if (params && params.postBizData) {
+        if (typeof params.postBizData == 'string') {
+            let objBizData = JSON.parse(params.postBizData);
+            let inputEle = document.querySelector('div[contenteditable="true"]');
+            if (objBizData.luckdropType == PlayType.treasure && inputEle) {
+                let textContent = inputEle.innerText;
+                reSetBindPostContent({
+                    postId: params.postId,
+                    postSrcContent: textContent,
+                })
+            }
+        }
+    }
+}
+
 function onClosePublishDialogHandle(dom, params) {
     // 如果是 Tool box
     if (params.postType == 3) {
@@ -398,7 +427,7 @@ function _addIframe() {
     // let span = document.createElement('span');
     // const shadowRoot = span.attachShadow({mode: 'closed'})
     let iframe = document.createElement('iframe');
-    iframe.src = chrome.runtime.getURL('/iframe/publish.html')
+    iframe.src = chromeExtensionUrl + ('iframe/publish.html')
     iframe.id = 'iframe-content'
     iframe.style.cssText = 'position:fixed;top:0px;right:0;display:block; width:100%;height:100%;z-index:10000; border: medium none;display:none;background: rgba(255,255,255,0);';
     // shadowRoot.appendChild(iframe);
@@ -421,9 +450,9 @@ function addPublishTipsIframe(params = {}) {
             let iframe = document.createElement('iframe');
             iframe.id = 'de-publish-tips'
             if (params.type == 'nft') {
-                iframe.src = chrome.runtime.getURL('/iframe/publish-tips.html?type="nft"');
+                iframe.src = chromeExtensionUrl + ('iframe/publish-tips.html?type="nft"');
             } else {
-                iframe.src = chrome.runtime.getURL('/iframe/publish-tips.html');
+                iframe.src = chromeExtensionUrl + ('iframe/publish-tips.html');
             }
 
             iframe.style.cssText = `border: medium none; width:270px;height:500px;position: fixed; right: ${right}px; top: 5%;z-index: -1`
@@ -440,7 +469,7 @@ export function noticeBindTweet(params) {
     hidePopupPage();
     let iframe = document.createElement('iframe');
     iframe.id = 'de-notice-bind-tweet';
-    iframe.src = chrome.runtime.getURL('/iframe/bind-tweet.html') + `?params=${JSON.stringify(params)}`;
+    iframe.src = chromeExtensionUrl + ('iframe/bind-tweet.html') + `?params=${JSON.stringify(params)}`;
     iframe.style.cssText = `border: medium none; width:400px;min-height:313px;position: fixed; right: 16px; top: 16px;border-radius: 20px;`
     let iframeContent = document.getElementById('de-notice-bind-tweet');
     if (!iframeContent) {
@@ -529,7 +558,7 @@ const setDialogPublishContent = throttle(function (content) {
         if (inputEle) {
             inputEle.dispatchEvent(event);
         }
-    }, 300)
+    }, 800)
 }, 600);
 
 /**
@@ -766,14 +795,14 @@ export function bindTwitterArtMethod() {
 
 import parseCard from './ParseCard'
 
-// 检测dom改变 
-// 获取短链接 
-// 查看本地是否有postid 
-// 如果有 修改dom 返回 
-// 如果没有 网络请求 
-// 获取postid 
-// 获取twitterid 
-// 检测当前所有dom 如果没有 
+// 检测dom改变
+// 获取短链接
+// 查看本地是否有postid
+// 如果有 修改dom 返回
+// 如果没有 网络请求
+// 获取postid
+// 获取twitterid
+// 检测当前所有dom 如果没有
 
 
 
@@ -808,73 +837,75 @@ function onChangePageMain(targetNode) {
 // 2.监听卡片是否可见
 // 3.如果可见了 去找
 
-function setIframeRedPacket(type = 'twitter') {
+function setIframeCard(type = 'twitter') {
     // 获取所有卡片参数
     let card_json_data
-    switch (type) {
-        case 'facebook':
-            card_json_data = parseCard.parseFacebookCardParmas()
-            for (let i in card_json_data) {
-                parseCard.replaceFacebookPacket(card_json_data[i])
-            }
-            break;
-        default:
-            card_json_data = parseCard.parseAllDeNetCardParmas()
-            // 过滤出可以请求的短链接
-            parseCard.getCardParmas(card_json_data).then((res) => {
-                for (let i in res.has_post_Id_card_data) {
-                    let item = res.has_post_Id_card_data[i];
-                    if (item && item.post_Id && item.post_Id.indexOf('nft/') >= 0) {
-                        parseCard.replaceNftDomRedPacket(item)
-                    } else if (item && item.post_Id && item.post_Id.indexOf('nft_group/') >= 0) {
-                        parseCard.replaceNftGroupDomRedPacket(item)
-                    } else if (item && item.post_Id && item.post_Id.indexOf('luckdraw/') >= 0) {
-                        item.post_Id = item.post_Id.split('luckdraw/')[1] || ''
-                        item.page_type = '抽奖'
-                        parseCard.replaceDOMRedPacket(item)
-                    } else if (item && item.post_Id && item.post_Id.indexOf('toolbox/') >= 0) {
-                        item.page_type = 'toolbox'
-                        item.post_Id = item.post_Id.split('toolbox/')[1] || ''
-                        if (item.post_Id) {
-                            parseCard.replaceIframeToolBox(item)
-                        }
-                    } else if (item && item.post_Id && !item.post_Id.includes('/')) {
-                        item.page_type = '红包'
-                        parseCard.replaceDOMRedPacket(item)
-                        // 夺宝链接
-                    } else if (item && item.post_Id && item.post_Id.includes('treasure/')) {
-                        // https://testh5.denetme.net/treasure/{postid}
-                        // https://testh5.denetme.net/treasure/invite/{inviteCode}
-                        // 邀请链接
-                        if (item.post_Id.includes('invite/')) {
-                            item.invite_code = item.post_Id.split('invite/')[1] || ''
-                            item.page_type = '邀请链接'
-                            if (item.invite_code) {
-                                item.post_Id = ''
-                                parseCard.replaceDOMTreasureCard(item)
-                            }
-                        } else {
-                            // 原始链接
-                            item.page_type = '原始链接'
-                            item.post_Id = item.post_Id.split('treasure/')[1] || ''
-                            if (item.post_Id) {
-                                parseCard.replaceDOMTreasureCard(item)
+    if (type == 'facebook') {
+        card_json_data = parseCard.parseFacebookCardParmas()
+        for (let i in card_json_data) {
+            parseCard.replaceFacebookPacket(card_json_data[i])
+        }
+    }
+    else if (type == 'twitter') {
+        card_json_data = parseCard.parseAllDeNetCardParmas()
+        // 过滤出可以请求的短链接
+        parseCard.getCardParmas(card_json_data).then((res) => {
+            for (let i in res.has_post_Id_card_data) {
+                let item = res.has_post_Id_card_data[i];
+                if (item && item.post_Id && item.post_Id.indexOf('nft/') >= 0) {
+                    parseCard.replaceNftDomRedPacket(item)
+                } else if (item && item.post_Id && item.post_Id.indexOf('nft_group/') >= 0) {
+                    parseCard.replaceNftGroupDomRedPacket(item)
+                } else if (item && item.post_Id && item.post_Id.indexOf('luckdraw/') >= 0) {
+                    item.post_Id = item.post_Id.split('luckdraw/')[1] || ''
+                    item.page_type = '抽奖'
+                    parseCard.replaceDOMRedPacket(item)
+                } else if (item && item.post_Id && item.post_Id.indexOf('toolbox/') >= 0) {
+                    item.page_type = 'toolbox'
+                    item.post_Id = item.post_Id.split('toolbox/')[1] || ''
+                    if (item.post_Id) {
+                        parseCard.replaceIframeToolBox(item)
+                    }
+                } else if (item && item.post_Id && !item.post_Id.includes('/')) {
+                    item.page_type = '红包'
+                    parseCard.replaceDOMRedPacket(item)
+                    // 夺宝链接
+                } else if (item && item.post_Id && item.post_Id.includes('treasure/')) {
+                    // https://testh5.denetme.net/treasure/{postid}
+                    // https://testh5.denetme.net/treasure/invite/{inviteCode}
+                    // 邀请链接
+                    if (item.post_Id.includes('invite/')) {
+                        let arr = item.post_Id.split('/')
+                        let index
+                        for (let i in arr) {
+                            index = Number(i) + 1
+                            if (arr[i] == 'invite' && arr.length >= index) {
+                                item.invite_code = arr[index]
+                                break
                             }
                         }
-                    }
-                }
-                if (res.need_net_short_url.length > 0) {
-                    // 请求短链接
-                    chrome.runtime.sendMessage({ actionType: "CONTENT_TWITTER_SHORT_LINK", data: "", arr_url: res.need_net_short_url }, (res) => {
-                        if (!res) {
-                            Report.reportLog({
-                                objectType: Report.objectType.parse_card_error
-                            });
+
+                        item.page_type = '邀请链接'
+                        if (item.invite_code) {
+                            item.post_Id = ''
+                            parseCard.replaceDOMTreasureCard(item)
                         }
-                    })
+                    } else {
+                        // 原始链接
+                        item.page_type = '原始链接'
+                        item.post_Id = item.post_Id.split('treasure/')[1] || ''
+                        if (item.post_Id) {
+                            parseCard.replaceDOMTreasureCard(item)
+                        }
+                    }
                 }
-            })
-            break;
+            }
+            if (res.need_net_short_urls.length > 0) {
+                parseCard.netShortUrl(res.need_net_short_urls, () => {
+                    changeQueueNum(5)
+                })
+            }
+        })
     }
 }
 
@@ -940,7 +971,7 @@ function initParseCard() {
                     return
                 }
                 initGroupTip()
-                setIframeRedPacket()
+                setIframeCard()
                 checkHasSliderDeBtn();
                 changeQueueNum(-1)
                 showNFTCard()
@@ -954,7 +985,7 @@ function initParseCard() {
                 if (queue_num <= 0) {
                     return
                 }
-                setIframeRedPacket('facebook')
+                setIframeCard('facebook')
                 changeQueueNum(-1)
             }, 1000)
         }
@@ -1031,6 +1062,28 @@ export function init() {
     });
 }
 
+export const getTweetUserFollowStatus = (params) => {
+    let { tweetId, userList } = params.data;
+    let promiseList = [];
+    for (let i = 0; i < userList.length; i++) {
+        promiseList[i] = TwitterApiUserByScreenNameReq({ screen_name: userList[i]['name'] });
+    }
+
+    Promise.all(promiseList).then((res) => {
+        let list = [];
+        if (res && res.length) {
+            for (let i = 0; i < res.length; i++) {
+                let item = res[i];
+                if (item && item.data && item.data.data) {
+                    list.push(item.data.data)
+                }
+            }
+        }
+
+        chrome.runtime.sendMessage({ actionType: 'CONTENT_GET_TWEET_USER_FOLLOW_STATUS_RES', data: list, tweetId, type: params.type, iframeId: params.iframeId }, () => { })
+    })
+}
+
 function onPageVisbile() {
     document.addEventListener('visibilitychange', function () {
         let isHidden = document.hidden;
@@ -1288,10 +1341,12 @@ export function checkTwitterTaskState() {
         })
         // 点击取消
         clickByDataTestId(e, 'confirmationSheetCancel', () => {
+            console.log('DO_TASK1')
             chrome.runtime.sendMessage({ actionType: "DO_TASK", tweet_Id, task_type, task_data, task_done: false }, () => { })
         })
         // 点击 蒙层
         if (e.target && e.target.nextSibling && e.target.nextSibling.dataset && e.target.nextSibling.dataset.testid == 'confirmationSheetDialog') {
+            console.log('DO_TASK2')
             chrome.runtime.sendMessage({ actionType: "DO_TASK", tweet_Id, task_type, task_data, task_done: false }, () => { })
         }
     }, true)
@@ -1346,7 +1401,7 @@ export function getTweetAuthorByDom(params) {
         }
     }
 }
-export function doTaskTwitterAPI({ task_data, task_type, tasks }) {
+export function doTaskTwitterAPI({ task_data, task_type, tasks, iframeId }) {
     switch (task_type) {
         case 'like':
             TwitterLikeAPI(task_data.tweet_Id)
@@ -1381,7 +1436,7 @@ export function doTaskTwitterAPI({ task_data, task_type, tasks }) {
                     // 推文发推
                     case '10':
                         // 发推
-                        TwitterApiCreateTweet({ text: task_data.tweet_text, tweet_Id: task_data.tweet_Id })
+                        TwitterApiCreateTweet({ text: task_data.tweet_text, tweet_Id: task_data.tweet_Id, iframeId })
                         break
                 }
 
@@ -1394,7 +1449,7 @@ export function showJoinDialog(data) {
     let iframe = document.querySelector('#nftProjectId')
     iframe.style.display = 'block'
     iframe.contentWindow.postMessage({ actionType: 'SHOW_JOIN_DATA', data }, '*');
-    iframe.src = chrome.runtime.getURL(`/iframe/buy-nft.html#/group?params=${JSON.stringify(data)}&time=${new Date().getTime()}`)
+    iframe.src = chromeExtensionUrl + (`iframe/buy-nft.html#/group?params=${JSON.stringify(data)}&time=${new Date().getTime()}`)
 }
 
 const TwitterFollowAPI = (item, tweet_Id) => {
@@ -1422,6 +1477,7 @@ const TwitterFollowAPI = (item, tweet_Id) => {
         }
         chrome.runtime.sendMessage({ actionType: "DO_TASK", do_type: 'api', tweet_Id, task_type: 'follow', task_data, task_done: true }, () => { })
     }).catch(() => {
+        console.log('DO_TASK3')
         chrome.runtime.sendMessage({ actionType: "DO_TASK", do_type: 'api', tweet_Id, task_type: 'follow', task_data, task_done: false }, () => { })
     })
 }
@@ -1454,6 +1510,7 @@ const TwitterRetweetAPI = (tweet_Id) => {
     }).then(() => {
         chrome.runtime.sendMessage({ actionType: "DO_TASK", do_type: 'api', tweet_Id, task_type: 'retweet', task_data: '', task_done: true }, () => { })
     }).catch(() => {
+        console.log('DO0_TASK4')
         chrome.runtime.sendMessage({ actionType: "DO_TASK", do_type: 'api', tweet_Id, task_type: 'retweet', task_data: '', task_done: false }, () => { })
     })
 }
@@ -1485,12 +1542,12 @@ const TwitterLikeAPI = (tweet_Id) => {
     }).then(() => {
         chrome.runtime.sendMessage({ actionType: "DO_TASK", do_type: 'api', tweet_Id, task_type: 'like', task_data: '', task_done: true }, () => { })
     }).catch(() => {
+        console.log('DO_TASK5')
         chrome.runtime.sendMessage({ actionType: "DO_TASK", do_type: 'api', tweet_Id, task_type: 'like', task_data: '', task_done: false }, () => { })
     })
 }
 
-
-const TwitterApiCreateTweet = ({ text, tweet_Id }) => {
+const TwitterApiCreateTweet = ({ text, tweet_Id, iframeId }) => {
     let data = {
         queryId: "hC1nuE-2d1NX5LYBuuAvtQ",
         features: {
@@ -1536,16 +1593,15 @@ const TwitterApiCreateTweet = ({ text, tweet_Id }) => {
             "x-twitter-client-language": "en"
         },
     }).then(function (response) {
-        chrome.runtime.sendMessage({ actionType: "DO_TASK", do_type: 'api', tweet_Id, task_type: 'createTweet', task_data: '', task_done: true, response })
+        chrome.runtime.sendMessage({ actionType: "DO_TASK", do_type: 'api', tweet_Id, task_type: 'createTweet1', task_data: '', task_done: '是', response, iframeId })
     }).catch(function (err) {
-        chrome.runtime.sendMessage({ actionType: "DO_TASK", do_type: 'api', tweet_Id, task_type: 'createTweet', task_data: '', task_done: false })
+        chrome.runtime.sendMessage({ actionType: "DO_TASK", do_type: 'api', tweet_Id, task_type: 'createTweet1', task_data: '', task_done: '否', iframeId })
     });
 }
 
-
-export const TwitterApiUserByScreenName = (params) => {
-    let { screen_name, tweetId = '', objectType = '' } = params;
-    axios.get(`https://twitter.com/i/api/graphql/mCbpQvZAw6zu_4PvuAUVVQ/UserByScreenName?variables=%7B%22screen_name%22%3A%22${screen_name}%22%2C%22withSafetyModeUserFields%22%3Atrue%2C%22withSuperFollowsUserFields%22%3Atrue%7D`, {
+const TwitterApiUserByScreenNameReq = (params) => {
+    let { screen_name } = params || {};
+    return axios.get(`https://twitter.com/i/api/graphql/mCbpQvZAw6zu_4PvuAUVVQ/UserByScreenName?variables=%7B%22screen_name%22%3A%22${screen_name}%22%2C%22withSafetyModeUserFields%22%3Atrue%2C%22withSuperFollowsUserFields%22%3Atrue%7D`, {
         headers: {
             "accept": "*/*",
             "accept-language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7",
@@ -1562,10 +1618,17 @@ export const TwitterApiUserByScreenName = (params) => {
             "x-twitter-auth-type": "OAuth2Session",
             "x-twitter-client-language": "en"
         },
-    }).then(function (response) {
+    })
+}
+
+
+export const TwitterApiUserByScreenName = (params, cb) => {
+    let { screen_name, tweetId = '', objectType = '' } = params;
+
+    TwitterApiUserByScreenNameReq({ screen_name }).then(function (response) {
         chrome.runtime.sendMessage({ actionType: "CONTENT_API_GET_TWEET_USER_INFO_RES", data: response.data.data || {}, tweetId, objectType }, () => { })
     }).catch(function (err) {
-      chrome.runtime.sendMessage({ actionType: "CONTENT_API_GET_TWEET_USER_INFO_RES", data: {}, tweetId, objectType }, () => { })
+        chrome.runtime.sendMessage({ actionType: "CONTENT_API_GET_TWEET_USER_INFO_RES", data: {}, tweetId, objectType }, () => { })
     });
 }
 
@@ -1722,7 +1785,7 @@ const initGroupTip = () => {
         if (iframe_banner) {
             if (twitterAccount != getQueryStringByUrl(iframe_banner.src, 'twitterAccount')) {
                 iframe_banner.style.display = 'none'
-                // iframe_banner.src = chrome.runtime.getURL(`/iframe/group-card.html?twitterAccount=${twitterAccount}`)
+                // iframe_banner.src = chromeExtensionUrl + (`iframe/group-card.html?twitterAccount=${twitterAccount}`)
                 iframe_banner.contentWindow.postMessage({ actionType: 'SHOW_BANNER', twitterAccount }, '*');
             }
             return
@@ -1732,7 +1795,7 @@ const initGroupTip = () => {
             let iframe = document.createElement('iframe')
             iframe.id = 'denet_group_banner'
             iframe.style.cssText = 'border: medium none; display:none; width:100%; height:100px;'
-            iframe.src = chrome.runtime.getURL(`/iframe/group-card.html?twitterAccount=${twitterAccount}`)
+            iframe.src = chromeExtensionUrl + (`iframe/group-card.html?twitterAccount=${twitterAccount}`)
             // iframe.contentWindow.postMessage({ actionType: 'SHOW_BANNER', twitterAccount }, '*');
             if (dom && !dom.parentNode.children[0].querySelector('iframe')) {
                 // dom.parentNode.insertBefore(iframe, dom)
@@ -1763,7 +1826,7 @@ export const showBuyNFT = ({ nft_project_Id, post_Id = '' }) => {
     }
     let iframe = document.querySelector('#nftProjectId')
     iframe.style.display = 'block'
-    iframe.src = chrome.runtime.getURL(`/iframe/buy-nft.html#/?nftProjectId=${nft_project_Id}&postId=${post_Id}`)
+    iframe.src = chromeExtensionUrl + (`iframe/buy-nft.html#/?nftProjectId=${nft_project_Id}&postId=${post_Id}`)
 }
 
 const initBuyNFT = () => {
@@ -1782,7 +1845,7 @@ export const showNFTCard = () => {
     let where = isTwitter && userElem && tabIndex;
     if (where) {
         let iframe = document.createElement('iframe');
-        iframe.src = chrome.runtime.getURL(`/iframe/nft-card.html`)
+        iframe.src = chromeExtensionUrl + (`iframe/nft-card.html`)
         iframe.style.cssText = 'border:medium none; width:100%; height:290px;';
         let nftElement = document.createElement('div');
         nftElement.id = 'de-nft-node';
@@ -1823,7 +1886,7 @@ export const appendPopupPage = (params = {}) => {
 
     let iframe = document.createElement('iframe');
     iframe.id = 'de-popup-page';
-    iframe.src = chrome.runtime.getURL('/iframe/popup-page.html') + `#${path}`;
+    iframe.src = chromeExtensionUrl + ('iframe/popup-page.html') + `#${path}`;
     iframe.style.cssText = `border: medium none; width: 375px !important;
         height: 650px;position: fixed; right: 16px; top: 16px;background: #FFFFFF;border: 0.5px solid #919191;box-shadow: 0px 4px 20px rgba(0, 0, 0, 0.2);box-sizing: border-box;z-index: 90000;
         animation-duration: 0.5s !important;
@@ -1870,7 +1933,7 @@ export const showPopupPage = (params = {}) => {
     }
     if (iframe) {
         if (path) {
-            iframe.src = chrome.runtime.getURL('/iframe/popup-page.html') + `#${path}`;
+            iframe.src = chromeExtensionUrl + ('iframe/popup-page.html') + `#${path}`;
         }
         iframe.style.transform = 'translateX(-' + 395 + 'px)';
 
@@ -1985,14 +2048,14 @@ export const setPopupConfByPopupPage = () => {
 }
 
 
-/** 
- * 
- * Group Tab List Start 
+/**
+ *
+ * Group Tab List Start
  */
 
 /**
- * 
- * 创建 Group Tab 
+ *
+ * 创建 Group Tab
  */
 const createGroupTabNode = () => {
     let groupIcon = document.createElement('img');
@@ -2388,7 +2451,7 @@ const addTabGroupContent = (cb) => {
     }
     let iframe = document.createElement('iframe');
     iframe.id = 'de-tab-group-content';
-    iframe.src = `${iframeHost}/tab-group` + `?params=${JSON.stringify(params)}`;
+    iframe.src = getInnerIframeURL(`${iframeHost}/tab-group` + `?params=${JSON.stringify(params)}&iframeID=${iframe.id}`);
     iframe.style.cssText = `border: medium none; height: 500px;display: none`
 
     let iframeContent = getGroupTabContentNode();
@@ -2534,6 +2597,12 @@ export const setGroupInfo = (params = {}) => {
     }
 }
 
+export const getExtensionStorgeDataForIframe = (data) => {
+    getChromeStorage(data.key).then((res) => {
+        messageCenter.send(data.iframeID, `IFRAME_GET_EXTENSION_STORGE_DATA-${data.messageID}`, res)
+    });
+}
+
 const getSysTheme = () => {
     const themeMedia = window.matchMedia("(prefers-color-scheme: light)");
     if (themeMedia.matches) {
@@ -2572,10 +2641,10 @@ const sysThemeChange = () => {
     }, 800)
 }
 
-/** 
- * 
- * Group Tab List End 
- * 
+/**
+ *
+ * Group Tab List End
+ *
  */
 
 
@@ -2594,3 +2663,16 @@ export const showPublishDialog = () => {
         smallBtn.click();
     }
 }
+
+// 获取推文发送回去
+export const sendContentByTwitterID = (tweet_Id) => {
+    // 获取内容
+    let txt = parseCard.getContentByTwitterId(tweet_Id)
+    // 发送
+    chrome.runtime.sendMessage({
+        actionType: "CONTENT_GET_TWEET_TXT", data: {
+            tweet_Id,
+            txt
+        }
+    })
+}

+ 2 - 2
src/manifest.json

@@ -2,8 +2,8 @@
     "manifest_version": 3,
     "name": "DeNet",
     "description": "Growing more twitter followers with Denet",
-    "version": "1.1.7",
-    "denet_app_version_code": "20",
+    "version": "1.1.7.1",
+    "denet_app_version_code": "21",
     "background": {
         "service_worker": "/js/background.js"
     },

+ 1 - 0
src/uilts/chromeExtension.js

@@ -68,6 +68,7 @@ export function getChromeStorage(key = '', callback) {
 //     } catch {
 //     }
 // }
+export let chromeExtensionUrl = chrome.runtime.getURL('/')
 
 export function setChromeCookie({
     name,

+ 6 - 0
src/uilts/denet.js

@@ -0,0 +1,6 @@
+import Content from '@/uilts/messageCenter/messageContent'
+
+let denet = {}
+denet.content = Content
+
+export default denet

+ 13 - 1
src/uilts/help.js

@@ -1,3 +1,5 @@
+import { appVersionCode } from '@/http/configAPI.js'
+
 export function getQueryString(name) {
   let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
   let r = window.location.search.substr(1).match(reg);
@@ -265,4 +267,14 @@ export function $(key, cache = true) {
     }
   }
   return _dom
-}
+}
+
+export const getInnerIframeURL = (url) => {
+  let iframeUrl = url;
+  if (url.includes('?')) {
+    iframeUrl += `&appVersionCode=${appVersionCode}`;
+  } else {
+    iframeUrl += `?appVersionCode=${appVersionCode}`;
+  }
+  return iframeUrl;
+}

+ 9 - 9
src/uilts/messageCenter/index.js

@@ -1,13 +1,13 @@
-class MessageCenter { 
-    constructor() { 
+class MessageCenter {
+    constructor() {
         this.iframeMap = new Map();
         this.messageCallbackMap = new Map();
         // this.listen()
     }
 
-    findIframeById(id) { 
+    findIframeById(id) {
         let target = this.iframeMap.get(id);
-        if (!target) { 
+        if (!target) {
             target = document.getElementById(id)
             this.iframeMap.set('id', target)
         }
@@ -27,17 +27,17 @@ class MessageCenter {
         let activeQuene = this.messageCallbackMap.get(actionType);
         if (activeQuene?.length > 0) {
             activeQuene.push(callback)
-        } else { 
+        } else {
             this.messageCallbackMap.set(actionType, [callback])
         }
     }
     // don't use
-    listen() { 
-        window.addEventListener('message', (e) => { 
+    listen() {
+        window.addEventListener('message', (e) => {
             const { actionType, data } = e.data;
             console.log('get message in content ...', actionType, data)
-            const quene = this.messageCallbackMap.get(actionType) ||  [];
-            while (quene.length > 0) { 
+            const quene = this.messageCallbackMap.get(actionType) || [];
+            while (quene.length > 0) {
                 let callback = quene.pop();
                 callback(data)
             }

+ 39 - 0
src/uilts/messageCenter/messageContent.js

@@ -0,0 +1,39 @@
+// class message  
+import messageCenter from '@/uilts/messageCenter';
+import MESSAGE_ENUM from "@/uilts/messageCenter/messageEnum";
+import { guid, iframeID } from '@/uilts/help.js'
+
+// content.createTweets('iframe') 
+
+// 做任务
+class doTask {
+    createTweet({ txt = '' }) {
+        return new Promise((res, rej) => {
+            messageCenter.send({
+                actionType: MESSAGE_ENUM.IFRAME_DO_TASK_CREATE_TWEET,
+                data: {
+                    iframeID,//用于告诉父窗口会传消息给哪个iframe 
+                    messageID: guid()// 唯一的ID,用于标记回调函数
+                },
+                info: {
+                    txt
+                },
+                callback: (data) => {
+                    res(data)
+                },
+                failback: (e) => {
+                    rej(e)
+                }
+            })
+        })
+        // console.log(window.parent.window.atest)
+        // window.postMessage({actionType: 'iframe_test', data: key})
+    }
+}
+
+
+export default {
+    doTask() {
+        return new doTask()
+    }
+}

+ 25 - 0
src/uilts/messageCenter/messageEnum.js

@@ -0,0 +1,25 @@
+/** 向父窗口发送的事件定义 */
+const SEND_MESSAGE_ENUM = {
+    IFREME_TAB_GROUP_SET_IFRAME_HEIGHT: 'IFREME_TAB_GROUP_SET_IFRAME_HEIGHT',
+    /** group tab 内的列表项点击 */
+    IFRAME_PAGE_JUMP: 'IFRAME_PAGE_JUMP',
+    IFREME_TAB_GROUP_CONTENT_GET_NAV_TOP: 'IFREME_TAB_GROUP_CONTENT_GET_NAV_TOP',
+    /** 获取content的localstorge数据 */
+    IFRAME_GET_EXTENSION_STORGE_DATA: 'IFRAME_GET_EXTENSION_STORGE_DATA',
+
+    // ---- 做任务 ----
+    IFRAME_DO_TASK_CREATE_TWEET: 'IFRAME_DO_TASK_CREATE_TWEET'
+
+}
+
+/** 接收父窗口的事件定义 */
+const RECEIVE_MESSAGE_ENUM = {
+    /** 切换到group tab */
+    CONTENT_REFRESH_TAB_GROUP_LIST: 'CONTENT_REFRESH_TAB_GROUP_LIST',
+    /** group打开时,页面发生滚动 */
+    CONTENT_GROUP_LIST_SCROLL: 'CONTENT_GROUP_LIST_SCROLL',
+    CONTENT_SEND_GROUP_NAV_TOP: 'CONTENT_SEND_GROUP_NAV_TOP',
+    CONTENT_SYS_THEME_CHANGE: 'CONTENT_SYS_THEME_CHANGE'
+}
+
+export default { ...SEND_MESSAGE_ENUM, ...RECEIVE_MESSAGE_ENUM }

+ 12 - 1
src/view/components/currency-list.vue

@@ -186,7 +186,18 @@ const searchCurrency = debounce(function (searchWords) {
     }).then(res => {
         if (res.code == 0) {
             if (res.data.currencyCategories && res.data.currencyCategories.length) {
-                let list = res.data.currencyCategories[0];
+                let currencyCategories = res.data.currencyCategories;
+
+                let arr = [];
+                for(let i = 0; i < currencyCategories.length; i++) {
+                  let item = currencyCategories[i];
+                  arr = arr.concat(item.data);
+                }
+
+                currencyCategories[0]['data'] = arr;
+
+                let list = currencyCategories[0];
+
                 if (list && list.data && list.data.length) {
                     searchList.value = list.data;
                 } else {

+ 4 - 4
src/view/components/custom-card-cover.vue

@@ -89,7 +89,7 @@
                 <img class="img" :src="data.currencyIconUrl" /> <span class="txt"> {{data.tokenSymbol}}  <template v-if="data.currencyCode != 'USD'">equivalent (Crypto)</template></span>
             </div>
 
-            <img class="img-treasure-big" :src="require('@/assets/img/icon-card-cover-treasure-big.png')">
+            <img class="img-treasure-big" :src="require('@/assets/img/icon-treasure-box.png')">
 
             <div class="treasure-row-4">
                <img class="img" :src="require('@/assets/svg/icon-card-cover-treasure-tasks.svg')"> to Hunt Treasure
@@ -181,9 +181,9 @@ const props = defineProps({
 watch(() => props.show, (newVal) => {
       if(newVal) {
         zoomCom.value && zoomCom.value.setFontZoom(0);
-        zoomCom1.value && zoomCom.value.setFontZoom(0);
-        zoomCom2.value && zoomCom.value.setFontZoom(0);
-        zoomCom3.value && zoomCom.value.setFontZoom(0);
+        zoomCom1.value && zoomCom1.value.setFontZoom(0);
+        zoomCom2.value && zoomCom2.value.setFontZoom(0);
+        zoomCom3.value && zoomCom3.value.setFontZoom(0);
       }
     },
     {

+ 12 - 9
src/view/content/message/index.vue

@@ -3,14 +3,16 @@
         <template v-for="item in state.list" :key="item.createTimestamp">
             <div class="denet-message-area" @click="clickItem(item)" v-if="item.bizType == 2">
                 <img :src="require('@/assets/img/icon-message-fail.png')" alt />
-                <span>You were not selected from {{item.bizData.twitterAccount}}'s giveaway events... Click to see more giveaways!</span>
+                <span>You were not selected from {{ item.bizData.twitterAccount }}'s giveaway events... Click to see more
+                    giveaways!</span>
                 <div class="denet-message-close" @click.stop="clickClose(item)">
                     <img :src="require('@/assets/img/icon-message-close.png')" alt />
                 </div>
             </div>
             <div class="denet-message-area" @click="clickItem(item)" v-if="item.bizType == 1">
                 <img :src="require('@/assets/img/icon-message-win.png')" alt />
-                <span>Congratulations! You won <b class="denet-message-money"> {{getPrize(item.bizData)}}</b> from {{item.bizData.twitterAccount}}'s giveaway!🎉</span>
+                <span>Congratulations! You won <b class="denet-message-money"> {{ getPrize(item.bizData) }}</b> from
+                    {{ item.bizData.twitterAccount }}'s giveaway!🎉</span>
                 <div class="denet-message-close" @click.stop="clickClose(item)">
                     <img :src="require('@/assets/img/icon-message-close.png')" alt />
                 </div>
@@ -35,16 +37,16 @@ let state = reactive({
 let timer, now_time
 
 // 获取奖励
-const getPrize = (item) => { 
+const getPrize = (item) => {
     const { lotteryMoney, lotteryTokenSymbol, twitterAccount, rewardType, customizedReward } = item;
     if (rewardType === RewardType.custom) {
         return customizedReward;
     } else {
-        return `${item.bizData.lotteryMoney} ${item.bizData.lotteryTokenSymbol}` 
+        return `${item.bizData.lotteryMoney} ${item.bizData.lotteryTokenSymbol}`
     }
 }
 
-// 过5秒消失逻辑
+// 过20秒消失逻辑
 const overTimeClose = () => {
     if (timer) {
         return
@@ -56,7 +58,7 @@ const overTimeClose = () => {
         }
         now_time = new Date().getTime()
         for (let i in state.list) {
-            if ((now_time - state.list[i].read_time) >= 5000) {
+            if ((now_time - state.list[i].read_time) >= 20000) {
                 state.list.splice(i, 1)
             }
         }
@@ -121,9 +123,10 @@ chrome.runtime.onMessage.addListener((req, sender, sendResponse) => {
 </script>
 
 <style lang="scss" >
-#denet_message{
+#denet_message {
     text-align: left;
 }
+
 .denet-message {
     position: fixed;
     max-height: 100%;
@@ -131,7 +134,7 @@ chrome.runtime.onMessage.addListener((req, sender, sendResponse) => {
     top: 0;
     right: 0;
     width: 500px;
-    z-index: 9999;    
+    z-index: 9999;
     text-align: left;
 
     &-area {
@@ -147,7 +150,7 @@ chrome.runtime.onMessage.addListener((req, sender, sendResponse) => {
         margin-left: 129px;
         animation: right_to_left 1s;
         text-align: left;
-        
+
         img:first-child {
             width: 40px;
             height: 40px;

+ 26 - 27
src/view/iframe/buy-nft/buy/pay.vue

@@ -1,5 +1,5 @@
 <template>
-    <div class="dialog" :style="{'height': dialogStyle.height + 'px'}">
+    <div class="dialog" :style="{ 'height': dialogStyle.height + 'px' }">
         <!-- home -->
         <div class="area-title">
             <img :src="require('@/assets/svg/icon-back.svg')" @click="clickBack" />
@@ -7,8 +7,7 @@
         </div>
         <!-- 内容 -->
         <div class="area-content">
-            <div
-                class="left"
+            <div class="left"
                 :class="{ auto: tempCurrentCurrencyInfo.currencyCode === 'USD' && Number(finalAmountData.rechargeAmountValue) <= 0 }">
                 <img :src="require('@/assets/img/img-box5.png')" v-show="pay_info.home.sale_plan.itemCount == 5"
                     alt="" />
@@ -22,8 +21,7 @@
                     </div>
                 </div>
             </div>
-            <div
-                class="right"
+            <div class="right"
                 :class="{ none: tempCurrentCurrencyInfo.currencyCode === 'USD' && Number(finalAmountData.rechargeAmountValue) <= 0 }">
                 <div class="card-content" v-if="tempCurrentCurrencyInfo.currencyCode">
                     <template v-if="tempCurrentCurrencyInfo.currencyCode !== 'USD'">
@@ -49,8 +47,7 @@
                             <img class="img" :src="require('@/assets/subject/top-01.svg')" />
                             <div class="font">Deposit to Send Giveaway</div>
                         </div>
-                        <payment-info-usd
-                            :finalAmountData="finalAmountData">
+                        <payment-info-usd :finalAmountData="finalAmountData">
                         </payment-info-usd>
                     </template>
                 </div>
@@ -104,19 +101,19 @@
                         <div class="desc">Balance</div>
                         <div class="price">
                             $
-                            {{tempCurrentCurrencyInfo.balance}}
+                            {{ tempCurrentCurrencyInfo.balance }}
                         </div>
                     </div>
-                    <img class="refresh"
-                        :class="{ 'icon-refresh-rotate': refreshRotate }"
-                        :src=" require('@/assets/svg/icon-form-refresh.svg')"
-                        @click="updateCurrencyBanlce"/>
+                    <img class="refresh" :class="{ 'icon-refresh-rotate': refreshRotate }"
+                        :src="require('@/assets/svg/icon-form-refresh.svg')" @click="updateCurrencyBanlce" />
                 </div>
                 <!-- Play -->
                 <div class="buy1 usd" @click="clickPayUSD">
                     <div class="left">Pay</div>
                     <div class="right">
-                        {{ finalAmountData.rechargeAmountValue > 0 ? finalAmountData.rechargeAmountValue : finalAmountData.orderAmountValue }}
+                        {{ finalAmountData.rechargeAmountValue > 0 ? finalAmountData.rechargeAmountValue :
+                                finalAmountData.orderAmountValue
+                        }}
                         {{ pay_info.home.sale_plan.currencyInfo.tokenSymbol }}
                     </div>
                 </div>
@@ -125,10 +122,7 @@
     </div>
 
     <!-- 预览页充值 -->
-    <message-box
-        :dialogVisible="showDepositMessageBox"
-        title="Is the Deposit Completed?"
-        @cancel="depositAchCancel"
+    <message-box :dialogVisible="showDepositMessageBox" title="Is the Deposit Completed?" @cancel="depositAchCancel"
         @confirm="depositAchConfirm">
     </message-box>
 </template>
@@ -145,7 +139,7 @@ import messageBox from "@/view/components/message-box.vue";
 import BtnLoading from '../components/btn-loading.vue'
 import { payNftMysteryBoxWithBalance } from "@/http/pay";
 import { calcRechargePayAmount } from "@/http/account";
-import { getChromeStorage, setChromeStorage } from "@/uilts/chromeExtension"
+import { getChromeStorage, setChromeStorage, chromeExtensionUrl } from "@/uilts/chromeExtension"
 import { ElMessage } from 'element-plus'
 import "element-plus/es/components/message/style/css";
 import { sendChromeTabMessage } from '@/uilts/chromeExtension.js';
@@ -181,7 +175,7 @@ let dialogStyle = reactive({
 
 const calcRechPayAmount = async (params) => {
     let res = await calcRechargePayAmount({
-        params : params
+        params: params
     })
 
     if (res.code == 0) {
@@ -285,17 +279,17 @@ const clickPlay = () => {
 }
 
 const clickPayUSD = () => {
-    if(Number(finalAmountData.value.rechargeAmountValue) > 0) {
+    if (Number(finalAmountData.value.rechargeAmountValue) > 0) {
         setTimeout(() => {
             showDepositMessageBox.value = true;
         }, 1000)
-        chrome.tabs.getCurrent(tab =>{
+        chrome.tabs.getCurrent(tab => {
             let achPayInfo = {
                 amountValue: finalAmountData.value.rechargeAmountValue,
                 tab: tab
             };
-            let guideUrl = chrome.runtime.getURL('/iframe/ach-cashier.html');
-            setChromeStorage({ achPayInfo : JSON.stringify(achPayInfo)});
+            let guideUrl = chromeExtensionUrl + ('iframe/ach-cashier.html');
+            setChromeStorage({ achPayInfo: JSON.stringify(achPayInfo) });
 
             chrome.tabs.create({
                 url: guideUrl
@@ -315,7 +309,7 @@ let tempCurrentCurrencyInfo = ref({});
 
 const refreshRotate = ref(false);
 const updateCurrencyBanlce = () => {
-    if(!refreshRotate.value) {
+    if (!refreshRotate.value) {
         refreshRotate.value = true;
         getCurrencyInfo()
         setTimeout(() => {
@@ -362,7 +356,7 @@ const amountInterval = () => {
 
 const setDialogStyle = () => {
     let clientHeight = window.innerHeight;
-    if(clientHeight >= 840) {
+    if (clientHeight >= 840) {
         dialogStyle.height = 800;
     } else {
         dialogStyle.height = clientHeight - 40;
@@ -460,7 +454,7 @@ onUnmounted(() => {
 
             .tip {
                 margin-top: 15px;
-                font-size: 16px;    
+                font-size: 16px;
                 display: flex;
                 justify-content: space-between;
 
@@ -480,7 +474,7 @@ onUnmounted(() => {
         .right {
             width: 400px;
             margin: 30px 56px 0px 30px;
-            
+
             &.none {
                 display: none;
             }
@@ -649,23 +643,28 @@ onUnmounted(() => {
 .balance {
     display: flex;
     margin-right: 20px;
+
     .icon {
         width: 40px;
         height: 40px;
     }
+
     .con {
         padding: 0 5px;
+
         .desc {
             color: rgba($color: #000000, $alpha: 0.5);
             font-size: 12px;
             margin-bottom: 4px;
         }
+
         .price {
             font-size: 14px;
             font-weight: bold;
             word-break: break-all;
         }
     }
+
     .refresh {
         width: 40px;
         cursor: pointer;

+ 18 - 0
src/view/iframe/nft/card.vue

@@ -56,6 +56,7 @@ const isShare = ref(false);
 const isLoading = ref(true);
 const isShowGuide = ref(false);
 const nftProjectId = ref('');
+const nftAccount = ref('');
 let tweetId = ref('');
 
 const getSaleInfo = () => {
@@ -89,6 +90,7 @@ const getSaleData = (projectId) => {
 }
 
 const getSaleProjectInfo = (account) => {
+    nftAccount.value = account;
     getTwitterSaleNftProjectInfo({
         params: {
             twitterAccount: account
@@ -193,6 +195,22 @@ const msgListener = (req, sender, sendResponse) => {
 
 onMounted(() => {
     onRuntimeMsg();
+    // 切换用户
+    chrome.tabs.onUpdated.addListener((id, info) => {
+        if (info.status === "loading" && (info && info.url) && !isShare.value) {
+            let url = new URL(info.url);
+            let pathname = url.pathname;
+            let pathArr;
+            if (pathname) {
+                pathname = pathname.slice(1);
+                pathArr = pathname.split('/');
+                if (nftAccount.value !== pathArr[0]) {
+                    console.log(3333)
+                    getSaleInfo()
+                }
+            }
+        }
+    })
 })
 
 

+ 13 - 21
src/view/iframe/publish/components/give-dialog-head.vue

@@ -4,35 +4,25 @@
             <!-- 关闭按钮 -->
             <div class="close-btn" @click="close">
                 <template v-if="publishType == 'TOOL_BOX'">
-                    <img  class="icon-close"
-                    :src="require('@/assets/svg/icon-close.svg')"
-                    v-if="toolBoxPageData.activePage == 'EDITOR'"/>
-                    <img class="icon-close"
-                        :src="require('@/assets/svg/icon-back.svg')"
-                        v-else/>
+                    <img class="icon-close" :src="require('@/assets/svg/icon-close.svg')"
+                        v-if="toolBoxPageData.activePage == 'EDITOR'" />
+                    <img class="icon-close" :src="require('@/assets/svg/icon-back.svg')" v-else />
                 </template>
                 <template v-else>
-                    <img  class="icon-close"
-                    :src="require('@/assets/svg/icon-close.svg')"
-                    v-if="showComType == 'default'"/>
-                    <img class="icon-close"
-                        :src="require('@/assets/svg/icon-back.svg')"
-                        v-else/>
+                    <img class="icon-close" :src="require('@/assets/svg/icon-close.svg')"
+                        v-if="showComType == 'default'" />
+                    <img class="icon-close" :src="require('@/assets/svg/icon-back.svg')" v-else />
                 </template>
             </div>
             <!-- 标题 -->
             <div class="title">
-                {{title}}
+                {{ title }}
             </div>
         </div>
         <div class="right">
             <!-- 更多按钮 -->
-            <img :src="require('@/assets/svg/icon-more-l.svg')"
-                class="more"
-                @click="showMoreOption = true">
-            <div class="area-option" 
-                v-if="showMoreOption" 
-                @click="showMoreOption = false">
+            <img :src="require('@/assets/svg/icon-more-l.svg')" class="more" @click="showMoreOption = true">
+            <div class="area-option" v-if="showMoreOption" @click="showMoreOption = false">
                 <div class="option">
                     <div class="item" @click="goTransactionsList()">
                         <img :src="require('@/assets/svg/icon-menu.svg')">
@@ -46,6 +36,7 @@
 
 <script setup>
 import { ref, defineEmits, defineProps } from "vue";
+import { chromeExtensionUrl } from "@/uilts/chromeExtension"
 
 const props = defineProps({
     publishType: {
@@ -76,7 +67,7 @@ const emits = defineEmits(["close"]);
 let showMoreOption = ref(false);
 
 const goTransactionsList = () => {
-    window.open(`${chrome.runtime.getURL('/iframe/home.html#/transactions')}`)
+    window.open(`${chromeExtensionUrl + ('iframe/home.html#/transactions')}`)
 }
 
 const close = () => {
@@ -98,6 +89,7 @@ const close = () => {
     .left {
         display: flex;
         align-items: center;
+
         .title {
             font-size: 16px;
             font-weight: 500;
@@ -161,7 +153,7 @@ const close = () => {
                 }
 
                 .item:hover {
-                        background: #F5F5F5;
+                    background: #F5F5F5;
                 }
             }
         }

+ 4 - 4
src/view/iframe/publish/components/giveaway-poster.vue

@@ -14,7 +14,7 @@
                             validityDuration: baseFormData.validityDuration,
                             customPosterUrl: customPosterInfo && customPosterInfo.before && customPosterInfo.before.imagePath || '',
                             userInfo: {
-                                nickName: userInfo.name,
+                                nickName: userInfo.nickName,
                                 avatarUrl: userInfo.avatarUrl
                             },
                             rewardType: baseFormData.rewardType,
@@ -65,7 +65,7 @@
                             validityDuration: baseFormData.validityDuration,
                             customPosterUrl: customPosterInfo && customPosterInfo.after && customPosterInfo.after.imagePath || '',
                             userInfo: {
-                                nickName: userInfo.name,
+                                nickName: userInfo.nickName,
                                 avatarUrl: userInfo.avatarUrl
                             },
                             rewardType: baseFormData.rewardType,
@@ -220,7 +220,7 @@ onMounted(() => {
     calcPreviewCanvasParams();
     getUserInfo((res) => {
         if(res) {
-            getUserName(res.nickName);
+            // getUserName(res.nickName);
         }
     });
     window.addEventListener('resize',function () {
@@ -354,4 +354,4 @@ onMounted(() => {
     top: unset;
     left: unset;
 }
-</style>
+</style>

+ 1 - 1
src/view/iframe/publish/components/nft-setting.vue

@@ -5,7 +5,7 @@
                 <div class="sel"><a-radio value="public"></a-radio></div>
                 <div class="inp">
                     <img :src=" require('@/assets/svg/icon-post-edit-open.svg') " />
-                    <span>Publick</span>
+                    <span>Public</span>
                 </div>
             </label>
             <label class="item">

+ 22 - 22
src/view/iframe/publish/components/pay-button.vue

@@ -1,13 +1,13 @@
 <template>
-<!-- pay 支付按钮 -->
+    <!-- pay 支付按钮 -->
     <div class="pay-wrapper">
         <slot name="balance"></slot>
         <div class="pay-btn">
-            <div class="iframe-pay"
-                v-show="currentCurrencyInfo.currencyCode == 'USD'">
-                <div class="token-pay"
-                    @click="clickPayUSD">
-                    Pay ${{finalAmountData.rechargeAmountValue > 0 && USDepositStatus != 'SUCCESS' ? finalAmountData.rechargeAmountValue : finalAmountData.orderAmountValue}}
+            <div class="iframe-pay" v-show="currentCurrencyInfo.currencyCode == 'USD'">
+                <div class="token-pay" @click="clickPayUSD">
+                    Pay ${{ finalAmountData.rechargeAmountValue > 0 && USDepositStatus != 'SUCCESS' ?
+                            finalAmountData.rechargeAmountValue : finalAmountData.orderAmountValue
+                    }}
                 </div>
 
                 <!-- <iframe
@@ -15,11 +15,9 @@
                     ref="iframe"
                     :src="`${payConfig.paypalHtml}?paypalClientId=${payConfig.paypalClientId}&amount=${props.finalAmountData.finalAmountValue}`"></iframe> -->
             </div>
-            <div class="token-pay"
-                :class="{ disabled: Number(currentCurrencyInfo.balance) < Number(payConfig.amount) }"
-                v-if="currentCurrencyInfo.currencyCode != 'USD'"
-                @click="balancePay">
-                Pay {{payConfig.amount || 0}} {{currentCurrencyInfo.tokenSymbol}}
+            <div class="token-pay" :class="{ disabled: Number(currentCurrencyInfo.balance) < Number(payConfig.amount) }"
+                v-if="currentCurrencyInfo.currencyCode != 'USD'" @click="balancePay">
+                Pay {{ payConfig.amount || 0 }} {{ currentCurrencyInfo.tokenSymbol }}
             </div>
         </div>
     </div>
@@ -30,9 +28,9 @@ import { onMounted, ref, defineProps, defineEmits, watch, defineExpose } from "v
 
 import { PlayType } from '@/types';
 
-import {payTaskLuckdropWithBalance} from "@/http/publishApi"
+import { payTaskLuckdropWithBalance } from "@/http/publishApi"
 import Report from "@/log-center/log"
-import {setChromeStorage, getChromeStorage} from "@/uilts/chromeExtension"
+import { setChromeStorage, getChromeStorage, chromeExtensionUrl } from "@/uilts/chromeExtension"
 
 const props = defineProps({
     finalAmountData: {
@@ -99,7 +97,7 @@ const balancePay = () => {
     }, {
         type: Report.getCurrentBizType(props.bizType)
     });
-    if(payIng) {
+    if (payIng) {
         return;
     }
     payIng = true;
@@ -109,8 +107,8 @@ const balancePay = () => {
             postId: props.payConfig.postId
         }
     }).then(res => {
-        if(res.code == 0) {
-            emits("payFinish", {...res.data});
+        if (res.code == 0) {
+            emits("payFinish", { ...res.data });
         }
         payIng = false;
     }).catch(() => {
@@ -119,17 +117,17 @@ const balancePay = () => {
 }
 
 const clickPayUSD = () => {
-    if(props.finalAmountData.rechargeAmountValue > 0 && props.USDepositStatus != 'SUCCESS') {
+    if (props.finalAmountData.rechargeAmountValue > 0 && props.USDepositStatus != 'SUCCESS') {
         setTimeout(() => {
             emits("showDepositMask", {});
         }, 1000)
-        chrome.tabs.getCurrent(tab =>{
+        chrome.tabs.getCurrent(tab => {
             let achPayInfo = {
                 amountValue: props.finalAmountData.rechargeAmountValue,
                 tab: tab
             };
-            let guideUrl = chrome.runtime.getURL('/iframe/ach-cashier.html');
-            setChromeStorage({ achPayInfo : JSON.stringify(achPayInfo)});
+            let guideUrl = chromeExtensionUrl + ('iframe/ach-cashier.html');
+            setChromeStorage({ achPayInfo: JSON.stringify(achPayInfo) });
 
             chrome.tabs.create({
                 url: guideUrl
@@ -203,13 +201,14 @@ defineExpose({
 
             .icon {
                 width: 14px;
-                margin-left:6px;
+                margin-left: 6px;
             }
 
             .desc {
-                margin-right:6px
+                margin-right: 6px
             }
         }
+
         .msg {
             font-size: 13px;
             color: #898989;
@@ -232,6 +231,7 @@ defineExpose({
             padding: 0 30px;
             word-break: break-all;
             cursor: pointer;
+
             &.disabled {
                 background: #DEDEDE;
             }

+ 2 - 2
src/view/iframe/publish/components/preview-card.vue

@@ -29,7 +29,7 @@
                             validityDuration: baseFormData.validityDuration,
                             customPosterUrl: customPosterInfo && customPosterInfo.after && customPosterInfo.after.imagePath || '',
                             userInfo: {
-                                nickName: userInfo.name,
+                                nickName: userInfo.nickName,
                                 avatarUrl: userInfo.avatarUrl
                             },
                             rewardType: baseFormData.rewardType,
@@ -74,7 +74,7 @@
                             customPosterUrl: customPosterInfo && customPosterInfo.before && customPosterInfo.before.imagePath || '',
                             addFans: baseFormData.addFans,
                             userInfo: {
-                                nickName: userInfo.name,
+                                nickName: userInfo.nickName,
                                 avatarUrl: userInfo.avatarUrl
                             },
                             rewardType: baseFormData.rewardType,

+ 72 - 16
src/view/iframe/publish/give-dialog.vue

@@ -309,9 +309,9 @@
                                         usdEstimateOrderAmount: treasureFormData.usdEstimateOrderAmount,
                                         upGainAmountUsdValue: treasureFormData.upGainAmountUsdValue,
                                         currencyIconUrl: currentCurrencyInfo.iconPath,
-                                        customPosterUrl: customPosterInfo && customPosterInfo.after && customPosterInfo.after.imagePath || '',
+                                        customPosterUrl: previewCustomPosterUrl,
                                         userInfo: {
-                                            nickName: userInfo.name,
+                                            nickName: userInfo.nickName,
                                             avatarUrl: userInfo.avatarUrl
                                         },
                                     }"></custom-card-cover>
@@ -455,6 +455,7 @@
 import { ref, watch, reactive, defineProps, defineEmits, onMounted, nextTick, provide, computed } from "vue";
 import { postPublish, syncChainTokenRechargeRecord, getCurrencyInfoByCode, getUser } from "@/http/publishApi";
 import { getInviteGuildInfo, getInviteGuildInfoByOpenApi, saveInviteGuildInfo } from "@/http/discordApi";
+import { getPostEditorConfig } from "@/http/toolBoxApi";
 import { payCalcFee, getPayConfig } from "@/http/pay";
 import { upGainCalculate } from "@/http/treasureApi";
 import { getFrontConfig, calcRechargePayAmount } from "@/http/account";
@@ -490,6 +491,8 @@ import ComponentZoom from '@/view/components/component-zoom.vue'
 
 const config = {
     number: 'BigNumber',
+    precision: 64,            // Number of significant digits for BigNumbers
+    epsilon: 1e-60
 }
 const math = create(all, config);
 
@@ -538,7 +541,9 @@ let cropperType = ref('before')
 let customPosterInfo = ref({})
 let customPosterData = ref({})
 let customShowNewImage = ref(false)
-let refCropper = ref('')
+let refCropper = ref('');
+
+let previewCustomPosterUrl = ref('');
 
 // 当前展示组件内容 default(表单)  preview(预览)  topUp(充值)
 let showComType = ref("default");
@@ -829,6 +834,7 @@ watch(
             timer.value = setInterval(() => {
                 getCurrencyInfo({loop: true});
             }, 10000)
+            savePostEditorConfig();
         } else {
             clearInterval(timer.value);
         }
@@ -1240,8 +1246,11 @@ const submitRequest = async () => {
             showComType.value = "preview";
             previewFontSize.value = calcFontSize(baseFormData.amountValue, 238, 56);
             isBack.value = false;
-        } else {
-            console.log(res);
+        } else if(res.code == 2101){
+            const { usdPrice, minAmount, luckdropPostConfig = [] } = currentCurrencyInfo.value;
+            let currentLuckDropConfig = luckdropPostConfig.find(item => item.luckdropType === selectModeInfo.type);
+
+            message.warning(`The prize pool must be above $${currentLuckDropConfig.minTotalUsdAmount} and the average prize must be above $${currentLuckDropConfig.minAvgUsdAmount} per person.`);
         }
     })
     .catch((err) => {
@@ -1359,6 +1368,14 @@ const payStatusHandle = (payStatus) => {
     switch (payStatus) {
         case 1:
             emits("postPublishFinish", { publishRes });
+            Report.reportLog({
+              pageSource: Report.pageSource.previewPage,
+              businessType: Report.businessType.buttonClick,
+              objectType: Report.objectType.previewNextButton,
+              postId: publishRes.postId
+            }, {
+              type: Report.getCurrentBizType(selectModeInfo.type)
+            });
             showComType.value = "default";
             initParams();
             break;
@@ -1480,7 +1497,7 @@ const calcFansUnitAmount = () => {
         unitAmount = calcToken2UsdEstimate({amount: unitAmount, usdPrice: currentCurrencyInfo.value.usdPrice });
     }
 
-    return unitAmount;
+    return Math.floor(unitAmount * 1000) / 1000;
 };
 
 const setUpGainAmountUsdValue = (params) => {
@@ -1525,7 +1542,16 @@ const onUsdEstimateOrderAmountInput = () => {
 const onAmountInput = () => {
     let val = baseFormData.amountValue;
     // val = val.replace(/[^\d^\.]+/g, "");
-    val = String(val).replace(/^\D*(\d*(?:\.\d{0,18})?).*$/g, '$1');
+
+    let num = 2;
+    let minAmount = currentCurrencyInfo.value.minAmount;
+    let minArr = minAmount.split('.');
+    if(minArr && minArr.length > 1) {
+      num = minArr[1].length || 2;
+    }
+    let reg = new RegExp('^\\D*(\\d*(?:\\.\\d{0,'+num+'})?).*$', 'g');
+
+    val = String(val).replace(reg, '$1');
 
     const maxCount = baseFormData.rewardType === RewardType.money ? Number.MAX_SAFE_INTEGER : 100000000;
 
@@ -1638,12 +1664,15 @@ const calcIptValue = (cb) => {
         };
     }
 
-    if (math.format(math.evaluate(`${baseFormData.amountValue} / ${baseFormData.totalCount}`)) < +currentCurrencyInfo.value.minAmount) {
+    let val1 = +math.format(math.divide(math.bignumber(+baseFormData.amountValue), math.bignumber(+baseFormData.totalCount)));
+    let val2 = +math.format(math.divide(math.bignumber(+baseFormData.amountValue), math.bignumber(+currentCurrencyInfo.value.minAmount)));
+
+    if (val1 < +currentCurrencyInfo.value.minAmount) {
         flag = false;
     }
     return {
         flag,
-        count: Math.floor(math.format(math.evaluate(`${baseFormData.amountValue} / ${currentCurrencyInfo.value.minAmount}`)))
+        count: Math.floor(val2)
     }
 };
 
@@ -1662,11 +1691,16 @@ const checkUsdMinNumber = (isInTemplate) => {
             // 当前token允许的usd最小金额为0 或单个红包最小金额为0,则无限制
             return forbiddenText;
         } else {
-            const isAmountForbidden = currentLuckDropConfig?.minTotalUsdAmount ? math.format(math.evaluate(amountValue * usdPrice)) < currentLuckDropConfig.minTotalUsdAmount : false;
-            const isAvgForbidden = currentLuckDropConfig?.minAvgUsdAmount ? math.format(math.evaluate(amountValue / totalCount * usdPrice)) < currentLuckDropConfig.minAvgUsdAmount : false;
-            forbiddenText = isAmountForbidden && isAvgForbidden ?
+            let val1 = 0;
+            if(currentLuckDropConfig?.minAvgUsdAmount) {
+              val1 = +math.format(math.multiply(math.bignumber(+totalCount), math.bignumber(usdPrice)));
+            }
+
+            const isAmountForbidden = currentLuckDropConfig?.minTotalUsdAmount ? +math.format(math.multiply(math.bignumber(+amountValue), math.bignumber(usdPrice))) < currentLuckDropConfig.minTotalUsdAmount : false;
+            const isAvgForbidden = currentLuckDropConfig?.minAvgUsdAmount ? +math.format(math.divide(math.bignumber(+amountValue), math.bignumber(val1))) < currentLuckDropConfig.minAvgUsdAmount : false;
+            forbiddenText = isAmountForbidden || isAvgForbidden ?
                             `The prize pool must be above ${isInTemplate ? ('<span class="font-color-1D9BF0">$' + currentLuckDropConfig.minTotalUsdAmount + '</span>') : ('$' + currentLuckDropConfig.minTotalUsdAmount)}
-                            or the average prize must be above
+                            and the average prize must be above
                             ${isInTemplate ? ('<span class="font-color-1D9BF0">$' + currentLuckDropConfig.minAvgUsdAmount +' per person.</span>' ): ('$' + currentLuckDropConfig.minAvgUsdAmount + ' per person.') }`
                             : '';
         }
@@ -1689,8 +1723,7 @@ const checkTreasureAmountRange = (isInTemplate) => {
             let txt =  `The prize pool must be above ${isInTemplate ? ('<span class="font-color-1D9BF0">$' + currentLuckDropConfig.minTotalUsdAmount + '</span>') : ('$' + currentLuckDropConfig.minTotalUsdAmount)}
                             and the average prize must be above
                             ${isInTemplate ? ('<span class="font-color-1D9BF0">$' + currentLuckDropConfig.minAvgUsdAmount +' per person.</span>' ): ('$' + currentLuckDropConfig.minAvgUsdAmount + ' per person.') }`
-
-            const isAmountForbidden = currentLuckDropConfig?.minTotalUsdAmount ? +math.format(math.evaluate(baseFormData.amountValue * usdPrice)) < currentLuckDropConfig?.minTotalUsdAmount : false;
+            const isAmountForbidden = currentLuckDropConfig?.minTotalUsdAmount ? +math.format(math.multiply(math.bignumber(+baseFormData.amountValue), math.bignumber(usdPrice))) < currentLuckDropConfig?.minTotalUsdAmount : false;
 
             const isAvgForbidden = treasureFormData.fansUnitAmount !== '' && currentLuckDropConfig?.minAvgUsdAmount ? treasureFormData.fansUnitAmount < minAmount || treasureFormData.fansUnitAmount < currentLuckDropConfig?.minAvgUsdAmount : false;
 
@@ -2075,7 +2108,7 @@ const getUserName = (screenName) => {
 const getLocalCurrencyInfoByCode = async () => {
     let storageUserInfo = await getChromeStorage('userInfo') || {};
     userInfo.value = storageUserInfo;
-    getUserName(storageUserInfo.nickName);
+    // getUserName(storageUserInfo.nickName);
     if(!currentCurrencyInfo.value.currencyCode) {
         getCurrencyInfo();
     }
@@ -2135,8 +2168,10 @@ const selectPublishMode = (params, index) => {
         baseFormData.rewardType = RewardType.money;
         baseFormData.customizedReward = '';
         showGeneralLottery.value = false;
+        previewCustomPosterUrl.value = '';
     } else {
         showGeneralLottery.value = true;
+        previewCustomPosterUrl.value = customPosterInfo.value && customPosterInfo.value.after && customPosterInfo.value.after.imagePath || ''
     }
 
     onIptSetErrorTxt();
@@ -2158,6 +2193,14 @@ const onToolBoxPageChange = (params) => {
 
 const toolBoxPublishFinish = (params) => {
     toolBoxPageData.activePage = 'EDITOR';
+    Report.reportLog({
+      pageSource: Report.pageSource.previewPage,
+      businessType: Report.businessType.buttonClick,
+      objectType: Report.objectType.previewNextButton,
+      postId: params.publishRes.postId
+    }, {
+      type: Report.getCurrentBizType(PlayType.postEditor)
+    });
     emits("postPublishFinish", { publishRes: params.publishRes });
 }
 
@@ -2234,6 +2277,7 @@ const successImage = (data) => {
 const confirmData = (data) => {
     close()
     customPosterData.value = customPosterInfo.value;
+    previewCustomPosterUrl.value =  customPosterInfo.value && customPosterInfo.value.after && customPosterInfo.value.after.imagePath || ''
 }
 /**
  * 显示通用奖品名称编辑框
@@ -2322,11 +2366,22 @@ const onPageVisbile = () => {
     });
 }
 
+const savePostEditorConfig = () => {
+  getPostEditorConfig({
+    params: {}
+  }).then(res => {
+    if(res.code == 0 && res.data) {
+      setChromeStorage({ postEditorConfig : JSON.stringify(res.data)})
+    }
+  })
+}
+
 onMounted(() => {
     setFrontConfig();
     setPayConfig();
     getLocalCurrencyInfoByCode();
     onPageVisbile();
+    savePostEditorConfig();
     window.addEventListener('resize', function () {
         setDialogStyle(true);
     })
@@ -2489,6 +2544,7 @@ onMounted(() => {
 
                     .form-left-sheet {
                         width: 500px;
+                        height: max-content;
                     }
 
                     .form-right-sheet {

+ 55 - 77
src/view/iframe/publish/tool-box/child/editor.vue

@@ -23,7 +23,7 @@
           <div class="app-list">
             <div class="app" v-for="(app, idx) in historyList" :key="idx" @click="clickHistoryAppHandler(app)">
               <div class="img-wrapper">
-                <img class="img" :class="{ 'small-img': !app.appId }" :src="app.iconPath" :onerror="imgOnError" />
+                <img class="img" :class="{ 'small-img': !app.appId && !app.contentType }" :src="app.iconPath" :onerror="imgOnError" />
               </div>
               <div class="name">
                 {{ app.name }}
@@ -51,10 +51,9 @@
 
 <script setup>
 import { ref, defineProps, defineEmits, onMounted } from "vue";
-import axios from 'axios';
 import Report from "@/log-center/log"
 import { message } from "ant-design-vue";
-import { convertUrl, getAllPostEditorAppData, checkInputUrlInBlacklist } from "@/http/toolBoxApi";
+import { getAllPostEditorAppData, checkInputUrlInBlacklist } from "@/http/toolBoxApi";
 import { setChromeStorage, getChromeStorage } from "@/uilts/chromeExtension"
 import { checkURL, debounce } from "@/uilts/help"
 
@@ -78,9 +77,6 @@ let appList = ref();
 const emits = defineEmits(["changeShowCom"]);
 
 const searchHandler = async (_params) => {
-  let siteTitle = '', favicon = '';
-  let timer = null;
-
   // report
   Report.reportLog({
     pageSource: Report.pageSource.publisherDialog,
@@ -96,35 +92,26 @@ const searchHandler = async (_params) => {
 
   siteUrl.value = siteUrl.value.trim();
 
+  let postEditorConfig  = await getChromeStorage('postEditorConfig') || {};
+
   if (!checkURL(siteUrl.value)) {
     message.info('Incorrect URL entered');
     //提示
     return;
   }
-  const loadingHide = message.loading('loading...', 0);
-  timer = setTimeout(() => {
-    loadingHide();
-    message.error('Page loading failed');
-  }, 1000 * 15);
-
-  if(!_params) {
-    let blackListRes = await checkInputUrlInBlacklist({
-      params: {
-        url: siteUrl.value
-      }
-    })
 
-    if(blackListRes.code == 0) {
-      if(blackListRes.data) {
-        loadingHide();
-        clearTimeout(timer);
-        message.info('This site is not supported');
-        return;
+  if (!_params) {
+    if(postEditorConfig.inputUrlBlackList && postEditorConfig.inputUrlBlackList.length) {
+      for(let i = 0; i < postEditorConfig.inputUrlBlackList.length; i++) {
+        let url =  postEditorConfig.inputUrlBlackList[i];
+        if(siteUrl.value.startsWith(url)) {
+          message.info('This site is not supported');
+          return;
+        }
       }
     }
   }
 
-  let siteRes = await axios.get(siteUrl.value);
 
   let currentApp = {
     appId: '',
@@ -137,61 +124,28 @@ const searchHandler = async (_params) => {
     linkImagePath: '',
     name: '',
   }
+  let urlObj = new URL(siteUrl.value);
 
-  if (siteRes) {
-    if (siteRes.headers['content-type'].indexOf('text/html') < 0 || siteRes.request.status > 403) {
-      loadingHide();
-      message.error('Page loading failed');
-      return;
-    }
-    let urlObj = new URL(siteUrl.value);
-    if (siteRes.data) {
-      siteTitle = getTitleByHtmlStr(siteRes.data);
-      if (!siteTitle) {
-        siteTitle = urlObj.hostname;
-        currentApp.defaultTit = siteTitle;
-      }
-      currentApp.name = siteTitle;
-    }
-    favicon = urlObj.origin + '/favicon.ico';
-  }
-  currentApp.iconPath = favicon;
+  currentApp.iconPath = urlObj.origin + '/favicon.ico';
 
-  if(_params) {
+  if (_params) {
     currentApp = _params;
   }
-  
-  let convertRes = await convertUrl({ params: { originUrl: siteUrl.value } });
-  let params = { convertUrl: siteUrl.value, 
-                  originUrl: siteUrl.value, 
-                  appId: currentApp.appId, 
-                  linkImagePath: currentApp.linkImagePath, 
-                  currentApp };
-
-  loadingHide();
-  clearTimeout(timer);
-
-  if (convertRes && convertRes.code == 0) {
-    let { convertUrl } = convertRes.data || {};
-    params.convertUrl = convertUrl;
-  }
-  emits('changeShowCom', params)
-}
 
-const getTitleByHtmlStr = (str = '') => {
-  let tag_start = '<title>'
-  let tag_end = '</title>'
-  let index1 = str.indexOf(tag_start) + tag_start.length;
-  let index2 = str.indexOf(tag_end);
+  let siteConvertUrl = getConvertUrl({postEditorConfig, siteUrl: siteUrl.value});
 
-  if (index1 < tag_start.length || index2 < 0 || index2 < index1) {
-    return '';
-  }
+  let params = {
+    convertUrl: siteConvertUrl || siteUrl.value,
+    originUrl: siteUrl.value,
+    appId: currentApp.appId,
+    linkImagePath: currentApp.linkImagePath,
+    currentApp
+  };
 
-  return str.substring(index1, index2) || '';
-};
+  emits('changeShowCom', params)
+}
 
-const clickHistoryAppHandler =  debounce(function(params) {
+const clickHistoryAppHandler = debounce(function (params) {
   if (params.appId) {
     clickAppHandler(params, false);
   } else {
@@ -209,7 +163,7 @@ const clickHistoryAppHandler =  debounce(function(params) {
   });
 }, 800);
 
-const clickAppHandler =  debounce(function(params, isReport = true) {
+const clickAppHandler = debounce(function (params, isReport = true) {
   let { createType, defaultUrl, appId, linkImagePath } = params;
   switch (createType) {
     case 1:
@@ -253,10 +207,11 @@ const createGuideWindow = (params, isUpdate = false) => {
   openWindowList = [];
   selectAppGuideData = {};
 
-  let windowWith = window.screen.width - 500;
+  let windowWith = window.screen.width > 800 ? window.screen.width - 500 : 500;
   let guideUrl = chrome.runtime.getURL('/iframe/tool-box-guide.html');
 
-  setChromeStorage({ selectGuideApp : JSON.stringify(params)}, async () => {
+  setChromeStorage({ selectGuideApp: JSON.stringify(params) }, async () => {
+    console.log(windowWith, 'window', window)
     let window1 = await chrome.windows.create({
       width: windowWith,
       type: 'normal',
@@ -269,12 +224,12 @@ const createGuideWindow = (params, isUpdate = false) => {
       width: 500,
       type: 'popup',
       url: guideUrl,
-      left: windowWith,
+      left: window.screen.availLeft > 0 ? windowWith : window.screen.availLeft + windowWith,
       state: 'normal'
     })
     openWindowList.push(window2);
 
-    setChromeStorage({ guideAppWindowList: JSON.stringify({list: openWindowList})});
+    setChromeStorage({ guideAppWindowList: JSON.stringify({ list: openWindowList }) });
 
     // report
     Report.reportLog({
@@ -297,6 +252,29 @@ const getAppList = () => {
   })
 }
 
+const getConvertUrl = (params) => {
+  let {postEditorConfig = {}, siteUrl} = params;
+  const urlConvertConfigList = postEditorConfig.urlConvertConfigList || [];
+  let convertUrl = siteUrl;
+  if(urlConvertConfigList && urlConvertConfigList.length) {
+    for(let i = 0; i < urlConvertConfigList.length; i++) {
+      let urlPattern = urlConvertConfigList[i]['urlPattern'];
+      let reg = new RegExp(urlPattern);
+      let regMatch = siteUrl.match(reg);
+      if(regMatch && regMatch.length) {
+        let count = regMatch.length;
+        let urlConvertFormat = urlConvertConfigList[i]['urlConvertFormat'];
+        for(let j = 1; j < count; j++) {
+          urlConvertFormat = urlConvertFormat.replace(`{group${j}}`, regMatch[j])
+        }
+        convertUrl = urlConvertFormat;
+        break;
+      }
+    }
+  }
+
+  return convertUrl;
+}
 
 const onRuntimeMsg = () => {
   chrome.runtime.onMessage.addListener((req, sender, sendResponse) => {

+ 107 - 12
src/view/iframe/publish/tool-box/child/preview.vue

@@ -49,9 +49,7 @@
                                     {{ previewData.currentApp.linkTitle }}
                                 </template>
                                 <template v-else>
-                                    {{ previewData.currentApp.defaultTit ? defaultLinkTitle :
-                                            previewData.currentApp.name
-                                    }}
+                                    {{ resourceInfo.title }}
                                 </template>
                             </div>
                         </div>
@@ -127,22 +125,60 @@ const props = defineProps({
     hasNft: {
         type: Boolean,
         default: false
+    },
+    resourceInfo: {
+        type: Object,
+        default: () => {
+          return {}
+        }
+    },
+    contentTypeConfig: {
+        type: Object,
+        default: () => {
+          return {
+
+          }
+        }
     }
 })
 
 watch(() => props.screenshotWebsiteData,
     (newVal) => {
         let { appId } = props.previewData;
-        if (loadingHide && (!appId || appId && !props.previewData.linkImagePath) && (newVal.url || newVal.status)) {
-            loadingHide();
-            loadingHide = null;
-            submitPublish();
+        if (loadingHide && (!appId || appId && !props.previewData.linkImagePath) && newVal.status) {
+                console.log(props.resourceInfo, 'resourceInfo')
+            if(appId) {
+              loadingHide();
+              loadingHide = null;
+              submitPublish();
+            } else {
+              if(props.resourceInfo.isSet) {
+                loadingHide();
+                loadingHide = null;
+                submitPublish();
+              }
+            }
         }
     },
     {
         deep: true
     })
 
+watch(() => props.resourceInfo,
+    (newVal) => {
+      console.log(newVal, 'resourceInfo')
+      let { appId } = props.previewData;
+      if (!appId && loadingHide && newVal.isSet && props.screenshotWebsiteData.status) {
+        loadingHide();
+        loadingHide = null;
+        submitPublish();
+      }
+    },
+    {
+        deep: true
+    })
+
+
 watch(() => props.showCom,
     (newVal) => {
         if (newVal == 'EDITOR' && loadingHide) {
@@ -210,11 +246,16 @@ const publishHandler = () => {
     if (loadingHide) {
         return;
     }
-    if ((!appId || appId && !props.previewData.linkImagePath) && (!props.screenshotWebsiteData.url && !props.screenshotWebsiteData.status)) {
+    if ((!appId || appId && !props.previewData.linkImagePath) && !props.screenshotWebsiteData.status) {
         loadingHide = message.loading('loading...', 0);
         return;
     }
 
+    if (!appId && !props.resourceInfo.isSet) {
+      loadingHide = message.loading('loading...', 0);
+      return;
+    }
+
     submitPublish();
 }
 
@@ -225,16 +266,50 @@ const submitPublish = () => {
         return;
     }
 
-    setHistoryData(currentApp);
+    if(!appId) {
+        let allowContentTypes = props.contentTypeConfig.allowContentTypes || [];
+        let isSupport = false;
+
+        if(props.resourceInfo.loadSuccess) {
+          for(let i = 0; i< allowContentTypes.length; i++){
+            let idx = props.resourceInfo.contentType.indexOf(allowContentTypes[i]);
+            if(idx > -1) {
+              isSupport = true;
+              break;
+            }
+          }
+        } else {
+          message.error('Page loading failed');
+          return;
+        }
+
+        if(!isSupport) {
+          message.warning(props.contentTypeConfig.unSupportToast);
+          return;
+        }
+    }
+
+    let linkTitle = props.resourceInfo.title;
 
-    let linkTitle = currentApp.name ? currentApp.name : currentApp.defaultTit;
+    let appData = {
+      ...currentApp
+    }
+    if(!props.resourceInfo.hasTitle) {
+      let contentType = props.resourceInfo.contentType || '';
+      appData.iconPath = props.screenshotWebsiteData.viewBgImageFullPath;
+      appData.contentType = contentType;
+      linkTitle = contentType ? getResourceTitle({contentType}) : '';
+    }
+
+    setHistoryData(appData, {linkTitle: !appId ? linkTitle : '' });
 
     let postBizData = {
         convertUrl,
         originUrl,
         appId,
         linkTitle: !appId ? linkTitle : '',
-        linkImagePath: props.screenshotWebsiteData.url
+        linkImagePath: props.screenshotWebsiteData.url,
+        viewBgImagePath: props.screenshotWebsiteData.viewBgImagePath
     };
     if (props.certNftProjectId !== '') {
         postBizData['certNftProjectId'] = props.certNftProjectId;
@@ -247,6 +322,7 @@ const submitPublish = () => {
         },
     };
 
+    let subLoadingHide = message.loading('loading...', 0);
     submitIng.value = true;
 
     Report.reportLog({
@@ -261,20 +337,39 @@ const submitPublish = () => {
 
     postPublish(data).then((res) => {
         submitIng.value = false;
+        subLoadingHide();
         if (res.code == 0) {
             let publishRes = res.data;
             emits("publishFinish", { publishRes });
         } else {
         }
     }).catch((err) => {
+      subLoadingHide();
       submitIng.value = false;
         console.log(err);
     });
 }
 
-const setHistoryData = async (params) => {
+const getResourceTitle = (params) => {
+  let {contentType} = params;
+  let contentTypeTitleMap = props.contentTypeConfig.contentTypeTitleMap || {};
+  let title = ''
+  for (let key in contentTypeTitleMap) {
+    if(contentType.indexOf(key) > -1) {
+      title = contentTypeTitleMap[key];
+      break;
+    }
+  }
+  return title;
+}
+
+const setHistoryData = async (params, {linkTitle = ''}) => {
     const maxLength = 9;
     let { list = [] } = await getChromeStorage('toolBoxAppHistoryData') || {};
+    if (linkTitle) {
+      params.name = linkTitle;
+    }
+
     if (list.length) {
         let hasSite = list.find(item => item.defaultUrl == params.defaultUrl);
         if (hasSite) {

+ 90 - 5
src/view/iframe/publish/tool-box/index.vue

@@ -8,6 +8,8 @@
             :defaultLinkTitle="pageData.defaultLinkTitle"
             :certNftProjectId="certNftProjectId"
             :hasNft="hasNft"
+            :resourceInfo="resourceInfo"
+            :contentTypeConfig="contentTypeConfig"
             @publishFinish="publishFinish">
             <nft-setting ref="nftSettingDom" @change="changeSetting"></nft-setting>
         </preview>
@@ -15,9 +17,9 @@
 </template>
 
 <script setup>
-import { ref, reactive, watch, defineProps, defineEmits } from "vue";
-
-import { screenshotWebsite } from "@/http/toolBoxApi";
+import { ref, reactive, watch, defineProps, defineEmits, onMounted } from "vue";
+import axios from 'axios';
+import { screenshotWebsite, getContentTypeConfig } from "@/http/toolBoxApi";
 import editor from '@/view/iframe/publish/tool-box/child/editor.vue'
 import preview from '@/view/iframe/publish/tool-box/child/preview.vue'
 import Report from "@/log-center/log"
@@ -71,12 +73,29 @@ let certNftProjectId = ref('')
 
 let screenshotWebsiteData = reactive({
     url: '',
+    viewBgImagePath: '',
+    viewBgImageFullPath: '',
     status: '',
 });
 
 let nftSettingDom = ref(null);
 let hasNft = ref(false);
 
+let contentTypeConfig = ref({
+  allowContentTypes: [],
+  unSupportToast: '',
+  contentTypeTitleMap: {}
+})
+
+let resourceInfo = ref({
+  isSet: false,
+  contentType: '',
+  statusCode: '',
+  title: '',
+  hasTitle: false,
+  loadSuccess: false
+});
+
 const changeShowCom = (params) => {
     showCom.value = 'PREVIEW';
     previewData.convertUrl = params.convertUrl;
@@ -86,7 +105,19 @@ const changeShowCom = (params) => {
     previewData.currentApp = params.currentApp || {};
 
     screenshotWebsiteData.url = '';
+    screenshotWebsiteData.viewBgImagePath = '';
+    screenshotWebsiteData.viewBgImageFullPath = '';
     screenshotWebsiteData.status = '';
+
+    resourceInfo.value = {
+      isSet: false,
+      contentType: '',
+      statusCode: '',
+      title: '',
+      hasTitle: false,
+      loadSuccess: false
+    };
+
     if(!params.appId || params.appId && !params.linkImagePath) {
         screenshotWebsite({
             params: {
@@ -96,8 +127,10 @@ const changeShowCom = (params) => {
             if(showCom.value != 'PREVIEW') {
                 return;
             }
-            if(res.code == 0) {
-                screenshotWebsiteData.url = res.data;
+            if(res.code == 0 && res.data) {
+                screenshotWebsiteData.url = res.data.linkImagePath;
+                screenshotWebsiteData.viewBgImagePath = res.data.viewBgImagePath;
+                screenshotWebsiteData.viewBgImageFullPath = res.data.viewBgImageFullPath;
                 screenshotWebsiteData.status = 1;
             } else {
                 screenshotWebsiteData.status = 1;
@@ -110,9 +143,52 @@ const changeShowCom = (params) => {
         })
     }
 
+    if(!params.appId) {
+      getResourceInfo({url:params.convertUrl});
+    }
+
     emits("onPageChange", {page: showCom.value});
 }
 
+const getResourceInfo = ({url}) => {
+  axios.get(url).then(res => {
+    if(res) {
+      resourceInfo.value.isSet = true;
+      resourceInfo.value.contentType = res.headers['content-type'];
+      resourceInfo.value.statusCode = res.request.status;
+      resourceInfo.value.hasTitle = resourceInfo.value.contentType.indexOf('text/html') > -1 ? true : false;
+      resourceInfo.value.loadSuccess = true;
+
+      let siteTitle = '';
+      if(resourceInfo.value.hasTitle) {
+        siteTitle = getTitleByHtmlStr(res.data);
+        if (!siteTitle) {
+          let urlObj = new URL(url);
+          siteTitle = urlObj.hostname;
+        }
+      }
+      resourceInfo.value.title = siteTitle;
+    }
+
+  }).catch(err => {
+    resourceInfo.value.isSet = true;
+  })
+}
+
+const getTitleByHtmlStr = (str = '') => {
+  let tag_start = '<title>'
+  let tag_end = '</title>'
+  let index1 = str.indexOf(tag_start) + tag_start.length;
+  let index2 = str.indexOf(tag_end);
+
+  if (index1 < tag_start.length || index2 < 0 || index2 < index1) {
+    return '';
+  }
+
+  return str.substring(index1, index2) || '';
+};
+
+
 const publishFinish = (params) => {
     emits("toolBoxPublishFinish", params);
 }
@@ -121,6 +197,15 @@ const changeSetting = (id = '') => {
     certNftProjectId.value = id;
 }
 
+onMounted(() => {
+  getContentTypeConfig({
+    params: {}
+  }).then(res => {
+    if(res.code == 0) {
+      contentTypeConfig.value = res.data;
+    }
+  })
+})
 </script>
 
 <style lang="scss" scoped>

+ 18 - 16
src/view/iframe/red-packet/luck-draw.vue

@@ -200,9 +200,10 @@
                     </div>
                 </div>
             </div>
-            <get-more :reportData="{pageSource: Report.pageSource.received_success_page,
-                                    postId: state.postId
-                                    }"></get-more>
+            <get-more :reportData="{
+                pageSource: Report.pageSource.received_success_page,
+                postId: state.postId
+            }"></get-more>
         </div>
 
 
@@ -237,7 +238,7 @@
                 validityDuration: state.count_down_time,
                 countDown: state.count_down_time,
                 userInfo: {
-                    nickName: state.detail.postUserInfo.name,
+                    nickName: state.detail.postUserInfo.nickName,
                     avatarUrl: state.detail.postUserInfo.avatarUrl
                 },
                 rewardType: state.detail.rewardType,
@@ -270,7 +271,7 @@
                 </div>
             </div>
             <div class="luck-list" @scroll="handleScroll">
-                <div class="luck-item" v-for="item, i in state.detail.allReceived" v-bind:key="i">
+                <div class="luck-item" v-for="item, i in     state.detail.allReceived" v-bind:key="i">
                     <img v-if="item.simpleUserInfoVO.avatarUrl" :src="item.simpleUserInfoVO.avatarUrl" alt
                         @click="openTwitterDetail(item)" />
                     <img v-else :src="require('@/assets/svg/icon-twitter.svg')" alt />
@@ -349,10 +350,10 @@
                     <img :src="require('@/assets/svg/icon-win-time.svg')" alt />
                     <span>{{ state.count_down_time || '' }}</span>
                 </div>
-                <get-more :style_type="2"
-                          :reportData="{pageSource: Report.pageSource.waitingLotteryPage,
-                                        postId: state.postId
-                                      }"></get-more>
+                <get-more :style_type="2" :reportData="{
+                    pageSource: Report.pageSource.waitingLotteryPage,
+                    postId: state.postId
+                }"></get-more>
                 <div class="notification_switch" v-if="state.notification_show">
                     <span>Announcement Notification</span>
                     <a-switch v-model:checked="state.notification_switch" @change="changeNotification" />
@@ -410,8 +411,8 @@
                 </div>
             </div>
             <get-more :reportData="{
-              pageSource: Report.pageSource.missingLotteryPage,
-              postId: state.postId
+                pageSource: Report.pageSource.missingLotteryPage,
+                postId: state.postId
             }" v-if="state.close_status != '等待结果'"></get-more>
         </div>
 
@@ -434,7 +435,7 @@
         </div>
 
         <div v-show="state.loading_redbag" class="redbag">
-            <img :src="require('@/assets/img/icon-loading-redbag.gif')" alt />
+            <img :src="require('@/assets/img/icon-loading-redbag.png')" alt />
         </div>
 
     </div>
@@ -457,7 +458,7 @@ import FontAmount from '@/view/components/font-amount.vue'
 import FontZoom from '@/view/components/font-zoom.vue'
 import ComponentZoom from '@/view/components/component-zoom.vue'
 import GetMore from '@/view/iframe/publish/components/get-more.vue'
-import { setChromeStorage, getChromeStorage, sendChromeTabMessage } from '@/uilts/chromeExtension.js'
+import { setChromeStorage, getChromeStorage, sendChromeTabMessage, chromeExtensionUrl } from '@/uilts/chromeExtension.js'
 import Report from "@/log-center/log"
 import { srcPublishSuccess } from '@/http/publishApi'
 import { discordAuthUrl, checkGuildJoined } from '@/http/discordApi'
@@ -603,7 +604,7 @@ async function clickLikeBtn() {
     });
 }
 function clickDone() {
-    window.open(`${chrome.runtime.getURL('/iframe/home.html')}`)
+    window.open(`${chromeExtensionUrl + ('iframe/home.html')}`)
     // 埋点
     Report.reportLog({
         objectType: Report.objectType.wallet_button,
@@ -1076,7 +1077,8 @@ const reportBindTweetSuccess = (params) => {
     sendChromeTabMessage({
         actionType: "IFRAME_API_GET_TWEET_USER_INFO_REQ",
         data: {
-            screen_name: srcUserId
+            screen_name: srcUserId,
+            tweetId: state.tweetId
         }
     })
 
@@ -2013,7 +2015,7 @@ function onRuntimeMsg() {
                 break;
             case 'CONTENT_API_GET_TWEET_USER_INFO_RES':
                 let { user } = req.data || {};
-                if (user && user.result && user.result.legacy) {
+                if (req.tweetId == state.tweetId && user && user.result && user.result.legacy) {
                     let legacy = user.result.legacy;
                     reportParams.twitterFans = legacy ? legacy.followers_count : 0;
 

+ 22 - 18
src/view/iframe/red-packet/red-packet.vue

@@ -210,10 +210,10 @@
           </div>
         </div>
       </div>
-      <get-more  :reportData="{
-                    pageSource: Report.pageSource.received_success_page,
-                    postId: state.postId
-                  }" ></get-more>
+      <get-more :reportData="{
+        pageSource: Report.pageSource.received_success_page,
+        postId: state.postId
+      }"></get-more>
     </div>
 
 
@@ -245,7 +245,7 @@
         type: PlayType.common,
         validityDuration: state.detail.validityDuration,
         userInfo: {
-          nickName: state.detail.postUserInfo.name,
+          nickName: state.detail.postUserInfo.nickName,
           avatarUrl: state.detail.postUserInfo.avatarUrl
         },
         rewardType: state.detail.rewardType,
@@ -368,9 +368,9 @@
         </div>
       </div>
       <get-more :reportData="{
-                    pageSource: Report.pageSource.expiredPage,
-                    postId: state.postId
-                  }" ></get-more>
+        pageSource: Report.pageSource.expiredPage,
+        postId: state.postId
+      }"></get-more>
     </div>
 
 
@@ -392,7 +392,7 @@
     </div>
 
     <div v-show="state.loading_redbag" class="redbag">
-      <img :src="require('@/assets/img/icon-loading-redbag.gif')" alt />
+      <img :src="require('@/assets/img/icon-loading-redbag.png')" alt />
     </div>
 
   </div>
@@ -413,7 +413,7 @@ import { message } from 'ant-design-vue';
 import FontAmount from '@/view/components/font-amount.vue'
 import FontZoom from '@/view/components/font-zoom.vue'
 import GetMore from '@/view/iframe/publish/components/get-more.vue'
-import { setChromeStorage, getChromeStorage, sendChromeTabMessage } from '@/uilts/chromeExtension.js'
+import { setChromeStorage, getChromeStorage, sendChromeTabMessage, chromeExtensionUrl } from '@/uilts/chromeExtension.js'
 import Report from "@/log-center/log"
 import { srcPublishSuccess } from '@/http/publishApi'
 import { discordAuthUrl, checkGuildJoined } from '@/http/discordApi'
@@ -552,7 +552,7 @@ async function clickLikeBtn() {
   });
 }
 function clickDone() {
-  window.open(`${chrome.runtime.getURL('/iframe/home.html')}`)
+  window.open(`${chromeExtensionUrl + ('iframe/home.html')}`)
   // 埋点
   Report.reportLog({
     objectType: Report.objectType.wallet_button,
@@ -957,7 +957,8 @@ const reportBindTweetSuccess = (params) => {
   sendChromeTabMessage({
     actionType: "IFRAME_API_GET_TWEET_USER_INFO_REQ",
     data: {
-      screen_name: srcUserId
+      screen_name: srcUserId,
+      tweetId: state.tweetId
     }
   })
 
@@ -1194,6 +1195,7 @@ function setFrontConfig() {
 };
 
 function init(initParams) {
+  state.loading_show = true;
   let { type } = initParams || {};
   onPageVisbile();
   onWindowMessage();
@@ -1233,6 +1235,7 @@ function init(initParams) {
       handleErrorCode(res)
     }
   }).finally(() => {
+    state.loading_show = false
     state.loading_redbag = false
   })
 }
@@ -1480,11 +1483,11 @@ function handleFinishRedPacket() {
     if (res.code == 0) {
       if (res.data.finished) {
         state.receiveAmount = res.data.receiveAmount
-        if (state.receiveAmount == 0) {
-          showRabbitPage()
-        } else {
-          state.status = 'success'
-        }
+        // if (state.receiveAmount == 0) {
+        //   showRabbitPage()
+        // } else {
+        //   state.status = 'success'
+        // }
         init()
         // 埋点
         Report.reportLog({
@@ -1806,7 +1809,7 @@ function onRuntimeMsg() {
         break;
       case 'CONTENT_API_GET_TWEET_USER_INFO_RES':
         let { user } = req.data || {};
-        if (user && user.result && user.result.legacy) {
+        if (req.tweetId == state.tweetId && user && user.result && user.result.legacy) {
           let legacy = user.result.legacy;
           reportParams.twitterFans = legacy ? legacy.followers_count : 0;
 
@@ -2074,6 +2077,7 @@ body {
     position: fixed;
     top: 0;
     left: 0;
+    user-select: none;
 
     img {
       margin-top: 172px;

+ 3 - 3
src/view/iframe/tool-box/buy-nft.vue

@@ -1,15 +1,15 @@
 <template>
-    <div class="nft-layer">
+    <div class="nft-layer" v-if="nftAuthINfo">
         <div class="title">
             <img @click="close" :src=" require('@/assets/svg/icon-close.svg') " />
-            <span class="text">Unlock by Ruomeng NFT</span>
+            <span class="text">Unlock by {{ nftAuthINfo.nftProjectName }} NFT</span>
         </div>
         <div class="content">
             <div class="img">
                 <img v-if="nftAuthINfo && nftAuthINfo.icon" :src="nftAuthINfo.icon" />
             </div>
             <div class="tips">
-                <span>only Ruomeng NFT holder can view the content</span>
+                <span>only {{ nftAuthINfo.nftProjectName }} NFT holder can view the content</span>
             </div>
             <div
                 class="btn"

+ 2 - 2
src/view/iframe/tool-box/card.vue

@@ -19,7 +19,7 @@
                         <div class="font">Available for holders of {{state.detail.nftProjectName}} NFT</div>
                     </div>
                 </div>
-                <img class="mask_bg" v-if="state.detail.linkImagePath" :src=" state.detail.linkImagePath " />
+                <img class="mask_bg" v-if="state.detail.viewBgImagePath" :src=" state.detail.viewBgImagePath " />
             </template>
             <iframe :src="state.iframe_url" v-show="state.status == 'iframe'" ref="dom_iframe" frameborder="0"
                 scrolling="yes" allow="camera *;microphone *"></iframe>
@@ -659,7 +659,7 @@ const msgListener = (req, sender, sendResponse) => {
             flex-direction: column;
             width: 100%;
             height: 100%;
-            background-color: rgba($color: #000000, $alpha: .8);
+            background-color: rgba($color: #000000, $alpha: .5);
             .luck {
                 width: 100px;
                 height: 100px;

+ 2 - 2
src/view/iframe/tool-box/full.vue

@@ -20,7 +20,7 @@
                         <div class="font">Available for holders of {{detail.nftProjectName}} NFT</div>
                     </div>
                 </div>
-                <img class="mask_bg" v-if="detail.linkImagePath" :src=" detail.linkImagePath " />
+                <img class="mask_bg" v-if="detail.viewBgImagePath" :src=" detail.viewBgImagePath " />
             </template>
             <iframe :src="state.iframe_url" frameborder="0" allow="camera *;microphone *"></iframe>
         </div>
@@ -237,7 +237,7 @@ const hideMask = (data) => {
             flex-direction: column;
             width: 100%;
             height: 100%;
-            background-color: rgba($color: #000000, $alpha: .8);
+            background-color: rgba($color: #000000, $alpha: .5);
             .luck {
                 width: 100px;
                 height: 100px;

+ 2 - 2
src/view/iframe/treasure-hunt/components/btn.vue

@@ -47,7 +47,7 @@ let props = defineProps({
 const emit = defineEmits(['on-click'])
 
 const clickBtn = () => {
-    if (!props.disabled) {
+    if (props.disabled == false && props.loading == false) {
         emit('on-click')
     }
 }
@@ -61,7 +61,7 @@ const refresh = () => {
 
         state.init(() => {
             state.inviteInit()
-            state.inviteList()
+            state.inviteListRefresh()
         })
     }
 }

+ 80 - 18
src/view/iframe/treasure-hunt/components/invite-friends.vue

@@ -25,6 +25,9 @@ import VBtn from '@/view/iframe/treasure-hunt/components/btn.vue'
 import { inviteChannel } from '@/http/treasure'
 import { inject, onMounted } from 'vue'
 import Report from "@/log-center/log"
+import { getFrontConfig } from "@/http/account";
+import { faceShareRedirectUrl } from '@/http/configAPI'
+import { setChromeStorage } from '@/uilts/chromeExtension.js'
 
 let ClipboardJS = require('clipboard');
 
@@ -37,7 +40,7 @@ state.log_invite_btn_show = {
     redPacketType: Report.redPacketType.treasure,
     shareLinkId: state.invite_code,
     myShareLinkId: state.detail.inviteCopyUrl,
-    currentInvitedNum: state.detail.inviteCount,
+    currentInvitedNum: state.inviteCount,
     postId: state.postId
 }
 
@@ -48,7 +51,7 @@ state.log_invite_btn_click = {
     redPacketType: Report.redPacketType.treasure,
     shareLinkId: state.invite_code,
     myShareLinkId: state.detail.inviteCopyUrl,
-    currentInvitedNum: state.detail.inviteCount,
+    currentInvitedNum: state.inviteCount,
     postId: state.postId
 }
 state.log_invite_copy_btn_click = {
@@ -58,17 +61,48 @@ state.log_invite_copy_btn_click = {
     redPacketType: Report.redPacketType.treasure,
     shareLinkId: state.invite_code,
     myShareLinkId: state.detail.inviteCopyUrl,
-    currentInvitedNum: state.detail.inviteCount,
+    currentInvitedNum: state.inviteCount,
     postId: state.postId
 }
+
+let facebookAppConfig = {
+    facebookAppId: "",
+    faceShareRedirectUrl
+};
+
 onMounted(() => {
     state.btn_loading = false
+    setFrontConfig();
+    initInviteChannel()
+})
+
+chrome.management.onDisabled.addListener(() => {
+    initInviteChannel()
+})
+chrome.management.onEnabled.addListener(() => {
+    initInviteChannel()
+})
+
+chrome.management.onInstalled.addListener(() => {
+    initInviteChannel()
+})
+chrome.management.onUninstalled.addListener(() => {
+    initInviteChannel()
+})
+
+let linePluginInstalled
+const initInviteChannel = () => {
     try {
         chrome.management.get('ophjlpahpchlmihnnnihgmmeilfjmjjc', (res) => {
-            let linePluginInstalled = 0
+            if ((res && linePluginInstalled == 1) || (!res && linePluginInstalled == 0)) {
+                return
+            }
             if (res) {
                 linePluginInstalled = 1
+            } else {
+                linePluginInstalled = 0
             }
+
             inviteChannel({
                 params: {
                     linePluginInstalled,
@@ -83,8 +117,7 @@ onMounted(() => {
     } catch (error) {
         console.error(error)
     }
-
-})
+}
 
 async function clickBtn() {
     let _userInfo = await state.checkIsLogin()
@@ -106,23 +139,52 @@ const clickShare = (item) => {
         }, 2000)
         e.clearSelection();
     })
-    chrome.tabs.create({
-        url: item.redirectPath
-    });
-    let strArr = item.treasureInviteUrl.split('/');
-    let channelName = window.atob(strArr[strArr.length-1]);
+    if (item.name == 'facebook') {
+        setChromeStorage({
+            shareFacebookData: JSON.stringify({
+                contentStr: item.inviteContent
+            })
+        })
+        let cbParams = {
+            bizType: 'TEASURE_INVITE'
+        }
+        let url = `https://www.facebook.com/dialog/share?app_id=${facebookAppConfig.facebookAppId}&display=popup&href=${item.treasureInviteUrl}&redirect_uri=${facebookAppConfig.faceShareRedirectUrl}?params=${JSON.stringify(cbParams)}`;
+
+        chrome.windows.create({
+            width: 800,
+            type: 'normal',
+            url
+        }, function (window) {
+        })
+    } else {
+        chrome.tabs.create({
+            url: item.redirectPath
+        });
+    }
     Report.reportLog({
-      businessType: Report.businessType.buttonClick,
-      pageSource: Report.pageSource.inviteFriendsPage,
-      objectType: Report.objectType.channelButton,
-      shareLinkId: state.invite_code,
-      myShareLinkId: state.detail.inviteCopyUrl,
-      currentInvitedNum: state.detail.inviteCount,
+        businessType: Report.businessType.buttonClick,
+        pageSource: Report.pageSource.inviteFriendsPage,
+        objectType: Report.objectType.channelButton,
+        shareLinkId: state.invite_code,
+        myShareLinkId: state.detail.inviteCopyUrl,
+        currentInvitedNum: state.inviteCount,
+        postId: state.postId
     }, {
-      'channel-name': channelName
+        'channel-name': item.name
     });
 }
 
+const setFrontConfig = () => {
+    getFrontConfig({
+        params: {},
+    }).then((res) => {
+        if (res.code == 0) {
+            facebookAppConfig.facebookAppId = res.data.fbClientId;
+        }
+    });
+};
+
+
 
 const clickCopy = () => {
     var clipboard = new ClipboardJS('.copy-btn');

+ 61 - 24
src/view/iframe/treasure-hunt/components/invite-list.vue

@@ -4,7 +4,7 @@
             Invite people to hunt treasure with you!
         </div>
         <div class="list" v-else @scroll="handleScroll($event)">
-            <div class="item" v-for="item in state.invited_list">
+            <div class="item" v-for="item in state.invited_list" :key="item.userInfo.uid">
                 <div class="left">
                     <img :src="item.userInfo.avatarUrl" alt="" @click="clickItem(item)" />
                 </div>
@@ -23,7 +23,7 @@
 </template>
 <script setup>
 import VBtn from '@/view/iframe/treasure-hunt/components/btn.vue'
-import { inviteList } from '@/http/treasure'
+import { inviteList, inviteListRefresh } from '@/http/treasure'
 import { inject, onMounted } from 'vue'
 import Report from "@/log-center/log"
 
@@ -41,7 +41,7 @@ state.log_invite_btn_click = {
     redPacketType: Report.redPacketType.treasure,
     shareLinkId: state.invite_code,
     myShareLinkId: state.detail.inviteCopyUrl,
-    currentInvitedNum: state.detail.inviteCount,
+    currentInvitedNum: state.inviteCount,
     postId: state.postId
 }
 
@@ -51,7 +51,7 @@ state.log_invite_list_show = {
     redPacketType: Report.redPacketType.treasure,
     shareLinkId: state.invite_code,
     myShareLinkId: state.detail.inviteCopyUrl,
-    currentInvitedNum: state.detail.inviteCount,
+    currentInvitedNum: state.inviteCount,
     postId: state.postId
 }
 
@@ -71,38 +71,74 @@ function handleScroll(e) {
     e = e.target
     if ((e.clientHeight + e.scrollTop) / e.scrollHeight > .8) {
         list_end = true
-        if (state.invited_list.length == page_num * page_size) {
-            page_num++
-        }
-        list()
+        inviteListScroll()
     }
 }
 
 const list = () => {
-    state.inviteList()
+    state.inviteListRefresh()
+}
+
+// 刷新时调用
+state.inviteListRefresh = () => {
+    let last_timestamp = 0
+    if (state.invited_list.length > 0) {
+        last_timestamp = state.invited_list[0].timestamp
+    }
+
+    inviteListRefresh({
+        params: {
+            postId: state.postId,
+            lastTimestamp: last_timestamp,
+        }
+    }).then((res) => {
+        if (res.code == 0) {
+            handleCommon(res.data)
+        }
+    })
 }
 
-state.inviteList = () => {
+const handleCommon = (data) => {
+    state.inviteCount = data.inviteCount
+    if (state.inviteCount > 0) {
+        state.tabs[1].txt = `invited(${state.inviteCount})`
+    }
+    if (data.inviteUsers.length > 0) {
+        data.inviteUsers.forEach(item => {
+            if (state.invited_list.filter((item2) => { return item2.userInfo.uid == item.userInfo.uid }).length == 0) {
+                state.invited_list.push(item)
+            }
+        })
+        state.invited_list = state.invited_list.sort((a, b) => {
+            return b.timestamp - a.timestamp
+        })
+
+        list_end = false
+    } else {
+        list_end = false
+    }
+}
+
+// 滚动
+let inviteListScroll = () => {
+    // state.invited_list
+    let last_timestamp = 0
+    let len = state.invited_list.length
+    if (len > 0) {
+        last_timestamp = state.invited_list[len - 1].timestamp
+    }
+
     inviteList({
         params: {
             inviteCode: state.invite_code,
             postId: state.postId,
-            pageNum: page_num,
-            pageSize: page_size,
+            lastTimestamp: last_timestamp,
+            pageSize: page_size
         }
-
     }).then((res) => {
         if (res.code == 0) {
-            if (res.data.length > 0) {
-                res.data.forEach(item => {
-                    if (state.invited_list.filter((item2) => { return item2.userInfo.uid == item.userInfo.uid }).length == 0) {
-                        state.invited_list.push(item)
-                    }
-                })
-                list_end = false
-            } else {
-                list_end = false
-            }
+
+            handleCommon(res.data)
         }
     })
 }
@@ -179,6 +215,7 @@ async function clickBtn() {
                 text-align: center;
 
                 img {
+                    cursor: pointer;
                     border-radius: 50px;
                     width: 30px;
                     height: 30px;
@@ -197,7 +234,7 @@ async function clickBtn() {
                     color: #000000;
                     font-weight: 500;
                     font-size: 15px;
-
+                    cursor: pointer;
                 }
 
                 div:nth-child(2) {

+ 196 - 47
src/view/iframe/treasure-hunt/cover.vue

@@ -57,9 +57,10 @@ import Report from "@/log-center/log"
 import { prepareStart, treasureStart } from '@/http/treasure.js'
 import { getChromeCookie, removeChromeCookie, getChromeStorage, sendChromeTabMessage } from '@/uilts/chromeExtension.js'
 import { reSetBindRepost } from '@/http/help.js'
+import { guid } from '@/uilts/help.js'
 
 let state = inject('state')
-
+let global_userInfo
 state.log_show = {
     businessType: Report.businessType.pageView,
     pageSource: Report.pageSource.pending_page,
@@ -75,14 +76,25 @@ chrome.storage.onChanged.addListener(changes => {
         state.init()
     }
 })
-
+let to_start_time = new Date().getTime()
+let now_time
 const toStart = (req) => {
+    now_time = new Date().getTime()
+    if (now_time - to_start_time <= 1000) {
+        return
+    }
+    to_start_time = now_time
+    console.log('to_start_time', to_start_time)
     treasureStart({
         params: {
             postId: state.postId || '',
-            inviteCode: state.invite_code || ''
+            inviteCode: state.invite_code || '',
+            frontFollowRelJSON: JSON.stringify(state.usersFollowStatusList),
+            time: new Date().getTime(),
+            guid: guid()
         }
     }).then((res) => {
+        state.usersFollowStatusList = [];
         if (res.code == 0) {
             state.page = '开奖页'
             state.start_task = res.data
@@ -106,52 +118,186 @@ const toStart = (req) => {
 chrome.runtime.onMessage.addListener((req, sender, sendResponse) => {
     switch (req.actionType) {
         case 'DO_TASK':
-            if (!req.task_type || state.tweetId != req.tweet_Id) {
+            if (!req.task_type || state.tweetId != req.tweet_Id || state.iframeId != req.iframeId) {
                 return
             }
-            if (!req.task_done && req.task_type == 'createTweet') {
+            console.log('DO_TASK', req)
+            if (req.task_type == 'createTweet1' && req.task_done == '否') {
+                console.log('createTweet1', req)
                 state.toast.txt = 'Seems something went wrong, please try again'
                 state.toast.show = true
                 state.toast.has_icon = false
                 setTimeout(() => {
                     state.toast.show = false
                 }, 2000)
-            } else if (req.task_type == 'createTweet' && req.task_done) {
+            } else if (req.task_type == 'createTweet1' && req.task_done == '是') {
+                console.log('createTweet2', req)
                 toStart(req);
                 getChromeStorage('userInfo', (_userInfo) => {
-                    if(_userInfo) {
-                      sendChromeTabMessage({
-                        actionType: "IFRAME_API_GET_TWEET_USER_INFO_REQ",
-                        data: {
-                            screen_name: _userInfo.nickName,
-                            tweetId: state.tweetId,
-                            objectType: Report.objectType.repostSuccess
-                        }
-                      })
+                    if (_userInfo) {
+                        sendChromeTabMessage({
+                            actionType: "IFRAME_API_GET_TWEET_USER_INFO_REQ",
+                            data: {
+                                screen_name: _userInfo.nickName,
+                                tweetId: state.tweetId,
+                                objectType: Report.objectType.repostSuccess
+                            }
+                        })
                     }
                 })
             }
             break
         case 'CONTENT_API_GET_TWEET_USER_INFO_RES':
-                let twitterFans = 0;
-                let { user } = req.data || {};
-                if (user && user.result && user.result.legacy) {
-                    let legacy = user.result.legacy;
-                    twitterFans = legacy ? legacy.followers_count : 0;
+            let twitterFans = 0;
+            let { user } = req.data || {};
+            if (user && user.result && user.result.legacy) {
+                let legacy = user.result.legacy;
+                twitterFans = legacy ? legacy.followers_count : 0;
+            }
+            if (state.tweetId == req.tweetId && req.objectType == Report.objectType.repostSuccess) {
+                Report.reportLog({
+                    objectType: Report.objectType.repostSuccess,
+                    twitterFans: twitterFans,
+                    redPacketType: Report.redPacketType.treasure,
+                    postId: state.postId,
+                    shareLinkId: state.invite_code,
+                });
+            };
+            break;
+        case 'CONTENT_GET_TWEET_USER_FOLLOW_STATUS_RES':
+            if (state.tweetId == req.tweetId && state.iframeId == req.iframeId) {
+
+                if (req.type == 'pre_repost') {
+                    // 发送埋点
+                    let list = getFollowStatus(req.data)
+                    log_pre_repost.names.forEach(item => {
+                        list.forEach((item2) => {
+                            if (item.name == item2.name) {
+                                if (item.type == 'invite') {
+                                    log_pre_repost.params.isFatherTwitterFans = item2.followed
+                                }
+                                if (item.type == 'post') {
+                                    log_pre_repost.params.isRootTwitterFans = item2.followed
+                                }
+                            }
+                        })
+                    })
+
+                    // 上报埋点
+                    Report.reportLog(Object.assign({
+                        objectType: Report.objectType.preRepost,
+                    }, log_pre_repost.params))
+
+                } else {
+                    state.usersFollowStatusList = getFollowStatus(req.data);
+                    // 上报埋点
+                    logPreRepost()
+                    // 做任务
+                    chrome.tabs.getCurrent((tab) => {
+                        // // 一键三连
+                        chrome.tabs.sendMessage(tab.id, {
+                            actionType: "IFRAME_TWITTER_API_DO_TASK",
+                            task_data: {
+                                tweet_Id: state.tweetId,
+                                tweet_text: state.rePostTweetContent
+                            },
+                            task_type: 'tasks',
+                            tasks: state.tasks,
+                            iframeId: state.iframeId
+                        })
+                        // double like
+                        chrome.tabs.sendMessage(tab.id, {
+                            actionType: "IFRAME_TWITTER_API_DO_TASK", task_data: {
+                                tweet_Id: state.detail.srcContentId
+                            }, task_type: 'like',
+                            iframeId: state.iframeId
+                        })
+                    })
                 }
-                if (state.tweetId == req.tweetId && req.objectType == Report.objectType.repostSuccess) {
-                  Report.reportLog({
-                      objectType: Report.objectType.repostSuccess,
-                      twitterFans: twitterFans,
-                      redPacketType: Report.redPacketType.treasure,
-                      postId: state.postId,
-                      shareLinkId: state.invite_code,
-                  });
-                };
+            }
             break;
     }
 })
 
+const getFollowStatus = (arr = []) => {
+    let list = [];
+    let userInfoList = arr;
+    for (let i = 0; i < userInfoList.length; i++) {
+        let item = userInfoList[i];
+        if (item.user && item.user.result && item.user.result.legacy) {
+            let legacy = item.user.result.legacy;
+            list.push({
+                name: legacy.screen_name,
+                followed: legacy.following
+            })
+        }
+    }
+    return list
+}
+
+let log_pre_repost = {
+    params: {},
+    names: []
+}
+const logPreRepost = () => {
+    log_pre_repost.params = {}
+    log_pre_repost.names = []
+
+    // rootTwitterName  上报原始发布者的name
+    // fatherTwitterName 上报分享者的name or 原始发布者的name
+    // isFatherTwitterFans 在原始链接或分享链接 邀请者非自己 
+    // isRootTwitterFans 在原始链接或分享链接 发布者非自己
+
+    let params = {}
+    params.postId = state.postId
+    if (state.page_type == '邀请链接') {
+        params.shareLinkId = state.invite_code
+        params.fatherTwitterName = state.detail.inviteUserInfo.nickName
+    } else if (state.page_type == '原始链接') {
+        params.fatherTwitterName = state.detail.postUserInfo.nickName
+    }
+    params.rootTwitterName = state.detail.postUserInfo.nickName
+    let names = []
+    if (state.detail.inviteUserInfo) {
+        if (state.detail.inviteUserInfo.uid != global_userInfo.uid) {
+            // isFatherTwitterFans = inviteUserInfo.nickName 的关注关系
+            // 发送事件校验关注关系
+            names.push({
+                type: 'invite',
+                name: state.detail.inviteUserInfo.nickName
+            })
+        }
+    } else {
+        if (state.detail.postUserInfo.uid != global_userInfo.uid) {
+            names.push({
+                type: 'invite',
+                name: state.detail.postUserInfo.nickName
+            })
+        }
+    }
+
+    if (state.detail.postUserInfo && (state.detail.postUserInfo.uid != global_userInfo.uid)) {
+        // isRootTwitterFans = postUserInfo.nickName 的关注关系
+        // 发送事件校验关注关系
+        names.push({
+            type: 'post',
+            name: state.detail.postUserInfo.nickName
+        })
+    }
+
+    sendChromeTabMessage({
+        actionType: "IFRAME_API_GET_TWEET_USER_FOLLOW_STATUS",
+        data: {
+            userList: names,
+            tweetId: state.tweetId
+        },
+        type: 'pre_repost',
+        iframeId: state.iframeId
+    })
+    log_pre_repost.params = params
+    log_pre_repost.names = names
+}
+
 const toLast = (num, bit) => {
     let str = 1
     for (let i = 0; i < bit; i++) {
@@ -161,10 +307,9 @@ const toLast = (num, bit) => {
     return Math.floor(Number(num) * _num) / _num
 }
 
-
 async function clickBtn() {
-    let _userInfo = await state.checkIsLogin()
-    if (!_userInfo) {
+    global_userInfo = await state.checkIsLogin()
+    if (!global_userInfo || !global_userInfo.uid) {
         return
     }
     if (state.cover_status == '奖励已被领光') {
@@ -177,7 +322,7 @@ async function clickBtn() {
         window.open('https://twitter.com/search?q=%23denet');
         return
     }
-
+    state.btn_loading = true
 
     Report.reportLog({
         businessType: Report.businessType.buttonClick,
@@ -188,7 +333,6 @@ async function clickBtn() {
         postId: state.postId
     });
 
-    state.btn_loading = true
     setTimeout(() => {
         if (state.btn_loading == true) {
             state.btn_loading = false
@@ -221,24 +365,29 @@ const startBtn = () => {
                 url: pageUrl,
             })
 
-            let text = res.data.rePostTweetContent
-            // 一键三连
-            chrome.tabs.getCurrent((tab) => {
-                chrome.tabs.sendMessage(tab.id, {
-                    actionType: "IFRAME_TWITTER_API_DO_TASK",
-                    task_data: {
-                        tweet_Id: state.tweetId,
-                        tweet_text: text
-                    },
-                    task_type: 'tasks',
-                    tasks: state.tasks,
-                });
-            })
+            state.rePostTweetContent = res.data.rePostTweetContent;
+            getUsersFollowStatus();
         } else {
             state.init()
         }
     })
 }
+
+const getUsersFollowStatus = () => {
+    let userList = state.follows;
+
+    if (userList && userList.length) {
+        sendChromeTabMessage({
+            actionType: "IFRAME_API_GET_TWEET_USER_FOLLOW_STATUS",
+            data: {
+                userList: userList,
+                tweetId: state.tweetId,
+            },
+            iframeId: state.iframeId
+        })
+    }
+}
+
 </script>
 <style lang="scss" scoped>
 .cover {

+ 58 - 11
src/view/iframe/treasure-hunt/index.vue

@@ -1,9 +1,12 @@
 <template>
-    <v-cover v-if="state.page == '封面页'"></v-cover>
+    <v-cover v-show="state.page == '封面页'"></v-cover>
     <v-invite v-if="state.page == '邀请页'"></v-invite>
     <v-result v-if="state.page == '开奖页'"></v-result>
     <open-box v-show="state.open_box.show"></open-box>
     <v-toast :show="state.toast.show" :txt="state.toast.txt" :has_icon="state.toast.has_icon"></v-toast>
+    <div v-show="state.loading_redbag" class="redbag">
+        <img :src="require('@/assets/img/icon-loading-redbag.png')" alt />
+    </div>
 </template>
 <script setup>
 import { reactive, provide, onMounted } from 'vue'
@@ -11,7 +14,7 @@ import VCover from '@/view/iframe/treasure-hunt/cover.vue'
 import VInvite from '@/view/iframe/treasure-hunt/invite.vue'
 import VResult from '@/view/iframe/treasure-hunt/result.vue'
 import { inviteDetail, treasureDetail, treasureOpen } from '@/http/treasure.js'
-import { reSetBindTwtterId, reSetBindRepost } from '@/http/help.js'
+import { reSetBindTwtterId, reSetBindPostContent, reSetBindRepost } from '@/http/help.js'
 import { getQueryString } from '@/uilts/help'
 import { getChromeStorage, sendChromeTabMessage } from '@/uilts/chromeExtension.js'
 import VToast from '@/view/iframe/treasure-hunt/components/toast.vue'
@@ -19,6 +22,7 @@ import OpenBox from '@/view/iframe/treasure-hunt/components/open-box.vue'
 import Report from "@/log-center/log"
 
 let state = reactive({
+    loading_redbag: true,
     page: '',
     detail: {},
     oldDetail: {},
@@ -37,16 +41,19 @@ let state = reactive({
         show: false,
     },
     start_task: {},
-    toast: {}
+    toast: {},
+    iframeId: ''
 })
 provide('state', state)
 
 let params = {}
 onMounted(() => {
     params = JSON.parse(getQueryString('params') || '{}')
+    state.iframeId = getQueryString('iframeId') || ''
     state.postId = params.post_Id || ''
     state.tweetId = params.tweet_Id || ''
     state.invite_code = params.invite_code || ''
+    state.page_type = params.page_type || ''
     state.init();
     onRuntimeMsg();
 })
@@ -77,7 +84,7 @@ state.init = (callback) => {
             }
         }).then((res) => {
             if (res.code == 0) {
-
+                state.loading_redbag = false
                 handleCommon(res, callback)
                 // 绑定repostSrcContentId
                 if (!res.data.repostSrcContentId) {
@@ -97,7 +104,17 @@ state.init = (callback) => {
             }
         }).then((res) => {
             if (res.code == 0) {
+                state.loading_redbag = false
                 handleCommon(res, callback)
+                // 原始链接绑定post content
+                if (!res.data.postSrcContent) {
+                    sendChromeTabMessage({
+                        actionType: "GET_CONTENT_BY_TWITTER_ID",
+                        data: {
+                            tweet_Id: state.tweetId
+                        }
+                    })
+                }
             }
         })
     }
@@ -111,7 +128,7 @@ const reportOpenBoxLog = () => {
             redPacketType: Report.redPacketType.treasure,
             shareLinkId: state.invite_code,
             myShareLinkId: state.detail.inviteCopyUrl,
-            currentInvitedNum: state.detail.inviteCount,
+            currentInvitedNum: state.inviteCount,
             postId: state.postId
         });
         state.open_box.showed = false
@@ -124,7 +141,7 @@ const reportOpenBoxLog = () => {
             redPacketType: Report.redPacketType.treasure,
             shareLinkId: state.invite_code,
             myShareLinkId: state.detail.inviteCopyUrl,
-            currentInvitedNum: state.detail.inviteCount,
+            currentInvitedNum: state.inviteCount,
             postId: state.postId
         });
         state.open_box.clicked = false
@@ -158,6 +175,7 @@ const handleCommon = (res, callback) => {
                     objectType: Report.objectType.tweetPostBinded
                 }
             })
+            state.init()
         })
     }
     handleStatus(callback)
@@ -191,7 +209,7 @@ state.treasureOpen = () => {
 
             state.init(() => {
                 state.inviteInit()
-                state.inviteList()
+                state.inviteListRefresh()
             })
         } else {
             switch (String(res.code)) {
@@ -218,7 +236,7 @@ state.treasureOpen = () => {
 
             state.init(() => {
                 state.inviteInit()
-                state.inviteList()
+                state.inviteListRefresh()
             })
         }
     }).catch(() => {
@@ -238,12 +256,11 @@ const handleStatus = (callback) => {
     //  显示结束页面
 
     let { status, joinStatus } = state.detail || {}
-    state.open_btn.txt = 'Start'
     // 如果 夺宝状态 = 未开始
     if (status == 0) {
-        state.page = '封面页'
-
+        // 未做处理
     }
+
     // 如果 夺宝状态 = 进行中
     else if (status == 1) {
         // 如果 夺宝参与状态 = 未参与夺宝
@@ -274,6 +291,15 @@ const handleStatus = (callback) => {
 function onRuntimeMsg() {
     chrome.runtime.onMessage.addListener((req, sender, sendResponse) => {
         switch (req.actionType) {
+            case 'CONTENT_GET_TWEET_TXT':
+                if (req.data.tweet_Id == state.tweetId && !state.detail.postSrcContent) {
+                    state.detail.postSrcContent = req.data.txt
+                    reSetBindPostContent({
+                        postId: state.postId || '',
+                        postSrcContent: req.data.txt,
+                    })
+                }
+                break
             case 'CONTENT_API_GET_TWEET_USER_INFO_RES':
                 let twitterFans = 0;
                 let { user } = req.data || {};
@@ -300,5 +326,26 @@ html,
 body {
     margin: 0;
     padding: 0;
+    width: 100%;
+    height: 100%;
+    overflow: hidden;
+
+    .redbag {
+        z-index: 222;
+        text-align: center;
+        width: 375px;
+        height: 500px;
+        position: fixed;
+        top: 0;
+        left: 0;
+        user-select: none;
+
+        img {
+            margin-top: 172px;
+            width: 130px;
+            height: 130px;
+        }
+    }
+
 }
 </style>

+ 5 - 8
src/view/iframe/treasure-hunt/invite.vue

@@ -61,7 +61,7 @@ state.log_invite_show = {
     redPacketType: Report.redPacketType.treasure,
     shareLinkId: state.invite_code,
     myShareLinkId: state.detail.inviteCopyUrl,
-    currentInvitedNum: state.detail.inviteCount,
+    currentInvitedNum: state.inviteCount,
     postId: state.postId
 }
 
@@ -91,7 +91,7 @@ onMounted(() => {
     setInterval(() => {
         state.init(() => {
             state.inviteInit()
-            state.inviteList()
+            state.inviteListRefresh()
         })
     }, 30000)
 })
@@ -100,9 +100,6 @@ const clickItem = (item) => {
     window.open(`https://twitter.com/${item.userInfo.nickName}`)
 }
 state.inviteInit = () => {
-    if (state.detail.inviteCount > 0) {
-        state.tabs[1].txt = `invited(${state.detail.inviteCount})`
-    }
     state.boxs = []
     state.detail.treasureRecords.forEach((item, index) => {
         if (item.openStatus == 0) {
@@ -122,7 +119,7 @@ state.inviteInit = () => {
             } else {
                 item.icon = silver_open_box
             }
-            item.txt = '$' + item.amountValue
+            item.txt = '$' + item.amountUsdValue
         }
 
         state.boxs.push(item)
@@ -157,8 +154,8 @@ const setLineFull = (box_num = 0, finishNeedInviteCount = 0, successInviteCount
         line_width = (successInviteCount / finishNeedInviteCount) * 55
     } else if (box_num == 1) {
         if (line_width == 55) {
-            // 第二个宝箱起点是92,终点是155
-            line_width = 92
+            // 第二个宝箱起点88,终点是155
+            line_width = 88
             line_width = (successInviteCount / finishNeedInviteCount) * (155 - line_width) + line_width
         }
     } else if (box_num == 2) {

+ 178 - 187
src/view/popup/currency-detail.vue

@@ -1,34 +1,27 @@
 <template>
   <div class="currency-detail-page">
-    <v-head :title="currencyInfo.tokenSymbol" 
-            :show_more="false"
-            :show_refresh="true"
-            :show_list="true"
-            :transactionsRouterParams="{
-              backUrl: 'back'
-            }"
-            back_url="/"
-            @on-refresh="onRefresh" />
+    <v-head :title="currencyInfo.tokenSymbol" :show_more="false" :show_refresh="true" :show_list="true"
+      :transactionsRouterParams="{
+        backUrl: 'back'
+      }" back_url="/" @on-refresh="onRefresh" />
     <div class="top">
-      <img
-        class="icon-currency"
-        :src="currencyInfo.iconPath"/>
+      <img class="icon-currency" :src="currencyInfo.iconPath" />
       <div class="amount">
         <div class="balance"
-            :class="{'direction-column': (currencyInfo.totalBalance.length + currencyInfo.tokenSymbol.length) > 15}">
+          :class="{ 'direction-column': (currencyInfo.totalBalance.length + currencyInfo.tokenSymbol.length) > 15 }">
           <a-tooltip :title="currencyInfo.totalBalance">
-              {{ getBit(currencyInfo.totalBalance) }}
-          </a-tooltip> 
+            {{ getBit(currencyInfo.totalBalance) }}
+          </a-tooltip>
           <template v-if="currencyInfo.totalBalance.length + currencyInfo.tokenSymbol.length < 16">
             &nbsp;&nbsp;
           </template>
           <span class="symbol">
-            {{currencyInfo.tokenSymbol}}
+            {{ currencyInfo.tokenSymbol }}
           </span>
         </div>
         <div class="final">
-          <a-tooltip :title="'$'+currencyInfo.totalUsdEstimateBalance">
-              ${{ getBit(currencyInfo.totalUsdEstimateBalance) }}
+          <a-tooltip :title="'$' + currencyInfo.totalUsdEstimateBalance">
+            ${{ getBit(currencyInfo.totalUsdEstimateBalance) }}
           </a-tooltip>
         </div>
       </div>
@@ -36,7 +29,7 @@
     <div class="bottom">
       <template v-if="showSendBtn">
         <div class="btn send-btn" v-if="enableRecharge == 1" @click="showSendGiveawayDialog(currencyInfo)">
-          <img :src="require('@/assets/svg/icon-send-giveaway.svg')" /> 
+          <img :src="require('@/assets/svg/icon-send-giveaway.svg')" />
           Send Giveaway
         </div>
         <div class="btn-wrapper">
@@ -51,23 +44,15 @@
     </div>
 
     <template v-if="showCurrencySelect">
-        <div class="selectDiv">
-            <currency-select 
-                ref="currencySelectDom"
-                :list="currenciesData"
-                @selectCurrency="selectCurrency">
-            </currency-select>
-        </div>
-        <div class="selectBg" @click="showCurrencySelect = false"></div>
+      <div class="selectDiv">
+        <currency-select ref="currencySelectDom" :list="currenciesData" @selectCurrency="selectCurrency">
+        </currency-select>
+      </div>
+      <div class="selectBg" @click="showCurrencySelect = false"></div>
     </template>
-    <input-action-sheet 
-      :visible="showDepositInput"
-      title="Enter the USD amount to be deposited"
-      :desc="depositDesc"
-      position="absolute"
-      @onInput="onDepositAmountInput"
-      @cancel="cancelDeposit"
-      @confirm="confirmDeposit"></input-action-sheet>
+    <input-action-sheet :visible="showDepositInput" title="Enter the USD amount to be deposited" :desc="depositDesc"
+      position="absolute" @onInput="onDepositAmountInput" @cancel="cancelDeposit" @confirm="confirmDeposit">
+    </input-action-sheet>
   </div>
 </template>
 
@@ -78,7 +63,7 @@ import Report from "@/log-center/log";
 import { getStorage } from "@/uilts/help";
 
 import { getCurrencyInfoBySymbol, syncChainTokenRechargeRecord } from "@/http/publishApi";
-import {setChromeStorage} from "@/uilts/chromeExtension"
+import { setChromeStorage, chromeExtensionUrl } from "@/uilts/chromeExtension"
 
 import VHead from '@/view/popup/components/head.vue'
 import currencySelect from "@/view/components/currency-select.vue";
@@ -109,42 +94,42 @@ let finalAmountData = ref({});
 
 
 const selectCurrency = (params) => {
-    showCurrencySelect.value = false;
-    let {enableRecharge, enableWithdraw} = params;
+  showCurrencySelect.value = false;
+  let { enableRecharge, enableWithdraw } = params;
 
-    if(currencyOpertionType == 'WITHDRAW') {
-      if(enableWithdraw != 1) {
-        return;
-      }
-      withdrawHandle(params);
-    } else if(currencyOpertionType == 'DEPOSIT') {
-      if(enableRecharge != 1) {
-        return;
-      }
-      depositHandle(params);
-    } else if(currencyOpertionType == 'SEND') {
-      if(enableRecharge != 1) {
-        return;
-      }
-      showSendGiveawayDialog(params);
+  if (currencyOpertionType == 'WITHDRAW') {
+    if (enableWithdraw != 1) {
+      return;
     }
+    withdrawHandle(params);
+  } else if (currencyOpertionType == 'DEPOSIT') {
+    if (enableRecharge != 1) {
+      return;
+    }
+    depositHandle(params);
+  } else if (currencyOpertionType == 'SEND') {
+    if (enableRecharge != 1) {
+      return;
+    }
+    showSendGiveawayDialog(params);
+  }
 }
 
 let withdraw_info = inject('withdraw_info')
 // 点击提现
 const clickWithdraw = () => {
-    Report.reportLog({
-        pageSource: Report.pageSource.denetHomePage,
-        businessType: Report.businessType.buttonClick,
-        objectType: Report.objectType.withdrawButton
-    });
+  Report.reportLog({
+    pageSource: Report.pageSource.denetHomePage,
+    businessType: Report.businessType.buttonClick,
+    objectType: Report.objectType.withdrawButton
+  });
 
-    if(currenciesData.value.length > 1) {
-      showCurrencySelect.value = true;
-      currencyOpertionType = "WITHDRAW";
-    } else if(currenciesData.value.length == 1){
-      withdrawHandle(currenciesData.value[0]);
-    }
+  if (currenciesData.value.length > 1) {
+    showCurrencySelect.value = true;
+    currencyOpertionType = "WITHDRAW";
+  } else if (currenciesData.value.length == 1) {
+    withdrawHandle(currenciesData.value[0]);
+  }
 }
 
 const withdrawHandle = (_params) => {
@@ -159,12 +144,12 @@ const withdrawHandle = (_params) => {
   withdraw_info.icon_net = require('@/assets/svg/icon-BNB.svg')
 
   if (_params.currencyCode == 'USD') {
-      withdraw_info.currency_code = _params.currencyCode
-      withdraw_info.paypal.amount_value = _params.balance
-      router.push('/withdraw/paypal')
+    withdraw_info.currency_code = _params.currencyCode
+    withdraw_info.paypal.amount_value = _params.balance
+    router.push('/withdraw/paypal')
   } else {
-      console.log(withdraw_info.chainInfo.iconPath)
-      router.push('/withdraw/info')
+    console.log(withdraw_info.chainInfo.iconPath)
+    router.push('/withdraw/info')
   }
 }
 
@@ -173,45 +158,45 @@ const withdrawHandle = (_params) => {
 let top_up_info = inject('top_up_info');
 
 const clickDeposit = () => {
-    Report.reportLog({
-        pageSource: Report.pageSource.denetHomePage,
-        businessType: Report.businessType.buttonClick,
-        objectType: Report.objectType.topupButton
-    });
+  Report.reportLog({
+    pageSource: Report.pageSource.denetHomePage,
+    businessType: Report.businessType.buttonClick,
+    objectType: Report.objectType.topupButton
+  });
 
-    if(currenciesData.value.length > 1) {
-      showCurrencySelect.value = true;
-      currencyOpertionType = "DEPOSIT";
-    } else if(currenciesData.value.length == 1){
-      let currencyInfo = currenciesData.value[0];
-      if(currencyInfo.currencyCode == 'USD') {
-        // 法币充值
-        showDepositInput.value = true;
-        setDepositDesc();
-          
-      } else {
-        depositHandle(currencyInfo);
-      }
+  if (currenciesData.value.length > 1) {
+    showCurrencySelect.value = true;
+    currencyOpertionType = "DEPOSIT";
+  } else if (currenciesData.value.length == 1) {
+    let currencyInfo = currenciesData.value[0];
+    if (currencyInfo.currencyCode == 'USD') {
+      // 法币充值
+      showDepositInput.value = true;
+      setDepositDesc();
+
+    } else {
+      depositHandle(currencyInfo);
     }
+  }
 }
 
 const setDepositDesc = async () => {
   let res = await payCalcFee({
-      params: {
-          amountValue: 0,
-          currencyCode: currencyInfo.value.currencyCode,
-          payChannel: 'ach',
-      },
+    params: {
+      amountValue: 0,
+      currencyCode: currencyInfo.value.currencyCode,
+      payChannel: 'ach',
+    },
   });
-  if(res.code == 0) {
-    let {feeDesc} = res.data;
+  if (res.code == 0) {
+    let { feeDesc } = res.data;
     depositDesc.value = `${feeDesc}`;
   }
 }
 
 const depositHandle = (_params) => {
   top_up_info.token = _params.currencyName || ''
-  top_up_info.token_chain = _params.tokenChain 
+  top_up_info.token_chain = _params.tokenChain
   top_up_info.token_symbol = _params.tokenSymbol || ''
   top_up_info.currency_code = _params.currencyCode
   top_up_info.icon_token = _params.iconPath || ''
@@ -219,21 +204,21 @@ const depositHandle = (_params) => {
   top_up_info.chainInfo = {
     ..._params.chainInfo
   };
-  
+
   router.push('/top-up/info');
 };
 
 
 const asyncTokenRechRecord = (currencyCode = '', cb) => {
-    syncChainTokenRechargeRecord({
-        params: {
-            currencyCode: currencyCode
-        }
-    }).then(res => {
-      cb && cb(res.data)
-    }).catch((err) => {
-      cb && cb()
-    })
+  syncChainTokenRechargeRecord({
+    params: {
+      currencyCode: currencyCode
+    }
+  }).then(res => {
+    cb && cb(res.data)
+  }).catch((err) => {
+    cb && cb()
+  })
 }
 
 const onRefresh = () => {
@@ -243,11 +228,11 @@ const onRefresh = () => {
         symbol: currencyInfo.value.tokenSymbol
       }
     }).then(res => {
-      if(res.code == 0) {
-        if(res.data && res.data.currencyCategories && res.data.currencyCategories.length) {
+      if (res.code == 0) {
+        if (res.data && res.data.currencyCategories && res.data.currencyCategories.length) {
           let data = res.data.currencyCategories[0].data;
-          if(data.length) {
-            let {totalBalance = '', totalUsdEstimateBalance = ''} = data[0] || {};
+          if (data.length) {
+            let { totalBalance = '', totalUsdEstimateBalance = '' } = data[0] || {};
             currencyInfo.value.totalBalance = totalBalance;
             currencyInfo.value.totalUsdEstimateBalance = totalUsdEstimateBalance;
           }
@@ -258,23 +243,23 @@ const onRefresh = () => {
 };
 
 const showSendGiveawayDialog = (params = {}) => {
-  if(currenciesData.value.length > 1 && currencyOpertionType != 'SEND') {
-      showCurrencySelect.value = true;
-      currencyOpertionType = "SEND";
+  if (currenciesData.value.length > 1 && currencyOpertionType != 'SEND') {
+    showCurrencySelect.value = true;
+    currencyOpertionType = "SEND";
   } else {
-      setLocalSelectCurrencyInfo(params)
-      setTimeout(() => {
-        chrome.runtime.sendMessage({ 
-          actionType: "POPUP_SHOW_DENET_PUBLISH_DIALOG", 
-          data: { } 
+    setLocalSelectCurrencyInfo(params)
+    setTimeout(() => {
+      chrome.runtime.sendMessage({
+        actionType: "POPUP_SHOW_DENET_PUBLISH_DIALOG",
+        data: {}
       });
-      }, 600)
-      currencyOpertionType = '';
+    }, 600)
+    currencyOpertionType = '';
   }
 };
 
 const setLocalSelectCurrencyInfo = (params = {}) => {
-    setChromeStorage({ selectCurrencyInfo : JSON.stringify(params)})    
+  setChromeStorage({ selectCurrencyInfo: JSON.stringify(params) })
 }
 
 const cancelDeposit = () => {
@@ -282,7 +267,7 @@ const cancelDeposit = () => {
 }
 
 const confirmDeposit = (params) => {
-  if(reqCalcIng) {
+  if (reqCalcIng) {
     return;
   }
 
@@ -290,16 +275,18 @@ const confirmDeposit = (params) => {
   depositDesc.value = '';
 
   let achPayInfo = {
-      amountValue: finalAmountData.value.finalAmountValue
+    amountValue: finalAmountData.value.finalAmountValue
   };
-  let guideUrl = chrome.runtime.getURL('/iframe/ach-cashier.html');
-  setChromeStorage({ achPayInfo : JSON.stringify(achPayInfo)});
+  let guideUrl = chromeExtensionUrl + ('iframe/ach-cashier.html');
+  setChromeStorage({ achPayInfo: JSON.stringify(achPayInfo) });
   let str = window.location.hash + '&refresh=true';
   let path = str.substring(1, str.length);
-  setChromeStorage({ achPayData : JSON.stringify({
-    form: 'popupPage',
-    path
-  })});
+  setChromeStorage({
+    achPayData: JSON.stringify({
+      form: 'popupPage',
+      path
+    })
+  });
 
   chrome.tabs.create({
     url: guideUrl
@@ -307,23 +294,23 @@ const confirmDeposit = (params) => {
 }
 
 const onDepositAmountInput = async (params = {}) => {
-  let {inputVal} = params;
+  let { inputVal } = params;
   reqCalcIng = true;
-  if(inputVal === '') {
+  if (inputVal === '') {
     inputVal = 0;
   }
   let res = await payCalcFee({
-      params: {
-          amountValue: inputVal,
-          currencyCode: currencyInfo.value.currencyCode,
-          payChannel: 'ach',
-      },
+    params: {
+      amountValue: inputVal,
+      currencyCode: currencyInfo.value.currencyCode,
+      payChannel: 'ach',
+    },
   });
   reqCalcIng = false;
-  if(res.code == 0) {
-    let {feeAmountValue, feeDesc} = res.data;
+  if (res.code == 0) {
+    let { feeAmountValue, feeDesc } = res.data;
     finalAmountData.value = res.data;
-    if(inputVal === 0) {
+    if (inputVal === 0) {
       depositDesc.value = `${feeDesc}`;
     } else {
       depositDesc.value = `Charge Fee:${feeAmountValue} USD(${feeDesc})`;
@@ -333,47 +320,47 @@ const onDepositAmountInput = async (params = {}) => {
 
 
 const onMessage = () => {
-    chrome.runtime.onMessage.addListener(msgListener)
+  chrome.runtime.onMessage.addListener(msgListener)
 }
 
 const msgListener = (req, sender, sendResponse) => {
-    switch (req.actionType) {
-        case 'CONTENT_POPUP_PAGE_SHOW':
-            let {refresh = false} = router.currentRoute.value.query;
-            if(refresh && currencyInfo.value.tokenSymbol) {
-              onRefresh();
-            }
-            break;
-    }
+  switch (req.actionType) {
+    case 'CONTENT_POPUP_PAGE_SHOW':
+      let { refresh = false } = router.currentRoute.value.query;
+      if (refresh && currencyInfo.value.tokenSymbol) {
+        onRefresh();
+      }
+      break;
+  }
 }
 
 onMounted(() => {
-    let {params = '{}'} = router.currentRoute.value.query;
-
-    let {currencies = [], totalBalance = 0, totalUsdEstimateBalance = 0} =  JSON.parse(params);
-
-    currenciesData.value = currencies;
-    if(currencies.length) {
-      currencyInfo.value = {
-        ...currencies[0],
-        totalBalance,
-        totalUsdEstimateBalance
-      };
-      if(currencies.length == 1) {
-        enableRecharge.value = currencyInfo.value.enableRecharge;
-        enableWithdraw.value = currencyInfo.value.enableWithdraw;
-      }
-    } 
-    if(window.location.pathname.indexOf('/home.html') > -1) {
-      showSendBtn.value = false;
-    } else {
-      showSendBtn.value = true;
+  let { params = '{}' } = router.currentRoute.value.query;
+
+  let { currencies = [], totalBalance = 0, totalUsdEstimateBalance = 0 } = JSON.parse(params);
+
+  currenciesData.value = currencies;
+  if (currencies.length) {
+    currencyInfo.value = {
+      ...currencies[0],
+      totalBalance,
+      totalUsdEstimateBalance
+    };
+    if (currencies.length == 1) {
+      enableRecharge.value = currencyInfo.value.enableRecharge;
+      enableWithdraw.value = currencyInfo.value.enableWithdraw;
     }
-    onMessage();
+  }
+  if (window.location.pathname.indexOf('/home.html') > -1) {
+    showSendBtn.value = false;
+  } else {
+    showSendBtn.value = true;
+  }
+  onMessage();
 })
 
 onBeforeUnmount(() => {
-    chrome.runtime.onMessage.removeListener(msgListener);
+  chrome.runtime.onMessage.removeListener(msgListener);
 })
 
 </script>
@@ -406,6 +393,7 @@ onBeforeUnmount(() => {
       justify-content: center;
       flex-direction: column;
       width: 100%;
+
       .balance {
         padding: 0 18px;
         box-sizing: border-box;
@@ -415,7 +403,7 @@ onBeforeUnmount(() => {
         align-items: center;
         justify-content: center;
 
-        .symbol{
+        .symbol {
           word-break: break-all;
         }
       }
@@ -433,6 +421,7 @@ onBeforeUnmount(() => {
       }
     }
   }
+
   .bottom {
     height: 162px;
     padding: 0 20px;
@@ -469,6 +458,7 @@ onBeforeUnmount(() => {
       margin-bottom: 18px;
       background: #1d9bf0;
       color: #fff;
+
       img {
         width: 19px;
         height: 19px;
@@ -505,25 +495,26 @@ onBeforeUnmount(() => {
 
 
   .selectDiv {
-      position: absolute;
-      z-index: 1000;
-      width: 100%;
-      max-height: 480px;
-      padding-bottom: 30px;
-      left: 0;
-      bottom: 0;
-      background-color: #fff;
-      border-radius: 20px 20px 0 0;
-      overflow-y: auto;
+    position: absolute;
+    z-index: 1000;
+    width: 100%;
+    max-height: 480px;
+    padding-bottom: 30px;
+    left: 0;
+    bottom: 0;
+    background-color: #fff;
+    border-radius: 20px 20px 0 0;
+    overflow-y: auto;
   }
+
   .selectBg {
-      position: absolute;
-      z-index: 999;
-      top: 0;
-      left: 0;
-      width: 100%;
-      height: 100%;
-      background: rgba($color: #000000, $alpha: 0.6);
+    position: absolute;
+    z-index: 999;
+    top: 0;
+    left: 0;
+    width: 100%;
+    height: 100%;
+    background: rgba($color: #000000, $alpha: 0.6);
   }
 }
 </style>