ソースを参照

验证码登录

zhengjinyi 2 年 前
コミット
db1164b2e5

+ 1 - 1
src/main/resources/static/css/account/login.css

@@ -35,7 +35,7 @@ li{list-style:none}
  .loginForm .login-line{width: 100%;height: 1px;background: #E2E2E2;margin-top: 10px;float: left;position: relative;}
  .loginForm .login-line span{display: block;line-height: 24px;padding: 0 5px;text-align: center;font-size: 12px;color: #999999;position: absolute;background: #FFFFFF;left: 50%;top: -12px;margin-left: -30px;}
  /*.loginForm .submit .btn:hover{opacity:.8}*/
- .loginForm .from-wechat{width: 100%;height: 40px;margin-top: 10px;float: left;}
+ .loginForm .from-wechat{width: 100%;height: 40px;margin-top: 20px;float: left;}
  .loginForm .codeBtn{width:40px;height:40px;display: block;margin: 0 auto;}
  .loginForm .codeBtn:before{width:40px;height:40px;background-position:0 -26px;}
  .loginForm .qrCodeBox{text-align:center;margin-top: 70px;}

+ 8 - 11
src/main/resources/static/js/account/bind.js

@@ -80,7 +80,7 @@ var bindPage = new Vue({
             this.userLoginVerification();
         },
         userLoginVerification(){// 校验短信验证码
-            var _self = this;
+            const _self = this;
             UserApi.userLoginVerification(this.verifiParams,function(response){
                 if(response.code === 0){
                     _self.activeNum = 1;
@@ -129,14 +129,14 @@ var bindPage = new Vue({
             }
         },
         handleMobileCode(){// 点击获取短信验证码
-            var _self = this;
+            const _self = this;
             if( this.isMobileDisabled1){ return }
             this.$nextTick(function() {
                 if (!verifyCheack('.codeParamsMobile')) { return false; }
                 UserApi.userLoginCode(_self.smsCodeParams,function (response) {
                     if(response.code === 0){
                         CAIMEI.dialog('获取验证码成功~',false,function () {});
-                        var TIME_COUNT = 60;
+                        const TIME_COUNT = 60;
                         if (!_self.mobilTime1) {
                             _self.mobilCount1 = TIME_COUNT;
                             _self.isMobileDisabled1 = true;
@@ -160,7 +160,7 @@ var bindPage = new Vue({
             })
         },
         handleBindConfirm(){ //绑定运营人员
-            var _self = this;
+            const _self = this;
             if(this.isSubDisabled){ return }
             if (this.loginLoading) { return false; }
             if (!verifyForm()) {return false;}
@@ -200,13 +200,11 @@ var bindPage = new Vue({
             });
         },
         getMobileImage:function() {//获取图形验证码
-            var _self = this;
-            var mobile = verifyCheack('.mobileOrEmail');
-            var pass = verifyCheack('.massageBtn');
+            const _self = this;
             if (_self.isMobileDisabled) { return false; }
             this.$nextTick(function() {
-                if (!mobile) { return false; }
-                if (!pass) { return false; }
+                if (!verifyCheack('.mobileOrEmail')) { return false; }
+                if (!verifyCheack('.massageBtn')) { return false; }
                 PublicApi.getImgVerifyCode({platformType: 0},function(response){
                     if(response.code === 0){
                         _self.bindCodeParams.imgCode = '';
@@ -220,7 +218,7 @@ var bindPage = new Vue({
             });
         },
         getMobileCodeFn:function(){//机构注册获取注册短信验证码
-            var _self = this;
+            const _self = this;
             if(this.bindCodeParams.imgCode === ''){
                 CAIMEI.dialog('请输入图形验证码',false,function () {});
                 return
@@ -277,7 +275,6 @@ var bindPage = new Vue({
 
     },
     mounted: function () {
-        var _self = this;
         if(globalUserData){
             this.userParams.unionId = globalUserData.unionId;
         }

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

@@ -74,7 +74,7 @@ var loginPage = new Vue({
             }
         },
         userCodeLogin(){// 短信验证码登录
-            var _self = this;
+            const _self = this;
             if (this.loginLoading) { return false; }
             this.$nextTick(function(){
                 if (!verifyForm()) { return false; }
@@ -85,7 +85,7 @@ var loginPage = new Vue({
             });
         },
         userPasswordLogin(){// 账号登录
-            var _self = this;
+            const _self = this;
             if (this.loginLoading) { return false; }
             this.$nextTick(function(){
                 if (!verifyForm()) { return false; }
@@ -96,7 +96,7 @@ var loginPage = new Vue({
             });
         },
         userUpdataeStatus(response){// 更新登录
-            var _self = this;
+            const _self = this;
             _self.loginLoading = false;
             if(response.code === 0){
                 _self.userData = {
@@ -129,7 +129,7 @@ var loginPage = new Vue({
                 } else {
                     location.href="/index.html";
                 }
-            } else if(response.code == '-3'){//审核未通过
+            } else if(response.code === '-3'){//审核未通过
                 _self.text =response.msg;
                 _self.stautsfalse = true;
                 _self.infofalse = true;
@@ -146,12 +146,12 @@ var loginPage = new Vue({
             }
         },
         handleMobileCode(){// 点击获取短信验证码
-            var _self = this;
+            const _self = this;
             if( this.isMobileDisabled){ return }
             this.$nextTick(function() {
                 if (!verifyCheack('.massageBtn')) { return false; }
                 UserApi.userOperateCode(_self.smsCodeParams,function (response) {
-                    if(response.code == 0){
+                    if(response.code === 0){
                         CAIMEI.dialog('获取验证码成功~',false,function () {});
                         var TIME_COUNT = 60;
                         if (!_self.mobilTime) {
@@ -177,11 +177,11 @@ var loginPage = new Vue({
             })
         },
         toQrCodeLogin(){//切换微信登录二维码
-            var _self = this;
-            var timeClock = null;
+            const _self = this;
+            let timeClock = null;
             this.qrCodeLogin = true;
             UserApi.ToWechatLogin({},function(response){
-                var wxLogin = new WxLogin({
+                const wxLogin = new WxLogin({
                     self_redirect: true,
                     id: "qrCodeWrap",
                     appid: response.data.appId,
@@ -195,17 +195,17 @@ var loginPage = new Vue({
                     _self.maxtime--;
                     if (_self.maxtime == 0) {
                         clearInterval(timeClock);
-                    };
+                    }
                 },1000);
                 _self.getWrchatStatusData({state:response.data.state})
             });
         },
         getWrchatStatusData(params){//轮询查询用户是否扫描过二维码登录
-            var _self = this;
-            var timer = null;
+            const _self = this;
+            let timer = null;
             UserApi.ToWechatPolling(params,function(response){
-                if(response.code == -90){
-                    if(_self.maxtime == 0){
+                if(response.code === -90){
+                    if(_self.maxtime === 0){
                         clearInterval(timer);
                         _self.maxtime = 60;
                         $('#qrCodeWrap').append('<div class="model"><div class="refresh-div"><img class="refresh" src="/img/base/shua.png" alt=""><p>二维码已失效,点击刷新</p></div></div>');
@@ -220,7 +220,7 @@ var loginPage = new Vue({
                     }
                 }else {
                     clearTimeout(timer); //清理定时任务
-                    if(response.code == 0){
+                    if(response.code === 0){
                         _self.userData = {
                             account: response.data.account,
                             email: response.data.email,
@@ -242,7 +242,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) {
@@ -252,7 +252,7 @@ var loginPage = new Vue({
                         } else {
                             location.href="/index.html";
                         }
-                    }else if(response.code == -4){
+                    }else if(response.code === -4){
                         _self.userData = {
                             account: response.data.account,
                             email: response.data.email,
@@ -273,7 +273,7 @@ var loginPage = new Vue({
                         setTimeout(function(){
                             window.location.href = '/bind.html';
                         },1000);
-                    }else if(response.code == '-3'){//审核未通过
+                    }else if(response.code === '-3'){//审核未通过
                         _self.text ='您的供应商账号审核未通过,原因:图片模糊,营业执照错误,审核人员在后台填写的内容';
                         _self.stautsfalse = true;
                         _self.infofalse = true;
@@ -283,7 +283,7 @@ var loginPage = new Vue({
                             token: response.data.token
                         };
                         console.log(_self.applyUse);
-                    }else if(response.code == '-2'){
+                    }else if(response.code === '-2'){
                         _self.stautsfalse = true;
                         _self.text ='您的供应商账号正在加速审核中,审核通过后即可登录';
                     }else{
@@ -310,7 +310,7 @@ var loginPage = new Vue({
         },
         showPassword(event) {
             var el = event.currentTarget;
-            var pwdEle = $(el).siblings('input');
+            const pwdEle = $(el).siblings('input');
             if(pwdEle.attr('type') === 'password') {
                 $(el).addClass('on');
                 pwdEle.attr('type','text');
@@ -335,21 +335,21 @@ var loginPage = new Vue({
         }
     },
     created: function () {
-        var userAgent = navigator.userAgent.toLowerCase();
+        const userAgent = navigator.userAgent.toLowerCase();
         this.isWeChat = userAgent.match(/MicroMessenger/i);
         // this.weChatAutoLogin();
     },
     mounted: function () {
-        var _self = this;
-        var SlideVerifyPlug = window.slideVerifyPlug;
-        var slideVerify = new SlideVerifyPlug('#verify-wrap',{
-            wrapWidth:'350',//设置 容器的宽度 ,不设置的话,会设置成100%,需要自己在外层包层div,设置宽度,这是为了适应方便点;
-            initText:'请向右滑动滑块',  //设置  初始的 显示文字
-            sucessText:'验证通过',//设置 验证通过 显示的文字
-            getSuccessState:function(res){
+        const _self = this;
+        const SlideVerifyPlug = window.slideVerifyPlug;
+        const slideVerify = new SlideVerifyPlug('#verify-wrap', {
+            wrapWidth: '350',//设置 容器的宽度 ,不设置的话,会设置成100%,需要自己在外层包层div,设置宽度,这是为了适应方便点;
+            initText: '请向右滑动滑块',  //设置  初始的 显示文字
+            sucessText: '验证通过',//设置 验证通过 显示的文字
+            getSuccessState: function (res) {
                 //当验证完成的时候 会 返回 res 值 true,只留了这个应该够用了
                 console.log(res);
-                if(slideVerify.slideFinishState){
+                if (slideVerify.slideFinishState) {
                     $('.value').html(slideVerify.slideFinishState)
                     $('#resetBtn').removeClass('prohibit')
                     _self.isSlideFinishState = false;