Procházet zdrojové kódy

首页右侧固定导航/新闻中心

yangzj před 2 roky
rodič
revize
2c49efa7d4

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 10 - 0
src/assets/images/email-icon.svg


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 10 - 0
src/assets/images/search-icon.svg


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 10 - 0
src/assets/images/telephone-icon.svg


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 13 - 0
src/assets/images/top-icon.svg


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 13 - 0
src/assets/images/weixin-icon.svg


+ 18 - 12
src/components/BannerBreadcrumb/index.vue

@@ -3,7 +3,7 @@
  * @Author: 空白格
  * @Date: 2022-08-11 13:44:08
  * @LastEditors: 空白格
- * @LastEditTime: 2022-08-11 13:49:12
+ * @LastEditTime: 2022-08-22 10:25:33
  * @FilePath: \veterans_client_web\src\components\BannerBreadcrumb\index.vue
  * @Copyright: Copyright (c) 2016~2022 by 空白格, All Rights Reserved.
 -->
@@ -14,25 +14,31 @@
       <div class="banner-breadcrumb-header-title">{{ title }}</div>
     </div>
     <!-- 面包屑 -->
-    <div class="banner-breadcrumb-breadcrumb">
-      <el-breadcrumb separator-class="el-icon-arrow-right">
-        <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
-        <el-breadcrumb-item>{{ title }}</el-breadcrumb-item>
-      </el-breadcrumb>
-    </div>
+    <template v-if="breadcrumb">
+      <div class="banner-breadcrumb-breadcrumb">
+        <el-breadcrumb separator-class="el-icon-arrow-right">
+          <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
+          <el-breadcrumb-item>{{ title }}</el-breadcrumb-item>
+        </el-breadcrumb>
+      </div>
+    </template>
   </div>
 </template>
 
 <script>
 export default {
-  name: 'BannerBreadcrumb',
+  name: "BannerBreadcrumb",
   props: {
     title: {
       type: String,
-      default: ''
-    }
-  }
-}
+      default: "",
+    },
+    breadcrumb: {
+      type: Boolean,
+      default: true,
+    },
+  },
+};
 </script>
 
 <style lang="scss" scoped>

+ 9 - 0
src/router/index.js

@@ -138,6 +138,15 @@ const routes = [
         meta: {
           title: '退役军人认证'
         }
+      },
+      {
+        path: 'newscenter',
+        name: 'NewsCenterIndex',
+        component: () =>
+          import('@/views/NewsCenter/NewsCenterIndex.vue'),
+        meta: {
+          title: '新闻中心'
+        }
       }
     ]
   },

+ 2 - 1
src/views/CooperativeColleges/CollegesDetails/CollegesDetailsIndex.vue

@@ -3,7 +3,7 @@
  * @Author: 空白格
  * @Date: 2022-08-16 10:40:45
  * @LastEditors: 空白格
- * @LastEditTime: 2022-08-16 11:44:55
+ * @LastEditTime: 2022-08-22 10:08:53
  * @FilePath: \veterans_client_web\src\views\CooperativeColleges\CollegesDetails\CollegesDetailsIndex.vue
  * @Copyright: Copyright (c) 2016~2022 by 空白格, All Rights Reserved.
 -->
