Просмотр исходного кода

6系列登录会挡住输入框的问题

luolei 5 лет назад
Родитель
Сommit
de78efe70e
5 измененных файлов с 119 добавлено и 6 удалено
  1. 1 1
      build/webpack.dev.conf.js
  2. 8 4
      src/components/Login.vue
  3. 3 0
      src/main.js
  4. 106 0
      src/utils/getfile.js
  5. 1 1
      src/utils/tools.js

+ 1 - 1
build/webpack.dev.conf.js

@@ -34,7 +34,7 @@ const devWebpackConfig = merge(baseWebpackConfig, {
     compress: true,
     // host: HOST || config.dev.host,
     // host: '192.168.3.6',
-    host: '192.168.1.106',
+    host: '192.168.1.104',
     port: PORT || config.dev.port,
     open: config.dev.autoOpenBrowser,
     overlay: config.dev.errorOverlay

+ 8 - 4
src/components/Login.vue

@@ -82,6 +82,7 @@ export default {
   created(){
     this.code = this.$route.query.hospitalCode||''
   },
+
   methods: {
     close() {
       this.showTip = false;
@@ -100,10 +101,13 @@ export default {
       this.show = !show;
     },
     blur() {
-      document.activeElement.scrollIntoViewIfNeeded(true);
-      setTimeout(() => {
-        document.activeElement.scrollIntoViewIfNeeded(true);
-      }, 300);
+      // document.activeElement.scrollIntoViewIfNeeded(true);      
+      // setTimeout(() => {
+      //   document.activeElement.scrollIntoViewIfNeeded(true);
+      // }, 300);
+      if(MobileDevice.getModels().join(' or ').indexOf('6') == -1){
+        window.scroll(0,0)
+      }
     },
     changeName() {
       document.activeElement.scrollIntoViewIfNeeded(true);

+ 3 - 0
src/main.js

@@ -5,10 +5,12 @@ import App from './App.vue';
 import preview from 'vue-photo-preview';
 import 'vue-photo-preview/dist/skin.css';
 import PortalVue from 'portal-vue';
+import './utils/getfile.js';
 Vue.use(PortalVue);
 Vue.use(preview);
 Vue.config.productionTip = false;
 
+
 new Vue({
   el:'#app',
   router,
@@ -19,3 +21,4 @@ new Vue({
   template:'<App/>'
 });
 
+

+ 106 - 0
src/utils/getfile.js

@@ -0,0 +1,106 @@
+(function () {
+  var canvas, gl, glRenderer, models,
+      devices = [
+          ['a7', '640x1136', ['iPhone 5', 'iPhone 5s']],
+          ['a7', '1536x2048', ['iPad Air', 'iPad Mini 2', 'iPad Mini 3']],
+          ['a8', '640x1136', ['iPod touch (6th gen)']],
+          ['a8', '750x1334', ['iPhone 6']],
+          ['a8', '1242x2208', ['iPhone 6 Plus']],
+          ['a8', '1536x2048', ['iPad Air 2', 'iPad Mini 4']],
+          ['a9', '640x1136', ['iPhone SE']],
+          ['a9', '750x1334', ['iPhone 6s']],
+          ['a9', '1242x2208', ['iPhone 6s Plus']],
+          ['a9x', '1536x2048', ['iPad Pro (1st gen 9.7-inch)']],
+          ['a9x', '2048x2732', ['iPad Pro (1st gen 12.9-inch)']],
+          ['a10', '750x1334', ['iPhone 7']],
+          ['a10', '1242x2208', ['iPhone 7 Plus']],
+          ['a10x', '1668x2224', ['iPad Pro (2th gen 10.5-inch)']],
+          ['a10x', '2048x2732', ['iPad Pro (2th gen 12.9-inch)']],
+          ['a11', '750x1334', ['iPhone 8']],
+          ['a11', '1242x2208', ['iPhone 8 Plus']],
+          ['a11', '1125x2436', ['iPhone X']],
+          ['a12', '828x1792', ['iPhone Xr']],
+          ['a12', '1125x2436', ['iPhone Xs']],
+          ['a12', '1242x2688', ['iPhone Xs Max']],
+          ['a12x', '1668x2388', ['iPad Pro (3rd gen 11-inch)']],
+          ['a12x', '2048x2732', ['iPad Pro (3rd gen 12.9-inch)']]
+      ];
+
+  function getCanvas() {
+      if (canvas == null) {
+          canvas = document.createElement('canvas');
+      }
+
+      return canvas;
+  }
+
+  function getGl() {
+      if (gl == null) {
+          gl = getCanvas().getContext('experimental-webgl');
+      }
+
+      return gl;
+  }
+
+  function getResolution() {
+      var ratio = window.devicePixelRatio || 1;
+      return (Math.min(screen.width, screen.height) * ratio)
+          + 'x' + (Math.max(screen.width, screen.height) * ratio);
+  }
+
+  function getGlRenderer() {
+      if (glRenderer == null) {
+          debugInfo = getGl().getExtension('WEBGL_debug_renderer_info');
+          glRenderer = debugInfo == null ? 'unknown' : getGl().getParameter(debugInfo.UNMASKED_RENDERER_WEBGL);
+      }
+
+      return glRenderer;
+  }
+
+  function getModels() {
+      if (models == null) {
+          var gpu = getGlRenderer(),
+              matches = gpu.match(/^apple\s+([_a-z0-9-]+)\s+gpu$/i),
+              res = getResolution();
+          
+          models = ['unknown'];
+
+          if (matches) {
+              for (var i = 0; i < devices.length; i ++) {
+                  var device = devices[i];
+
+                  if (matches[1].toLowerCase() == device[0]
+                      && res == device[1]) {
+                      models = device[2];
+                      break;
+                  }
+              }
+          }
+      }
+
+      return models;
+  }
+
+  if (window.MobileDevice == undefined) {
+      window.MobileDevice = {};
+  }
+
+  window.MobileDevice.getGlRenderer = getGlRenderer;
+  window.MobileDevice.getModels = getModels;
+  window.MobileDevice.getResolution = getResolution;
+
+  window.MobileDevice.is = function (match) {
+      var currentModels = getModels();
+      match = match.toLowerCase().replace(/\s+$/, '') + ' ';
+
+      for (var i = 0; i < currentModels.length; i ++) {
+          var model = currentModels[i].toLowerCase() + ' ';
+
+          if (0 === model.indexOf(math)) {
+              return true;
+          }
+      }
+
+      return false;
+  };
+})();

+ 1 - 1
src/utils/tools.js

@@ -233,7 +233,7 @@ function fixedKeyboard() {
       }else{
         $('.detailBox-wrap').css('position','fixed');
         // $('.main').css('height','100%;') ;
-        $('.main').height("100%") ;
+        $('.main').height("100%");
       }
     }
   })