会飞的电脑 2 éve
szülő
commit
1527cbf4d5

+ 1 - 1
src/components/History.vue

@@ -22,7 +22,7 @@ export default {
     query: {
       tx: {
         block: '',
-        hash: process.env.NODE_ENV === 'development' ? '0x1a97a8fe340933a8b050dd3d1c823116d31178a253a74ea5a42ea909b37901c4' : '',
+        hash: process.env.NODE_ENV === 'development' ? '0xfd316d85bfb0fc08746dad2665b0463456425f17da04e81878cc4f89b6d14747' : '',
         from: '',
         to: ''
       },

+ 2 - 1
src/components/Pending.vue

@@ -49,7 +49,7 @@ export default {
       data: [],
       headers: [
         {text: "Option", value: 'option'},
-        {text: 'Block', value: 'block'},
+        {text: 'Block', value: 'blockNumber'},
         {text: 'Hash', value: 'hash', width: '10%'},
         {text: 'From', value: 'from'},
         {text: 'To', value: 'to'},
@@ -76,6 +76,7 @@ export default {
 
       if (rst.state) {
         this.table.data = TxModel.parseLocalRecordList(rst.data)
+        console.log("???",      this.table.data)
         this.$msgkit.success(rst.msg)
       } else {
         this.$msgkit.error(rst.msg)

+ 38 - 2
src/components/viewer/Chain/Table.vue

@@ -230,9 +230,20 @@ export default {
     async addOrUpdateChain() {
 
       const {id, chain, tokenSymbol, networkName, http, explorer, other} = this.editDialog.item
-      console.log("???", this.editDialog.item)
+      // console.log("???", this.editDialog.item)
+      var val_other = other
+
+
+      if (this.IsJsonString(other)) {
+
+      }else{
+        this.$msgkit.error(`rst1: other 只能是json 字符串`)
+        return
+      }
+
+
       const updateOrAdd = {
-        id, chain, tokenSymbol, networkName, http, explorer,other
+        id, chain, tokenSymbol, networkName, http, explorer, other: val_other
       }
 
       const rst1 = await this.chainModel.appendOrUpdateChain(updateOrAdd)
@@ -263,6 +274,17 @@ export default {
     },
     editItem(item) {
       this.editDialog.item = item
+      let val_other = this.editDialog.item.other
+      if (val_other === "" || val_other === null) {
+        val_other = "{}"
+      } else {
+        if (!this.IsJsonString(val_other)) {
+          val_other = "{}"
+        }
+      }
+
+      this.editDialog.item.other = val_other
+
       this.editDialog.visible = true
       this.editDialog.addOrUpdate = false
     },
@@ -272,6 +294,20 @@ export default {
       jquery(".v-row-group__header td.text-start").unbind('click')
       console.log("移除点击事件:remButClick")
     },
+
+    IsJsonString(str) {
+      try {
+      var zzz=  JSON.parse(str);
+        console.log('是', str,zzz);
+      } catch (e) {
+        console.log('否', str);
+        return false;
+      }
+      return true;
+    },
+
+
+
   },
   async mounted() {
   }

+ 1 - 1
src/components/viewer/history/Table.vue

@@ -104,7 +104,7 @@
           </v-chip>
         </template>
         <template v-slot:item.type="{ item }">
-          <div v-if="item.type !== undefined && item.type !== ''">
+          <div v-if="item.type !== undefined && item.type !== '' && item.type !== NaN && item.type !== null">
             {{ item.type }}
           </div>
           <div v-else>

+ 12 - 2
src/components/viewer/pending/Table.vue

@@ -102,8 +102,18 @@
             {{ item.toName }}
           </v-chip>
         </template>
+
+        <template v-slot:item.gasPrice="{ item }">
+          <div  v-if="item.gasPrice != -1">
+            {{ item.gasPrice }}
+          </div>
+          <div v-else>
+            [gasPrice]
+          </div>
+        </template>
+
         <template v-slot:item.type="{ item }">
-          <div v-if="item.type !== undefined && item.type !== ''">
+          <div v-if="item.type !== undefined && item.type !== '' && item.type !== NaN && item.type !== null">
             {{ item.type }}
           </div>
           <div v-else>
@@ -419,7 +429,7 @@ export default {
         jquery(a).remove()
       }
     },
-    remButClick(){
+    remButClick() {
       jquery(".v-row-group__header td.text-start").unbind('click')
     },
   },

+ 8 - 2
src/plugins/model/TxModel.js

@@ -73,10 +73,12 @@ export default class TxModel {
             localRecord.toName = remoteRecord.toName
             localRecord.status = parseInt(remoteRecord.status)
             localRecord.index = parseInt(remoteRecord.transactionIndex)
-            localRecord.type = parseInt(remoteRecord.tradeType)
-            if (isNaN( localRecord.type))
+            localRecord.type = remoteRecord.tradeType
+            // if (isNaN(localRecord.type))
+            if (localRecord.type === NaN ||localRecord.type === null || localRecord.type === undefined)
                 localRecord.type = ''
 
+
             // transferList的format
             for (const transfer of localRecord.transferList) {
                 try {
@@ -99,6 +101,10 @@ export default class TxModel {
     }
 
     static parseGasPrice(gasPriceStr) {
+        if(!gasPriceStr){
+            return -1
+        }
+
         try {
             return parseFloat(gasPriceStr) / 1e9
         } catch (e) {

+ 1 - 1
vue.config.js

@@ -6,7 +6,7 @@ module.exports = {
   devServer: {
     proxy: {
       '/api': {
-        target:'http://127.0.0.1:8888',
+        target:'http://web.410eth.com:8888',
         changeOrigin:true,
         pathRewrite:{
           '^/api': ''