baichun 5 years ago
parent
commit
e4d3392e6c
37 changed files with 66 additions and 0 deletions
  1. 66 0
      _src/store/actions.js
  2. 0 0
      dist/css/chunk-2ae77270.6c05c7a7.css
  3. 0 0
      dist/css/chunk-3a7aa49c.484561d2.css
  4. 0 0
      dist/css/chunk-41737974.492bfa43.css
  5. 0 0
      dist/css/chunk-4a300287.95618aa0.css
  6. 0 0
      dist/css/chunk-57fc05d2.feb38348.css
  7. 0 0
      dist/css/chunk-587d9e67.621d2337.css
  8. 0 0
      dist/css/chunk-868985ce.7de37954.css
  9. 0 0
      dist/css/chunk-cc6720b0.6c4d2f2f.css
  10. 0 0
      dist/css/chunk-d94a81b0.1e2497e0.css
  11. 0 0
      dist/css/chunk-e141921e.0f0a0132.css
  12. 0 0
      dist/js/chunk-21bd4ca5.5edf431f.js
  13. 0 0
      dist/js/chunk-2ae77270.e46c08a1.js
  14. 0 0
      dist/js/chunk-3a7aa49c.23f972a0.js
  15. 0 0
      dist/js/chunk-3ab2e3e3.e83f44a7.js
  16. 0 0
      dist/js/chunk-41737974.a93aff4f.js
  17. 0 0
      dist/js/chunk-4a300287.71c4eeb4.js
  18. 0 0
      dist/js/chunk-57fc05d2.4d278541.js
  19. 0 0
      dist/js/chunk-587d9e67.b63ab5a9.js
  20. 0 0
      dist/js/chunk-5b86aac9.6cd73d35.js
  21. 0 0
      dist/js/chunk-5c065784.1ecea1c6.js
  22. 0 0
      dist/js/chunk-650cd7d0.4edc6889.js
  23. 0 0
      dist/js/chunk-868985ce.201b2bd7.js
  24. 0 0
      dist/js/chunk-a6830cb4.1ed61dfc.js
  25. 0 0
      dist/js/chunk-cc6720b0.6be9a91c.js
  26. 0 0
      dist/js/chunk-common.3a5b8c0a.js
  27. 0 0
      dist/js/chunk-common.c6acac60.js
  28. 0 0
      dist/js/chunk-d94a81b0.cfd6bc92.js
  29. 0 0
      dist/js/chunk-e141921e.925bedaf.js
  30. 0 0
      dist/js/h5.839fab26.js
  31. 0 0
      dist/js/h5.a887ff41.js
  32. 0 0
      dist/js/mini.f21d9370.js
  33. 0 0
      dist/js/pc.8f0590ca.js
  34. 0 0
      dist/sw.js
  35. 0 0
      mini.html
  36. 0 0
      protected/views/h5.html
  37. 0 0
      protected/views/pc.html

+ 66 - 0
_src/store/actions.js

