Browse Source

build:new

baichun 5 years ago
parent
commit
78560b3cab

+ 11 - 22
_src/util/ethHelper.js

@@ -1,5 +1,5 @@
 import API from '@/api'
-import Web3 from 'web3'
+// import Web3 from 'web3'
 import { showError } from '@/util/util'
 
 let ethHelper = {
@@ -18,37 +18,26 @@ let ethHelper = {
       return Promise.reject(new Error(''))
     }
 
-    if (!this.isInitEth) {
-      if (window.ethereum) {
-        window.web3 = new Web3(window.ethereum)
-        try {
-          await window.ethereum.enable()
-        } catch (error) {
-        }
-      } else if (window.web3) {
-        window.web3 = new Web3(window.web3.currentProvider)
-      }
-
-      let networkType = await window.web3.eth.net.getNetworkType()
-      if (networkType != 'main') {
-        showError('eth不是主网')
-        return Promise.reject(new Error('eth不是主网'))
-      }
-
-      this.isInitEth = true
+    if (window.ethereum) {
+      await window.ethereum.enable()
     }
 
-    let accounts = await window.web3.eth.getAccounts()
+    // let networkType = await window.web3.eth.net.getNetworkType()
+    // if (networkType != 'main') {
+    //   showError('eth不是主网')
+    //   return Promise.reject(new Error('eth不是主网'))
+    // }
+
+    let accounts = window.web3.eth.accounts
     let account = this.account = accounts[0]
 
     if (account) {
       this.curAccount = account
       let randomRes = await API.user.getRandom2({ account: account })
-      let str = window.web3.utils.sha3(randomRes.data.data.random)
 
       return new Promise((resolve, reject) => {
         try {
-          window.web3.eth.sign(str, account, (err, rs) => {
+          window.web3.personal.sign(window.web3.fromUtf8(randomRes.data.data.random), window.web3.eth.coinbase, (err, rs) => {
             if (err) {
               reject(err)
             } else {

+ 0 - 0
dist/css/chunk-705f5170.735872c4.css → dist/css/chunk-6aeec874.735872c4.css


+ 0 - 0
dist/css/chunk-635cf4b6.feb38348.css → dist/css/chunk-a6830cb4.feb38348.css


+ 0 - 0
dist/css/chunk-vendors.98357f41.css → dist/css/chunk-vendors.56665762.css


+ 0 - 0
dist/css/mini.a8487b9d.css → dist/css/mini.7e846a75.css


File diff suppressed because it is too large
+ 0 - 0
dist/js/chunk-635cf4b6.7760e52e.js


File diff suppressed because it is too large
+ 0 - 0
dist/js/chunk-6aeec874.b858465d.js


File diff suppressed because it is too large
+ 0 - 0
dist/js/chunk-705f5170.c9d28d6b.js


File diff suppressed because it is too large
+ 0 - 0
dist/js/chunk-a6830cb4.32bb64a1.js


File diff suppressed because it is too large
+ 0 - 0
dist/js/chunk-common.c2007fed.js


File diff suppressed because it is too large
+ 0 - 0
dist/js/chunk-common.ce4ff231.js


File diff suppressed because it is too large
+ 0 - 0
dist/js/chunk-vendors.3e5894cf.js


File diff suppressed because it is too large
+ 0 - 0
dist/js/chunk-vendors.3fe669d1.js


File diff suppressed because it is too large
+ 0 - 0
dist/js/h5.5031f2f6.js


File diff suppressed because it is too large
+ 0 - 0
dist/js/mini.36b01880.js


File diff suppressed because it is too large
+ 0 - 0
dist/js/pc.74b1624a.js


File diff suppressed because it is too large
+ 0 - 0
dist/sw.js


File diff suppressed because it is too large
+ 0 - 0
mini.html


File diff suppressed because it is too large
+ 0 - 0
protected/views/h5.html


File diff suppressed because it is too large
+ 0 - 0
protected/views/pc.html


Some files were not shown because too many files changed in this diff