注册功能增加邮箱验证功能;项目详情前端页面完成

This commit is contained in:
Yang Zhao 2016-12-29 12:31:43 +00:00
parent 3885ad5b36
commit 6c67b0ca34
6 changed files with 193 additions and 7 deletions

View File

@ -5,9 +5,9 @@ class UsersController < ApplicationController
def emailExist
if checkExist?(:email, params[:email])
render :text => 'exist'
render :text => '1'
else
render :text => 'not exist'
render :text => '0'
end
end

View File

@ -6,10 +6,10 @@ class User < ActiveRecord::Base
has_secure_password # 等价于验证password_confirm和password是否相等并且验证password是否存在
validates :name, presence: true, uniqueness: true, length: { maximum: 30 }
validates :name, presence: true, length: { maximum: 30 }
validates :email, presence: true, uniqueness: true, length: { maximum: 50},
format: { with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i }
validates :password, length: { minimum: 6 },on:create
validates :phone, presence: true, uniqueness: true, format: { with: /\A[0-9]{11,11}\Z/i },
validates :phone, presence: true, format: { with: /\A[0-9]{11,11}\Z/i },
multiline: false
end

BIN
public/dist/img/photo2.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 633 KiB

View File

@ -36,9 +36,9 @@
//2:分享
//3:通知
//4:修改个人信息
var src_array=["project_select","task","share","inform","alter_info"];
var src_array=["project_select","task","share","inform","alter_info","project_detail"];
var src="pages/"+src_array[seq]+".html";
if( seq==0 )
if( seq==0 || seq==5 )
window.location=src;
else
document.getElementById("main").src=src;
@ -140,7 +140,7 @@
</div>
<!-- col -->
<div class="col-lg-6">
<button class="btn btn-block btn-primary btn-lg">项目详情</button>
<button class="btn btn-block btn-primary btn-lg" onclick="change_iframe(5,$(this));return false;">项目详情</button>
</div>
<!-- col -->
</div>

View File

@ -0,0 +1,157 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<!-- Font Awesome -->
<link rel="stylesheet" href="../plugins/font-awesome/css/font-awesome.css">
<!-- Theme style -->
<link rel="stylesheet" href="../dist/css/AdminLTE.min.css">
<!-- Bootstrap 3.3.5 -->
<link rel="stylesheet" href="../bootstrap/css/bootstrap.min.css">
<!-- AdminLTE Skins. We have chosen the skin-blue for this starter
page. However, you can choose any other skin. Make sure you
apply the skin class to the body tag so the changes take effect.
-->
<link rel="stylesheet" href="../dist/css/skins/skin-green.min.css">
<!-- date picker -->
<link rel="stylesheet" href="../dist/css/datepicker.css">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body class="hold-transition skin-green sidebar-mini" style="overflow-x:hidden;">
<div class="wrapper">
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper" style="margin-left:0px;">
<section class="content-header">
<h1>
项目详情
<small>What Should I do?</small>
</h1>
</section>
<!-- header section -->
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-lg-8 col-lg-offset-2">
<!-- Widget: user widget style 1 -->
<div class="box box-widget widget-user">
<!-- Add the bg color to the header using any of the bg-* classes -->
<div class="widget-user-header bg-blue">
<h3 class="widget-user-username">项目信息修改</h3>
</div>
<div class="widget-user-image">
<img class="img-circle" src="../dist/img/photo2.png" alt="User Avatar">
</div>
<div class="box-footer">
<div class="row">
</div>
<!-- /.row -->
&nbsp
<div class="box-body">
<form id="alter">
<div class="form-group row has-feedback">
<label for="inputEmail3" class="col-sm-2 col-md-push-2 control-label">项目名称</label>
<div class="col-sm-6 col-md-push-2">
<input type="text" class="form-control" value="11" id="name" name="name" placeholder="姓名">
</div>
</div>
<!-- ./form-group -->
<div class="form-group row has-feedback">
<label for="inputPassword3" class="col-sm-2 col-md-push-2 control-label">项目简介</label>
<div class="col-sm-6 col-md-push-2">
<input type="text" class="form-control" value="11" id="address" name="address" placeholder="地址">
</div>
</div>
<!-- ./form-group -->
</form>
</div>
<!-- /.box-body -->
<div class="box-footer">
<button onclick="submit_query()" class="btn btn-primary pull-right">提交修改</button>
</div>
<!-- /.box-footer -->
</div>
</div>
<!-- /.widget-user -->
</div>
<!-- ./col -->
<div class="col-lg-8 col-lg-offset-2">
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title">成员修改</h3>
</div>
<!-- /.box-header -->
<!-- form start -->
<form role="form">
<div class="box-body">
<div class="row">
<div class="col-lg-9 col-md-push-2">
<table class="table" style="text-align:center">
<thead>
<tr>
<th style="text-align:center">姓名</th>
<th style="text-align:center">操作</th>
</tr>
</thead>
<tbody>
<tr>
<td>杨诏</td>
<td><button class="btn btn-primary btn-danger">删除</button></td>
</tr>
<tr>
<td>杨诏</td>
<td><button class="btn btn-primary btn-danger">删除</button></td>
</tr>
</tbody>
</table>
</div>
<!-- /.col -->
</div>
<!-- /.row -->
<div class="form-group row has-feedback">
<div class="col-sm-6 col-md-push-2">
<input type="text" class="form-control" value="" id="address" name="address" placeholder="输入新成员邮箱">
</div>
<div class="col-sm-2 col-md-push-2">
<button class="btn btn-primary btn-success">添加成员</button>
</div>
</div>
<!-- ./form-group -->
</div>
<!-- /.box-body -->
</form>
</div>
</div>
<!-- ./col -->
</div>
<!-- ./row -->
</section>
<!-- content header -->
</div>
<!-- content-wrapper -->
</div>
<!-- ./wrapper -->
<center><strong>Copyright &copy; 2016 <a href="#">Ambition Inc.</a>.</strong> All rights reserved.</center>
<!-- jQuery 2.1.4 -->
<script src="../plugins/jQuery/jQuery-2.1.4.min.js"></script>
<!-- Bootstrap 3.3.5 -->
<script src="../bootstrap/js/bootstrap.min.js"></script>
<!-- AdminLTE App -->
<script src="../dist/js/app.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="../dist/js/demo.js"></script>
<!-- date select and query -->
</body>
</html>

View File

@ -80,7 +80,35 @@
if( pwd1!=pwd2 ){
alert("两次密码输入不相同!");
}else{
var exist;
$.ajax({
type: "get",
dataType: "json",
url:"/users/emailExist.json",
async:false,// 强制同步
data: {
"email":email
},
statusCode: {
200: function(data) {// 请求成功
//alert(data);
if( data=='1' )
exist=true;
else
exist=false;
},
422:function(){
alert("输入不符合要求,请重新输入!");
},
401:function(){// 未授权
alert("用户名或密码错误!");
}
}
});
if( exist ){// 邮箱存在
alert("邮箱存在!");
}else{
$.ajax({
type: "post",
dataType: "json",
url:"/users.json",
@ -103,6 +131,7 @@
}
}
});
}
}
}
else{