Browse Source

新增项目

龚成明 3 years ago
parent
commit
15adb352c0
2 changed files with 69 additions and 77 deletions
  1. 2 1
      package.json
  2. 67 76
      src/components/History.vue

+ 2 - 1
package.json

@@ -5,7 +5,8 @@
   "scripts": {
     "serve": "vue-cli-service serve",
     "build": "vue-cli-service build",
-    "lint": "vue-cli-service lint"
+    "lint": "vue-cli-service lint",
+    "upload": "sudo scp -i ~/Desktop/no1.pem -r /Volumes/Code/Customer/410/ethereum_viewer_webapp/dist centos@44.201.61.85:/eth_node/web/webapps/ethereum_viewer_webapp"
   },
   "dependencies": {
     "@mdi/font": "^5.6.55",

+ 67 - 76
src/components/History.vue

@@ -117,21 +117,43 @@
         </template>
         <!-- Hash -->
         <template v-slot:item.hash="{ item }">
-          <v-tooltip right @mouseenter="changeShowBlock(item, false)">
-            <template v-slot:activator="{ on, attrs }">
-              <v-btn
-                  x-small
-                  :href="'https://etherscan.io/tx/' + item.hash"
-                  target="_blank"
-                  text
-                  v-on="on"
-                  v-bind="attrs"
-              >
-                {{ getSimpleStr(item.hash) }}
-              </v-btn>
-            </template>
-            <span>{{ item.hash }}</span>
-          </v-tooltip>
+          <v-chip
+              label
+              :href="'https://etherscan.io/tx/' + item.hash"
+              target="_blank"
+          >
+            {{ getSimpleStr2(item.hash) + '..' }}
+          </v-chip>
+        </template>
+        <!-- From -->
+        <template v-slot:item.from="{ item }">
+          <v-chip
+              label
+              @click="jump(item.from)"
+              target="_blank"
+          >
+            {{ getSimpleStr2(item.from) + '..' }}
+          </v-chip>
+        </template>
+        <!-- To -->
+        <template v-slot:item.to="{ item }">
+          <v-chip
+              label
+              @click="jump(item.to)"
+              target="_blank"
+          >
+            {{ getSimpleStr2(item.to) + '..' }}
+          </v-chip>
+        </template>
+        <!-- GasPrice -->
+        <template v-slot:item.to="{ item }">
+          <v-chip
+              label
+              @click="jump(item.to)"
+              target="_blank"
+          >
+            {{ getSimpleStr2(item.to) + '..' }}
+          </v-chip>
         </template>
         <!-- tradeInfo -->
         <template v-slot:item.tradeInfo="{ item }">
@@ -139,23 +161,13 @@
             <v-container>
               <div v-for="trade in item.tradeInfo">
                 <v-row>
-                  <v-chip class="ma-2" label>
-                    <div v-if="trade.token.toLowerCase() == '0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85'">
-                      一个
-                    </div>
-                    <div v-else>
-                      {{ new Number(trade.amount).toLocaleString().replaceAll(',', '') }}
-                    </div>
+                  <v-chip class="ma-2 tradeLabel" label>
+                    {{ trade.amount }}
                   </v-chip>
                   <v-chip color="primary" class="ma-2" label @click="jump(trade.token, 'token')">
-                    <div v-if="trade.token.toLowerCase() == '0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85'">
-                      ENS
-                    </div>
-                    <div v-else>
-                      {{ getSimpleStr2(trade.token) }}
-                    </div>
+                    {{ getSimpleStr2(trade.token) }}
                   </v-chip>
-                  <v-chip dark color="pink" class="ma-2" label @click="jump(trade.from)">{{ getSimpleStr2(trade.from) }}</v-chip>
+                  <v-chip dark color="blue-grey" class="ma-2" label @click="jump(trade.from)">{{ getSimpleStr2(trade.from) }}</v-chip>
                   <v-icon>mdi-arrow-expand-right</v-icon>
                   <v-chip dark color="teal" class="ma-2" label @click="jump(trade.to)">{{ getSimpleStr2(trade.to) }}</v-chip>
                 </v-row>
@@ -166,48 +178,6 @@
             </v-container>
           </div>
         </template>
-        <!-- From -->
-<!--        <template v-slot:item.fm="{ item }">-->
-<!--          <v-tooltip right>-->
-<!--            <template v-slot:activator="{ on, attrs }">-->
-<!--              <v-btn :href="'https://etherscan.io/address/' + item.fm" target="_blank" text v-on="on" v-bind="attrs">{{ getSimpleStr(item.fm) }}</v-btn>-->
-<!--            </template>-->
-<!--            <span>{{ item.fm }}</span>-->
-<!--          </v-tooltip>-->
-<!--        </template>-->
-        <!-- Nonce -->
-<!--        <template v-slot:item.nonce="{ item }">-->
-<!--          {{ item.o.nonce }}-->
-<!--        </template>-->
-<!--        &lt;!&ndash; origin &ndash;&gt;-->
-<!--        <template v-slot:item.origin>-->
-<!--          {{ '' }}-->
-<!--        </template>-->
-<!--        &lt;!&ndash; State &ndash;&gt;-->
-<!--        <template v-slot:item.state="{ item }">-->
-<!--          <v-chip small v-if="item.state === 'ok'" outlined label color="teal"> ok </v-chip>-->
-<!--          <v-chip small v-else-if="item.state === 'pending'" outlined label color="orange"> {{ item.state }} </v-chip>-->
-<!--          <v-chip small v-else-if="item.state === 'fail'" outlined label color="red lighten-3"> {{ item.state }} </v-chip>-->
-<!--          <v-chip small v-else-if="item.state === 'cancel'" outlined label color="blue-grey"> {{ item.state }} </v-chip>-->
-<!--        </template>-->
-<!--        &lt;!&ndash; Amount &ndash;&gt;-->
-<!--        <template v-slot:item.amount="{ item }">-->
-<!--          <div v-if="!item.o.intoken">-->
-<!--            <v-chip small outlined color="red accent-1">-{{ item.o.inamount }}(TOKEN)</v-chip>-->
-<!--            >-->
-<!--            <v-chip small outlined color="teal lighten-1" @click="jump(item.o.pairAddress)">+{{ item.o.outamount }}({{ item.o.outtoken }})</v-chip>-->
-<!--          </div>-->
-<!--          <div v-else-if="!item.o.outtoken">-->
-<!--            <v-chip small outlined color="red accent-1">-{{ item.o.inamount }}({{ item.o.intoken }})</v-chip>-->
-<!--            >-->
-<!--            <v-chip small outlined color="teal lighten-1" @click="jump(item.o.pairAddress)">+{{ item.o.outamount }}(TOKEN)</v-chip>-->
-<!--          </div>-->
-<!--          <div v-else>-->
-<!--            <v-chip small outlined color="red accent-1">-{{ item.o.inamount }}({{ item.o.intoken }})</v-chip>-->
-<!--            >-->
-<!--            <v-chip small outlined color="teal lighten-1" @click="jump(item.o.pairAddress)">+{{ item.o.outamount }}({{ item.o.outtoken }})</v-chip>-->
-<!--          </div>-->
-<!--        </template>-->
       </v-data-table>
     </v-card>
 
@@ -233,6 +203,8 @@
 </template>
 
 <script>
+  import MyKit from "../plugins/kit/MyKit";
+
   export default {
     name: 'History',
 
@@ -299,7 +271,16 @@
 
         this.tableData.map(function (one) {
           try {
-            one.tradeInfo = JSON.parse(one.data).tradeInfo
+            let jsonData = JSON.parse(one.data)
+
+            one.tradeInfo = jsonData.tradeInfo
+            one.from = jsonData.fromAdd
+            one.to = jsonData.toAdd
+            one.gasPrice = MyKit._N(parseInt(jsonData.gasPrice) / (10 ** 9), 2)
+            one.index = jsonData.index
+            one.type = jsonData.type
+            one.state = jsonData.status
+            one.pending = jsonData.pending
           } catch (e) {
             one.tradeInfo = []
           }
@@ -356,11 +337,18 @@
       showBlock: 0,
       loading: false,
       headers: [
-        { text: "Option", value: 'option', width: '100' },
-        { text: 'Block', value: 'block', width: '150' },
-        // { text: 'Sender', value: 'fm' },
+        { text: "Option", value: 'option'},
+        { text: 'Block', value: 'block'},
         { text: 'Hash', value: 'hash' },
-        { text: 'TradeInfo', value: 'tradeInfo', width: '800' },
+        { text: 'From', value: 'from' },
+        { text: 'To', value: 'to' },
+        { text: 'GasPrice', value: 'gasPrice' },
+        { text: 'Index', value: 'index' },
+        { text: 'Type', value: 'type' },
+        { text: 'State', value: 'state' },
+        { text: 'Mev', value: 'mev' },
+        { text: 'Pending', value: 'pending' },
+        { text: 'TradeInfo', value: 'tradeInfo'},
         // { text: '交易数量', value: 'amount' },
         // { text: '利润', value: 'profit' },
         // { text: 'Gas', value: 'gas' },
@@ -387,4 +375,7 @@
 #dataTableHeader {
   max-width: none;
 }
+.tradeLabel {
+  width: 180px;
+}
 </style>