<template>
  <div class="load">
    <toptip :currTitle="currTitle"></toptip>
    <template>
      <el-table :data="newList" style="width: 100%">
        <el-table-column>
          <template slot-scope="scope">
            <div @mouseleave="loadHiden()" @mouseover="loadShow(scope.row.in)">
              <i class="el-icon-caret-right"></i>
              <span
                style="margin-left: 10px; font-size: 16px; width: 40%"
                class="title"
                @click="goto(scope.row.path)"
                >{{ scope.row.name }}</span
              >
              <a class="loader" :href="scope.row.loadPath" :download="scope.row.loadTitle">
                <span v-show="scope.row.in === current">下载</span>
              </a>
            </div>
          </template>
        </el-table-column>
      </el-table>
    </template>
    <div class="page-box">
      <el-pagination
        background
        layout="prev, pager, next"
        :total="count"
        prev-text="上一页"
        next-text="下一页"
      >
      </el-pagination>
    </div>
  </div>
</template>

<script>
import toptip from "../../components/toptip";
export default {
  metaInfo: {
    title: "申请表下载",
  },
  data() {
    return {
      currTitle: "申请表下载",
      newList: [
        {
          name: "单位会员入会申请表",
          in: 1,
          path: "dwload",
          loadPath: 'http://ca.liuniu946.com/uploads/20201223/93058675c2c0747769c550aacaf924e7.jpg',
          loadTitle: '单位会员入会申请表.jpg'
        },
        {
          name: "个人会员入会申请表",
          in: 2,
          path: "grload",
          loadPath: 'http://ca.liuniu946.com/uploads/20201223/6a30c709cbe3cb994cdf3993c0062570.jpg',
          loadTitle: '个人会员入会申请表.jpg'
        },
      ],
      isShow: false,
      current: 0,
    };
  },
  components: {
    toptip,
  },
  computed: {
    count() {
      return this.newList.length;
    },
  },
  methods: {
    loadShow(index) {
      this.current = index;
    },
    loadHiden() {
      this.current = 0;
    },
    goto(path) {
      console.log(path);
      this.$router.push("/committee/" + path);
    },
    down(data) {
      console.log(data);
    },
  },
};
</script>

<style lang="scss" scoped>
.page-box {
  margin-top: 40px;
  width: 858px;
  display: flex;
  justify-content: center;
  cursor: pointer;
}
.title {
  cursor: pointer;
}
.loader {
  cursor: pointer;
  background: url("../../assets/load.png") no-repeat;
  float: right;
  width: 45px;
  height: 25px;
  color: #fff;
  text-align: center;
  line-height: 25px;
  span {
    display: inline-block;
    background-color: red;
    width: 45px;
  }
}
</style>