123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
- <meta http-equiv="x-ua-compatible" content="ie=edge">
- <title>用户注册-大司空云计价</title>
- <link rel="stylesheet" href="/lib/bootstrap/css/bootstrap.min.css">
- <link rel="stylesheet" href="/web/building_saas/css/main.css">
- <link rel="stylesheet" href="/lib/font-awesome/font-awesome.min.css">
- <link rel="shortcut icon" href="/web/building_saas/css/favicon.ico">
- <style>
- html{height:100%;}
- </style>
- </head>
- <body class="login-body">
- <div class="container">
- <form class="form-signin mt-5" method="post" onsubmit="return checkForm();">
- <h1 class="d-flex justify-content-center mb-0"><img src="/web/building_saas/img/building.png" width="40" height="40" class="mr-3" style="margin-top:5px"> 大司空云计价</h1>
- <p class="text-center mb-4 text-muted">市政、房建、轨道、管廊管线等专业工程计价软件</p>
- <p class="h3 text-center mb-3" id="tips">用户注册</p>
- <div class="form-group">
- <input id="mobile" name="mobile" class="form-control" type="number" placeholder="输入手机号" required="">
- <small id="mobiletips" style="display: none" class="form-text text-danger">手机号格式不对</small>
- <!-- <small id="e" class="form-text text-danger alert alert-danger">手机号已注册</small> -->
- </div>
- <div class="form-group">
- <button type="button" class="btn btn-outline-primary btn-block" id="get-code">获取验证码</button>
- </div>
- <div class="form-group">
- <input id="code" name="code" class="form-control " placeholder="输入验证码" required="" type="number">
- </div>
- <div class="form-group" id="error-tips" <% if (err === '') { %>style="display: none;"<% } %>>
- <div class="alert alert-danger" role="alert">
- <strong>失败</strong> <span id="message"><%= err %></span>
- </div>
- </div>
- <div class="form-group">
- <button type="button" id="check-user" class="btn btn-primary btn-block">确认</button>
- </div>
- <div id="msg" style="display: none">
- <hr>
- <input id="type" name="type" type="hidden">
- <div class="form-group">
- <input id="password" disabled name="password" class="form-control " placeholder="输入您的密码" required="" type="password">
- <small id="pwd-tips" style="display: none" class="form-text text-danger">密码长度为6~16位,建议使用数字与英文混合</small>
- </div>
- <div class="form-group">
- <select id="province" name="province" class="form-control ">
- <option value="-1">企业所在地区</option>
- <% provinceList.forEach(function(province, index) {%>
- <option value="<%= index %>"><%= province %></option>
- <% })%>
- </select>
- <small id="province-tips" style="display: none" class="form-text text-danger">请选择企业地区</small>
- </div>
- <div class="form-group">
- <input id="company" disabled name="company" class="form-control " placeholder="输入单位信息" required="" type="text">
- <small id="company-tips" style="display: none" class="form-text text-danger">请输入单位信息</small>
- </div>
- <div class="form-group">
- <input id="realname" disabled name="real_name" class="form-control " placeholder="输入您的姓名" required="" type="text">
- <small id="name-tips" style="display: none" class="form-text text-danger">姓名存在特殊字符或空格</small>
- </div>
- <div class="form-group">
- <input id="qq" disabled name="qq" class="form-control " placeholder="输入您的QQ号" required="" type="text">
- <small id="qq-tips" style="display: none" class="form-text text-danger">请输入正确的QQ号码</small>
- </div>
- <div class="form-group">
- <button type="submit" class="btn btn-primary btn-block">注册</button>
- </div>
- </div>
- <div class="form-group mt-5">
- <a href="/wap/checkuser" class="btn btn-success btn-block">查询注册状态</a>
- </div>
- </form>
- <!-- <div class="text-white fixed-bottom"><p class="text-center mb-1">Copyright © 2019 <a href="https://smartcost.com.cn" target="_blank" class="text-white">珠海纵横创新软件有限公司</a>.All Rights Reserved.<a class="text-white ml-2" href="http://www.miitbeian.gov.cn" target="_blank">粤ICP备14032472号</a></p></div> -->
- </div>
- <!-- JS. -->
- <script src="/lib/jquery/jquery-3.2.1.min.js"></script>
- <script src="/lib/popper/popper.min.js"></script>
- <script src="/lib/bootstrap/bootstrap.min.js"></script>
- <script src="/web/building_saas/js/global.js"></script>
- <script type="text/javascript" src="/web/users/js/gt.js"></script>
- <script>
- $(function () {
- $("#get-code").click(function() {
- $('#mobiletips').hide();
- const mobile = $("#mobile").val();
- if(!validMobile(mobile)){
- return false;
- }
- const btn = $(this);
- if(!btn.hasClass('disabled')){
- $.ajax({
- url: '/sms/code',
- type: 'post',
- data: { mobile: mobile, type: 3},
- error: function() {
- $('#mobiletips').text('短信接口出错!').show();
- },
- beforeSend: function() {
- },
- success: function(response) {
- if (response.err === 0) {
- codeSuccess(btn);
- } else {
- $('#mobiletips').text(response.msg).show();
- }
- }
- });
- }
- });
- $('#check-user').click(function () {
- const mobile = $("#mobile").val();
- const code = $('#code').val();
- $("#error-tips").hide();
- $('#mobiletips').hide();
- if(!validMobile(mobile)){
- return false;
- }
- if(code === '') {
- return false;
- }
- $.ajax({
- type: 'post',
- url: '/wap/checkuser',
- async: false,
- data: { mobile: mobile, code: code },
- dataType: 'json',
- success: function (result) {
- if (result.error === 0) {
- if (result.existUser === 1) {
- window.location.href = '/wap/checkuser?mobile=' + mobile;
- } else {
- // $('#mobiletips').text('当前手机号未注册').show();
- $('#mobile').attr('readOnly', true);
- // $('#tips').text('用户注册');
- $('#msg').show();
- $('#msg input').removeAttr('disabled');
- // $('#check-user').parents('div').addClass('mt-5');
- // $('#check-user').siblings('a').show();
- $('#check-user').remove();
- $('#code').parents('.form-group').remove();
- $('#get-code').parents('.form-group').remove();
- if (result.existUser === 2) {
- $('#password').parents('.form-group').remove();
- $('#type').val(2); // 代表sso已有账号
- } else {
- $('#type').val(1); // 代表同时注册sso
- }
- }
- } else {
- showError(result.msg, null);
- }
- }
- })
- })
- });
- /**
- * 获取成功后的操作
- *
- * @param {Object} btn - 点击的按钮
- * @return {void}
- */
- function codeSuccess(btn) {
- let counter = 60;
- btn.removeClass('btn-primary').addClass('btn-outline-secondary disabled').text('重新获取('+ counter +')');
- btn.parents().siblings('div').children('input').removeAttr('readonly');
- const countDown = setInterval(function() {
- const countString = counter - 1 <= 0 ? '' : counter - 1;
- // 倒数结束后
- if (countString === '') {
- clearInterval(countDown);
- btn.removeClass('btn-outline-secondary disabled').addClass('btn-primary').text('获取验证码');
- }
- const text = '重新获取' + (countString === '' ? '' : '('+ countString +')');
- btn.text(text);
- counter -= 1;
- }, 1000);
- }
- /**
- * 提示错误
- *
- * @param {string} msg
- * @param {object} element
- * @return {void}
- */
- function showError(msg, element) {
- if (element !== null) {
- element.parent().addClass('has-danger');
- }
- $("#message").html(msg);
- $("#error-tips").show("fast");
- }
- /**
- * 提示错误
- *
- * @param {string} msg
- * @param {object} element
- * @return {void}
- */
- function showError2(msg, element) {
- if (element !== null) {
- element.parent().addClass('has-danger');
- }
- $("#message2").html(msg);
- $("#error-tips2").show("fast");
- }
- /**
- * 验证手机号是否正确
- *
- * @return {boolean}
- */
- function validMobile(mobile, status = 1) {
- let result = true;
- if($.trim(mobile) === ''){
- $('#mobiletips').text('手机号不能为空').show();
- return false;
- }
- let mobileValid = /^1[3456789]\d{9}$/;
- if(!mobileValid.test(mobile)){
- $('#mobiletips').text('手机号码格式有误!').show();
- return false;
- }
- return result;
- }
- function checkForm() {
- let flag = true;
- if (parseInt($('#type').val()) === 1) {
- $('#pwd-tips').hide();
- const pwd = $('#password').val();
- if (pwd.length < 6 || pwd.length > 16) {
- flag = false;
- $('#pwd-tips').show();
- }
- }
- $('#province-tips').hide();
- $('#company-tips').hide();
- $('#name-tips').hide();
- $('#qq-tips').hide();
- const province = parseInt($('#province').val());
- if (province === -1) {
- flag = false;
- $('#province-tips').show();
- }
- const company = $('#company').val();
- if (company === '') {
- flag = false;
- $('#company-tips').show();
- }
- const realname = $('#realname').val();
- const pattern2 = /^[A-Za-z0-9\u4e00-\u9fa5]+$/gi;
- if (!pattern2.test(realname) && realname != '') {
- flag = false;
- $('#name-tips').show();
- }
- const qq = $('#qq').val();
- const pattern = /^[1-9][0-9]{4,14}$/;
- if(!pattern.test(qq) && qq !== ''){
- flag = false;
- $('#qq-tips').show();
- }
- if (flag) {
- $('button[type="submit"]').text('注册中,请勿退出...').attr('disabled', true);
- }
- return flag;
- }
- </script>
- </body>
- </html>
|