Browse Source

修改滚动不到位bug

jinsy 7 years ago
parent
commit
a130bacb23

+ 11 - 8
frontend/saas-portal-web/src/components/conenter/enterprise.vue

@@ -35,10 +35,10 @@
                 </div>
                 </div>
             <div class="collapse navbar-collapse navbar-right" role="navigation" style="position: absolute;left: 35%;">
             <div class="collapse navbar-collapse navbar-right" role="navigation" style="position: absolute;left: 35%;">
             <ul @click="gohome" id="nav" class="nav navbar-nav menu">
             <ul @click="gohome" id="nav" class="nav navbar-nav menu">
-                <li><router-link to="/home"><a @click="setTurnHome"><span style="color: white">首页</span></a></router-link></li>
-                <li><a href="#" @click="feature"><span>特色</span></a></li>
-                <li><a href="#" @click="service"><span>功能</span></a></li>
-                <li><a href="#" @click="download"><span>下载</span></a></li>
+                <li><router-link to="/home"><a @click="home"><span style="color: white">首页</span></a></router-link></li>
+                <li><a class="xs" @click="feature"><span>特色</span></a></li>
+                <li><a class="xs" @click="service"><span>功能</span></a></li>
+                <li><a class="xs" @click="download"><span>下载</span></a></li>
                 <!-- <router-link to="/invitation"><a ><span style="color: white">邀请</span></a></router-link> -->
                 <!-- <router-link to="/invitation"><a ><span style="color: white">邀请</span></a></router-link> -->
                 <li>
                 <li>
                     <el-menu  
                     <el-menu  
@@ -450,24 +450,27 @@ import { setTimeout } from 'timers';
                 document.documentElement.scrollTop = 0;
                 document.documentElement.scrollTop = 0;
                 this.setTurnHome();
                 this.setTurnHome();
             },
             },
