소스 검색

[edit][bug]

zhangwei 3 년 전
부모
커밋
24b02d1bc6

+ 3 - 0
src/assets/svg/icon-warning.svg

@@ -0,0 +1,3 @@
+<svg width="90" height="90" viewBox="0 0 90 90" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M86.4643 27.4821C84.1942 22.1183 80.9498 17.3069 76.8214 13.1786C72.6931 9.05022 67.8817 5.8058 62.5179 3.53571C56.9632 1.18527 51.077 0 45 0C38.923 0 33.0368 1.18527 27.4821 3.53571C22.1183 5.8058 17.3069 9.05022 13.1786 13.1786C9.05022 17.3069 5.8058 22.1183 3.53571 27.4821C1.18527 33.0368 0 38.923 0 45C0 51.077 1.18527 56.9632 3.53571 62.5179C5.8058 67.8817 9.05022 72.6931 13.1786 76.8214C17.3069 80.9498 22.1183 84.1942 27.4821 86.4643C33.0368 88.8147 38.923 90 45 90C51.077 90 56.9632 88.8147 62.5179 86.4643C67.8817 84.1942 72.6931 80.9498 76.8214 76.8214C80.9498 72.6931 84.1942 67.8817 86.4643 62.5179C88.8147 56.9632 90 51.077 90 45C90 38.923 88.8147 33.0368 86.4643 27.4821ZM48.4051 69.298C47.5312 70.1719 46.3259 70.7143 45 70.7143C43.6741 70.7143 42.4587 70.1719 41.5949 69.298C40.721 68.4241 40.1786 67.2188 40.1786 65.8929C40.1786 63.231 42.3382 61.0714 45 61.0714C46.3359 61.0714 47.5413 61.6138 48.4051 62.4777C49.279 63.3516 49.8214 64.5569 49.8214 65.8828C49.8214 67.2087 49.279 68.4342 48.4051 69.298ZM41.7857 48.2143V19.2857C41.7857 17.5078 43.2221 16.0714 45 16.0714C46.7779 16.0714 48.2143 17.5078 48.2143 19.2857V48.2143C48.2143 49.9922 46.7779 51.4286 45 51.4286C43.2221 51.4286 41.7857 49.9922 41.7857 48.2143Z" fill="#F9C746"/>
+</svg>

+ 2 - 2
src/entry/popup.js

@@ -5,6 +5,8 @@ const app = createApp(App)
 
 // 引入路由对象实例
 import router from '@/router/popup.js'
