Przeglądaj źródła

daqian modify for file upload

daqian 4 lat temu
rodzic
commit
8d2ec42716

+ 1 - 0
.gitignore

@@ -154,3 +154,4 @@ local.properties
 .scala_dependencies
 .worksheet
 
+/src/main/webapp/upload/avatar/

+ 2 - 0
src/main/java/com/jfinal/club/login/LoginValidator.java

@@ -52,6 +52,8 @@ public class LoginValidator extends Validator {
         if ("1".equals(c.getPara("type"))) {
             validateRequired("pwds", "msg", "密码不能为空");
             validateCaptcha("captcha", "msg", "验证码不正确");
+        }else if("2".equals(c.getPara("type"))){
+            validateRequired("pwds", "msg", "密码不能为空");
         } else {
             Map<String, String> map = c.getSessionAttr(c.getPara("phone"));
             validateRequired("code", "msg", "手机验证码不能为空");

+ 1 - 1
src/main/webapp/_view/common/__layout.html

@@ -44,7 +44,7 @@
                                 <a href="center.html" class="top_infor_right">
                                     <p class="top_infor_name">#(loginUsers.phone)</p>
                                     <p class="top_infor_tel">#(loginUsers.nickname)</p></a>
-                                <a class="tc_btn" onclick="logout()" href="#">退出</a>
+                                <a class="tc_btn" href="/logout">退出</a>
                             </div>
                         </div>
                     </li>

+ 60 - 22
src/main/webapp/_view/index/index.html

@@ -10,25 +10,6 @@
         </div>
     </div>
 </div>
-<script type="text/javascript">
-    $(function () {
-        $(".search_label").click(function () {
-            $(this).children(".input_ys").addClass("input_checked");
-            $(this).siblings().children(".input_ys").removeClass("input_checked");
-        })
-
-        $(".gzh_top").click(function () {
-            if ($(this).hasClass("gzh_topcur")) {
-                $(".erweima_con").slideUp();
-                $(this).removeClass("gzh_topcur");
-            } else {
-                $(".erweima_con").slideDown();
-                $(this).addClass("gzh_topcur");
-            }
-
-        })
-    })
-</script>
 <!-- 导航 -->
 <div class="nav">
     <div class="mainbox clearfix">
@@ -105,17 +86,17 @@
             <p class="login_index_tit">账户登录</p>
             <p class="login_index_input">
                 <i class="icon_login_name"></i>
-                <input type="text" placeholder="用户名">
+                <input type="text" name="phone" id="phone" placeholder="用户名">
             </p>
             <p class="login_index_input">
                 <i class="icon_login_pass"></i>
-                <input type="password" placeholder="密码">
+                <input type="password" name="pwds" id="pwds" placeholder="密码">
             </p>
             <div class="login_index_enter">
                 <a href="reg">注册</a>
                 <a href="forget.html">忘记密码</a>
             </div>
-            <a class="index_sc_btn" href="index.html">登录</a>
+            <a class="index_sc_btn" id="loginHref" href="javascript:void(0)" onclick="">登录</a>
         </div>
         #end
     </div>
@@ -290,4 +271,61 @@
 
 </div>
 
+#define js()
+<script type="text/javascript" src="/assets/layer/layer/layer.js"></script>
+<script type="text/javascript">
+    $(document).ready(function () {
+        $("#loginHref").click(function () {
+            $.ajax({
+                url: "/login/doLogin",
+                dataType: "json",
+                beforeSubmit: function (formData, jqForm, options) {
+                    // 表单提交之前回调
+                },
+                data: {phone:$("#phone").val(), pwds:$("#pwds").val(),type:2},
+                success: function (ret) {
+                    if (ret.state == "ok") {
+                        location.href = ret.returnUrl;
+                    } else {
+                        layer.msg(ret.msg, {
+                                shift: 6
+                                , shade: 0.3
+                                , time: 7000			// 0 为不自动关闭窗口
+                                , offset: "165px"
+                                , closeBtn: 1
+                                , shadeClose: true
+                            }, function () {
+                                updateCaptcha(captchaImg, captchaInputId);
+                            }
+                        );
+                    }
+                },
+                error: function (ret) {
+                }              // ret.status != 200 时回调
+                , complete: function (ret) {
+                }       // 无论是 success 还是 error,最终都会被回调
+            });
+        });
+    });
+
+    $(function () {
+        $(".search_label").click(function () {
+            $(this).children(".input_ys").addClass("input_checked");
+            $(this).siblings().children(".input_ys").removeClass("input_checked");
+        })
+
+        $(".gzh_top").click(function () {
+            if ($(this).hasClass("gzh_topcur")) {
+                $(".erweima_con").slideUp();
+                $(this).removeClass("gzh_topcur");
+            } else {
+                $(".erweima_con").slideDown();
+                $(this).addClass("gzh_topcur");
+            }
+
+        })
+    });
+</script>
+#end
+
 #end

+ 0 - 1
src/main/webapp/_view/login/forget_password.html

@@ -30,7 +30,6 @@
 		font-size: 16px;
 		margin-right:30px;
 	}
-	
 </style>
 #end
 

+ 5 - 0
src/main/webapp/_view/login/login.html

@@ -1,4 +1,9 @@
 #include("_top.html")
+<style>
+    .login_way{
+        display: none;
+    }
+</style>
 <div class="login_w">
     <div class="login_con">
         <div class="login_tit"><i class="icon_login_1"></i>用户登录</div>

+ 1 - 1
src/main/webapp/_view/my/common/_my.html

@@ -48,7 +48,7 @@
                                     <p class="top_infor_name">#(loginUsers.phone)</p>
                                     <p class="top_infor_tel">#(loginUsers.nickname)</p>
                                 </a>
-                                <a class="tc_btn" href="#">退出</a>
+                                <a class="tc_btn" href="/logout">退出</a>
                             </div>
 
                         </div>

+ 2 - 3
src/main/webapp/_view/my/doc/_top.html

@@ -41,12 +41,11 @@
                     <a href="center" class="top_infor">#(loginUsers.phone) <i class="icon_top"></i></a>
                     <div class="top_infor_down">
                         <div class="top_infor_con">
-                            <a href="/doc/" class="top_infor_pic"><img src="#(context)/assets/#(loginUsers.tximg)"
-                                                                       alt=""></a>
+                            <a href="/doc/" class="top_infor_pic"><img src="#(context)/assets/#(loginUsers.tximg)" alt=""></a>
                             <a href="/doc/" class="top_infor_right">
                                 <p class="top_infor_name">#(loginUsers.phone)</p>
                                 <p class="top_infor_tel">#(loginUsers.nickname)</p></a>
-                            <a class="tc_btn" href="#">退出</a>
+                            <a class="tc_btn" href="/logout">退出</a>
                         </div>
                     </div>
                 </li>