1.0
明梦爽
2022-01-10 3fbb5e3166522734fd5407bcdf76c384d40e9dfa
1.0
8个文件已修改
254 ■■■■ 已修改文件
src/api/api.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/Home.vue 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/router.js 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/homePage/moreMessage.vue 114 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/homePage/noticeMessage.vue 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/notice.vue 27 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/school.vue 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/work.vue 41 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/api.js
@@ -2,7 +2,7 @@
//post请求参数放在data里面,get请求参数放在params里边
import request from "../utils/request";
//导航栏列表
// 导航栏列表
export const getNavList = data => {
  return request({
    method: 'GET',
src/components/Home.vue
@@ -11,20 +11,8 @@
    </el-header>
    <!-- 主页导航栏 -->
    <el-row>
      <el-menu
        mode="horizontal"
        background-color="rgb(64, 112, 186)"
        text-color="white"
        class="menu"
        active-text-color="#000000"
        :default-active="activeIndex"
        @select="handleSelect"
      >
        <el-menu-item
          :key="index"
          v-for="(item, index) in menuList"
          :index="(item.id).toString()"
        >
      <el-menu mode="horizontal" background-color="rgb(64, 112, 186)" text-color="white" class="menu" active-text-color="#000000" :default-active="activeIndex" @select="handleSelect">
        <el-menu-item :key="index" v-for="(item, index) in menuList" :index="(item.id).toString()">
          {{ item.contypeName }}
        </el-menu-item>
      </el-menu>
@@ -46,28 +34,30 @@
  data() {
    return {
      activeIndex: '1',
      menuList: [],
      menuList: [{contypeName: '首页',id: 1},{contypeName: '科协概况',id: 2},{contypeName: '政策法规',id: 3},{contypeName: '科协项目',id: 4},
      {contypeName: '学术交流',id: 5},{contypeName: '办事指南',id: 6},{contypeName: '科普风采',id: 7},{contypeName: '学校首页',id: 8},
      {contypeName: '联系我们',id: 9}],
    }
  },
  created() {
    this.getNavArr();
    // this.getNavArr();
  },
  mounted() {},
  watch: {},
  methods: {
    //获取导航栏
    getNavArr(){
      const data ={};
      //.then() 主要用于一个函数用到另一个函数的返回值
      getNavList(data).then(res => {
        console.log('res', res)
        if(res.code == 200){
          this.menuList = res.data
        }
      }).catch(err => {
        console.log('err', err)
      })
    },
    // //获取导航栏
    // getNavArr(){
    //   const data ={};
    //   getNavList(data).then(res => {
    //     console.log('res', res)
    //     if(res.code == 200){
    //       this.menuList = res.data
    //     }
    //   }).catch(err => {
    //     console.log('err', err)
    //   })
    // },
    formatterTitle(t){
      switch(t){
        case '1':
src/router.js
@@ -97,7 +97,13 @@
        },
      ]
    }
  ]
  ],
  scrollBehavior(to, from, savedPosition) { //页面跳转后自动回到顶部
    if (savedPosition) {
        return savedPosition
    }
    return {x: 0, y: 0}
  }
})
// 挂载路由导航守卫
src/views/homePage/moreMessage.vue
@@ -6,36 +6,42 @@
    <div class="mart15">
      <div v-if="this.$route.query.type == '通知公告'">
        <ul>
          <li
            class="lieBiao flex-v flex-conter padt10 liPointer"
            :key="index"
            v-for="(item, index) in noticeList"
          >
          <li class="lieBiao flex-v flex-between" :key="index" v-for="(item, index) in noticeList">
            <div class="time">
              <span>{{ item.date }}</span>
              <span>{{ item.years }}</span>
              <span>{{ item.year }}</span>
              <span>{{ item.month }}</span>
            </div>
            <div class="title" @click="toNoticeMsg(item.title)">
              {{ item.title }}
            <div class="title liPointer" @click="toNoticeMsg(item.id,item.count)">
              {{ item.news }}
            </div>
          </li>
        </ul>
      </div>
      <div v-if="this.$route.query.type == '学院动态'">
        <ul>
          <li :key="index" v-for="(item, index) in schoolList" class="liPointer">
          <li class="lieBiao flex-v flex-between" :key="index" v-for="(item, index) in schoolList">
            <!-- <a href="item.path"> {{ item.title }} </a> -->
            <!-- <router-link :to="{name:'schoolMessage',params:{id:item.id}}" >{{ item.title }} </router-link> -->
            <div @click="toNoticeMsg(item.title)">{{ item.title }}</div>
            <div class="time">
              <span>{{ item.year }}</span>
              <span>{{ item.month }}</span>
            </div>
            <div  class="title liPointer" @click="toSchoolMsg(item.id,item.count)">
              {{ item.news }}
            </div>
          </li>
        </ul>
      </div>
      <div v-if="this.$route.query.type == '工作状态'">
        <ul>
          <li :key="index" v-for="(item, index) in workList" class="liPointer">
          <li class="lieBiao flex-v flex-between" :key="index" v-for="(item, index) in workList">
            <!-- <a href="item.path"> {{ item.title }} </a> -->
            <!-- <router-link :to="{name:'schoolMessage',params:{id:item.id}}" >{{ item.title }} </router-link> -->
            <div @click="toNoticeMsg(item.title)">{{ item.title }}</div>
            <div class="time">
              <span>{{ item.year }}</span>
              <span>{{ item.month }}</span>
            </div>
            <div class="title liPointer" @click="toWorkMsg(item.id,item.count)">{{ item.news }}</div>
          </li>
        </ul>
      </div>
