<template>
    <div class="p_all_20">
        <div class="container0">

          <el-row class="box" v-for="(item,index) in newsData" :key="index">
            <el-col :span="24">
              <router-link :to="'/notice/details?id=' + item.noticeId" class="link">
                <h3 class="title_item">{{item.title}}</h3>
                <p class="time_show">时间：{{item.time}}</p>
                <div class="text_info">{{item.content}}</div>
                <span class="label" v-if="item.type == 0"><img src="@/assets/img/state_1.png" alt=""></span>
                <span class="label" v-if="item.type == 1"><img src="@/assets/img/state_2.png" alt=""></span>
              </router-link>
              </el-col>
          </el-row>
         
          <div class="pagination">
            <!-- <pagination
              @eventSizeChange="eventSizeChange"
              @eventCurrentChange="eventCurrentChange"
              :total="total"
              :pageSize="pageSize"
            ></pagination> -->
            <div class="pagination">
                <pagination @eventSizeChange="eventSizeChange" @eventCurrentChange="eventCurrentChange" :total="total" :pageSize="pageSize"></pagination>
              </div>
          </div>
        </div>
    </div>
</template>

<script>
import pagination from "@/components/common/pagination"
    export default {
        name: 'noticeList',
        data() {
            return {
              pageSize:20,
              total:0,
              pageNum:1,
              newsData:[]
            }
        },
        components:{
          pagination,
        },
        mounted(){
          this.getData()
        },
        methods: {
          getData(){
            var params = {
               pageNum:this.pageNum,
               pageSize:this.pageSize
            }
            this.$axios.get('/notice/list',{
             params
              })
            .then((res) => {
              if(res.data.code == 200){
                this.newsData = res.data.data.list;
                this.total = ~~res.data.data.total;
              }else{
                this.$message.error(res.data.message);
              }
            })
            .catch((err) => {console.log(err)})
          },
          eventSizeChange(e) {
            this.pageSize = e;
            this.getData();
          },
          eventCurrentChange(e) {
            this.pageNum = e;
            this.getData();
          },
        },
    }

</script>

<style scoped>
.box{
  margin-bottom: 15px;
}
.link{
  display: block;
  padding-left: 56px;
  padding-top: 10px;
  padding-bottom:16px;
  border-bottom: 1px solid #dcdcdc;
  color:#000;
}
.title_item {
    font-size: 18px;
    padding-bottom: 6px;
    position: relative;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.time_show {
    color: #999;
    padding-bottom: 12px;
    font-size: 14px;
}
.text_info {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
}
.label{
  display: block;
  position: absolute;
  left: 0;
  top: 10px;
  width: 56px;
  height: 20px;
}
</style>

