Quellcode durchsuchen

增加户籍证明

zmw vor 1 Jahr
Ursprung
Commit
01a896ed8d

+ 62 - 4
app/Admin/Controllers/Recruit/RecruitController.php

@@ -251,7 +251,7 @@ class RecruitController extends Controller
             $form->number('ordid', '排序')->default(0);
             $form->multipleFile('addFile', '附件')->move('storage/app/public/recruit/' . time());
         })->tab('报名表单与条件', function ($form) {
-            $form->checkbox('forms', '报名表单模块')->options(['basic' => '基础信息模块','expand_special' => '扩展模块-加分','detail' => '详情介绍模块','identification' => '身份证明上传模块','education_certification' => '学历证明上传模块','other_certification' => '其他证明上传模块', 'remark' => '备注模块','chengnuoshu'=>'诚信承诺书','shixin'=>'失信被执行人查询信息页扫描件','baokaoshengming' => '报考声明书','internship' => '实习专场'])->default(['basic'])->setMustMark();
+            $form->checkbox('forms', '报名表单模块')->options(['basic' => '基础信息模块','expand_special' => '扩展模块-加分','detail' => '详情介绍模块','identification' => '身份证明上传模块','education_certification' => '学历证明上传模块','other_certification' => '其他证明上传模块','hj_certification' => '户籍证明上传模块', 'remark' => '备注模块','chengnuoshu'=>'诚信承诺书','shixin'=>'失信被执行人查询信息页扫描件','baokaoshengming' => '报考声明书','internship' => '实习专场'])->default(['basic'])->setMustMark();
             $str = "let num = $(\"#forms\").find(\".checked\").length;
             if(num == 0){
                 alert(\"未选中报名表单模块\");
@@ -932,6 +932,7 @@ class RecruitController extends Controller
             'identification'=>[],
             'education_certification'=>[],
             'other_certification'=>[],
+            'hj_certification'=>[],
         ];
 
         if(in_array('expand_special',$recruit->forms)){
@@ -958,7 +959,7 @@ class RecruitController extends Controller
                 $data->material = [];
             }
         }
-        if(in_array('identification',$recruit->forms) || in_array('internship',$recruit->forms)){
+        if(in_array('identification',$recruit->forms)){
             if(json_decode($data->identification)){
                 $data->identification = json_decode($data->identification);
                 $photo_data = [];
@@ -981,7 +982,7 @@ class RecruitController extends Controller
                 $data->identification = [];
             }
         }
-        if(in_array('education_certification',$recruit->forms) || in_array('internship',$recruit->forms)){
+        if(in_array('education_certification',$recruit->forms)){
             if(json_decode($data->education_certification)){
                 $data->education_certification = json_decode($data->education_certification);
                 $photo_data = [];
@@ -1004,7 +1005,7 @@ class RecruitController extends Controller
                 $data->education_certification = [];
             }
         }
-        if(in_array('other_certification',$recruit->forms) || in_array('internship',$recruit->forms)){
+        if(in_array('other_certification',$recruit->forms)){
             if(json_decode($data->other_certification)){
                 $data->other_certification = json_decode($data->other_certification);
                 $photo_data = [];
@@ -1027,6 +1028,29 @@ class RecruitController extends Controller
                 $data->other_certification = [];
             }
         }
+        if(in_array('hj_certification',$recruit->forms)){
+            if(json_decode($data->hj_certification)){
+                $data->hj_certification = json_decode($data->hj_certification);
+                $photo_data = [];
+                foreach ($data->hj_certification as $k => $v) {
+                    if($v->status){
+                        $photo_data[] = [
+                            'alt' => $v->name,
+                            'pid' => $v->uid,
+                            'src' => $v->response->path,
+                        ];
+                    }
+                }
+                $photos['hj_certification'] = [
+                    'title' => '户籍证明',
+                    'id' => 1,
+                    'start' => 0,
+                    'data' =>$photo_data
+                ];
+            }else{
+                $data->hj_certification = [];
+            }
+        }
         if(in_array('chengnuoshu',$recruit->forms)){
             if(json_decode($data->chengnuoshu)){
                 $data->chengnuoshu = json_decode($data->chengnuoshu);
@@ -2229,6 +2253,23 @@ class RecruitController extends Controller
                         }
                     }
                 }
+                if(in_array('hj_certification',explode(',', $recruit->forms))){
+                    $hj_certification = json_decode($value->hj_certification,true);
+                    if($hj_certification){
+                        foreach ($hj_certification as $k => $v){
+                            if(array_key_exists('response',$v) && array_key_exists('path',$v['response'])){
+                                $old_path = base_path() . "/public/" . $v['response']['path'];
+                            }else{
+                                $old_path = base_path() . "/public/" . $v['url'];
+                            }
+                            if (file_exists($old_path)) {
+                                $basename = basename($old_path);
+                                $new_path = $path . $basename; //iconv("UTF-8", "GBK", $p->picture_name);
+                                copy($old_path, $new_path); //拷贝到新目录
+                            }
+                        }
+                    }
+                }
                 if(empty($value->word_url)){
                     $value->word_url = $this->fetch_word(['recruit_id'=>$recruit_id,'appoint_id'=>$value->id]);
                 }
@@ -2363,6 +2404,9 @@ class RecruitController extends Controller
             if(in_array('other_certification',explode(',', $recruit->forms)) || in_array('internship',explode(',', $recruit->forms))){
                 $header[] = '其他证明';
             }
+            if(in_array('hj_certification',explode(',', $recruit->forms)) || in_array('internship',explode(',', $recruit->forms))){
+                $header[] = '户籍证明';
+            }
             if(in_array('chengnuoshu',explode(',', $recruit->forms))){
                 $header[] = '诚信承诺书';
             }
@@ -2615,6 +2659,20 @@ class RecruitController extends Controller
                     }
                     array_push($item, implode("\r\n", $other_certifications));
                 }
+                if (in_array('hj_certification', explode(',', $recruit->forms))) {
+                    $hj_certification = json_decode($v->hj_certification, true);
+                    $hj_certifications = [];
+                    if(is_array($hj_certification)){
+                        if($hj_certification){
+                            foreach ($hj_certification as $val){
+                                if(array_key_exists('path', $val['response'])){
+                                    array_push($hj_certifications,"https://www.jucai.gov.cn" . $val['response']['path']);
+                                }
+                            }
+                        }
+                    }
+                    array_push($item, implode("\r\n", $hj_certifications));
+                }
                 if (in_array('chengnuoshu', explode(',', $recruit->forms))) {
                     $chengnuoshu = json_decode($v->chengnuoshu, true);
                     $chengnuoshu = [];

+ 72 - 0
app/Http/Controllers/Web/Recruit/IndexController.php

@@ -456,6 +456,19 @@ class IndexController extends WebBaseController
                 }
                 $user_info['other_certification'] = $other_certification;
 
+                if (json_decode($user_info['hj_certification'])) {
+                    $hj_certification = json_decode($user_info['hj_certification'], true);
+                    foreach ($hj_certification as $k => $v) {
+                        if (array_key_exists('response', $v)) {
+                            $hj_certification[$k]['url'] = $v['response']['path'];
+                        }
+
+                    }
+                } else {
+                    $hj_certification = [];
+                }
+                $user_info['hj_certification'] = $hj_certification;
+
                 if (json_decode($user_info['chengnuoshu'])) {
                     $chengnuoshu = json_decode($user_info['chengnuoshu'], true);
                     foreach ($chengnuoshu as $k => $v) {
@@ -603,6 +616,24 @@ class IndexController extends WebBaseController
                     $user_info['other_certification'] = $other_certification;
                 }
 
+                //如果有户籍证明模块
+                if (in_array('hj_certification', $forms)) {
+                    if (json_decode($user_info['hj_certification'])) {
+                        $hj_certification = json_decode($user_info['hj_certification'], true);
+                        foreach ($hj_certification as $k => $v) {
+                            if (array_key_exists('response', $v)) {
+                                if (array_key_exists('path', $v['response'])) {
+                                    $hj_certification[$k]['url'] = $v['response']['path'];
+                                }
+                            }
+
+                        }
+                    } else {
+                        $hj_certification = [];
+                    }
+                    $user_info['hj_certification'] = $hj_certification;
+                }
+
                 //如果有承诺书模块
                 if (in_array('chengnuoshu', $forms)) {
                     if (json_decode($user_info['chengnuoshu'])) {
@@ -714,6 +745,7 @@ class IndexController extends WebBaseController
                     'identification'          => [],
                     'education_certification' => [],
                     'other_certification'     => [],
+                    'hj_certification'        => [],
                     'chengnuoshu'             => [],
                     'baokaoshengming'         => [],
                     'shixin'                  => [],
@@ -751,6 +783,9 @@ class IndexController extends WebBaseController
                 if (in_array('other_certification', $forms)) {
                     $user_info['other_certification'] = [];
                 }
+                if (in_array('hj_certification', $forms)) {
+                    $user_info['hj_certification'] = [];
+                }
                 if (in_array('chengnuoshu', $forms)) {
                     $user_info['chengnuoshu'] = [];
                 }
@@ -1170,6 +1205,24 @@ class IndexController extends WebBaseController
                     }
                 }
 
+                //如果有其他证明模块
+                if (in_array('hj_certification', $forms)) {
+                    $hj_certification = $request->input('hj_certification');
+                    if (is_array($hj_certification)) {
+                        //删除掉没有成功返回路径的图片
+                        foreach ($hj_certification as $k => $v) {
+                            if (!array_key_exists('response', $v)) {
+                                unset($hj_certification[$k]);
+                            }
+                        }
+                    }
+
+                    if ($hj_certification) {
+                        $appoint_info->hj_certification = json_encode($hj_certification);
+                        $appoint_info->save();
+                    }
+                }
+
                 //如果有承诺书模块
                 if (in_array('chengnuoshu', $forms)) {
                     $chengnuoshu = $request->input('chengnuoshu');
@@ -1377,6 +1430,25 @@ class IndexController extends WebBaseController
                     }
                 }
 
+                //如果有户籍证明模块
+                if (in_array('hj_certification', $forms)) {
+                    $hj_certification = $request->input('hj_certification');
+
+                    if ($hj_certification) {
+                        if (is_array($hj_certification)) {
+                            //删除掉没有成功返回路径的图片
+                            foreach ($hj_certification as $k => $v) {
+                                if (!array_key_exists('response', $v)) {
+                                    unset($hj_certification[$k]);
+                                }
+                            }
+                        }
+
+                        $result->hj_certification = json_encode($hj_certification);
+                        $result->save();
+                    }
+                }
+
                 //如果有承诺书模块
                 if (in_array('chengnuoshu', $forms)) {
                     $chengnuoshu = $request->input('chengnuoshu');

+ 16 - 0
public/themes/default/views/app/recruit/preview.blade.php

@@ -929,6 +929,22 @@
                             </td>
                         </tr>
                     @endif
+                    @if(in_array('hj_certification',$module))
+                        <tr style="height:52px;page-break-inside:avoid">
+                            <td valign="center" >
+                                户籍证明
+                            </td>
+                            <td valign="center" colspan="11">
+                                <div style="padding: 10px 0">
+                                    <el-upload
+                                            action="{{ route('recruit.api.upload') }}"
+                                            list-type="picture-card">
+                                        <i class="el-icon-plus"></i>
+                                    </el-upload>
+                                </div>
+                            </td>
+                        </tr>
+                    @endif
                     @if(in_array('chengnuoshu',$module))
                         <tr style="height:52px;page-break-inside:avoid">
                             <td valign="center" >

+ 45 - 0
public/themes/default/views/app/recruit/sign_up.blade.php

@@ -1052,6 +1052,29 @@
                             </td>
                         </tr>
                     @endif
+                    @if(in_array('hj_certification',$module))
+                        <tr style="height:52px;page-break-inside:avoid">
+                            <td valign="center" >
+                                <span class="require">*</span>户籍证明
+                            </td>
+                            <td valign="center" colspan="11">
+                                <div style="padding: 10px 0">
+                                    <el-upload
+                                            action="{{ route('recruit.api.upload') }}"
+                                            list-type="picture-card"
+                                            :data="{_token:'{{csrf_token()}}'}"
+                                            :file-list="user.hj_certification"
+                                            :before-upload="beforeImageUpload"
+                                            :on-success="uploadSuccessHj"
+                                            :multiple="true"
+                                            :on-preview="handlePictureCardPreview"
+                                            :on-remove="removeHJ">
+                                        <i class="el-icon-plus"></i>
+                                    </el-upload>
+                                </div>
+                            </td>
+                        </tr>
+                    @endif
                     @if(in_array('chengnuoshu',$module))
                         <tr style="height:52px;page-break-inside:avoid">
                             <td valign="center" >
@@ -1826,6 +1849,11 @@
                             {validator:this.validEducertification, trigger: 'change'}
                         ],
                         @endif
+                        @if(in_array('hj_certification',$module))
+                        hj_certification:[
+                            {validator:this.validHJcertification, trigger: 'change'}
+                        ],
+                        @endif
                         @if(in_array('chengnuoshu',$module))
                         chengnuoshu:[
                             {validator:this.validCNS, trigger: 'change'}
@@ -1984,6 +2012,13 @@
                         callback();
                     }
                 },
+                validHJcertification(rule, value, callback){
+                    if(this.user.hj_certification.length == 0){
+                        callback(new Error('请上传户籍证明证件'));
+                    }else{
+                        callback();
+                    }
+                },
                 validCNS(rule, value, callback){
                     if(this.user.chengnuoshu.length == 0){
                         callback(new Error('请上传诚信承诺书'));
@@ -2045,6 +2080,13 @@
                         this.$message.error(response.msg);
                     }
                 },
+                uploadSuccessHJ(response, file, fileList){
+                    if(response.status){
+                        this.user.hj_certification = fileList
+                    }else{
+                        this.$message.error(response.msg);
+                    }
+                },
                 uploadSuccessOther(response, file, fileList){
                     if(response.status){
                         this.user.other_certification = fileList
@@ -2082,6 +2124,9 @@
                 removeEDU(file,fileList) {
                     this.user.education_certification = fileList
                 },
+                removeHJ(file,fileList) {
+                    this.user.hj_certification = fileList
+                },
                 removeOther(file,fileList) {
                     this.user.other_certification = fileList
                 },

+ 17 - 0
resources/views/admin/recruit/manageajax_userinfo.blade.php

@@ -767,6 +767,23 @@
             </td>
         </tr>
     @endif
+    @if(in_array('hj_certification',$recruit->forms))
+        <tr style="height:52px;page-break-inside:avoid">
+            <td valign="center">
+                户籍证明
+            </td>
+            <td valign="center" colspan="11">
+                <div style="padding: 10px 0">
+                    @foreach($appointinfo->hj_certification as $k => $v)
+                        @if(!empty($v))
+                            <img class="attchment" data-key="{{$k}}" data-name="hj_certification"
+                                 src="{{ $v->response->path }}?v=1"/>
+                        @endif
+                    @endforeach
+                </div>
+            </td>
+        </tr>
+    @endif
     @if(in_array('chengnuoshu',$recruit->forms))
         <tr style="height:52px;page-break-inside:avoid">
             <td valign="center">