Explorar o código

简历bug修复

wkw hai 7 meses
pai
achega
3bb21f3d8e
Modificáronse 1 ficheiros con 70 adicións e 57 borrados
  1. 70 57
      src/views/resume/addResume.vue

+ 70 - 57
src/views/resume/addResume.vue

@@ -420,7 +420,7 @@
                     </div>
                 </div>
                 <!----------------------------  工作经历 ---------------------------------->
-                <div v-if="resumesId" class="info-boxsWork flex align-center justify-center">
+                <div class="info-boxsWork flex align-center justify-center">
                     <div class="info-boxsWorks">
                         <div class="info-boxsWorks-title flex align-center justify-between">
                             工作经历
@@ -621,7 +621,7 @@
                     </div>
                 </div>
                 <!----------------------------  教育经历 ---------------------------------->
-                <div v-if="resumesId" class="info-boxsWork flex align-center justify-center">
+                <div class="info-boxsWork flex align-center justify-center">
                     <div class="info-boxsWorks">
                         <div class="info-boxsWorks-title flex align-center justify-between">
                             教育经历
@@ -1078,6 +1078,7 @@ export default {
             // 工作经历相关数据,定义为响应式属性
             workExps: [], // 工作经历列表
             workExpList: [],// 工作经历详细信息列表
+            eduList: [], // 教育经历列表
         };
     },
     computed: {
@@ -1280,13 +1281,13 @@ export default {
                             this.form.resumesCompensation =
                                 resumeData.resumesCompensation || '';
                             this.form.city = resumeData.city || '';
-                            this.form.birthday = resumeData.birthday || '';
-                            this.form.resumesAttachment =
-                                resumeData.resumesAttachment || '';
-                            this.form.resumesImage =
-                                resumeData.resumesImage || '';
-                            this.form.resumesImageName =
-                                resumeData.resumesImageName || '';
+                            // this.form.birthday = resumeData.birthday || '';
+                            // this.form.resumesAttachment =
+                            //     resumeData.resumesAttachment || '';
+                            // this.form.resumesImage =
+                            //     resumeData.resumesImage || '';
+                            // this.form.resumesImageName =
+                            //     resumeData.resumesImageName || '';
                             this.resumesStatus = resumeData.resumesStatus;
                             this.resumesId = resumeData.resumesId;
                         }
@@ -2151,42 +2152,44 @@ export default {
             formResume.validate(valid => {
                 if (valid) {
                     // 额外的字段验证
-                    if (!this.form.resumesName) {
+                    // if (!this.form.resumesName) {
+                    //     ElMessage({
+                    //         message: '用户名不能为空',
+                    //         type: 'warning',
+                    //         duration: 1500,
+                    //         offset: this.screenHeight / 2
+                    //     });
+                    //     return;
+                    // } else if (!this.form.resumesPhone) {
+                    //     ElMessage({
+                    //         message: '联系电话不能为空',
+                    //         type: 'warning',
+                    //         duration: 1500,
+                    //         offset: this.screenHeight / 2
+                    //     });
+                    //     return;
+                    // } 
+                   if (!this.form.resumesAge) {
                         ElMessage({
-                            message: '用户名不能为空',
+                            message: '年龄不能为空',
                             type: 'warning',
                             duration: 1500,
                             offset: this.screenHeight / 2
                         });
                         return;
-                    } else if (!this.form.resumesPhone) {
-                        ElMessage({
-                            message: '联系电话不能为空',
-                            type: 'warning',
-                            duration: 1500,
-                            offset: this.screenHeight / 2
-                        });
-                        return;
-                    } else if (!this.form.birthday) {
-                        ElMessage({
-                            message: '生日不能为空',
-                            type: 'warning',
-                            duration: 1500,
-                            offset: this.screenHeight / 2
-                        });
-                        return;
-                    } else if (!this.form.resumesEmail) {
-                        ElMessage({
-                            message: '邮箱不能为空',
-                            type: 'warning',
-                            duration: 1500,
-                            offset: this.screenHeight / 2
-                        });
-                        return;
-                    }
+                    } 
+                    // else if (!this.form.resumesEmail) {
+                    //     ElMessage({
+                    //         message: '邮箱不能为空',
+                    //         type: 'warning',
+                    //         duration: 1500,
+                    //         offset: this.screenHeight / 2
+                    //     });
+                    //     return;
+                    // }
                     
                     // 计算年龄
-                    this.form.resumesAge = this.calculateAgeFromBirthday(this.form.birthday) || 0;
+                    // this.form.resumesAge = this.calculateAgeFromBirthday(this.form.birthday) || 0;
                     
                     let that = this;
                     ElMessageBox.confirm('确定保存信息', '温馨提示', {
@@ -2201,7 +2204,8 @@ export default {
                             avatar: that.userEntity.avatar || '',
                             sex: that.form.resumesSex,
                             age: that.form.resumesAge,
-                            weChatNum: that.form.weChatNum || ''
+                            phone: this.form.resumesPhone
+                            // weChatNum: that.form.weChatNum || ''
                         },{type:'json'}).then(res => {
                             if (res.code === 0) {
                                 // 用户信息更新成功后,更新简历信息
@@ -2226,8 +2230,9 @@ export default {
         setResume() {
             let data = {
                 resumesStatus: this.form.resumesStatus,
-                resumesPhone: this.form.resumesPhone,
-                birthday: this.form.birthday,
+                // resumesPhone: this.form.resumesPhone,
+                // resumesAge: this.form.resumesAge,
+                birthday: this.getBirthDateByAge(this.form.resumesAge),
                 resumesEmail: this.form.resumesEmail,
                 ifExp: this.form.resumesWorkExperience ? 1 : 0
             };
@@ -2258,17 +2263,25 @@ export default {
                 }
             });
         },
-        // 计算年龄
-        calculateAgeFromBirthday(birthday) {
-            if (!birthday) return 0;
-            let birthDate = new Date(birthday);
-            let nowDate = new Date();
-            let age = nowDate.getFullYear() - birthDate.getFullYear();
-            if (nowDate.getMonth() < birthDate.getMonth() || (nowDate.getMonth() === birthDate.getMonth() && nowDate.getDate() < birthDate.getDate())) {
-                age--;
-            }
-            return age;
+        getBirthDateByAge(age) {
+            const today = new Date()
+            const birth = new Date(today.getFullYear() - age, today.getMonth(), today.getDate())
+            const y = birth.getFullYear()
+            const m = String(birth.getMonth() + 1).padStart(2, '0')
+            const d = String(birth.getDate()).padStart(2, '0')
+            return `${y}-${m}-${d}`
         },
+        // 计算年龄
+        // calculateAgeFromBirthday(birthday) {
+        //     if (!birthday) return 0;
+        //     let birthDate = new Date(birthday);
+        //     let nowDate = new Date();
+        //     let age = nowDate.getFullYear() - birthDate.getFullYear();
+        //     if (nowDate.getMonth() < birthDate.getMonth() || (nowDate.getMonth() === birthDate.getMonth() && nowDate.getDate() < birthDate.getDate())) {
+        //         age--;
+        //     }
+        //     return age;
+        // },
         // 获取最高学历的学校和专业
         getHighestEducation() {
             if (!this.eduList || this.eduList.length === 0) {
@@ -2372,13 +2385,13 @@ export default {
                                 resumeData.resumesCompensation || '';
                             this.form.city = resumeData.city || '';
                             // 同步其他需要的字段
-                            this.form.birthday = resumeData.birthday || '';
-                            this.form.resumesAttachment =
-                                resumeData.resumesAttachment || '';
-                            this.form.resumesImage =
-                                resumeData.resumesImage || '';
-                            this.form.resumesImageName =
-                                resumeData.resumesImageName || '';
+                            // this.form.birthday = resumeData.birthday || '';
+                            // this.form.resumesAttachment =
+                            //     resumeData.resumesAttachment || '';
+                            // this.form.resumesImage =
+                            //     resumeData.resumesImage || '';
+                            // this.form.resumesImageName =
+                            //     resumeData.resumesImageName || '';
 
                             // 更新性别选择的当前值
                             this.current = resumeData.resumesSex || 1;