@@ -47,39 +53,55 @@
  name: 'moreMessage',
  data() {
    return {
      noticeList: [
        { years: '2021', date: '11-2', title: '我是标题1' },
        { years: '2021', date: '11-2', title: '我是标题2' },
        { years: '2021', date: '11-2', title: '我是标题3' },
        { years: '2021', date: '11-2', title: '我是标题4' },
        { years: '2021', date: '11-2', title: '我是标题5' }
      ],
      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' }
      ],
      workList: [
        { id:'1', title: '工作状态1' },
        { id:'2', title: '工作状态2' },
        { id:'3', title: '工作状态3' },
        { id:'4', title: '工作状态4' },
        { id:'5', title: '工作状态5' },
        { id:'6', title: '工作状态6' },
      ]
      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:'你走过的地方只剩下思念难捱,把你藏在心头,每天每夜想你'}],
      schoolList: [{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:'唐三藏参见女王陛下'}],
      workList: [{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:'黑人超白竹炭深洁牙膏'}],
    }
  },
  methods: {
    toNoticeMsg(t) {
    toNoticeMsg(id,count) {
      this.$router.push({
        path: '/home/noticeMessage',
        query: {
          title: t
          id: id,
          count: count
        }
      })
      window.location.reload()
    },
    toSchoolMsg(id,count) {
      this.$router.push({
        path: '/home/schoolMessage',
        query: {
          id: id,
          count: count
        }
      })
      window.location.reload()
    },
    toWorkMsg(id,count) {
      this.$router.push({
        path: '/home/workMessage',
        query: {
          id: id,
          count: count
        }
      })
      window.location.reload()
    }
  }
}
@@ -90,20 +112,22 @@
}
.lieBiao {
  width: 95%;
  height: 80px;
  background: rgb(202, 202, 202);
  overflow: hidden;
  height: 60px;
  background: rgb(241, 241, 241);
  margin-bottom: 10px;
}
.time {
  width: 100px;
  overflow: hidden;
  width: 80px;
  display: flex;
  flex-direction: column;
  padding: 8px;
  background-color: rgb(1, 72, 153);
  color: white;
  text-align: center;
}
.title {
  width: 500px;
  width: 1030px;
  height: 70px;
  overflow: hidden;
}
</style>
</style>
src/views/homePage/noticeMessage.vue
@@ -1,7 +1,6 @@
<template>
  <div>
    <span>noticeMessage</span>
    <p>{{ this.$route.query.title }}</p>
    <p>{{ this.$route.query.id }} 点击量:【{{this.$route.query.count}}】</p>
    <div v-html="message"></div>
  </div>
</template>
@@ -14,7 +13,7 @@
    }
  },
  created(){
    console.log(">>>>>>>>",this.$route.query.title);
    console.log(">>>>>>>>",this.$route.query.id);
    this.queryAll();
  },
  methods:{
src/views/notice.vue
@@ -10,17 +10,13 @@
    <!-- 通知公告新闻列表 -->
    <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.contypeId }}</span>
            <span>{{ item.categoryId }}</span>
            <span>{{ item.year }}</span>
            <span>{{ item.month }}</span>
          </div>
          <div class="title" @click="toNoticeMsg(item.title,item.id)">
            {{ item.dataString }}
          <div class="title" @click="toNoticeMsg(item.id,item.count)">
            {{ item.news }}
          </div>
        </li>
      </ul>
@@ -33,8 +29,11 @@
  name: 'notice',
  data() {
    return {
      noticeList: [
      ]
     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() {
@@ -58,12 +57,12 @@
      })
    },
    // 去到新闻展示页
    toNoticeMsg(t,id) {
    toNoticeMsg(id,count) {
      this.$router.push({
        path: '/home/noticeMessage',
        query: {
          title: t,
          id:id
          id:id,
          count:count
        }
      })
    },
src/views/school.vue
@@ -12,7 +12,7 @@
          <!-- <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 }}
            {{ item.news }}
          </div>
        </li>
      </ul>
@@ -25,8 +25,11 @@
  name: 'school',
  data() {
    return {
      schoolList: [
      ]
      schoolList: [{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() {
src/views/work.vue
@@ -10,7 +10,7 @@
      <ul>
        <li :key="index" v-for="(item, index) in workList" class="liPointer">
          <div @click="toWorkMsg(item.title)" class="bgc mart10">
            {{ item.dataString }}
            {{ item.news }}
          </div>
        </li>
      </ul>
@@ -23,30 +23,33 @@
  name:'work',
  data(){
    return{
      workList: [
      ]
      workList: [{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();
    // this.getnews();
  },
  methods:{
    //获取新闻列表
    getnews() {
      const data = {
        categoryId: 2,//小标题ID
        contypeId: 2,//大标题ID
        p: 0//当前页
      };
      getNewsList(data).then(res => {
        console.log('res',res);
        if(res.code == 200){
          this.workList = res.data.records
        }
      }).catch(err => {
        console.log('err',err);
      })
    },
    // getnews() {
    //   const data = {
    //     categoryId: 2,//小标题ID
    //     contypeId: 2,//大标题ID
    //     p: 0//当前页
    //   };
    //   getNewsList(data).then(res => {
    //     console.log('res',res);
    //     if(res.code == 200){
    //       this.workList = res.data.records
    //     }
    //   }).catch(err => {
    //     console.log('err',err);
    //   })
    // },
    toWorkMsg(t) {
      this.$router.push({
        path:'/home/workMessage',