Files
SIPAIIS_WMS_JSSW/WebRoot/jsp/user/improveUserInformation.jsp
2026-01-16 14:13:44 +08:00

202 lines
8.9 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"%>
<%-- <% request.setAttribute("VisitWeChatLogin", CommString.VisitWeChatLogin); %> --%>
<!DOCTYPE html>
<!-- <html lang="zh-CN"> -->
<!-- BEGIN HEAD -->
<head>
<title><%= ServerObject.atttable.get("TOPTITLE")%></title>
<!-- 引用页头及CSS页-->
<script src="JS/module/login/login.js" type="text/javascript"></script>
<jsp:include page="/jsp/inc.jsp"></jsp:include>
<script type="text/javascript">
var doupdate = function() {
$("#subForm").bootstrapValidator('validate');//提交验证
$('#registerbut').attr('disabled',"true");
setTimeout(function(){
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
$.post(ext.contextPath + "/user/updateUserInformation.do", $("#subForm").serialize(), function(data) {
if (data.res == 1) {
showAlert('s','注册成功,系统即将自动登录...');
$('#registerbut').attr('disabled',"true");
var wechatid = '${user.wechatid}';
var url=ext.contextPath+"/j_spring_security_check";
$.post(url , {weChatId:wechatid}, function(result) {
location.replace(ext.contextPath);
},'json');
}else if(data.res == 0){
showAlert('d','注册失败');
}else{
showAlert('d',data.res);
}
},'json');
}
$('#registerbut').removeAttr("disabled");
}, 500);
};
$(function() {
var result = '${result}';
if(result=='1'){
$("#successed").attr("style","display:none;");//隐藏div
}else if(result=='0'){
$("#successful").attr("style","display:none;");//隐藏div
}
$("#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()
};
}
},
}
},
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 dologin = function(){
var wechatid = '${user.wechatid}';
var url=ext.contextPath+"/j_spring_security_check";
$.post(url , {weChatId:wechatid}, function(result) {
location.replace(ext.contextPath);
},'json');
};
//发送验证码
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 href="../../index2.html"><b>运维平台</b></a>
</div>
</div>
<!-- 账号已存在 -->
<div class="register-box-body" id="successed">
<p class="login-box-msg">你的微信授权账户已经被注册过</p>
<p class="login-box-msg">是否直接授权登录</p>
<button type="button" class="btn btn-primary btn-block btn-flat" onclick="dologin();">授权登录</button>
</div>
<!--首次注册,完善信息 -->
<div class="register-box-body" id="successful">
<p class="login-box-msg">已授权成功</p>
<p class="login-box-msg">请继续完善你的个人信息</p>
<form id ="subForm">
<div id="alertDiv"></div>
<input id ="id" name="id" type="hidden" value="${user.id}"/>
<input id ="wechatid" name="wechatid" type="hidden" value="${user.wechatid}"/>
<input id ="sex" name="sex" type="hidden" value="${user.sex}"/>
<input id ="pid" name="pid" type="hidden" value="${user.pid}"/>
<div class="form-group has-feedback">
<input type="text" class="form-control" id="caption" 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>
<br>
<div class="row">
<div class="col-xs-4 pull-right">
<button type="button" id='registerbut' class="btn btn-primary btn-block btn-flat" onclick="doupdate();">保存</button>
</div>
<!-- /.col -->
</div>
</form>
<text class="text-center">保存后,将自动登录系统</text><br>
<text class="text-center">初始用户名为手机号,密码为123456<br>登录后请尽快修改个人密码</text>
</div>
<!-- /.form-box -->
</div>
<!-- /.register-box -->
</body>
</html>