sugangqiang 2 years ago
parent
commit
2c6caf0ec5

+ 234 - 167
app/common/controller/Auth.php

@@ -13,152 +13,152 @@ use think\exception\ValidateException;
 use think\facade\Request;
 use app\common\api\UploadApi;
 
-class Auth extends BaseController
-{
+class Auth extends BaseController {
 
-    public function register(){
+    public function register() {
         $msg = "";
-        if($this->request->isPost()){
+        if ($this->request->isPost()) {
             $source = intval($this->request['source']);
             $response_object = new \StdClass();
-            $special = \StrUtil::getRequestDecodeParam($this->request,'special');
+            $special = \StrUtil::getRequestDecodeParam($this->request, 'special');
             $data = [
-                'username' => \StrUtil::getRequestDecodeParam($this->request,'username'),
-                'password' => \StrUtil::getRequestDecodeParam($this->request,'password'),
-                're_password' => \StrUtil::getRequestDecodeParam($this->request,'re_password'),
-                'name' => \StrUtil::getRequestDecodeParam($this->request,'name'),
-                'idCard' => \StrUtil::getRequestDecodeParam($this->request,'idCard'),
-                'agentName' => \StrUtil::getRequestDecodeParam($this->request,'agentName'),
-                'agentPhone' => \StrUtil::getRequestDecodeParam($this->request,'agentPhone'),
-                'verificationCode' => \StrUtil::getRequestDecodeParam($this->request,'verificationCode'),
-                'legal' => \StrUtil::getRequestDecodeParam($this->request,'legal'),
-                'street' => \StrUtil::getRequestDecodeParam($this->request,'street'),
-                'address' => \StrUtil::getRequestDecodeParam($this->request,'address'),
+                'username' => \StrUtil::getRequestDecodeParam($this->request, 'username'),
+                'password' => \StrUtil::getRequestDecodeParam($this->request, 'password'),
+                're_password' => \StrUtil::getRequestDecodeParam($this->request, 're_password'),
+                'name' => \StrUtil::getRequestDecodeParam($this->request, 'name'),
+                'idCard' => \StrUtil::getRequestDecodeParam($this->request, 'idCard'),
+                'agentName' => \StrUtil::getRequestDecodeParam($this->request, 'agentName'),
+                'agentPhone' => \StrUtil::getRequestDecodeParam($this->request, 'agentPhone'),
+                'verificationCode' => \StrUtil::getRequestDecodeParam($this->request, 'verificationCode'),
+                'legal' => \StrUtil::getRequestDecodeParam($this->request, 'legal'),
+                'street' => \StrUtil::getRequestDecodeParam($this->request, 'street'),
+                'address' => \StrUtil::getRequestDecodeParam($this->request, 'address'),
                 'type' => intval($this->request['type']),
-                'enterpriseTag' => \StrUtil::getRequestDecodeParam($this->request,'enterpriseTag'),
-                'enterpriseType' => \StrUtil::getRequestDecodeParam($this->request,'enterpriseType'),
-                'agentEmail' => \StrUtil::getRequestDecodeParam($this->request,'agentEmail'),
-                'ephone' => \StrUtil::getRequestDecodeParam($this->request,'ephone'),
-                'industryFieldNew' => \StrUtil::getRequestDecodeParam($this->request,'industryFieldNew'),
-                'industryFieldOld' => \StrUtil::getRequestDecodeParam($this->request,'industryFieldOld'),
-                'bankCard' => \StrUtil::getRequestDecodeParam($this->request,'bankCard'),
-                'bank' => \StrUtil::getRequestDecodeParam($this->request,'bank'),
-                'bankNetwork' => \StrUtil::getRequestDecodeParam($this->request,'bankNetwork')
+                'enterpriseTag' => \StrUtil::getRequestDecodeParam($this->request, 'enterpriseTag'),
+                'enterpriseType' => \StrUtil::getRequestDecodeParam($this->request, 'enterpriseType'),
+                'agentEmail' => \StrUtil::getRequestDecodeParam($this->request, 'agentEmail'),
+                'ephone' => \StrUtil::getRequestDecodeParam($this->request, 'ephone'),
+                'industryFieldNew' => \StrUtil::getRequestDecodeParam($this->request, 'industryFieldNew'),
+                'industryFieldOld' => \StrUtil::getRequestDecodeParam($this->request, 'industryFieldOld'),
+                'bankCard' => \StrUtil::getRequestDecodeParam($this->request, 'bankCard'),
+                'bank' => \StrUtil::getRequestDecodeParam($this->request, 'bank'),
+                'bankNetwork' => \StrUtil::getRequestDecodeParam($this->request, 'bankNetwork')
             ];
             try {
-                if(stripos($data['name'],"(")){
-                    $data['name'] = str_replace('(','(',$data['name']);
+                if (stripos($data['name'], "(")) {
+                    $data['name'] = str_replace('(', '(', $data['name']);
                 }
 
-                if(stripos($data['name'],")")){
-                    $data['name'] = str_replace(')',')',$data['name']);
+                if (stripos($data['name'], ")")) {
+                    $data['name'] = str_replace(')', ')', $data['name']);
                 }
                 $files = $this->request->file();
-                if($special == 'qiye'){
-                    if($data['type'] == 1){
+                if ($special == 'qiye') {
+                    if ($data['type'] == 1) {
                         validate(Enterprise::class)->batch(true)->scene('add')->check($data);
-                        if(!array_key_exists('domainImg',$files) || $files['domainImg'] == ''){
+                        if (!array_key_exists('domainImg', $files) || $files['domainImg'] == '') {
                             $response_object->code = 500;
                             $response_object->msg = '行业领域佐证材料不能为空';
-                            return \StrUtil::back($response_object,"Register.epCallBack");
+                            return \StrUtil::back($response_object, "Register.epCallBack");
                         }
-                    }else{
-                        validate(Enterprise::class)->batch(true)->scene('jc_add')->check($data);//集成电路
+                    } else {
+                        validate(Enterprise::class)->batch(true)->scene('jc_add')->check($data); //集成电路
                     }
-                    if(!array_key_exists('imgurl',$files) || $files['imgurl'] == ''){
+                    if (!array_key_exists('imgurl', $files) || $files['imgurl'] == '') {
                         $response_object->code = 500;
                         $response_object->msg = '营业执照不能为空';
-                        return \StrUtil::back($response_object,"Register.epCallBack");
+                        return \StrUtil::back($response_object, "Register.epCallBack");
                     }
-                    if(!array_key_exists('bankImg',$files) || $files['bankImg'] == ''){
+                    if (!array_key_exists('bankImg', $files) || $files['bankImg'] == '') {
                         $response_object->code = 500;
                         $response_object->msg = '开户许可证不能为空';
-                        return \StrUtil::back($response_object,"Register.epCallBack");
+                        return \StrUtil::back($response_object, "Register.epCallBack");
                     }
-                    if(!array_key_exists('beian',$files) || $files['beian'] == ''){
+                    if (!array_key_exists('beian', $files) || $files['beian'] == '') {
                         $response_object->code = 500;
                         $response_object->msg = '人才联络员备案表不能为空';
-                        return \StrUtil::back($response_object,"Register.epCallBack");
+                        return \StrUtil::back($response_object, "Register.epCallBack");
                     }
                     $data['special'] = 0;
-                }else{
+                } else {
                     $data['type'] = 1;
-                    validate(Enterprise::class)->batch(true)->scene('sy_add')->check($data);//事业单位
-                    if(!array_key_exists('imgurl',$files) || $files['imgurl'] == ''){
+                    validate(Enterprise::class)->batch(true)->scene('sy_add')->check($data); //事业单位
+                    if (!array_key_exists('imgurl', $files) || $files['imgurl'] == '') {
                         $response_object->code = 500;
                         $response_object->msg = '法人代表证或批文不能为空';
-                        return \StrUtil::back($response_object,"Register.epCallBack");
+                        return \StrUtil::back($response_object, "Register.epCallBack");
                     }
                     $data['special'] = 1;
                 }
+
                 //检验验证码
-                $codeResult = MessageRecord::where('smsType',1)->where('phone',$data['agentPhone'])->order('createTime','desc')->find();
-                if(!$codeResult){
+                $codeResult = MessageRecord::where('smsType', 1)->where('phone', $data['agentPhone'])->order('createTime', 'desc')->find();
+                if (!$codeResult) {
                     $response_object->code = 500;
                     $response_object->msg = '请先发送验证码';
-                    return \StrUtil::back($response_object,"Register.epCallBack");
+                    return \StrUtil::back($response_object, "Register.epCallBack");
                 }
 
-                if(time() - strtotime($codeResult['createTime']) > 300){
+                if (time() - strtotime($codeResult['createTime']) > 300) {
                     $response_object->code = 500;
                     $response_object->msg = '验证码过期,请重新发送';
-                    return \StrUtil::back($response_object,"Register.epCallBack");
+                    return \StrUtil::back($response_object, "Register.epCallBack");
                 }
                 $uploadapi = new UploadApi();
                 //检验附件 营业执照
-                if(array_key_exists('imgurl',$files)){
-                    $upload_result = $uploadapi->uploadOne($this->request->file('imgurl'),'image');
-                    if($upload_result->code == 500){
-                        return \StrUtil::back($upload_result,"Register.epCallBack");
+                if (array_key_exists('imgurl', $files)) {
+                    $upload_result = $uploadapi->uploadOne($this->request->file('imgurl'), 'system');
+                    if ($upload_result->code == 500) {
+                        return \StrUtil::back($upload_result, "Register.epCallBack");
                     }
                     $imgurl = $upload_result->filepath;
-                }else{
+                } else {
                     $imgurl = '';
                 }
 
                 //检验附件 开户许可证
-                if(array_key_exists('bankImg',$files)){
-                    $upload_result1 = $uploadapi->uploadOne($this->request->file('bankImg'),'image');
-                    if($upload_result1->code == 500){
-                        return \StrUtil::back($upload_result1,"Register.epCallBack");
+                if (array_key_exists('bankImg', $files)) {
+                    $upload_result1 = $uploadapi->uploadOne($this->request->file('bankImg'), 'system');
+                    if ($upload_result1->code == 500) {
+                        return \StrUtil::back($upload_result1, "Register.epCallBack");
                     }
                     $bankImg = $upload_result1->filepath;
-                }else{
+                } else {
                     $bankImg = '';
                 }
 
                 //检验附件 行业领域佐证材料
-                if(array_key_exists('domainImg',$files)){
-                    $upload_result2 = $uploadapi->uploadOne($this->request->file('domainImg'),'image');
-                    if($upload_result2->code == 500){
-                        return \StrUtil::back($upload_result2,"Register.epCallBack");
+                if (array_key_exists('domainImg', $files)) {
+                    $upload_result2 = $uploadapi->uploadOne($this->request->file('domainImg'), 'system');
+                    if ($upload_result2->code == 500) {
+                        return \StrUtil::back($upload_result2, "Register.epCallBack");
                     }
                     $domainImg = $upload_result2->filepath;
-                }else{
+                } else {
                     $domainImg = '';
                 }
 
                 //检验附件 人才联络员备案表
-                if(array_key_exists('beian',$files)){
-                    $upload_result3 = $uploadapi->uploadOne($this->request->file('beian'),'system');
-                    if($upload_result3->code == 500){
-                        return \StrUtil::back($upload_result3,"Register.epCallBack");
+                if (array_key_exists('beian', $files)) {
+                    $upload_result3 = $uploadapi->uploadOne($this->request->file('beian'), 'system');
+                    if ($upload_result3->code == 500) {
+                        return \StrUtil::back($upload_result3, "Register.epCallBack");
                     }
                     $beian = $upload_result3->filepath;
-                }else{
+                } else {
                     $beian = '';
                 }
 
 
                 $data['id'] = getStringId();
-                $data['password'] = hash('md5',$data['password']);
+                $data['password'] = hash('md5', $data['password']);
                 $data['source'] = $source;
                 $data['imgurl'] = $imgurl;
                 $data['bankImg'] = $bankImg;
                 $data['domainImg'] = $domainImg;
                 $data['beian'] = $beian;
-                $data['createTime'] = date("Y-m-d H:i:s",time());
-                $data['updateTime'] = date("Y-m-d H:i:s",time());
+                $data['createTime'] = date("Y-m-d H:i:s", time());
+                $data['updateTime'] = date("Y-m-d H:i:s", time());
                 $data['active'] = 1;
                 $data['checkState'] = 1;
                 \app\common\model\Enterprise::create($data);
@@ -173,166 +173,232 @@ class Auth extends BaseController
                     'step' => 100,
                     'stateChange' => '用户提交',
                     'description' => '用户注册',
-                    'createTime' => date("Y-m-d H:i:s",time()),
+                    'createTime' => date("Y-m-d H:i:s", time()),
                     'createUser' => '用户'
                 ]);
 
                 $response_object->code = 200;
                 $response_object->msg = '注册成功';
-                return \StrUtil::back($response_object,"Register.epCallBack");
-            } catch (ValidateException $e){
+                return \StrUtil::back($response_object, "Register.epCallBack");
+            } catch (ValidateException $e) {
                 $error = $e->getError();
                 $response_object->code = 500;
                 $response_object->msg = array_pop($error);
-                return \StrUtil::back($response_object,"Register.epCallBack");
+                return \StrUtil::back($response_object, "Register.epCallBack");
             }
-
-
         }
         return view("", ["msg" => $msg]);
     }
 
-    public function enterprise_edit()
-    {
+    public function enterprise_edit() {
         $temp = session('temp');
-        if(empty($temp)){
+        if (empty($temp)) {
             return redirect("/");
         }
         $ep = EnterpriseApi::getOne(session('temp')['uid']);
-        if($this->request->isPost()){
+        if ($this->request->isPost()) {
             $response_object = new \StdClass();
             $data = [
-                'name' => \StrUtil::getRequestDecodeParam($this->request,'name'),//单位名称
-                'idCard' => \StrUtil::getRequestDecodeParam($this->request,'idCard'),//统一社会信用代码
-                'agentName' => \StrUtil::getRequestDecodeParam($this->request,'agentName'),//人才联络员
-                'legal' => \StrUtil::getRequestDecodeParam($this->request,'legal'),//法人
-                'street' => \StrUtil::getRequestDecodeParam($this->request,'street'),//镇街
-                'address' => \StrUtil::getRequestDecodeParam($this->request,'address'),//地址
+                'name' => \StrUtil::getRequestDecodeParam($this->request, 'name'), //单位名称
+                'idCard' => \StrUtil::getRequestDecodeParam($this->request, 'idCard'), //统一社会信用代码
+                'agentName' => \StrUtil::getRequestDecodeParam($this->request, 'agentName'), //人才联络员
+                'legal' => \StrUtil::getRequestDecodeParam($this->request, 'legal'), //法人
+                'street' => \StrUtil::getRequestDecodeParam($this->request, 'street'), //镇街
+                'address' => \StrUtil::getRequestDecodeParam($this->request, 'address'), //地址
                 'type' => intval($this->request['type']),
-                'enterpriseTag' => \StrUtil::getRequestDecodeParam($this->request,'enterpriseTag'),//单位标签
-                'enterpriseType' => \StrUtil::getRequestDecodeParam($this->request,'enterpriseType'),//单位类型
-                'agentEmail' => \StrUtil::getRequestDecodeParam($this->request,'agentEmail'),//邮箱
-                'ephone' => \StrUtil::getRequestDecodeParam($this->request,'ephone'),//单位电话
-                'industryFieldNew' => \StrUtil::getRequestDecodeParam($this->request,'industryFieldNew'),//产业领域
-                'industryFieldOld' => \StrUtil::getRequestDecodeParam($this->request,'industryFieldOld'),//行业领域
-                'bankCard' => \StrUtil::getRequestDecodeParam($this->request,'bankCard'),//银行
-                'bank' => \StrUtil::getRequestDecodeParam($this->request,'bank'),//开户行
-                'bankNetwork' => \StrUtil::getRequestDecodeParam($this->request,'bankNetwork')//网点
+                'enterpriseTag' => \StrUtil::getRequestDecodeParam($this->request, 'enterpriseTag'), //单位标签
+                'enterpriseType' => \StrUtil::getRequestDecodeParam($this->request, 'enterpriseType'), //单位类型
+                'agentPhone' => \StrUtil::getRequestDecodeParam($this->request, 'agentPhone'), //手机
+                'agentEmail' => \StrUtil::getRequestDecodeParam($this->request, 'agentEmail'), //邮箱
+                'ephone' => \StrUtil::getRequestDecodeParam($this->request, 'ephone'), //单位电话
+                'industryFieldNew' => \StrUtil::getRequestDecodeParam($this->request, 'industryFieldNew'), //产业领域
+                'industryFieldOld' => \StrUtil::getRequestDecodeParam($this->request, 'industryFieldOld'), //行业领域
+                'bankCard' => \StrUtil::getRequestDecodeParam($this->request, 'bankCard'), //银行
+                'bank' => \StrUtil::getRequestDecodeParam($this->request, 'bank'), //开户行
+                'bankNetwork' => \StrUtil::getRequestDecodeParam($this->request, 'bankNetwork')//网点
             ];
-            try {
-                if(stripos($data['name'],"(")){
-                    $data['name'] = str_replace('(','(',$data['name']);
+            $files = $this->request->file();
+            if ($files) {
+                $uploadapi = new UploadApi();
+                if (array_key_exists('imgurl', $files)) {
+                    $upload_result = $uploadapi->uploadOne($this->request->file('imgurl'), 'system');
+                    if ($upload_result->code == 500) {
+                        return \StrUtil::back($upload_result, "Register.epCallBack");
+                    }
+                    $data["imgurl"] = $upload_result->filepath;
                 }
 
-                if(stripos($data['name'],")")){
-                    $data['name'] = str_replace(')',')',$data['name']);
+                //检验附件 开户许可证
+                if (array_key_exists('bankImg', $files)) {
+                    $upload_result1 = $uploadapi->uploadOne($this->request->file('bankImg'), 'system');
+                    if ($upload_result1->code == 500) {
+                        return \StrUtil::back($upload_result1, "Register.epCallBack");
+                    }
+                    $data["bankImg"] = $upload_result1->filepath;
+                }
+
+                //检验附件 行业领域佐证材料
+                if (array_key_exists('domainImg', $files)) {
+                    $upload_result2 = $uploadapi->uploadOne($this->request->file('domainImg'), 'system');
+                    if ($upload_result2->code == 500) {
+                        return \StrUtil::back($upload_result2, "Register.epCallBack");
+                    }
+                    $data["domainImg"] = $upload_result2->filepath;
+                }
+
+                //检验附件 人才联络员备案表
+                if (array_key_exists('beian', $files)) {
+                    $upload_result3 = $uploadapi->uploadOne($this->request->file('beian'), 'system');
+                    if ($upload_result3->code == 500) {
+                        return \StrUtil::back($upload_result3, "Register.epCallBack");
+                    }
+                    $data["beian"] = $upload_result3->filepath;
+                }
+            }
+            try {
+                if (stripos($data['name'], "(")) {
+                    $data['name'] = str_replace('(', '(', $data['name']);
+                }
+                if (stripos($data['name'], ")")) {
+                    $data['name'] = str_replace(')', ')', $data['name']);
                 }
                 $data['id'] = $ep->id;
-                validate(\app\common\validate\Enterprise::class)->batch(true)->scene('check_common')->check($data);
+                if ($ep->special == 0) {
+                    if ($ep->type == 1) {
+                        validate(\app\common\validate\Enterprise::class)->batch(true)->scene('change')->check($data);
+                    } else {
+                        validate(\app\common\validate\Enterprise::class)->batch(true)->scene('jc_change')->check($data);
+                    }
+                } else {
+                    validate(\app\common\validate\Enterprise::class)->batch(true)->scene('sy_change')->check($data);
+                }
+                unset($data["agentPhone"]);
                 $data['checkState'] = 1;
                 $ep->update($data);
 
                 $response_object->code = 200;
                 $response_object->msg = '修改成功';
-                return \StrUtil::back($response_object,"Register.epCallBack");
-
-            }catch (ValidateException $e){
+                return \StrUtil::back($response_object, "Register.epCallBack");
+            } catch (ValidateException $e) {
                 $error = $e->getError();
                 $response_object->code = 500;
                 $response_object->msg = array_pop($error);
-                return \StrUtil::back($response_object,"Register.epCallBack");
+                return \StrUtil::back($response_object, "Register.epCallBack");
+            }
+        }
+        if ($ep->imgurl) {
+            $pathinfo = pathinfo($ep->imgurl);
+            if (in_array($pathinfo["extension"], ["jpg", "jpeg", "png", "gif"])) {
+                $ep->imgurl_is_img = 1;
+            }
+        }
+        if ($ep->domainImg) {
+            $pathinfo = pathinfo($ep->domainImg);
+            if (in_array($pathinfo["extension"], ["jpg", "jpeg", "png", "gif"])) {
+                $ep->domainImg_is_img = 1;
+            }
+        }
+        if ($ep->beian) {
+            $pathinfo = pathinfo($ep->beian);
+            if (in_array($pathinfo["extension"], ["jpg", "jpeg", "png", "gif"])) {
+                $ep->beian_is_img = 1;
+            }
+        }
+        if ($ep->bankImg) {
+            $pathinfo = pathinfo($ep->bankImg);
+            if (in_array($pathinfo["extension"], ["jpg", "jpeg", "png", "gif"])) {
+                $ep->bankImg_is_img = 1;
             }
         }
 
         $msg = session('temp')['msg'];
-        return view("",['msg' => $msg, 'ep' => $ep]);
+        return view("", ['msg' => $msg, 'ep' => $ep]);
     }
 
-    public function findBackPassword(){
+    public function findBackPassword() {
         $type = intval($this->request['type']);
-        if(\StrUtil::isEmpOrNull($type)){
-            return json(['msg' => '请选择账号类型','code' => 500]);
+        if (\StrUtil::isEmpOrNull($type)) {
+            return json(['msg' => '请选择账号类型', 'code' => 500]);
         }
-        $username = \StrUtil::getRequestDecodeParam($this->request,'username');
-        if(\StrUtil::isEmpOrNull($username)){
-            return json(['msg' => '请填写账号','code' => 500]);
+        $username = \StrUtil::getRequestDecodeParam($this->request, 'username');
+        if (\StrUtil::isEmpOrNull($username)) {
+            return json(['msg' => '请填写账号', 'code' => 500]);
         }
-        $password = \StrUtil::getRequestDecodeParam($this->request,'password');
-        if(\StrUtil::isEmpOrNull($password)){
-            return json(['msg' => '请填写新密码','code' => 500]);
+        $password = \StrUtil::getRequestDecodeParam($this->request, 'password');
+        if (\StrUtil::isEmpOrNull($password)) {
+            return json(['msg' => '请填写新密码', 'code' => 500]);
         }
-        $rePassword = \StrUtil::getRequestDecodeParam($this->request,'rePassword');
-        if(\StrUtil::isEmpOrNull($rePassword)){
-            return json(['msg' => '请填写重复新密码','code' => 500]);
+        $rePassword = \StrUtil::getRequestDecodeParam($this->request, 'rePassword');
+        if (\StrUtil::isEmpOrNull($rePassword)) {
+            return json(['msg' => '请填写重复新密码', 'code' => 500]);
         }
-        if($password != $rePassword){
-            return json(['msg' => '两次密码填写不一致','code' => 500]);
+        if ($password != $rePassword) {
+            return json(['msg' => '两次密码填写不一致', 'code' => 500]);
         }
-        if(!preg_match("/^(?=.*\d)(?=.*[A-Za-z]).{8,}$/",$password)){
-            return json(['msg' => '密码必须包含字母、数字、特殊字符且长度超过8位','code' => 500]);
+        if (!preg_match("/^(?=.*\d)(?=.*[A-Za-z]).{8,}$/", $password)) {
+            return json(['msg' => '密码必须包含字母、数字、特殊字符且长度超过8位', 'code' => 500]);
         }
-        $phone = \StrUtil::getRequestDecodeParam($this->request,'phone');
-        if(\StrUtil::isEmpOrNull($phone)){
-            return json(['msg' => '请填写手机号','code' => 500]);
+        $phone = \StrUtil::getRequestDecodeParam($this->request, 'phone');
+        if (\StrUtil::isEmpOrNull($phone)) {
+            return json(['msg' => '请填写手机号', 'code' => 500]);
         }
-        $verificationCode = \StrUtil::getRequestDecodeParam($this->request,'verificationCode');
-        if(\StrUtil::isEmpOrNull($verificationCode)){
-            return json(['msg' => '请填写验证码','code' => 500]);
+        $verificationCode = \StrUtil::getRequestDecodeParam($this->request, 'verificationCode');
+        if (\StrUtil::isEmpOrNull($verificationCode)) {
+            return json(['msg' => '请填写验证码', 'code' => 500]);
         }
         //检验验证码
-        $codeResult = MessageRecord::where('smsType',1)->where('phone',$phone)->order('createTime','desc')->find();
-        if(!$codeResult || (time() - strtotime($codeResult['sendingDate']) > 300) ){
-            return json(['msg' => '请先发送验证码','code' => 500]);
+        $codeResult = MessageRecord::where('smsType', 1)->where('phone', $phone)->order('createTime', 'desc')->find();
+        if (!$codeResult || (time() - strtotime($codeResult['sendingDate']) > 300)) {
+            return json(['msg' => '请先发送验证码', 'code' => 500]);
         }
-        if($codeResult['params'] != $verificationCode){
-            return json(['msg' => '验证码不正确','code' => 500]);
+        if ($codeResult['params'] != $verificationCode) {
+            return json(['msg' => '验证码不正确', 'code' => 500]);
         }
-        $password = hash('md5',$password);
-        if($type == 1){
-            $count = \app\common\model\Enterprise::where('username',$username)->where('agentPhone',$phone)->count();
-            if($count == 0){
-                return json(['msg' => '未找到相关账号,请仔细核对账号及手机号信息!','code' => 500]);
+        $password = hash('md5', $password);
+        if ($type == 1) {
+            $count = \app\common\model\Enterprise::where('username', $username)->where('agentPhone', $phone)->count();
+            if ($count == 0) {
+                return json(['msg' => '未找到相关账号,请仔细核对账号及手机号信息!', 'code' => 500]);
             }
-            if($count > 1){
-                return json(['msg' => '找到多个账户,请联系相关单位处理!','code' => 500]);
+            if ($count > 1) {
+                return json(['msg' => '找到多个账户,请联系相关单位处理!', 'code' => 500]);
             }
-            $ep = \app\common\model\Enterprise::where('username',$username)->where('agentPhone',$phone)->find();
+            $ep = \app\common\model\Enterprise::where('username', $username)->where('agentPhone', $phone)->find();
             $ep->password = $password;
             $ep->save();
-        }else{
+        } else {
             //个人账户找回密码TODO
         }
-        return json(['msg' => '找回密码成功!','code' => 200]);
+        return json(['msg' => '找回密码成功!', 'code' => 200]);
     }
 
-    public function verificationCode()
-    {
+    public function verificationCode() {
         $phone = $this->request["phone"];
         $type = $this->request["type"];
         //校验手机号码是否为空
-        if(\StrUtil::isEmpOrNull($phone)) {
-            return json(["msg" => "请填写手机号码!"],500);
+        if (\StrUtil::isEmpOrNull($phone)) {
+            return json(["msg" => "请填写手机号码!"], 500);
         }
         if (\StrUtil::isEmpOrNull($type)) {
-            return json(["msg" => "请填写手机号码!"],500);
+            return json(["msg" => "请填写手机号码!"], 500);
         }
         //校验手机号码格式是否正确
-        if(\StrUtil::isMoblePhone($phone)) {
-            return json(["msg" => "请填写正确的手机号码!"],500);
+        if (\StrUtil::isMoblePhone($phone)) {
+            return json(["msg" => "请填写正确的手机号码!"], 500);
         }
 
         $record = Cache::get("verify_{$type}_{$phone}");
 
-        if($record){
+        if ($record) {
             $time = time();
-            if($time - $record <= 60){
-                return json(["msg" => "一分钟内请勿频繁发送短信!"],500);
+            if ($time - $record <= 60) {
+                return json(["msg" => "一分钟内请勿频繁发送短信!"], 500);
             }
         }
 
         $code = '';
-        for ($i = 1;$i <= 6;$i++){
-            $code .= rand(0,9);
+        for ($i = 1; $i <= 6; $i++) {
+            $code .= rand(0, 9);
         }
 
         //$code = 999999;
@@ -341,9 +407,9 @@ class Auth extends BaseController
 
         $smsapi = new ChuanglanSmsApi();
 
-        $result = $smsapi->sendSMS($phone,$template);
+        $result = $smsapi->sendSMS($phone, $template);
 
-        $result = json_decode($result,true);
+        $result = json_decode($result, true);
 
         $id = getStringId();
 
@@ -356,18 +422,19 @@ class Auth extends BaseController
             'params' => $code,
             'templateCode' => $template,
             'state' => $result['code'] == 0 ? 2 : 3,
-            'sendingDate' => date("Y-m-d H:i:s",time()),
-            'createTime' => date("Y-m-d H:i:s",time()),
+            'sendingDate' => date("Y-m-d H:i:s", time()),
+            'createTime' => date("Y-m-d H:i:s", time()),
             'msg' => $result['errorMsg']
         ];
 
         MessageRecord::create($record_data);
 
-        if($result['code'] == 0){
-            Cache::set("verify_{$type}_{$phone}",time());
-            return json(["msg" => '验证码发送成功'],200);
-        }else{
-            return json(["msg" => '验证码发送失败'],500);
+        if ($result['code'] == 0) {
+            Cache::set("verify_{$type}_{$phone}", time());
+            return json(["msg" => '验证码发送成功'], 200);
+        } else {
+            return json(["msg" => '验证码发送失败'], 500);
         }
     }
+
 }

+ 251 - 218
app/common/view/auth/enterprise_edit.html

@@ -1,237 +1,270 @@
 {extend name="layout/content" /}
 {block name="content"}
 <style type="text/css">
-  .spacing {
-    margin-bottom: 10px;
-    padding-right:4px;
-    padding-left: 4px;
-  }
+    .spacing {
+        margin-bottom: 10px;
+        padding-right:4px;
+        padding-left: 4px;
+    }
 </style>
 <div class="ibox float-e-margins">
-  <div class="ibox-content">
-    <h4 style="color: red;text-align: center;font-size: 26px">{$msg}</h4>
-    <div class="form-horizontal">
-      <div class="row">
-        <div class="col-sm-12">
-          <form id="ep_form" action="/common/auth/enterprise_edit" method="post" class="form-horizontal" enctype="multipart/form-data" target="hiddenIframe">
-            <input type="hidden" id="id" name="id" value="{$ep.id}">
-            <div class="col-sm-12 form-group-sm">
+    <div class="ibox-content">
+        <h4 style="color: red;text-align: center;font-size: 26px">{$msg}</h4>
+        <div class="form-horizontal">
+            <div class="row">
+                <div class="col-sm-12">
+                    <form id="ep_form" action="/common/auth/enterprise_edit" method="post" class="form-horizontal" enctype="multipart/form-data" target="hiddenIframe">
+                        <input type="hidden" id="id" name="id" value="{$ep.id}">
+                        <input type="hidden" id="type" name="type" value="{$ep.type}">
+                        <input type="hidden" id="special" name="special" value="{$ep.special}">
+                        <div class="col-sm-12 form-group-sm">
 
-              <div class="panel panel-default">
-                <div class="panel-heading">单位基础信息</div>
-                <div class="panel-body">
-                  <table style="width: 100%;border-collapse: collapse;" class="table table-bordered">
-                    <tr>
-                      <td>
-                        <div class="rowGroup">
-                          <label class="control-label spacing td-label"><span style="color: red">*</span>账号</label>
-                          <input type="text" autocomplete="off" readonly="readonly" class="form-control" id="username" name="username" value="{$ep.username}" />
-                        </div>
-                      </td>
-                      <td>
-                        <div class="rowGroup">
-                          <label class="control-label spacing td-label"><span style="color: red">*</span>密码</label>
-                          <input type="password" autocomplete="off" class="form-control" id="password" name="password" value="**********" readonly disabled placeholder="密码由字母、数字及特殊字符组成且字符个数为8-20"/>
-                        </div>
-                      </td>
-                      <td>
-                        <div class="rowGroup">
-                          <label class="control-label spacing td-label"><span style="color: red">*</span>重复密码</label>
-                          <input autocomplete="off" type="password" class="form-control" id="re_password" name="re_password" value="**********" readonly disabled placeholder="密码由字母、数字及特殊字符组成且字符个数为8-20"/>
-                        </div>
+                            <div class="panel panel-default">
+                                <div class="panel-heading">{eq name="ep.special" value="0"}企业{else/}单位{/eq}基础信息</div>
+                                <div class="panel-body">
+                                    <table style="width: 100%;border-collapse: collapse;" class="table table-bordered">
+                                        <tr>
+                                            <td>
+                                                <div class="rowGroup">
+                                                    <label class="control-label spacing td-label"><span style="color: red">*</span>账号</label>
+                                                    <input type="text" autocomplete="off" readonly="readonly" class="form-control" id="username" name="username" value="{$ep.username}" />
+                                                </div>
+                                            </td>
+                                            <td>
+                                                <div class="rowGroup">
+                                                    <label class="control-label spacing td-label"><span style="color: red">*</span>密码</label>
+                                                    <input type="password" autocomplete="off" class="form-control" id="password" name="password" value="**********" readonly disabled placeholder="密码由字母、数字及特殊字符组成且字符个数为8-20"/>
+                                                </div>
+                                            </td>
+                                            <td>
+                                                <div class="rowGroup">
+                                                    <label class="control-label spacing td-label"><span style="color: red">*</span>重复密码</label>
+                                                    <input autocomplete="off" type="password" class="form-control" id="re_password" name="re_password" value="**********" readonly disabled placeholder="密码由字母、数字及特殊字符组成且字符个数为8-20"/>
+                                                </div>
 
-                      </td>
-                      <td rowspan="3" >
-                        <label class="control-label spacing"><span class="text-danger">*</span>营业执照</label>
-                        <img id="photoImg" src="{$ep.imgurl|getStoragePath}" style="height: 60px;" onclick="$('#imgurl').click()" >
-                        <input style="display: none" autocomplete="off" type="file" class="form-control" id="imgurl" name="imgurl" />
-                      </td>
-                    </tr>
-                    <tr>
-                      <td>
-                        <div class="rowGroup">
-                          <label class=" control-label spacing td-label"><span style="color: red">*</span>单位名称</label>
-                          <input autocomplete="off" type="text" class="form-control" id="name" name="name" value="{$ep.name}"/>
-                        </div>
-                      </td>
-                      <td>
-                        <div class="rowGroup">
-                          <label class=" control-label spacing td-label"><span style="color: red">*</span>统一社会信用代码</label>
-                          <input autocomplete="off" type="text" class="form-control" id="idCard" name="idCard" value="{$ep.idCard}"/>
-                        </div>
-                      </td>
-                      <td>
-                        <div class="rowGroup">
-                          <label class=" control-label spacing td-label"><span style="color: red">*</span>法人代表</label>
-                          <input autocomplete="off" type="text" class="form-control" id="legal" name="legal" value="{$ep.legal}"/>
-                        </div>
-                      </td>
-                    </tr>
-                    <tr>
-                      <td>
-                        <div class="rowGroup">
-                          <label class=" control-label spacing td-label"><span style="color: red">*</span>所属街道</label>
-                          <select class="form-control" id="street" name="street" value="{$ep.street}"></select>
-                        </div>
-                      </td>
-                      <td>
-                        <div class="rowGroup">
-                          <label class=" control-label spacing td-label"><span style="color: red">*</span>单位地址</label>
-                          <input autocomplete="off" type="text" class="form-control" id="address" name="address" value="{$ep.address}"/>
-                        </div>
-                      </td>
-                      <td>
-                        <div class="rowGroup">
-                          <label class=" control-label spacing td-label"><span style="color: red">*</span>单位电话</label>
-                          <input autocomplete="off" type="text" class="form-control" id="ephone" name="ephone" value="{$ep.ephone}"/>
-                        </div>
-                      </td>
-                    </tr>
-                    <tr>
-                      <td>
-                        <div class="rowGroup">
-                          <label class=" control-label spacing td-label"><span style="color: red">*</span>企业银行账号</label>
-                          <input autocomplete="off" type="text" class="form-control" id="bankCard" name="bankCard" value="{$ep.bankCard}" />
-                        </div>
-                      </td>
-                      <td>
-                        <div class="rowGroup">
-                          <label class=" control-label spacing td-label"><span style="color: red">*</span>企业开户银行</label>
-                          <input autocomplete="off" type="text" class="form-control" id="bank" name="bank" value="{$ep.bank}" />
-                        </div>
-                      </td>
-                      <td>
-                        <div class="rowGroup">
-                          <label class=" control-label spacing td-label"><span style="color: red">*</span>企业开户银行网点</label>
-                          <input autocomplete="off" type="text" class="form-control" id="bankNetwork" name="bankNetwork" value="{$ep.bankNetwork}" />
-                        </div>
-                      </td>
-                      <td>
-                        <label class="control-label spacing"><span class="text-danger">*</span>开户许可证</label>
-                        <img id="photoImg1" src="{$ep.bankImg|getStoragePath}" style="height: 60px;" onclick="$('#bankImg').click()" >
-                        <input style="display: none" autocomplete="off" type="file" class="form-control" id="bankImg" name="bankImg" />
-                      </td>
-                    </tr>
+                                            </td>
+                                            <td rowspan="3" >
+                                                <label class="control-label spacing"><span class="text-danger">*</span>{eq name="ep.special" value="0"}营业执照{else/}事业单位法人证或批文{/eq}</label>
+                                                {if condition="$ep['imgurl']"}
+                                                {if condition="$ep['imgurl_is_img'] eq 1"}
+                                                <img src="{$ep.imgurl|getStoragePath}" style="height: 60px;" onclick="$('#imgurl').click()">
+                                                {else/}
+                                                <img src="/static/img/File.png" style="height: 60px;" onclick="$('#imgurl').click()">
+                                                {/if}
+                                                {else/}
+                                                <img src="/static/img/yyzz.png" style="height: 60px;" onclick="$('#imgurl').click()" >
+                                                {/if}
+                                                <input style="display: none" autocomplete="off" type="file" class="form-control" id="imgurl" name="imgurl" />
+                                            </td>
+                                        </tr>
+                                        <tr>
+                                            <td>
+                                                <div class="rowGroup">
+                                                    <label class=" control-label spacing td-label"><span style="color: red">*</span>{eq name="ep.special" value="0"}企业{else/}单位{/eq}名称</label>
+                                                    <input autocomplete="off" type="text" class="form-control" id="name" name="name" value="{$ep.name}"/>
+                                                </div>
+                                            </td>
+                                            <td>
+                                                <div class="rowGroup">
+                                                    <label class=" control-label spacing td-label"><span style="color: red">*</span>统一社会信用代码</label>
+                                                    <input autocomplete="off" type="text" class="form-control" id="idCard" name="idCard" value="{$ep.idCard}"/>
+                                                </div>
+                                            </td>
+                                            <td>
+                                                <div class="rowGroup">
+                                                    <label class=" control-label spacing td-label"><span style="color: red">*</span>法人代表</label>
+                                                    <input autocomplete="off" type="text" class="form-control" id="legal" name="legal" value="{$ep.legal}"/>
+                                                </div>
+                                            </td>
+                                        </tr>
+                                        <tr>
+                                            <td>
+                                                <div class="rowGroup">
+                                                    <label class=" control-label spacing td-label"><span style="color: red">*</span>所属街道</label>
+                                                    <select class="form-control" id="street" name="street" value="{$ep.street}"></select>
+                                                </div>
+                                            </td>
+                                            <td>
+                                                <div class="rowGroup">
+                                                    <label class=" control-label spacing td-label"><span style="color: red">*</span>{eq name="ep.special" value="0"}企业{else/}单位{/eq}地址</label>
+                                                    <input autocomplete="off" type="text" class="form-control" id="address" name="address" value="{$ep.address}"/>
+                                                </div>
+                                            </td>
+                                            <td>
+                                                <div class="rowGroup">
+                                                    <label class=" control-label spacing td-label"><span style="color: red">*</span>{eq name="ep.special" value="0"}企业{else/}单位{/eq}电话</label>
+                                                    <input autocomplete="off" type="text" class="form-control" id="ephone" name="ephone" value="{$ep.ephone}"/>
+                                                </div>
+                                            </td>
+                                        </tr>
+                                        <tr>
+                                            <td>
+                                                <div class="rowGroup">
+                                                    <label class=" control-label spacing td-label"><span style="color: red">*</span>{eq name="ep.special" value="0"}企业{else/}单位{/eq}银行账号</label>
+                                                    <input autocomplete="off" type="text" class="form-control" id="bankCard" name="bankCard" value="{$ep.bankCard}" />
+                                                </div>
+                                            </td>
+                                            <td>
+                                                <div class="rowGroup">
+                                                    <label class=" control-label spacing td-label"><span style="color: red">*</span>{eq name="ep.special" value="0"}企业{else/}单位{/eq}开户银行</label>
+                                                    <input autocomplete="off" type="text" class="form-control" id="bank" name="bank" value="{$ep.bank}" />
+                                                </div>
+                                            </td>
+                                            <td>
+                                                <div class="rowGroup">
+                                                    <label class=" control-label spacing td-label"><span style="color: red">*</span>{eq name="ep.special" value="0"}企业{else/}单位{/eq}开户银行网点</label>
+                                                    <input autocomplete="off" type="text" class="form-control" id="bankNetwork" name="bankNetwork" value="{$ep.bankNetwork}" />
+                                                </div>
+                                            </td>
+                                            <td>
+                                                <label class="control-label spacing"><span class="text-danger">*</span>开户许可证</label>
+                                                {if condition="$ep['bankImg']"}
+                                                {if condition="$ep['bankImg_is_img'] eq 1"}
+                                                <img src="{$ep.bankImg|getStoragePath}" style="height: 60px;" onclick="$('#bankImg').click()">
+                                                {else/}
+                                                <img src="/static/img/File.png" style="height: 60px;" onclick="$('#bankImg').click()">
+                                                {/if}
+                                                {else/}
+                                                <img src="/static/img/yyzz.png" style="height: 60px;" onclick="$('#bankImg').click()" >
+                                                {/if}
+                                                <input style="display: none" autocomplete="off" type="file" class="form-control" id="bankImg" name="bankImg" />
+                                            </td>
+                                        </tr>
 
-                  </table>
-                </div>
-                <div class="panel-heading">申报基础信息</div>
-                <div class="panel-body">
-                  <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">
-                        <select class="form-control" id="type" name="type" onchange="Register.typeChange()" value="{$ep.type}">
-                          <option value="">请选择</option>
-                          <option value="1">晋江市现代产业体系人才</option>
-                          <option value="2">集成电路优秀人才</option>
-<!--                          <option value="3">海峡计划团队</option>-->
-                        </select>
-                      </div>
-                    </div>
-                  </div>
-                  <div class="row" id="typeGroup" style="display: none">
-                    <table style="width: 100%;border-collapse: collapse;" class="table table-bordered">
-                      <tr>
-                        <td>
-                          <div class="rowGroup">
-                            <label class="control-label spacing td-label"><span style="color: red">*</span>产业领域</label>
-                            <select autocomplete="off" type="text" class="form-control" id="industryFieldNew" name="industryFieldNew" onchange="Register.industryChange()" value="{$ep.industryFieldNew}"></select>
-                          </div>
-                        </td>
-                        <td>
-                          <div class="rowGroup">
-                            <label class="control-label spacing td-label"><span style="color: red">*</span>行业领域</label>
-                            <select class="form-control" id="industryFieldOld" name="industryFieldOld" value="{$ep.industryFieldOld}">
-                            </select>
-                          </div>
-                        </td>
-                        <td rowspan="2">
-                          <label class="control-label spacing">行业领域上传材料 </label>
-                          <img id="photoImg2" src="{$ep.domainImg|getStoragePath}" style="height: 60px;" onclick="$('#domainImg').click()" >
-                          <input style="display: none" autocomplete="off" type="file" class="form-control" id="domainImg" name="domainImg" />
-                        </td>
-                      </tr>
-                      <tr>
-                        <td>
-                          <div class="rowGroup">
-                            <label class="control-label spacing td-label"><span style="color: red">*</span>单位标签</label>
-                            <select class="form-control" id="enterpriseTag" name="enterpriseTag" value="{$ep.enterpriseTag}">
-                            </select>
-                          </div>
-                        </td>
-                        <td>
-                          <div class="rowGroup">
-                            <label class="control-label spacing td-label"><span style="color: red">*</span>单位类型</label>
-                            <select class="form-control" id="enterpriseType" name="enterpriseType" value="{$ep.enterpriseType}">
-                            </select>
-                          </div>
-                        </td>
-                      </tr>
-                    </table>
-                  </div>
-
-                </div>
-                <div class="panel-heading">人才联络员信息</div>
-                <div class="panel-body">
-                  <table style="width: 100%;border-collapse: collapse;" class="table table-bordered">
-                    <tr>
-                      <td>
-                        <div class="rowGroup">
-                          <label class="control-label spacing td-label"><span style="color: red">*</span>人才联络员</label>
-                          <input autocomplete="off" type="text" class="form-control" id="agentName" name="agentName" value="{$ep.agentName}"/>
-                        </div>
-                      </td>
-                      <td>
-                        <div class="rowGroup">
-                          <label class="control-label spacing td-label"><span style="color: red">*</span>电子邮箱</label>
-                          <input autocomplete="off" type="text" class="form-control" id="agentEmail" name="agentEmail" value="{$ep.agentEmail}"/>
-                        </div>
-                      </td>
-                      <td rowspan="2">
-                        <label class="control-label spacing" style="text-align: center">人才联络员备案表<br /><a href="/beianbiao.doc" style="color: red">模板下载</a>  </label>
-                        <img id="photoImg3" src="{$ep.beian|getStoragePath}" style="height: 60px;" onclick="$('#beian').click()" >
-                        <input style="display: none" autocomplete="off" type="file" class="form-control" id="beian" name="beian" />
-                      </td>
-                    </tr>
-                    <tr>
-                      <td>
-                        <div class="rowGroup">
-                          <label class="control-label spacing td-label"><span style="color: red">*</span>人才联络员手机号</label>
-                          <input autocomplete="off" type="text" class="form-control" id="agentPhone" name="agentPhone" value="{$ep.agentPhone}" readonly disabled  placeholder="用于找回密码" />
-                        </div>
-                      </td>
-                      <td>
-                        <div class="rowGroup">
-                          <label class="control-label spacing td-label"><span style="color: red">*</span>审核状态</label>
-                          <input autocomplete="off" type="text" class="form-control" id="checkState" name="checkState" value="审核驳回" readonly disabled  />
+                                    </table>
+                                </div>
+                                {if condition="$ep['special'] eq 0"}
+                                <div class="panel-heading">申报基础信息</div>
+                                <div class="panel-body">
+                                    <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">
+                                                <select class="form-control" id="type" name="type" onchange="Register.typeChange()" value="{$ep.type}">
+                                                    <option value="">请选择</option>
+                                                    <option value="1">晋江市现代产业体系人才</option>
+                                                    <option value="2">集成电路优秀人才</option>
+                                                    <!--                          <option value="3">海峡计划团队</option>-->
+                                                </select>
+                                            </div>
+                                        </div>
+                                    </div>
+                                    {if condition="$ep['type'] eq 1"}
+                                    <div class="row" id="typeGroup" style="display: none">
+                                        <table style="width: 100%;border-collapse: collapse;" class="table table-bordered">
+                                            <tr>
+                                                <td>
+                                                    <div class="rowGroup">
+                                                        <label class="control-label spacing td-label"><span style="color: red">*</span>产业领域</label>
+                                                        <select autocomplete="off" type="text" class="form-control" id="industryFieldNew" name="industryFieldNew" onchange="Register.industryChange()" value="{$ep.industryFieldNew}"></select>
+                                                    </div>
+                                                </td>
+                                                <td>
+                                                    <div class="rowGroup">
+                                                        <label class="control-label spacing td-label"><span style="color: red">*</span>行业领域</label>
+                                                        <select class="form-control" id="industryFieldOld" name="industryFieldOld" value="{$ep.industryFieldOld}">
+                                                        </select>
+                                                    </div>
+                                                </td>
+                                                <td rowspan="2">
+                                                    <label class="control-label spacing">行业领域上传材料 </label>
+                                                    {if condition="$ep['domainImg']"}
+                                                    {if condition="$ep['domainImg_is_img'] eq 1"}
+                                                    <img src="{$ep.domainImg|getStoragePath}" style="height: 60px;" onclick="$('#domainImg').click()">
+                                                    {else/}
+                                                    <img src="/static/img/File.png" style="height: 60px;" onclick="$('#domainImg').click()">
+                                                    {/if}
+                                                    {else/}
+                                                    <img src="/static/img/yyzz.png" style="height: 60px;" onclick="$('#domainImg').click()" >
+                                                    {/if}
+                                                    <input style="display: none" autocomplete="off" type="file" class="form-control" id="domainImg" name="domainImg" />
+                                                </td>
+                                            </tr>
+                                            <tr>
+                                                <td>
+                                                    <div class="rowGroup">
+                                                        <label class="control-label spacing td-label"><span style="color: red">*</span>企业标签</label>
+                                                        <select class="form-control" id="enterpriseTag" name="enterpriseTag" value="{$ep.enterpriseTag}">
+                                                        </select>
+                                                    </div>
+                                                </td>
+                                                <td>
+                                                    <div class="rowGroup">
+                                                        <label class="control-label spacing td-label"><span style="color: red">*</span>企业类型</label>
+                                                        <select class="form-control" id="enterpriseType" name="enterpriseType" value="{$ep.enterpriseType}">
+                                                        </select>
+                                                    </div>
+                                                </td>
+                                            </tr>
+                                        </table>
+                                    </div>
+                                    {/if}
+                                </div>
+                                {/if}
+                                <div class="panel-heading">人才联络员信息</div>
+                                <div class="panel-body">
+                                    <table style="width: 100%;border-collapse: collapse;" class="table table-bordered">
+                                        <tr>
+                                            <td>
+                                                <div class="rowGroup">
+                                                    <label class="control-label spacing td-label"><span style="color: red">*</span>人才联络员</label>
+                                                    <input autocomplete="off" type="text" class="form-control" id="agentName" name="agentName" value="{$ep.agentName}"/>
+                                                </div>
+                                            </td>
+                                            <td>
+                                                <div class="rowGroup">
+                                                    <label class="control-label spacing td-label"><span style="color: red">*</span>电子邮箱</label>
+                                                    <input autocomplete="off" type="text" class="form-control" id="agentEmail" name="agentEmail" value="{$ep.agentEmail}"/>
+                                                </div>
+                                            </td>
+                                            <td rowspan="2">
+                                                <label class="control-label spacing" style="text-align: center">人才联络员备案表<br /><a href="/beianbiao.doc" style="color: red">模板下载</a>  </label>                                                
+                                                {if condition="$ep['beian']"}
+                                                {if condition="$ep['beian_is_img'] eq 1"}
+                                                <img src="{$ep.beian|getStoragePath}" style="height: 60px;" onclick="$('#beian').click()">
+                                                {else/}
+                                                <img src="/static/img/File.png" style="height: 60px;" onclick="$('#beian').click()">
+                                                {/if}
+                                                {else/}
+                                                <img src="/static/img/yyzz.png" style="height: 60px;" onclick="$('#beian').click()" >
+                                                {/if}
+                                                <input style="display: none" autocomplete="off" type="file" class="form-control" id="beian" name="beian" />
+                                            </td>
+                                        </tr>
+                                        <tr>
+                                            <td>
+                                                <div class="rowGroup">
+                                                    <label class="control-label spacing td-label"><span style="color: red">*</span>人才联络员手机号</label>
+                                                    <input autocomplete="off" type="text" class="form-control" id="agentPhone" name="agentPhone" value="{$ep.agentPhone}" readonly disabled  placeholder="用于找回密码" />
+                                                </div>
+                                            </td>
+                                            <td>
+                                                <div class="rowGroup">
+                                                    <label class="control-label spacing td-label"><span style="color: red">*</span>审核状态</label>
+                                                    <input autocomplete="off" type="text" class="form-control" id="checkState" name="checkState" value="审核驳回" readonly disabled  />
+                                                </div>
+                                            </td>
+                                        </tr>
+                                    </table>
+                                </div>
+                            </div>
+                            <div class="row">
+                                <div class="col-sm-12" style="text-align: center;margin-top: 10px;">
+                                    <button type="button" class="btn btn-sm btn-primary " onclick="Register.enterpriseUserRegister()" id="ensure">
+                                        <i class="fa fa-check"></i>&nbsp;提交
+                                    </button>
+                                </div>
+                            </div>
                         </div>
-                      </td>
-                    </tr>
-                  </table>
-                </div>
-              </div>
-
-
-
-              <div class="row">
-
-                <div class="col-sm-12" style="text-align: center;margin-top: 10px;">
-                  <button type="button" class="btn btn-sm btn-primary " onclick="Register.enterpriseUserRegister()" id="ensure">
-                    <i class="fa fa-check"></i>&nbsp;提交
-                  </button>
+                    </form>
                 </div>
-              </div>
             </div>
-          </form>
         </div>
-      </div>
     </div>
-  </div>
 </div>
 <iframe id="hiddenIframe" name="hiddenIframe" style="display: none;"></iframe>
 <!--<script src="${ctxPath}/static/modular/gate/enterprise/enterprise_edit.js"></script>-->
 <script type="text/javascript">
-  document.write('<script src="/static/modular/gate/enterprise/enterprise_edit.js?v='+(new Date()).getTime()+'"><\/script>');
+    document.write('<script src="/static/modular/gate/enterprise/enterprise_edit.js?v=' + (new Date()).getTime() + '"><\/script>');
 </script>
 {/block}

+ 9 - 84
public/static/js/register.js

@@ -623,96 +623,21 @@ $(function () {
         {"name": "enterpriseType", "code": "enterprise_type"},
         {"name": "sy_street", "code": "street"}];
     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);
-            }
-        };
-    });
-    $("#sy_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 = $("#sy_imgurl").val();
-            var sn = src.lastIndexOf(".");
-            var suffix = src.substring(sn + 1, src.length);
-            if (suffix == 'pdf' || suffix == 'PDF') {
-                $("#sy_photoImg").attr("src", Feng.ctxPath + "/static/img/Pdf.png");
-            } else {
-                imgSrc = this.result;
-                $("#sy_photoImg").attr("src", imgSrc);
-            }
-        };
-    });
-    $("#bankImg").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 = $("#bankImg").val();
-            var sn = src.lastIndexOf(".");
-            var suffix = src.substring(sn + 1, src.length);
-            if (suffix == 'pdf' || suffix == 'PDF') {
-                $("#photoImg1").attr("src", Feng.ctxPath + "/static/img/Pdf.png");
-            } else {
-                imgSrc = this.result;
-                $("#photoImg1").attr("src", imgSrc);
-            }
-        };
-    });
-    $("#domainImg").change(function (e) {
-        var tag = e.target;
-        var file = tag.files[0];
+    $("#imgurl,#sy_imgurl,#bankImg,#sy_bankImg,#beian,#domainImg").change(function (e) {
+        var that = this;
+        if (!Feng.chkFileInvalid(that.files[0], 5, 10)) {
+            return;
+        }
+        var file = that.files[0];
         var imgSrc;
         var reader = new FileReader();
         reader.readAsDataURL(file);
         reader.onload = function () {
-            var src = $("#domainImg").val();
-            var sn = src.lastIndexOf(".");
-            var suffix = src.substring(sn + 1, src.length);
-            if (suffix == 'pdf' || suffix == 'PDF') {
-                $("#photoImg2").attr("src", Feng.ctxPath + "/static/img/Pdf.png");
-            } else {
+            if (Feng.isImg(file.type)) {
                 imgSrc = this.result;
-                $("#photoImg2").attr("src", imgSrc);
-            }
-        };
-    });
-
-    $("#beian").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 = $("#beian").val();
-            var sn = src.lastIndexOf(".");
-            var suffix = src.substring(sn + 1, src.length);
-            if (suffix == 'pdf' || suffix == 'PDF') {
-                $("#photoImg3").attr("src", Feng.ctxPath + "/static/img/Pdf.png");
-            } else if (suffix == 'doc' || suffix == 'docx') {
-                $("#photoImg3").attr("src", Feng.ctxPath + "/static/img/word.jpg");
+                $(that).prev("img").attr("src", imgSrc);
             } else {
-                imgSrc = this.result;
-                $("#photoImg3").attr("src", imgSrc);
+                $(that).prev("img").attr("src", Feng.ctxPath + "/static/img/File.png");
             }
         };
     });

+ 64 - 67
public/static/modular/gate/enterprise/enterprise_edit.js

@@ -6,7 +6,8 @@ var persionCountDown = 0;
 var psSmsBtn = $("#ps_sms_btn");
 
 
-Register.enterpriseUserRegister = function() {
+Register.enterpriseUserRegister = function () {
+    $("#agentPhone").removeAttr("disabled");
     var username = $("#username").val();
     var name = $("#name").val();
     var idCard = $("#idCard").val();
@@ -16,12 +17,13 @@ Register.enterpriseUserRegister = function() {
     var street = $("#street").val();
     var address = $("#address").val();
     var type = $("#type").val();
+    var special = $("#special").val();
     var agentEmail = $("#agentEmail").val();
     var ephone = $("#ephone").val();
     var bankCard = $("#bankCard").val();
     var bank = $("#bank").val();
     var bankNetwork = $("#bankNetwork").val();
-    if (username==null || username=='') {
+    if (username == null || username == '') {
         Feng.info("请填写账号!");
         return;
     }
@@ -29,7 +31,7 @@ Register.enterpriseUserRegister = function() {
         Feng.info("账号最多50个字符!");
         return;
     }
-    if (name==null || name=='') {
+    if (name == null || name == '') {
         Feng.info("请填写单位名称!");
         return;
     }
@@ -37,11 +39,11 @@ Register.enterpriseUserRegister = function() {
         Feng.info("单位名称最多100个字符!");
         return;
     }
-    if (idCard==null || idCard=='') {
+    if (idCard == null || idCard == '') {
         Feng.info("请填写统一社会信用代码!");
         return;
     }
-    if (type==null || type=='') {
+    if (type == null || type == '') {
         Feng.info("请选择申报类型!");
         return;
     }
@@ -49,7 +51,7 @@ Register.enterpriseUserRegister = function() {
         Feng.info("统一社会信用代码最多40个字符!");
         return;
     }
-    if (agentName==null || agentName=='') {
+    if (agentName == null || agentName == '') {
         Feng.info("请填写人才联络员!");
         return;
     }
@@ -57,81 +59,81 @@ Register.enterpriseUserRegister = function() {
         Feng.info("人才联络员最多30个字符!");
         return;
     }
-    if (agentPhone==null || agentPhone=='') {
+    if (agentPhone == null || agentPhone == '') {
         Feng.info("请填写人才联络员电话!");
         return;
     }
-    if(ephone == null || ephone==''){
+    if (ephone == null || ephone == '') {
         Feng.info("请填写单位电话");
         return;
     }
-    if (legal==null || legal=='') {
+    if (legal == null || legal == '') {
         Feng.info("请填写法人代表!");
         return;
     }
-    if (street==null || street=='') {
+    if (street == null || street == '') {
         Feng.info("请选择所属街道!");
         return;
     }
-    if (address==null || address=='') {
+    if (address == null || address == '') {
         Feng.info("请填写单位地址!");
         return;
     }
-    if (bankCard==null || bankCard=='') {
+    if (bankCard == null || bankCard == '') {
         Feng.info("请填写企业银行账号!");
         return;
     }
-    if (bank==null || bank=='') {
+    if (bank == null || bank == '') {
         Feng.info("请填写企业开户银行!");
         return;
     }
-    if (bankNetwork==null || bankNetwork=='') {
+    if (bankNetwork == null || bankNetwork == '') {
         Feng.info("请填写企业开户银行网点!");
         return;
     }
 
-    if(type==null || type==''){
+    if (type == null || type == '') {
         Feng.info("请选择企业类别");
-        return ;
+        return;
     }
-    if (agentEmail==null || agentEmail=='') {
+    if (agentEmail == null || agentEmail == '') {
         Feng.info("请填写电子邮箱!");
         return;
     }
-    if(type==1 ){
+    if (special == 0 && type == 1) {
         var industryFieldNew = $("#industryFieldNew").val();
         var industryFieldOld = $("#industryFieldOld").val();
         var domainImg = $("#domainImg").val();
         var enterpriseTag = $("#enterpriseTag").val();
         var enterpriseType = $("#enterpriseType").val();
 
-        if(enterpriseTag==null||enterpriseTag==''){
+        if (enterpriseTag == null || enterpriseTag == '') {
             Feng.info("请选择企业标签!");
             return;
         }
-        if(industryFieldNew == null || industryFieldNew ==''){
+        if (industryFieldNew == null || industryFieldNew == '') {
             Feng.info("请选择产业领域");
-            return ;
+            return;
         }
-        if(industryFieldOld == null || industryFieldOld ==''){
+        if (industryFieldOld == null || industryFieldOld == '') {
             Feng.info("请选择行业领域");
-            return ;
+            return;
         }
-        if(enterpriseType==null||enterpriseType==''){
+        if (enterpriseType == null || enterpriseType == '') {
             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)){
+    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)){
+    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)){
+    if (!/[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?/.test(agentEmail)) {
         Feng.info("电子邮箱格式不合法!");
         return;
     }
@@ -143,64 +145,59 @@ Register.enterpriseUserRegister = function() {
 /**
  * 企业用户注册回调
  */
-Register.epCallBack = function(data) {
+Register.epCallBack = function (data) {
+    $("#agentPhone").prop("disabled", true);
     Feng.info(data.msg);
     if (data.code == 200) {
         setInterval(function () {
-            window.location.href=Feng.ctxPath + "/";
-        },3000);
+            window.location.href = Feng.ctxPath + "/";
+        }, 3000);
     }
 };
-Register.typeChange = function(){
+Register.typeChange = function () {
     var type = $("#type").val();
-    if(type==1){
-        $("#typeGroup").attr("style","display:block");
-    }else{
-        $("#typeGroup").attr("style","display:none");
+    if (type == 1) {
+        $("#typeGroup").attr("style", "display:block");
+    } else {
+        $("#typeGroup").attr("style", "display:none");
     }
 }
-Register.industryChange = function(){
+Register.industryChange = function () {
     var industryNew = $("#industryFieldNew").val();
-    var arr = [{"name":"industryFieldOld","code":industryNew+"_field"}];
+    var arr = [{"name": "industryFieldOld", "code": industryNew + "_field"}];
     Feng.findChildDictBatch(JSON.stringify(arr));
 }
+$("#imgurl,#bankImg,#beian,#domainImg").change(function (e) {
+    var that = this;
+    if (!Feng.chkFileInvalid(that.files[0], 5, 10)) {
+        return;
+    }
+    var file = that.files[0];
+    var imgSrc;
+    var reader = new FileReader();
+    reader.readAsDataURL(file);
+    reader.onload = function () {
+        if (Feng.isImg(file.type)) {
+            imgSrc = this.result;
+            $(that).prev("img").attr("src", imgSrc);
+        } else {
+            $(that).prev("img").attr("src", Feng.ctxPath + "/static/img/File.png");
+        }
+    };
+});
 
 
-$(function(){
+$(function () {
     var industryNew = $("#industryFieldNew").attr("value");
     var arr = [
-        {"name":"street","code":"street"},
-        {"name":"enterpriseTag","code":"enterprise_tag"},
-        {"name":"enterpriseType","code":"enterprise_type"},
-        {"name":"industryFieldNew","code":"industry_field"},
-        {"name":"industryFieldOld","code":industryNew+"_field"}];
+        {"name": "street", "code": "street"},
+        {"name": "enterpriseTag", "code": "enterprise_tag"},
+        {"name": "enterpriseType", "code": "enterprise_type"},
+        {"name": "industryFieldNew", "code": "industry_field"},
+        {"name": "industryFieldOld", "code": industryNew + "_field"}];
     Feng.findChildDictBatch(JSON.stringify(arr));
     $("select").each(function () {
         $(this).val($(this).attr("value"));
         $(this).trigger("change");
     });
-    var photoImg = $("#photoImg").attr("src");
-    var oldSn = photoImg.lastIndexOf(".");
-    var oldSuffix = photoImg.substring(oldSn+1,photoImg.length);
-    if(oldSuffix == 'pdf' || oldSuffix == 'PDF'){
-        $("#photoImg").attr("src", Feng.ctxPath + "/static/img/Pdf.png");
-    }
-    $("#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);
-            }
-        };
-    });
 });