wenliming 2 yıl önce
ebeveyn
işleme
f872804f47

+ 11 - 3
src/logic/background/twitter.js

@@ -499,9 +499,17 @@ export const checkShowPublishDialog = (params) => {
     chrome.tabs.query({
         active: true,
     }, (tabs) => {
-        if(tabs && tabs.length == 1) {
-            if(tabs[0].url.startsWith(twitterUrl)) {
-                chrome.tabs.sendMessage(tabs[0].id, { 
+        console.log(tabs, 'tabs')
+        if(tabs && tabs.length) {
+            let tab = null;
+            for (let i in tabs) {
+                if (tabs[i].url.startsWith(twitterUrl)) {
+                    tab = tabs[i];
+                    break
+                }
+            }
+            if(tab) {
+                chrome.tabs.sendMessage(tab.id, { 
                     actionType: 'BG_SHOW_DENET_PUBLISH_DIALOG', 
                     data: {} 
                 }, (res) => { console.log(res) });

+ 20 - 5
src/view/popup/currency-detail.vue

@@ -73,6 +73,7 @@ import Report from "@/log-center/log";
 import { getStorage } from "@/uilts/help";
 
 import { getCurrencyInfoBySymbol } from "@/http/publishApi";
+import {setChromeStorage} from "@/uilts/chromeExtension"
 
 import VHead from '@/view/popup/components/head.vue'
 import currencySelect from "@/view/components/currency-select.vue";
@@ -97,6 +98,8 @@ const selectCurrency = (params) => {
       withdrawHandle(params);
     } else if(currencyOpertionType == 'DEPOSIT') {
       depositHandle(params);
+    } else if(currencyOpertionType == 'SEND') {
+      showSendGiveawayDialog(params);
     }
 }
 
@@ -188,13 +191,25 @@ const onRefresh = () => {
   })
 };
 
-const showSendGiveawayDialog = () => {
-  chrome.runtime.sendMessage({ 
-      actionType: "POPUP_SHOW_DENET_PUBLISH_DIALOG", 
-      data: { } 
-  }, () => { });
+const showSendGiveawayDialog = (params = null) => {
+  if(currenciesData.value.length > 1 && currencyOpertionType != 'SEND') {
+      showCurrencySelect.value = true;
+      currencyOpertionType = "SEND";
+  } else {
+      let currencyInfo = params ? params : currencyInfo.value;
+      setLocalSelectCurrencyInfo(currencyInfo)
+      chrome.runtime.sendMessage({ 
+          actionType: "POPUP_SHOW_DENET_PUBLISH_DIALOG", 
+          data: { } 
+      }, () => { });
+      currencyOpertionType = '';
+  }
 };
 
+const setLocalSelectCurrencyInfo = (params = {}) => {
+    setChromeStorage({ selectCurrencyInfo : JSON.stringify(params)})    
+}
+
 onMounted(() => {
     let {params = '{}'} = router.currentRoute.value.query;