<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport"
content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
<title></title>
<link rel="stylesheet" href="${pageContext.request.contextPath }/css/style.css"/>
</head>
<body>
<header>
<%-- <img src="${pageContext.request.contextPath }/images/arrow-l.png" alt=""> --%>
<!-- <div class="login">
登录
</div> -->
<div class="title">
注册
</div>
</header>
<form id="oneForm">
<div class="reg">
<input type="hidden" id="info" value="${code}"/>
<div class="in-box">
<input type="text" placeholder="本人手机号" class="phone" id="tel" name="tel" value="15910717141">
</div>
<div class="in-box">
<input type="text" id="smsCode" name="smsCode" placeholder="短信验证码" class="code">
<span id="qw" οnclick="getSmsCode(this)" class="get">获取验证码</span>
</div>
<div style="text-align: center; ">
<input id="password3" name="smsCode" type="button" placeholder="重新发送" value="重新发送">
<input id="password3" name="smsCode" type="button" placeholder="获取验证码" value="获取验证码">
</div>
<div οnclick="goNext()" class="btn">
注册
</div>
</div>
</form>
</body>
<script type="text/javascript" src="${pageContext.request.contextPath }/js/jquery-1.11.3.min.js"></script>
<script src="${pageContext.request.contextPath }/js/mui.min.js"></script>
<script>
function changeCode(){
var now = new Date();
$("#codeImg").attr("src","${pageContext.request.contextPath }/share/randomCode.do?t="+now);
}
var wait;
function getSmsCode(yzm_btn) {
var phone = $("#tel").val();
if(phone==''){
alert("请输入手机号");
return;
}
var myreg = /^(1+\d{10})$/;
if( phone.length != 11){
alert("请输入正确手机号");
return;
}else if(!myreg.test(phone)) {
alert("请输入正确手机号");
return;
}
if($("#qw").text()!="获取验证码"){
return;
}
var randomCode = $("#randomCode").val();
//ajax提交到后台验证码处理的action
$.ajax({
type : "post",
data : {
"tel" : phone,"randomCode":randomCode
},
dataType: "json",
url : "${pageContext.request.contextPath}/register/sendMessageCode.do",
success : function(data) {
if (data.code == 0) {
alert(data.msg_cn);
} else {
changeCode();
wait = 60;
yzm_btn.disabled = false;
time(yzm_btn);
}
}
});
}
function time(o) {
if (wait == 0) {
o.removeAttribute("disabled");
o.innerHTML = "获取验证码";
wait = 60;
} else {
o.setAttribute("disabled", true);
o.innerHTML = wait + "秒后,获取";
wait--;
setTimeout(function(){
time(o);
}, 1000);
}
}
function goNext(){
var phone = $("#tel").val();
if(phone==''){
alert("请输入手机号");
return;
}
var myreg = /^(1+\d{10})$/;
if( phone.length != 11){
alert("请输入正确手机号");
return;
}else if(!myreg.test(phone)) {
alert("请输入正确手机号");
return;
}
var smsCode = $("#smsCode").val();
if(randomCode==null||randomCode==""){
alert("请输入短信验证码");
return;
}
$.ajax({
type : "post",
data : {
"tel" : phone,"randomCode":randomCode,"smsCode":smsCode,"parentCode":$("#parentCode").val()
},
dataType: "json",
url : "${pageContext.request.contextPath}/share/goTwo.do",
success : function(data) {
if (data.code == 0) {
alert(data.msg_cn);
} else {
window.location.href="${pageContext.request.contextPath}/share/theTwo.do";
}
}
});
}
</script>
</html>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport"
content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
<title></title>
<link rel="stylesheet" href="${pageContext.request.contextPath }/css/style.css"/>
</head>
<body>
<header>
<%-- <img src="${pageContext.request.contextPath }/images/arrow-l.png" alt=""> --%>
<!-- <div class="login">
登录
</div> -->
<div class="title">
注册
</div>
</header>
<form id="oneForm">
<div class="reg">
<input type="hidden" id="info" value="${code}"/>
<div class="in-box">
<input type="text" placeholder="本人手机号" class="phone" id="tel" name="tel" value="15910717141">
</div>
<div class="in-box">
<input type="text" id="smsCode" name="smsCode" placeholder="短信验证码" class="code">
<span id="qw" οnclick="getSmsCode(this)" class="get">获取验证码</span>
</div>
<div style="text-align: center; ">
<input id="password3" name="smsCode" type="button" placeholder="重新发送" value="重新发送">
<input id="password3" name="smsCode" type="button" placeholder="获取验证码" value="获取验证码">
</div>
<div οnclick="goNext()" class="btn">
注册
</div>
</div>
</form>
</body>
<script type="text/javascript" src="${pageContext.request.contextPath }/js/jquery-1.11.3.min.js"></script>
<script src="${pageContext.request.contextPath }/js/mui.min.js"></script>
<script>
function changeCode(){
var now = new Date();
$("#codeImg").attr("src","${pageContext.request.contextPath }/share/randomCode.do?t="+now);
}
var wait;
function getSmsCode(yzm_btn) {
var phone = $("#tel").val();
if(phone==''){
alert("请输入手机号");
return;
}
var myreg = /^(1+\d{10})$/;
if( phone.length != 11){
alert("请输入正确手机号");
return;
}else if(!myreg.test(phone)) {
alert("请输入正确手机号");
return;
}
if($("#qw").text()!="获取验证码"){
return;
}
var randomCode = $("#randomCode").val();
//ajax提交到后台验证码处理的action
$.ajax({
type : "post",
data : {
"tel" : phone,"randomCode":randomCode
},
dataType: "json",
url : "${pageContext.request.contextPath}/register/sendMessageCode.do",
success : function(data) {
if (data.code == 0) {
alert(data.msg_cn);
} else {
changeCode();
wait = 60;
yzm_btn.disabled = false;
time(yzm_btn);
}
}
});
}
function time(o) {
if (wait == 0) {
o.removeAttribute("disabled");
o.innerHTML = "获取验证码";
wait = 60;
} else {
o.setAttribute("disabled", true);
o.innerHTML = wait + "秒后,获取";
wait--;
setTimeout(function(){
time(o);
}, 1000);
}
}
function goNext(){
var phone = $("#tel").val();
if(phone==''){
alert("请输入手机号");
return;
}
var myreg = /^(1+\d{10})$/;
if( phone.length != 11){
alert("请输入正确手机号");
return;
}else if(!myreg.test(phone)) {
alert("请输入正确手机号");
return;
}
var smsCode = $("#smsCode").val();
if(randomCode==null||randomCode==""){
alert("请输入短信验证码");
return;
}
$.ajax({
type : "post",
data : {
"tel" : phone,"randomCode":randomCode,"smsCode":smsCode,"parentCode":$("#parentCode").val()
},
dataType: "json",
url : "${pageContext.request.contextPath}/share/goTwo.do",
success : function(data) {
if (data.code == 0) {
alert(data.msg_cn);
} else {
window.location.href="${pageContext.request.contextPath}/share/theTwo.do";
}
}
});
}
</script>
</html>