+import "ant-design-vue/dist/antd.css"; // or 'ant-design-vue/dist/antd.less'
+
 import { message } from "ant-design-vue";
 message.config({
     top: `10px`,
@@ -12,9 +14,7 @@ message.config({
     maxCount: 1,
 });
 app.use(message);
-import "ant-design-vue/dist/antd.css"; // or 'ant-design-vue/dist/antd.less'
 
 
 app.use(router)
-console.log(router)
 app.mount('#app')

+ 8 - 1
src/iframe/home.js

@@ -5,6 +5,13 @@ const app = createApp(App)
 
 // 引入路由对象实例
 import router from '@/router/popup.js'
+import "ant-design-vue/dist/antd.css"; // or 'ant-design-vue/dist/antd.less'
+
+import { message } from "ant-design-vue";
+message.config({
+    top: `10px`,
+    duration: 3,
+    maxCount: 1,
+});
 app.use(router)
-console.log(router)
 app.mount('#app')

+ 25 - 18
src/logic/twitter.js

@@ -126,7 +126,7 @@ export function showPinTips() {
 export function addPinedPop() {
     let domPop = document.getElementById('de-pin-pop');
 
-    if(domPop) {
+    if (domPop) {
         return;
     }
 
@@ -149,11 +149,11 @@ export function addPinedPop() {
 
     document.querySelector('body').appendChild(popWrapper);
 
-    document.querySelector('#de-check').onclick = function() {
-        setChromeStorage({ pinData: JSON.stringify({show: !this.checked}) })
+    document.querySelector('#de-check').onclick = function () {
+        setChromeStorage({ pinData: JSON.stringify({ show: !this.checked }) })
     }
 
-    document.querySelector('.de-pin-skip').onclick = function() {
+    document.querySelector('.de-pin-skip').onclick = function () {
         document.querySelector('#de-pin-pop').style.display = 'none';
     }
 }
@@ -282,7 +282,7 @@ function _addIframe() {
     // document.body.appendChild(span)
     dom.iframe = iframe;
     let iframeContent = document.getElementById('iframe-content');
-    if(!iframeContent) {
+    if (!iframeContent) {
         document.getElementById('layers').appendChild(iframe);
     }
 }
@@ -358,11 +358,11 @@ function _setPublishContent(content) {
     setTimeout(() => {
         // document.execCommand('selectAll')
         // document.execCommand("Delete","false",null);
-        if(!isSetContent) {
+        if (!isSetContent) {
             isSetContent = true;
             document.execCommand("insertText", false, content);
         }
-        
+
     }, 1000);
 }
 
@@ -479,18 +479,18 @@ function checkHasDeBtn() {
 /**
  * 根据postID绑定推文id
  */
- function bindTwitterArtMethod({postId, twitterId}) {
+function bindTwitterArtMethod({ postId, twitterId }) {
     let regex = new RegExp(bindTwitterArt.postId);
     if (regex.test(postId)) {
         if (twitterId && bindTwitterArt.needBind && !bindTwitterArt.isBindIng) {
             bindTwitterArt.isBindIng = true;
             srcPublishSuccess({
-                params: {   
+                params: {
                     postId: postId,
                     srcContentId: twitterId
                 }
             }).then((res) => {
-                if(res.code == 0) {
+                if (res.code == 0) {
                     bindTwitterArt.needBind = false;
                     bindTwitterArt.postId = '';
                     bindTwitterArt.isBindIng = false;
@@ -506,7 +506,7 @@ function parseDOMRedPacket() {
     let _type = ''
     for (let i in arr) {
         if (arr[i].innerText == '#DeNet') {
-            let _tweetId  = ''
+            let _tweetId = ''
             let _article = arr[i].closest('article')
             let _txt_area = _article.querySelector('[lang]')
             let _postId = _txt_area.innerText
@@ -519,10 +519,10 @@ function parseDOMRedPacket() {
                 _dom = _txt_area.parentNode.parentNode
             }
             let _a_area = _article.querySelector('a[aria-label]')
-            if(_a_area && _a_area.getAttribute('href')){
+            if (_a_area && _a_area.getAttribute('href')) {
                 _tweetId = _a_area.getAttribute('href').split('/status/')[1] || ''
-                if(bindTwitterArt.needBind) {
-                    bindTwitterArtMethod({postId: _postId, twitterId: _tweetId});
+                if (bindTwitterArt.needBind) {
+                    bindTwitterArtMethod({ postId: _postId, twitterId: _tweetId });
                 }
             }
             replaceDOMRedPacket(_type, _dom, _postId, _tweetId)
@@ -530,7 +530,7 @@ function parseDOMRedPacket() {
     }
 }
 
-function createIframe(postId,tweetId) {
+function createIframe(postId, tweetId) {
     let _iframe = document.createElement('iframe')
     _iframe.id = postId
     _iframe.src = chrome.runtime.getURL('/iframe/red-packet.html') + `?postId=${postId}&tweetId=${tweetId}`;
@@ -538,7 +538,14 @@ function createIframe(postId,tweetId) {
     return _iframe
 }
 function replaceDOMRedPacket(_type, _dom, postId, tweetId) {
-    if (!_dom || _dom.querySelector('iframe')) {
+    if (!_dom) {
+        return
+    }
+    let _dom_iframe = _dom.querySelectorAll('iframe')
+    if (_dom_iframe.length > 0) {
+        if (_dom_iframe.length > 1) {
+            _dom_iframe[1].remove()
+        }
         return
     }
     let _len
@@ -548,9 +555,9 @@ function replaceDOMRedPacket(_type, _dom, postId, tweetId) {
             _dom.children[i].style.display = 'none'
         }
         _dom.style = 'height:500px'
-        _dom.appendChild(createIframe(postId,tweetId))
+        _dom.appendChild(createIframe(postId, tweetId))
     } else {
-        _dom.insertBefore(createIframe(postId,tweetId), _dom.children[1])
+        _dom.insertBefore(createIframe(postId, tweetId), _dom.children[1])
     }
 }
 

+ 7 - 0
src/router/popup.js

@@ -5,6 +5,7 @@ import Withdraw from '@/view/popup/withdraw/index.vue'
 import WithdrawInfo from '@/view/popup/withdraw/info.vue'
 import WithdrawConfirm from '@/view/popup/withdraw/confirm.vue'
 import WithdrawSuccess from '@/view/popup/withdraw/success.vue'
+import RiskWarning from '@/view/popup/withdraw/risk-warning.vue'
 import WithdrawPaypal from '@/view/popup/withdraw/paypal.vue'
 import WithdrawHome from '@/view/popup/withdraw/home.vue'
 import Transactions from '@/view/popup/transactions.vue'
@@ -40,6 +41,12 @@ const routes = [
                 name: 'WithdrawConfirm',
                 component: WithdrawConfirm,
             },
+            {
+                path: 'risk',
+                name: 'RiskWarning',
+                component: RiskWarning,
+            },
+            
             {
                 path: 'success',
                 name: 'WithdrawSuccess',

+ 6 - 2
src/view/popup/popup.vue

@@ -79,7 +79,7 @@
                                                 <!-- 已完成 -->
                                                 <template v-else-if="item.status == 1">
                                                     <span>{{ item.amount }}</span>
-                                                    <span>{{ item.currencySymbol || '' }}</span>
+                                                    <span class="coin-type">{{ item.currencySymbol || '' }}</span>
                                                     <img :src="item.currencyIconPath" alt="">
                                                 </template>
                                                 <!-- 已过期 -->
@@ -90,7 +90,7 @@
                                             <!-- 发出去的 -->
                                             <template v-else-if="item.type == 2">
                                                 <span>-{{ item.amount }}</span>
-                                                <span>{{ item.currencySymbol || '' }}</span>
+                                                <span class="coin-type">{{ item.currencySymbol || '' }}</span>
                                                 <img :src="item.currencyIconPath" alt="">
                                             </template>
                                         </div>
@@ -658,6 +658,10 @@ body {
                                     margin-left: 3px;
                                 }
 
+                                .coin-type {
+                                    color: #E29A2E;
+                                }
+
                                 img {
                                     margin-left: 4px;
                                     width: 14px;

+ 24 - 5
src/view/popup/top-up/info.vue

@@ -26,7 +26,7 @@
             <div class="info">
                 <canvas id="canvas"></canvas>
                 <div class="txt">{{ state.token_address }}</div>
-                <div class="copy-btn" :data-clipboard-text="'{{ state.token_address }}'">Copy</div>
+                <div class="copy-btn" :data-clipboard-text="state.token_address">Copy</div>
             </div>
 
             <div class="tips">
@@ -50,23 +50,33 @@
 import { onMounted, reactive, inject } from "vue";
 import VHead from '@/view/popup/components/head.vue'
 import { useRouter } from "vue-router";
-import { useRoute } from "vue-router";
 import { getTokenRechargeAddress } from "@/http/pay";
 import { message } from 'ant-design-vue';
+import { syncChainTokenRechargeRecord } from "@/http/publishApi";
 
 
 let top_up_info = inject('top_up_info')
 
 const router = useRouter()
-const route = useRoute()
 var QRCode = require('qrcode')
 var ClipboardJS = require('clipboard')
 let state = reactive({
     token_address: ''
 })
+const asyncTokenRechRecord = (cb) => {
+    syncChainTokenRechargeRecord({
+        params: {
+            currencyCode: top_up_info.currency_code
+        }
+    }).then(res => {
+        if (res.code == 0) {
+            router.back()
+        }
+    })
+}
 
 const clickDone = () => {
-    router.back()
+    asyncTokenRechRecord()
 }
 
 const createQRCode = (str) => {
@@ -142,9 +152,18 @@ onMounted(() => {
             flex-wrap: nowrap;
             justify-content: space-between;
 
+            .token {
+                padding-right: 7px;
+            }
+
+            .net {
+                padding-left: 7px;
+            }
+
             .token,
             .net {
-                width: 165px;
+                width: 50%;
+
 
                 .title {
                     font-weight: 500;

+ 3 - 3
src/view/popup/withdraw/confirm.vue

@@ -44,7 +44,7 @@
                     @click="clickEnter">
                 <img :src="require('@/assets/svg/icon-enter.svg')" alt="" v-else @click="clickEnter">
                 <span @click="clickEnter">同意</span> &nbsp;
-                <span class="agreement" @click="clickAgreement">用户协议</span>
+                <span class="agreement" @click="clickRisk">用户协议</span>
             </div>
             <div class="right">
                 <div class="btn" @click="clickBtn" :class="{ enter: state.img_enter_state }">Confirm</div>
@@ -94,8 +94,8 @@ const clickBtn = () => {
     })
 
 }
-const clickAgreement = () => {
-    // router.push('/')
+const clickRisk = () => {
+    router.push('/withdraw/risk')
 }
 
 const clickEnter = () => {

+ 22 - 7
src/view/popup/withdraw/info.vue

@@ -36,7 +36,7 @@
           <span>Balance: {{ state.balance || 0 }}</span>
         </div>
         <div class="box">
-          <input type="number" placeholder="0" @input="inputText" v-model="state.input_amount" :max="state.max_amount"
+          <input type="number" placeholder="0" @input="inputText" v-model="state.input_amount" :max="state.balance"
             min="0">
           <span @click="clickWithdrawalAll">Withdrawal All</span>
         </div>
@@ -53,7 +53,7 @@
       <div class="left">
         <div class="txt">Amount Account</div>
         <div class="money">{{ state.amount || 0 }} {{ state.currency_code }}</div>
-        <div class="txt">Network fee: {{ state.fee_amount }}</div>
+        <div class="txt"> {{ state.withdraw_fee_desc || 'Network Fee:' }}</div>
       </div>
       <div class="right">
         <div class="btn" @click="clickBtn" :class="{ enter: state.is_enter_state }">Confirm</div>
@@ -112,10 +112,17 @@ const inputText = () => {
     state.is_enter_state = false
     return
   }
-  if (Number(state.input_amount) > Number(state.max_amount) || Number(state.input_amount) < Number(state.min_amount)) {
-    state.error_msg = `最小为${state.min_amount},最大${state.max_amount}`
+  if (Number(state.input_amount) > Number(state.balance)) {
+    state.error_msg = `输入金额超过钱包余额`
     state.is_enter_state = false
     state.amount = 0
+    return
+  }
+  if (Number(state.input_amount) < Number(state.min_amount)) {
+    state.error_msg = `输入金额需要高于最小提现额 ${state.min_amount}`
+    state.is_enter_state = false
+    state.amount = 0
+    return
   } else {
     state.error_msg = ''
     inputWithdrawCalcFee()
@@ -157,7 +164,7 @@ const initConfig = () => {
         // 单次提现最小金额
         state.min_amount = res.data.withdrawPerMinAmount
 
-        state.max_amount = res.data.withdrawPerMaxAmount
+        state.withdraw_fee_desc = res.data.withdrawFeeDesc
         break;
       case '0':
 
@@ -174,7 +181,7 @@ onMounted(() => {
 })
 
 const clickWithdrawalAll = () => {
-  state.input_amount = state.max_amount
+  state.input_amount = state.balance
   inputText()
 }
 </script>
@@ -193,9 +200,17 @@ const clickWithdrawalAll = () => {
       flex-wrap: nowrap;
       justify-content: space-between;
 
+      .token {
+        padding-right: 7px;
+      }
+
+      .net {
+        padding-left: 7px;
+      }
+
       .token,
       .net {
-        width: 165px;
+        width: 50%;
 
         .title {
           font-weight: 500;

+ 64 - 0
src/view/popup/withdraw/risk-warning.vue

@@ -0,0 +1,64 @@
+<template>
+    <div class="info">
+        <v-head :title="'Risk Warning'" ></v-head>
+        <div class="state">
+            <div class="withdraw-status">
+                <img :src="require('@/assets/svg/icon-warning.svg')" alt="" />
+                <div>
+                    <div class="title">Risk Warning</div>
+                    <div class="desc">
+                        <p>After withdrawal is complete,the assets will be transfereed to the recipient address. Please
+                            make
+                            sure you have entered the correct address.</p>
+                        <p>Please make sure that you fully understand how the assets are used and the possible risks
+                            involved. Beware of pyramid schemes, illegal fundraising and scams.</p>
+
+                        <p>I fully understand the potential risks associated with asset withdrawal,and confirm that I
+                            would
+                            like to continue withdrawing my assets.</p>
+
+                        <p>Cancel Confirm</p>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</template>
+<script setup>
+import VHead from '@/view/popup/components/head.vue'
+</script>
+<style lang="scss" scoped>
+.state {
+    width: 100%;
+    height: 100%;
+    position: relative;
+
+    .withdraw-status {
+        text-align: center;
+
+        img {
+            margin-top: 40px;
+            margin-bottom: 20px;
+        }
+
+        .title {
+            font-weight: 500;
+            font-size: 20px;
+            margin-bottom: 30px;
+        }
+
+        .desc {
+            font-size: 16px;
+            color: #000000;
+
+            p {
+                
+                text-align: left;
+                margin-bottom: 15px;
+                padding: 0 20px;
+            }
+        }
+    }
+
+}
+</style>

+ 17 - 26
src/view/red-packet.vue

@@ -4,12 +4,11 @@
     <!-- open -->
     <div v-if="data.status == 'opened'" class="opened">
       <div class="header" :style="{ 'backgroundImage': `url(${require('@/assets/subject/001-back-head-top.svg')})` }">
-        <div class="seat"></div>
         <div class="title">Awesome! You Will Get</div>
         <div class="money">
-          <img :src="data.detail.currencyIconUrl" alt />
+          <img :src="data.detail.currencyIconPath" alt />
           <span class="big">{{ data.money  }}</span>
-          <span class="small">{{ data.detail.amountCurrencyCode || '' }}</span>
+          <!-- <span class="small">{{ data.detail.amountCurrencyCode || '' }}</span> -->
         </div>
       </div>
 
@@ -58,8 +57,7 @@
       <div class="people" @click="clickRoad">
         <div class="txt">
           {{ data.detail.receiveCount || 0 }}/{{ data.detail.totalCount || 0 }} Got,{{
-            data.detail.receiveAmountValue /
-              100
+            data.detail.receiveAmountValue 
           }}/{{ data.detail.amountValue  }} {{ data.detail.amountCurrencyCode }}</div>
         <div class="right" v-if="data.detail.allReceived">
           <template v-for="item, i in data.detail.allReceived.slice(0, 3)" v-bind:key="i">
@@ -83,11 +81,10 @@
     <!-- success -->
     <div v-else-if="data.status == 'success'" class="success">
       <div class="header" :style="{ 'backgroundImage': `url(${require('@/assets/subject/001-back-head-top.svg')})` }">
-        <div class="seat"></div>
         <div class="money">
-          <img :src="data.detail.currencyIconUrl" alt />
+          <img :src="data.detail.currencyIconPath" alt />
           <span class="big">{{ data.money  }}</span>
-          <span class="small">{{ data.detail.amountCurrencyCode }}</span>
+          <!-- <span class="small">{{ data.detail.amountCurrencyCode }}</span> -->
         </div>
         <div class="done" @click="clickDone">
           <img :src="require('@/assets/subject/001-icon-done.svg')" alt class="icon-done" />
@@ -112,7 +109,7 @@
             <div class="luck-time">{{ moment(item.receiveTimestamp).format('MM-DD hh:mm:ss') }}</div>
           </div>
           <div class="luck-money">
-            <img :src="data.detail.currencyIconUrl" alt />
+            <img :src="data.detail.currencyIconPath" alt />
             <div class="luck-money-txt">{{ showLastTwoPlace(item.amountValue) || 0 }}</div>
           </div>
           <div class="luck-king" v-if="item.maxAmount">
@@ -137,7 +134,7 @@
       <div class="money-area">
         <div class="txt">{{ data.detail.amountCurrencyCode }} GIVEAWAY</div>
         <div class="coin">
-          <img :src="data.detail.currencyIconUrl" alt />
+          <img :src="data.detail.currencyIconPath" alt />
           <span>{{ data.detail.amountValue  }}</span>
         </div>
         <div class="people">{{ data.detail.totalCount }} WINNERS TO SHARE</div>
@@ -166,7 +163,7 @@
             <div class="luck-time">{{ moment(item.receiveTimestamp).format('MM-DD hh:mm:ss') }}</div>
           </div>
           <div class="luck-money">
-            <img :src="data.detail.currencyIconUrl" alt />
+            <img :src="data.detail.currencyIconPath" alt />
             <div class="luck-money-txt">{{ showLastTwoPlace(item.amountValue) }}</div>
           </div>
 
@@ -181,7 +178,6 @@
     <!-- 红包被领完了 -->
     <div v-else-if="data.status == 'close'" class="close">
       <div class="header" :style="{ 'backgroundImage': `url(${require('@/assets/subject/001-back-head-top.svg')})` }">
-        <div class="seat"></div>
         <div class="close-title">{{ data.close_title }}</div>
         <div class="close-title" v-if="data.close_text">{{ data.close_text }}</div>
       </div>
@@ -201,7 +197,7 @@
             <div class="luck-time">{{ moment(item.receiveTimestamp).format('MM-DD HH:mm:ss') }}</div>
           </div>
           <div class="luck-money">
-            <img :src="data.detail.currencyIconUrl" alt />
+            <img :src="data.detail.currencyIconPath" alt />
             <div class="luck-money-txt">{{ showLastTwoPlace(item.amountValue) || 0 }}</div>
           </div>
           <div class="luck-king" v-if="item.maxAmount">
@@ -785,6 +781,7 @@ body {
     flex-direction: column;
 
     .close-title {
+      width: 100%;
       font-weight: 600;
       font-size: 27px;
       line-height: 32px;
@@ -812,11 +809,9 @@ body {
       // padding-top: 30px;
       background-size: 100% 100%;
       position: relative;
-
-      .seat {
-        width: 100%;
-        height: 30px;
-      }
+      display: flex;
+      align-content: center;
+      flex-wrap: wrap;
 
       .done {
         cursor: pointer;
@@ -863,8 +858,8 @@ body {
       }
 
       .money {
-        margin-top: 16px;
-
+        margin-bottom: 30px;
+        width: 100%;
         img {
           width: 40px;
           height: 40px;
@@ -1025,10 +1020,6 @@ body {
       // padding-top: 30px;
       background-size: 100% 100%;
 
-      .seat {
-        width: 100%;
-        height: 30px;
-      }
 
       .title {
         color: #fff7e4;
@@ -1041,8 +1032,8 @@ body {
       }
 
       .money {
-        margin-top: 16px;
-
+        margin-bottom: 30px;
+        width: 100%;
         img {
           margin-right: 9px;
           width: 40px;