Browse Source

fixed:在登录失败后,验证码自动刷新

Rlax 8 years ago
parent
commit
7953fdfbf9

+ 3 - 2
README.md

@@ -55,12 +55,13 @@
     1、建立后台管理数据库:doc/sql/jboot-admin.sql,数据库名:jboot-admin,用户名密码root/root
     2、建立B2C数据库:doc/sql/jboot-b2c.sql,数据库名:jboot-b2c,用户名密码root/root
     3、启动consul或zookeeper,目前配置文件默认为consul+motan,如需替换dubbo + zookeeper可参考下面配置进行更改
-    4、启动redis,默认密码为 123456,可在配置文件进行修改
+    4、启动redis,需要配置密码为 123456,可在配置文件进行修改
     5、如需更改db/redis/consul/zookeeper等配置请更新客户端配置文件:jboot-admin/resources/jboot.properties
     6、如需更改db/redis/consul/zookeeper数据库配置请更新服务端配置文件:jboot-admin-service/jboot-admin-service-provider/resources/jboot.properties
     7、启动客户端:客户端启动入口:io.jboot.admin.Application
     8、启动服务端:服务端启动入口:io.jboot.admin.service.provider.app.Application
-    9、浏览器访问:localhost:8888,默认用户名密码:admin/123123
+    9、启动B2C服务端:服务端启动入口:io.jboot.b2c.service.provider.app.Application
+    10、浏览器访问:localhost:8888,默认用户名密码:admin/123123
         
     附加:
     监控相关功能需要安装对应服务才可正常使用

+ 9 - 0
jboot-admin/src/main/resources/static/js/utils.js

@@ -49,6 +49,7 @@ util.sendAjax = function(obj) {
     var cache = obj.cache;
     var successfn = obj.success;
     var unSuccess = obj.unSuccess;
+    var completefn = obj.complete;
     var notice = obj.notice;
     async = (async==null || async==="" || typeof(async)=="undefined")? "true" : async;
     cache = (cache==null || cache==="" || typeof(cache)=="undefined")? "false" : cache;
@@ -67,6 +68,13 @@ util.sendAjax = function(obj) {
 
         }
     }
+
+    if (completefn==null || completefn==="" || typeof(completefn)=="undefined") {
+        completefn = function () {
+
+        }
+    }
+
     //POST,PUT 转化成json字符串
     if(type=="POST" || type=="PUT"){
 
@@ -110,6 +118,7 @@ util.sendAjax = function(obj) {
 			}
         },
         complete :function(XMLHttpRequest, TS){
+            completefn();
             if (loadFlag) {
             	layer.closeAll('loading');
             }

+ 6 - 2
jboot-admin/src/main/resources/template/login.html

@@ -32,7 +32,7 @@
 
             <div class="layui-input-inline">
                 <input type="text" name="capval" class="layui-input" required lay-verify="required" placeholder="验证码" maxlength="4" minlength="4"/>
-                <img alt="验证码" src="#(ctxPath)/captcha" onclick = "this.src='#(ctxPath)/captcha?'+Math.random()">
+                <img id="captchaImg" alt="验证码" src="#(ctxPath)/captcha" onclick = "this.src='#(ctxPath)/captcha?'+Math.random()">
             </div>
         </div>
         <div class="layui-form-item">
@@ -57,8 +57,12 @@
                 url: '#(ctxPath)/postLogin',
                 data: $.param(data.field),
                 loadFlag: true,
-                success : function(data){
+                success : function(data) {
                     window.location.href = "/";
+                },
+                complete : function() {
+                    // 刷新验证码
+                    $("#captchaImg").attr('src', '#(ctxPath)/captcha?'+Math.random());
                 }
             });