<template>
  <div class="app-container">
    <div class="title">{{ vote.voteTitle }}</div>
    <div class="time">投票时间：{{ vote.sTime }} - {{ vote.eTime }}</div>
    <div class="des">{{ vote.vDescription }}</div>
    <div class="tou_piao" v-if="vote.typeId==='1'">
      <div v-for="item in voteList" class="tou_piao_item">
        <div class="tx"><i class="el-icon-user-solid"></i> </div>
        <div class="emp_name">{{ item.empName }}</div>
        <div class="num">{{ item.voteNum||11111110 }} <span style="color:#666666;">票</span></div>
        <div>
          <el-button type="primary" icon="el-icon-thumb">投给TA一票</el-button>
        </div>
      </div>
    </div>
    <div class="tou_piao"  v-if="vote.typeId==='2'">
      <div v-for="item in voteList" class="tou_piao_item">
        <div class="tx"><i class="el-icon-user-solid"></i> </div>
        <div class="emp_name">{{ item.empName }}</div>
        <div class="num">{{ item.voteNum||11111110 }} <span style="color:#666666;">票</span></div>
        <div>
          <el-rate v-model="item.voteScore"></el-rate>
        </div>
      </div>
    </div>

  </div>
</template>

<script>
import { getVote } from "@/api/kaohe/vote"
import { listVote_emp } from "@/api/kaohe/vote_emp"

export default {
  name: "votepage",
  data() {
    return {
      value1: null,
      loading:null,
      vote:{
        voteTitle: null,
        vDescription: null,
        sTime: null,
        eTime: null,
        maxNum: null,
        typeId:null
      },
      voteList: []
    }
  },
  created() {
    this.getVote()
  },
  methods: {
    getVote(){
      this.loading = this.$loading({
        lock: true,
        text: 'Loading',
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.7)'
      });
      getVote(this.$route.query.id).then(response => {
        this.vote = response.data;
        this.getList()
      })
    },
    /** 查询投票评测列表 */
    getList() {
      listVote_emp({
        voteId: this.$route.query.id,
        pageNum: 1,
        pageSize: 10000000,
      }).then(response => {
        this.voteList = response.rows;
        this.loading.close()
      })
    },
  }
}
</script>

<style scoped lang="scss">
.app-container{
  width: 1200px;
  margin: 0 auto;

  .title{
    font-size: 24px;
    text-align: center;
    margin-bottom: 50px;
  }
  .des{
    padding: 10px;
    color: #666666;
  }
  .time{
    padding: 10px;
    color: #bb1313;
  }

  .tou_piao{
    display: flex;
    flex-wrap: wrap;

    .tou_piao_item{
      margin: 10px;
      border: 1px solid #eeeeee;
      padding: 10px;
      text-align: center;
      width: 200px;
      height: 200px;
      display: flex;
      flex-direction: column;
      justify-content: space-around;
      .tx{
        font-size: 50px;
        color: #999999;
      }
      .num{
        color: #b40000;
      }
    }
  }

}
</style>
