明梦爽
2022-08-15 6cf9fe5c9eb7dc664b7a64454cd327d08baf1a93
src/views/notice.vue
@@ -1,26 +1,18 @@
<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>
      <span @click="goMore('通知公告')" class="liPointer"> 更多<i class="el-icon-d-arrow-right"></i> </span>
    </el-row>
    <div>
    <!-- 通知公告新闻列表 -->
    <div style="max-height:382px;overflow:hidden;">
      <ul>
        <li
          class="lieBiao liPointer"
          :key="index"
          v-for="(item, index) in noticeList"
        >
        <li class="lieBiao liPointer" :key="index" v-for="(item, index) in noticeList">
          <div class="time">
            <!-- <span>{{ item.categoryId }}</span>
            <span>{{ item.contypeId }}</span> -->
            <span>{{ item.years }}</span>
            <span>{{ item.date }}</span>
            {{ item.releaseTime }}
          </div>
          <div class="title" @click="toNoticeMsg(item.title)">
          <div class="title" @click="toNoticeMsg(item.id)">
            {{ item.title }}
          </div>
        </li>
@@ -29,43 +21,57 @@
  </div>
</template>
<script>
import axios from 'axios'
import { getMinTitle, getNewsList } from '../api/api'
export default {
  name: 'notice',
  data() {
    return {
      noticeList: [
        {years:'2021',date:'11-17',title:'平顶山学院高层次人才招聘公告'},
        {years:'2021',date:'11-17',title:'关于开展“我为学校‘十四五’规划建言献策”活动的通知'},
        {years:'2021',date:'11-17',title:'平顶山学院及附属口腔医院招聘口腔医学专业人才公告'},
        {years:'2021',date:'11-17',title:'平顶山学院2020-2021学年本科教学质量报告'},
        {years:'2021',date:'11-17',title:'关于推荐全省高校学生工作专家库专家的通知'},
        {years:'2021',date:'11-17',title:'平顶山学院2022届毕业生冬季网络视频双选会邀请函'},
      ]
      // {
      //   categoryId: 1,
      //   contypeId: 2,
      //   coverPath: '13',
      //   dataString: '123',
      //   title:"12"
      // }
      noticeList: []
    }
  },
  created() {
    // getnews() {
    //   const res = this.$http.post('newsTheme/insert',this.noticeList)
  created() {},
  mounted() {
    //获取小标题
    // axios.get('http://localhost:8080/news_category/list/1').then(res => {
    //   console.log(res);
    // }
    //   if(res.status==200){
    //     this.noticeList = res.data.data
    //   }
    // }).catch(err => {
    //   console.log(err);
    // })
    this.getnews()
  },
  methods: {
    toNoticeMsg(t) {
    //获取新闻列表
    getnews() {
      const data = {
        current: 1,
        newsCategoryId: 42,
        size: 6
      }
      getNewsList(data)
        .then(res => {
          console.log(res)
          if (res.code == 200) {
            this.noticeList = res.data.records
          }
        })
        .catch(error => {
          console.log(error)
        })
    },
    // 去到新闻展示页
    toNoticeMsg(id) {
      this.$router.push({
        path: '/home/noticeMessage',
        path: '/home/news',
        query: {
          title: t
          id: id
        }
      })
    },
    //去到更多新闻列表页
    goMore(val) {
      this.$router.push({
        path: '/home/moreMessage',
@@ -82,7 +88,7 @@
  border-bottom: 1px solid rgb(1, 72, 153);
}
.lieBiao {
  width: 95%;
  width: 100%;
  height: 55px;
  background: rgb(241, 241, 241);
  display: flex;
@@ -91,12 +97,10 @@
  margin-bottom: 10px;
}
.time {
  width: 80px;
  overflow: hidden;
  width: 100px;
  padding: 17px 0px;
  display: flex;
  // line-height: 20px;
  flex-direction: column;
  padding: 8px ;
  background-color: rgb(1, 72, 153);
  color: white;
  text-align: center;
@@ -106,6 +110,7 @@
  height: 50px;
  overflow: hidden;
  line-height: 50px;
  // background-color: rgb(179, 19, 19);
  padding: 0 0 0 10px;
}
</style>
</style>