<template>
  <div>
    <NavHeader color="#0687D2" title="人才政策线上申报" @back="$router.go(-1)" />
    <div class="list">
      <div style="height: 20px"></div>
      <no-data v-if="nodata" text="暂无数据~"></no-data>
      <div class="card" v-for="item in list" :key="item.id" @click="jumpDetail(item)">
        <div class="title">
          <img src="@/assets/policy/matter_icon.png" alt="" />
          <p>{{ item.name }}</p>
        </div>
        <div class="cell">
          <p class="label">实施主体</p>
          <p class="value">{{ item.departmentName }}</p>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import NavHeader from "@/components/NavHeader";
import NoData from "@/components/NoData";
import { mattersGuideList } from "@/api/policy";

export default {
  components: { NavHeader, NoData },
  data() {
    return {
      list: [],
      nodata: false,
    };
  },
  methods: {
    init() {
      this.$toast.loading({
        duration: 0, // 持续展示 toast
        forbidClick: true,
        message: "加载中...",
      });
      mattersGuideList({
        appId: 1234,
        handlingMethod: 1,
        pageNum: 1,
        pageSize: 100,
      }).then((res) => {
        console.log(res);
        this.$toast.clear();
        this.list = res.data.list;
        if (this.list && this.list.length <= 0) {
          this.nodata = true;
        } else {
          this.nodata = false;
        }
      });
    },
    jumpDetail(item) {
      this.$router.push({ name: "PolicyDetail", query: { id: item.id } });
    },
  },
  created() {
    this.init();
  },
};
</script>

<style lang="stylus" scoped>
.list {
  height calc(100vh - 88px)
  overflow auto

  .card {
    margin 0 30px 20px;
    padding 30px;
    background #fff
    border-radius: 2px;

    .title {
      display flex;
      align-items center;

      img {
        width 50px;
        height 50px;
        margin-right 27px;
      }

      p {
        line-height: 45px;
        font-size: 32px;
        font-weight: 500;
        color: #333333;
      }
    }

    .cell {
      margin-top 30px;
      display flex;
      .label {
        width 120px;
        margin-right 30px;
        font-size: 28px;
        color: #999999;
        line-height: 40px;
      }
      .value {
        width calc(100% - 210px)
        font-size: 28px;
        color: #333333;
        line-height: 40px;
      }
    }
  }
}
</style>