+            home(){
+                document.documentElement.scrollTop = 0;
+                this.setTurnHome();
+            },
             // 特色
             // 特色
             feature(){
             feature(){
-                this.$router.push({name: 'Home', params: {isfeature: 690}});
+                this.$router.push({name: 'Home', params: {isfeature: 'feature'}});//690
                 this.setTurnHome();
                 this.setTurnHome();
             },
             },
             //功能
             //功能
             service(){
             service(){
-                this.$router.push({name: 'Home', params: {isfeature: 3530}});
+                this.$router.push({name: 'Home', params: {isfeature: 'service'}});//3530
                 this.setTurnHome();
                 this.setTurnHome();
             },
             },
             // 下载
             // 下载
             download(){
             download(){
-                this.$router.push({name: 'Home', params: {isfeature: 4190}});
+                this.$router.push({name: 'Home', params: {isfeature: 'download'}});//4190
                 this.setTurnHome();
                 this.setTurnHome();
             },
             },
             gohome(e){
             gohome(e){
                 this.$store.commit('problemtrue')
                 this.$store.commit('problemtrue')
-                // this.isproblem = true
             },
             },
             //内容不足500固定高度
             //内容不足500固定高度
             boxheight(){
             boxheight(){

+ 66 - 41
frontend/saas-portal-web/src/components/conenter/home.vue

@@ -256,7 +256,7 @@
       </section>
       </section>
       <!-- end Service section -->
       <!-- end Service section -->
       <!-- 下载 -->
       <!-- 下载 -->
-      <section>
+      <section id="download">
         <div class="container ts-worp" style="padding-top: 30px;">
         <div class="container ts-worp" style="padding-top: 30px;">
           <div class="section-title text-center" style="margin-bottom: 50px">
           <div class="section-title text-center" style="margin-bottom: 50px">
             <p class="ts-title">下载</p>
             <p class="ts-title">下载</p>
@@ -353,16 +353,52 @@
       })
       })
     },
     },
     beforeDestroy(){
     beforeDestroy(){
-      clearInterval(this.timer)
+      clearInterval(this.timer);
+      window.removeEventListener("scroll",this.handleFun);
     },
     },
     mounted() {
     mounted() {
-      this.clientId = Math.random().toString(36).substr(2)
+      this.clientId = Math.random().toString(36).substr(2);
       // 从本地加载已经登录的信息
       // 从本地加载已经登录的信息
-      this.account = Session.getAccount()
-      document.documentElement.scrollTop = this.isfeature;
-      $(window).scroll(function() {
+      this.account = Session.getAccount();
+      switch (this.isfeature) {
+        case 'feature':
+          this.feature2()
+          break;
+        case 'service':
+          this.service2()
+          break;
+        case 'download':
+          this.download()
+          break;
+      };
+      // document.documentElement.scrollTop = this.isfeature;
+      window.addEventListener("scroll",this.handleFun);
+    },
+    computed: {
+      setTokenPage() {
+        return this.$url.web + '/set-token.html'
+      },
+      ssoPage() {
+        if (this.isLogin) {
+          return this.$url.sso + '/sassLogin?appId=sp&baseUrl=' +
+            encodeURIComponent(this.$url.api + '/api/auth/sso/callback/' + this.clientId)
+        }
+        if (this.isRegister) {
+          return this.$url.sso + '/sassLogin/register?appId=sp&baseUrl=' +
+            encodeURIComponent(this.$url.api + '/api/auth/sso/callback/' + this.clientId)
+        }
+      },
+      getnewproblem() {
+        return this.$store.state.isproblem;
+      },
+    },
+    methods: {
+      handleFun(){
         let Y = $(window).scrollTop();
         let Y = $(window).scrollTop();
-        if (Y >= 500 && Y <= 1500) {
+        if ($('#feature').offset()) {
+          var scrollH = Math.floor($('#feature').offset().top) - 260;//500
+        }
+        if (Y >= scrollH && Y <= scrollH + 1000) {
           $(".animate1").stop();
           $(".animate1").stop();
           $(".animate1").animate({
           $(".animate1").animate({
             top:'0px',
             top:'0px',
@@ -375,7 +411,7 @@
             opacity:'0'
             opacity:'0'
           },1000);
           },1000);
         };
         };
-        if (Y > 1200 && Y < 2200) {
+        if (Y > scrollH + 700 && Y < scrollH + 1700) {
           $(".animate2").stop();
           $(".animate2").stop();
           $(".animate2").animate({
           $(".animate2").animate({
             top:'0px',
             top:'0px',
@@ -388,7 +424,7 @@
             opacity:'0'
             opacity:'0'
           },1000);
           },1000);
         };
         };
-        if (Y > 1900 && Y < 2900) {
+        if (Y > scrollH + 1400 && Y < scrollH + 2400) {
           $(".animate3").stop();
           $(".animate3").stop();
           $(".animate3").animate({
           $(".animate3").animate({
             top:'0px',
             top:'0px',
@@ -411,7 +447,7 @@
             opacity:'0'
             opacity:'0'
           },1000);
           },1000);
         };
         };
-        if (Y > 2600 && Y < 3600) {
+        if (Y > scrollH + 2100 && Y < scrollH + 3100) {
           $(".animate4").stop();
           $(".animate4").stop();
           $(".animate4").animate({
           $(".animate4").animate({
             top:'0px',
             top:'0px',
@@ -434,27 +470,7 @@
             opacity:'0'
             opacity:'0'
           },1000);
           },1000);
         };
         };
-      })
-    },
-    computed: {
-      setTokenPage() {
-        return this.$url.web + '/set-token.html'
-      },
-      ssoPage() {
-        if (this.isLogin) {
-          return this.$url.sso + '/sassLogin?appId=sp&baseUrl=' +
-            encodeURIComponent(this.$url.api + '/api/auth/sso/callback/' + this.clientId)
-        }
-        if (this.isRegister) {
-          return this.$url.sso + '/sassLogin/register?appId=sp&baseUrl=' +
-            encodeURIComponent(this.$url.api + '/api/auth/sso/callback/' + this.clientId)
-        }
-      },
-      getnewproblem() {
-        return this.$store.state.isproblem;
       },
       },
-    },
-    methods: {
       listenOnCallback() {
       listenOnCallback() {
         const me = this
         const me = this
         subscribe(this.clientId, '/sso/callback').then(data => {
         subscribe(this.clientId, '/sso/callback').then(data => {
@@ -509,7 +525,7 @@
           me.isRegister = false
           me.isRegister = false
         })
         })
       },
       },
-      // 下载1
+      // 下载
       downloadOne(){
       downloadOne(){
         let url = 'https://saas-assets.usoftchina.com/UsoftchinaSaasClient_setup.exe';
         let url = 'https://saas-assets.usoftchina.com/UsoftchinaSaasClient_setup.exe';
         let alink = document.createElement("a");
         let alink = document.createElement("a");
@@ -578,34 +594,38 @@
       //常见问题
       //常见问题
       navproblem(){
       navproblem(){
         this.$store.commit('problemfalse');
         this.$store.commit('problemfalse');
-        // document.documentElement.scrollTop = 0;
         clearInterval(this.timer);
         clearInterval(this.timer);
         this.animate(0);
         this.animate(0);
       },
       },
       home() {
       home() {
         clearInterval(this.timer);
         clearInterval(this.timer);
         this.animate(0);
         this.animate(0);
-        this.setTurnHome();
       },
       },
       //特色
       //特色
       feature2(){
       feature2(){
         clearInterval(this.timer);
         clearInterval(this.timer);
-        this.animate(690);
-        this.setTurnHome();
+        setTimeout(()=>{
+          let featH = Math.floor($('#feature').offset().top) - 70;
+          this.animate(featH);//690
+        },10);
       },
       },
       //功能
       //功能
       service2(){
       service2(){
         clearInterval(this.timer);
         clearInterval(this.timer);
-        this.animate(3530);
-        this.setTurnHome();
+        setTimeout(()=>{
+          let servH = Math.floor($('#service').offset().top) - 129;
+          this.animate(servH);//3530
+        },10);
       },
       },
       // 下载
       // 下载
       download(){
       download(){
         // document.documentElement.scrollTop = 4190;
         // document.documentElement.scrollTop = 4190;
         // window.scrollTo(0,4190);
         // window.scrollTo(0,4190);
         clearInterval(this.timer);
         clearInterval(this.timer);
-        this.animate(4190);
-        this.setTurnHome();
+        setTimeout(()=>{
+          let dowH = Math.floor($('#download').offset().top) - 100;
+          this.animate(dowH);
+        },10)
       },
       },
       //添加鼠标滚轮事件,鼠标滚动的时候清除定时器,否则无法滚动
       //添加鼠标滚轮事件,鼠标滚动的时候清除定时器,否则无法滚动
       scrollout(){
       scrollout(){
@@ -625,8 +645,13 @@
             }
             }
         }, 5);
         }, 5);
       },
       },
