浏览代码

修改校验

yangg 1 月之前
父节点
当前提交
560f344f0b
共有 2 个文件被更改,包括 434 次插入2 次删除
  1. 239 2
      pages/Personal/Personal.vue
  2. 195 0
      unpackage/dist/dev/mp-weixin/pages/Personal/Personal.js

+ 239 - 2
pages/Personal/Personal.vue

@@ -1166,6 +1166,91 @@ import { apiBaseUrl } from '@/common/config.js';
 					return;
 				}
 				
+				// 检查每个工作经历的必填字段
+				for (let i = 0; i < this.workList.length; i++) {
+					const work = this.workList[i];
+					
+					// 检查起止时间
+					if (!work.startTime) {
+						uni.showToast({
+							title: `单位${i+1}:请选择开始时间`,
+							icon: 'none'
+						});
+						return false;
+					}
+					
+					if (!work.endTime) {
+						uni.showToast({
+							title: `单位${i+1}:请选择结束时间`,
+							icon: 'none'
+						});
+						return false;
+					}
+					
+					// 检查单位名称
+					if (!work.companyName) {
+						uni.showToast({
+							title: `单位${i+1}:请输入单位名称`,
+							icon: 'none'
+						});
+						return false;
+					}
+					
+					// 检查任职部门
+					if (!work.department) {
+						uni.showToast({
+							title: `单位${i+1}:请输入任职部门`,
+							icon: 'none'
+						});
+						return false;
+					}
+					
+					// 检查单位人数
+					if (!work.employeeCount) {
+						uni.showToast({
+							title: `单位${i+1}:请输入单位人数`,
+							icon: 'none'
+						});
+						return false;
+					}
+					
+					// 检查担任职务
+					if (!work.position) {
+						uni.showToast({
+							title: `单位${i+1}:请输入担任职务`,
+							icon: 'none'
+						});
+						return false;
+					}
+					
+					// 检查月总收入
+					if (!work.monthlySalary) {
+						uni.showToast({
+							title: `单位${i+1}:请输入月总收入`,
+							icon: 'none'
+						});
+						return false;
+					}
+					
+					// 检查直接领导
+					if (!work.supervisor) {
+						uni.showToast({
+							title: `单位${i+1}:请输入直接领导姓名`,
+							icon: 'none'
+						});
+						return false;
+					}
+					
+					// 检查领导电话
+					if (!work.supervisorPhone) {
+						uni.showToast({
+							title: `单位${i+1}:请输入领导电话`,
+							icon: 'none'
+						});
+						return false;
+					}
+				}
+				
 				// 构建提交数据结构
 				const submitData = {
 					tenant_id: 1,
@@ -1453,9 +1538,63 @@ import { apiBaseUrl } from '@/common/config.js';
 							});
 							return false;
 						}
+						// 添加对手机号的验证
+						if (!this.formData.phone) {
+							uni.showToast({
+								title: '请输入手机号',
+								icon: 'none'
+							});
+							return false;
+						}
+						// 添加对身份证号的验证
+						if (!this.formData.idCard) {
+							uni.showToast({
+								title: '请输入身份证号',
+								icon: 'none'
+							});
+							return false;
+						}
+						// 添加对政治面貌的验证
+						if (this.politicalIndex === -1) {
+							uni.showToast({
+								title: '请选择政治面貌',
+								icon: 'none'
+							});
+							return false;
+						}
+						// 添加对民族的验证
+						if (this.ethnicIndex === -1) {
+							uni.showToast({
+								title: '请选择民族',
+								icon: 'none'
+							});
+							return false;
+						}
+						// 添加对婚育状况的验证
+						if (this.marriageIndex === -1) {
+							uni.showToast({
+								title: '请选择婚育状况',
+								icon: 'none'
+							});
+							return false;
+						}
 						return true;
 						
 					case 2: // 紧急联系人信息
