Przeglądaj źródła

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

zhangwei 2 lat temu
rodzic
commit
a8d39672d7

+ 0 - 2
src/view/iframe/publish/give-dialog.vue

@@ -432,9 +432,7 @@ let tempCurrentCurrencyInfo = ref({});
 let tempCurrentCurrencyList = ref([]);
 
 let payConfig = ref({});
-let installStatus = ref(false);
 let timer = ref(null);
-provide('installStatus', installStatus)
 
 // 发布后返回的结果
 let publishRes = reactive({});

+ 22 - 35
src/view/iframe/publish/tool-box/child/editor.vue

@@ -54,7 +54,7 @@ import { ref, defineProps, defineEmits, onMounted } from "vue";
 import axios from 'axios';
 import { message } from "ant-design-vue";
 import { convertUrl, getAllPostEditorAppData } from "@/http/toolBoxApi";
-import { getChromeStorage } from "@/uilts/chromeExtension"
+import { setChromeStorage, getChromeStorage } from "@/uilts/chromeExtension"
 import { checkURL, debounce } from "@/uilts/help"
 
 const props = defineProps({
@@ -68,7 +68,6 @@ const props = defineProps({
 let siteUrl = ref('');
 
 let selectAppGuideData = {};
-let selectGuideApp = {};
 let openWindowList = [];
 
 let historyList = ref([])
@@ -137,7 +136,7 @@ const searchHandler = async (_params) => {
   }
   
   let convertRes = await convertUrl({ params: { originUrl: siteUrl.value } });
-  let params = { convertUrl: siteUrl.value, originUrl: siteUrl.value, appId: '', currentApp };
+  let params = { convertUrl: siteUrl.value, originUrl: siteUrl.value, appId: currentApp.appId, linkImagePath: currentApp.linkImagePath, currentApp };
 
   loadingHide();
   clearTimeout(timer);
@@ -203,32 +202,30 @@ const openWindow = (params) => {
 const createGuideWindow = (params, isUpdate = false) => {
   openWindowList = [];
   selectAppGuideData = {};
-  selectGuideApp = {};
 
   let windowWith = window.screen.width - 500;
   let guideUrl = chrome.runtime.getURL('/iframe/tool-box-guide.html');
 
-  chrome.windows.create({
-    width: windowWith,
-    type: 'normal',
-    url: params.defaultUrl,
-    state: 'normal'
-  }, function (window) {
-    openWindowList.push(window);
-  })
-  chrome.windows.create({
-    width: 500,
-    type: 'popup',
-    url: guideUrl,
-    left: windowWith,
-    state: 'normal'
-  }, function (window) {
-    openWindowList.push(window);
-  })
-  selectGuideApp = params;
-  if (params.guideData) {
-    selectAppGuideData = JSON.parse(params.guideData);
-  }
+  setChromeStorage({ selectGuideApp : JSON.stringify(params)}, async () => {
+    let window1 = await chrome.windows.create({
+      width: windowWith,
+      type: 'normal',
+      url: params.defaultUrl,
+      state: 'normal'
+    })
+    openWindowList.push(window1);
+
+    let window2 = await chrome.windows.create({
+      width: 500,
+      type: 'popup',
+      url: guideUrl,
+      left: windowWith,
+      state: 'normal'
+    })
+    openWindowList.push(window2);
+
+    setChromeStorage({ guideAppWindowList: JSON.stringify({list: openWindowList})});
+  })  
 }
 
 const getAppList = () => {
@@ -244,16 +241,6 @@ const onRuntimeMsg = () => {
   chrome.runtime.onMessage.addListener((req, sender, sendResponse) => {
 
     switch (req.actionType) {
-      case 'CONTENT_GET_GUIDE_DATA':
-        chrome.runtime.sendMessage({
-          actionType: "CONTENT_EDIT_SEND_GUIDE_DATA",
-          data: {
-            guideData: selectAppGuideData,
-            windowData: openWindowList,
-            selectGuideApp
-          }
-        }, (response) => { });
-        break;
       case 'CONTENT_GUIDE_APPLY_APP':
         siteUrl.value = req.data.siteUrl;
         searchHandler(req.data.selectGuideApp);

+ 19 - 23
src/view/iframe/publish/tool-box/child/guide.vue

@@ -27,22 +27,24 @@
 <script setup>
 import { ref, reactive, onMounted } from "vue";
 import { checkURL } from "@/uilts/help"
+import { setChromeStorage, getChromeStorage } from "@/uilts/chromeExtension"
 
 let siteUrl = ref('');
 
 let pageData = reactive({
-    guideType: '',
     guideData: [],
     selectGuideApp: {}
 });
 
-const confirm = () => {
+const confirm = async () => {
     siteUrl.value = siteUrl.value.trim();
 
     if (!checkURL(siteUrl.value)) {
         return;
     }
 
+    let {list: windowList = []} = await getChromeStorage('guideAppWindowList') || {list: []};
+
     chrome.runtime.sendMessage({
         actionType: "CONTENT_GUIDE_APPLY_APP",
         data: {
@@ -52,41 +54,35 @@ const confirm = () => {
     }, (response) => { });
 
     setTimeout(() => {
-        if(pageData.windowData) {
-            for (let i = 0; i < pageData.windowData.length; i++) {
-                let item = pageData.windowData[i];
+        if(windowList && windowList.length) {
+            for (let i = 0; i < windowList.length; i++) {
+                let item = windowList[i];
                 chrome.windows.remove(
                     item.id,
                     function () { }
                 )
             };
+            chrome.storage.local.remove("selectGuideApp");
+            chrome.storage.local.remove("guideAppWindowList");
         }
     }, 600)
 };
 
-const onRuntimeMsg = () => {
-    chrome.runtime.onMessage.addListener((req, sender, sendResponse) => {
+const setPageData = async () => {
+    let selectGuideApp = await getChromeStorage('selectGuideApp') || {};
+    pageData.selectGuideApp = selectGuideApp;
 
-        switch (req.actionType) {
-            case 'CONTENT_EDIT_SEND_GUIDE_DATA':
-                let { guideData, windowData, selectGuideApp } = req.data;
-                pageData.guideData = guideData;
-                pageData.windowData = windowData;
-                pageData.selectGuideApp = selectGuideApp;
-                break;
+    if(selectGuideApp.guideData) {
+        if(typeof selectGuideApp.guideData == 'string') {
+            pageData.guideData = JSON.parse(selectGuideApp.guideData);
+        } else {
+            pageData.guideData = selectGuideApp.guideData
         }
-    })
+    };
 }
 
 onMounted(() => {
-    setTimeout(() => {
-        chrome.runtime.sendMessage({
-            actionType: "CONTENT_GET_GUIDE_DATA",
-            data: {}
-        }, (response) => { });
-    }, 600)
-
-    onRuntimeMsg();
+    setPageData();
 })
 
 </script>

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

@@ -279,9 +279,9 @@ onMounted(() => {
             getUserName(res.nickName);
         }
         clearInterval(timer.value);
-        // timer.value = setInterval(() => {
-        // installStatus.value = !installStatus.value;
-        // }, 3000)
+        timer.value = setInterval(() => {
+            installStatus.value = !installStatus.value;
+        }, 3000)
     });
     window.addEventListener('resize', function () {
         calcPreviewCanvasParams();

+ 23 - 11
src/view/popup/currency-detail.vue

@@ -14,7 +14,7 @@
         :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> 
@@ -22,7 +22,7 @@
             &nbsp;&nbsp;
           </template>
           <span class="symbol">
-             {{currencyInfo.tokenSymbol}}
+            {{currencyInfo.tokenSymbol}}
           </span>
         </div>
         <div class="final">
@@ -34,18 +34,18 @@
     </div>
     <div class="bottom">
       <template v-if="showSendBtn">
-        <div class="btn send-btn" v-if="showUSDepositBtn" @click="showSendGiveawayDialog(currencyInfo)">
+        <div class="btn send-btn" v-if="enableRecharge == 1" @click="showSendGiveawayDialog(currencyInfo)">
           <img :src="require('@/assets/svg/icon-send-giveaway.svg')" /> 
           Send Giveaway
         </div>
         <div class="btn-wrapper">
-          <div class="button left" v-if="showUSDepositBtn" @click="clickDeposit">Deposit</div>
-          <div class="button" @click="clickWithdraw">Withdrawal</div>
+          <div class="button left" v-if="enableRecharge == 1" @click="clickDeposit">Deposit</div>
+          <div class="button" v-if="enableWithdraw == 1" @click="clickWithdraw">Withdrawal</div>
         </div>
       </template>
       <template v-else>
-        <div class="btn deposit-btn" v-if="showUSDepositBtn" @click="clickDeposit">Deposit</div>
-        <div class="btn withdrawal-btn" @click="clickWithdraw">Withdrawal</div>
+        <div class="btn deposit-btn" v-if="enableRecharge == 1" @click="clickDeposit">Deposit</div>
+        <div class="btn withdrawal-btn" v-if="enableWithdraw == 1" @click="clickWithdraw">Withdrawal</div>
       </template>
     </div>
 
@@ -93,7 +93,8 @@ let currencyOpertionType = '';
 
 let showSendBtn = ref(true);
 
-let showUSDepositBtn = ref(true);
+let enableRecharge = ref(1);
+let enableWithdraw = ref(1);
 
 let showDepositInput = ref(false);
 
@@ -101,11 +102,22 @@ let showDepositInput = ref(false);
 
 const selectCurrency = (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);
     }
 }
@@ -278,9 +290,9 @@ onMounted(() => {
         totalBalance,
         totalUsdEstimateBalance
       };
-      if(currencyInfo.value.currencyCode == 'USD') {
-        //set USD deposit btn show status
-        
+      if(currencies.length == 1) {
+        enableRecharge.value = currencyInfo.value.enableRecharge;
+        enableWithdraw.value = currencyInfo.value.enableWithdraw;
       }
     } 
     if(window.location.pathname.indexOf('/home.html') > -1) {