Browse Source

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

zhangwei 2 years ago
parent
commit
9435b48974

+ 8 - 0
src/http/toolBoxApi.js

@@ -22,4 +22,12 @@ export function screenshotWebsite(params) {
         method: 'post',
         data: params
     })
+}
+
+export function checkInputUrlInBlacklist(params) {
+    return service({
+        url: `/post/editor/checkInputUrlInBlacklist`,
+        method: 'post',
+        data: params
+    })
 }

+ 6 - 0
src/iframe/tool-box-guide.js

@@ -1,7 +1,13 @@
 import { createApp } from 'vue'
 import App from '@/view/iframe/publish/tool-box/child/guide.vue'
 
+import "ant-design-vue/dist/antd.css"; // or 'ant-design-vue/dist/antd.less'
+
+import {message} from "ant-design-vue";
+
 const app = createApp(App);
+
+app.use(message);
 app.mount('#app');
 
 window.onload= () => {

+ 14 - 12
src/logic/background/denet.js

@@ -1,18 +1,20 @@
 import { getChromeStorage } from '@/uilts/chromeExtension.js'
+import { payAchNoticeUrl } from '@/http/configAPI'
 
 export const closeAchPayNoticeHandler = async () => {
-    let {id} = await getCurrentTab();
-
-    chrome.tabs.remove(
-        id, () => {
-            getChromeStorage('achPayInfo', (res) => {
-                chrome.storage.local.remove("achPayInfo");
-                if(res && res.tab) {
-                    chrome.tabs.highlight({ windowId: res.tab.windowId, tabs: res.tab.index })
-                }
-            })
-        }
-    )
+    let res = await getCurrentTab();
+    if(res.url.startsWith(payAchNoticeUrl)) {
+        chrome.tabs.remove(
+            res.id, () => {
+                getChromeStorage('achPayInfo', (res) => {
+                    chrome.storage.local.remove("achPayInfo");
+                    if(res && res.tab) {
+                        chrome.tabs.highlight({ windowId: res.tab.windowId, tabs: res.tab.index })
+                    }
+                })
+            }
+        )
+    }
 }
 
 const getCurrentTab = async () => {

+ 1 - 1
src/view/components/input-action-sheet.vue

@@ -166,7 +166,7 @@ const confirm = () => {
             font-weight: 500;
             font-size: 13px;
             color: #888888;
-            height: 40px;
+            min-height: 40px;
         }
         .btn-wrapper {
             display: flex;

+ 4 - 4
src/view/components/popup-withdraw.vue

@@ -213,7 +213,7 @@ const withdraw = () => {
     }
     params.withdrawReceiveAccount = params.withdrawReceiveAccount.replace(/\s*/g, "");
     params.amountValue = params.amountValue;
-    if (parseInt(params.amountValue) > parseInt(canWithdrawBalance.value)) {
+    if (+params.amountValue > +canWithdrawBalance.value) {
         return;
     }
     withdrawIng.value = true;
@@ -259,7 +259,7 @@ const onAmountInput = () => {
     setWithdrawIptStatus(value);
 
     // 输入金额大于可提现金额
-    if (parseInt(value) > parseInt(canWithdrawBalance.value)) {
+    if (+value > +canWithdrawBalance.value) {
         if (!showWithdrawError.value) {
             showWithdrawIptError.value = true;
         }
@@ -275,8 +275,8 @@ const onAmountInput = () => {
 const setWithdrawIptStatus = (amount) => {
     //显示tips
     if (
-        amount > 0 &&
-        amount < walletWithdrawConfig.value.withdrawPerMinAmount
+        +amount > 0 &&
+        +amount < +walletWithdrawConfig.value.withdrawPerMinAmount
     ) {
         showWithdrawError.value = true;
     } else {

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

@@ -7,7 +7,7 @@
                 v-show="currentCurrencyInfo.currencyCode == 'USD'">
                 <div class="token-pay" 
                     @click="clickPayUSD">
-                    Pay {{finalAmountData.rechargeAmountValue > 0 && USDepositStatus != 'SUCCESS' ? finalAmountData.rechargeAmountValue : finalAmountData.orderAmountValue}} {{currentCurrencyInfo.tokenSymbol}}
+                    Pay ${{finalAmountData.rechargeAmountValue > 0 && USDepositStatus != 'SUCCESS' ? finalAmountData.rechargeAmountValue : finalAmountData.orderAmountValue}}
                 </div>
 
                 <!-- <iframe
@@ -113,7 +113,7 @@ const balancePay = () => {
 }
 
 const clickPayUSD = () => {
-    if(props.finalAmountData.rechargeAmountValue > 0) {
+    if(props.finalAmountData.rechargeAmountValue > 0 && props.USDepositStatus != 'SUCCESS') {
         setTimeout(() => {
             emits("showDepositMask", {});
         }, 1000)

+ 55 - 10
src/view/iframe/publish/give-dialog.vue

@@ -316,11 +316,19 @@
                                 @showDepositMask="showDepositMessageBox = true"
                                 @payFinish="payFinish">
                                 <template v-slot:balance>
-                                    <div class="balance" v-if="Number(baseFormData.amountValue) <= Number(currentCurrencyInfo.balance)">
+                                    <div class="balance" v-if="Number(baseFormData.amountValue) <= Number(currentCurrencyInfo.balance) || currentCurrencyInfo.currencyCode == 'USD' ">
                                         <img class="icon" src="@/assets/subject/icon-balance.png" />
                                         <div class="con">
                                             <div class="desc">Balance</div>
-                                            <div class="price">{{currentCurrencyInfo.balance}} {{currentCurrencyInfo.tokenSymbol}}</div>
+                                            <div class="price">
+                                                <template v-if="currentCurrencyInfo.currencyCode == 'USD'">
+                                                    $
+                                                </template>
+                                                {{currentCurrencyInfo.balance}} 
+                                                <template v-if="currentCurrencyInfo.currencyCode != 'USD'">
+                                                    {{currentCurrencyInfo.tokenSymbol}}
+                                                </template>
+                                            </div>
                                         </div>
                                         <img class="refresh"
                                             :class="{ 'icon-refresh-rotate': refreshRotate }"
@@ -721,6 +729,7 @@ watch(
     () => props.dialogData,
     (newVal) => {
         visible.value = newVal.visible;
+        USDepositStatus.value = "DEFAULT"
 
         if (newVal.visible) {
             publishType.value = newVal.type;
@@ -750,6 +759,7 @@ watch(
 const emits = defineEmits(["close", "confirm", "postPublishFinish"]);
 
 const close = () => {
+    USDepositStatus.value = "DEFAULT"
     if(publishType.value == 'TOOL_BOX') {
         closeToolBoxPage()
     } else {
@@ -994,21 +1004,29 @@ const topUpDone = () => {
 /**
  * 更新货币余额
  */
-const updateCurrencyBanlce = () => {
+const updateCurrencyBanlce = async () => {
     if(!refreshRotate.value) {
         refreshRotate.value = true;
         setTimeout(() => {
             refreshRotate.value = false;
         }, 1000)
     }
-    asyncTokenRechRecord((res) => {
-        if(res.code == 0 && res.data && res.data.length) {
-            let currencyInfo = res.data[0];
-            if(currencyInfo.currencyCode == currentCurrencyInfo.value.currencyCode) {
-                currentCurrencyInfo.value.balance = currencyInfo.balance;
-            }
+    if(currentCurrencyInfo.value.currencyCode == 'USD') {
+        let currencyInfoRes = await getCurrencyByCode({currencyCode: currentCurrencyInfo.value.currencyCode});
+
+        if(currencyInfoRes.code == 0 && currencyInfoRes.data) {
+            currentCurrencyInfo.value = currencyInfoRes.data;
         }
-    })
+    } else {
+        asyncTokenRechRecord((res) => {
+            if(res.code == 0 && res.data && res.data.length) {
+                let currencyInfo = res.data[0];
+                if(currencyInfo.currencyCode == currentCurrencyInfo.value.currencyCode) {
+                    currentCurrencyInfo.value.balance = currencyInfo.balance;
+                }
+            }
+        })
+    }
 }
 
 /**
@@ -1851,6 +1869,21 @@ const submitReward = (reward) => {
     onIptSetErrorTxt();
 }
 
+const updateUSDeposit = async () => {
+    if(showDepositMessageBox.value) {
+        let currencyInfoRes = await getCurrencyByCode({currencyCode: currentCurrencyInfo.value.currencyCode});
+
+        if(currencyInfoRes.code == 0 && currencyInfoRes.data) {
+            currentCurrencyInfo.value = currencyInfoRes.data;
+            let {balance} = currencyInfoRes.data;
+            if(balance >= finalAmountData.value.orderAmountValue) {
+                USDepositStatus.value = 'SUCCESS';
+            }
+        }
+    }
+};
+
+
 const depositAchCancel = async () => {
     showDepositMessageBox.value = false;
     let currencyInfoRes = await getCurrencyByCode({currencyCode: currentCurrencyInfo.value.currencyCode});
@@ -1864,6 +1897,7 @@ const depositAchCancel = async () => {
     }
 }
 
+
 const depositAchConfirm = async () => {
     let currencyInfoRes = await getCurrencyByCode({currencyCode: currentCurrencyInfo.value.currencyCode});
 
@@ -1874,16 +1908,27 @@ const depositAchConfirm = async () => {
         let {balance} = currencyInfoRes.data;
         if(balance >= finalAmountData.value.orderAmountValue) {
             USDepositStatus.value = 'SUCCESS';
+            payButtonDom.value && payButtonDom.value.balancePay();
         } else {
             message.info('Deposit failed, please try again later');
         }
     }
 }
 
+const onPageVisbile = () => {
+    document.addEventListener('visibilitychange', function () {
+        let isHidden = document.hidden;
+        if (!isHidden) {
+            updateUSDeposit();
+        }
+    });
+}
+
 onMounted(() => {
     setFrontConfig();
     setPayConfig();
     getLocalCurrencyInfoByCode();
+    onPageVisbile();
     window.addEventListener('resize', function () {
         setDialogStyle(true);
     })

+ 18 - 1
src/view/iframe/publish/tool-box/child/editor.vue

@@ -53,7 +53,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 { convertUrl, getAllPostEditorAppData, checkInputUrlInBlacklist } from "@/http/toolBoxApi";
 import { setChromeStorage, getChromeStorage } from "@/uilts/chromeExtension"
 import { checkURL, debounce } from "@/uilts/help"
 
@@ -98,6 +98,23 @@ const searchHandler = async (_params) => {
     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;
+      }
+    }
+  }
+
   let siteRes = await axios.get(siteUrl.value);
 
   let currentApp = {

+ 17 - 0
src/view/iframe/publish/tool-box/child/guide.vue

@@ -28,6 +28,9 @@
 import { ref, reactive, onMounted } from "vue";
 import { checkURL } from "@/uilts/help"
 import { setChromeStorage, getChromeStorage } from "@/uilts/chromeExtension"
+import { message } from "ant-design-vue";
+
+import { checkInputUrlInBlacklist } from "@/http/toolBoxApi";
 
 let siteUrl = ref('');
 
@@ -40,9 +43,23 @@ const confirm = async () => {
     siteUrl.value = siteUrl.value.trim();
 
     if (!checkURL(siteUrl.value)) {
+        message.info('Incorrect URL entered');
         return;
     }
 
+    let blackListRes = await checkInputUrlInBlacklist({
+        params: {
+            url: siteUrl.value
+        }
+    })
+
+    if(blackListRes.code == 0) {
+        if(blackListRes.data) {
+            message.info('This site is not supported');
+            return;
+        }
+    }
+
     let {list: windowList = []} = await getChromeStorage('guideAppWindowList') || {list: []};
 
     chrome.runtime.sendMessage({

+ 24 - 2
src/view/popup/currency-detail.vue

@@ -186,6 +186,7 @@ const clickDeposit = () => {
       if(currencyInfo.currencyCode == 'USD') {
         // 法币充值
         showDepositInput.value = true;
+        setDepositDesc();
           
       } else {
         depositHandle(currencyInfo);
@@ -193,6 +194,20 @@ const clickDeposit = () => {
     }
 }
 
+const setDepositDesc = async () => {
+  let res = await payCalcFee({
+      params: {
+          amountValue: 0,
+          currencyCode: currencyInfo.value.currencyCode,
+          payChannel: 'ach',
+      },
+  });
+  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 
@@ -281,13 +296,16 @@ const confirmDeposit = (params) => {
   setChromeStorage({ achPayInfo : JSON.stringify(achPayInfo)});
 
   chrome.tabs.create({
-      url: guideUrl
+    url: guideUrl
   });
 }
 
 const onDepositAmountInput = async (params = {}) => {
   let {inputVal} = params;
   reqCalcIng = true;
+  if(inputVal === '') {
+    inputVal = 0;
+  }
   let res = await payCalcFee({
       params: {
           amountValue: inputVal,
@@ -299,7 +317,11 @@ const onDepositAmountInput = async (params = {}) => {
   if(res.code == 0) {
     let {feeAmountValue, feeDesc} = res.data;
     finalAmountData.value = res.data;
-    depositDesc.value = `Charge Fee:${feeAmountValue} USD(${feeDesc})`;
+    if(inputVal === 0) {
+      depositDesc.value = `${feeDesc}`;
+    } else {
+      depositDesc.value = `Charge Fee:${feeAmountValue} USD(${feeDesc})`;
+    }
   }
 }