wangguoyu hace 5 años
padre
commit
f1f8d89fd2

+ 8 - 0
src/api/login.js

@@ -41,3 +41,11 @@ export function homeLinksList(data = {}) {
                        data,
                        data,
                    });
                    });
 }
 }
+//  describe: 【前台】新闻资讯  author: Wgy date:2020-08-10
+export function homeNewsList(data = {}) {
+    return request({
+                       url:    `/home/news/list`,
+                       method: 'post',
+                       data,
+                   });
+}

+ 4 - 9
src/components/client/common/header.vue

@@ -51,41 +51,36 @@
         computed:   {},
         computed:   {},
         methods:    {
         methods:    {
             handleSelect(key, keyPath) {
             handleSelect(key, keyPath) {
-                console.log(key);
                 switch (Number(key)) {
                 switch (Number(key)) {
                     case 0:
                     case 0:
                         this.$router.push({ name: 'index'});
                         this.$router.push({ name: 'index'});
-                        this.activeIndex = '0';
                         break;
                         break;
                     case 1:
                     case 1:
                         this.$router.push({ name: 'examPlatform'});
                         this.$router.push({ name: 'examPlatform'});
-                        this.activeIndex = '1';
                         break;
                         break;
                     case 2:
                     case 2:
                         this.$router.push({ name: 'peixunPlatform'});
                         this.$router.push({ name: 'peixunPlatform'});
-                        this.activeIndex = '2';
                         break;
                         break;
                     case 3:
                     case 3:
                         this.$router.push({ name: 'courseDev'});
                         this.$router.push({ name: 'courseDev'});
-                        this.activeIndex = '3';
+
                         break;
                         break;
                     case 4:
                     case 4:
                         this.$router.push({ name: 'newsInfor'});
                         this.$router.push({ name: 'newsInfor'});
-                        this.activeIndex = '4';
+
                         break;
                         break;
                     case 5:
                     case 5:
                         this.$router.push({ name: 'helpCenter'});
                         this.$router.push({ name: 'helpCenter'});
-                        this.activeIndex = '5';
+
                         break;
                         break;
                     case 6:
                     case 6:
                         this.$router.push({ name: 'aboutUs'});
                         this.$router.push({ name: 'aboutUs'});
-                        this.activeIndex = '6';
+
                         break;
                         break;
 
 
                     default:
                     default:
 
 
                 }
                 }
-
             },
             },
         }
         }
         ,
         ,

+ 7 - 7
src/router.js

