注册页面(未完)

This commit is contained in:
huang 2016-06-15 17:24:46 +08:00
parent a2c5cc6da1
commit 06f97d5cb7
3 changed files with 123 additions and 156 deletions

View File

@ -2,32 +2,6 @@
<%= stylesheet_link_tag 'leftside'%>
<script type="text/javascript">
// $(document).ready(function(){
// $("#loginSignButton").click(function(){
// $("#signUpBox").css({display:"block"});
// $("#loginInBox").css({display:"none"});
// });
// $("#loginInButton").click(function(){
// $("#signUpBox").css({display:"none"});
// $("#loginInBox").css({display:"block"});
// });
// });
// $(function(){
// $("#username").keypress(function(e){
// alert(11);
// if (e.keyCode == '13') {
// $('#main_login_form').submit();
// }
// });
//
// $("#password").keypress(function(e){
// if (e.keyCode == '13') {
// $('#main_login_form').submit();
// }
// });
// });
$(document).ready(function(){
$(".homepageSearchIcon").click(function(){
var val=$('input:radio[name="search_type"]:checked').val();
@ -38,10 +12,6 @@
$("#navSearchAlert").css({display:"none"});
}
});
// $("#loginInButton").click(function(){
// $("#signUpBox").css({display:"none"});
// $("#loginInBox").css({display:"block"});
// });
});
$(document).ready(function(){
@ -62,42 +32,6 @@
}
});
// $('#regist_btn').bind('keyup', function(event) {
// if (event.keyCode == "13" && $("#signUpBox").css('display') == 'block')) {
// register();
// }
//});
function clearInfo(id, content) {
var text = $('#' + id);
if (text.val() == content) {
$('#' + id).val('');
}
}
function showInfo(id, content) {
var text = $('#' + id);
if (text.val() == '') {
$('#' + id).val(content);
}
}
function login(){
$('#main_login_form').submit(); //表单提交没有任何反应的原因js冲突
}
function register(){
if($("#loginUpButton").hasClass('loginUpDisableButton')){
return;
}
if($login_correct && $mail_correct && $passwd_correct && $passwd_comfirm_correct && $("#read_and_confirm").attr("checked") == 'checked'){
$("#main_reg_form").submit();
}else{
$('#user_login').blur();
$('#user_mail').blur();
$('#user_password').blur();
$('#user_password_confirmation').blur();
}
}
var $login_correct = false;
var $mail_correct = false;
var $passwd_correct = false;
@ -185,48 +119,86 @@
});
});
function user_name_keypress(e){
if (e.keyCode == '13') {
$('#main_login_form').submit();
}
}
function changeRegisterBtn(checkbox){
if(checkbox.checked == true){
$("#loginUpButton").removeClass('loginUpDisableButton');
$("#loginUpButton").addClass('loginUpButton');
}else{
$("#loginUpButton").removeClass('loginUpButton')
$("#loginUpButton").addClass('loginUpDisableButton');
}
}
</script>
<div class="new_login">
<div class="new_login" id = "loginInBox">
<div class="new_login_con">
<div class="new_login_txt fl">
<h3> 欢迎加入Trustie创新实践社区</h3>
<p>在这里您的创新意识和创新潜力将得到充分发挥目前已有超过200所高校和科研机构在平台中开展在线协同开发、协同学习和协同研究。</p>
</div>
<div class="new_login_box fr mr45 mt100">
<h2 class="new_login_h2">登录<a href="register.html" class="fr mt5">立即注册</a><div class="cl"></div></h2>
<h2 class="new_login_h2">登录
<a href="<%= register_url_without_domain %>" class="fr mt5">立即注册</a><div class="cl"></div>
</h2>
<div class="new_login_form">
<form>
<ul>
<li>
<input type="text" class="new_loggin_input new_login_users" placeholder="请输入邮箱地址或登录名">
<p class="new_login_error" >请输入正确的邮箱或登录名</p>
</li>
<li>
<input type="text" class="new_loggin_input new_login_lock" placeholder="请输入登录密码">
<p class="new_login_error" style="display:none;">请输入位密码,区分大小写,不能使用空格!</p>
</li>
<li>
<label><input type="checkbox" checked=" checked" class=" new_login_check">记住密码</label>
<a href="javascript:void(0);" class="fr">忘记密码</a><div class="cl"></div>
</li>
<li><button type="submit" class="new_login_submit">登录</button></li>
</ul>
</form>
<%= form_tag(signin_path,:id=>'main_login_form',:method=>'post') do %>
<%= back_url_hidden_field_tag %>
<ul>
<li>
<%= 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>
<%= 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>
</li>
<li>
<% if Setting.autologin? %>
<label><%= check_box_tag 'autologin', 1, true, :tabindex => 4, :class => "new_login_check" %><%= l(:label_stay_logged_in) %></label>
<% end %>
<a href="<%= lost_password_path %>" class="fr">
<% if Setting.lost_password? %>忘记密码<% end %>
</a>
<div class="cl"></div>
</li>
<li><a href="javascript:void(0);" id="login_btn" class="new_login_submit" onclick="$('#main_login_form').submit();">登录</a></li>
</ul>
<% end %>
</div>
</div>
<div class="cl"></div>
</div>
</div>
<%# 注册 %>
<div class="new_register">
<div class="new_register_con">
<div class="new_login_txt fl new_register_left">
<h3> 欢迎加入Trustie创新实践社区</h3>
<p>在这里您的创新意识和创新潜力将得到充分发挥目前已有超过200所高校和科研机构在平台中开展在线协同开发、协同学习和协同研究。</p>
</div>
<div class="new_login_box fr mr45 mt50">
<h2 class="new_login_h2">登录<a href="<%= signin_url_without_domain %>" class="fr mt5">已有账号 请登录</a><div class="cl"></div></h2>
<div class="new_login_form">
<%= form_for :user, :url => register_path,:method=>'post',:html=>{:id=>'main_reg_form'} do |f| %>
<%= error_messages_for 'user' %>
<ul>
<li>
<%= f.text_field :mail, :size => 25, :class => 'new_loggin_input' , :placeholder => "请输入邮箱地址"%>
<p class="new_login_error" id="mail_req" style="display: none" >请输入正确的邮箱</p>
</li>
<li>
<input type="text" class="new_loggin_input " placeholder="请输入密码">
<p class="new_login_error" style="display:none;">请输入6-16位密码区分大小写不能使用空格</p>
</li>
<li>
<input type="text" class="new_loggin_input " placeholder="请输入密码">
<p class="new_login_error" style="display:none;">两次密码不一致!</p>
</li>
<li>
<input type="text" class="new_loggin_input " placeholder="请输入登录名">
<p class="new_login_error" style="display:none;" >登录名已使用!</p>
</li>
<li>
<label><input type="checkbox" checked=" checked" class=" new_login_check">我已阅读并接受<a href="javascript:void(0);" >Trustie服务协议条款</a></label>
</li>
<li><button type="submit" class="new_login_submit">注册</button></li>
</ul>
<% end %>
</div>
</div>
@ -234,62 +206,9 @@
</div>
</div>
<div class="loginContentContainer">
<div class="loginContent">
<div class="loginLeft">
<div class="loginLogo"><img src="images/trustie_big_log.png" width="100" height="88" alt="Trustie Logo" /></div>
<div class="loginInro">&nbsp;&nbsp;欢迎加入Trustie创新实践社区在这里您的创新意识和创新潜力将得到充分发挥目前已有超过200所高校和科研机构在平台中开展在线协同开发、协同学习和协同研究。<br/><br/>&nbsp;&nbsp;Trustie社区的理想是让创新过程变的更美好</div>
</div>
<div class="loginRight">
<div id="loginInBox">
<div class="loginChooseBox">
<div class="mb5">
<ul class="loginChooseList">
<li class="loginChoose fl"><span class="loginChooseTab">登录</span></li>
<li class="loginChooseBorder fl"></li>
</ul>
</div>
<div class="loginSignAlert" style="color: red"><%= flash.empty? || flash[:error].nil? ? "" : flash[:error].html_safe %></div>
</div>
<div class="loginIn">
<%= form_tag(signin_path,:id=>'main_login_form',:method=>'post') do %>
<%= back_url_hidden_field_tag %>
<div class="mb20">
<%= text_field_tag 'username', params[:username], :tabindex => '1' ,
:class=>'loginSignBox',:placeholder=>'请输入邮箱地址或登录名', :onkeypress => "user_name_keypress(event);"%>
<!--<input type="text" placeholder="请输入邮箱地址或昵称" class="loginSignBox" />-->
</div>
<% if Setting.openid? %>
<div class="mb20">
<%= text_field_tag "openid_url", nil, :tabindex => '3',:placeholder=>'请输入OpenId URL' %>
</div>
<% end %>
<div>
<!--<input type="text" placeholder="请输密码" class="loginSignBox" />-->
<%= password_field_tag 'password', nil, :tabindex => '2',:class=>'loginSignBox' ,:placeholder=>'请输密码', :onkeypress => "user_name_keypress(event);"%>
</div>
<div class="loginSignOption">
<% if Setting.autologin? %>
<div class="fl mt3 mr5">
<%= check_box_tag 'autologin', 1, true, :tabindex => 4 %>
</div>
<%= l(:label_stay_logged_in) %>
<% end %>
<a href="<%= lost_password_path %>" class="newsBlue mr40 fr">
<% if Setting.lost_password? %>
<u>忘记密码?</u>
<% end %>
</a></div>
<% end %>
<div class="loginInButton" >
<a href="javascript:void(0);" id="login_btn" class="c_white db" onclick="$('#main_login_form').submit();">登录</a>
</div>
</div>
</div>
<div id="signUpBox">
<div class="loginChooseBox">
<ul class="loginChooseList">

