Przeglądaj źródła

人才申报中年龄判断修改为周岁(足年足月),去掉劳动合同时间切换单日期双日期的功能

sugangqiang 2 lat temu
rodzic
commit
d6045a45a6

+ 6 - 4
app/enterprise/controller/Talent.php

@@ -390,10 +390,12 @@ class Talent extends EnterpriseController {
             }
             $age = 0;
             if ($params["birthday"]) {
-                $birthday = $params["birthday"];
-                $birthdayYear = substr($birthday, 0, 4);
+                $birthtime = strtotime($params["birthday"]);
                 $currentYear = date("Y");
-                $age = $currentYear - $birthdayYear;
+                $currentMonth = date("n");
+                $birthdayYear = date("Y", $birthtime);
+                $birthdayMonth = date("n", $birthtime);
+                $age = ($currentYear * 12 + $currentMonth - $birthdayYear * 12 - $birthdayMonth) / 12;
             }
             $ft_ids = [];
             $deletes = [];
@@ -634,7 +636,7 @@ class Talent extends EnterpriseController {
                 $headimg = $request->file("photo");
                 $upload = new \app\common\api\UploadApi();
                 $result = $upload->uploadOne($headimg, "image", "talent/photo");
-                if($result->code != 200){
+                if ($result->code != 200) {
                     throw new ValidateException($result->msg);
                 }
                 $file = imagecreatefromstring(file_get_contents("storage/" . $result->filepath));

+ 1 - 1
app/enterprise/validate/TalentInfo.php

@@ -23,7 +23,7 @@ class TalentInfo extends Validate {
         "nationality" => "checkInSelect:nationality,cn,cn_hk,cn_mc,cn_tw,us,en,jp,co,nl,sg,other",
         "talent_type" => "between:1,3",
         "tax_insurance_month" => "checkRangeDate:tax_insurance_month",
-        //"labor_contract_rangetime" => "checkRangeDate:labor_contract_rangetime",
+        "labor_contract_rangetime" => "checkRangeDate:labor_contract_rangetime",
         "fst_work_time" => "dateFormat:Y-m-d",
         "pre_import_type" => "between:1,2",
         "return" => "between:0,2",

+ 1 - 5
app/enterprise/view/talent/apply.html

@@ -258,12 +258,8 @@
                                                 </td>
                                                 <td>
                                                     <div class="rowGroup">
-                                                        <label class=" control-label spacing td-label"><span style="color: red">*</span>劳动合同起止时间&nbsp;&nbsp;(<a style="color:#0346e4;" onclick="TalentInfoInfoDlg.switchDateAndRangeDate('labor_contract_rangetime')">切换{if condition="strtotime($row['labor_contract_rangetime'])"}日期范围模式{else/}无固定期限模式{/if}</a>)</label>
-                                                        {if condition="strtotime($row['labor_contract_rangetime'])"}
-                                                        <input type="text" class="form-control date" id="labor_contract_rangetime" name="labor_contract_rangetime" value="{$row.labor_contract_rangetime}" />
-                                                        {else/}
+                                                        <label class=" control-label spacing td-label"><span style="color: red">*</span>劳动合同起止时间</label>
                                                         <input type="text" class="form-control rangedate" id="labor_contract_rangetime" name="labor_contract_rangetime" value="{$row.labor_contract_rangetime}" />
-                                                        {/if}
                                                     </div>
                                                 </td>
                                             </tr>                                    

+ 13 - 3
public/static/modular/gate/talentInfo/new_talentInfo_info.js

@@ -697,9 +697,19 @@ TalentInfoInfoDlg.afterSelectCity = function () {
 
 TalentInfoInfoDlg.isAgeChecked = false;
 TalentInfoInfoDlg.birthdayChange = function () {
-    let birthday = parseInt($("#birthday").val().substring(0, 4));
-    let currentYear = parseInt(new Date().getFullYear());
-    let age = currentYear - (isNaN(birthday) ? 0 : birthday);
+    let age = 18;
+    if ($("#birthday").val()) {
+        let birthDate = new Date($("#birthday").val());//生日日期
+        let birthYear = birthDate.getFullYear();
+        let birthMonth = birthDate.getMonth() + 1;
+        let currentDate = new Date();//当前日期
+        let currentYear = currentDate.getFullYear();
+        let currentMonth = currentDate.getMonth() + 1;
+        age = (currentYear * 12 + currentMonth - birthYear * 12 - birthMonth) / 12;
+    }
+    /*let birthday = parseInt($("#birthday").val().substring(0, 4));
+     let currentYear = parseInt(new Date().getFullYear());
+     let age = currentYear - (isNaN(birthday) ? 0 : birthday);*/
     let option = $("[data-rel=birthday]");
     let limitAge = option.data("option");
     if (age >= limitAge) {