Bladeren bron

Merge branch 'dev_1.1.5-1' into dev_1.1.5.2

zhangwei 2 jaren geleden
bovenliggende
commit
3aa81bbe2b

BIN
src/assets/img/back-loading.png


+ 3 - 3
src/logic/content/ParseCard.js

@@ -245,7 +245,7 @@ class ParseCard {
         }
         _iframe.src = _iframe_url
         _iframe.scrolling = 'no'
-        _iframe.style.cssText = 'border:medium none; width:505px; height:544px; max-height:544px;     filter: drop-shadow(rgba(0, 0, 0, 0.2) 0px 4px 20px);'
+        _iframe.style.cssText = 'border:medium none; width:505px; height:545px; max-height:545px;     filter: drop-shadow(rgba(0, 0, 0, 0.2) 0px 4px 20px);'
         return _iframe
     }
     createIframe({ post_Id = '', tweet_Id = '', tweet_author = '', page_type = '' }, if_center = false) {
@@ -355,7 +355,7 @@ class ParseCard {
         div.id = 'denet-' + tweet_Id
         div.style.cssText = `
         width: 505px;
-        height: 544px;`
+        height: 545px;`
         div.dataset.tweetId = tweet_Id || ''
         div.dataset.postId = post_Id || ''
         parentElement.appendChild(div)
@@ -418,7 +418,7 @@ class ParseCard {
             dom = dom_card.querySelector('div[lang][dir=auto]').parentElement
         }
 
-        dom.style = 'min-height:544px'
+        dom.style = 'min-height:545px'
         if (dom) {
             // debugger mode
             if (window.location.href.includes('denet_debugger')) {

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

@@ -11,7 +11,7 @@ export const toolBox = new class ToolBox {
         iframe.id = 'denet-tool-box-fixed'
         iframe.style.cssText = `
             width: 505px;
-            height: 544px;
+            height: 545px;
             position: fixed;
             right: 10px;
             top: 10px;
@@ -42,7 +42,7 @@ export const toolBox = new class ToolBox {
                 dom_fixed.style.cssText = `
                     display:block;
                     width: 505px;
-                    height: 544px;
+                    height: 545px;
                     position: fixed;
                     right: 10px;
                     top: 10px;

+ 13 - 12
src/logic/content/twitter.js

@@ -111,9 +111,7 @@ export function showTwitterPublishDialogHandler(publishRes) {
 
     setChromeStorage({ publishData: JSON.stringify(publishRes) })
 
-    addPublishTipsIframe({
-        srcContent: publishRes.copyContent
-    })
+    addPublishTipsIframe()
     // _setPublishContent(publishRes.srcContent);
     setDialogPublishContent(publishRes.srcContent);
     _publishTweetEvent(publishRes, bindTwitterArtMethod);
@@ -288,7 +286,8 @@ function _addDeNetEditBtn(params = {}) {
             });
             let innerDeIcon = document.getElementById('de-btn1');
             if (!innerDeIcon) {
-                toolElem.firstChild.appendChild(createTweetToolbarDenet())
+                toolElem.firstChild.appendChild(createTweetToolbarDenet());
+                popupShowGiveawayDialog();
             }
 
             let innerToolBoxIcon = document.getElementById('de-tool-box-btn-01');
@@ -306,7 +305,8 @@ function _addDeNetEditBtn(params = {}) {
                     });
                     let innerDeIcon = document.getElementById('de-btn1');
                     if (!innerDeIcon) {
-                        toolElem.firstChild.appendChild(createTweetToolbarDenet())
+                        toolElem.firstChild.appendChild(createTweetToolbarDenet());
+                        popupShowGiveawayDialog();
                     }
 
                     let innerToolBoxIcon = document.getElementById('de-tool-box-btn-01');
@@ -319,6 +319,13 @@ function _addDeNetEditBtn(params = {}) {
     })
 }
 
+const popupShowGiveawayDialog = async () => {
+    let { show = false } = await getChromeStorage('showGiveawayData') || {};
+    if (show) {
+        chrome.storage.local.remove("showGiveawayData");
+        showPublishDialog()
+    }
+}
 
 /**
  * 获取左侧twitter按钮
@@ -612,7 +619,7 @@ function createTweetToolbarToolBox() {
 
     return deToolBoxBtn;
 }
-async function addSliderNavDeBtn(isSmall = false) {
+function addSliderNavDeBtn(isSmall = false) {
     try {
         if (!isSmall) {
             let bigDom = document.querySelector('a[href="/compose/tweet"]').parentNode.parentNode;
@@ -640,12 +647,6 @@ async function addSliderNavDeBtn(isSmall = false) {
     } catch (e) {
         console.log(e)
     }
-
-    let { show = false } = await getChromeStorage('showGiveawayData') || {};
-    if (show) {
-        chrome.storage.local.remove("showGiveawayData");
-        showPublishDialog()
-    }
 }
 
 function onWindowResize() {

+ 8 - 1
src/types/global.js

@@ -34,5 +34,12 @@ export const TaskType = {
   twitterCommentAndTag: 9,
 };
 
+/**
+ * 帖子类型
+ */
 
-
+export const PostType = {
+  giveaway: 1,
+  nftGroup: 2,
+  postEditor: 3
+}

+ 29 - 6
src/view/components/input-action-sheet.vue

@@ -12,6 +12,9 @@
                     @input="onValueInput"
                     @blur="onValueBlur">
             </div>
+            <div class="desc">
+                {{desc}}
+            </div>
             <div class="btn-wrapper">
                 <div class="btn cancel" @click="cancel">
                     {{cancelText}}
@@ -25,7 +28,7 @@
 </template>
 
 <script setup>
-import { ref, defineProps, defineEmits } from "vue";
+import { ref, defineProps, defineEmits, watch } from "vue";
 
 let inputVal = ref('');
 
@@ -50,16 +53,28 @@ const props = defineProps({
         type: String,
         default: 'Continue',
     },
+    desc: {
+        type: String,
+        defautl: ''
+    }
 });
 
-const emits = defineEmits(["cancel", "confirm"]);
+watch(() => props.visible, (newVal) => {
+    if(!newVal) {
+        inputVal.value = ''
+    }
+})
+
+const emits = defineEmits(["cancel", "confirm", "onInput"]);
 
 const onValueInput = () => {
-    inputValHandler();
+    let val = inputValHandler();
+    emits("onInput", { inputVal: val });
+    return val;
 }
 
 const onValueBlur = () => {
-    inputValHandler();
+    return inputValHandler();
 }
 
 
@@ -79,6 +94,7 @@ const inputValHandler = () => {
     }
 
     inputVal.value = val;
+
     return val;
 }
 
@@ -127,7 +143,7 @@ const confirm = () => {
             border-radius: 5px;
             box-sizing: border-box;
             height: 42px;
-            margin: 17px 0 23px 0;
+            margin: 17px 0 10px 0;
 
             .input {
                 width: 100%;
@@ -145,10 +161,17 @@ const confirm = () => {
                 color: #B3B3B3;
             }
         }
-
+        
+        .desc {
+            font-weight: 500;
+            font-size: 13px;
+            color: #888888;
+            height: 40px;
+        }
         .btn-wrapper {
             display: flex;
             justify-content: space-between;
+            margin-top: 20px;
 
             .btn {
                 width: 150px;

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

@@ -33,8 +33,7 @@
                                 v-model="requestWithdrawParams.amountValue" 
                                 placeholder="$0"
                                 style="width: 220px"
-                                @input="onAmountInput" 
-                                @blur="onAmountBlur" />
+                                @input="onAmountInput"  />
                             <div @click="withdrawalAll" class="withdrawal-all-btn">
                                 Withdrawal All
                             </div>
@@ -188,12 +187,14 @@ const withdrawCalcAmount = () => {
         if (res.code == 0) {
             finalWithdrawalAmount.value = res.data.finalAmountValue;
         }
+    }).catch(err => {
+        calcReq.value = false;
     })
 }
 
 const withdrawCalcAmountDebounce = debounce(function () {
     withdrawCalcAmount();
-}, 1000)
+}, 300)
 
 /**
  * 提现
@@ -233,10 +234,9 @@ const withdraw = () => {
         } else {
             console.log(res);
         }
-    })
-        .catch((err) => {
-            console.log(err);
-        });
+    }).catch((err) => {
+        console.log(err);
+    });
 };
 
 const onAmountBlur = () => {

+ 1 - 1
src/view/content/tool-box/full.vue

@@ -77,7 +77,7 @@ const changeFull = () => {
 const changeFixed = () => {
     dom_fixed.style.cssText = `
     width: 505px;
-    height: 544px;
+    height: 545px;
     position: fixed;
     right: 10px;
     top: 10px;`

+ 1 - 1
src/view/content/tool-box/index.vue

@@ -226,7 +226,7 @@ const handleFixed = () => {
     dom.fixed.style.cssText = `
         display:block;
         width: 505px;
-        height: 544px;
+        height: 545px;
         position: fixed;
         right: 10px;
         top: 10px;`

+ 20 - 6
src/view/iframe/publish-tips/publish-tips.vue

@@ -7,8 +7,20 @@
                     Do not delete the
                 </div>
                 <div>
-                    <span>#DeNet </span>and<span> Giveaway link</span>
-                    otherwise the giveaway will not be available
+                    <span>#DeNet </span>and<span> 
+                    <template v-if="publishData.postType == PostType.giveaway">
+                        Giveaway
+                    </template>
+                    <template v-else-if="publishData.postType == PostType.postEditor">
+                        Tool Box
+                    </template> link</span>
+                    otherwise the 
+                    <template v-if="publishData.postType == PostType.giveaway">
+                        giveaway
+                    </template>
+                    <template v-else-if="publishData.postType == PostType.postEditor">
+                        Tool Box
+                    </template> will not be available
                 </div>
             </div>
             <div class="text-wrapper" v-show="type == 'NFT'">
@@ -26,16 +38,17 @@
 </template>
 
 <script setup>
-/* eslint-disable */
 import { onMounted, ref } from "vue";
 import { message } from 'ant-design-vue';
 import { getChromeStorage } from '@/uilts/chromeExtension.js'
 import { getQueryString } from '@/uilts/help.js';
+import { PostType } from '@/types';
 
 let ClipboardJS = require('clipboard');
 
 let strContent = ref('');
-let type = ref('Giveaway')
+let publishData = ref({});
+let type = ref('Giveaway');
 
 const copyToken = () => {
     var clipboard = new ClipboardJS('.copy-btn');
@@ -55,8 +68,9 @@ const copyToken = () => {
 }
 
 const setSrcContent = async () => {
-    let publishData = await getChromeStorage('publishData');
-    strContent.value = publishData.copyContent;
+    let data = await getChromeStorage('publishData');
+    strContent.value = data.copyContent;
+    publishData.value = data;
 }
 
 

+ 5 - 1
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 ? finalAmountData.rechargeAmountValue : finalAmountData.orderAmountValue}} {{currentCurrencyInfo.tokenSymbol}}
+                    Pay {{finalAmountData.rechargeAmountValue > 0 && USDepositStatus != 'SUCCESS' ? finalAmountData.rechargeAmountValue : finalAmountData.orderAmountValue}} {{currentCurrencyInfo.tokenSymbol}}
                 </div>
 
                 <!-- <iframe
@@ -60,6 +60,10 @@ const props = defineProps({
 
         }
     },
+    USDepositStatus: {
+        type: String,
+        default: 'DEFAULT'
+    }
 });
 
 let iframe = ref(null);

+ 15 - 24
src/view/iframe/publish/give-dialog.vue

@@ -312,6 +312,7 @@
                                     postId
                                 }"
                                 :currentCurrencyInfo="currentCurrencyInfo"
+                                :USDepositStatus = "USDepositStatus"
                                 @showDepositMask="showDepositMessageBox = true"
                                 @payFinish="payFinish">
                                 <template v-slot:balance>
@@ -448,6 +449,8 @@ let dialogStyle = reactive({
     dialogContentWidth: 1100
 })
 
+let USDepositStatus = ref('DEFAULT');
+
 let cropperOption = ref({
     img: '',
     full: true,
@@ -813,27 +816,6 @@ const selectCurrencyPopHandle = () => {
     }
 }
 
-/**
- * 获取实际支付金额
- */
-const getPayAmount = async (amountValue) => {
-    let res = await payCalcFee({
-        params: {
-            amountValue,
-            currencyCode: currentCurrencyInfo.value.currencyCode,
-            payChannel: 'ach',
-        },
-    });
-    if (res.code == 0) {
-        let { finalAmountValue, feeDesc } = res.data;
-        payConfig.value.feeDesc = feeDesc;
-        if (finalAmountValue > 0) {
-            finalAmountData.value = res.data;
-        }
-    }
-    return res.data;
-};
-
 const saveDiscordGuildInfo = () => {
     let {guildId, inviteCode, inviteUrl} = discordInviteInfo.value;
     //保存服务器信息 
@@ -1869,8 +1851,17 @@ const submitReward = (reward) => {
     onIptSetErrorTxt();
 }
 
-const depositAchCancel = () => {
+const depositAchCancel = async () => {
     showDepositMessageBox.value = false;
+    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 depositAchConfirm = async () => {
@@ -1881,8 +1872,8 @@ const depositAchConfirm = async () => {
         currentCurrencyInfo.value = currencyInfoRes.data;
 
         let {balance} = currencyInfoRes.data;
-        if(balance > finalAmountData.value.orderAmountValue) {
-            // payButtonDom.value && payButtonDom.value.balancePay();
+        if(balance >= finalAmountData.value.orderAmountValue) {
+            USDepositStatus.value = 'SUCCESS';
         } else {
             message.info('Deposit failed, please try again later');
         }

+ 15 - 12
src/view/iframe/tool-box/card.vue

@@ -11,12 +11,9 @@
             <iframe :src="iframe_url" frameborder="0"></iframe>
         </div>
         <div class="content" v-else>
-            <div ref="dom_area_iframe" v-show="state.status == 'iframe'" class="area-iframe">
-
-            </div>
-            <iframe src="https://www.twitter.com" ref="dom_iframe" frameborder="0" scrolling="yes"
-                allow="camera *;microphone *"></iframe>
-
+            <iframe :src="state.iframe_url" v-show="state.status == 'iframe'" ref="dom_iframe" frameborder="0"
+                scrolling="yes" allow="camera *;microphone *"></iframe>
+            <!-- sandbox="allow-same-origin allow-scripts allow-popups allow-top-navigation allow-forms allow-modals allow-popups-to-escape-sandbox" -->
             <!-- 网页错误 -->
             <div class="state" v-show="state.status == '网页错误'">
                 <img :src="state.cover_url" alt="" class="cover" />
@@ -81,7 +78,7 @@ let state = reactive({
     tweetId: '',
     detail: {},
     handle_type: '',
-    iframe_sandbox: ''
+    cover_url: require('@/assets/img/back-loading.png')
 })
 
 let dom = {}
@@ -136,6 +133,7 @@ onMounted(() => {
         if (res == state.tweetId) {
             state.status = '固定右上角'
         } else {
+            state.status = '加载'
             getDetail()
         }
     })
@@ -177,10 +175,11 @@ const getDetail = () => {
             state.detail = JSON.parse(res.data.postBizData)
             console.log('postBizData', state.detail)
             // 加载iframe
-            state.cover_url = state.detail.linkImagePath
-            // state.cover_url = 'https://www.keaidian.com/uploads/allimg/190424/24110307_8.jpg'  
-            state.status = '加载'
-            // createIframe()
+
+            if (state.detail.viewBgImagePath) {
+                state.cover_url = state.detail.viewBgImagePath
+            }
+            state.iframe_url = state.detail.convertUrl
         } else {
             state.status = '网页错误'
         }
@@ -407,12 +406,15 @@ const clickFull = () => {
             width: 100%;
             height: 100%;
 
-            iframe {
+            <<<<<<< HEAD iframe {
                 background: #fff;
                 width: 100%;
                 height: 100%;
                 border: medium none;
             }
+
+            =======border: medium none;
+            >>>>>>>dev_1.1.5-1
         }
 
 
@@ -428,6 +430,7 @@ const clickFull = () => {
 
             .cover {
                 width: 100%;
+                height: 100%;
                 background: #000000;
                 opacity: 0.6;
             }

+ 39 - 12
src/view/popup/currency-detail.vue

@@ -62,7 +62,9 @@
     <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>
@@ -81,6 +83,7 @@ import VHead from '@/view/popup/components/head.vue'
 import currencySelect from "@/view/components/currency-select.vue";
 import inputActionSheet from "@/view/components/input-action-sheet.vue";
 import { getBit } from "@/uilts/help";
+import { payCalcFee } from "@/http/pay";
 
 let currenciesData = ref([]);
 let currencyInfo = ref({
@@ -98,6 +101,10 @@ let enableWithdraw = ref(1);
 
 let showDepositInput = ref(false);
 
+let reqCalcIng = false;
+let depositDesc = ref('');
+let finalAmountData = ref({});
+
 
 
 const selectCurrency = (params) => {
@@ -260,21 +267,40 @@ const cancelDeposit = () => {
 }
 
 const confirmDeposit = (params) => {
-  let {inputVal} = params;
+  if(reqCalcIng) {
+    return;
+  }
+
   showDepositInput.value = false;
+  depositDesc.value = '';
 
-  // chrome.tabs.getCurrent(tab =>{
-  //   console.log(tab);
-      let achPayInfo = {
-          amountValue: inputVal
-      };
-      let guideUrl = chrome.runtime.getURL('/iframe/ach-cashier.html');
-      setChromeStorage({ achPayInfo : JSON.stringify(achPayInfo)});
+  let achPayInfo = {
+      amountValue: finalAmountData.value.finalAmountValue
+  };
+  let guideUrl = chrome.runtime.getURL('/iframe/ach-cashier.html');
+  setChromeStorage({ achPayInfo : JSON.stringify(achPayInfo)});
 
-      chrome.tabs.create({
-          url: guideUrl
-      });
-  // })
+  chrome.tabs.create({
+      url: guideUrl
+  });
+}
+
+const onDepositAmountInput = async (params = {}) => {
+  let {inputVal} = params;
+  reqCalcIng = true;
+  let res = await payCalcFee({
+      params: {
+          amountValue: inputVal,
+          currencyCode: currencyInfo.value.currencyCode,
+          payChannel: 'ach',
+      },
+  });
+  reqCalcIng = false;
+  if(res.code == 0) {
+    let {feeAmountValue, feeDesc} = res.data;
+    finalAmountData.value = res.data;
+    depositDesc.value = `Charge Fee:${feeAmountValue} USD(${feeDesc})`;
+  }
 }
 
 onMounted(() => {
@@ -301,6 +327,7 @@ onMounted(() => {
       showSendBtn.value = true;
     }
 })
+
 </script>