+						if (!this.formData.email) {
+							uni.showToast({
+								title: '请输入电子邮箱',
+								icon: 'none'
+							});
+							return false;
+						}
+						if (!this.formData.currentAddress) {
+							uni.showToast({
+								title: '请输入现居住地址',
+								icon: 'none'
+							});
+							return false;
+						}
 						if (!this.formData.emergencyContact) {
 							uni.showToast({
 								title: '请输入紧急联系人',
@@ -1519,11 +1658,23 @@ import { apiBaseUrl } from '@/common/config.js';
 						return true;
 						
 					case 6: // 专业技能
-						// 专业技能可以选填
+						if (!this.formData.skills) {
+							uni.showToast({
+								title: '请描述您的专业技能',
+								icon: 'none'
+							});
+							return false;
+						}
 						return true;
 						
 					case 7: // 培训经历
-						// 培训经历可以选填
+						if (!this.formData.training) {
+							uni.showToast({
+								title: '请描述您接受过的培训经历',
+								icon: 'none'
+							});
+							return false;
+						}
 						return true;
 						
 					case 8: // 工作经历
@@ -1534,6 +1685,92 @@ import { apiBaseUrl } from '@/common/config.js';
 							});
 							return false;
 						}
+						
+						// 检查每个工作经历的必填字段
+						for (let i = 0; i < this.workList.length; i++) {
+							const work = this.workList[i];
+							
+							// 检查起止时间
+							if (!work.startTime) {
+								uni.showToast({
+									title: `单位${i+1}:请选择开始时间`,
+									icon: 'none'
+								});
+								return false;
+							}
+							
+							if (!work.endTime) {
+								uni.showToast({
+									title: `单位${i+1}:请选择结束时间`,
+									icon: 'none'
+								});
+								return false;
+							}
+							
+							// 检查单位名称
+							if (!work.companyName) {
+								uni.showToast({
+									title: `单位${i+1}:请输入单位名称`,
+									icon: 'none'
+								});
+								return false;
+							}
+							
+							// 检查任职部门
+							if (!work.department) {
+								uni.showToast({
+									title: `单位${i+1}:请输入任职部门`,
+									icon: 'none'
+								});
+								return false;
+							}
+							
+							// 检查单位人数
+							if (!work.employeeCount) {
+								uni.showToast({
+									title: `单位${i+1}:请输入单位人数`,
+									icon: 'none'
+								});
+								return false;
+							}
+							
+							// 检查担任职务
+							if (!work.position) {
+								uni.showToast({
+									title: `单位${i+1}:请输入担任职务`,
+									icon: 'none'
+								});
+								return false;
+							}
+							
+							// 检查月总收入
+							if (!work.monthlySalary) {
+								uni.showToast({
+									title: `单位${i+1}:请输入月总收入`,
+									icon: 'none'
+								});
+								return false;
+							}
+							
+							// 检查直接领导
+							if (!work.supervisor) {
+								uni.showToast({
+									title: `单位${i+1}:请输入直接领导姓名`,
+									icon: 'none'
+								});
+								return false;
+							}
+							
+							// 检查领导电话
+							if (!work.supervisorPhone) {
+								uni.showToast({
+									title: `单位${i+1}:请输入领导电话`,
+									icon: 'none'
+								});
+								return false;
+							}
+						}
+						
 						return true;
 						
 					default:

+ 195 - 0
unpackage/dist/dev/mp-weixin/pages/Personal/Personal.js

@@ -532,6 +532,72 @@ const _sfc_main = {
         });
         return;
       }
+      for (let i = 0; i < this.workList.length; i++) {
+        const work = this.workList[i];
+        if (!work.startTime) {
+          common_vendor.index.showToast({
+            title: `单位${i + 1}:请选择开始时间`,
+            icon: "none"
+          });
+          return false;
+        }
+        if (!work.endTime) {
+          common_vendor.index.showToast({
+            title: `单位${i + 1}:请选择结束时间`,
+            icon: "none"
+          });
+          return false;
+        }
+        if (!work.companyName) {
+          common_vendor.index.showToast({
+            title: `单位${i + 1}:请输入单位名称`,
+            icon: "none"
+          });
+          return false;
+        }
+        if (!work.department) {
+          common_vendor.index.showToast({
+            title: `单位${i + 1}:请输入任职部门`,
+            icon: "none"
+          });
+          return false;
+        }
+        if (!work.employeeCount) {
+          common_vendor.index.showToast({
+            title: `单位${i + 1}:请输入单位人数`,
+            icon: "none"
+          });
+          return false;
+        }
+        if (!work.position) {
+          common_vendor.index.showToast({
+            title: `单位${i + 1}:请输入担任职务`,
+            icon: "none"
+          });
+          return false;
+        }
+        if (!work.monthlySalary) {
+          common_vendor.index.showToast({
+            title: `单位${i + 1}:请输入月总收入`,
+            icon: "none"
+          });
+          return false;
+        }
+        if (!work.supervisor) {
+          common_vendor.index.showToast({
+            title: `单位${i + 1}:请输入直接领导姓名`,
+            icon: "none"
+          });
+          return false;
+        }
+        if (!work.supervisorPhone) {
+          common_vendor.index.showToast({
+            title: `单位${i + 1}:请输入领导电话`,
+            icon: "none"
+          });
+          return false;
+        }
+      }
       const submitData = {
         tenant_id: 1,
         user_id: JSON.parse(common_vendor.index.getStorageSync("userInfo")).id,
@@ -755,8 +821,57 @@ const _sfc_main = {
             });
             return false;
           }
