| | |
| | | <li |
| | | v-for="(item, index) in bannerList" |
| | | :key="index" |
| | | @click="toggleBanner(index + 1)" |
| | | @click="toggleBanner(index)" |
| | | > |
| | | <button |
| | | class="inner" |
| | | :class="{ active: activeBanner == index + 1 }" |
| | | :class="{ active: activeBanner == index }" |
| | | ></button> |
| | | </li> |
| | | </ul> |
| | |
| | | </div> |
| | | </div> |
| | | |
| | | <Connect v-if="showConnect"></Connect> |
| | | <Connect></Connect> |
| | | |
| | | <!-- 页尾 --> |
| | | <Footer></Footer> |
| | |
| | | this.getBanner(); |
| | | this.getRecommend(); |
| | | this.getModule(); |
| | | window.addEventListener("scroll", this.scrollListener); |
| | | }, |
| | | destroyed() { |
| | | window.removeEventListener("scroll", this.scrollListener); |
| | | }, |
| | | data() { |
| | | return { |
| | |
| | | router: "/trialCenter", |
| | | }, |
| | | ], //推荐卡片数据 |
| | | activeBanner: 1, //选中的banner |
| | | activeBanner: 0, //选中的banner |
| | | activeCommend: 3, //选中的推荐tabs |
| | | commendData: [], //推荐tab的数据 |
| | | productData: [], |
| | |
| | | timer: null, //向上回滚动画 |
| | | ConnectTimer: null, // 控制弹层的定时器 |
| | | bannerList: [], |
| | | showConnect: false, //显示联系我们与回到顶部 |
| | | }; |
| | | }, |
| | | methods: { |
| | |
| | | this.activeCommend = id; |
| | | this.getRecommend(); |
| | | }, |
| | | //添加滚动监听 |
| | | scrollListener() { |
| | | //页面滑动触发事件 (滚动条移动则调用是否显示返回顶部按钮事件) |
| | | |
| | | if (document.documentElement.scrollTop < 1100) { |
| | | this.showConnect = false; |
| | | } else { |
| | | this.showConnect = true; |
| | | } |
| | | |
| | | //检查滚动条是否在顶部,控制返回顶部按钮的隐藏和显示 |
| | | }, |
| | | }, |
| | | beforeRouteLeave(to, from, next) { |
| | | let userInfo = sessionStorage.getItem("userInfo"); |
| | | if ( |
| | | !userInfo && |
| | | to.path !== "/login" && |
| | | to.path !== "/register" && |
| | | to.path !== "/connectUs" |
| | | ) { |
| | | next({ path: "/login" }); |
| | | } else { |
| | | next(); |
| | | } |
| | | }, |
| | | }; |
| | | </script> |