baichun 5 years ago
parent
commit
1240471e71

+ 6 - 4
_src/mixins/login.js

@@ -1,7 +1,7 @@
 import api from '@/api'
 import { showError, getUrlParam, getMeechatType, openBlankWindow, getUserOpt, setUserOpt, getShowLoginTyps } from '@/util/util'
 import { mapActions, mapState, mapMutations } from 'vuex'
-import ScatterJS from 'scatter-js/dist/scatter.esm'
+import ScatterJS from 'scatterjs-core'
 import EthHelper from '@/util/ethHelper.js'
 import TronHelper from '@/util/tronHelper.js'
 import { Message } from 'element-ui'
@@ -57,7 +57,6 @@ export const accountLoginMixin = {
         this.curLoginType = getUserOpt('loginType') || 'eos'
 
         if ((this.curLoginType == 'eos' || this.curLoginType == 'meetone')) {
-          alert('checkLocalLogin succ')
           if (top === self) {
             await this.loginEosMeetoneCommon(this.curLoginType)
           } else {
@@ -149,6 +148,9 @@ export const accountLoginMixin = {
 
       return new Promise(async (resolve, reject) => {
         this.setLogining(true)
+        document.addEventListener('scatterLoaded', () => {
+          console.log('ScatterJS.scatter')
+        })
         // 连接scatter
         ScatterJS.scatter.connect('MEE_CHAT').then(async connected => {
           if (connected) {
@@ -159,7 +161,7 @@ export const accountLoginMixin = {
             window.ScatterJS = null
             if (getUserOpt('isChangeIndentity') == 1) {
               setUserOpt('isChangeIndentity', 0)
-              await (ScatterJS.scatter && ScatterJS.scatter.identity && ScatterJS.scatter.forgetIdentity && ScatterJS.scatter.forgetIdentity())
+              await (ScatterJS.scatter && ScatterJS.scatter.identity && ScatterJS.scatter.logout && ScatterJS.scatter.logout())
             }
 
             try {
@@ -191,7 +193,7 @@ export const accountLoginMixin = {
                 }
 
                 this.$store.commit('setAccount', '')
-                await (ScatterJS.scatter && ScatterJS.scatter.identity && ScatterJS.scatter.forgetIdentity && ScatterJS.scatter.forgetIdentity())
+                await (ScatterJS.scatter && ScatterJS.scatter.identity && ScatterJS.scatter.logout && ScatterJS.scatter.logout())
               }
             } catch (error) {
               this.$store.commit('setAccount', '')

+ 2 - 2
_src/mixins/user.js

@@ -2,7 +2,7 @@ import { mapState, mapMutations, mapActions } from 'vuex'
 import API from '@/api'
 import User from '@/store/db/User.js'
 import { setUserOpt, confirmPopup, openBlankWindow, getMeechatType, showError } from '@/util/util'
-import ScatterJS from 'scatter-js/dist/scatter.esm'
+import ScatterJS from 'scatterjs-core'
 import EthHelper from '@/util/ethHelper'
 import TronHelper from '@/util/tronHelper'
 
@@ -229,7 +229,7 @@ export const bindAccountMixins = {
         API.user.unBind({
           type
         }).then(() => {
-          if (type == 'eos') this.scatter && this.scatter.forgetIdentity && this.scatter.forgetIdentity()
+          if (type == 'eos') this.scatter && this.scatter.logout && this.scatter.logout()
 
           this.$showTips(this.$t('userinfo.unbindSuccess'))
           this.changeUserBinds({

+ 4 - 1
_src/pages/index/App.vue

@@ -16,7 +16,8 @@
 </template>
 
 <script>
-// import ScatterJS from 'scatter-js/dist/scatter.esm'
+import ScatterJS from 'scatterjs-core'
+import ScatterEOS from 'scatterjs-plugin-eosjs'
 import { getUrlParam, noticeManager } from '@/util/util.js'
 import { accountLoginMixin } from '@/mixins/login'
 import { mapState } from 'vuex'
@@ -24,6 +25,8 @@ import { mapState } from 'vuex'
 import loginBox from '@/components/login/loginBox'
 import panel from '@/components/panel/panel'
 
+ScatterJS.plugins(new ScatterEOS())
+
 export default {
   name: 'App',
   mixins: [accountLoginMixin],

+ 6 - 10
_src/store/actions.js

@@ -27,12 +27,10 @@ export const actions = {
 
       // 调用getIdentity方法获取用户名
       try {
-        var identity = await state.scatter.getIdentity({
+        var identity = await state.scatter.login({
           accounts: [networkConfig]
         })
-        alert('identity next')
       } catch (error) {
-        alert('identity error', error)
         if (error.type !== 'identity_rejected') {
           showError(error.message)
         }
@@ -99,12 +97,10 @@ export const actions = {
 
       // 调用getIdentity方法获取用户名
       try {
-        var identity = await state.scatter.getIdentity({
+        var identity = await state.scatter.login({
           accounts: [networkConfig]
         })
-        alert('identity next')
       } catch (error) {
-        alert('identity error', error)
         if (error.type !== 'identity_rejected') {
           showError(error.message)
         }
@@ -167,13 +163,13 @@ export const actions = {
       // 获取最快主网
       let networkConfig = await getNetwork()
       if (state.scatter.identity) {
-        await (state.scatter && state.scatter.forgetIdentity && state.scatter.forgetIdentity())
+        await (state.scatter && state.scatter.logout && state.scatter.logout())
       }
 
       setUserOpt('isChangeIndentity', 1)
       // 调用getIdentity方法获取用户名
       try {
-        var identity = await state.scatter.getIdentity({
+        var identity = await state.scatter.login({
           accounts: [networkConfig]
         })
       } catch (error) {
@@ -230,8 +226,8 @@ export const actions = {
     commit('setAccount', '')
     setUserOpt('isChangeIndentity', 0)
 
-    // return state.scatter && state.scatter.identity ? state.scatter.forgetIdentity && state.scatter.forgetIdentity() : true
-    return (state.scatter && state.scatter.identity && state.scatter.forgetIdentity && state.scatter.forgetIdentity()) || true
+    // return state.scatter && state.scatter.identity ? state.scatter.logout && state.scatter.logout() : true
+    return (state.scatter && state.scatter.identity && state.scatter.logout && state.scatter.logout()) || true
   },
 
   /**

+ 0 - 0
dist/css/chunk-vendors.56665762.css → dist/css/chunk-vendors.be5bb01d.css


File diff suppressed because it is too large
+ 0 - 0
dist/css/pc.e97306db.css


File diff suppressed because it is too large
+ 0 - 0
dist/js/chunk-335f5c5d.93ad0124.js


File diff suppressed because it is too large
+ 0 - 0
dist/js/chunk-335f5c5d.ae359ac3.js


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


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


File diff suppressed because it is too large
+ 0 - 0
dist/js/chunk-4be0e358.0134820c.js


File diff suppressed because it is too large
+ 0 - 0
dist/js/chunk-4be0e358.731c8795.js


File diff suppressed because it is too large
+ 0 - 0
dist/js/chunk-55ee6bb8.642b9d3f.js


File diff suppressed because it is too large
+ 0 - 0
dist/js/chunk-55ee6bb8.97044ced.js


File diff suppressed because it is too large
+ 0 - 0
dist/js/chunk-6aeec874.50a341d2.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-common.59254d0d.js


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


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


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


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


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


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


File diff suppressed because it is too large
+ 0 - 0
dist/js/pc.c2e72e45.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


+ 2 - 3
package.json

@@ -21,9 +21,8 @@
     "lodash": "^4.17.11",
     "number-precision": "^1.2.1",
     "qs": "^6.5.2",
-    "scatter-js": "^2.5.2",
-    "scatterjs-core": "^2.5.0",
-    "scatterjs-plugin-eosjs": "^1.4.0",
+    "scatterjs-core": "^2.7.18",
+    "scatterjs-plugin-eosjs": "^1.5.1",
     "twemoji": "^11.3.0",
     "vue": "^2.5.17",
     "vue-clipboard2": "^0.2.1",

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