+          if (!this.formData.phone) {
+            common_vendor.index.showToast({
+              title: "请输入手机号",
+              icon: "none"
+            });
+            return false;
+          }
+          if (!this.formData.idCard) {
+            common_vendor.index.showToast({
+              title: "请输入身份证号",
+              icon: "none"
+            });
+            return false;
+          }
+          if (this.politicalIndex === -1) {
+            common_vendor.index.showToast({
+              title: "请选择政治面貌",
+              icon: "none"
+            });
+            return false;
+          }
+          if (this.ethnicIndex === -1) {
+            common_vendor.index.showToast({
+              title: "请选择民族",
+              icon: "none"
+            });
+            return false;
+          }
+          if (this.marriageIndex === -1) {
+            common_vendor.index.showToast({
+              title: "请选择婚育状况",
+              icon: "none"
+            });
+            return false;
+          }
           return true;
         case 2:
+          if (!this.formData.email) {
+            common_vendor.index.showToast({
+              title: "请输入电子邮箱",
+              icon: "none"
+            });
+            return false;
+          }
+          if (!this.formData.currentAddress) {
+            common_vendor.index.showToast({
+              title: "请输入现居住地址",
+              icon: "none"
+            });
+            return false;
+          }
           if (!this.formData.emergencyContact) {
             common_vendor.index.showToast({
               title: "请输入紧急联系人",
@@ -816,8 +931,22 @@ const _sfc_main = {
           }
           return true;
         case 6:
+          if (!this.formData.skills) {
+            common_vendor.index.showToast({
+              title: "请描述您的专业技能",
+              icon: "none"
+            });
+            return false;
+          }
           return true;
         case 7:
+          if (!this.formData.training) {
+            common_vendor.index.showToast({
+              title: "请描述您接受过的培训经历",
+              icon: "none"
+            });
+            return false;
+          }
           return true;
         case 8:
           if (this.workList.length === 0) {
@@ -827,6 +956,72 @@ const _sfc_main = {
             });
             return false;
           }
+          for (let i = 0; i < this.workList.length; i++) {
+            const work = this.workList[i];
+            if (!work.startTime) {
+              common_vendor.index.showToast({
+                title: `单位${i + 1}:请选择开始时间`,
+                icon: "none"
+              });
+              return false;
+            }
+            if (!work.endTime) {
+              common_vendor.index.showToast({
+                title: `单位${i + 1}:请选择结束时间`,
+                icon: "none"
+              });
+              return false;
+            }
+            if (!work.companyName) {
+              common_vendor.index.showToast({
+                title: `单位${i + 1}:请输入单位名称`,
+                icon: "none"
+              });
+              return false;
+            }
+            if (!work.department) {
+              common_vendor.index.showToast({
+                title: `单位${i + 1}:请输入任职部门`,
+                icon: "none"
+              });
+              return false;
+            }
+            if (!work.employeeCount) {
+              common_vendor.index.showToast({
+                title: `单位${i + 1}:请输入单位人数`,
+                icon: "none"
+              });
+              return false;
+            }
+            if (!work.position) {
+              common_vendor.index.showToast({
+                title: `单位${i + 1}:请输入担任职务`,
+                icon: "none"
+              });
+              return false;
+            }
+            if (!work.monthlySalary) {
+              common_vendor.index.showToast({
+                title: `单位${i + 1}:请输入月总收入`,
+                icon: "none"
+              });
+              return false;
+            }
+            if (!work.supervisor) {
+              common_vendor.index.showToast({
+                title: `单位${i + 1}:请输入直接领导姓名`,
+                icon: "none"
+              });
+              return false;
+            }
+            if (!work.supervisorPhone) {
+              common_vendor.index.showToast({
+                title: `单位${i + 1}:请输入领导电话`,
+                icon: "none"
+              });
+              return false;
+            }
+          }
           return true;
         default:
           return true;