DW-PC\DW 5 tahun lalu
induk
melakukan
436a40f9c3

+ 1 - 5
_src/api/http.js

@@ -1,7 +1,6 @@
 import axios from 'axios'
 import Qs from 'qs'
 import { MessageBox } from 'element-ui'
-// import { Cookie } from '../util/util'
 import $store from '@/store'
 
 let host = ''
@@ -51,10 +50,7 @@ ax.interceptors.response.use(
       return Promise.resolve(response)
     } else {
       if (response.data.code === -5) { // code为-5是登录态失效
-        $store.dispatch('resetGameLogin').then(() => {
-          // 重新登录成功话刷新页面
-          location.reload()
-        })
+        $store.dispatch('resetGameLogin')
       } else {
         // 请求出错提示错误
         MessageBox.confirm(response.data.msg, 'Error', {

+ 11 - 39
_src/components/chatMini/chatMini.vue

@@ -159,7 +159,6 @@ import chatAt from '@/components/chatAt'
 import atMe from '@/components/chatAt/atme'
 import chatPin from '@/components/chatPin'
 import { mapActions, mapState, mapMutations } from 'vuex'
-import API from '@/api'
 import { getMiniWsUrl } from '@/util/contract.js'
 import { isMobile, scrollMsgIntoView } from '@/util/util.js'
 import WsManager from '@/util/wsManager.js'
@@ -234,6 +233,10 @@ export default {
     inputMsg (val, newval) {
       let ele = this.$refs.chatInput
       this.inputHeight = 'auto'
+
+      // 处理ios系统下窗体闪烁的bug
+      this.$refs.scrollWrap.style.overflowY = 'hidden'
+
       this.$nextTick(() => {
         this.inputHeight = Math.max(18, Math.min(ele.scrollHeight, 75)) + 'px'
       })
@@ -341,7 +344,7 @@ export default {
       'getHistoryMsg',
       'doSendMsg',
       'doSendFile',
-      'doParentLogin'
+      'doContractLogin'
     ]),
     handleMoreClick () {
       this.showEmoji = false
@@ -533,19 +536,9 @@ export default {
         // scatter登录
         await this.getParentIdentity()
         if (!this.account) return
-
         // 合约登录
-        let { data } = await API.user.getRandom2({ account: this.account.name })
-        let random = data.data.random
-        let accessToken = data.data.accessToken
-
-        let trxId = await this.doParentLogin([this.account.name, random])
-        let param = {
-          account: this.account.name,
-          access_token: accessToken,
-          trx_id: trxId
-        }
-        this.eosLogin(param)
+        await this.doContractLogin()
+        location.replace(location.href.replace('show=false', 'show=true'))
       } catch (msg) {
         if (msg.type) {
           // scatter报错的情况
@@ -560,31 +553,6 @@ export default {
         this.showLoginBtn = true
       }
     },
-    async eosLogin (param) {
-      let { data } = await API.user.eosLogin2(param)
-      if (data.result === 1) {
-        let userId = data.data.user_id
-        let token = data.data.token
-        localStorage.setItem('user_id', userId)
-        localStorage.setItem('token', token)
-
-        location.replace(location.href.replace('show=false', 'show=true'))
-        //
-        //        this.setUserId(userId)
-        //        this.setToken(token)
-        //
-        //        // 设置groupId
-        //        this.initGroup({
-        //          userId,
-        //          groupId: this.groupId,
-        //          useCache: false
-        //        })
-        //
-        //        this.showLoginBtn = false
-        //
-        //        await this.getUserInfo()
-      }
-    },
     /**
      * 聊天窗体滚动到底部
      */
@@ -728,6 +696,10 @@ export default {
       e.preventDefault()
       return false
     },
+    handleBlur () {
+      // 处理ios系统下窗体闪烁的bug
+      this.$refs.scrollWrap.style.overflowY = 'scroll'
+    },
     placeEnd (el) {
       var range = document.createRange()
       range.selectNodeContents(el)

+ 47 - 13
_src/store/actions.js

@@ -185,27 +185,61 @@ export const actions = {
 	 * @param {Object} store
 	 * @param {Object} params
    */
-  resetGameLogin ({ dispatch, commit, state }, params) {
+  async resetGameLogin ({ dispatch, commit, state }, params) {
     localStorage.removeItem('user_id')
     localStorage.removeItem('token')
-    dispatch('doGameLogin')
+    await dispatch('doContractLogin')
+    if (self !== top) {
+      location.replace(location.href.replace('show=false', 'show=true'))
+    }
   },
   /**
-   * 内嵌版本调起合约登录
+   * 合约登录, 生成业务登录态token
 	 * @param {Array} params
    */
-  async doParentLogin ({ dispatch, commit, state }, params) {
+  async doContractLogin ({ commit, state }, params) {
     try {
+      // 合约登录
+      let { data } = await API.user.getRandom2({ account: state.account.name })
+      let random = data.data.random
+      let accessToken = data.data.accessToken
       let identity = { authorization: [`${state.account.name}@${state.account.authority}`] }
-      let trx = await window.postMessager.send({
-        action: 'meechat:eosAction',
-        data: {
-          contract: 'meechatadmin',
-          action: 'login',
-          param: params.concat(identity)
-        }
-      })
-      return Promise.resolve(trx.transaction_id)
+
+      let trx = null
+      if (self !== top) {
+        trx = await window.postMessager.send({
+          action: 'meechat:eosAction',
+          data: {
+            contract: 'meechatadmin',
+            action: 'login',
+            param: [state.account.name, random, identity]
+          }
+        })
+      } else {
+        let contract = await window.EOS.contract('meechatadmin')
+        trx = await contract.login(state.account.name, random, identity)
+      }
+
+      let param = {
+        account: state.account.name,
+        access_token: accessToken,
+        trx_id: trx.transaction_id,
+        group_id: state.group.groupId || null
+      }
+
+      let res = await API.user.eosLogin2(param)
+      if (res.data.result === 1) {
+        let userId = res.data.data.user_id
+        let token = res.data.data.token
+
+        localStorage.setItem('user_id', userId)
+        localStorage.setItem('token', token)
+
+        commit('setUserId', userId)
+        commit('setToken', token)
+
+        return Promise.resolve(res.data)
+      }
     } catch (error) {
       return Promise.reject(error)
     }

+ 0 - 5
_src/store/module/group.js

@@ -759,11 +759,6 @@ const group = {
           .catch(err => reject(err))
       })
     },
-    doUploadFile ({ dispatch, commit, state }, params = {}) {
-      API.session.fileUpload({
-        name: 'res'
-      })
-    },
     /**
      * 链接websocket
      * @param {Object} data

File diff ditekan karena terlalu besar
+ 0 - 0
dist/css/chunk-common.657b0eab.css


+ 0 - 0
dist/css/chunk-vendors.f66650d8.css → dist/css/chunk-vendors.061e5f0b.css


File diff ditekan karena terlalu besar
+ 0 - 0
dist/css/index.d3530041.css


File diff ditekan karena terlalu besar
+ 0 - 0
dist/css/mini.7c7d8090.css


File diff ditekan karena terlalu besar
+ 0 - 0
dist/js/chunk-common.04e0d402.js


File diff ditekan karena terlalu besar
+ 0 - 0
dist/js/chunk-common.41a32dc4.js


File diff ditekan karena terlalu besar
+ 0 - 0
dist/js/chunk-vendors.ab422156.js


File diff ditekan karena terlalu besar
+ 0 - 0
dist/js/index.22147928.js


File diff ditekan karena terlalu besar
+ 0 - 0
dist/js/index.cdc5e639.js


File diff ditekan karena terlalu besar
+ 0 - 0
dist/js/mini.50dacbd5.js


File diff ditekan karena terlalu besar
+ 0 - 0
dist/js/mini.96062488.js


+ 36 - 36
dist/precache-manifest.ae381a40e66838d8febbc88e9cfeea69.js → dist/precache-manifest.1bb23f4e0d41f78beca598051059de98.js

@@ -1,78 +1,78 @@
 self.__precacheManifest = [
   {
-    "revision": "733c3c95a119053d528a",
-    "url": "/dist/css/chunk-common.665d5bf6.css"
+    "revision": "6f0a76321d30f3c8120915e57f7bd77e",
+    "url": "/dist/fonts/element-icons.6f0a7632.ttf"
+  },
+  {
+    "revision": "b6216d61c03e6ce0c9aea6ca7808f7ca",
+    "url": "/dist/robots.txt"
   },
   {
-    "revision": "733c3c95a119053d528a",
-    "url": "/dist/js/chunk-common.41a32dc4.js"
+    "revision": "724c93c87ad4f3be666829b662cee9ce",
+    "url": "/dist/sw.js"
   },
   {
-    "revision": "0075b82cdeae0d9eff2f",
-    "url": "/dist/css/chunk-vendors.f66650d8.css"
+    "revision": "eb029f3afb0aa1294ffa0cf0ade29412",
+    "url": "/dist/img/bg.eb029f3a.png"
   },
   {
-    "revision": "0075b82cdeae0d9eff2f",
-    "url": "/dist/js/chunk-vendors.73646c03.js"
+    "revision": "9acad26f646b0c96c7a9",
+    "url": "/dist/js/chunk-vendors.ab422156.js"
   },
   {
-    "revision": "7bcfa7f086d627d330d0",
-    "url": "/dist/css/index.64f33b5e.css"
+    "revision": "b486b46b608958132ad7",
+    "url": "/dist/js/index.22147928.js"
   },
   {
-    "revision": "7bcfa7f086d627d330d0",
-    "url": "/dist/js/index.cdc5e639.js"
+    "revision": "ee63bdc9a836118a8274be3cc4a2bf1e",
+    "url": "/dist/mini.html"
   },
   {
-    "revision": "f3ee53b3754073eb8888",
-    "url": "/dist/css/mini.539f9bda.css"
+    "revision": "6c6036e92d5e44f43a2b",
+    "url": "/dist/js/mini.50dacbd5.js"
   },
   {
-    "revision": "f3ee53b3754073eb8888",
-    "url": "/dist/js/mini.96062488.js"
+    "revision": "823af133843b05ebc952dc37d4ea797d",
+    "url": "/dist/../protected/views/index.html"
   },
   {
     "revision": "2fad952a20fbbcfd1bf2ebb210dccf7a",
     "url": "/dist/fonts/element-icons.2fad952a.woff"
   },
   {
-    "revision": "6f0a76321d30f3c8120915e57f7bd77e",
-    "url": "/dist/fonts/element-icons.6f0a7632.ttf"
+    "revision": "71de928a26b3ba1fe61c933166c7e5ec",
+    "url": "/dist/img/bg.71de928a.jpg"
   },
   {
-    "revision": "eb029f3afb0aa1294ffa0cf0ade29412",
-    "url": "/dist/img/bg.eb029f3a.png"
+    "revision": "5ab8d8c546c0a3364cdd25e10fbe49aa",
+    "url": "/dist/icon_192.png"
   },
   {
     "revision": "0b28333db188e069d1ff4907da0148c6",
     "url": "/dist/img/bg2.0b28333d.png"
   },
   {
-    "revision": "71de928a26b3ba1fe61c933166c7e5ec",
-    "url": "/dist/img/bg.71de928a.jpg"
-  },
-  {
-    "revision": "dee7c822bc01eb98582bb4e0ea539bbc",
-    "url": "/dist/../protected/views/index.html"
+    "revision": "8a6dbdb8915a2aa677d2",
+    "url": "/dist/js/chunk-common.04e0d402.js"
   },
   {
-    "revision": "0d57a6a787d5155ee9a7a4a1bb83fd55",
-    "url": "/dist/../protected/views/mini.html"
+    "revision": "6c6036e92d5e44f43a2b",
+    "url": "/dist/css/mini.7c7d8090.css"
   },
   {
-    "revision": "6dc2cb834b811f7d3de4fddd33d61ec9",
-    "url": "/dist/mini.html"
+    "revision": "b486b46b608958132ad7",
+    "url": "/dist/css/index.d3530041.css"
   },
   {
-    "revision": "5ab8d8c546c0a3364cdd25e10fbe49aa",
-    "url": "/dist/icon_192.png"
+    "revision": "9acad26f646b0c96c7a9",
+    "url": "/dist/css/chunk-vendors.061e5f0b.css"
   },
   {
-    "revision": "b6216d61c03e6ce0c9aea6ca7808f7ca",
-    "url": "/dist/robots.txt"
+    "revision": "8a6dbdb8915a2aa677d2",
+    "url": "/dist/css/chunk-common.657b0eab.css"
   },
   {
-    "revision": "8a88129bbdd23eb4d2c683cfd1de65fb",
-    "url": "/dist/sw.js"
+    "revision": "c3bee7bb07610f239f1309dc8cad6469",
+    "url": "/dist/../protected/views/mini.html"
   }
 ];

+ 1 - 1
dist/sw.js

@@ -1,4 +1,4 @@
-importScripts("/dist/precache-manifest.ae381a40e66838d8febbc88e9cfeea69.js");
+importScripts("/dist/precache-manifest.1bb23f4e0d41f78beca598051059de98.js");
 
 
 var workbox=function(){"use strict";try{self.workbox.v["workbox:sw:3.6.3"]=1}catch(t){}const t="https://storage.googleapis.com/workbox-cdn/releases/3.6.3",e={backgroundSync:"background-sync",broadcastUpdate:"broadcast-cache-update",cacheableResponse:"cacheable-response",core:"core",expiration:"cache-expiration",googleAnalytics:"google-analytics",navigationPreload:"navigation-preload",precaching:"precaching",rangeRequests:"range-requests",routing:"routing",strategies:"strategies",streams:"streams"};return new class{constructor(){return this.v={},this.t={debug:"localhost"===self.location.hostname,modulePathPrefix:null,modulePathCb:null},this.e=this.t.debug?"dev":"prod",this.s=!1,new Proxy(this,{get(t,s){if(t[s])return t[s];const o=e[s];return o&&t.loadModule(`workbox-${o}`),t[s]}})}setConfig(t={}){if(this.s)throw new Error("Config must be set before accessing workbox.* modules");Object.assign(this.t,t),this.e=this.t.debug?"dev":"prod"}skipWaiting(){self.addEventListener("install",()=>self.skipWaiting())}clientsClaim(){self.addEventListener("activate",()=>self.clients.claim())}loadModule(t){const e=this.o(t);try{importScripts(e),this.s=!0}catch(s){throw console.error(`Unable to import module '${t}' from '${e}'.`),s}}o(e){if(this.t.modulePathCb)return this.t.modulePathCb(e,this.t.debug);let s=[t];const o=`${e}.${this.e}.js`,r=this.t.modulePathPrefix;return r&&""===(s=r.split("/"))[s.length-1]&&s.splice(s.length-1,1),s.push(o),s.join("/")}}}();

+ 12 - 1
protected/controllers/UserController.php

@@ -117,7 +117,8 @@ class UserController extends BaseController {
         $rules = [
             'account' => ['string', 'reg' => '/^[a-z0-9\.]{1,13}$/', 'desc' => 'eos账号'],
             'access_token' => ['string', 'len' => 36, 'desc' => 'access_token'],
-            'trx_id' => ['string', 'desc' => '交易id']
+            'trx_id' => ['string', 'desc' => '交易id'],
+            'group_id' => ['int', 'nullable' => true, 'desc' => '群id'],
         ];
         Param::checkParam2($rules, $args);
 
@@ -162,6 +163,16 @@ class UserController extends BaseController {
             Response::error($e->getCode(), $e->getMessage());
         }
 
+        // 带群id检测是否加入群
+        if ($args['group_id']) {
+            try {
+                (new GroupInfo())->joinGroup($data['user_id'], $args['group_id']);
+            } catch (Exception $e) {
+                var_log($e->getMessage());
+            }
+
+        }
+
         return $data;
     }
 

+ 2 - 2
protected/views/index.html

@@ -1,4 +1,4 @@
-<!DOCTYPE html><html><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"><title>MeeChat</title><link href=/dist/css/chunk-common.665d5bf6.css rel=preload as=style><link href=/dist/css/chunk-vendors.f66650d8.css rel=preload as=style><link href=/dist/css/index.64f33b5e.css rel=preload as=style><link href=/dist/js/chunk-common.41a32dc4.js rel=preload as=script><link href=/dist/js/chunk-vendors.73646c03.js rel=preload as=script><link href=/dist/js/index.cdc5e639.js rel=preload as=script><link href=/dist/css/chunk-vendors.f66650d8.css rel=stylesheet><link href=/dist/css/chunk-common.665d5bf6.css rel=stylesheet><link href=/dist/css/index.64f33b5e.css rel=stylesheet><link rel=icon type=image/png sizes=32x32 href=/dist/img/icons/favicon-32x32.png><link rel=icon type=image/png sizes=16x16 href=/dist/img/icons/favicon-16x16.png><link rel=manifest href=/dist/manifest.json><meta name=theme-color content=#4DBA87><meta name=apple-mobile-web-app-capable content=no><meta name=apple-mobile-web-app-status-bar-style content=default><meta name=apple-mobile-web-app-title content=MeeChat><link rel=apple-touch-icon href=/dist/img/icons/apple-touch-icon-152x152.png><link rel=mask-icon href=/dist/img/icons/safari-pinned-tab.svg color=#4DBA87><meta name=msapplication-TileImage content=/dist/img/icons/msapplication-icon-144x144.png><meta name=msapplication-TileColor content=#000000></head><body><div id=app></div><script>window.EOS_PROTOCOL = 'https'
+<!DOCTYPE html><html><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"><title>MeeChat</title><link href=/dist/css/chunk-common.657b0eab.css rel=preload as=style><link href=/dist/css/chunk-vendors.061e5f0b.css rel=preload as=style><link href=/dist/css/index.d3530041.css rel=preload as=style><link href=/dist/js/chunk-common.04e0d402.js rel=preload as=script><link href=/dist/js/chunk-vendors.ab422156.js rel=preload as=script><link href=/dist/js/index.22147928.js rel=preload as=script><link href=/dist/css/chunk-vendors.061e5f0b.css rel=stylesheet><link href=/dist/css/chunk-common.657b0eab.css rel=stylesheet><link href=/dist/css/index.d3530041.css rel=stylesheet><link rel=icon type=image/png sizes=32x32 href=/dist/img/icons/favicon-32x32.png><link rel=icon type=image/png sizes=16x16 href=/dist/img/icons/favicon-16x16.png><link rel=manifest href=/dist/manifest.json><meta name=theme-color content=#4DBA87><meta name=apple-mobile-web-app-capable content=no><meta name=apple-mobile-web-app-status-bar-style content=default><meta name=apple-mobile-web-app-title content=MeeChat><link rel=apple-touch-icon href=/dist/img/icons/apple-touch-icon-152x152.png><link rel=mask-icon href=/dist/img/icons/safari-pinned-tab.svg color=#4DBA87><meta name=msapplication-TileImage content=/dist/img/icons/msapplication-icon-144x144.png><meta name=msapplication-TileColor content=#000000></head><body><div id=app></div><script>window.EOS_PROTOCOL = 'https'
       window.EOS_HOST = 'proxy.eosnode.tools'
       window.EOS_PORT = '443'
 
@@ -13,4 +13,4 @@
       //         console.log('ServiceWorker registration failed: ', err)
       //       })
       //   })
-      // }</script><script src=/dist/js/chunk-vendors.73646c03.js></script><script src=/dist/js/chunk-common.41a32dc4.js></script><script src=/dist/js/index.cdc5e639.js></script></body></html>
+      // }</script><script src=/dist/js/chunk-vendors.ab422156.js></script><script src=/dist/js/chunk-common.04e0d402.js></script><script src=/dist/js/index.22147928.js></script></body></html>

+ 2 - 2
protected/views/mini.html

@@ -1,3 +1,3 @@
-<!DOCTYPE html><html><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"><!--[if IE]><link rel="icon" href="/dist/favicon.ico"><![endif]--><title>MeeChat</title><link href=/dist/css/chunk-common.665d5bf6.css rel=preload as=style><link href=/dist/css/chunk-vendors.f66650d8.css rel=preload as=style><link href=/dist/css/mini.539f9bda.css rel=preload as=style><link href=/dist/js/chunk-common.41a32dc4.js rel=preload as=script><link href=/dist/js/chunk-vendors.73646c03.js rel=preload as=script><link href=/dist/js/mini.96062488.js rel=preload as=script><link href=/dist/css/chunk-vendors.f66650d8.css rel=stylesheet><link href=/dist/css/chunk-common.665d5bf6.css rel=stylesheet><link href=/dist/css/mini.539f9bda.css rel=stylesheet><link rel=icon type=image/png sizes=32x32 href=/dist/img/icons/favicon-32x32.png><link rel=icon type=image/png sizes=16x16 href=/dist/img/icons/favicon-16x16.png><link rel=manifest href=/dist/manifest.json><meta name=theme-color content=#4DBA87><meta name=apple-mobile-web-app-capable content=no><meta name=apple-mobile-web-app-status-bar-style content=default><meta name=apple-mobile-web-app-title content=MeeChat><link rel=apple-touch-icon href=/dist/img/icons/apple-touch-icon-152x152.png><link rel=mask-icon href=/dist/img/icons/safari-pinned-tab.svg color=#4DBA87><meta name=msapplication-TileImage content=/dist/img/icons/msapplication-icon-144x144.png><meta name=msapplication-TileColor content=#000000></head><body><div id=app></div><script>window.EOS_PROTOCOL = 'https'
+<!DOCTYPE html><html><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"><!--[if IE]><link rel="icon" href="/dist/favicon.ico"><![endif]--><title>MeeChat</title><link href=/dist/css/chunk-common.657b0eab.css rel=preload as=style><link href=/dist/css/chunk-vendors.061e5f0b.css rel=preload as=style><link href=/dist/css/mini.7c7d8090.css rel=preload as=style><link href=/dist/js/chunk-common.04e0d402.js rel=preload as=script><link href=/dist/js/chunk-vendors.ab422156.js rel=preload as=script><link href=/dist/js/mini.50dacbd5.js rel=preload as=script><link href=/dist/css/chunk-vendors.061e5f0b.css rel=stylesheet><link href=/dist/css/chunk-common.657b0eab.css rel=stylesheet><link href=/dist/css/mini.7c7d8090.css rel=stylesheet><link rel=icon type=image/png sizes=32x32 href=/dist/img/icons/favicon-32x32.png><link rel=icon type=image/png sizes=16x16 href=/dist/img/icons/favicon-16x16.png><link rel=manifest href=/dist/manifest.json><meta name=theme-color content=#4DBA87><meta name=apple-mobile-web-app-capable content=no><meta name=apple-mobile-web-app-status-bar-style content=default><meta name=apple-mobile-web-app-title content=MeeChat><link rel=apple-touch-icon href=/dist/img/icons/apple-touch-icon-152x152.png><link rel=mask-icon href=/dist/img/icons/safari-pinned-tab.svg color=#4DBA87><meta name=msapplication-TileImage content=/dist/img/icons/msapplication-icon-144x144.png><meta name=msapplication-TileColor content=#000000></head><body><div id=app></div><script>window.EOS_PROTOCOL = 'https'
       window.EOS_HOST = 'proxy.eosnode.tools'
-      window.EOS_PORT = '443'</script><script src=/dist/js/chunk-vendors.73646c03.js></script><script src=/dist/js/chunk-common.41a32dc4.js></script><script src=/dist/js/mini.96062488.js></script></body></html>
+      window.EOS_PORT = '443'</script><script src=/dist/js/chunk-vendors.ab422156.js></script><script src=/dist/js/chunk-common.04e0d402.js></script><script src=/dist/js/mini.50dacbd5.js></script></body></html>

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini