<template>
  <div class="app-container">
    <van-nav-bar
      title="政策法规"
      left-arrow
      @click-left="$router.back(-1)"
    />

    <van-list>
      <van-cell v-for="item in list" :key="item.id" is-link :to="{path:'villageAffairsDetail',query:{id:item.id,type:'1'}}" style="margin:2%;width:96%;border-radius: 6px;box-shadow: 0px 3px 6px 0px rgba(0,0,0,0.16);">
        <template #title>
          <p style="display:inline-block;background: #EC4B2C;height:20px;width: 20px;border-radius: 2px;margin-right: 10px;float: left"></p><p style="font-weight: bold;font-size: 18px;">{{item.title}}</p>
        </template>
        <template #label>
          <van-row>
            <van-col span="12"><p style="font-size: 12px">发布人/单位：{{item.issuedBy}}</p></van-col>
            <van-col span="12"><p style="font-size: 12px;text-align: right">发布时间：{{item.issuedDate}}</p></van-col>
          </van-row>
        </template>
      </van-cell>
    </van-list>
    <van-cell v-if="list.length==0"  is-link url="" style="margin:2%;width:96%;border-radius: 6px;box-shadow: 0px 3px 6px 0px rgba(0,0,0,0.16);">
      <template #title>
        <p style="display:inline-block;background: #dddddd;height:20px;width: 20px;border-radius: 2px;margin-right: 10px;float: left"></p><p style="font-weight: bold;font-size: 18px;">暂无数据</p>
      </template>
      <template #label>
        <van-row>
          <van-col span="12"><p style="font-size: 12px"></p></van-col>
          <van-col span="12"><p style="font-size: 12px;text-align: right"></p></van-col>
        </van-row>
      </template>
    </van-cell>
  </div>
</template>

<script>
    import onlineHomeIndex from "../onlineHomeIndex";
    import {getAffairs, listAffairs} from "../../api/onlineHome/threeAffairs";
    import {listVillageAffairs} from "../../api/onlineHome/villageAffairs";

    export default {
      components: {
        onlineHomeIndex
      },
        name: "zcfg",
      data() {
        return {
          list: [],
          loading: false,
          finished: false,
          // 查询参数
          queryParams: {
            pageNum: 1,
            pageSize: 10,
            title: null,
            villageAffairsType: null,
            deptId: null,
            isWechat: null,
            status: null,
          },
        };
      },
      created() {
        this.getList(1);
      },
      methods: {
        getList(name,title) {
          this.loading = true;
          this.queryParams.villageAffairsType = name
          listVillageAffairs(this.queryParams).then(response => {
            this.list = response.rows;
            this.total = response.total;
            this.loading = false;
          });
        },
      },
    }
</script>

<style scoped>

</style>
