|
@@ -1,112 +1,150 @@
|
|
<template>
|
|
<template>
|
|
<div class="headerSection">
|
|
<div class="headerSection">
|
|
<div class="header-container width1200">
|
|
<div class="header-container width1200">
|
|
- <router-link :to="{ path: '/' }"
|
|
|
|
- class="logo">
|
|
|
|
- <img src="../assets/images/logoWhile.png"
|
|
|
|
- width="100%"
|
|
|
|
- alt="">
|
|
|
|
|
|
+ <router-link :to="{ path: '/' }" class="logo">
|
|
|
|
+ <img src="../assets/images/logoWhile.png" width="100%" alt="" />
|
|
</router-link>
|
|
</router-link>
|
|
<div class="menu">
|
|
<div class="menu">
|
|
- <a :class="checkActive==1?'active':''"
|
|
|
|
- @click="change(1,'banner')">平台介绍</a>
|
|
|
|
- <a :class="checkActive==2?'active':''"
|
|
|
|
- @click="change(2,'infos')">产品优势</a>
|
|
|
|
- <a :class="checkActive==3?'active':''"
|
|
|
|
- @click="change(3,'detail')">考生指引</a>
|
|
|
|
- <a :class="checkActive==4?'active':''"
|
|
|
|
- @click="change(4,'videoList')">操作指南</a>
|
|
|
|
- <a :class="checkActive==5?'active':''"
|
|
|
|
- @click="change(5,'consult')">行业资讯</a>
|
|
|
|
- <a :class="checkActive==6?'active':''"
|
|
|
|
- @click="change(6,'aboutUs')">关于我们</a>
|
|
|
|
- <div class="bandBtn"
|
|
|
|
- @click="goKu">合作机构登录</div>
|
|
|
|
|
|
+ <a
|
|
|
|
+ :class="checkActive == 1 ? 'active' : ''"
|
|
|
|
+ @click="change(1, 'banner')"
|
|
|
|
+ >平台介绍</a
|
|
|
|
+ >
|
|
|
|
+ <a :class="checkActive == 2 ? 'active' : ''" @click="change(2, 'infos')"
|
|
|
|
+ >产品优势</a
|
|
|
|
+ >
|
|
|
|
+ <a
|
|
|
|
+ :class="checkActive == 3 ? 'active' : ''"
|
|
|
|
+ @click="change(3, 'detail')"
|
|
|
|
+ >考生指引</a
|
|
|
|
+ >
|
|
|
|
+ <a
|
|
|
|
+ :class="checkActive == 4 ? 'active' : ''"
|
|
|
|
+ @click="change(4, 'videoList')"
|
|
|
|
+ >操作指南</a
|
|
|
|
+ >
|
|
|
|
+ <a
|
|
|
|
+ :class="checkActive == 5 ? 'active' : ''"
|
|
|
|
+ @click="change(5, 'consult')"
|
|
|
|
+ >行业资讯</a
|
|
|
|
+ >
|
|
|
|
+ <a
|
|
|
|
+ :class="checkActive == 6 ? 'active' : ''"
|
|
|
|
+ @click="change(6, 'aboutUs')"
|
|
|
|
+ >关于我们</a
|
|
|
|
+ >
|
|
|
|
+ <div class="bandBtn" @click="goKu">合作机构登录</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
<script>
|
|
<script>
|
|
-import Bus from '../views/index/blocks/eventBus'
|
|
|
|
-import { scrollAnimation } from '@/util/scroll'
|
|
|
|
|
|
+import Bus from "../views/index/blocks/eventBus";
|
|
|
|
+import { scrollAnimation } from "@/util/scroll";
|
|
export default {
|
|
export default {
|
|
- name: 'headerSection',
|
|
|
|
- props: ['name'],
|
|
|
|
- data () {
|
|
|
|
|
|
+ name: "headerSection",
|
|
|
|
+ props: ["name"],
|
|
|
|
+ data() {
|
|
return {
|
|
return {
|
|
checkActive: 1,
|
|
checkActive: 1,
|
|
- topList: []
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- created () {
|
|
|
|
-
|
|
|
|
|
|
+ topList: [],
|
|
|
|
+ };
|
|
},
|
|
},
|
|
- mounted () {
|
|
|
|
|
|
+ created() {},
|
|
|
|
+ mounted() {
|
|
scrollTo(0, 0);
|
|
scrollTo(0, 0);
|
|
- let url = this.$route
|
|
|
|
- if (url.path.indexOf('detile') != -1) {
|
|
|
|
- this.checkActive = 5
|
|
|
|
|
|
+ let url = this.$route;
|
|
|
|
+ if (url.path.indexOf("detile") != -1) {
|
|
|
|
+ this.checkActive = 5;
|
|
}
|
|
}
|
|
- this.$nextTick(res => {
|
|
|
|
- this.topList = this.getTop(['banner', 'infos', 'detail', 'videoList', 'consult', 'aboutUs'])
|
|
|
|
- })
|
|
|
|
|
|
+ this.$nextTick((res) => {
|
|
|
|
+ this.topList = this.getTop([
|
|
|
|
+ "banner",
|
|
|
|
+ "infos",
|
|
|
|
+ "detail",
|
|
|
|
+ "videoList",
|
|
|
|
+ "consult",
|
|
|
|
+ "aboutUs",
|
|
|
|
+ ]);
|
|
|
|
+ });
|
|
|
|
|
|
- window.addEventListener('scroll', this.onContentScroll, true)
|
|
|
|
- Bus.$on('gotoDetail', (res => {
|
|
|
|
|
|
+ window.addEventListener(
|
|
|
|
+ "scroll",
|
|
|
|
+ this.onContentScroll,
|
|
|
|
+ true
|
|
|
|
+ );
|
|
|
|
+ Bus.$on("gotoDetail", (res) => {
|
|
// 控制页面滚动
|
|
// 控制页面滚动
|
|
- this.change(3, 'detail')
|
|
|
|
- }))
|
|
|
|
|
|
+ this.change(3, "detail");
|
|
|
|
+ });
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
- getTop (nameList) {
|
|
|
|
- let arr = []
|
|
|
|
- nameList.forEach(item => {
|
|
|
|
- let top = document.getElementById(item).offsetTop - 78
|
|
|
|
- arr.push(top)
|
|
|
|
- })
|
|
|
|
- arr.sort(function (a, b) { return a - b });
|
|
|
|
- return arr
|
|
|
|
|
|
+ getTop(nameList) {
|
|
|
|
+ let arr = [];
|
|
|
|
+ nameList.forEach((item) => {
|
|
|
|
+ let top = document.getElementById(item).offsetTop - 78;
|
|
|
|
+ arr.push(top);
|
|
|
|
+ });
|
|
|
|
+ arr.sort(function (a, b) {
|
|
|
|
+ return a - b;
|
|
|
|
+ });
|
|
|
|
+ return arr;
|
|
},
|
|
},
|
|
- change (num, name) {
|
|
|
|
- let url = this.$route.path
|
|
|
|
- let top = document.getElementById(name).offsetTop - 76
|
|
|
|
- const currentY = document.documentElement.scrollTop || document.body.scrollTop
|
|
|
|
- if (url != '/') {
|
|
|
|
- this.$router.push('/')
|
|
|
|
|
|
+ change(num, name) {
|
|
|
|
+ let url = this.$route.path;
|
|
|
|
+ let top = document.getElementById(name).offsetTop - 76;
|
|
|
|
+ const currentY =
|
|
|
|
+ document.documentElement.scrollTop || document.body.scrollTop;
|
|
|
|
+ if (url != "/") {
|
|
|
|
+ this.$router.push("/");
|
|
this.checkActive = num;
|
|
this.checkActive = num;
|
|
|
|
|
|
- scrollAnimation(currentY, top)
|
|
|
|
|
|
+ scrollAnimation(currentY, top);
|
|
// scrollTo(0, top);
|
|
// scrollTo(0, top);
|
|
} else {
|
|
} else {
|
|
this.checkActive = num;
|
|
this.checkActive = num;
|
|
- scrollAnimation(currentY, top)
|
|
|
|
|
|
+ scrollAnimation(currentY, top);
|
|
// scrollTo(0, top);
|
|
// scrollTo(0, top);
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- goKu () {
|
|
|
|
- window.open('https://kj.colexiu.com/#/login?returnUrl=%2F', '_blank');
|
|
|
|
|
|
+ goKu() {
|
|
|
|
+ window.open("https://kj.colexiu.com/#/login?returnUrl=%2F", "_blank");
|
|
},
|
|
},
|
|
|
|
|
|
- onContentScroll (e) {
|
|
|
|
|
|
+ onContentScroll(e) {
|
|
// this.topList = this.getTop(['banner', 'infos', 'detail', 'videoList', 'consult', 'aboutUs'])
|
|
// this.topList = this.getTop(['banner', 'infos', 'detail', 'videoList', 'consult', 'aboutUs'])
|
|
- let target = e.target || e.srcElement
|
|
|
|
- this.scrollTop = target.scrollingElement.scrollTop
|
|
|
|
- if (this.scrollTop < this.topList[1]) {
|
|
|
|
- this.checkActive = 1
|
|
|
|
- } else if (this.scrollTop >= this.topList[1] && this.scrollTop < this.topList[2]) {
|
|
|
|
- this.checkActive = 2
|
|
|
|
- } else if (this.scrollTop >= this.topList[2] && this.scrollTop < this.topList[3]) {
|
|
|
|
- this.checkActive = 3
|
|
|
|
- } else if (this.scrollTop >= this.topList[3] && this.scrollTop < this.topList[4]) {
|
|
|
|
- this.checkActive = 4
|
|
|
|
- } else if (this.scrollTop >= this.topList[4] && this.scrollTop < this.topList[5]) {
|
|
|
|
- this.checkActive = 5
|
|
|
|
- } else if (this.scrollTop >= this.topList[5]) {
|
|
|
|
- this.checkActive = 6
|
|
|
|
|
|
+ let target = e.target || e.srcElement;
|
|
|
|
+ if (target&&target.scrollingElement) {
|
|
|
|
+ this.scrollTop = target.scrollingElement.scrollTop;
|
|
|
|
+ if (this.scrollTop < this.topList[1]) {
|
|
|
|
+ this.checkActive = 1;
|
|
|
|
+ } else if (
|
|
|
|
+ this.scrollTop >= this.topList[1] &&
|
|
|
|
+ this.scrollTop < this.topList[2]
|
|
|
|
+ ) {
|
|
|
|
+ this.checkActive = 2;
|
|
|
|
+ } else if (
|
|
|
|
+ this.scrollTop >= this.topList[2] &&
|
|
|
|
+ this.scrollTop < this.topList[3]
|
|
|
|
+ ) {
|
|
|
|
+ this.checkActive = 3;
|
|
|
|
+ } else if (
|
|
|
|
+ this.scrollTop >= this.topList[3] &&
|
|
|
|
+ this.scrollTop < this.topList[4]
|
|
|
|
+ ) {
|
|
|
|
+ this.checkActive = 4;
|
|
|
|
+ } else if (
|
|
|
|
+ this.scrollTop >= this.topList[4] &&
|
|
|
|
+ this.scrollTop < this.topList[5]
|
|
|
|
+ ) {
|
|
|
|
+ this.checkActive = 5;
|
|
|
|
+ } else if (this.scrollTop >= this.topList[5]) {
|
|
|
|
+ this.checkActive = 6;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- }
|
|
|
|
-}
|
|
|
|
|
|
+ },
|
|
|
|
+};
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style lang="less" scoped>
|
|
<style lang="less" scoped>
|