-      gohome(e){
-        this.$store.commit('problemtrue')
+      gohome(ev){
+        var ev = ev || window.event;
+        if (ev.target.childNodes[0].data == '帮助中心') {
+          return
+        } else {
+          this.$store.commit('problemtrue')
+        }
         // this.isproblem = true
         // this.isproblem = true
       }
       }
     }
     }

+ 2 - 1
frontend/saas-portal-web/src/components/conenter/invitation.vue

@@ -87,7 +87,6 @@ import { log } from 'util';
         },
         },
         methods:{
         methods:{
             browserRedirect() {
             browserRedirect() {
-                let param = this.getUrlParam('param');
                 var sUserAgent = navigator.userAgent.toLowerCase();
                 var sUserAgent = navigator.userAgent.toLowerCase();
                 var bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
                 var bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
                 var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";
                 var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";
@@ -99,6 +98,8 @@ import { log } from 'util';
                 var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
                 var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
                 if (bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM) {
                 if (bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM) {
                     // 移动端访问跳转到移动端页面
                     // 移动端访问跳转到移动端页面
+                    let index = window.location.href.indexOf('=');
+                    let param=window.location.href.substr(index+1);
                     window.location.href = 'invitation_mobile_join.html?param='+param
                     window.location.href = 'invitation_mobile_join.html?param='+param
                 } else {
                 } else {
                     this.param();//获取pc端页面参数
                     this.param();//获取pc端页面参数