明梦爽
2022-08-09 5d3f2aa7ccd9f761a6fd4224e7b49ceb6830abea
src/views/school.vue
@@ -1,49 +1,65 @@
<template>
  <div>
    <el-row type="flex" justify="space-between" class="underline">
      <span>学院动态</span>
      <span class="color"><b>学院动态</b></span>
      <span @click="goMore('学院动态')" class="liPointer">更多<i class="el-icon-d-arrow-right"></i> </span>
    </el-row>
    <div>
    <div style="max-height:420px;overflow:hidden;">
      <ul>
        <li :key="index" v-for="(item, index) in schoolList" class="liPointer">
          <!-- <a href="item.path"> {{ item.title }} </a> -->
          <!-- <router-link :to="{name:'schoolMessage',params:{id:item.id}}" >{{ item.title }} </router-link> -->
          <div @click="toSchoolMsg(item.title)"> {{ item.title }} </div>
          <div @click="toSchoolMsg(item.id)" class="bgc mart10">
            {{ item.title }}
          </div>
        </li>
      </ul>
    </div>
  </div>
</template>
<script>
import { getNewsList } from '../api/api'
export default {
  name: 'school',
  data() {
    return {
      schoolList: [
        { id: '1',title: '学校状态1' },
        { id: '2',title: '学校状态2' },
        { id: '3',title: '学校状态3' },
        { id: '4',title: '学校状态4' },
        { id: '5',title: '学校状态5' },
        { id: '6',title: '学校状态6' }
      ]
      schoolList: []
    }
  },
  methods:{
    goMore(val){
  created() {
    this.getnews()
  },
  methods: {
    getnews() {
      const data = {
        current: 1,
        newsCategoryId: 44,
        size: 6
      }
      getNewsList(data)
        .then(res => {
          console.log(res)
          if (res.code == 200) {
            this.schoolList = res.data.records
          }
        })
        .catch(error => {
          console.log(error)
        })
    },
    //前往更多信息页面
    goMore(val) {
      this.$router.push({
        path:'moreMessage',
        query:{
          type:val,
        path: 'moreMessage',
        query: {
          type: val
        }
      })
    },
    toSchoolMsg(t) {
    //前往信息展示页面
    toSchoolMsg(id) {
      this.$router.push({
        path: 'schoolMessage',
        path: '/home/news',
        query: {
          title:t
          id: id
        }
      })
    }
@@ -52,7 +68,7 @@
</script>
<style lang="less" scoped>
.underline {
  border-bottom: 1px solid rgb(0, 110, 215);
  border-bottom: 1px solid rgb(1, 72, 153);
}
ul {
  padding-left: 0;
@@ -65,4 +81,9 @@
a {
  text-decoration: none;
}
</style>
.bgc {
  background: rgb(241, 241, 241);
  height: 55px;
  line-height: 55px;
}
</style>