Selaa lähdekoodia

验证码登录

zhengjinyi 2 vuotta sitten
vanhempi
commit
65ec2c0b57

+ 15 - 15
src/main/resources/static/js/account/bind.js

@@ -1,6 +1,14 @@
 var bindPage = new Vue({
     el: "#bindPage",
     data: {
+        rule:{
+            mobileOrEmail: '(^([\\w-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([\\w-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$)|(^\\d{6,12}$)',
+            name: '^[a-zA-Z\\u4e00-\\u9fa5]{2,}$',
+            phone: '^\\d{6,12}$',
+            code: '^\\d{6}$',
+            password: "^[^\\u4e00-\\u9fa5]{8,16}$",
+            mobile:'^1[1-9][0-9]{9}$'
+        },
         loginLoading:false,
         mobilCount:0,
         mobileCodeText:'获取验证码',
@@ -12,6 +20,12 @@ var bindPage = new Vue({
         imageCode:'',
         activeNum:0,
         loginTabs:0,
+        isDisabled:true,
+        isSubDisabled:true,
+        mobilCount1:0,
+        mobileCodeText1:'获取验证码',
+        mobilTime1:null,
+        isMobileDisabled1:false,
         userParams: {
             mobileOrEmail :'',
             password : '',
@@ -22,18 +36,6 @@ var bindPage = new Vue({
             companyMobile:'',
             passOrNote:0
         },
-        rule:{
-            mobileOrEmail: '(^([\\w-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([\\w-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$)|(^\\d{6,12}$)',
-            name: '^[a-zA-Z\\u4e00-\\u9fa5]{2,}$',
-            phone: '^\\d{6,12}$',
-            code: '^\\d{6}$',
-            password: "^[^\\u4e00-\\u9fa5]{8,16}$",
-            mobile:'^1[1-9][0-9]{9}$'
-        },
-        mobilCount1:0,
-        mobileCodeText1:'获取验证码',
-        mobilTime1:null,
-        isMobileDisabled1:false,
         codeParams:{
             mobile:'',
             code:''
@@ -55,9 +57,7 @@ var bindPage = new Vue({
             mobile:'',
             code:'',
             codeType:0
-        },
-        isDisabled:true,
-        isSubDisabled:true
+        }
     },
     computed: {
 

+ 5 - 5
src/main/resources/static/js/account/login.js

@@ -119,7 +119,7 @@ var loginPage = new Vue({
                 _self.setStorages( _self.userData);
                 // 登录成功页面跳转
                 var loginBeforePath = getBaseCookie("loginBeforePath");
-                if (loginBeforePath && loginBeforePath!='undefined' && loginBeforePath.indexOf('.html')>0) {
+                if (loginBeforePath && loginBeforePath!=='undefined' && loginBeforePath.indexOf('.html')>0) {
                     delBaseCookie("loginBeforePath");
                     window.location.href = loginBeforePath;
                 } else if (_self.userData.userIdentity*1 === 3) {
@@ -138,7 +138,7 @@ var loginPage = new Vue({
                     shopId: response.data.shopId,
                     token: response.data.token
                 };
-            }else if(response.code == '-2'){
+            }else if(response.code === '-2'){
                 _self.stautsfalse = true;
                 _self.text =response.msg;
             }else {// 登录失败
@@ -193,7 +193,7 @@ var loginPage = new Vue({
                 });
                 timeClock = setInterval(function(){
                     _self.maxtime--;
-                    if (_self.maxtime == 0) {
+                    if (_self.maxtime === 0) {
                         clearInterval(timeClock);
                     }
                 },1000);
@@ -309,7 +309,7 @@ var loginPage = new Vue({
             this.qrCodeLogin = false;
         },
         showPassword(event) {
-            var el = event.currentTarget;
+            const el = event.currentTarget;
             const pwdEle = $(el).siblings('input');
             if(pwdEle.attr('type') === 'password') {
                 $(el).addClass('on');
@@ -320,7 +320,7 @@ var loginPage = new Vue({
             }
         },
         blurHandle(event) {  // 失去焦点校验
-            var el = event.currentTarget;
+            const el = event.currentTarget;
             verifyHandle(el);
         },
         SetSoragesInfo(data){