Explorar el Código

登录页提示与修改

luolei hace 5 años
padre
commit
16a511b8cb
Se han modificado 2 ficheros con 28 adiciones y 41 borrados
  1. 11 1
      src/App.vue
  2. 17 40
      src/components/Login.vue

+ 11 - 1
src/App.vue

@@ -8,7 +8,17 @@
 </template>
 <script>
   export default {
-    name:'App'
+    name:'App',
+    mounted(){
+      (/iphone|ipod|ipad/i.test(navigator.appVersion)) && document.addEventListener('blur', (e) => {
+        // 这里加了个类型判断,因为a等元素也会触发blur事件
+        if(['input', 'textarea'].includes(e.target.localName)) {
+          setTimeout(()=> {
+            document.scrollingElement.scrollTo(0, document.scrollingElement.scrollTop);
+          }, 200);
+        }
+      }, true)
+    },
   }
 </script>
 <style lang="less">

+ 17 - 40
src/components/Login.vue

@@ -88,22 +88,6 @@ export default {
   created(){
     this.code = this.$route.query.hospitalCode||''
   },
-  // mounted(){
-    
-  //   (/iphone|ipod|ipad/i.test(navigator.appVersion)) && document.addEventListener('blur', (e) => {
-  //     // 这里加了个类型判断,因为a等元素也会触发blur事件
-  //     if(['input', 'textarea'].includes(e.target.localName)) {
-  //       iscanscrollpage = true;
-  //       setTimeout(function() {
-  //         if(iscanscrollpage) {
-  //           // alert(document.scrollingElement.scrollTop)
-  //           document.scrollingElement.scrollTo(0, document.scrollingElement.scrollTop);
-  //           document.body && (document.body.scrollTop = document.body.scrollTop);
-  //         }
-  //       }, 200);
-  //     }
-  //   }, true)
-  // },
   methods: {
     close() {
       this.showTip = false;
@@ -126,9 +110,9 @@ export default {
     },
     blur() {
       // iscanscrollpage = true;
-      if(MobileDevice.getModels().join(' or ').indexOf('6') == -1){
-        document.activeElement.scrollIntoView({behavior: "smooth",block:'end'})
-      }
+      // if(MobileDevice.getModels().join(' or ').indexOf('6') == -1){
+      //   document.activeElement.scrollIntoView({behavior: "smooth",block:'end'})
+      // }
     },
     changeName() {
       // document.activeElement.scrollIntoViewIfNeeded(true);
@@ -154,27 +138,27 @@ export default {
         clearTimeout(timer);
       }, 2000);
     },
-    showSubmit(flg) {
+    showSubmit(flg){
       this.submit = flg;
     },
-    handleDepart() {
+    handleDepart(){
       const { type, value,patName,allow } = this;
+      this.allow = false
       if (value&&patName&&allow) {
-        this.allow = false
         let timer = setTimeout(() => {
-          if (type == 103) {
-            if (!phoneTest.test(value)) {//验证不通过
-              this.defaultWaring("输入信息格式有误");
+          if (type == 102) {
+            if (!jgpattern.test(value)) {//验证不通过
+              this.defaultWaring("请输入正确的病历号");
               return;
             }
           } else if (type == 101) {//身份证
             if (!identify.test(value)) {//验证不通过
-              this.defaultWaring("输入信息格式有误");
+              this.defaultWaring("请输入正确的身份证号");
               return;
             }
-          } else if (type == 104) {//病历号只能输入数字字母
-            if (!jgpattern.test(value)) {//验证不通过
-              this.defaultWaring("输入信息格式有误");
+          } else if (type == 104) {//市民卡号只能输入数字字母
+            if (!jgpattern.test(value)||value.length!=9) {//验证不通过
+              this.defaultWaring("请输入正确的9位市民卡号");
               return;
             }
           }
@@ -248,15 +232,12 @@ export default {
 };
 </script>
 <style lang="less" scoped>
+@import "../less/index.less";
 .login {
   height: 100%;
   width: 100%;
   position: absolute;
-  background: linear-gradient(
-    180deg,
-    rgba(79, 79, 255, 1) 0%,
-    rgba(79, 137, 255, 1) 100%
-  );
+  background: #colors[btn];
   padding: 0rem 0.6rem;
   box-sizing: border-box;
   .top {
@@ -351,12 +332,8 @@ export default {
       height: 0.88rem;
       line-height: 0.88rem;
       text-align: center;
-      background: linear-gradient(
-        270deg,
-        rgba(79, 139, 255, 1) 0%,
-        rgba(79, 79, 255, 1) 100%
-      );
-      border-radius: 0.44rem;
+      background: #colors[btn];
+      border-radius: 0.2rem;
       color: #fff;
       font-size: 0.32rem;
       font-weight: 500;