<template>
  <div class="send">
    <div class="disabled" v-if="channelInfo.chatDisable">全员禁言中</div>
    <div class="disabled" v-else-if="userInfo.isDisableChat == 1">你已被禁言</div>
    <div class="text" v-else-if="allowChat" @click.stop="showSend = true">一起聊聊吧...</div>
    <div class="text" v-else @click="_login">点击登录，参与互动</div>
     <transition name="fade">
      <div class="send-mask" v-transfer-dom v-show="showSend">
        <send-chat v-model="showSend"></send-chat>
      </div>
     </transition>
  </div>
</template>
<script>
import { mapGetters } from 'vuex';
import sendChat from './sendChat';
export default {
  name: 'vertical-send-box',
  components: {
    sendChat
  },
  data() {
    return {
      showSend: false,
      sendDate: 0,
      content: ''
    };
  },
  computed: {
    ...mapGetters({
      userInfo: 'userInfo',
      channelInfo: 'channelInfo'
    }),
    allowChat() {
      if (!this.userInfo.id && this.channelInfo.chatLogin) {
        return false;
      } else {
        return true;
      }
    }
  },
  methods: {
    _login() {
      this.$Bus.$emit('bus-showLogin', true);
    },
  },
  watch: {
    showSend(newVal) {
      this.$Bus.$emit('bus-footerInput', newVal);
      this.$Bus.$emit('bus-suspensionInput', newVal);
    }
  }
};
</script>
<style lang="less" scoped>
.fade-enter,.fade-leave-to{
  opacity: 0;
}
.fade-enter-to,.fade-leave{
  opacity: 1;
}
.fade-enter-active,.fade-leave-active{
  transition: all .5s cubic-bezier(0,0,0.58,1);
}
.send {
  .disabled {
    padding: 0 0.1rem;
    width: 100%;
    height: 0.36rem;
    line-height: 0.36rem;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.4);
    font-size: 0.13rem;
    color: #eee;
  }
  .text {
    padding: 0 0.1rem;
    width: 100%;
    height: 0.32rem;
    line-height: 0.32rem;
    border-radius: 0.16rem;
    background: rgba(0, 0, 0, 0.4);
    font-size: 0.13rem;
    color: #fff;
  }
}
.send-mask {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 900;
  width: 100%;
  height: 0.6rem;
}
</style>