@@ -27,6 +27,72 @@ export const actions = {
       let networkConfig = await getNetwork()
       let networkConfig = await getNetwork()
       alert('networkConfig next')
       alert('networkConfig next')
 
 
+      return new Promise((resolve, reject) => {
+        state.scatter.getIdentity({
+          accounts: [networkConfig]
+        }).then(async (identity) => {
+          let accounts = identity.accounts.find(x => x.blockchain === 'eos')
+
+          let lastAccounts = localStorage.getItem('accounts')
+
+          if (lastAccounts && JSON.parse(lastAccounts).name !== accounts.name) {
+            await actions.doScatterLogout(...arguments)
+            h5Router.push({ path: '/login' })
+            commit('setUserInfo', null)
+            commit('initChatData')
+            commit('initGroupData')
+            commit('chatAppLogin', false)
+            commit('toApp', false)
+          }
+
+          commit('setAccount', accounts)
+          localStorage.setItem('accounts', JSON.stringify(accounts))
+
+          // 如果当前登录的用户名和cookie中保存的account不一致
+          // 则删除cookie中保存的account
+          // 避免某些用户在移动端钱包中切换账号时跳过注销流程导致账号不一致的问题
+          // if (Cookie.getCookie('account') !== accounts.name) {
+          //   Cookie.delCookie('account')
+          // }
+          // 设置全局EOS对象
+          window.EOS = state.scatter.eos(networkConfig, Eos, {})
+
+          // 调用scatter登录成功后获取用户EOS、GT
+          // dispatch('getUserEOS')
+          // dispatch('getUserGT')
+          await dispatch('getAccount')
+
+          // 每分钟刷新一次
+          // this.limitTimer = setInterval(() => {
+          //   dispatch('getAccount')
+          // }, 60000)
+
+          resolve(true)
+        }).catch(e => {
+          reject(e)
+        })
+      })
+    }
+  },
+  /**
+   * 调起授权登录
+	 * @param {Object} store
+	 * @param {Object} params
+   */
+  async doScatterLoginCopy ({ dispatch, commit, state }, h5Router) {
+    if (!state.scatter) {
+      showError('Please install the scatter', 'Scatter')
+    } else {
+      if (getUserOpt('isChangeIndentity') == 1) {
+        await actions.doScatterLogout(...arguments)
+        localStorage.setItem('accounts', '')
+        setUserOpt('isChangeIndentity', 0)
+      }
+      alert('networkConfig before')
+      // 获取最快主网
+      let networkConfig = await getNetwork()
+      alert('networkConfig next')
+
       // 调用getIdentity方法获取用户名
       // 调用getIdentity方法获取用户名
       try {
       try {
         var identity = await state.scatter.getIdentity({
         var identity = await state.scatter.getIdentity({

+ 0 - 0
dist/css/chunk-7fdb0984.f80ccfd7.css → dist/css/chunk-2ae77270.6c05c7a7.css


+ 0 - 0
dist/css/chunk-650cd7d0.f8b796f1.css → dist/css/chunk-3a7aa49c.484561d2.css


+ 0 - 0
dist/css/chunk-579c6ae2.f3c7912e.css → dist/css/chunk-41737974.492bfa43.css


+ 0 - 0
dist/css/chunk-21bd4ca5.19ff19e6.css → dist/css/chunk-4a300287.95618aa0.css


+ 0 - 0
dist/css/chunk-a6830cb4.feb38348.css → dist/css/chunk-57fc05d2.feb38348.css


+ 0 - 0
dist/css/chunk-3ab2e3e3.621d2337.css → dist/css/chunk-587d9e67.621d2337.css


+ 0 - 0
dist/css/chunk-5b86aac9.a00b706f.css → dist/css/chunk-868985ce.7de37954.css


+ 0 - 0
dist/css/chunk-484a20ba.6c4d2f2f.css → dist/css/chunk-cc6720b0.6c4d2f2f.css


+ 0 - 0
dist/css/chunk-5c065784.1e2497e0.css → dist/css/chunk-d94a81b0.1e2497e0.css


+ 0 - 0
dist/css/chunk-4f1644cf.0f0a0132.css → dist/css/chunk-e141921e.0f0a0132.css


File diff suppressed because it is too large
+ 0 - 0
dist/js/chunk-21bd4ca5.5edf431f.js


File diff suppressed because it is too large
+ 0 - 0
dist/js/chunk-2ae77270.e46c08a1.js


File diff suppressed because it is too large
+ 0 - 0
dist/js/chunk-3a7aa49c.23f972a0.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-41737974.a93aff4f.js


File diff suppressed because it is too large
+ 0 - 0
dist/js/chunk-4a300287.71c4eeb4.js


File diff suppressed because it is too large
+ 0 - 0
dist/js/chunk-57fc05d2.4d278541.js


File diff suppressed because it is too large
+ 0 - 0
dist/js/chunk-587d9e67.b63ab5a9.js


File diff suppressed because it is too large
+ 0 - 0
dist/js/chunk-5b86aac9.6cd73d35.js


File diff suppressed because it is too large
+ 0 - 0
dist/js/chunk-5c065784.1ecea1c6.js


File diff suppressed because it is too large
+ 0 - 0
dist/js/chunk-650cd7d0.4edc6889.js


File diff suppressed because it is too large
+ 0 - 0
dist/js/chunk-868985ce.201b2bd7.js


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


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


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


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


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


File diff suppressed because it is too large
+ 0 - 0
dist/js/chunk-e141921e.925bedaf.js


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


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


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


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