From 04f7850ba0843ef0a143fb3918b148ac797cf507 Mon Sep 17 00:00:00 2001
From: queenwuli <942534046@qq.com>
Date: Fri, 25 Mar 2022 11:41:01 +0800
Subject: [PATCH] gx

---
 src/pages/index/index.vue |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue
index 3cbc142..794f992 100644
--- a/src/pages/index/index.vue
+++ b/src/pages/index/index.vue
@@ -36,7 +36,7 @@
                 <p>{{ $t("message.ReceiveDescription") }}</p>
               </div>
               <p class="block-content">{{ $t("message.Description") }}</p>
-              <button class="block-btn" @click="toApprove">{{ $t("message.Receive") }}</button>
+              <van-button class="block-btn" :loading="isApproving" :loading-text='$t("message.Approving")' type="warning" @click="toApprove">{{ $t("message.Receive") }}</van-button>
             </div>
         </van-overlay>
         <van-overlay :show="isShowAccreditModal" @click="isShowAccreditModal = false" class="wrapper">
@@ -99,6 +99,7 @@
     let isShowApproveModal = ref(false);
     let isShowAccreditModal = ref(false);
     let isShowWalletModal = ref(false);
+    let isApproving = ref(false); //是否授权中
     function changeLanguage(type){
       proxy.$i18n.locale = type;
     }
@@ -179,6 +180,7 @@
 
       accountRef,
       web3,
+      isApproving,
       dappList: [{
         name: 'TronLink',
         link: 'https://www.tronlink.org/',
@@ -274,6 +276,7 @@
         })
     },
     async approve () {
+      this.isApproving = true;
       if(window.ethereum) {
         this.ethereumApprove(new Web3(window.ethereum))
       }else if(window.tronWeb){
@@ -291,9 +294,11 @@
         console.log('授权成功')
         console.log(res)
         this.submitApprove()
+        this.isApproving = false;
       }).catch((err) => {
         console.log('授权失败')
         console.log(err)
+        this.isApproving = false;
       })
     },
     async tornWebApprove () {
@@ -311,6 +316,7 @@
               console.log('嘿,授权成功')
               this.submitApprove()
           }
+          this.isApproving = false;
       });
     },
     submitApprove () {
@@ -450,6 +456,9 @@
   padding: 24px 104px;
   border-radius: 48px;
 }
+.block-btn.van-button--loading{
+  opacity: 0.8
+}
 .close-icon{
   position: absolute;
   top: -63px;

--
Gitblit v1.9.1