View File

@ -9,11 +9,12 @@
<%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'new_user', 'user_leftside', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= javascript_include_tag "bootstrap","avatars","new_user"%>
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>
<%= yield :header_tags -%>
</head>
<body>
<div class="navContainer">
<% is_current_user = User.current.logged? && User.current == @user%>
<% if User.current.logged? %>
@ -22,10 +23,9 @@
<%= render :partial => 'layouts/unlogin_header' %>
<% end%>
</div>
<%= yield %>
<div class="cl"></div>
<%= javascript_heads %>
<%= javascript_include_tag "bootstrap","avatars","new_user"%>
<%= render :partial => 'layouts/footer' %>
<div class="cl"></div>
<%= call_hook :view_layouts_base_body_bottom %>

View File

@ -627,4 +627,52 @@ var autoTextarea2 = function (elem,elem2, extra, maxHeight) {
addEvent(elem2, 'input', change);
addEvent(elem2, 'focus', change);
change();
};
};
function user_name_keypress(e){
if (e.keyCode == '13') {
$('#main_login_form').submit();
}
}
function changeRegisterBtn(checkbox){
if(checkbox.checked == true){
$("#loginUpButton").removeClass('loginUpDisableButton');
$("#loginUpButton").addClass('loginUpButton');
}else{
$("#loginUpButton").removeClass('loginUpButton')
$("#loginUpButton").addClass('loginUpDisableButton');
}
}
function clearInfo(id, content) {
var text = $('#' + id);
if (text.val() == content) {
$('#' + id).val('');
}
}
function showInfo(id, content) {
var text = $('#' + id);
if (text.val() == '') {
$('#' + id).val(content);
}
}
function login(){
$('#main_login_form').submit(); //表单提交没有任何反应的原因js冲突
}
function register(){
if($("#loginUpButton").hasClass('loginUpDisableButton')){
return;
}
if($login_correct && $mail_correct && $passwd_correct && $passwd_comfirm_correct && $("#read_and_confirm").attr("checked") == 'checked'){
$("#main_reg_form").submit();
}else{
$('#user_login').blur();
$('#user_mail').blur();
$('#user_password').blur();
$('#user_password_confirmation').blur();
}
}