<template>
  <div class="AppInfotainment">
    <div class="fiveIndustry" v-if="list.length">
      <div class="title">
        <h2>{{ parentName }}</h2>
        <p v-if="parentName == '产业振兴'">实现乡村振兴的物质基础</p>
        <p v-if="parentName == '组织振兴'">保障乡村振兴的政治基础</p>
        <p v-if="parentName == '人才振兴'">推动乡村振兴的重要因素</p>
        <p v-if="parentName == '文化振兴'">稳固乡村振兴的思想保障</p>
        <p v-if="parentName == '生态振兴'">构建乡村振兴的环境基础</p>
      </div>
      <div class="list">
        <div class="item" v-for="(item,index) in list" :key="index" @click="toNewList(item.id,item.categoryName)">
          <span>{{ item.categoryName }}</span>
          <span><u-icon name="arrow-right"></u-icon></span>
        </div>
      </div>
    </div>
    <AiEmpty description="暂无数据" v-else />
  </div>
</template>

<script>
export default {
  name: 'AppInfotainment',
  appName: '宣传资讯',
  data() {
    return {
      current: 1,
      categoryType: '0',
      list: [],
      parentName: ''
    }
  },
  onLoad(o) {
    this.parentName = o.listName
  },
  onShow() {
    document.title = this.parentName
    if(this.parentName.length) {
      this.getList()
    }
  },
  methods: {
    getList() {
      this.$http.post('/app/apppublicitycategory/list',null,{
        params: {
          current: this.current,
          parentName: this.parentName,
          categoryType: '1',
        }
      }).then((res)=>{
        this.list = this.current == 1? res.data.records:[...this.list,...res.data.records,]
      })
    },
    toNewList(id,categoryName) {
      uni.navigateTo({url: `./newList?id=${id}&parentName=${categoryName}`})
    }
  },
  onReachBottom() {
    this.current ++,
    this.getList()
  }
}
</script>

<style lang="scss" scoped>
.AppInfotainment {
  ::v-deep .AppInfotainment {
    background: none;
  }
  .fiveIndustry {
    
    .title {
      padding: 30px 32px;
      box-sizing: border-box;
      height: 256px;
      background: #FFF url('./components/bg.png') no-repeat right;
      background-size: 336px 256px;
      h2 {
        margin-top: 20px;
        font-size: 50px;
        font-weight: 800;
      }
      p {
        margin-top: 16px;
        font-size: 30px;
        color: #999999;
      }
    }

    .list {
      margin-top: 24px;
      background: #FFF;
      padding: 0 32px 40px 32px;
      box-sizing: border-box;
      .item {
        display: flex;
        justify-content: space-between;
        padding: 30px 0;
        border-bottom: 1px solid #D8DDE6;
      }
    }
  }
}
</style>