Browse Source

人才购房系统

linwu 3 years ago
parent
commit
1317087a1b

+ 119 - 13
app/Http/Controllers/Web/Content/BuyhouseController.php

@@ -13,6 +13,8 @@ use App\Services\Content\NavigationService;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\Cache;
 use Illuminate\Support\Collection;
+use Illuminate\Support\Facades\Storage;
+use Illuminate\Support\Facades\Validator;
 
 
 class BuyhouseController extends WebBaseController
@@ -109,14 +111,14 @@ class BuyhouseController extends WebBaseController
      */
     public function list(Request $request)
     {
-        /*$time         = time();
+        $time         = time();
         $request_post = [
             'idCards' => ['350524198704156033'],
             'sign'    => md5("timestr={$time}&key=rsKVyec52fqEKpk4RRD2TU8fKvPxt6ombKg0qSq1velPQtBHVi"),
             'timeStr' => $time,
         ];
         $res          = https_request('http://rc.jucai.gov.cn/api/dataInterface/findTalentInfoByIdCards', json_encode($request_post), ['Accept:application/json', 'Content-Type:application/json;charset=utf-8']);
-        dd($res);*/
+        dd($res);
 
         $login = $this->checkLogin();
         if ($login) {
@@ -131,7 +133,14 @@ class BuyhouseController extends WebBaseController
         }
 
         //人才判断
-
+        /*$time         = time();
+        $request_post = [
+            'idCards' => ['350524198704156033'],
+            'sign'    => md5("timestr={$time}&key=rsKVyec52fqEKpk4RRD2TU8fKvPxt6ombKg0qSq1velPQtBHVi"),
+            'timeStr' => $time,
+        ];
+        $res          = https_request('http://rc.jucai.gov.cn/api/dataInterface/findTalentInfoByIdCards', json_encode($request_post), ['Accept:application/json', 'Content-Type:application/json;charset=utf-8']);
+        dd($res);*/
 
         //房源信息
         $house = TalentHouse::where('id', $id)->first();
@@ -148,17 +157,21 @@ class BuyhouseController extends WebBaseController
         $apply = TalentHouseApply::where('house_id', $id)->where('user_id', $user_id)->first();
         $check = [];
         if ($apply) {
-            $apply['family']  = json_decode($apply['family'], true);
-            $apply['checked'] = true;
+            $apply['family']             = json_decode($apply['family'], true);
+            $apply['certificates']       = json_decode($apply['certificates'], true);
+            $apply['marry_prove']        = json_decode($apply['marry_prove'], true);
+            $apply['household_register'] = json_decode($apply['household_register'], true);
+            $apply['work_prove']         = json_decode($apply['work_prove'], true);
+            $apply['checked']            = true;
 
             //审核状态
             if ($apply['rs_check_status'] != 2) {
                 $check['status_text'] = '人社局' . $this->apply_status[$apply['rs_check_status']];
-                $check['comment']     = $apply['rs_check_comment'];
+                $check['comment']     = $apply['rs_check_status'] == 1 ? '' : $apply['rs_check_comment'];
                 $check['type']        = $this->check_type[$apply['rs_check_status']];
-            } elseif ($apply['zj_check_status']) {
+            } elseif ($apply['zj_check_status'] != 2) {
                 $check['status_text'] = '住建局' . $this->apply_status[$apply['zj_check_status']];
-                $check['comment']     = $apply['zj_check_comment'];
+                $check['comment']     = $apply['zj_check_status'] == 1 ? '' : $apply['zj_check_comment'];
                 $check['type']        = $this->check_type[$apply['zj_check_status']];
             } else {
                 $check['title']       = '';
@@ -168,8 +181,12 @@ class BuyhouseController extends WebBaseController
             }
         } else {
             $apply = [
-                'family'  => [['relation' => '', 'realname' => '', 'idcard' => '']],
-                'checked' => true,
+                'family'             => [['relation' => '', 'realname' => '', 'idcard' => '']],
+                'checked'            => true,
+                'certificates'       => [],
+                'marry_prove'        => [],
+                'household_register' => [],
+                'work_prove'         => [],
             ];
         }
 
@@ -185,8 +202,9 @@ class BuyhouseController extends WebBaseController
 
     public function listPost(Request $request)
     {
-        $data     = $request->only(['id', 'house_id', 'name', 'mobile', 'native', 'email', 'talent_level', 'talent_card_validity', 'talent_tags', 'talent_condition', 'certificates', 'marry', 'marry_prove', 'household_register', 'family', 'work_prove', 'street', 'house_condition', 'house_policy']);
-        $rules    = [
+        //数据校验
+        $data      = $request->only(['id', 'certificates', 'marry', 'marry_prove', 'household_register', 'family', 'work_prove', 'street', 'house_condition', 'house_policy']);
+        $rules     = [
             'certificates'       => 'required',
             'marry'              => 'required',
             'household_register' => 'required',
@@ -195,7 +213,7 @@ class BuyhouseController extends WebBaseController
             'house_condition'    => 'required',
             'house_policy'       => 'required',
         ];
-        $messages = [
+        $messages  = [
             'certificates.required'       => '请上传证件信息',
             'marry.required'              => '请选择婚姻状况',
             'household_register.required' => '请上传户口本',
@@ -204,11 +222,99 @@ class BuyhouseController extends WebBaseController
             'house_condition.required'    => '请填写家庭成员在晋江市行政区域内住房情况',
             'house_policy.required'       => '请填写在晋享受政策性住房或相关优惠情况',
         ];
+        $validator = Validator::make($data, $rules, $messages);
+        if ($validator->fails()) {
+            $msg = $validator->errors()->all();
+            return response()->json(['status' => 0, 'msg' => $msg[0]]);
+        }
+        if ($data['marry'] > 1 && empty($data['marry_prove'])) {
+            return response()->json(['status' => 0, 'msg' => '请上传婚姻证明']);
+        }
+
+        //报名信息
+        $info = TalentHouseApply::find($data['id']);
+        if (empty($info)) {
+            return response()->json(['status' => 0, 'msg' => '提交格式有误']);
+        }
+
+        //图片
+        $images = ['certificates', 'household_register', 'marry_prove', 'work_prove'];
+        foreach ($images as $image) {
+            if (is_array($data[$image])) {
+                //删除掉没有成功返回路径的图片
+                foreach ($data[$image] as $k => $v) {
+                    if (!array_key_exists('response', $v)) {
+                        unset($data[$image][$k]);
+                    }
+                }
+                $data[$image] = array_values($data[$image]);
+            }
+        }
+
+        //更新数据
+        $info->certificates = json_encode($data['certificates']);
+        $info->marry        = $data['marry'];
+        if ($data['marry'] > 1) {
+            $info->marry_prove = json_encode($data['marry_prove']);
+        }
+        $info->household_register = json_encode($data['household_register']);
+        $info->family             = json_encode($data['family']);
+        $info->work_prove         = json_encode($data['work_prove']);
+        $info->street             = $data['street'];
+        $info->house_condition    = $data['house_condition'];
+        $info->house_policy       = $data['house_policy'];
 
+        //审核状态
+        if ($info->rs_check_status == 3) {
+            $info->rs_check_status = 1;
+        }
+        if ($info->zj_check_status == 3) {
+            $info->zj_check_status = 1;
+        }
+        $info->save();
 
         return response()->json(['status' => 1]);
     }
 
+    public function upload(Request $request)
+    {
+        header('Access-Control-Allow-Origin:*');
+        header('Access-Control-Allow-Methods:GET,POST,PUT,DELETE');
+        header('Access-Control-Allow-Headers:Origin, Content-Type, Cookie, Accept, X-CSRF-TOKEN');
+        header('Access-Control-Allow-Credentials:true');
+
+        $file = $request->file('file');
+        if ($file->isValid()) { //判断文件是否存在
+            //获取文件的扩展名
+            $ext = $file->getClientOriginalExtension();
+
+            if (!in_array(strtolower($ext), ['jpg', 'jpeg', 'png', 'doc', 'docx', 'pdf'])) {
+                $res['status'] = 0;
+                $res['msg']    = '文件格式不正确';
+            } else {
+                //获取文件的绝对路径
+                $path = $file->getRealPath();
+
+                $oldname = $file->getClientOriginalName();
+
+                //定义文件名
+                $filename = 'storage/buyhouse/' . uniqid() . mt_rand(10000, 99999) . '.' . $ext;
+
+                //存储文件。disk里面的public。总的来说,就是调用disk模块里的public配置
+                Storage::disk('public')->put($filename, file_get_contents($path));
+
+                $res['status']   = 1;
+                $res['filename'] = $oldname;
+                $res['path']     = "/storage/" . $filename;
+                $res['msg']      = '上传成功';
+            }
+        } else {
+            $res['status'] = 0;
+            $res['msg']    = '上传失败';
+        }
+        return response()->json($res);
+    }
+
     /**
      * 登录状态
      */

+ 199 - 202
public/themes/default/views/app/content/buyhouse/list.blade.php

@@ -228,24 +228,24 @@
                             <span class="require">*</span>姓名
                         </td>
                         <td valign="center" colspan="3" style="width:300px;">
-                            <el-form-item prop="realname">
-                                <el-input v-model="user.realname" placeholder="请输入您的姓名"></el-input>
+                            <el-form-item>
+                                <el-input v-model="user.name" :disabled="true" placeholder="请输入您的姓名"></el-input>
                             </el-form-item>
                         </td>
                         <td valign="center" style="width:100px;">
                             <span class="require">*</span>联系电话
                         </td>
                         <td valign="center" colspan="3" style="width:300px;">
-                            <el-form-item prop="realname">
-                                <el-input v-model="user.realname" placeholder="请输入您的姓名"></el-input>
+                            <el-form-item>
+                                <el-input v-model="user.mobile" :disabled="true" placeholder="请输入您的联系电话"></el-input>
                             </el-form-item>
                         </td>
                         <td valign="center" style="width:100px;">
                             <span class="require">*</span>籍贯
                         </td>
                         <td valign="center" colspan="3" style="width:300px;">
-                            <el-form-item prop="realname">
-                                <el-input v-model="user.realname" placeholder="请输入您的姓名"></el-input>
+                            <el-form-item>
+                                <el-input v-model="user.native" :disabled="true" placeholder="请输入您的籍贯"></el-input>
                             </el-form-item>
                         </td>
                     </tr>
@@ -254,16 +254,16 @@
                             <span class="require">*</span>电子邮箱
                         </td>
                         <td valign="center" colspan="3">
-                            <el-form-item prop="card">
-                                <el-input v-model="user.card" placeholder="请输入身份证号码 "></el-input>
+                            <el-form-item>
+                                <el-input v-model="user.email" :disabled="true" placeholder="请输入电子邮箱"></el-input>
                             </el-form-item>
                         </td>
                         <td valign="center">
                             <span class="require">*</span>人才层次
                         </td>
                         <td valign="center" colspan="3">
-                            <el-form-item prop="education">
-                                <el-select v-model="user.education" placeholder="请选择人才层次" style="width:100%;">
+                            <el-form-item>
+                                <el-select v-model="user.talent_level" disabled placeholder="请选择人才层次" style="width:100%;">
                                     <el-option label="第一层次" value="第一层次"></el-option>
                                     <el-option label="第二层次" value="第二层次"></el-option>
                                     <el-option label="第三层次" value="第三层次"></el-option>
@@ -278,14 +278,8 @@
                             <span class="require">*</span>人才证有效期
                         </td>
                         <td valign="center" colspan="3">
-                            <el-form-item prop="birthday">
-                                <el-date-picker
-                                        style="width:100%;"
-                                        v-model="user.birthday"
-                                        type="date"
-                                        placeholder="选择您的人才证有效期"
-                                        value-format="yyyy-MM-dd">
-                                </el-date-picker>
+                            <el-form-item>
+                                <el-input v-model="user.talent_card_validity" :disabled="true" placeholder="输入您的人才证有效期"></el-input>
                             </el-form-item>
                         </td>
                     </tr>
@@ -294,8 +288,8 @@
                             <span class="require">*</span>人才标签
                         </td>
                         <td valign="center" colspan="3">
-                            <el-form-item prop="card">
-                                <el-input v-model="user.card" placeholder="请输入身份证号码 "></el-input>
+                            <el-form-item>
+                                <el-input v-model="user.talent_tags" :disabled="true" placeholder="请输入人才标签"></el-input>
                             </el-form-item>
                         </td>
 
@@ -303,8 +297,8 @@
                             <span class="require">*</span>人才认定条件
                         </td>
                         <td valign="center" colspan="6">
-                            <el-form-item prop="house_register">
-                                <el-input v-model="user.house_register" placeholder="请输入户籍所在地"></el-input>
+                            <el-form-item prop="talent_condition">
+                                <el-input v-model="user.talent_condition" :disabled="true" placeholder="请输入人才认定条件"></el-input>
                             </el-form-item>
                         </td>
                     </tr>
@@ -314,13 +308,13 @@
                             (身份证或护照,本人手持证件正、反面照片)
                         </td>
                         <td valign="center" colspan="11">
-                            <el-form-item prop="identification" ref="identification">
+                            <el-form-item prop="certificates">
                                 <div style="padding: 10px 0">
                                     <el-upload
-                                            action="{{ route('recruit.api.upload') }}"
+                                            action="{{ route('buyhouse.upload') }}"
                                             list-type="picture-card"
                                             :data="{_token:'{{csrf_token()}}'}"
-                                            :file-list="user.identification"
+                                            :file-list="user.certificates"
                                             :before-upload="beforeImageUpload"
                                             :on-success="uploadSuccessID"
                                             :multiple="true"
@@ -354,24 +348,24 @@
                             </el-form-item>
                         </td>
                     </tr>
-                    <tr style="height:52px;page-break-inside:avoid">
+                    <tr style="height:52px;page-break-inside:avoid" v-show="user.marry > 1">
                         <td valign="center">
                             <span class="require">*</span>婚姻证明<br/>
                             (结婚证,离婚证,离婚生效文书、丧偶证明等)
                         </td>
                         <td valign="center" colspan="3">
-                            <el-form-item prop="identification" ref="identification">
+                            <el-form-item prop="marry_prove">
                                 <div style="padding: 10px 0">
                                     <el-upload
-                                            action="{{ route('recruit.api.upload') }}"
+                                            action="{{ route('buyhouse.upload') }}"
                                             list-type="picture-card"
                                             :data="{_token:'{{csrf_token()}}'}"
-                                            :file-list="user.identification"
+                                            :file-list="user.marry_prove"
                                             :before-upload="beforeImageUpload"
-                                            :on-success="uploadSuccessID"
+                                            :on-success="uploadSuccessMarry"
                                             :multiple="true"
                                             :on-preview="handlePictureCardPreview"
-                                            :on-remove="removeID">
+                                            :on-remove="removeMarry">
                                         <i class="el-icon-plus"></i>
                                     </el-upload>
                                 </div>
@@ -384,18 +378,18 @@
                             (上传家庭户口本)
                         </td>
                         <td valign="center" colspan="3">
-                            <el-form-item prop="identification" ref="identification">
+                            <el-form-item prop="household_register">
                                 <div style="padding: 10px 0">
                                     <el-upload
-                                            action="{{ route('recruit.api.upload') }}"
+                                            action="{{ route('buyhouse.upload') }}"
                                             list-type="picture-card"
                                             :data="{_token:'{{csrf_token()}}'}"
-                                            :file-list="user.identification"
+                                            :file-list="user.household_register"
                                             :before-upload="beforeImageUpload"
-                                            :on-success="uploadSuccessID"
+                                            :on-success="uploadSuccessHousehold"
                                             :multiple="true"
                                             :on-preview="handlePictureCardPreview"
-                                            :on-remove="removeID">
+                                            :on-remove="removeHousehold">
                                         <i class="el-icon-plus"></i>
                                     </el-upload>
                                 </div>
@@ -462,18 +456,18 @@
                             <a href="" target="_blank" style="color:blue;">点击下载范本</a>
                         </td>
                         <td valign="center" style="width:1000px;">
-                            <el-form-item prop="identification" ref="identification">
+                            <el-form-item prop="work_prove">
                                 <div style="padding: 10px 0">
                                     <el-upload
-                                            action="{{ route('recruit.api.upload') }}"
+                                            action="{{ route('buyhouse.upload') }}"
                                             list-type="picture-card"
                                             :data="{_token:'{{csrf_token()}}'}"
-                                            :file-list="user.identification"
+                                            :file-list="user.work_prove"
                                             :before-upload="beforeImageUpload"
-                                            :on-success="uploadSuccessID"
+                                            :on-success="uploadSuccessWork"
                                             :multiple="true"
                                             :on-preview="handlePictureCardPreview"
-                                            :on-remove="removeID">
+                                            :on-remove="removeWork">
                                         <i class="el-icon-plus"></i>
                                     </el-upload>
                                 </div>
@@ -485,8 +479,8 @@
                             <span class="require">*</span>所属街道
                         </td>
                         <td valign="center">
-                            <el-form-item prop="card">
-                                <el-input v-model="user.card" placeholder="请输入所属街道"></el-input>
+                            <el-form-item prop="street">
+                                <el-input v-model="user.street" placeholder="请输入所属街道"></el-input>
                             </el-form-item>
                         </td>
                     </tr>
@@ -503,8 +497,8 @@
                             <span class="require">*</span>家庭成员在晋江市行政区域内住房情况
                         </td>
                         <td valign="center" colspan="3">
-                            <el-form-item prop="card">
-                                <el-input v-model="user.card" placeholder="请输入情况 "></el-input>
+                            <el-form-item prop="house_condition">
+                                <el-input v-model="user.house_condition" placeholder="请输入情况 "></el-input>
                             </el-form-item>
                         </td>
 
@@ -512,8 +506,8 @@
                             <span class="require">*</span>在晋享受政策性住房或相关优惠情况
                         </td>
                         <td valign="center" colspan="3">
-                            <el-form-item prop="house_register">
-                                <el-input v-model="user.house_register" placeholder="请输入情况"></el-input>
+                            <el-form-item prop="house_policy">
+                                <el-input v-model="user.house_policy" placeholder="请输入情况"></el-input>
                             </el-form-item>
                         </td>
                     </tr>
@@ -523,8 +517,10 @@
                     <tr>
                         <td height="52" colspan="12" style="padding: 10px 0">
                             <p>
-                                本人承诺<a href="" style="color: blue;">《承诺书》</a>:
-                                <el-checkbox v-model="user.checked"></el-checkbox>
+                                <el-form-item prop="checked">
+                                    本人承诺<a href="" style="color: blue;">《承诺书》</a>:
+                                    <el-checkbox v-model="user.checked"></el-checkbox>
+                                </el-form-item>
                             </p>
                             <el-form-item size="large">
                                 <el-button type="success" @click="submit('userForm')">提交申请</el-button>
@@ -534,12 +530,16 @@
                 </table>
             </el-form>
         </div>
+        <el-dialog :visible.sync="imageDialogVisible">
+            <img width="100%" :src="dialogImageUrl" alt="">
+        </el-dialog>
     </div>
 @endsection
 
 @section('script')
     <script type="text/javascript" src="{{theme_asset('app/js/vue.min.js')}}"></script>
     <script src="{{theme_asset('app/js/axios.js')}}"></script>
+    <script src="{{theme_asset('app/js/qs.min.js')}}"></script>
     <script type="text/javascript" src="{{theme_asset('app/js/elementui.min.js')}}"></script>
     <script>
 
@@ -548,155 +548,48 @@
             data() {
                 return {
                     dialogVisible: false,
+                    imageDialogVisible: false,
+                    dialogImageUrl: '',
                     user: {!! $apply !!},
                     post_data: {},
                     rules: {
-                        realname: [
-                            {required: true, message: '请输入您的姓名', trigger: 'blur'}
-                        ],
-                        sex: [
-                            {required: true, message: '请选择性别', trigger: 'change'}
-                        ],
-                        birthday: [
-                            {required: true, message: '请选择出生日期', trigger: 'change'}
-                        ],
-                        avatar: [
-                            {required: true, message: '请上传蓝底/红底近期证件照', trigger: 'change'}
-                        ],
-                        card: [
-                            {required: true, message: '请输入证件号', trigger: 'blur'},
-                            {validator: this.validID, trigger: 'blur'}
-                        ],
-                        nation: [
-                            {required: true, message: '请输入您的民族', trigger: 'blur'}
-                        ],
-                        native_place: [
-                            {required: true, message: '请输入您的籍贯', trigger: 'blur'}
-                        ],
-                        political_affiliation: [
-                            {required: true, message: '请选择您的政治面貌', trigger: 'blur'}
-                        ],
-                        house_register: [
-                            {required: true, message: '请输入您的户籍所在地', trigger: 'blur'}
+                        certificates: [
+                            {validator: this.validCertificates, trigger: 'change'}
                         ],
-                        // edu_type:[
-                        //     {required: true, message: '请选择您的教育类型', trigger: 'change'}
-                        // ],
-                        school: [
-                            {required: true, message: '请输入学校信息', trigger: 'blur'}
+                        marry: [
+                            {required: true, message: '请选择婚姻状况', trigger: 'change'}
                         ],
-                        education: [
-                            {required: true, message: '请输入学历信息', trigger: 'blur'}
+                        marry_prove: [
+                            {validator: this.validMarry, trigger: 'change'}
                         ],
-                        pro: [
-                            {required: true, message: '请输入所学专业', trigger: 'blur'}
+                        household_register: [
+                            {validator: this.validHousehold, trigger: 'change'}
                         ],
-                        mobile: [
-                            {required: true, message: '请输入手机号', trigger: 'blur'},
-                            {validator: this.validMobile, trigger: 'blur'}
+                        family: [
+                            {validator: this.validFamily, trigger: 'blur'}
                         ],
-                        email: [
-                            {required: true, message: '请输入电子邮箱', trigger: 'blur'},
-                            {validator: this.validEmail, trigger: 'blur'}
+                        work_prove: [
+                            {validator: this.validWork, trigger: 'change'}
                         ],
-                        address: [
-                            {required: true, message: '请输入地址', trigger: 'blur'}
+                        street: [
+                            {required: true, message: '请填写所属街道', trigger: 'blur'}
                         ],
-                        post_id: [
-                            {required: true, message: '请选择报名岗位', trigger: 'blur'}
+                        house_condition: [
+                            {required: true, message: '请填写家庭成员在晋江市行政区域内住房情况', trigger: 'blur'}
                         ],
-                        is_push: [
-                            {required: true, message: '请选择是否接送推送', trigger: 'change'}
+                        house_policy: [
+                            {required: true, message: '在晋享受政策性住房或相关优惠情况', trigger: 'blur'}
                         ],
-                        concat_name: [
-                            {required: true, message: '请输入紧急联系人姓名', trigger: 'blur'}
+                        checked: [
+                            {validator: this.validChecked, trigger: 'change'}
                         ],
-                        concat_mobile: [
-                            {required: true, message: '请输入紧急联系人电话', trigger: 'blur'}
-                        ],
-                        @if(in_array('expand_special',$module))
-                        //扩展验证
-                        special_condition: [
-                            {validator: this.validSpecialCondition, trigger: 'blur'}
-                        ],
-                        special_material: [
-                            {validator: this.validSpecialMaterial, trigger: 'change'}
-                        ],
-                        @endif
-                        resume: [
-                            {required: true, message: '请输入个人简历', trigger: 'blur'},
-                        ],
-                        @if(in_array('identification',$module))
-                        //身份验证
-                        identification: [
-                            {validator: this.validIdentification, trigger: 'change'}
-                        ],
-                        @endif
-                                @if(in_array('education_certification',$module))
-                        education_certification: [
-                            {validator: this.validEducertification, trigger: 'change'}
-                        ],
-                        @endif
                     },
-                    political_affiliation: [ //国家关于政治面貌的分类标准
-                        {
-                            value: '01',
-                            label: '中共党员'
-                        },
-                        {
-                            value: '02',
-                            label: '中共预备党员'
-                        },
-                        {
-                            value: '03',
-                            label: '共青团员'
-                        },
-                        {
-                            value: '04',
-                            label: '民革党员'
-                        },
-                        {
-                            value: '05',
-                            label: '民盟盟员'
-                        },
-                        {
-                            value: '06',
-                            label: '民建会员'
-                        },
-                        {
-                            value: '07',
-                            label: '民进会员'
-                        },
-                        {
-                            value: '08',
-                            label: '农工党党员'
-                        },
-                        {
-                            value: '09',
-                            label: '致公党党员'
-                        },
-                        {
-                            value: '10',
-                            label: '九三学社社员'
-                        },
-                        {
-                            value: '11',
-                            label: '台盟盟员'
-                        },
-                        {
-                            value: '12',
-                            label: '无党派人士'
-                        },
-                        {
-                            value: '13',
-                            label: '群众'
-                        }
-                    ],
                     list: [{!!$house!!}],
                     formDisable: false,
                 };
             },
             methods: {
+                //上传相关
                 beforeImageUpload(file) {
                     const isJPG = (file.type === 'image/jpeg' || file.type === 'image/png');
                     const isLt2M = file.size / 1024 / 1024 < 2;
@@ -709,38 +602,102 @@
                     }
                     return isJPG && isLt2M;
                 },
-                uploadSuccess(response, file, fileList) {
+                handlePictureCardPreview(file) {
+                    this.dialogImageUrl = file.url;
+                    this.imageDialogVisible = true;
+                },
+                uploadSuccessID(response, file, fileList) {
                     if (response.status) {
-                        this.user.avatar = response.path;
+                        this.user.certificates = fileList
                     } else {
                         this.$message.error(response.msg);
                     }
                 },
-                uploadSuccessID(response, file, fileList) {
+                removeID(file, fileList) {
+                    this.user.certificates = fileList
+                },
+                uploadSuccessMarry(response, file, fileList) {
                     if (response.status) {
-                        this.user.identification = fileList
+                        this.user.marry_prove = fileList
                     } else {
                         this.$message.error(response.msg);
                     }
                 },
-                handlePictureCardPreview(file) {
-                    this.dialogImageUrl = file.url;
-                    this.dialogVisible = true;
+                removeMarry(file, fileList) {
+                    this.user.marry_prove = fileList
                 },
-                removeID(file, fileList) {
-                    this.user.identification = fileList
+                uploadSuccessHousehold(response, file, fileList) {
+                    if (response.status) {
+                        this.user.household_register = fileList
+                    } else {
+                        this.$message.error(response.msg);
+                    }
+                },
+                removeHousehold(file, fileList) {
+                    this.user.household_register = fileList
+                },
+                uploadSuccessWork(response, file, fileList) {
+                    if (response.status) {
+                        this.user.work_prove = fileList
+                    } else {
+                        this.$message.error(response.msg);
+                    }
+                },
+                removeWork(file, fileList) {
+                    this.user.work_prove = fileList
+                },
+
+                //验证相关
+                validCertificates(rule, value, callback){
+                    if(this.user.certificates.length == 0){
+                        callback(new Error('请上传证件信息'));
+                    }else{
+                        callback();
+                    }
+                },
+                validMarry(rule, value, callback){
+                    if(this.user.marry > 1 && this.user.marry_prove.length == 0){
+                        callback(new Error('请上传婚姻证明'));
+                    }else{
+                        callback();
+                    }
+                },
+                validHousehold(rule, value, callback){
+                    if(this.user.household_register.length == 0){
+                        callback(new Error('请上传户口本'));
+                    }else{
+                        callback();
+                    }
+                },
+                validFamily(rule, value, callback){
+                    if(this.user.family.length == 0){
+                        callback(new Error('请填写家庭成员'));
+                    }else{
+                        callback();
+                    }
                 },
-                postChange(value) {
-                    this.post_limit_value = this.post_limit[value];
+                validWork(rule, value, callback){
+                    if(this.user.work_prove.length == 0){
+                        callback(new Error('请上传人才工作单位'));
+                    }else{
+                        callback();
+                    }
+                },
+                validChecked(rule, value, callback){
+                    if(!this.user.checked){
+                        callback(new Error('请同意承诺书'));
+                    }else{
+                        callback();
+                    }
                 },
 
+
+                //家庭成员
                 addFamily() {
                     this.user.family.push({
-                        appellation: '',
+                        relation: '',
                         realname: '',
-                        birthday: '',
-                        political_attitudes: '',
-                        work: ''
+                        idcard: '',
                     });
                 },
                 delFamily() {
@@ -750,15 +707,55 @@
                     } else {
                         this.$message.error('只剩一条记录,不能再删啦');
                     }
-                }
+                },
+
+                //提交表单
+                submit(formName){
+                    this.user.operation = 2;
+                    this.$refs[formName].validate((valid,object) => {
+                        if (valid) {
+                            var msg = '资料请详细检查!';
+                            this.$confirm(msg, '提示', {
+                                confirmButtonText: '检查无误,确定提交',
+                                cancelButtonText: '我需要再检查一遍',
+                                type: 'warning'
+                            }).then(() => {
+                                this.loading = this.$loading({
+                                    lock: false,
+                                    text: '加载中',
+                                    spinner: 'el-icon-loading',
+                                    background: 'rgba(0, 0, 0, 0.7)'
+                                });
+
+                                this.user._token = '{{csrf_token()}}';
+                                axios.post("{{route('buyhouse.listPost')}}",Qs.stringify(this.user)).then(response => {
+                                    if(response.data.status){
+                                        this.$alert(response.data.msg, '提交成功', {
+                                            confirmButtonText: '确定',
+                                            callback: action => {
+                                                window.location.reload();
+                                            }
+                                        });
+                                    }else{
+                                        this.$message.error(response.data.msg);
+                                        this.loading.close();
+                                        return false;
+                                    }
+                                });
+                            }).catch(() => {
+
+                            });
+
+                        } else {
+                            for(let key in object){
+                                this.$message.error(object[key][0].message);
+                                return false;
+                            }
+                            return false;
+                        }
+                    })
+                },
             },
-            created() {
-                /*axios.post("{{ route('share.getmydata') }}").then(response => {
-                this.loading = false;
-                this.share_list = response.data.data;
-                this.page_total = response.data.total;
-            });*/
-            }
         })
     </script>
 @endsection

+ 2 - 0
routes/web.php

@@ -729,6 +729,8 @@ Route::group([
     //人才购房系统
     $router->any('buyhouse/login', "Web\Content\BuyhouseController@login")->name('buyhouse.login');
     $router->any('buyhouse/list', "Web\Content\BuyhouseController@list")->name('buyhouse.list');
+    $router->post('buyhouse/list_post', "Web\Content\BuyhouseController@listPost")->name('buyhouse.listPost');
+    $router->post('buyhouse/upload', 'Web\Content\BuyhouseController@upload')->name('buyhouse.upload');
 });
 
 /*硬件模块*/