@@ -22,13 +22,6 @@ const router = new Router({
                                       redirect: '/index',
                                       redirect: '/index',
                                   },
                                   },
                                   {
                                   {
-                                      name:      'index',
-                                      path:      '/index',
-                                      component: () => {
-                                          return import(/* webpackChunkName: "index" */ './views/client/Index.vue');
-                                      },
-                                  },
-                                  {
                                       name:      'Login',
                                       name:      'Login',
                                       path:      '/login',
                                       path:      '/login',
                                       component: () => {
                                       component: () => {
@@ -40,6 +33,13 @@ const router = new Router({
                                       component: () => import(/* webpackChunkName: "Cframe" */ './components/client/common/Cframe.vue'),
                                       component: () => import(/* webpackChunkName: "Cframe" */ './components/client/common/Cframe.vue'),
                                       children:  [
                                       children:  [
                                           {
                                           {
+                                              name:      'index',
+                                              path:      '/index',
+                                              component: () => {
+                                                  return import(/* webpackChunkName: "index" */ './views/client/Index.vue');
+                                              },
+                                          },
+                                          {
                                               name:      'examPlatform',
                                               name:      'examPlatform',
                                               path:      '/examPlatform',
                                               path:      '/examPlatform',
                                               meta:      {
                                               meta:      {

+ 0 - 6
src/views/client/Index.vue

@@ -1,8 +1,5 @@
 <template>
 <template>
     <div class="client-index-page">
     <div class="client-index-page">
-        <!-- 首页导航栏 -->
-        <mta-header></mta-header>
-
         <!-- 首页banner栏 -->
         <!-- 首页banner栏 -->
         <div class="client-banner">
         <div class="client-banner">
             <div class="client-container">
             <div class="client-container">
@@ -204,9 +201,6 @@
             </el-carousel>
             </el-carousel>
         </div>
         </div>
 
 
-        <!-- 底部footer -->
-        <mta-footer></mta-footer>
-
     </div>
     </div>
 </template>
 </template>
 
 

+ 53 - 16
src/views/client/newsInfor.vue

@@ -1,13 +1,13 @@
 <template>
 <template>
     <div class="client-newsInfor-page">
     <div class="client-newsInfor-page">
         <!-- 新闻资讯banner栏 -->
         <!-- 新闻资讯banner栏 -->
-        <div class="newsInfor-banner"></div>
+     <!--   <div class="newsInfor-banner"></div>-->
 
 
         <!-- 新闻资讯tab页 -->
         <!-- 新闻资讯tab页 -->
         <div class="client-container newsInfor-tab-box">
         <div class="client-container newsInfor-tab-box">
             <el-tabs tab-position="left" v-model="activeName" @tab-click="handleClick" class="client-newsInfor-tab">
             <el-tabs tab-position="left" v-model="activeName" @tab-click="handleClick" class="client-newsInfor-tab">
-                <el-tab-pane label="行业动态">
-                    <div class="tab-state-box">
+                <el-tab-pane name="1" label="行业动态">
+                    <div class="tab-state-box" v-infinite-scroll="load" infinite-scroll-disabled="disabled" >
                         <ul>
                         <ul>
                             <li>
                             <li>
                                 <img :src="newsInforImg" alt="行业动态">
                                 <img :src="newsInforImg" alt="行业动态">
@@ -18,19 +18,14 @@
                                     <a>了解更多</a>
                                     <a>了解更多</a>
                                 </div>
                                 </div>
                             </li>
                             </li>
-                            <li>
-                                <img :src="newsInforImg" alt="行业动态">
-                                <div class="newsInfor-list-content">
-                                    <h1>企业为什么需要微课</h1>
-                                    <div><i></i><span>2020-08-03</span><i type="visits"></i><span>2000</span></div>
-                                    <p>“在美国谷歌工作期间,我亲眼见到容器技术的先进性,由此产生了创业的想法。”在采访中,才云科技创始人兼CEO、原谷歌资深软件工程师张鑫向创业邦这样介绍道。他曾作为技术带头人从事谷歌容器化集群管理系统的研发,自动化管理 95% 以上的</p>
-                                    <a>了解更多</a>
-                                </div>
-                            </li>
+                            <p v-if="loading" style="margin-top:10px;" class="loading">
+                                <span></span>
+                            </p>
+                            <p v-if="noMore" style="margin-top:10px;font-size:13px;color:#ccc">没有更多了</p>
                         </ul>
                         </ul>
                     </div>
                     </div>
                 </el-tab-pane>
                 </el-tab-pane>
-                <el-tab-pane label="媒体关注">媒体关注</el-tab-pane>
+                <el-tab-pane name="2" label="媒体关注">媒体关注</el-tab-pane>
             </el-tabs>
             </el-tabs>
         </div>
         </div>
     </div>
     </div>
@@ -38,24 +33,63 @@
 
 
 <script>
 <script>
     import MtaBreadcrumb    from '@/components/client/common/MtaBreadcrumb.vue';
     import MtaBreadcrumb    from '@/components/client/common/MtaBreadcrumb.vue';
+    import { homeNewsList } from '@/api/login.js';
     export default {
     export default {
         name:       'newsInfor',
         name:       'newsInfor',
         props:      {
         props:      {
         },
         },
         data() {
         data() {
             return {
             return {
+                activeName:'1',
                 newsInforImg:  require(`@/assets/images/client/newsInfor/newsInfor-list-img.png`),
                 newsInforImg:  require(`@/assets/images/client/newsInfor/newsInfor-list-img.png`),
+                count: 0,//起始页数值为0
+                loading: false,
+                totalPages: "",//取后端返回内容的总页数
+                list: [] //后端返回的数组
             };
             };
         },
         },
         components: {
         components: {
             MtaBreadcrumb
             MtaBreadcrumb
         },
         },
-        computed:   {},
+        computed:   {
+            noMore() {
+                //当起始页数大于总页数时停止加载
+                return this.count >= this.totalPages - 1;
+            },
+            disabled() {
+                return this.loading || this.noMore;
+            }
+        },
         methods:    {
         methods:    {
+            load() {
+                //滑到底部时进行加载
+                this.loading = true;
+                setTimeout(() => {
+                    this.count += 1; //页数+1
+                    this.getMessage(); //调用接口,此时页数+1,查询下一页数据
+                }, 2000);
+            },
+            handleClick(data,data1){
+                console.log(data);
+                console.log(data1);
 
 
+            },
+            getMessage(){
+                let req = {
+                    newsClassifyId : 0,
+                    page : 1,
+                    size : 4,
+                    };
+                homeNewsList(req).then(res=>{
+                       if(res.code===0){
+                            console.log(res);
+                       }
+                })
+
+            }
         },
         },
         created() {
         created() {
-
+            this.getMessage()
         },
         },
         mounted() {
         mounted() {
 
 
@@ -65,5 +99,8 @@
     };
     };
 </script>
 </script>
 <style>
 <style>
-
+    .tab-state-box {
+        height: 700px;
+        overflow-y: auto;
+    }
 </style>
 </style>