<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title></title>
<script src="../scripts/jquery-1.10.2.min.js"></script>
<script src="../scripts/viewport.js"></script>
<style>
*{
margin: 0;
padding: 0
}
html{
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
-webkit-tap-highlight-color:transparent;
}
body{
position: absolute;
width: 100%;
background: white
}
form,.num,.name,.wrap>div:nth-last-of-type(1){
position: absolute;
left: 50%;
transform: translateX(-50%);
width: 76%;
z-index: 2;
}
form{
top: 52%;
}
.num{
top: 42%;
font-size: 50px;
font-weight: bold
}
.name{
font-size: 24px;
top: 48%;
}
.wrap>div:nth-last-of-type(1){
font-size: 20px;
top: 85%;
text-align: center;
font-size: 20px
}
input{
font-size: 28px;
padding-bottom: 10px;
box-sizing: border-box;
width: 100%;
margin: 20px auto;
border-bottom: 1px solid #dddddd;
border-top:0px;
border-left:0px;
border-right:0px;
}
input::-webkit-input-placeholder {
color: #dddddd;
font-size: 30px;
}
.wrap{
background: white;
width: 100%;
height: 100%;
position: relative
}
.bgImg{
position: absolute;
left: 0;
top: 0
}
.bgImg,.bgImg img{
width: 100%;
}
.bgImg img{
display: block
}
a{
text-decoration: none
}
.register {
font-size: 24px;
color: white;
text-align: center;
width: 90%;
border-radius: 40px;
display: block;
padding: 20px 0;
margin: 12px auto;
background: -moz-linear-gradient(right, #2cb38a, #00e2b5);
/* Firefox 3.6 - 15 */
background: -webkit-linear-gradient(right, #2cb38a, #00e2b5);
/* Safari 5.1 - 6.0 */
background: -o-linear-gradient(right, #2cb38a, #00e2b5);
/* Opera 11.1 - 12.0 */
background: linear-gradient(to right, #2cb38a, #00e2b5) !important;
/* 标准的语法 */
}
.agreement{
color: #2cb38a;
font-size: 22px;
padding: 2px;
display: block;
}
.gain{
position: absolute;
right: 0;
top: 30%;
color: #2cb38a;
font-size: 24px;
border:0px;
background-color:transparent
}
.confirm{
width: 100%;
height: 100%;
position: fixed;
left: 0;
top: 0;
z-index: 99;
background: rgba(0, 0, 0, .3);
display: none;
}
.confirm>div{
height: 20%;
border-radius: 20px;
position: absolute;
width: 60%;
left: 50%;
transform: translateX(-50%);
top: 40%;
background: white;
text-align: center;
color: #666666;
font-size: 24px
}
.confirm>div {
position: relative;
z-index: 100;
}
.confirm>div p,.confirm>div a{
z-index: 101;
position: absolute;
left: 50%;
transform: translateX(-50%)
}
.confirm>div p{
width: 57%;
top: 24%;
}
.confirm>div a{
color: #2cb38a;
width: 100%;
display: block;
box-sizing: border-box;
padding:20px;
border-top:1px solid #999999 ;
bottom: 0
}
</style>
</head>
<body>
<div class="wrap">
<div class="confirm">
<div>
<p></p>
<a href="javascript:void(0);">好的</a>
</div>
</div>
<div class="bgImg"><img src="../images/reg2.png" alt=""></div>
<p class="num"></p>
<p class="name"></p>
<form action="">
<input type="number" name="" id="" placeholder="请输入手机号" class="phone">
<input type="number" name="" id="" placeholder="请输入验证码" class="code">
<button type="button" class="gain" id="btn">获取验证码</button>
<input type="password" name="" id="" placeholder="请输入密码" class="pass1">
<input type="password" name="" id="" placeholder="请确认密码" class="pass2">
</form>
<div>
<a href="javascript:void(0);" class="register">成为会员</a>
</div>
</div>
<script>
$(function () {
$('body').height($(window).height())
var myreg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/; //手机号
var win_h = $(window).height();
var u = navigator.userAgent;
var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
// $('.wrap').height(document.documentElement.clientHeight);
var nickname = getURLParameter("nickname");
var inviteeMemberDays = getURLParameter("inviteeMemberDays");
var invitationCode = getURLParameter("invitationCode");
$('.num').html(invitationCode)
$('.name').html("来自"+nickname+"会员的邀请码")
//11111111111111111111手机输入框
//监听手机可视高度 ios无resize事件
window.addEventListener('resize', function () {
if ($(window).height() < win_h) {
if (isAndroid) {
var target = this;
setTimeout(function () {
target.scrollIntoViewIfNeeded();
target.scrollIntoView(true);
}, 200);
}
} else {
}
});
//ios监测失焦聚焦即可
$("input").focus(function () {
}).blur(function () {
if (isiOS) {
window.scrollTo(0, document.body.scrollHeight);
}
});
//222222222222222222获取验证码
$('.gain').click(function () {
if (!myreg.test($('.phone').val())) {
$('.confirm').show()
$('.confirm>div p').html("请输入正确的手机号")
//alert('输入正确的手机号')
$('.phone').val('')
} else {
invokeSettime(this)
//获取验证码 ajax请求
$.submit({
type: "get",
url: "regCode/" + $('.phone').val(),
func: function (res) {
},
error: function (jqXHR, textStatus, errorThrown) {
$('.confirm').show()
$('.confirm>div p').html(jqXHR.msg)
}
})
}
})
//333333333333333333发送注册请求
$('.register').click(function () {
if (!myreg.test($('.phone').val())) {
$('.confirm').show()
$('.confirm>div p').html("请输入正确的手机号")
$('.phone').val('')
} else if ($('.pass1').val() != $('.pass2').val()) {
$('.confirm').show()
$('.confirm>div p').html("两次输入密码不一致,请重新输入")
$('.pass1').val('')
$('.pass2').val('')
} else if ($('.pass1').val() == "" || $('.pass2').val() == "" || $('.phone').val() ==
"" || $('.code').val() == "") {
$('.confirm').show()
$('.confirm>div p').html("请填写完整的信息")
} else {
//ajax请求
$.submit({
type: "post",
url: "invitation/reg",
data:{
invitationCode : invitationCode,
},
func: function (res) {
},
error: function (jqXHR, textStatus, errorThrown) {
$('.confirm').show()
$('.confirm>div p').html(jqXHR.msg)
}
})
}
})
$(".confirm>div a").click(function(){
$('.confirm').hide()
})
//4444444444444444444验证码倒计时
function invokeSettime(obj) {
var countdown = 60;
settime(obj);
function settime(obj) {
if (countdown == 0) {
$(obj).attr("disabled", false);
$(obj).css('color', '#2cb38a');
$(obj).text("获取验证码");
countdown = 60;
return;
} else {
$(obj).attr("disabled", true);
$(obj).css('color', '#dedede');
$(obj).text(" 重发(" + countdown + ")");
countdown--;
}
setTimeout(function () {
settime(obj)
}, 1000)
}
}
})
</script>
</body>
</html>