瀏覽代碼

前后端正式打通

龚成明 3 年之前
父節點
當前提交
18f540b16a
共有 8 個文件被更改,包括 117 次插入1166 次删除
  1. 1 6
      package.json
  2. 20 38
      src/App.vue
  3. 二進制
      src/assets/logo-ether.png
  4. 0 364
      src/components/Config.vue
  5. 72 163
      src/components/History.vue
  6. 0 352
      src/components/My.vue
  7. 0 235
      src/components/New.vue
  8. 24 8
      src/plugins/axios.js

+ 1 - 6
package.json

@@ -16,12 +16,8 @@
   },
   "devDependencies": {
     "@vue/cli-plugin-babel": "~4.5.0",
-    "@vue/cli-plugin-eslint": "~4.5.0",
     "@vue/cli-service": "~4.5.0",
     "axios": "^0.18.1",
-    "babel-eslint": "^10.1.0",
-    "eslint": "^6.7.2",
-    "eslint-plugin-vue": "^6.2.2",
     "sass": "^1.19.0",
     "sass-loader": "^8.0.0",
     "vue-cli-plugin-vuetify": "~2.0.7",
@@ -34,8 +30,7 @@
       "node": true
     },
     "extends": [
-      "plugin:vue/essential",
-      "eslint:recommended"
+      "plugin:vue/essential"
     ],
     "parserOptions": {
       "parser": "babel-eslint"

+ 20 - 38
src/App.vue

@@ -22,23 +22,23 @@
         <v-tab
           key="history"
         >
-          历史记录
-        </v-tab>
-        <v-tab
-          key="new"
-        >
-          最新动态
-        </v-tab>
-        <v-tab
-            key="my"
-        >
-          我的交易
-        </v-tab>
-        <v-tab
-            key="config"
-        >
-          参数配置
+          History
         </v-tab>
+<!--        <v-tab-->
+<!--          key="new"-->
+<!--        >-->
+<!--          最新动态-->
+<!--        </v-tab>-->
+<!--        <v-tab-->
+<!--            key="my"-->
+<!--        >-->
+<!--          我的交易-->
+<!--        </v-tab>-->
+<!--        <v-tab-->
+<!--            key="config"-->
+<!--        >-->
+<!--          参数配置-->
+<!--        </v-tab>-->
       </v-tabs>
 
       <v-spacer></v-spacer>
@@ -54,6 +54,7 @@
     </v-app-bar>
 
     <v-main>
+      <!--   密码测试   -->
       <v-tabs-items
         v-model="tab"
         v-if="calcPwdMD5() !== pwdMD5"
@@ -68,9 +69,7 @@
             </v-col>
           </v-row>
           <v-row>
-            <v-col cols="3">
-
-            </v-col>
+            <v-col cols="3"></v-col>
             <v-col cols="6">
               <v-text-field
                 v-model="pwd"
@@ -81,9 +80,7 @@
                 @click:append="jump"
               ></v-text-field>
             </v-col>
-            <v-col cols="3">
-
-            </v-col>
+            <v-col cols="3"></v-col>
           </v-row>
         </v-container>
       </v-tabs-items>
@@ -94,15 +91,6 @@
         <v-tab-item key="history">
           <History></History>
         </v-tab-item>
-        <v-tab-item key="new">
-          <New></New>
-        </v-tab-item>
-        <v-tab-item key="my">
-          <My></My>
-        </v-tab-item>
-        <v-tab-item key="config">
-          <Config></Config>
-        </v-tab-item>
       </v-tabs-items>
     </v-main>
   </v-app>
@@ -111,19 +99,13 @@
 <script>
 
 import History from "@/components/History";
-import New from "@/components/New";
-import My from "@/components/My";
-import Config from "@/components/Config";
 import md5 from 'md5-node'
 
 export default {
   name: 'App',
 
   components: {
-    History,
-    New,
-    My,
-    Config
+    History
   },
 
   data: () => ({

二進制
src/assets/logo-ether.png


+ 0 - 364
src/components/Config.vue

@@ -1,364 +0,0 @@
-<template>
-  <v-card
-      elevation="0"
-  >
-    <!--  卡片顶部功能区  -->
-    <v-card-title>
-      配置界面
-      <v-spacer></v-spacer>
-      <v-text-field
-        v-model="search"
-        append-icon="mdi-magnify"
-        label="搜索"
-        single-line
-        hide-details
-      ></v-text-field>
-      <v-spacer></v-spacer>
-      <v-btn
-          color="primary"
-          dark
-          class="mb-2"
-          @click="dialog = true"
-          elevation="0"
-      >
-        新建
-      </v-btn>
-      <v-spacer></v-spacer>
-      <v-btn
-          color="primary"
-          dark
-          class="mb-2"
-          @click="get"
-          elevation="0"
-      >
-        刷新
-      </v-btn>
-    </v-card-title>
-
-    <!--  新增、更新框  -->
-    <v-dialog
-        v-model="dialog"
-        max-width="500px"
-    >
-      <v-card>
-        <v-card-title>
-          <span class="headline">{{ formTitle }}</span>
-        </v-card-title>
-
-        <v-card-text>
-          <v-container>
-            <v-row>
-              <v-col cols="12" sm="6" md="6">
-                <v-text-field type="number" v-model="editedItem.ts" label="Ts"></v-text-field>
-              </v-col>
-              <v-col cols="12" sm="6" md="6">
-                <v-text-field v-model="editedItem.type" label="Type"></v-text-field>
-              </v-col>
-              <v-col cols="12" sm="6" md="12">
-                <v-text-field v-model="editedItem.hs" label="Hash"></v-text-field>
-              </v-col>
-              <v-col cols="12" sm="12" md="12">
-                <v-textarea outlined v-model="editedItem.o" label="Origin"></v-textarea>
-              </v-col>
-            </v-row>
-          </v-container>
-        </v-card-text>
-
-        <v-card-actions>
-          <v-spacer></v-spacer>
-          <v-btn
-              color="blue darken-1"
-              text
-              @click="close"
-          >
-            取消
-          </v-btn>
-          <v-btn
-              color="blue darken-1"
-              text
-              @click="save"
-          >
-            保存
-          </v-btn>
-        </v-card-actions>
-      </v-card>
-    </v-dialog>
-    <!-- 删除确定框 -->
-    <v-dialog v-model="dialogDelete" max-width="500px">
-      <v-card>
-        <v-card-title class="headline">你要删掉它吗?</v-card-title>
-        <v-card-actions>
-          <v-spacer></v-spacer>
-          <v-btn color="blue darken-1" text @click="closeDelete">取消</v-btn>
-          <v-btn color="blue darken-1" text @click="deleteItemConfirm">确定</v-btn>
-          <v-spacer></v-spacer>
-        </v-card-actions>
-      </v-card>
-    </v-dialog>
-
-    <!-- 数据表格 -->
-    <v-data-table
-      dense
-      hide-default-footer
-      multi-sort
-      :headers="headers"
-      :items="tableData"
-      :search="search"
-      :items-per-page="10000"
-      :loading="loading"
-      :sort-by="['ts', 'block', 'nonce']"
-      :sort-desc="[true, true, true]"
-    >
-      <template v-slot:item.ts="{ item }">
-        {{ getTime(item.ts) }}
-      </template>
-      <!-- Hash -->
-      <template v-slot:item.hs="{ item }">
-        <v-tooltip right>
-          <template v-slot:activator="{ on, attrs }">
-            <v-btn small :href="'https://etherscan.io/tx/' + item.hs" target="_blank" text v-on="on" v-bind="attrs">{{ getSimpleStr(item.hs) }}</v-btn>
-          </template>
-          <span>{{ item.hs }}</span>
-        </v-tooltip>
-      </template>
-      <template v-slot:item.actions="{ item }">
-        <v-icon
-            small
-            class="mr-2"
-            @click="editItem(item)"
-        >
-          mdi-pencil
-        </v-icon>
-        <v-icon
-            small
-            @click="deleteItem(item)"
-        >
-          mdi-delete
-        </v-icon>
-      </template>
-    </v-data-table>
-
-    <v-snackbar centered top
-                v-model="snackbar.visible"
-                :timeout="snackbar.timeout" :color="snackbar.color">
-      <v-icon left>{{ snackbar.icon }}</v-icon>
-      {{ snackbar.msg }}
-    </v-snackbar>
-  </v-card>
-</template>
-
-<script>
-import axios from 'axios'
-
-export default {
-  name: 'Config',
-
-  methods: {
-    // 时间戳转换chart时间
-    getTime (timestamp) {
-      // 组织日期格式并返回
-      return this.dateFormat('YYYY-mm-dd HH:MM:SS:sss', new Date(timestamp * 1000))
-    },
-    // 时间格式化
-    dateFormat(fmt, date) {
-      let ret;
-      const opt = {
-        "Y+": date.getFullYear().toString(),        // 年
-        "m+": (date.getMonth() + 1).toString(),     // 月
-        "d+": date.getDate().toString(),            // 日
-        "H+": date.getHours().toString(),           // 时
-        "M+": date.getMinutes().toString(),         // 分
-        "S+": date.getSeconds().toString(),         // 秒
-        "s+": date.getMilliseconds().toString()     // 毫秒
-        // 有其他格式化字符需求可以继续添加,必须转化成字符串
-      };
-      for (let k in opt) {
-        ret = new RegExp("(" + k + ")").exec(fmt);
-        if (ret) {
-          fmt = fmt.replace(ret[1], (ret[1].length === 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0")))
-        }
-      }
-      return fmt;
-    },
-    // 取字符串开头8位与最后四位
-    getSimpleStr (str) {
-      if (str && str.indexOf('x') !== -1) {
-        return str.substr(0, 7) + '...' + str.substr(-4)
-      } else {
-        return ''
-      }
-    },
-    // 跳转到指定地址
-    jump (pairAddress) {
-      window.open('https://etherscan.io/address/' + pairAddress)
-    },
-
-    // 编辑项
-    editItem (item) {
-      this.editedIndex = this.tableData.indexOf(item)
-      this.editedItem = Object.assign({}, item)
-      this.dialog = true
-    },
-
-    // 删除项
-    deleteItem (item) {
-      this.editedIndex = this.tableData.indexOf(item)
-      this.editedItem = Object.assign({}, item)
-      this.dialogDelete = true
-    },
-
-    // 删除前确认
-    async deleteItemConfirm () {
-      this.loading = true
-      const { data: rst } = await axios.get(this.url + '/config/delete', { params: {
-        hs: this.tableData[this.editedIndex].hs
-      }})
-      this.loading = false
-
-      if (rst.state) {
-        this.tableData.splice(this.editedIndex, 1)
-
-        this.closeDelete()
-        this.snackbarSuccess(rst.msg)
-      } else {
-        this.snackbarFail(rst.msg)
-      }
-    },
-
-    close () {
-      this.dialog = false
-      this.$nextTick(() => {
-        this.editedItem = Object.assign({}, this.defaultItem)
-        this.editedIndex = -1
-      })
-    },
-
-    closeDelete () {
-      this.dialogDelete = false
-      this.$nextTick(() => {
-        this.editedItem = Object.assign({}, this.defaultItem)
-        this.editedIndex = -1
-      })
-    },
-
-    // 新增项
-    async save () {
-      this.editedItem.o = this.editedItem.o.replaceAll('[', '【').replaceAll(']', '】')
-      this.loading = true
-
-      if (this.editedIndex > -1) {
-        const { data: rst } = await axios.get('/config/update', { params: this.editedItem })
-
-        if (rst.state) {
-          Object.assign(this.tableData[this.editedIndex], rst.data)
-          this.snackbarSuccess(rst.msg)
-
-          this.close()
-        } else {
-          this.snackbarFail(rst.msg)
-        }
-      } else {
-        const { data: rst } = await axios.get('/config/add', { params: this.editedItem })
-
-        if (rst.state) {
-          this.tableData.push(rst.data)
-          this.snackbarSuccess(rst.msg)
-
-          this.close()
-        } else {
-          this.snackbarFail(rst.msg)
-        }
-      }
-      this.loading = false
-    },
-
-    // 拉取项目
-    async get () {
-      this.loading = true
-      const { data: rst } = await this.$http.get('/config/get')
-
-      if (rst.state) {
-        this.tableData = rst.data.list
-        this.snackbarSuccess(rst.msg)
-      } else {
-        this.snackbarFail(rst.msg)
-      }
-      this.loading = false
-    },
-
-    snackbarSuccess (msg, timeout = 2000) {
-      this.snackbar.msg = msg
-      this.snackbar.visible = true
-      this.snackbar.timeout = timeout
-      this.snackbar.icon = 'mdi-check-circle-outline'
-      this.snackbar.color = 'teal'
-    },
-
-    snackbarFail (msg, timeout = 2000) {
-      this.snackbar.msg = msg
-      this.snackbar.visible = true
-      this.snackbar.timeout = timeout
-      this.snackbar.icon = 'mdi-alert-octagram-outline'
-      this.snackbar.color = 'purple'
-    }
-  },
-
-  data: () => ({
-    query: {},
-
-    search: '',
-
-    loading: false,
-
-    headers: [
-      { text: 'Save Time', value: 'ts' },
-      { text: '类型', value: 'type' },
-      { text: 'Hash', value: 'hs' },
-      { text: '  ', value: 'o' },
-      { text: '操作', value: 'actions' }
-    ],
-
-    tableData: [],
-
-    dialog: false,
-
-    dialogDelete: false,
-
-    editedIndex: -1,
-
-    editedItem: {
-      ts: 0,
-      hs: '',
-      type: '',
-      o: ''
-    },
-
-    defaultItem: {
-      ts: 0,
-      hs: '',
-      type: '',
-      o: ''
-    },
-
-    url: 'http://410eth.com',
-
-    snackbar: {
-      msg: '嗯哼?',
-      visible: false,
-      timeout: 2000,
-      color: 'green',
-      icon: ''
-    }
-  }),
-
-  computed: {
-    formTitle () {
-      return this.editedIndex === -1 ? 'New Item' : 'Edit Item'
-    },
-  },
-
-  mounted() {
-    this.get()
-  }
-}
-</script>

+ 72 - 163
src/components/History.vue

@@ -4,26 +4,14 @@
   >
     <v-container>
       <v-row>
-        <!-- Start Time过滤 -->
+        <!-- block过滤 -->
         <v-col
             cols="18"
             md="2"
         >
           <v-text-field
-              v-model="query.t1_str"
-              label="Start Time(YYYY/mm/DD HH:MM:SS)"
-              required
-          ></v-text-field>
-        </v-col>
-
-        <!-- End Time过滤 -->
-        <v-col
-            cols="18"
-            md="2"
-        >
-          <v-text-field
-              v-model="query.t2_str"
-              label="End Time(YYYY/mm/DD HH:MM:SS)"
+              v-model="query.block"
+              label="BlockNumber"
               required
           ></v-text-field>
         </v-col>
@@ -34,44 +22,20 @@
             md="2"
         >
           <v-text-field
-              v-model="query.hs"
+              v-model="query.hash"
               label="Hash"
               required
           ></v-text-field>
         </v-col>
 
-        <!-- From -->
-        <v-col
-            cols="18"
-            md="2"
-        >
-          <v-text-field
-              v-model="query.fm"
-              label="From"
-              required
-          ></v-text-field>
-        </v-col>
-
-        <!-- To -->
-        <v-col
-            cols="18"
-            md="2"
-        >
-          <v-text-field
-              v-model="query.t"
-              label="To"
-              required
-          ></v-text-field>
-        </v-col>
-
-        <!-- State -->
+        <!-- data过滤 -->
         <v-col
             cols="18"
-            md="1"
+            md="6"
         >
           <v-text-field
-              v-model="query.state"
-              label="State"
+              v-model="query.dataVague"
+              label="Data"
               required
           ></v-text-field>
         </v-col>
@@ -80,7 +44,7 @@
             cols="18"
             md="1"
         >
-          <v-btn outlined tile color="primary" @click="getRecord">
+          <v-btn outlined x-large tile color="primary" @click="pullData">
             <v-icon left>mdi-cloud-search-outline</v-icon>
             Search
           </v-btn>
@@ -97,7 +61,7 @@
         <v-text-field
             v-model="search"
             append-icon="mdi-magnify"
-            label="Search"
+            label="Local Search"
             single-line
             hide-details
         ></v-text-field>
@@ -115,37 +79,15 @@
         :sort-by="['ts', 'block', 'nonce']"
         :sort-desc="[true, true, true]"
       >
-        <template v-slot:item.ts="{ item }">
-          {{ getTime(item.ts) }}
-        </template>
-        <!-- Type -->
-        <template v-slot:item.type="{ item }">
-          <v-chip small v-if="item.o.type.indexOf('err') !== -1" outlined label color="grey">
-            <v-icon small left>mdi-filter-remove</v-icon>
-            {{ item.o.type.split(':')[1] }}
-          </v-chip>
-          <v-chip small v-else-if="item.o.type.indexOf('WARN') !== -1" outlined label color="red lighten-2">
-            <v-icon small left>mdi-alert-circle-outline</v-icon>
-            {{ item.o.type.split(':')[1] }}
-          </v-chip>
-          <v-chip small v-else-if="item.o.type.indexOf('DS:') !== -1" outlined label color="cyan darken-3">
-            <v-icon small left>mdi-horse-human</v-icon>
-            {{ item.o.type.split(':')[1] }}
-          </v-chip>
-          <v-chip small v-else-if="item.o.type.indexOf('CASH') !== -1" outlined label color="black">
-            <v-icon small left>mdi-currency-usd</v-icon>
-            {{ item.o.type.split(':')[1] }}
-          </v-chip>
-          <v-chip small v-else-if="item.o.type.indexOf('ZIJI') !== -1" outlined label color="blue">
-            <v-icon small left>mdi-panda</v-icon>
-            {{ item.o.type.split(':')[1] }}
-          </v-chip>
+        <!-- Block -->
+        <template v-slot:item.block="{ item }">
+          {{ item.block }}
         </template>
         <!-- Hash -->
-        <template v-slot:item.hs="{ item }">
+        <template v-slot:item.hash="{ item }">
           <v-tooltip right>
             <template v-slot:activator="{ on, attrs }">
-              <v-btn small :href="'https://etherscan.io/tx/' + item.hs" target="_blank" text v-on="on" v-bind="attrs">{{ getSimpleStr(item.hs) }}</v-btn>
+              <v-btn 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.hs }}</span>
           </v-tooltip>
@@ -159,60 +101,39 @@
 <!--            <span>{{ item.fm }}</span>-->
 <!--          </v-tooltip>-->
 <!--        </template>-->
-        <!-- Address -->
-        <template v-slot:item.symbolAddress="{ item }">
-          <v-tooltip right>
-            <template v-slot:activator="{ on, attrs }">
-              <v-btn small :href="'https://etherscan.io/address/' + item.symbolAddress" target="_blank" text v-on="on" v-bind="attrs">{{ getSimpleStr(item.symbolAddress) }}</v-btn>
-            </template>
-            <span>{{ item.symbolAddress }}</span>
-          </v-tooltip>
-        </template>
-        <!-- Gas -->
-        <template v-slot:item.o="{ item }">
-          {{ item.o.gas }}
-        </template>
-        <!-- 利润 -->
-        <template v-slot:item.profit="{ item }">
-          {{ item.o.profit }}
-        </template>
-        <!-- Block -->
-        <template v-slot:item.block="{ item }">
-          {{ item.o.blockNumber }}
-        </template>
         <!-- Nonce -->
-        <template v-slot:item.nonce="{ item }">
-          {{ item.o.nonce }}
-        </template>
-        <!-- origin -->
-        <template v-slot:item.origin>
-          {{ '' }}
-        </template>
-        <!-- State -->
-        <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>
-        <!-- Amount -->
-        <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>
+<!--        <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>
   </v-card>
@@ -258,26 +179,20 @@
           return ''
         }
       },
-      async getRecord () {
-        let url = '/data/getRecord'
+      async pullData () {
+        let url = '/ethmev/findByHashOrBlockOrDataVague'
 
         this.tableData.length = 0
         this.loading = true
-        this.query.t1 = this.query.t1_str ? this.dateToTimestamp(this.query.t1_str) : ''
-        this.query.t2 = this.query.t2_str ? this.dateToTimestamp(this.query.t2_str) : ''
-        const data = await axios.get(url, { params: this.query })
 
-        data.data.data.map(function (one) {
-          one.origin = one.o
-          one.o = JSON.parse(one.o.replaceAll("'", '"'))
-          one.blockNumber = one.o.blockNumber
-          one.gas = one.o.gas
-          one.nonce = one.o.nonce
-          one.profit = one.o.profit
-          one.symbolAddress = one.o.symbolAddress
-        })
+        const rst = await this.$http.post(url, this.query)
+
+        this.tableData = rst.data.data
+
+        // this.tableData.map(function (one) {
+        //   one.data = JSON.parse(one.data)
+        // })
 
-        this.tableData = data.data.data
         this.loading = false
       },
       dateToTimestamp (str) {
@@ -294,38 +209,32 @@
 
     data: () => ({
       query: {
-        t1: '',
-        t1_str: '',
-        t2: '',
-        t2_str: '',
-        fm: '',
-        t: '',
-        state: '',
-        hs: ''
+        block: '',
+        hash: '',
+        dataVague: ''
       },
       search: '',
       loading: false,
       headers: [
-        { text: 'Save Time', value: 'ts' },
+        { text: 'block', value: 'block' },
         // { text: 'Sender', value: 'fm' },
-        { text: '类型', value: 'type' },
-        { text: 'Symbol', value: 'symbolAddress' },
-        { text: '交易数量', value: 'amount' },
-        { text: '利润', value: 'profit' },
-        { text: 'Gas', value: 'gas' },
-        { text: '状态', value: 'state' },
-        { text: 'BlockNumber', value: 'blockNumber' },
-        { text: 'Nonce', value: 'nonce' },
-        { text: 'Hash', value: 'hs' },
-        { text: '  ', value: 'origin' }
+        { text: 'hash', value: 'hash' },
+        { text: 'data', value: 'data' },
+        // { text: '交易数量', value: 'amount' },
+        // { text: '利润', value: 'profit' },
+        // { text: 'Gas', value: 'gas' },
+        // { text: '状态', value: 'state' },
+        // { text: 'BlockNumber', value: 'blockNumber' },
+        // { text: 'Nonce', value: 'nonce' },
+        // { text: 'Hash', value: 'hs' },
+        // { text: '  ', value: 'origin' }
       ],
       history: {"data":[{"t":"0x8a2a17e7adb6cbf6635380a35c04c01db473ed5ca919706f1c492d3aa1d9f1a9","fm":"0x6ff6f16a2459114fad74eed1604b402b97b02717","hs":"0x8a2a17e7adb6cbf6635380a35c04c01db473ed5ca919706f1c492d3aa1d9f1a9","state":"ok","ts":1602503469,"o":"{'type': 'NO TOKEN', 'intoken': 'WETH', 'outtoken': false, 'inamount': 0.314674952033383, 'outamount': 48953401866254456333, 'symbol': false, 'gas': 56.100000233, 'profit': 0, 'balance': 0, 'stocks': 0, 'decimals': 18, 'symbolAddress': '0x054f76beed60ab6dbeb23502178c52d6c5debe40', 'pairAddress': false, 'from': '0x6ff6f16a2459114fad74eed1604b402b97b02717', 'to': '0x8a2a17e7adb6cbf6635380a35c04c01db473ed5ca919706f1c492d3aa1d9f1a9', 'hs': '0x8a2a17e7adb6cbf6635380a35c04c01db473ed5ca919706f1c492d3aa1d9f1a9'}"}],"count":1,"state":"ok"},
       tableData: []
     }),
 
-    mounted() {
-      this.query.t2_str = '2099/1/1 0:0:0'
-      this.query.t1_str = this.dateFormat('YYYY/mm/dd HH:MM:SS', new Date(new Date().getTime() - 10 * 60 * 1000))
+    async mounted () {
+      await this.pullData()
     }
   }
 </script>

+ 0 - 352
src/components/My.vue

@@ -1,352 +0,0 @@
-<template>
-  <v-card
-      elevation="1"
-  >
-    <v-container>
-      <v-row>
-        <!-- Start Time过滤 -->
-        <v-col
-            cols="18"
-            md="2"
-        >
-          <v-text-field
-              v-model="query.t1_str"
-              label="Start Time(YYYY/mm/DD HH:MM:SS)"
-              required
-          ></v-text-field>
-        </v-col>
-
-        <!-- End Time过滤 -->
-        <v-col
-            cols="18"
-            md="2"
-        >
-          <v-text-field
-              v-model="query.t2_str"
-              label="End Time(YYYY/mm/DD HH:MM:SS)"
-              required
-          ></v-text-field>
-        </v-col>
-
-        <!-- hash过滤 -->
-        <v-col
-            cols="18"
-            md="2"
-        >
-          <v-text-field
-              v-model="query.hs"
-              label="Hash"
-              required
-          ></v-text-field>
-        </v-col>
-
-        <!-- From -->
-        <v-col
-            cols="18"
-            md="2"
-        >
-          <v-text-field
-              v-model="query.fm"
-              label="From"
-              required
-          ></v-text-field>
-        </v-col>
-
-        <!-- To -->
-        <v-col
-            cols="18"
-            md="2"
-        >
-          <v-text-field
-              v-model="query.t"
-              label="To"
-              required
-          ></v-text-field>
-        </v-col>
-
-        <!-- State -->
-        <v-col
-            cols="18"
-            md="1"
-        >
-          <v-text-field
-              v-model="query.state"
-              label="State"
-              required
-          ></v-text-field>
-        </v-col>
-
-        <v-col
-            cols="18"
-            md="1"
-        >
-          <v-btn outlined tile color="primary" @click="searchData">
-            <v-icon left>mdi-cloud-search-outline</v-icon>
-            Search
-          </v-btn>
-        </v-col>
-      </v-row>
-    </v-container>
-
-    <v-card
-      elevation="0"
-    >
-      <v-card-title>
-        My Data
-        <v-spacer></v-spacer>
-        <v-text-field
-            v-model="search"
-            append-icon="mdi-magnify"
-            label="Search"
-            single-line
-            hide-details
-        ></v-text-field>
-      </v-card-title>
-
-      <v-data-table
-        dense
-        hide-default-footer
-        multi-sort
-        :headers="headers"
-        :items="tableData"
-        :search="search"
-        :items-per-page="10000"
-        :loading="loading"
-        :sort-by="['ts', 'block', 'nonce']"
-        :sort-desc="[true, true, true]"
-      >
-        <template v-slot:item.ts="{ item }">
-          {{ getTime(item.ts) }}
-        </template>
-        <!-- Type -->
-        <template v-slot:item.type="{ item }">
-          <v-chip small v-if="item.o.type.indexOf('err') !== -1" outlined label color="grey">
-            <v-icon small left>mdi-filter-remove</v-icon>
-            {{ item.o.type.split(':')[1] }}
-          </v-chip>
-          <v-chip small v-else-if="item.o.type.indexOf('WARN') !== -1" outlined label color="red lighten-2">
-            <v-icon small left>mdi-alert-circle-outline</v-icon>
-            {{ item.o.type.split(':')[1] }}
-          </v-chip>
-          <v-chip small v-else-if="item.o.type.indexOf('DS:') !== -1" outlined label color="cyan darken-3">
-            <v-icon small left>mdi-horse-human</v-icon>
-            {{ item.o.type.split(':')[1] }}
-          </v-chip>
-          <v-chip small v-else-if="item.o.type.indexOf('CASH') !== -1" outlined label color="black">
-            <v-icon small left>mdi-currency-usd</v-icon>
-            {{ item.o.type.split(':')[1] }}
-          </v-chip>
-          <v-chip small v-else-if="item.o.type.indexOf('ZIJI') !== -1" outlined label color="blue">
-            <v-icon small left>mdi-panda</v-icon>
-            {{ item.o.type.split(':')[1] }}
-          </v-chip>
-        </template>
-        <!-- Hash -->
-        <template v-slot:item.hs="{ item }">
-          <v-tooltip right>
-            <template v-slot:activator="{ on, attrs }">
-              <v-btn small :href="'https://etherscan.io/tx/' + item.hs" target="_blank" text v-on="on" v-bind="attrs">{{ getSimpleStr(item.hs) }}</v-btn>
-            </template>
-            <span>{{ item.hs }}</span>
-          </v-tooltip>
-        </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>-->
-        <!-- Address -->
-        <template v-slot:item.symbolAddress="{ item }">
-          <v-tooltip right>
-            <template v-slot:activator="{ on, attrs }">
-              <v-btn small :href="'https://etherscan.io/address/' + item.symbolAddress" target="_blank" text v-on="on" v-bind="attrs">{{ getSimpleStr(item.symbolAddress) }}</v-btn>
-            </template>
-            <span>{{ item.symbolAddress }}</span>
-          </v-tooltip>
-        </template>
-        <!-- Gas -->
-        <template v-slot:item.o="{ item }">
-          {{ item.o.gas }}
-        </template>
-        <!-- 利润 -->
-        <template v-slot:item.profit="{ item }">
-          {{ item.o.profit }}
-        </template>
-        <!-- Block -->
-        <template v-slot:item.block="{ item }">
-          {{ item.o.blockNumber }}
-        </template>
-        <!-- Nonce -->
-        <template v-slot:item.nonce="{ item }">
-          {{ item.o.nonce }}
-        </template>
-        <!-- origin -->
-        <template v-slot:item.origin>
-          {{ '' }}
-        </template>
-        <!-- State -->
-        <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>
-        <!-- Amount -->
-        <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>
-  </v-card>
-</template>
-
-<script>
-  import axios from 'axios'
-
-  export default {
-    name: 'History',
-
-    methods: {
-      // 时间戳转换chart时间
-      getTime (timestamp) {
-        // 组织日期格式并返回
-        return this.dateFormat('YYYY-mm-dd HH:MM:SS:sss', new Date(timestamp * 1000))
-      },
-      dateFormat(fmt, date) {
-        let ret;
-        const opt = {
-          "Y+": date.getFullYear().toString(),        // 年
-          "m+": (date.getMonth() + 1).toString(),     // 月
-          "d+": date.getDate().toString(),            // 日
-          "H+": date.getHours().toString(),           // 时
-          "M+": date.getMinutes().toString(),         // 分
-          "S+": date.getSeconds().toString(),         // 秒
-          "s+": date.getMilliseconds().toString()     // 毫秒
-          // 有其他格式化字符需求可以继续添加,必须转化成字符串
-        };
-        for (let k in opt) {
-          ret = new RegExp("(" + k + ")").exec(fmt);
-          if (ret) {
-            fmt = fmt.replace(ret[1], (ret[1].length === 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0")))
-          }
-        }
-        return fmt;
-      },
-      // 最后四位
-      getSimpleStr (str) {
-        if (str && str.indexOf('x') !== -1) {
-          return str.substr(0, 7) + '...' + str.substr(-4)
-        } else {
-          return ''
-        }
-      },
-      async getRecord () {
-        let url = '/data/getRecordByMySelf'
-        this.loading = true
-        if (this.searched) {
-          this.query.t1 = this.query.t1_str ? this.dateToTimestamp(this.query.t1_str) : ''
-          this.query.t2 = this.query.t2_str ? this.dateToTimestamp(this.query.t2_str) : ''
-        }
-        const data = await axios.get(url, { params: this.query })
-        this.tableData.length = 0
-
-        data.data.data.map(function (one) {
-          one.origin = one.o
-          one.o = JSON.parse(one.o.replaceAll("'", '"'))
-          one.blockNumber = one.o.blockNumber
-          one.gas = one.o.gas
-          one.nonce = one.o.nonce
-          one.profit = one.o.profit
-          one.symbolAddress = one.o.symbolAddress
-        })
-
-        this.tableData = data.data.data
-        this.loading = false
-      },
-      dateToTimestamp (str) {
-        let [a, b] = str.split(' ')
-        let [year, month, day] = a.split('/')
-        let [hour, minute, second] = b.split(':')
-
-        return new Date(year, month - 1, day, hour, minute, second).getTime() / 1000
-      },
-      jump (pairAddress) {
-        window.open('https://etherscan.io/address/' + pairAddress)
-      },
-      searchData () {
-        this.searched = true
-        this.getRecord()
-        clearInterval(this.intervalID)
-      }
-    },
-
-    data: () => ({
-      query: {
-        t1: '',
-        t1_str: '',
-        t2: '',
-        t2_str: '',
-        fm: '',
-        t: '',
-        state: '',
-        hs: ''
-      },
-      search: '',
-      loading: false,
-      headers: [
-        { text: 'Save Time', value: 'ts' },
-        // { text: 'Sender', value: 'fm' },
-        { text: '类型', value: 'type' },
-        { text: 'Symbol', value: 'symbolAddress' },
-        { text: '交易数量', value: 'amount' },
-        { text: '利润', value: 'profit' },
-        { text: 'Gas', value: 'gas' },
-        { text: '状态', value: 'state' },
-        { text: 'BlockNumber', value: 'blockNumber' },
-        { text: 'Nonce', value: 'nonce' },
-        { text: 'Hash', value: 'hs' },
-        { text: '  ', value: 'origin' }
-      ],
-      history: {"data":[{"t":"0x8a2a17e7adb6cbf6635380a35c04c01db473ed5ca919706f1c492d3aa1d9f1a9","fm":"0x6ff6f16a2459114fad74eed1604b402b97b02717","hs":"0x8a2a17e7adb6cbf6635380a35c04c01db473ed5ca919706f1c492d3aa1d9f1a9","state":"ok","ts":1602503469,"o":"{'type': 'NO TOKEN', 'intoken': 'WETH', 'outtoken': false, 'inamount': 0.314674952033383, 'outamount': 48953401866254456333, 'symbol': false, 'gas': 56.100000233, 'profit': 0, 'balance': 0, 'stocks': 0, 'decimals': 18, 'symbolAddress': '0x054f76beed60ab6dbeb23502178c52d6c5debe40', 'pairAddress': false, 'from': '0x6ff6f16a2459114fad74eed1604b402b97b02717', 'to': '0x8a2a17e7adb6cbf6635380a35c04c01db473ed5ca919706f1c492d3aa1d9f1a9', 'hs': '0x8a2a17e7adb6cbf6635380a35c04c01db473ed5ca919706f1c492d3aa1d9f1a9'}"}],"count":1,"state":"ok"},
-      tableData: [],
-      intervalID: 0,
-      searched: false
-    }),
-
-    mounted() {
-      this.query.t2_str = '2099/1/1 0:0:0'
-      this.query.t1_str = this.dateFormat('YYYY/mm/dd HH:MM:SS', new Date(new Date().getTime() - 10 * 60 * 1000))
-
-      const app = this
-
-      app.query.t1 = parseInt(((new Date().getTime()) / 1000 - 2 * 60) + '')
-      app.getRecord()
-
-      app.intervalID = setInterval(function () {
-        if (!app.loading) {
-          app.query.t1 = parseInt(((new Date().getTime()) / 1000) + '')
-          app.getRecord()
-        }
-      }, 10 * 1000)
-    }
-  }
-</script>
-cl

+ 0 - 235
src/components/New.vue

@@ -1,235 +0,0 @@
-<template>
-  <v-card
-      elevation="1"
-  >
-    <v-card
-        elevation="0"
-    >
-      <v-card-title>
-        New Data
-        <v-spacer></v-spacer>
-        <v-text-field
-            v-model="search"
-            append-icon="mdi-magnify"
-            label="Search"
-            single-line
-            hide-details
-        ></v-text-field>
-      </v-card-title>
-
-      <v-data-table
-        dense
-        hide-default-footer
-        multi-sort
-        :headers="headers"
-        :items="tableData"
-        :search="search"
-        :items-per-page="10000"
-        :loading="loading"
-        :sort-by="['ts', 'block', 'nonce']"
-        :sort-desc="[true, true, true]"
-      >
-        <template v-slot:item.ts="{ item }">
-          {{ getTime(item.ts) }}
-        </template>
-        <!-- Type -->
-        <template v-slot:item.type="{ item }">
-          <v-chip small v-if="item.o.type.indexOf('err') !== -1" outlined label color="grey">
-            <v-icon small left>mdi-filter-remove</v-icon>
-            {{ item.o.type.split(':')[1] }}
-          </v-chip>
-          <v-chip small v-else-if="item.o.type.indexOf('WARN') !== -1" outlined label color="red lighten-2">
-            <v-icon small left>mdi-alert-circle-outline</v-icon>
-            {{ item.o.type.split(':')[1] }}
-          </v-chip>
-          <v-chip small v-else-if="item.o.type.indexOf('DS:') !== -1" outlined label color="cyan darken-3">
-            <v-icon small left>mdi-horse-human</v-icon>
-            {{ item.o.type.split(':')[1] }}
-          </v-chip>
-          <v-chip small v-else-if="item.o.type.indexOf('CASH') !== -1" outlined label color="black">
-            <v-icon small left>mdi-currency-usd</v-icon>
-            {{ item.o.type.split(':')[1] }}
-          </v-chip>
-          <v-chip small v-else-if="item.o.type.indexOf('ZIJI') !== -1" outlined label color="blue">
-            <v-icon small left>mdi-panda</v-icon>
-            {{ item.o.type.split(':')[1] }}
-          </v-chip>
-        </template>
-        <!-- Hash -->
-        <template v-slot:item.hs="{ item }">
-          <v-tooltip right>
-            <template v-slot:activator="{ on, attrs }">
-              <v-btn small :href="'https://etherscan.io/tx/' + item.hs" target="_blank" text v-on="on" v-bind="attrs">{{ getSimpleStr(item.hs) }}</v-btn>
-            </template>
-            <span>{{ item.hs }}</span>
-          </v-tooltip>
-        </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>-->
-        <!-- Address -->
-        <template v-slot:item.symbolAddress="{ item }">
-          <v-tooltip right>
-            <template v-slot:activator="{ on, attrs }">
-              <v-btn small :href="'https://etherscan.io/address/' + item.symbolAddress" target="_blank" text v-on="on" v-bind="attrs">{{ getSimpleStr(item.symbolAddress) }}</v-btn>
-            </template>
-            <span>{{ item.symbolAddress }}</span>
-          </v-tooltip>
-        </template>
-        <!-- 利润 -->
-        <template v-slot:item.profit="{ item }">
-          {{ item.o.profit }}
-        </template>
-        <!-- origin -->
-        <template v-slot:item.origin  >
-          {{ '' }}
-        </template>
-        <!-- State -->
-        <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>
-        <!-- Amount -->
-        <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>
-  </v-card>
-</template>
-
-<script>
-import axios from 'axios'
-
-export default {
-  name: 'History',
-
-  methods: {
-    // 时间戳转换chart时间
-    getTime (timestamp) {
-      // 组织日期格式并返回
-      return this.dateFormat('YYYY-mm-dd HH:MM:SS:sss', new Date(timestamp * 1000))
-    },
-    dateFormat(fmt, date) {
-      let ret;
-      const opt = {
-        "Y+": date.getFullYear().toString(),        // 年
-        "m+": (date.getMonth() + 1).toString(),     // 月
-        "d+": date.getDate().toString(),            // 日
-        "H+": date.getHours().toString(),           // 时
-        "M+": date.getMinutes().toString(),         // 分
-        "S+": date.getSeconds().toString(),         // 秒
-        "s+": date.getMilliseconds().toString()     // 毫秒
-        // 有其他格式化字符需求可以继续添加,必须转化成字符串
-      };
-      for (let k in opt) {
-        ret = new RegExp("(" + k + ")").exec(fmt);
-        if (ret) {
-          fmt = fmt.replace(ret[1], (ret[1].length === 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0")))
-        }
-      }
-      return fmt;
-    },
-    // 最后四位
-    getSimpleStr (str) {
-      if (str && str.indexOf('x') !== -1) {
-        return str.substr(0, 7) + '...' + str.substr(-4)
-      } else {
-        return ''
-      }
-    },
-    async getRecord () {
-      let url = '/data/getRecord'
-      this.loading = true
-      const app = this
-      const data = await axios.get(url, { params: this.query })
-      this.tableData = []
-
-      data.data.data.map(function (one) {
-        if (one.state === 'cancel') {
-          return
-        }
-        one.origin = one.o
-        one.o = JSON.parse(one.o.replaceAll("'", '"'))
-        one.blockNumber = one.o.blockNumber
-        one.gas = one.o.gas
-        one.nonce = one.o.nonce
-        one.profit = one.o.profit
-        one.symbolAddress = one.o.symbolAddress
-
-        app.tableData.push(one)
-      })
-
-      this.loading = false
-    },
-    jump (pairAddress) {
-      window.open('https://etherscan.io/address/' + pairAddress)
-    }
-  },
-
-  data: () => ({
-    query: {
-      t1: '',
-      t2: '',
-      fm: '',
-      t: '',
-      state: '',
-      hs: ''
-    },
-    search: '',
-    loading: false,
-    headers: [
-      { text: 'Save Time', value: 'ts' },
-      // { text: 'Sender', value: 'fm' },
-      { text: '类型', value: 'type' },
-      { text: 'Symbol', value: 'symbolAddress' },
-      { text: '交易数量', value: 'amount' },
-      { text: '利润', value: 'profit' },
-      { text: 'Gas', value: 'gas' },
-      { text: '状态', value: 'state' },
-      { text: 'BlockNumber', value: 'blockNumber' },
-      { text: 'Nonce', value: 'nonce' },
-      { text: 'Hash', value: 'hs' },
-      { text: '  ', value: 'origin' }
-    ],
-    history: {"data":[{"t":"0x8a2a17e7adb6cbf6635380a35c04c01db473ed5ca919706f1c492d3aa1d9f1a9","fm":"0x6ff6f16a2459114fad74eed1604b402b97b02717","hs":"0x8a2a17e7adb6cbf6635380a35c04c01db473ed5ca919706f1c492d3aa1d9f1a9","state":"ok","ts":1602503469,"o":"{'type': 'NO TOKEN', 'intoken': 'WETH', 'outtoken': false, 'inamount': 0.314674952033383, 'outamount': 48953401866254456333, 'symbol': false, 'gas': 56.100000233, 'profit': 0, 'balance': 0, 'stocks': 0, 'decimals': 18, 'symbolAddress': '0x054f76beed60ab6dbeb23502178c52d6c5debe40', 'pairAddress': false, 'from': '0x6ff6f16a2459114fad74eed1604b402b97b02717', 'to': '0x8a2a17e7adb6cbf6635380a35c04c01db473ed5ca919706f1c492d3aa1d9f1a9', 'hs': '0x8a2a17e7adb6cbf6635380a35c04c01db473ed5ca919706f1c492d3aa1d9f1a9'}"}],"count":1,"state":"ok"},
-    tableData: []
-  }),
-
-  mounted() {
-    const app = this
-
-    app.query.t1 = parseInt(((new Date().getTime()) / 1000 - 2 * 60) + '')
-    app.getRecord()
-
-    setInterval(function () {
-      if (!app.loading) {
-        app.query.t1 = parseInt(((new Date().getTime()) / 1000) + '')
-        app.getRecord()
-      }
-    }, 5 * 1000)
-  }
-}
-</script>

+ 24 - 8
src/plugins/axios.js

@@ -2,8 +2,10 @@
 
 import Vue from 'vue';
 import axios from "axios";
+import md5 from "md5-node"
+import qs from "qs"
 
-Vue.prototype.$http = axios
+// Vue.prototype.$http = axios
 
 axios.defaults.baseURL = process.env.VUE_APP_BASE_URL
 
@@ -11,9 +13,22 @@ axios.defaults.baseURL = process.env.VUE_APP_BASE_URL
 let config = {}
 const _axios = axios.create(config)
 
-_axios.interceptors.request.use(
+axios.interceptors.request.use(
     function(config) {
-      // Do something before request is sent
+      // auth
+      let timestamp = parseInt((new Date().getTime()) / 1000) + ''
+      let baseStr = '410410' + timestamp
+      let splitStrList = baseStr.split("")
+      let replacedStr = baseStr.replaceAll(splitStrList[splitStrList.length - 1], "")
+      let authStr = md5(replacedStr)
+
+      config.data.timestamp = timestamp
+      config.data.auth = authStr
+
+      // headers处理
+      config.headers['content-type'] = 'application/x-www-form-urlencoded'
+      config.data = qs.stringify(config.data)
+
       return config;
     },
     function(error) {
@@ -23,7 +38,7 @@ _axios.interceptors.request.use(
 );
 
 // Add a response interceptor
-_axios.interceptors.response.use(
+axios.interceptors.response.use(
     function(response) {
       // Do something with response data
       return response;
@@ -35,17 +50,18 @@ _axios.interceptors.response.use(
 );
 
 Plugin.install = function(Vue) {
-  Vue.axios = _axios;
-  window.axios = _axios;
+  Vue.axios = axios;
+  Vue.prototype.$http = axios;
+
   Object.defineProperties(Vue.prototype, {
     axios: {
       get() {
-        return _axios;
+        return axios;
       }
     },
     $axios: {
       get() {
-        return _axios;
+        return axios;
       }
     },
   });