<template>
  <div class="vote" @click="goVote">
    <div class="btn">
      <div class="icon"></div>
    </div>
    <div class="title">投票</div>
  </div>
</template>
<script>
import { mapGetters } from 'vuex';

export default {
  name: 'suspension-vote',
  props: {
    info: {}
  },
  computed: {
    ...mapGetters({
      userInfo: 'userInfo',
      channelInfo: 'channelInfo'
    })
  },
  methods: {
    goVote() {
      if (!this.userInfo.id) {
        this.$Bus.$emit('bus-showLogin', true);
      } else {
        const id = this.info.id;
        const uin = this.channelInfo.uin;
        window.location.href = `/vote/?id=${id}&uin=${uin}`;
      }
    }
  }
};
</script>
<style lang="less" scoped>
.vote {
  width: 0.8rem;
  height: 0.8rem;
  .btn {
    position: relative;
    padding: 0 0.1rem;
    width: 0.8rem;
    height: 0.6rem;
    background: var(--suspension-vote-bg) no-repeat center center;
    background-size: contain;
    .icon {
      width: 100%;
      height: 100%;
      background: url(./img/icon-vote.png) no-repeat center center;
      background-size: auto 60%;
    }
  }
  .title {
    margin-top: 0.02rem;
    line-height: 0.18rem;
    text-align: center;
    white-space: nowrap;
    font-size: 0.16rem;
    color: #666;
  }
}
</style>
