1.0
明梦爽
2022-01-10 3fbb5e3166522734fd5407bcdf76c384d40e9dfa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<template>
  <div>
    <!-- 通知公告导航条 -->
    <el-row type="flex" class="row-bg underline marb10" justify="space-between">
      <span class="color"><b>通知公告</b></span>
      <span @click="goMore('通知公告')" class="liPointer">
        更多<i class="el-icon-d-arrow-right"></i>
      </span>
    </el-row>
    <!-- 通知公告新闻列表 -->
    <div style="max-height:382px;overflow:hidden;">
      <ul>
        <li class="lieBiao liPointer" :key="index" v-for="(item, index) in noticeList">
          <div class="time">
            <span>{{ item.year }}</span>
            <span>{{ item.month }}</span>
          </div>
          <div class="title" @click="toNoticeMsg(item.id,item.count)">
            {{ item.news }}
          </div>
        </li>
      </ul>
    </div>
  </div>
</template>
<script>
import {getNewsList} from '../api/api'
export default {
  name: 'notice',
  data() {
    return {
     noticeList: [{id:1,year: 2022,month:'1-10',count:10, news:'你走过的地方只剩下思念难捱,把你藏在心头,每天每夜想你'},{id:2,year: 2022,month:'1-10',count:11, news:'你走过的地方只剩下思念难捱,把你藏在心头,每天每夜想你'},
      {id:3,year: 2022,month:'1-10',count:12, news:'你走过的地方只剩下思念难捱,把你藏在心头,每天每夜想你'},{id:4,year: 2022,month:'1-10',count:13, news:'你走过的地方只剩下思念难捱,把你藏在心头,每天每夜想你'},
      {id:5,year: 2022,month:'1-10',count:14, news:'你走过的地方只剩下思念难捱,把你藏在心头,每天每夜想你'},{id:6,year: 2022,month:'1-10',count:14, news:'你走过的地方只剩下思念难捱,把你藏在心头,每天每夜想你'},
      {id:6,year: 2022,month:'1-10',count:15, news:'你走过的地方只剩下思念难捱,把你藏在心头,每天每夜想你'},{id:6,year: 2022,month:'1-10',count:16, news:'你走过的地方只剩下思念难捱,把你藏在心头,每天每夜想你'},
      {id:6,year: 2022,month:'1-10',count:16, news:'你走过的地方只剩下思念难捱,把你藏在心头,每天每夜想你'},{id:6,year: 2022,month:'1-10',count:17, news:'你走过的地方只剩下思念难捱,把你藏在心头,每天每夜想你'}],
    }
  },
  created() {
    this.getnews();
  },
  methods: {
    //获取新闻列表
    getnews() {
      const data = {
        categoryId: 1,//小标题ID
        contypeId: 2,//大标题ID
        p: 0//当前页
      };
      getNewsList(data).then(res => {
        console.log('res',res);
        if(res.code == 200){
          this.noticeList = res.data.records
        }
      }).catch(err => {
        console.log('err',err);
      })
    },
    // 去到新闻展示页
    toNoticeMsg(id,count) {
      this.$router.push({
        path: '/home/noticeMessage',
        query: {
          id:id,
          count:count
        }
      })
    },
    //去到更多新闻列表页
    goMore(val) {
      this.$router.push({
        path: '/home/moreMessage',
        query: {
          type: val
        }
      })
    }
  }
}
</script>
<style lang="less" scoped>
.underline {
  border-bottom: 1px solid rgb(1, 72, 153);
}
.lieBiao {
  width: 95%;
  height: 55px;
  background: rgb(241, 241, 241);
  display: flex;
  justify-content: space-between;
  overflow: hidden;
  margin-bottom: 10px;
}
.time {
  width: 80px;
  overflow: hidden;
  display: flex;
  // line-height: 20px;
  flex-direction: column;
  padding: 8px;
  background-color: rgb(1, 72, 153);
  color: white;
  text-align: center;
}
.title {
  width: 500px;
  height: 50px;
  overflow: hidden;
  line-height: 50px;
  padding: 0 0 0 10px;
}
</style>