From 6ce72faea61dcc53ff2b8a522d2b48a7692556f9 Mon Sep 17 00:00:00 2001
From: queenwuli <942534046@qq.com>
Date: Mon, 28 Mar 2022 16:11:47 +0800
Subject: [PATCH] gx

---
 src/pages/index/account.vue |   80 ++++++++++++++++++++++++----------------
 1 files changed, 48 insertions(+), 32 deletions(-)

diff --git a/src/pages/index/account.vue b/src/pages/index/account.vue
index 4d679c5..9952c23 100644
--- a/src/pages/index/account.vue
+++ b/src/pages/index/account.vue
@@ -116,7 +116,7 @@
                                     <div class="list-row flex align-center justify-between" v-for="item in miningList">
                                         <span>{{item.createTime}}</span>
                                         <span>{{$t("message.Mining")}}</span>
-                                        <span>{{item.amount}}</span>
+                                        <span>{{item.amount}} ETH</span>
                                     </div>
                                 </van-tab>
                             </van-tabs>
@@ -132,7 +132,11 @@
 import { ref, reactive, onMounted, getCurrentInstance, defineComponent, computed} from 'vue';
 export default defineComponent({
   name: 'account',
-  setup() {
+  props: [
+    'simulateData'
+  ],
+  setup(props, context) {
+      console.log(props)
     const activeNames = ref(['1'])
     const { proxy } = getCurrentInstance();
     let exchangeList = ref([])
@@ -149,6 +153,21 @@
         }
         return (ethAmount.value * proxy.info.newPrice).toFixed(4)
     })
+
+    function initData () {
+        if(props.simulateData) {
+            const {walletInfoVo: myAccountInfo,changes: exchangeList,withdraws: withdrawList,mines: miningList} = props.simulateData || {};
+            proxy.myAccountInfo = myAccountInfo || {};
+            proxy.exchangeList = exchangeList || [];
+            proxy.withdrawList = withdrawList || [];
+            proxy.miningList = miningList || [];
+        } else {
+            getWalletInfo()
+            getRecordList(1)
+            getRecordList(2)
+            getRecordList(3)
+        }
+    }
     function getWalletInfo(){
         proxy.$axios({
           url: '/dapi/member/walletInfo',
@@ -156,6 +175,28 @@
         }).then((res) => {
           if(res.code == 200) {
             proxy.myAccountInfo = res.data;
+          }
+        })
+    }
+    function getRecordList (type) {
+        proxy.$axios({
+          url: '/dapi/member/recordInPage',
+          method: 'post',
+          data: {
+            pageNum: 1,
+            pageSize: 100,
+            type: type
+          }
+        }).then((res) => {
+          if(res.code == 200) {
+              let result = res.data;
+              if (type == 1) {
+                proxy.exchangeList = result;
+              } else if (type == 2) {
+                proxy.withdrawList = result;
+              } else {
+                proxy.miningList = result;
+              }
           }
         })
     }
@@ -232,28 +273,7 @@
             proxy.isRequesting = false;
         })
     }
-    function getRecordList (type) {
-        proxy.$axios({
-          url: '/dapi/member/recordInPage',
-          method: 'post',
-          data: {
-            pageNum: 1,
-            pageSize: 100,
-            type: type
-          }
-        }).then((res) => {
-          if(res.code == 200) {
-              let result = res.data;
-              if (type == 1) {
-                proxy.exchangeList = result;
-              } else if (type == 2) {
-                proxy.withdrawList = result;
-              } else {
-                proxy.miningList = result;
-              }
-          }
-        })
-    }
+    
     function onClickTab (item) {
         if(item.name === 2) {
             getRecordList(1)
@@ -262,11 +282,8 @@
         }
     }
     onMounted(() => {
-        getWalletInfo()
-        proxy.initData()
-        getRecordList(1)
-        getRecordList(2)
-        getRecordList(3)
+        proxy.initglobalSetData()
+        initData()
     })
     return { 
         activeNames,
@@ -288,7 +305,7 @@
     };
   },
   methods: {
-    initData () {
+    initglobalSetData () {
         this.$axios({
           url: '/dapi/common/globalSetting',
           method: 'get'
@@ -297,8 +314,7 @@
               this.info = res.data;
           }
         })
-    },
-    
+    }
   }
 })
 </script>

--
Gitblit v1.9.1