<template>
  <div class="chat-text">
    <div class="user-head">
      <img :src="userHead" alt="" />
    </div>
    <div class="right">
      <div class="name">{{ info.userNick }}:</div>
      <div class="content">
        <span
          :style="{ color: info.contentColor }"
          v-html="$options.filters.emojiParse(info.filterContent)"
        ></span>
      </div>
    </div>
  </div>
</template>
<script>
import { mapGetters } from 'vuex';
export default {
  name: 'vertical-chat-text',
  props: {
    info: {}
  },
  computed: {
    ...mapGetters({
      channelInfo: 'channelInfo'
    }),
    userHead() {
      const userHeadImg = this.info.userHeadImg;
      if (userHeadImg === 'phoneHead') {
        return this.channelInfo.defaultPhoneHeadAva;
      } else if (userHeadImg === 'default') {
        return this.channelInfo.defaultUserAva;
      } else if (!userHeadImg) {
        return this.channelInfo.defaultUserAva;
      } else {
        return userHeadImg;
      }
    }
  },
  methods: {}
};
</script>
<style lang="less" scoped>
.chat-text {
  display: flex;
  .user-head {
    flex: 0 0 auto;
    margin-right: 0.05rem;
    width: 0.26rem;
    height: 0.26rem;
    border-radius: 100%;
    overflow: hidden;
    img {
      width: 100%;
      height: 100%;
    }
  }
  .right {
    padding: 0.05rem 0.1rem;
    min-height: 0.3rem;
    line-height: 0.2rem;
    font-size: 0.12rem;
    border-radius: 0.2rem;
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    word-break: break-all;
    .name {
      display: inline-block;
      color: #ffde8d;
    }
    .content {
      display: inline-block;
      ::v-deep {
        .emoji {
          display: inline-block;
          width: 0.2rem;
          height: 0.2rem;
          vertical-align: middle;
        }
      }
    }
  }
}
</style>
