<template>
  <div id="app" @mousewheel.stop @touchstart.stop>
    <chat-mini
      :show="show"
      :groupId="groupId"
      :width="outWidth"
      :height="outHeight"
      >
    </chat-mini>
  </div>
</template>

<script>
import { mapActions, mapMutations } from 'vuex'
import { getUrlParam } from '@/util/util'
import chatMini from '@/components/chatMini/chatMini'

export default {
  name: 'App',
  components: {
    chatMini
  },
  data () {
    var width = getUrlParam('width') || window.innerWidth
    var height = getUrlParam('height') || window.innerHeight - 16
    return {
      show: getUrlParam('show') === 'true',
      groupId: getUrlParam('groupId') || 10001,
      outWidth: parseInt(width),
      outHeight: parseInt(height)
    }
  },
  methods: {
    ...mapMutations([
      'setPublicKey'
    ]),
    ...mapActions([
      'setScatter',
      'setAccount',
      'doScatterLogin'
    ])
  },
  created () {
    //    if (self !== top) {
    //      let account = getUrlParam('account')
    //      let publicKey = getUrlParam('pk')
    //      if (account && publicKey) {
    //        account = {
    //          authority: account.split('@')[1],
    //          blockchain: 'eos',
    //          name: account.split('@')[0]
    //        }
    //
    //        this.setAccount(account)
    //        this.setPublicKey(publicKey)
    //      }
    //    }
  }
}
</script>

<style lang="scss">
@import '@/style/mini.scss';
</style>
