完成新版登录注册

This commit is contained in:
huang 2016-06-16 10:21:21 +08:00
parent aa42044199
commit 5e3df51ad9
4 changed files with 35 additions and 20 deletions

View File

@ -52,7 +52,7 @@
$('#login_req').html('<span style="color: green">'+data.message+'</span>'); $('#login_req').html('<span style="color: green">'+data.message+'</span>');
$login_correct = true; $login_correct = true;
} else { } else {
$('#login_req').html( '<span style="color: red">'+data.message+'</span>'); $('#login_req').html( '<span style="color: #c00202">'+data.message+'</span>');
$login_correct = false; $login_correct = false;
} }
$('#login_req').css('display','block'); $('#login_req').css('display','block');
@ -63,7 +63,7 @@
$mail.blur(function (event) { $mail.blur(function (event) {
if (/^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/.test(this.value) == false){ if (/^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/.test(this.value) == false){
$('#mail_req').html( '<span style="color: red">邮件格式不对</span>').show(); $('#mail_req').html( '<span style="color: #c00202">邮件格式不对</span>').show();
$mail_correct = false; $mail_correct = false;
return ; return ;
} }
@ -76,7 +76,7 @@
$('#mail_req').html( '<span style="color: green">'+data.message+'</span>' ); $('#mail_req').html( '<span style="color: green">'+data.message+'</span>' );
$mail_correct = true; $mail_correct = true;
} else { } else {
$('#mail_req').html( '<span style="color: red">'+data.message+'</span>' ); $('#mail_req').html( '<span style="color: #c00202">'+data.message+'</span>' );
$mail_correct = false; $mail_correct = false;
} }
$('#mail_req').css('display','block'); $('#mail_req').css('display','block');
@ -92,7 +92,7 @@
$passwd_correct = true; $passwd_correct = true;
} }
else { else {
$('#passwd_req').html( '<span style="color: red">'+'<%= l(:setting_password_min_length_limit, :count => Setting.password_min_length.to_i) %>'+'</span>'); $('#passwd_req').html( '<span style="color: #c00202">'+'<%= l(:setting_password_min_length_limit, :count => Setting.password_min_length.to_i) %>'+'</span>');
$passwd_correct = false; $passwd_correct = false;
} }
$('#passwd_req').css('display','block'); $('#passwd_req').css('display','block');
@ -108,7 +108,7 @@
$passwd_comfirm_correct = true; $passwd_comfirm_correct = true;
} }
else { else {
$('#confirm_req').html('<span style="color: red">'+'<%= l(:setting_password_error) %>'+'</span>'); $('#confirm_req').html('<span style="color: #c00202">'+'<%= l(:setting_password_error) %>'+'</span>');
$passwd_comfirm_correct = false; $passwd_comfirm_correct = false;
} }
@ -118,8 +118,6 @@
}); });
}); });
</script> </script>
<div class="new_login" id = "loginInBox"> <div class="new_login" id = "loginInBox">
@ -138,12 +136,9 @@
<ul> <ul>
<li> <li>
<%= text_field_tag 'username', params[:username], :tabindex => '1', :class=>'new_loggin_input new_login_users',:placeholder=>'请输入邮箱地址或登录名', :onkeypress => "user_name_keypress(event);"%> <%= text_field_tag 'username', params[:username], :tabindex => '1', :class=>'new_loggin_input new_login_users',:placeholder=>'请输入邮箱地址或登录名', :onkeypress => "user_name_keypress(event);"%>
<!--<input type="text" class="new_loggin_input new_login_users" placeholder="请输入邮箱地址或登录名">-->
<!--<p class="new_login_error" >请输入正确的邮箱或登录名</p>-->
</li> </li>
<li> <li>
<%= password_field_tag 'password', nil, :tabindex => '2', :class => 'new_loggin_input new_login_lock' , :placeholder => '请输入登录密码', :onkeypress => "user_name_keypress(event);"%> <%= password_field_tag 'password', nil, :tabindex => '2', :class => 'new_loggin_input new_login_lock' , :placeholder => '请输入登录密码', :onkeypress => "user_name_keypress(event);"%>
<!--<input type="text" class="new_loggin_input new_login_lock" placeholder="请输入登录密码">-->
<p class="new_login_error"><%= flash.empty? || flash[:error].nil? ? "" : flash[:error].html_safe %></p> <p class="new_login_error"><%= flash.empty? || flash[:error].nil? ? "" : flash[:error].html_safe %></p>
</li> </li>
<li> <li>
@ -155,7 +150,7 @@
</a> </a>
<div class="cl"></div> <div class="cl"></div>
</li> </li>
<li><a href="javascript:void(0);" id="login_btn" class="new_login_submit" onclick="$('#main_login_form').submit();">登录</a></li> <li><button type="submit" class="new_login_submit"><a href="javascript:void(0);" id="login_btn" onclick="$('#main_login_form').submit();">登录</a></button></li>
</ul> </ul>
<% end %> <% end %>
</div> </div>
@ -197,7 +192,9 @@
<label><input type="checkbox" id="read_and_confirm" onchange="changeRegisterBtn(this);" class=" new_login_check">我已阅读并接受<a href="<%= agreement_path %>" >Trustie服务协议条款</a></label> <label><input type="checkbox" id="read_and_confirm" onchange="changeRegisterBtn(this);" class=" new_login_check">我已阅读并接受<a href="<%= agreement_path %>" >Trustie服务协议条款</a></label>
</li> </li>
<li> <li>
<button type="submit" class="new_login_submit"><a href="javascript:void(0);" class="new_login_submit" id="regist_btn" onclick="register();" >注册</a></button></li> <div class="new_login_submit_disable" id="loginUpButton">
<a href="javascript:void(0);" id="regist_btn" onclick="register();" class ="db" class="new_login_submit_disable" style="text-decoration: none;">注册</a>
</div>
</ul> </ul>
<% end %> <% end %>
</div> </div>

