<template>
  <div class="cats">
    <header>
      <div class="apply-header">
        当前申请人数:{{totalCount}}人
      </div>
    </header>
    <div class="heightset">
      <div class="developer-box">
        <div class="dev-main clear" v-for="item in appliers" :key="item.id">
          <div class="dev-left">
            <div class="grid-content point" @click="clickUID(item.uid)">
              <img class="dev-head" :src="item.icon_url" alt/>
              <p class="blackc">{{item.uid}}</p>
              <p class="blackc">{{item.nickname}}</p>
            </div>
          </div>
          <div class="dev-right">
            <el-checkbox :checked="item.status==2" @change="changeStatus(item.uid)">不合适</el-checkbox>
          </div>
        </div>
      </div>
    </div>
    <el-pagination
      @current-change="changePagination"
      :current-page.sync="currentPage"
      :page-size="size"
      layout="total, prev, pager, next"
      :total="totalCount"
    ></el-pagination>
  </div>
</template>

<script>
  const tableHeaders = [
    "用户ID",
    "昵称",
  ];
  const tableProps = [
    "uid",
    "nickname",
  ];

  // 现在环境是线上还是测试, 默认线上
  let env = "";

  export default {
    data() {
      return {
        appliers: [],
        currentPage:1,
        size:10,
        totalCount:10
      };
    },
    mounted() {
      this.getTableData();
    },
    methods: {
      clickUID(uid) {
        if (env === "test")
          window.open(`https://dev.test.proginn.com/rooter/user/${uid}`);
        else window.open(`https://www.proginn.com/rooter/user/${uid}`);
      },

      changePagination() {
        this.getTableData();
      },

      async getTableData() {
        const id = this.$router.currentRoute.query.id;
        const res = await this.$post("/api/admin/present_job/get_apply_users", {
          page: this.currentPage,
          size: 10,
          id:id
        });
        this.appliers = res.data.appliers;
        this.totalCount = res.data.count;
      },

      changeStatus(uid){
        const id = this.$router.currentRoute.query.id;
        this.$post("/api/admin/present_job/change_status", {
          present_job_id:id,
          uid:uid
        }).then(res=>{
          this.$message.success('修改成功');
        });
      }
    }
  };
</script>

<style scoped lang="scss">
  .form-inline {
    display: flex;
    flex-wrap: wrap;
  }

  .inline {
    display: inline;
  }

  .apply-header {
    padding: 20px 0 20px 0;
    font-size: 16px;
  }

  .lblue {
    color: #419df7;
  }

  .lblack {
    color: #aeaeae;
  }

  .cats-boxs {
    height: calc(100% - 40px);
    overflow-y: auto;
  }

  .point {
    cursor: pointer;
  }

  .form-inline {
    display: flex;
    flex-wrap: wrap;
  }

  .developer-box {
    padding-top: 10px;
    background: #f7f7f7;
    font-size: 14px;
    padding-bottom: 20px;
  }

  .dev-main {
    margin: 0 auto;
    padding: 37px 9px 20px 23px;
    background: white;
    width: 1000px;
    margin-bottom: 10px;
    box-sizing: border-box;
  }

  .dev-main > div {
    float: left;
  }

  .dev-left {
    width: 112px;
    text-align: center;
  }

  .state-of {
    display: inline-block;
    background: rgba(243, 243, 243, 1);
    font-size: 12px;
    color: #888888;
    padding: 3px 11px;
  }

  .dev-left p {
    padding: 3px 0;
  }

  .dev-center {
    width: 594px;
  }

  .dev-right {
    margin-top: 25px;
    margin-left:20px ;
  }

  .dev-detail {
    border-left: 1px solid #e0e0e0;
    padding: 3px 0 3px 19px;
  }

  .dev-detail > p {
    padding-top: 3px;
    padding-right: 10px;
    font-size: 13px;
    color: #505050;
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .dev-head {
    width: 74px;
    border-radius: 50%;
    overflow: hidden;
  }

  .dev-mark {
    margin-right: 22px;
  }

  .dev-mark > span {
    float: left;
    padding: 2px 9px;
    color: #888888;
    font-size: 12px;
    border: 1px solid #c0c0c0;
    border-radius: 2px;
    margin-right: 7px;
    height: 23px;
    line-height: 18px;
  }

  .dev-mark .dev-dark {
    float: left;
    padding: 2px 9px;
    color: white;
    font-size: 12px;
    background: #999999;
    border: 1px solid #999999;
    border-radius: 2px;
    margin-right: 7px;
  }

  .dev-infor {
    padding-top: 2px;
  }

  .dev-infor > p {
    padding-top: 3px;
    padding-right: 10px;
    font-size: 13px;
    color: #505050;
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .heightset {
    // height: calc(100% - 200px);
    // overflow: auto;
  }

  .clear::after {
    display: block;
    clear: both;
    content: "";
  }

  .inlineb {
    display: inline-block;
  }

  .floatl {
    float: left;
  }

  .floatr {
    float: right;
  }

  .table {
    height: calc(100% - 40px);
  }

  #main {
  }
</style>
