明梦爽
2022-08-09 ece9b6bba5a44a06041a8ad4d5f5ac1f14560d3e
src/views/school.vue
@@ -4,46 +4,62 @@
      <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)" class="bgc mart10"> {{ 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: '河南省生态经济型木本植物种质创新与利用重点实验室建设项目' },
        { id: '2',title: '平顶山学院智慧校园软件及实验室管理平台二期' },
        { id: '3',title: '平顶山学院新工科实训楼和产教融合实训楼全过程跟踪审计服务' },
        { id: '4',title: '平顶山学院智慧校园综合业务服务系统(一期)' },
        { id: '5',title: '平顶山学院2021-2022第二学期医用低值易耗品采购项目公告' },
        { id: '6',title: '平顶山学院软件实验室硬盘采购项目竞争性谈判公告' }
      ]
      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
        }
      })
    }
@@ -70,4 +86,4 @@
  height: 55px;
  line-height: 55px;
}
</style>
</style>