瀏覽代碼

提交StrUtil

sandm 2 年之前
父節點
當前提交
a4b3ece33f

+ 74 - 0
app/common/api/ChuanglanSmsApi.php

@@ -0,0 +1,74 @@
+<?php
+
+namespace app\common\api;
+
+class ChuanglanSmsApi{
+    //参数的配置请登录zz.253.com获取以下API信息↓↓↓↓↓↓↓
+    const API_SEND_URL='http://smssh1.253.com/msg/send/json'; //创蓝发送短信接口URL
+
+
+    const API_ACCOUNT = 'N7450217'; //创蓝API账号
+    const API_PASSWORD = 'wS5gE4GQszb46f';//创蓝API密码
+
+    private $verification;
+
+
+    /**
+     * 发送短信
+     *
+     * @param string $mobile 		手机号码
+     * @param string $msg 			短信内容
+     * @param string $needstatus 	是否需要状态报告
+     */
+    public function sendSMS( $mobile, $msg, $needstatus = 'true') {
+
+        //创蓝接口参数
+        $postArr = array (
+            'account'  =>  self::API_ACCOUNT,
+            'password' => self::API_PASSWORD,
+            'msg' => urlencode($msg),
+            'phone' => $mobile,
+            'report' => $needstatus,
+        );
+        $result = $this->curlPost( self::API_SEND_URL, $postArr);
+        return $result;
+    }
+
+
+    /**
+     * 通过CURL发送HTTP请求
+     * @param string $url  //请求URL
+     * @param array $postFields //请求参数
+     * @return mixed
+     *
+     */
+    private function curlPost($url,$postFields){
+        $postFields = json_encode($postFields);
+        $ch = curl_init ();
+        curl_setopt( $ch, CURLOPT_URL, $url );
+        curl_setopt( $ch, CURLOPT_HTTPHEADER, array(
+                'Content-Type: application/json; charset=utf-8'   //json版本需要填写  Content-Type: application/json;
+            )
+        );
+        curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); //若果报错 name lookup timed out 报错时添加这一行代码
+        curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
+        curl_setopt( $ch, CURLOPT_POST, 1 );
+        curl_setopt( $ch, CURLOPT_POSTFIELDS, $postFields);
+        curl_setopt( $ch, CURLOPT_TIMEOUT,60);
+        curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0);
+        curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, 0);
+        $ret = curl_exec ( $ch );
+        if (false == $ret) {
+            $result = curl_error(  $ch);
+        } else {
+            $rsp = curl_getinfo( $ch, CURLINFO_HTTP_CODE);
+            if (200 != $rsp) {
+                $result = "请求状态 ". $rsp . " " . curl_error($ch);
+            } else {
+                $result = $ret;
+            }
+        }
+        curl_close ( $ch );
+        return $result;
+    }
+}

+ 53 - 0
app/common/controller/Api.php

@@ -0,0 +1,53 @@
+<?php
+namespace app\common\controller;
+
+use app\BaseController;
+use app\common\model\MessageRecord;
+use think\Facade\Cache;
+
+class Api extends BaseController
+{
+
+    public function register(){
+        $msg = "";
+        if($this->request->isPost()){
+
+        }
+        return view("", ["msg" => $msg]);
+    }
+
+    public function verificationCode()
+    {
+        $phone = $this->request["phone"];
+        $type = $this->request["type"];
+        //校验手机号码是否为空
+        if(\StrUtil::isEmpOrNull($phone)) {
+            return json(["msg" => "请填写手机号码!"],500);
+        }
+        if (\StrUtil::isEmpOrNull($type)) {
+            return json(["msg" => "请填写手机号码!"],500);
+        }
+        //校验手机号码格式是否正确
+        if(\StrUtil::isMoblePhone($phone)) {
+            return json(["msg" => "请填写正确的手机号码!"],500);
+        }
+
+        $record = Cache::get("verify_{$type}_{$phone}");
+
+        if($record){
+            $time = time();
+            if($time - $record <= 60){
+                return json(["msg" => "一分钟内请勿频繁发送短信!"],500);
+            }
+        }
+
+        $code = '';
+        for ($i = 1;$i <= 6;$i++){
+            $code .= rand(0,9);
+        }
+
+        $template = "【晋江市人才服务平台】尊敬的用户,您的短信验证码为{$code},5分钟内有效。若非本人操作请忽略。";
+
+
+    }
+}

