ソースを参照

阻止悬浮窗滑动

shenjj 7 年 前
コミット
f8a02cd73a
2 ファイル変更13 行追加2 行削除
  1. 12 1
      components/mobile/common/LoginBox.vue
  2. 1 1
      pages/mobile/wechat/toggle.vue

+ 12 - 1
components/mobile/common/LoginBox.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="mobile-modal" v-show="showLogin">
+  <div class="mobile-modal" v-show="showLogin" @scroll.prevent="touchmove()">
     <div class="mobile-modal-box">
       <div class="mobile-modal-header">请登录后再操作<i @click="close" class="icon-guanbi iconfont"></i></div>
       <div class="mobile-modal-content">
@@ -19,6 +19,9 @@
       }
     },
     methods: {
+      touchmove() {
+        console.log(1)
+      },
       close: function () {
         this.$emit('onLoginBoxClose')
       },
@@ -34,6 +37,12 @@
       }
     },
     mounted() {
+      document.querySelector('html').addEventListener('touchmove', function(e) {
+        e.preventDefault()
+      })
+      document.querySelector('.mobile-modal').addEventListener('touchmove', function(e) {
+        e.preventDefault()
+      })
       let ua = window.navigator.userAgent.toLowerCase()
       if (ua.match(/micromessenger/i) && ua.match(/micromessenger/i)[0] === 'micromessenger') {
         if (this.url) {
@@ -42,6 +51,8 @@
           this.$router.push(`/mobile/wechat`)
         }
       } else {
+        // document.querySelector('html').style = 'overflow-y: hidden'
+        // document.querySelector('body').style = 'overflow-y: hidden'
         this.showLogin = true
       }
     }

+ 1 - 1
pages/mobile/wechat/toggle.vue

@@ -8,7 +8,7 @@
     mounted() {
       this.$nextTick(() => {
         // this.$route.query.url
-        window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxd29bbca61728b189&redirect_uri=http://wwpszp.natappfree.cc${this.$route.query.url}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
+        window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxd29bbca61728b189&redirect_uri=http://gmxwni.natappfree.cc${this.$route.query.url}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
       })
     }
   }