Files
SIPAIIS_WMS_JSSW/src/main/webapp/jsp/register.jsp
2026-01-16 14:13:44 +08:00

223 lines
9.4 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<%@page import="com.sipai.tools.CommString"%>
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ page import="com.sipai.entity.base.ServerObject"%>
<%@ taglib uri="http://www.springsecurity.org/jsp" prefix="security"%>
<!DOCTYPE html>
<!-- <html lang="zh-CN"> -->
<!-- BEGIN HEAD -->
<head>
<title><%= ServerObject.atttable.get("TOPTITLE")%></title>
<!-- 引用页头及CSS页-->
<jsp:include page="/jsp/inc.jsp"></jsp:include>
<script type="text/javascript">
var doregister = function() {
$("#subForm").bootstrapValidator('validate');//提交验证
$('#registerbut').attr('disabled',"true");
setTimeout(function(){
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
$.post(ext.contextPath + "/user/saveRegisterUser.do", $("#subForm").serialize(), function(data) {
if (data.res == 1) {
showAlert('s','注册成功,系统即将跳转...');
$('#registerbut').attr('disabled',"true");
setTimeout(function() {location.replace(ext.contextPath);},2000);
}else if(data.res == 0){
showAlert('d','注册失败');
}else{
showAlert('d',data.res);
}
},'json');
}
$('#registerbut').removeAttr("disabled");
}, 500);
};
$(function() {
//微信授权注册
var companyid=$('#pid').val();
//console.info(companyid);
$("#btn_wechat").attr('href','http://wx.sipaiis.com/wxAuth/wxLogin?systemFlag=SIPAIIS_WMS'+'&companyid='+companyid);
//输入框验证
$("#subForm").bootstrapValidator({
live: 'disabled',//验证时机enabled是内容有变化就验证默认disabled和submitted是提交再验证
fields: {
caption: {
validators: {
notEmpty: {
message: '用户名不能为空'
}
}
},
mobile: {
validators: {
notEmpty: {
message: '手机号不能为空'
},
stringLength: {//检测长度
min: 11,
max: 11,
message: '请输入中国大陆11位手机号'
},
remote: {//ajax验证。server result:{"valid",true or false} 向服务发送当前input name值获得一个json数据。例表示正确{"valid",true}
url: ext.contextPath + '/user/checkExist.do',//验证地址
message: '手机号已存在',//提示消息
type: 'POST',//请求方式
data: function(validator) {
return {
mobile: $('#mobile').val()
};
}
},
}
},
password: {
validators: {
notEmpty: {
message: '密码不能为空'
}
}
},
repassword: {
validators: {
notEmpty: {
message: '重新输入密码为空'
},
identical: {
field: 'password',
message: '密码不一致'
},
}
},
verificationcode: {
validators: {
notEmpty: {
message: '验证码不能为空'
},
stringLength: {//检测长度
min: 6,
max: 6,
message: '请输入6位验证码'
},
remote: {//ajax验证。server result:{"valid",true or false} 向服务发送当前input name值获得一个json数据。例表示正确{"valid",true}
url: ext.contextPath + '/user/checkVerificationCode.do',//验证地址
message: '验证码不正确',//提示消息
type: 'POST',//请求方式
data: function(validator) {
return {
mobile: $('#mobile').val(),
verificationcode: $('#verificationcode').val()
};
}
},
}
},
}
});
});
//发送验证码
var sendVerificationCode = function(){
//验证手机号码
$("#subForm").data("bootstrapValidator").validateField("mobile");
//延迟加载避免出现手机号第一次验证全为false现象
setTimeout(function(){
if($("#subForm").data("bootstrapValidator").isValidField("mobile")){
//验证码倒计时,发送验证码按钮不可用
$("#sendButton").attr("disabled","true");
$("#sendButton").html('重新发送<b id="countdown">(60s)</b>');
var countdown = document.getElementById("countdown");
var i = 60;
var timer = setInterval(function(){
i--;
countdown.innerHTML = "("+i+"s)";
if(i==0){
$("#sendButton").removeAttr("disabled");
$("#sendButton").html("发送验证码");
}
},1000);
$.post(ext.contextPath + "/user/sendVerificationCode.do", {mobile:$("#mobile").val()}, function(data) {
/* if (data.result == "true") {
}else if(data.result == "false"){
} */
},'json');
}
}, 200);
}
</script>
</head>
<body class="hold-transition register-page">
<div class="register-box">
<div class="register-logo">
<a ><b>运维平台</b></a>
</div>
<div class="register-box-body">
<p class="login-box-msg">${unit.name}-注册</p>
<form id ="subForm">
<div id="alertDiv"></div>
<input id ="pid" name="pid" type="hidden" value="${unit.id}"/>
<div class="form-group has-feedback">
<input type="text" class="form-control" name="caption" placeholder="姓名">
<span class="glyphicon glyphicon-user form-control-feedback"></span>
</div>
<div class="form-group has-feedback">
<input type="tel" class="form-control" id ="mobile" name="mobile" placeholder="手机">
<span class="glyphicon glyphicon-earphone form-control-feedback"></span>
</div>
<div class="form-group ">
<div class="input-group">
<input type="text" class="form-control" id ="verificationcode" name="verificationcode" placeholder="验证码">
<span class="input-group-btn">
<button type="button" id="sendButton" class="btn btn-info btn-flat" onclick="sendVerificationCode();">发送验证码</button>
</span>
</div>
</div>
<div class="form-group has-feedback">
<input type="password" class="form-control" name ="password" placeholder="密码">
<span class="glyphicon glyphicon-lock form-control-feedback"></span>
</div>
<div class="form-group has-feedback">
<input type="password" class="form-control" name="repassword" placeholder="重新输入密码">
<span class="glyphicon glyphicon-log-in form-control-feedback"></span>
</div>
<div class="row">
<!-- <div class="col-xs-8">
<div class="checkbox icheck">
<label>
<input type="checkbox"> I agree to the <a href="#">terms</a>
</label>
</div>
</div> -->
<!-- /.col -->
<div class="col-xs-4 pull-left">
<a type="button" id="btn_wechat" class="btn bg-green btn-flat pull-left" ><i class="fa fa-weixin"></i> 微信授权</a>
</div>
<div class="col-xs-4 pull-right">
<button type="button" id='registerbut' class="btn btn-primary btn-flat pull-right" onclick="doregister();"><i class="fa fa-mobile-phone"></i> 手机注册</button>
</div>
<!-- /.col -->
</div>
</form>
<!-- <div class="social-auth-links text-center">
<p>- OR -</p>
<a href="#" class="btn btn-block btn-social btn-facebook btn-flat"><i class="fa fa-facebook"></i> Sign up using
Facebook</a>
<a href="#" class="btn btn-block btn-social btn-google btn-flat"><i class="fa fa-google-plus"></i> Sign up using
Google+</a>
</div>-->
<br>
<text class="text-center">手机号注册后,请使用手机号登陆</text> <br>
<text class="text-center">微信授权注册后,可以使用微信授权登陆</text>
</div>
<!-- /.form-box -->
</div>
<!-- /.register-box -->
</body>
</html>