@@ -204,6 +204,7 @@ export default {
     const { schoolId } = this.$route.query;
     if (schoolId) {
       this.getSchoolDetails(schoolId);
+      document.documentElement.scrollTop = 0;
     }
   },
   methods: {

+ 2 - 1
src/views/CooperativeEnterprise/EnterpriseDetails/EnterpriseDetailsIndex.vue

@@ -3,7 +3,7 @@
  * @Author: 空白格
  * @Date: 2022-08-15 14:54:50
  * @LastEditors: 空白格
- * @LastEditTime: 2022-08-16 13:27:50
+ * @LastEditTime: 2022-08-22 10:08:18
  * @FilePath: \veterans_client_web\src\views\CooperativeEnterprise\EnterpriseDetails\EnterpriseDetailsIndex.vue
  * @Copyright: Copyright (c) 2016~2022 by 空白格, All Rights Reserved.
 -->
@@ -255,6 +255,7 @@ export default {
       this.getCompanyDetails(companyId);
       this.positionObj.queryParams.companyId = companyId;
       this.getPositionList();
+      document.documentElement.scrollTop = 0;
     }
   },
   methods: {

+ 116 - 144
src/views/Home/HomeIndex.vue

@@ -3,38 +3,16 @@
  * @Author: 空白格
  * @Date: 2022-08-10 11:26:40
  * @LastEditors: 空白格
- * @LastEditTime: 2022-08-17 17:49:33
+ * @LastEditTime: 2022-08-22 10:22:23
  * @FilePath: \veterans_client_web\src\views\Home\HomeIndex.vue
  * @Copyright: Copyright (c) 2016~2022 by 空白格, All Rights Reserved.
 -->
 <template>
   <div class="home app-main">
-    <!-- 轮播图 -->
-    <div class="home-carousel">
-      <el-carousel :interval="5000" arrow="always" height="400px">
-        <el-carousel-item v-for="(item, index) in bannerList" :key="index">
-          <el-image class="image" :src="item.bannerUrl" fit="contain">
-            <div slot="placeholder" class="image-slot">
-              加载图片中<span class="dot">...</span>
-            </div>
-          </el-image>
-        </el-carousel-item>
-      </el-carousel>
-    </div>
-    <!-- 菜单 -->
-    <div class="home-menu" :class="{ 'home-menu-fixed': scrollTop > 473 }">
-      <div class="home-menu-list">
-        <div
-          class="home-menu-list-item"
-          :class="{ active: index === 0 }"
-          v-for="(item, index) in menuList"
-          :key="index"
-          @click="jumpPage(item.path)"
-        >
-          {{ item.name }}
-        </div>
-      </div>
-    </div>
+    <!-- 顶部轮播 -->
+    <header-banner />
+    <!-- 菜单导航 -->
+    <menu-navigation :scrollTop="scrollTop" />
     <div class="home-main" :class="{ 'home-main-top': scrollTop > 473 }">
       <!-- 新闻最新一条 -->
       <div class="home-main-latest">
@@ -111,6 +89,7 @@
                   </ul>
                 </el-tab-pane>
               </el-tabs>
+              <div class="more-btn" @click="jumpPage('/newscenter')">更多</div>
             </div>
           </el-col>
         </el-row>
@@ -217,7 +196,45 @@
       </div>
     </div>
     <!-- 友情链接 -->
-    <friendship-link/>
+    <friendship-link />
+    <!-- 右侧操作 -->
+    <div class="home-operation">
+      <div class="home-operation-fixed">
+        <div class="home-operation-fixed-item home-operation-fixed-item-1">
+          <el-image
+            class="image"
+            :src="require('@/assets/images/search-icon.svg')"
+          ></el-image>
+        </div>
+        <div class="home-operation-fixed-item">
+          <el-image
+            class="image"
+            :src="require('@/assets/images/email-icon.svg')"
+          ></el-image>
+        </div>
+        <div class="home-operation-fixed-item">
+          <el-image
+            class="image"
+            :src="require('@/assets/images/telephone-icon.svg')"
+          ></el-image>
+        </div>
+        <div class="home-operation-fixed-item">
+          <el-image
+            class="image"
+            :src="require('@/assets/images/weixin-icon.svg')"
+          ></el-image>
+        </div>
+        <div
+          class="home-operation-fixed-item home-operation-fixed-item-last"
+          @click="backToTop"
+        >
+          <el-image
+            class="image"
+            :src="require('@/assets/images/top-icon.svg')"
+          ></el-image>
+        </div>
+      </div>
+    </div>
   </div>
 </template>
 
@@ -231,65 +248,22 @@ import {
 } from "@/api/Home";
 import { getDictData } from "@/api/Dict";
 import { getPolicyData } from "@/api/PolicyAdvice";
+import HeaderBanner from "./components/HeaderBanner";
+import MenuNavigation from "./components/MenuNavigation";
 import InstitutionalCooperation from "./components/InstitutionalCooperation";
 import EnterpriseCooperation from "./components/EnterpriseCooperation";
 import FriendshipLink from "./components/FriendshipLink";
 export default {
   name: "HomeIndex",
   components: {
+    HeaderBanner,
+    MenuNavigation,
     InstitutionalCooperation,
     EnterpriseCooperation,
-    FriendshipLink
+    FriendshipLink,
   },
   data() {
     return {
-      bannerList: [],
-      menuList: [
-        {
-          name: "首页",
-          icon: require("@/assets/images/home-menu-icon/home-menu-icon-1.svg"),
-        },
-        {
-          name: "政策咨询",
-          icon: require("@/assets/images/home-menu-icon/home-menu-icon-1.svg"),
-          path: "/policyadvice",
-        },
-        {
-          name: "招聘就业",
-          icon: require("@/assets/images/home-menu-icon/home-menu-icon-2.svg"),
-          path: "/recruitmentemployment",
-        },
-        {
-          name: "合作企业",
-          icon: require("@/assets/images/home-menu-icon/home-menu-icon-3.svg"),
-          path: "/cooperativeenterprise",
-        },
-        {
-          name: "合作院校",
-          icon: require("@/assets/images/home-menu-icon/home-menu-icon-4.svg"),
-          path: "/cooperativecolleges",
-        },
-        {
-          name: "技能培训",
-          icon: require("@/assets/images/home-menu-icon/home-menu-icon-5.svg"),
-          path: "/skilltraining",
-        },
-        {
-          name: "适应性培训",
-          icon: require("@/assets/images/home-menu-icon/home-menu-icon-6.svg"),
-          path: "/adaptivetraining",
-        },
-        {
-          name: "学历提升",
-          icon: require("@/assets/images/home-menu-icon/home-menu-icon-7.svg"),
-          path: "/educationpromote",
-        },
-        {
-          name: "创业指引",
-          icon: require("@/assets/images/home-menu-icon/home-menu-icon-8.svg"),
-          path: "/workguide",
-        },
-      ],
       latestNews: {},
       newsList: [],
       noticeList: [],
@@ -321,7 +295,6 @@ export default {
     },
     initData() {
       this.getDict();
-      this.getBanner();
       this.getNews();
       this.getNotice();
       this.getPolicyBannerList();
@@ -339,16 +312,6 @@ export default {
           this.getPolicyList();
       });
     },
-    /**
-     * 获取轮播图
-     * @date 2022-08-10
-     * @returns {any}
-     */
-    getBanner() {
-      getBannerList({ type: 0 }).then((res) => {
-        this.bannerList = res.data;
-      });
-    },
     /**
      * 获取新闻
      * @date 2022-08-10
@@ -450,69 +413,32 @@ export default {
         this.$router.push(path);
       }
     },
+    /**
+     * 返回顶部
+     * @date 2022-08-22
+     * @returns {any}
+     */
+    backToTop() {
+      cancelAnimationFrame(this.timer);
+      const self = this;
+      self.timer = requestAnimationFrame(function fn() {
+        const oTop =
+          document.body.scrollTop || document.documentElement.scrollTop;
+        if (oTop > 0) {
+          document.body.scrollTop = document.documentElement.scrollTop =
+            oTop - 50;
+          self.timer = requestAnimationFrame(fn);
+        } else {
+          cancelAnimationFrame(self.timer);
+        }
+      });
+    },
   },
 };
 </script>
 
 <style lang="scss" scoped>
 .home {
-  &-carousel {
-    .image {
-      width: 100%;
-      height: 100%;
-    }
-    .image-slot {
-      line-height: 400px;
-      text-align: center;
-    }
-    :deep(.el-carousel__arrow) {
-      border: solid 1px rgba($color: #fff, $alpha: 0.7);
-    }
-    :deep(.el-carousel__button) {
-      // 指示器按钮
-      width: 10px;
-      height: 10px;
-      border: none;
-      border-radius: 50%;
-      background-color: #fff;
-    }
-    :deep(.is-active .el-carousel__button) {
-      // 指示器激活按钮
-      width: 18px;
-      border-radius: 10px;
-    }
-  }
-  &-menu {
-    background-color: #416050;
-    width: 100%;
-    line-height: 104px;
-    &-list {
-      width: 70%;
-      min-width: 600px;
-      display: flex;
-      flex-wrap: wrap;
-      // justify-content: space-between;
-      margin: 0 auto;
-      &-item {
-        color: #fff;
-        font-size: 22px;
-        padding: 0 30px;
-        cursor: pointer;
-        &:hover {
-          background-color: #478364;
-        }
-      }
-      .active {
-        background-color: #478364;
-      }
-    }
-  }
-  .home-menu-fixed {
-    position: fixed;
-    top: 0;
-    left: 0;
-    z-index: 111;
-  }
   &-main {
     &-latest {
       background-color: #fff;
@@ -600,6 +526,7 @@ export default {
         }
       }
       &-right {
+        position: relative;
         :deep(.el-tabs__item) {
           font-size: 20px;
           font-weight: 500;
@@ -643,6 +570,14 @@ export default {
             }
           }
         }
+        .more-btn {
+          position: absolute;
+          right: 0;
+          top: 12px;
+          color: #727272;
+          font-size: 14px;
+          cursor: pointer;
+        }
       }
     }
     &-policy {
@@ -833,5 +768,42 @@ export default {
   .home-main-top {
     margin-top: 104px;
   }
+  &-operation {
+    position: fixed;
+    top: 50%;
+    right: 0;
+    margin-top: -214px;
+    z-index: 1000;
+    &-fixed {
+      &-item {
+        width: 95px;
+        height: 95px;
+        display: flex;
+        justify-content: center;
+        align-items: center;
+        background: #416050;
+        margin-bottom: 2px;
+        cursor: pointer;
+        &:nth-last-child(2) {
+          margin-bottom: 0;
+        }
+        &:first-child,
+        &:last-child {
+          background: #73aa8d;
+        }
+        .image {
+          width: 48px;
+          height: 48px;
+        }
+      }
+      &-item-last {
+        height: 42px;
+        .image {
+          width: 26px;
+          height: 26px;
+        }
+      }
+    }
+  }
 }
 </style>

+ 80 - 0
src/views/Home/components/HeaderBanner.vue

@@ -0,0 +1,80 @@
+<!--
+ * @Description: 顶部轮播图
+ * @Author: 空白格
+ * @Date: 2022-08-22 09:14:32
+ * @LastEditors: 空白格
+ * @LastEditTime: 2022-08-22 09:17:40
+ * @FilePath: \veterans_client_web\src\views\Home\components\HeaderBanner.vue
+ * @Copyright: Copyright (c) 2016~2022 by 空白格, All Rights Reserved.
+-->
+<template>
+  <div class="home-carousel">
+    <el-carousel :interval="5000" arrow="always" height="400px">
+      <el-carousel-item v-for="(item, index) in bannerList" :key="index">
+        <el-image class="image" :src="item.bannerUrl" fit="contain">
+          <div slot="placeholder" class="image-slot">
+            加载图片中<span class="dot">...</span>
+          </div>
+        </el-image>
+      </el-carousel-item>
+    </el-carousel>
+  </div>
+</template>
+
+<script>
+import { getBannerList } from "@/api/Home";
+export default {
+  name: "HeaderBanner",
+  data() {
+    return {
+      bannerList: [],
+    };
+  },
+  created() {
+    this.getBanner();
+  },
+  methods: {
+    /**
+     * 获取轮播图
+     * @date 2022-08-22
+     * @returns {any}
+     */
+    getBanner() {
+      getBannerList({ type: 0 }).then((res) => {
+        this.bannerList = res.data;
+      });
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+.home {
+  &-carousel {
+    .image {
+      width: 100%;
+      height: 100%;
+    }
+    .image-slot {
+      line-height: 400px;
+      text-align: center;
+    }
+    :deep(.el-carousel__arrow) {
+      border: solid 1px rgba($color: #fff, $alpha: 0.7);
+    }
+    :deep(.el-carousel__button) {
+      // 指示器按钮
+      width: 10px;
+      height: 10px;
+      border: none;
+      border-radius: 50%;
+      background-color: #fff;
+    }
+    :deep(.is-active .el-carousel__button) {
+      // 指示器激活按钮
+      width: 18px;
+      border-radius: 10px;
+    }
+  }
+}
+</style>

+ 134 - 0
src/views/Home/components/MenuNavigation.vue

@@ -0,0 +1,134 @@
+<!--
+ * @Description: 菜单导航
+ * @Author: 空白格
+ * @Date: 2022-08-22 09:22:47
+ * @LastEditors: 空白格
+ * @LastEditTime: 2022-08-22 09:29:26
+ * @FilePath: \veterans_client_web\src\views\Home\components\MenuNavigation.vue
+ * @Copyright: Copyright (c) 2016~2022 by 空白格, All Rights Reserved.
+-->
+<template>
+  <div class="home-menu" :class="{ 'home-menu-fixed': scrollTop > 473 }">
+    <div class="home-menu-list">
+      <div
+        class="home-menu-list-item"
+        :class="{ active: index === 0 }"
+        v-for="(item, index) in menuList"
+        :key="index"
+        @click="jumpPage(item.path)"
+      >
+        {{ item.name }}
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+export default {
+  data() {
+    return {
+      menuList: [
+        {
+          name: "首页",
+          icon: require("@/assets/images/home-menu-icon/home-menu-icon-1.svg"),
+        },
+        {
+          name: "政策咨询",
+          icon: require("@/assets/images/home-menu-icon/home-menu-icon-1.svg"),
+          path: "/policyadvice",
+        },
+        {
+          name: "招聘就业",
+          icon: require("@/assets/images/home-menu-icon/home-menu-icon-2.svg"),
+          path: "/recruitmentemployment",
+        },
+        {
+          name: "合作企业",
+          icon: require("@/assets/images/home-menu-icon/home-menu-icon-3.svg"),
+          path: "/cooperativeenterprise",
+        },
+        {
+          name: "合作院校",
+          icon: require("@/assets/images/home-menu-icon/home-menu-icon-4.svg"),
+          path: "/cooperativecolleges",
+        },
+        {
+          name: "技能培训",
+          icon: require("@/assets/images/home-menu-icon/home-menu-icon-5.svg"),
+          path: "/skilltraining",
+        },
+        {
+          name: "适应性培训",
+          icon: require("@/assets/images/home-menu-icon/home-menu-icon-6.svg"),
+          path: "/adaptivetraining",
+        },
+        {
+          name: "学历提升",
+          icon: require("@/assets/images/home-menu-icon/home-menu-icon-7.svg"),
+          path: "/educationpromote",
+        },
+        {
+          name: "创业指引",
+          icon: require("@/assets/images/home-menu-icon/home-menu-icon-8.svg"),
+          path: "/workguide",
+        },
+      ],
+    };
+  },
+  props: {
+    scrollTop: {
+      type: Number,
+      default: 0,
+    },
+  },
+  methods: {
+    /**
+     * 跳转到指定页面
+     * @date 2022-08-22
+     * @param {any} path
+     * @returns {any}
+     */
+    jumpPage(path) {
+      if (path) {
+        this.$router.push(path);
+      }
+    }
+  }
+};
+</script>
+
+<style lang="scss" scoped>
+.home {
+  &-menu {
+    background-color: #416050;
+    width: 100%;
+    line-height: 104px;
+    &-list {
+      width: 70%;
+      min-width: 600px;
+      display: flex;
+      flex-wrap: wrap;
+      // justify-content: space-between;
+      margin: 0 auto;
+      &-item {
+        color: #fff;
+        font-size: 22px;
+        padding: 0 30px;
+        cursor: pointer;
+        &:hover {
+          background-color: #478364;
+        }
+      }
+      .active {
+        background-color: #478364;
+      }
+    }
+    &-fixed {
+      position: fixed;
+      top: 0;
+      left: 0;
+      z-index: 111;
+    }
+  }
+}
+</style>

+ 24 - 0
src/views/NewsCenter/NewsCenterIndex.vue

@@ -0,0 +1,24 @@
+<!--
+ * @Description: 新闻中心
+ * @Author: 空白格
+ * @Date: 2022-08-22 10:20:21
+ * @LastEditors: 空白格
+ * @LastEditTime: 2022-08-22 10:25:48
+ * @FilePath: \veterans_client_web\src\views\NewsCenter\NewsCenterIndex.vue
+ * @Copyright: Copyright (c) 2016~2022 by 空白格, All Rights Reserved.
+-->
+<template>
+  <div class="app-main">
+    <BannerBreadcrumb title="新闻中心" :breadcrumb="false" />
+  </div>
+</template>
+
+<script>
+import BannerBreadcrumb from "@/components/BannerBreadcrumb";
+export default {
+  name: "NewsCenterIndex",
+  components: {
+    BannerBreadcrumb,
+  },
+};
+</script>