| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246 |
- <!DOCTYPE HTML>
- <html xmlns:th="http://www.thymeleaf.org"
- xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
- layout:decorate="~{admin/common/common}">
- <head>
- <title>完善信息</title>
- <style>
- label.error {
- left: 15px;
- top: 29px
- }
- .ke-container {
- width: 100% !important;
- }
- .ke-swfupload-body {
- height: 265px
- }
- .ke-dialog-body {
- height: 340px !important;
- }
- .ke-dialog-default {
- height: 410px !important;
- }
- </style>
- </head>
- <body layout:fragment="content">
- <article class="page-container">
- <form class="form form-horizontal" id="form-information-add">
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>姓名:</label>
- <div class="formControls col-xs-8 col-sm-3">
- <div class="add_contact">
- <p><input type="text" required minlength="1" maxlength="45" class="width_200 input-text user_name"
- placeholder="请输入联系人姓名" th:name="user_name" th:value="${user.user_name}"/></p>
- </div>
- </div>
- </div>
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>账号名:</label>
- <div class="formControls col-xs-8 col-sm-3">
- <div class="add_contact">
- <p><input type="text" required class="ml_50 width_200 input-text nick_name" th:name="nick_name" th:id="nick_name"
- th:value="${user.nick_name}" placeholder="账户名可以为组织机构代码等"/></p>
- </div>
- </div>
- </div>
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>手机号:</label>
- <div class="formControls col-xs-8 col-sm-3">
- <div class="add_contact">
- <p><input type="text" required isMobile="true" class="ml_50 width_200 input-text phone"
- placeholder="请输入手机号" th:name="phone" th:id="phone" th:value="${user.phone}"/></p>
- <input id="verificationCode" onClick="getVerificationCode()" type="button"
- class="btn btn-primary radius" value="获取验证码"/>
- </div>
- </div>
- </div>
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>验证码:</label>
- <div class="formControls col-xs-8 col-sm-3">
- <div class="add_contact">
- <p><input type="text" required class="ml_50 width_200 input-text" th:name="validateNum"
- placeholder="请输入短信验证码"/></p>
- </div>
- </div>
- </div>
- <input type="text" required class="ml_50 width_200 input-text" th:name="user_id" th:id="user_id" hidden th:value="${user.id}"/>
- <!-- 企业信息 ------------------------------------------- 结束 -->
- <div class="row cl">
- <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
- <button class="btn btn-primary radius" type="submit">确定</button>
- <button onClick="removeIframe();" class="btn btn-default radius" type="button"> 取消 </button>
- </div>
- </div>
- </form>
- </article>
- <script th:inline="javascript">
- /**
- * 取消
- */
- function removeIframe() {
- var index = parent.layer.getFrameIndex(window.name);
- parent.layer.close(index);
- }
- //获取验证码
- function getVerificationCode() {
- var phone = $("#phone").val();
- var v_regex = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
- if (phone) {
- if (v_regex.test(phone)) {
- //checkPhoneNumber(phone)
- startCountDown();
- sendVerificationCode(phone);
- } else {
- errorMessage('手机号码格式不正确!');
- }
- } else {
- errorMessage('请输入手机号码!');
- }
- }
- //校验手机号码是否已被使用
- function checkPhoneNumber(phone) {
- $.ajax({
- dataType: "json",
- contentType: "application/json;charset=utf-8",
- url: pagePath + "/company/companyInfoManage/getPhone",
- type: "get",
- sync: true,
- data: {
- phone: phone
- },
- success: function (result) {
- if (result) {
- sendVerificationCode(phone);
- } else {
- errorMessage('该手机号码已被注册!');
- }
- },
- error: function () {
- errorMessage('系统错误!');
- }
- });
- }
- //发送验证码
- function sendVerificationCode(phone) {
- $.ajax({
- contentType: "application/json;charset=utf-8",
- dataType: "json",
- url: pagePath + "/home/sendVerificationCode",
- type: "get",
- sync: true,
- data: {
- phone: phone
- },
- success: function (result) {
- if (result.success) {
- succeedMessage(result.message);
- //startCountDown();
- } else {
- errorMessage(result.message);
- }
- },
- error: function () {
- errorMessage('系统错误!');
- }
- });
- }
- //验证码倒计时
- function startCountDown() {
- var second = 60;//时间默认值
- $("#verificationCode").attr("disabled", true);
- var timer = null;
- timer = setInterval(function () {
- $("#verificationCode").val(second + "秒后重发")
- second--;
- if (second < 0) {
- $("#verificationCode").attr("disabled", false);
- $("#verificationCode").val("获取验证码")
- clearInterval(timer);
- }
- }, 1000);
- }
- //保存信息
- $("#form-information-add").validate({
- rules: {
- nick_name: {
- minlength: 1,
- maxlength: 60,
- remote: {
- url: pagePath + "/company/companyInfoManage/getNickName",
- type: "get",
- data: {
- nick_name: function () {
- return $("#nick_name").val();
- },
- id: function () {
- return $("#user_id").val();
- },
- }
- },
- },
- user_name: {
- minlength: 1,
- maxlength: 20
- },
- phone: {
- minlength: 1,
- maxlength: 20,
- phone: true
- },
- validateNum: {
- minlength: 1,
- maxlength: 20
- },
- },
- messages: {
- nick_name: {
- remote: "该账号名已被注册!"
- },
- },
- //debug:true,
- onkeyup: false,
- focusCleanup: true,
- success: "valid",
- submitHandler: function (form) {
- $(form).ajaxSubmit({
- type: 'post',
- url: pagePath + "/home/complete",
- dataType: "json",
- success: function (data) {
- if (data.success) {
- succeedMessage(data.message);
- setTimeClose();
- } else {
- // $(form).find(":submit").attr("disabled", false);
- errorMessage(data.message);
- }
- },
- error: function () {
- errorMessage('系统错误!');
- }
- });
- return false; // 非常重要,如果是false,则表明是不跳转,在本页上处理,也就是ajax,如果是非false,则传统的form跳转。
- }
- });
- </script>
- </body>
- </html>
|