View File

@ -15,6 +15,7 @@
<%= call_hook :view_layouts_base_html_head %> <%= call_hook :view_layouts_base_html_head %>
<%= yield :header_tags -%> <%= yield :header_tags -%>
</head> </head>
<body style="background-color: #fff">
<div class="navContainer"> <div class="navContainer">
<% is_current_user = User.current.logged? && User.current == @user%> <% is_current_user = User.current.logged? && User.current == @user%>
<% if User.current.logged? %> <% if User.current.logged? %>

View File

@ -637,11 +637,11 @@ function user_name_keypress(e){
function changeRegisterBtn(checkbox){ function changeRegisterBtn(checkbox){
if(checkbox.checked == true){ if(checkbox.checked == true){
$("#loginUpButton").removeClass('loginUpDisableButton'); $("#loginUpButton").removeClass('new_login_submit_disable');
$("#loginUpButton").addClass('loginUpButton'); $("#loginUpButton").addClass('new_login_submit');
}else{ }else{
$("#loginUpButton").removeClass('loginUpButton') $("#loginUpButton").removeClass('new_login_submit')
$("#loginUpButton").addClass('loginUpDisableButton'); $("#loginUpButton").addClass('new_login_submit_disable');
} }
} }
@ -664,7 +664,7 @@ function login(){
} }
function register(){ function register(){
if($("#loginUpButton").hasClass('loginUpDisableButton')){ if($("#loginUpButton").hasClass('new_login_submit_disable')){
return; return;
} }
if($login_correct && $mail_correct && $passwd_correct && $passwd_comfirm_correct && $("#read_and_confirm").attr("checked") == 'checked'){ if($login_correct && $mail_correct && $passwd_correct && $passwd_comfirm_correct && $("#read_and_confirm").attr("checked") == 'checked'){

View File

@ -747,8 +747,8 @@ a:hover .gz_btn{color:#ff5722;}
.homepageCoursesType {width:75px; background-color:#ffffff; float:left; list-style:none; position:absolute; border:1px solid #eaeaea; border-radius:5px; top:15px; padding:5px 10px; left:-65px; font-size:12px; color:#4b4b4b; line-height:2; z-index:9999; display:none;} .homepageCoursesType {width:75px; background-color:#ffffff; float:left; list-style:none; position:absolute; border:1px solid #eaeaea; border-radius:5px; top:15px; padding:5px 10px; left:-65px; font-size:12px; color:#4b4b4b; line-height:2; z-index:9999; display:none;}
/*注册登陆页面*/ /*注册登陆页面*/
#loginInBox {display:block; margin-top:143px;} #loginInBox {display:block;}
#signUpBox {display:none; margin-top:79px;} #signUpBox {display:none;}
#loginSignButton {height:54px; padding-left:10px; padding-right:10px; text-align:center; line-height:54px; vertical-align:middle; color:#ffffff; font-size:16px;} #loginSignButton {height:54px; padding-left:10px; padding-right:10px; text-align:center; line-height:54px; vertical-align:middle; color:#ffffff; font-size:16px;}
#loginInButton {height:54px; padding-left:10px; padding-right:10px; text-align:center; line-height:54px; vertical-align:middle; color:#ffffff; font-size:16px;} #loginInButton {height:54px; padding-left:10px; padding-right:10px; text-align:center; line-height:54px; vertical-align:middle; color:#ffffff; font-size:16px;}
#loginSignButton:hover {background-color:#05488e;} #loginSignButton:hover {background-color:#05488e;}
@ -1708,11 +1708,28 @@ input.new_login_lock{
margin-bottom:15px; margin-bottom:15px;
} }
.new_login_error{ .new_login_error{
color:#c00202;
}
.new_login_submit_disable{
width:265px;
height:40px;
line-height: 40px;
background:#ccc;
color:#fff; color:#fff;
font-size:14px;
-webkit-border-radius:5px;
-moz-border-radius:5px;
-o-border-radius:5px;
border-radius:5px;
border:none;
text-align:center;
cursor:pointer;
vertical-align: middle;
} }
.new_login_submit{ .new_login_submit{
width:265px; width:265px;
height:40px; height:40px;
line-height: 40px;
background:#f27d0d; background:#f27d0d;
color:#fff; color:#fff;
font-size:14px; font-size:14px;
@ -1723,7 +1740,7 @@ input.new_login_lock{
border:none; border:none;
text-align:center; text-align:center;
cursor:pointer; cursor:pointer;
vertical-align: middle;
} }
.new_login_check{ .new_login_check{
width:15px; width:15px;