+ 1 - 1
app/common/controller/Tool.php

@@ -14,7 +14,7 @@ use think\facade\Db;
  */
 class Tool extends BaseController {
 
-    protected $middleware = [Auth::class];
+    //protected $middleware = [Auth::class];
 
     public function findChildDictBatch() {
         $result = [];

+ 16 - 0
app/common/model/MessageRecord.php

@@ -0,0 +1,16 @@
+<?php
+
+namespace app\common\model;
+
+use think\Model;
+
+/**
+ * Description of Batch
+ *
+ * @author sgq
+ */
+class MessageRecord extends Model {
+
+    protected $table = "new_message_record";
+
+}

+ 238 - 0
app/common/view/api/register.html

@@ -0,0 +1,238 @@
+{extend name="layout/content" /}
+{block name="content"}
+<style type="text/css">
+    .spacing {
+        margin-bottom: 10px;
+        padding-right:4px;
+        padding-left: 4px;
+    }
+</style>
+<div class="ibox float-e-margins">
+    <div class="ibox-content">
+        <div class="form-horizontal">
+            <div class="row">
+                <div class="col-sm-12">
+                    <div class="tabs-container">
+                        <ul class="nav nav-tabs">
+                            <li class="active" regType="en" id="enTab"><a data-toggle="tab" href="#tab-1" aria-expanded="true">机构用户注册</a></li>
+                            <li class="" regType="ps" id="personTab" ><a data-toggle="tab" href="#tab-2"   aria-expanded="false">个人用户注册</a></li>
+                        </ul>
+                        <div class="tab-content">
+                            <div id="tab-1" class="tab-pane active">
+                                <br/>
+                                <form id="ep_form" action="${ctxPath}/api/enterpriseUser/register" method="post" class="form-horizontal" enctype="multipart/form-data" target="hiddenIframe">
+                                    <div class="col-sm-12 form-group-sm">
+                                        <input type="hidden" id="source" name="source" value="1">
+                                        <div class="row">
+                                            <div class="rowGroup"  >
+                                                <label class="col-sm-2 control-label spacing"><span class="text-danger">*</span>账号</label>
+                                                <div class="col-sm-4 spacing">
+                                                    <input type="text" autocomplete="off" class="form-control" id="username" name="username" placeholder="请填写账号,用于登陆" />
+                                                </div>
+                                            </div>
+                                            <div class="rowGroup" >
+                                                <label class="col-sm-2 control-label spacing"><span class="text-danger">*</span>密码</label>
+                                                <div class="col-sm-4 spacing">
+                                                    <input type="password" autocomplete="off" class="form-control" id="password" name="password" placeholder="密码由字母、数字及特殊字符组成且字符个数为8-20"/>
+                                                </div>
+                                            </div>
+                                            <div class="rowGroup"  >
+                                                <label class="col-sm-2 control-label spacing"><span class="text-danger">*</span>重复密码</label>
+                                                <div class="col-sm-4 spacing">
+                                                    <input autocomplete="off" type="password" class="form-control" id="re_password" name="re_password" placeholder="密码由字母、数字及特殊字符组成且字符个数为8-20""/>
+                                                </div>
+                                            </div>
+                                            <div class="rowGroup"  >
+                                                <label class="col-sm-2 control-label spacing"><span class="text-danger">*</span>单位名称</label>
+                                                <div class="col-sm-4 spacing">
+                                                    <input autocomplete="off" type="text" class="form-control" id="name" name="name" />
+                                                </div>
+                                            </div>
+                                            <div class="rowGroup"  >
+                                                <label class="col-sm-2 control-label spacing"><span class="text-danger">*</span>社会信用代码</label>
+                                                <div class="col-sm-4 spacing">
+                                                    <input autocomplete="off" type="text" class="form-control" id="idCard" name="idCard" />
+                                                </div>
+                                            </div>
+                                            <div class="rowGroup" >
+                                                <label class="col-sm-2 control-label spacing"><span class="text-danger">*</span>申报类型</label>
+                                                <div class="col-sm-4 spacing">
+                                                    <select class="form-control" id="type" name="type" onchange="Register.typeChange()">
+                                                        <option value="">请选择</option>
+                                                        <option value="1">晋江市优秀人才</option>
+                                                        <option value="2">集成电路优秀人才</option>
+                                                        <!--	<option value="3">海峡计划团队</option>  -->
+                                                    </select>
+                                                </div>
+                                            </div>
+                                            <div class="rowGroup"  style="display: none">
+                                                <label class="col-sm-2 control-label spacing"><span class="text-danger">*</span>行业领域</label>
+                                                <div class="col-sm-4 spacing">
+                                                    <select autocomplete="off" type="text" class="form-control" id="industryField" name="industryField"></select>
+                                                </div>
+                                            </div>
+                                            <div class="rowGroup"  style="display: none">
+                                                <label class="col-sm-2 control-label spacing"><span class="text-danger">*</span>企业标签</label>
+                                                <div class="col-sm-4 spacing">
+                                                    <select class="form-control" id="talentType" name="talentType">
+                                                    </select>
+                                                </div>
+                                            </div>
+                                            <div class="rowGroup" >
+                                                <label class="col-sm-2 control-label spacing"><span class="text-danger">*</span>经办人</label>
+                                                <div class="col-sm-4 spacing">
+                                                    <input autocomplete="off" type="text" class="form-control" id="agentName" name="agentName" />
+                                                </div>
+                                            </div>
+                                            <div class="rowGroup form-inline" >
+                                                <label class="col-sm-2 control-label spacing"><span class="text-danger">*</span>经办人手机号</label>
+                                                <div class="col-sm-4 spacing">
+                                                    <input autocomplete="off" type="text" class="form-control" id="agentPhone" name="agentPhone"  style="width: 60%" />
+                                                    <button id="enterprise_sms_btn" style="margin-bottom: 0px;" onclick="Register.getEnterpriseSms()" type="button" class="btn btn-xs btn-info" style="width: 38%">获取验证码</button>
+                                                </div>
+                                            </div>
+                                            <div class="rowGroup"  >
+                                                <label class="col-sm-2 control-label spacing"><span class="text-danger">*</span>手机验证码</label>
+                                                <div class="col-sm-4 spacing">
+                                                    <input autocomplete="off" type="text" class="form-control" id="verificationCode" name="verificationCode" />
+                                                </div>
+                                            </div>
+                                            <div class="rowGroup"  >
+                                                <label class="col-sm-2 control-label spacing"><span class="text-danger">*</span>法人代表</label>
+                                                <div class="col-sm-4 spacing">
+                                                    <input autocomplete="off" type="text" class="form-control" id="legal" name="legal" />
+                                                </div>
+                                            </div>
+                                            <div class="rowGroup"  >
+                                                <label class="col-sm-2 control-label spacing"><span class="text-danger">*</span>所属街道</label>
+                                                <div class="col-sm-4 spacing">
+                                                    <select class="form-control" id="street" name="street"></select>
+                                                </div>
+                                            </div>
+                                            <div class="rowGroup" >
+                                                <label class="col-sm-2 control-label spacing"><span class="text-danger">*</span>单位地址</label>
+                                                <div class="col-sm-4 spacing">
+                                                    <input autocomplete="off" type="text" class="form-control" id="address" name="address" />
+                                                </div>
+                                            </div>
+                                            <div class="rowGroup" >
+                                                <label class="col-sm-2 control-label spacing"><span class="text-danger">*</span>单位电话</label>
+                                                <div class="col-sm-4 spacing">
+                                                    <input autocomplete="off" type="text" class="form-control" id="ephone" name="ephone" />
+                                                </div>
+                                            </div>
+                                            <div class="rowGroup"  >
+                                                <label class="col-sm-2 control-label spacing"><span class="text-danger">*</span>电子邮箱</label>
+                                                <div class="col-sm-4 spacing">
+                                                    <input autocomplete="off" type="text" class="form-control" id="agentEmail" name="agentEmail" />
+                                                </div>
+                                            </div>
+                                            <div class="rowGroup"  >
+                                                <label class="col-sm-2 control-label spacing"><span class="text-danger">*</span>营业执照照片</label>
+                                                <div class="col-sm-4 spacing">
+                                                    <img id="photoImg" src="${ctxPath}/static/img/yyzz.png" style="height: 60px;" onclick="$('#imgurl').click()" >
+                                                    <input style="display: none" autocomplete="off" type="file" class="form-control" id="imgurl" name="imgurl" />
+                                                </div>
+                                            </div>
+                                        </div>
+                                    </div>
+                                </form>
+                            </div>
+                            <div id="tab-2" class="tab-pane">
+                                <input type="hidden" id="ps_source"  value="1">
+                                <br/>
+                                <div class="row">
+                                    <div class="col-sm-6 b-r">
+                                        <div class="rowGroup"  style="margin-bottom: 0px;">
+                                            <label class="col-sm-3 control-label"><span class="text-danger">*</span>账号</label>
+                                            <div class="col-sm-9">
+                                                <input type="text" autocomplete="off" class="form-control" id="ps_username" placeholder="请填写账号,用于登陆" />
+                                            </div>
+                                        </div>
+                                    </div>
+                                    <div class="col-sm-6 b-r">
+                                        <div class="rowGroup"  style="margin-bottom: 0px;">
+                                            <label class="col-sm-3 control-label"><span class="text-danger">*</span>密码</label>
+                                            <div class="col-sm-9">
+                                                <input type="password" autocomplete="off" class="form-control" id="ps_password" />
+                                            </div>
+                                        </div>
+                                    </div>
+                                </div>
+                                <div class="hr-line-dashed"></div>
+                                <div class="row">
+                                    <div class="col-sm-6 b-r">
+                                        <div class="rowGroup"  style="margin-bottom: 0px;">
+                                            <label class="col-sm-3 control-label"><span class="text-danger">*</span>重复密码</label>
+                                            <div class="col-sm-9">
+                                                <input type="password" autocomplete="off" class="form-control" id="ps_re_password" />
+                                            </div>
+                                        </div>
+                                    </div>
+                                    <div class="col-sm-6 b-r">
+                                        <div class="rowGroup"  style="margin-bottom: 0px;">
+                                            <label class="col-sm-3 control-label"><span class="text-danger">*</span>姓名</label>
+                                            <div class="col-sm-9">
+                                                <input type="text" autocomplete="off" class="form-control" id="ps_name" />
+                                            </div>
+                                        </div>
+                                    </div>
+                                </div>
+                                <div class="hr-line-dashed"></div>
+                                <div class="row">
+                                    <div class="col-sm-6 b-r">
+                                        <div class="rowGroup"  style="margin-bottom: 0px;">
+                                            <label class="col-sm-3 control-label"><span class="text-danger">*</span>性别</label>
+                                            <div class="col-sm-9">
+                                                <select class="form-control" id="ps_sex">
+                                                    <option value="">--- 请选择 ---</option>
+                                                    <option value="1">男</option>
+                                                    <option value="2">女</option>
+                                                </select>
+                                            </div>
+                                        </div>
+                                    </div>
+                                    <div class="col-sm-6 b-r">
+                                        <div class="rowGroup"  style="margin-bottom: 0px;">
+                                            <label class="col-sm-3 control-label"><span class="text-danger">*</span>证件号码</label>
+                                            <div class="col-sm-9">
+                                                <input type="text" autocomplete="off" class="form-control" id="ps_idCard" />
+                                            </div>
+                                        </div>
+                                    </div>
+                                </div>
+                                <div class="hr-line-dashed"></div>
+                                <div class="row">
+                                    <div class="col-sm-6 b-r">
+                                        <div class="rowGroup"  style="margin-bottom: 0px;">
+                                            <label class="col-sm-3 control-label"><span class="text-danger">*</span>手机号</label>
+                                            <div class="col-sm-6">
+                                                <input type="text" autocomplete="off" class="form-control" id="ps_phone" />
+                                            </div>
+                                            <div class="col-sm-3">
+                                                <button id="ps_sms_btn" onclick="Register.getPersionSms()" type="button" class="btn btn-info">获取验证码</button>
+                                            </div>
+                                        </div>
+                                    </div>
+                                    <div class="col-sm-6 b-r">
+                                        <div class="rowGroup"  style="margin-bottom: 0px;">
+                                            <label class="col-sm-3 control-label"><span class="text-danger">*</span>手机验证码</label>
+                                            <div class="col-sm-9">
+                                                <input type="text" autocomplete="off" class="form-control" id="ps_verificationCode" />
+                                            </div>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+<iframe id="hiddenIframe" name="hiddenIframe" style="display: none;"></iframe>
+
+<script src="/static/js/register.js"></script>
+
+{/block}

+ 1 - 1
app/index/view/auth/login.html

@@ -56,7 +56,7 @@
                 </div>
                 <button type="submit" class="btn btn-primary block full-width m-b" style="background:url(/static/img/btn.png);height: 34px;"></button>
                 </p>
-                <button onclick="Login.gotoRegisterPage('/api/common/gotoRegisterPage')" type="button" style="border:none; background: #fff;color: #008ef9;margin-left: 150px;">注册新用户</button>
+                <button onclick="Login.gotoRegisterPage('/common/api/register')" type="button" style="border:none; background: #fff;color: #008ef9;margin-left: 150px;">注册新用户</button>
                 <button onclick="Login.openEditPassword()" type="button" style="border:none; background: #fff;float: right;color: #008ef9;">忘记密码</button>
             </form>
         </div>

+ 4 - 4
config/database.php

@@ -24,13 +24,13 @@ return [
             // 数据库类型
             'type'            => env('database.type', 'mysql'),
             // 服务器地址
-            'hostname'        => env('database.hostname', '172.17.0.4'),
+            'hostname'        => env('database.hostname', '106.54.81.227'),
             // 数据库名
-            'database'        => env('database.database', 'jjrcwpro'),
+            'database'        => env('database.database', 'jjrcw'),
             // 用户名
-            'username'        => env('database.username', 'root'),
+            'username'        => env('database.username', 'jjrcw'),
             // 密码
-            'password'        => env('database.password', 'root'),
+            'password'        => env('database.password', 'shjHcS6zbffiW65t'),
             // 端口
             'hostport'        => env('database.hostport', '3306'),
             // 数据库连接参数

+ 454 - 0
public/static/js/register.js

@@ -0,0 +1,454 @@
+var Register = {
+    registData: {},
+    validateFields: {
+        username: {validators: {notEmpty: {message: '登录账号不能为空'}}},
+        name: {validators: {notEmpty: {message: '单位名称不能为空'}}},
+        idCard: {validators: {notEmpty: {message: '社会信用代码不能为空'}}},
+        agentName: {validators: {notEmpty: {message: '经办人不能为空'}}},
+        agentPhone: {
+            validators: {
+                notEmpty: {
+                    message: '经办人手机号不能为空'
+                }, regexp: {
+                    regexp: /((\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))$)/,
+                    message: "经办人手机号格式不合法"
+                }
+            }
+        },
+        verificationCode: {validators: {notEmpty: {message: '手机验证码不能为空'}}},
+        legal: {validators: {notEmpty: {message: '法人代表不能为空'}}},
+        street: {validators: {notEmpty: {message: '所属街道不能为空'}}},
+        address: {validators: {notEmpty: {message: '单位地址不能为空'}}},
+        ephone: {
+            validators: {
+                notEmpty: {
+                    message: '单位电话不能为空'
+                }, regexp: {
+                    regexp: /((\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))$)/,
+                    message: "单位电话格式不合法"
+                }
+            }
+        },
+        agentEmail: {
+            validators: {
+                notEmpty: {
+                    message: '电子邮箱不能为空'
+                },
+                regexp: {
+                    regexp: /[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?/,
+                    message: "电子邮箱格式不正确"
+                }
+            }
+        }
+    }
+};
+
+var enterpriseCountDown = 0;
+var enterpriseSmsBtn = $("#enterprise_sms_btn");
+var persionCountDown = 0;
+var psSmsBtn = $("#ps_sms_btn");
+var lock = false;
+
+Register.addSubmit = function() {
+    var regType = $(".active").attr("regType");
+    if (regType == "en") {                                                          //企业用户注册
+        Register.enterpriseUserRegister();
+    } else if (regType == "ps") {                                                   //个人用户注册
+        Register.personUserRegister();
+    }
+};
+
+/**
+ * 验证数据
+ */
+Register.validate = function () {
+    $('#ep_form').data("bootstrapValidator").resetForm();
+    $('#ep_form').bootstrapValidator('validate');
+    return $("#ep_form").data('bootstrapValidator').isValid();
+}
+
+
+var isDis = false;
+Register.enterpriseUserRegister = function() {
+    if(!Register.validate()){
+        return ;
+    }
+    isDis = $("#type").prop("disabled");
+    var source = $("#source").val();
+    var username = $("#username").val();
+    var password = $("#password").val();
+    var rePassword = $("#re_password").val();
+    var name = $("#name").val();
+    var idCard = $("#idCard").val();
+    var agentName = $("#agentName").val();
+    var agentPhone = $("#agentPhone").val();
+    var verificationCode = $("#verificationCode").val();
+    var legal = $("#legal").val();
+    var street = $("#street").val();
+    var address = $("#address").val();
+    if(isDis){
+        $("#type").removeAttr("disabled");
+    }
+    var type = $("#type").val();
+    var agentEmail = $("#agentEmail").val();
+    var talentType = $("#talentType").val();
+    var ephone = $("#ephone").val();
+    var industryField = $("#industryField").val();
+    if (username==null || username=='') {
+        Feng.info("请填写账号!");
+        return;
+    }
+    if (username.length > 50) {
+        Feng.info("账号最多50个字符!");
+        return;
+    }
+    if(source != 2){
+        if (password==null || password=='') {
+            Feng.info("请填写密码!");
+            return;
+        }
+        if (!/^(?=.*\d)(?=.*[a-zA-Z]).{8,20}$/.test(password)){
+            Feng.info("密码格式错误,密码由字母、数字及特殊字符且8-20个字符组成!");
+            return;
+        }
+        if (rePassword==null || rePassword=='') {
+            Feng.info("请填写重复密码!");
+            return;
+        }
+        if (password != rePassword) {
+            Feng.info("两次密码填写不一致!");
+            return;
+        }
+    }
+    if (name==null || name=='') {
+        Feng.info("请填写单位名称!");
+        return;
+    }
+    if (name.length > 100) {
+        Feng.info("单位名称最多100个字符!");
+        return;
+    }
+    if (idCard==null || idCard=='') {
+        Feng.info("请填写社会信用代码!");
+        return;
+    }
+    if (type==null || type=='') {
+        Feng.info("请选择申报类型!");
+        return;
+    }
+    if (idCard.length > 40) {
+        Feng.info("社会信用代码最多40个字符!");
+        return;
+    }
+    if (agentName==null || agentName=='') {
+        Feng.info("请填写经办人!");
+        return;
+    }
+    if (agentName.length > 30) {
+        Feng.info("经办人最多30个字符!");
+        return;
+    }
+    if (agentPhone==null || agentPhone=='') {
+        Feng.info("请填写经办人电话!");
+        return;
+    }
+    if(ephone == null || ephone==''){
+        Feng.info("请填写单位电话");
+        return;
+    }
+    if (verificationCode==null || verificationCode=='') {
+        Feng.info("请填写手机验证码!");
+        return;
+    }
+    if (legal==null || legal=='') {
+        Feng.info("请填写法人代表!");
+        return;
+    }
+    if (street==null || street=='') {
+        Feng.info("请选择所属街道!");
+        return;
+    }
+    if (address==null || address=='') {
+        Feng.info("请填写单位地址!");
+        return;
+    }
+    if(type==null || type==''){
+        Feng.info("请选择企业类别");
+        return ;
+    }
+    if (agentEmail==null || agentEmail=='') {
+        Feng.info("请填写电子邮箱!");
+        return;
+    }
+    if(type==1 ){
+        if(talentType==null||talentType==''){
+            Feng.info("请选择企业标签!");
+            return;
+        }
+        if(industryField == null || industryField ==''){
+            Feng.info("请选择行业领域");
+            return ;
+        }
+    }
+    var x=document.getElementById("imgurl").value;
+    if(x==""){
+        Feng.info("请上传营业执照照片!");
+        return;
+    }
+    if(!/((\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))$)/.test(ephone)){
+        Feng.info("单位电话格式不合法!");
+        return;
+    }
+    if(!/((\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))$)/.test(agentPhone)){
+        Feng.info("经办人电话格式不合法!");
+        return;
+    }
+    if(!/[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?/.test(agentEmail)){
+        Feng.info("电子邮箱格式不合法!");
+        return;
+    }
+    if(!lock){
+        lock = true;
+    }else{
+        Feng.info("不能重复点击");
+        return;
+    }
+    $("#ep_form")[0].submit();
+};
+
+Register.personUserRegister = function() {
+    var source = $("#ps_source").val();
+    var username = $("#ps_username").val();
+    var password = $("#ps_password").val();
+    var rePassword = $("#ps_re_password").val();
+    var name = $("#ps_name").val();
+    var sex = $("#ps_sex").val();
+    var idCard = $("#ps_idCard").val();
+    var phone = $("#ps_phone").val();
+    var verificationCode = $("#ps_verificationCode").val();
+    if (username==null || username=='') {
+        Feng.info("请填写账号!");
+        return;
+    }
+    if (username.length > 50) {
+        Feng.info("账号最多20个字符!");
+        return;
+    }
+    if(source !=2 ){
+        if (password==null || password=='') {
+            Feng.info("请填写密码!");
+            return;
+        }
+        if (rePassword==null || rePassword=='') {
+            Feng.info("请填写重复密码!");
+            return;
+        }
+        if (password != rePassword) {
+            Feng.info("两次密码填写不一致!");
+            return;
+        }
+    }
+    if (name==null || name=='') {
+        Feng.info("请填写姓名!");
+        return;
+    }
+    if (name.length > 20) {
+        Feng.info("姓名最多20个字符!");
+        return;
+    }
+    if (sex==null || sex=='') {
+        Feng.info("请选择性别!");
+        return;
+    }
+    if (idCard==null || idCard=='') {
+        Feng.info("请填写身份证号!");
+        return;
+    }
+    if (phone==null || phone=='') {
+        Feng.info("请填写手机号!");
+        return;
+    }
+    if (verificationCode==null || verificationCode=='') {
+        Feng.info("请填写手机验证码!")
+        return;
+    }
+    if(!/0?(13|14|15|17|18|19)[0-9]{9}/.test(phone)){
+        Feng.info("手机号格式不合法!");
+        return;
+    }
+    var da = {"source":source,"username":username, "password":password, "name":name, "sex":sex, "idCard":idCard, "phone":phone, "verificationCode":verificationCode};
+    var ajax = new $ax(Feng.ctxPath + "/api/personalUser/register", function(data){
+        Feng.info(data.msg);
+        if (data.code == 200) {
+            parent.layer.close(window.parent.Login.layerIndex);
+        }
+    },function(data){
+        Feng.error("操作失败!" + data.responseJSON.message + "!");
+    });
+    ajax.set(da);
+    ajax.start();
+};
+
+Register.getEnterpriseSms = function() {
+    var agentPhone = $("#agentPhone").val();
+    if (agentPhone==null || agentPhone=="") {
+        Feng.info("请填写经办人手机号!");
+        return;
+    }
+    agentPhone = $.trim(agentPhone);
+    if (!Feng.checkMobilePhoneNum(agentPhone)) {
+        Feng.info("手机号格式有误,请填写正确的手机号码!");
+        return;
+    }
+
+    Register.enterpriseBtnCountDown();
+
+    var ajax = new $ax(Feng.ctxPath + "/common/api/verificationCode?phone="+agentPhone+"&type=1", function(data){
+        Feng.info(data.msg);
+    },function(data){
+        Feng.error("操作失败!" + data.responseJSON.message + "!");
+    });
+    ajax.set(null);
+    ajax.start();
+};
+
+Register.enterpriseBtnCountDown = function() {
+    if (enterpriseCountDown == 0) {
+        enterpriseCountDown = 60;
+    } else if (enterpriseCountDown == 1) {
+        enterpriseSmsBtn.removeAttr("disabled");
+        enterpriseSmsBtn.html("获取验证码");
+        enterpriseCountDown = 0;
+        return;
+    }
+    enterpriseSmsBtn.attr("disabled", true);
+    enterpriseSmsBtn.html(enterpriseCountDown + "秒");
+    enterpriseCountDown--;
+    setTimeout("Register.enterpriseBtnCountDown()", 1000);
+};
+
+Register.getPersionSms = function() {
+    var phone = $("#ps_phone").val();
+    if (phone==null || phone=="") {
+        Feng.info("请填写手机号!");
+        return;
+    }
+    phone = $.trim(phone);
+    if (!Feng.checkMobilePhoneNum(phone)) {
+        Feng.info("手机号格式有误,请填写正确的手机号码!");
+        return;
+    }
+    Register.getPersionBtnCountDown();
+    var ajax = new $ax(Feng.ctxPath + "/common/api/verificationCode?phone="+phone+"&type=1", function(data){
+        Feng.info(data.msg);
+    },function(data){
+        Feng.error("操作失败!" + data.responseJSON.message + "!");
+    });
+    ajax.set(null);
+    ajax.start();
+};
+
+Register.getPersionBtnCountDown = function() {
+    if (persionCountDown == 0) {
+        persionCountDown = 60;
+    } else if (persionCountDown == 1) {
+        psSmsBtn.removeAttr("disabled");
+        psSmsBtn.html("获取验证码");
+        persionCountDown = 0;
+        return;
+    }
+    psSmsBtn.attr("disabled", true);
+    psSmsBtn.html(persionCountDown + "秒");
+    persionCountDown--;
+    setTimeout("Register.getPersionBtnCountDown()", 1000);
+};
+
+/**
+ * 企业用户注册回调
+ */
+Register.epCallBack = function(data) {
+    lock = false;
+    var nowDis = $("#type").prop("disabled");
+    if(isDis!=nowDis){
+        $("#type").attr("disabled","disabled");
+    }
+    Feng.info(data.msg);
+    if (data.code == 200) {
+        parent.layer.close(window.parent.Login.layerIndex);
+    }
+};
+Register.typeChange = function(){
+    $("#type").removeAttr("disabled");
+    var type = $("#type").val();
+    if(type==1){
+        $("#talentType,#industryField").parent().parent().attr("style","display:block");
+    }else{
+        $("#talentType,#industryField").val("");
+        $("#talentType,#industryField").parent().parent().attr("style","display:none");
+    }
+}
+
+
+$(function(){
+    $('#ep_form').bootstrapValidator({
+        feedbackIcons: {
+            valid: 'glyphicon glyphicon-ok',
+            invalid: 'glyphicon glyphicon-remove',
+            validating: 'glyphicon glyphicon-refresh'
+        },
+        group:'.rowGroup',
+        fields: Register.validateFields,
+        live: 'enabled',
+        message: '该字段不能为空'
+    });
+    var userType = Feng.getUrlValue("userType");
+    var username = Feng.getUrlValue("username");
+    var name = Feng.getUrlValue("name");
+    var idCard = Feng.getUrlValue("idCard");
+    var type = Feng.getUrlValue("type");
+    if(userType == 1){			//企业用户trigger
+        $("#source").val(2);
+        $("#username").val(username).attr("readonly","readonly");
+        $("#name").val(name).attr("readonly","readonly");
+        $("#idCard").val(idCard).attr("readonly","readonly");
+        $("#type").val(type).trigger("change");
+        $("#type").attr("disabled","disabled");
+        $("#password").val("").attr("placeholder","密码为聚才网账号密码").attr("readonly","readonly");
+        $("#re_password").val("").attr("placeholder","密码为聚才网账号密码").attr("readonly","readonly");
+        $("#personTab").css("pointer-events","none");
+    } else if(userType == 2){	//个人用户
+        $("#personTab").css("pointer-events","block");
+        $("#personTab").children().click();
+        $("#ps_source").val(2);
+        $("#ps_username").val(name).attr("readonly","readonly");
+        $("#ps_idCard").val(idCard).attr("readonly","readonly");
+        $("#ps_password").val("").attr("placeholder","密码为聚才网账号密码").attr("readonly","readonly");
+        $("#ps_re_password").val("").attr("placeholder","密码为聚才网账号密码").attr("readonly","readonly");
+        $("#enTab").css("pointer-events","none");
+    } else{						//无
+
+    }
+    var arr = [
+        {"name":"street","code":"street"},
+        {"name":"talentType","code":"enterprise_tag"},
+        {"name":"industryField","code":"industry_field"}];
+    Feng.findChildDictBatch(JSON.stringify(arr));
+    $("#imgurl").change(function (e) {
+        var tag = e.target;
+        var file = tag.files[0];
+        var imgSrc;
+        var reader = new FileReader();
+        reader.readAsDataURL(file);
+        reader.onload = function() {
+            var src = $("#imgurl").val();
+            var sn = src.lastIndexOf(".");
+            var suffix = src.substring(sn+1,src.length);
+            if(suffix == 'pdf' || suffix == 'PDF'){
+                $("#photoImg").attr("src", Feng.ctxPath + "/static/img/Pdf.png");
+            }else{
+                imgSrc = this.result;
+                $("#photoImg").attr("src", imgSrc);
+            }
+        };
+    });
+});