123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914 |
- "use strict";
- const common_vendor = require("../../common/vendor.js");
- const common_config = require("../../common/config.js");
- const _sfc_main = {
- data() {
- return {
- // 添加承诺书相关数据
- showPromiseModal: true,
- promiseChecked: false,
- formData: {
- name: "",
- gender: "",
- threePeriod: "",
- birthDate: "",
- idCard: "",
- political: "",
- ethnic: "",
- height: "",
- weight: "",
- nativePlace: "",
- residence: "",
- marriage: "",
- expectedSalary: "",
- phone: "",
- email: "",
- currentAddress: "",
- emergencyContact: "",
- emergencyPhone: "",
- hobby: "",
- motto: "",
- // 添加应聘来源相关字段
- sourceType: "social",
- // 默认为社招
- socialSource: "",
- // 社招来源
- otherSocialSource: "",
- // 其他社招来源
- otherSchoolSource: "",
- // 其他学校来源
- // 添加技能和培训字段
- skills: "",
- training: ""
- },
- genderOptions: ["男", "女"],
- genderIndex: -1,
- threePeriodOptions: ["无", "孕期", "产期", "哺乳期"],
- threePeriodIndex: -1,
- politicalOptions: ["群众", "共青团员", "中共党员", "民主党派"],
- politicalIndex: -1,
- ethnicOptions: ["汉族", "蒙古族", "回族", "藏族", "维吾尔族", "其他"],
- ethnicIndex: -1,
- marriageOptions: ["未婚", "已婚", "离异", "丧偶"],
- marriageIndex: -1,
- familyMembers: [],
- familyMemberForm: {
- relation: "",
- name: "",
- workplaceOrAddress: "",
- position: "",
- phone: "",
- isEmergencyContact: false
- // 添加新字段
- },
- isEditing: false,
- editingIndex: -1,
- // 添加教育经历相关数据
- educationList: [],
- educationForm: {
- startTime: "",
- endTime: "",
- schoolName: "",
- major: "",
- degree: ""
- },
- isEditingEducation: false,
- editingEducationIndex: -1,
- degreeOptions: ["高中", "中专", "大专", "本科", "硕士", "博士"],
- degreeIndex: -1,
- // 添加工作经历相关数据
- workList: [],
- workForm: {
- startTime: "",
- endTime: "",
- companyName: "",
- department: "",
- employeeCount: "",
- position: "",
- monthlySalary: "",
- supervisor: "",
- supervisorPhone: ""
- },
- isEditingWork: false,
- editingWorkIndex: -1,
- // 添加步骤控制
- currentStep: 1,
- steps: [
- { id: 1, name: "基本信息" },
- { id: 3, name: "家庭成员" },
- { id: 5, name: "教育经历" },
- { id: 6, name: "专业技能" },
- { id: 8, name: "工作经历" }
- ],
- formErrors: {
- name: "",
- idCard: "",
- phone: "",
- gender: "",
- ethnic: "",
- currentAddress: "",
- height: "",
- weight: "",
- expectedSalary: "",
- skills: "",
- training: "",
- threePeriod: ""
- // 添加这一行
- },
- // Add loading state
- isLoading: true,
- familyMemberErrors: {
- relation: "",
- name: "",
- phone: "",
- workplaceOrAddress: "",
- position: ""
- },
- workErrors: {
- startTime: "",
- endTime: "",
- companyName: "",
- department: "",
- position: "",
- employeeCount: "",
- monthlySalary: "",
- supervisor: "",
- supervisorPhone: ""
- },
- // 在 data 中添加教育经历的错误提示对象
- educationErrors: {
- startTime: "",
- endTime: "",
- schoolName: "",
- major: "",
- degree: ""
- },
- // 添加统一的验证规则
- validationRules: {
- name: {
- required: true,
- message: "请输入姓名"
- },
- phone: {
- required: true,
- pattern: /^1[3-9]\d{9}$/,
- message: "请输入正确的手机号码"
- },
- idCard: {
- required: true,
- pattern: /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/,
- message: "请输入正确的身份证号码"
- },
- gender: {
- required: true,
- message: "请选择性别"
- },
- ethnic: {
- required: true,
- message: "请选择民族"
- },
- currentAddress: {
- required: true,
- message: "请输入现居住地址"
- },
- height: {
- pattern: /^\d+(\.\d{1,2})?$/,
- message: "请输入正确的身高(cm)"
- },
- weight: {
- pattern: /^\d+(\.\d{1,2})?$/,
- message: "请输入正确的体重(kg)"
- },
- expectedSalary: {
- pattern: /^\d+(\.\d{1,2})?$/,
- message: "请输入正确的期望薪资"
- }
- },
- // 获取配置信息
- configData: (() => {
- try {
- const configStr = common_vendor.index.getStorageSync("configData");
- if (configStr && configStr.trim()) {
- return JSON.parse(configStr);
- }
- return {};
- } catch (error) {
- console.warn("解析配置数据失败:", error);
- return {};
- }
- })()
- };
- },
- onLoad() {
- this.fetchUserData();
- console.log(this.configData);
- },
- computed: {
- // 添加计算属性来控制按钮显示
- showPrevButton() {
- return this.currentStep !== 1;
- },
- showNextButton() {
- return this.currentStep !== 8;
- },
- showSubmitButton() {
- return this.currentStep === 8;
- },
- // 获取当前步骤在数组中的索引
- currentStepIndex() {
- return this.steps.findIndex((step) => step.id === this.currentStep);
- },
- // 添加安全的配置访问器
- safeConfigData() {
- return this.configData || {};
- },
- safeProfileFieldsConfig() {
- return this.safeConfigData.profile_fields_config || {};
- },
- safeFamilyFieldsConfig() {
- return this.safeConfigData.family_fields_config || {};
- },
- safeEducationFieldsConfig() {
- return this.safeConfigData.education_fields_config || {};
- },
- safeWorkFieldsConfig() {
- return this.safeConfigData.work_experience_fields_config || {};
- },
- // 字段显示控制方法
- showNameField() {
- var _a;
- return Object.keys(this.safeProfileFieldsConfig).length === 0 || ((_a = this.safeProfileFieldsConfig.name) == null ? void 0 : _a.visible) !== false;
- },
- showGenderField() {
- var _a;
- return Object.keys(this.safeProfileFieldsConfig).length === 0 || ((_a = this.safeProfileFieldsConfig.gender) == null ? void 0 : _a.visible) !== false;
- },
- showPhoneField() {
- var _a;
- return Object.keys(this.safeProfileFieldsConfig).length === 0 || ((_a = this.safeProfileFieldsConfig.phone) == null ? void 0 : _a.visible) !== false;
- },
- showIdCardField() {
- var _a;
- return Object.keys(this.safeProfileFieldsConfig).length === 0 || ((_a = this.safeProfileFieldsConfig.id_card) == null ? void 0 : _a.visible) !== false;
- },
- showEthnicField() {
- var _a;
- return Object.keys(this.safeProfileFieldsConfig).length === 0 || ((_a = this.safeProfileFieldsConfig.ethnic) == null ? void 0 : _a.visible) !== false;
- },
- showHeightField() {
- var _a;
- return Object.keys(this.safeProfileFieldsConfig).length === 0 || ((_a = this.safeProfileFieldsConfig.height) == null ? void 0 : _a.visible) !== false;
- },
- showWeightField() {
- var _a;
- return Object.keys(this.safeProfileFieldsConfig).length === 0 || ((_a = this.safeProfileFieldsConfig.weight) == null ? void 0 : _a.visible) !== false;
- },
- // 家庭成员字段显示控制
- showFamilyRelationField() {
- var _a;
- return Object.keys(this.safeFamilyFieldsConfig).length === 0 || ((_a = this.safeFamilyFieldsConfig.relation) == null ? void 0 : _a.visible) !== false;
- },
- showFamilyNameField() {
- var _a;
- return Object.keys(this.safeFamilyFieldsConfig).length === 0 || ((_a = this.safeFamilyFieldsConfig.name) == null ? void 0 : _a.visible) !== false;
- },
- showFamilyWorkplaceField() {
- var _a;
- return Object.keys(this.safeFamilyFieldsConfig).length === 0 || ((_a = this.safeFamilyFieldsConfig.workplace_or_address) == null ? void 0 : _a.visible) !== false;
- },
- showFamilyPositionField() {
- var _a;
- return Object.keys(this.safeFamilyFieldsConfig).length === 0 || ((_a = this.safeFamilyFieldsConfig.position) == null ? void 0 : _a.visible) !== false;
- },
- showFamilyPhoneField() {
- var _a;
- return Object.keys(this.safeFamilyFieldsConfig).length === 0 || ((_a = this.safeFamilyFieldsConfig.phone) == null ? void 0 : _a.visible) !== false;
- },
- // 教育经历字段显示控制
- showEducationTimeField() {
- var _a;
- return Object.keys(this.safeEducationFieldsConfig).length === 0 || ((_a = this.safeEducationFieldsConfig.start_time) == null ? void 0 : _a.visible) !== false;
- },
- showEducationSchoolField() {
- var _a;
- return Object.keys(this.safeEducationFieldsConfig).length === 0 || ((_a = this.safeEducationFieldsConfig.school_name) == null ? void 0 : _a.visible) !== false;
- },
- showEducationMajorField() {
- var _a;
- return Object.keys(this.safeEducationFieldsConfig).length === 0 || ((_a = this.safeEducationFieldsConfig.major) == null ? void 0 : _a.visible) !== false;
- },
- showEducationDegreeField() {
- var _a;
- return Object.keys(this.safeEducationFieldsConfig).length === 0 || ((_a = this.safeEducationFieldsConfig.degree) == null ? void 0 : _a.visible) !== false;
- },
- // 工作经历字段显示控制
- showWorkTimeField() {
- var _a;
- return Object.keys(this.safeWorkFieldsConfig).length === 0 || ((_a = this.safeWorkFieldsConfig.start_time) == null ? void 0 : _a.visible) !== false;
- },
- showWorkCompanyField() {
- var _a;
- return Object.keys(this.safeWorkFieldsConfig).length === 0 || ((_a = this.safeWorkFieldsConfig.company_name) == null ? void 0 : _a.visible) !== false;
- },
- showWorkDepartmentField() {
- var _a;
- return Object.keys(this.safeWorkFieldsConfig).length === 0 || ((_a = this.safeWorkFieldsConfig.department) == null ? void 0 : _a.visible) !== false;
- },
- showWorkEmployeeCountField() {
- var _a;
- return Object.keys(this.safeWorkFieldsConfig).length === 0 || ((_a = this.safeWorkFieldsConfig.employee_count) == null ? void 0 : _a.visible) !== false;
- },
- showWorkPositionField() {
- var _a;
- return Object.keys(this.safeWorkFieldsConfig).length === 0 || ((_a = this.safeWorkFieldsConfig.position) == null ? void 0 : _a.visible) !== false;
- },
- showRequireProfessionalSkillsField() {
- console.log(this.safeConfigData.require_professional_skills);
- const value = this.safeConfigData.require_professional_skills;
- return value === void 0 || value === null ? true : value;
- },
- showRequireTrainingInfoField() {
- console.log(this.safeConfigData.require_training_info);
- const value = this.safeConfigData.require_training_info;
- return value === void 0 || value === null ? true : value;
- },
- shouldShowSkillsStep() {
- return this.showRequireTrainingInfoField || this.showRequireProfessionalSkillsField;
- }
- },
- methods: {
- // 添加承诺书相关方法
- togglePromiseChecked() {
- this.promiseChecked = !this.promiseChecked;
- },
- confirmPromise() {
- if (this.promiseChecked) {
- this.showPromiseModal = false;
- } else {
- common_vendor.index.showToast({
- title: "请先阅读并同意承诺书内容",
- icon: "none"
- });
- }
- },
- // 添加字段是否需要验证的判断方法
- shouldValidateField(fieldName, section) {
- section = section || "profile";
- switch (section) {
- case "profile":
- const fieldShowMap = {
- "name": this.showNameField,
- "gender": this.showGenderField,
- "phone": this.showPhoneField,
- "idCard": this.showIdCardField,
- "ethnic": this.showEthnicField,
- "height": this.showHeightField,
- "weight": this.showWeightField,
- "currentAddress": true,
- // 现居住地址总是显示和必填
- "expectedSalary": true,
- // 期望薪资总是显示
- "skills": this.showRequireTrainingInfoField,
- // 专业技能根据配置显示和必填
- "training": this.showRequireProfessionalSkillsField,
- // 培训经历根据配置显示和必填
- "threePeriod": this.formData.gender === "女"
- // 只有女性时才需要验证三期状态
- };
- return fieldShowMap[fieldName] !== false;
- case "family":
- const familyFieldShowMap = {
- "relation": this.showFamilyRelationField,
- "name": this.showFamilyNameField,
- "phone": this.showFamilyPhoneField,
- "workplaceOrAddress": this.showFamilyWorkplaceField,
- "position": this.showFamilyPositionField
- };
- return familyFieldShowMap[fieldName] !== false;
- case "education":
- const educationFieldShowMap = {
- "startTime": this.showEducationTimeField,
- "endTime": this.showEducationTimeField,
- "schoolName": this.showEducationSchoolField,
- "major": this.showEducationMajorField,
- "degree": this.showEducationDegreeField
- };
- return educationFieldShowMap[fieldName] !== false;
- case "work":
- const workFieldShowMap = {
- "startTime": this.showWorkTimeField,
- "endTime": this.showWorkTimeField,
- "companyName": this.showWorkCompanyField,
- "department": this.showWorkDepartmentField,
- "position": this.showWorkPositionField,
- "employeeCount": this.showWorkEmployeeCountField,
- "monthlySalary": true,
- // 月薪总是需要验证
- "supervisor": true,
- // 直接领导总是需要验证
- "supervisorPhone": true
- // 领导电话总是需要验证
- };
- return workFieldShowMap[fieldName] !== false;
- default:
- return true;
- }
- },
- bindGenderChange(e) {
- this.genderIndex = e.detail.value;
- this.formData.gender = this.genderOptions[this.genderIndex];
- if (this.formErrors.gender) {
- this.formErrors.gender = "";
- }
- if (this.formData.gender !== "女") {
- this.formData.threePeriod = "";
- this.threePeriodIndex = -1;
- this.formErrors.threePeriod = "";
- }
- },
- bindThreePeriodChange(e) {
- this.threePeriodIndex = e.detail.value;
- this.formData.threePeriod = this.threePeriodOptions[this.threePeriodIndex];
- if (this.formErrors.threePeriod) {
- this.formErrors.threePeriod = "";
- }
- },
- bindPoliticalChange(e) {
- this.politicalIndex = e.detail.value;
- this.formData.political = this.politicalOptions[this.politicalIndex];
- },
- bindEthnicChange(e) {
- this.ethnicIndex = e.detail.value;
- this.formData.ethnic = this.ethnicOptions[this.ethnicIndex];
- if (this.formErrors.ethnic) {
- this.formErrors.ethnic = "";
- }
- },
- bindMarriageChange(e) {
- this.marriageIndex = e.detail.value;
- this.formData.marriage = this.marriageOptions[this.marriageIndex];
- },
- bindDateChange(e) {
- this.formData.birthDate = e.detail.value;
- },
- saveFamilyMember() {
- this.resetFamilyMemberErrors();
- let isValid = true;
- if (this.shouldValidateField("relation", "family") && !this.familyMemberForm.relation) {
- this.familyMemberErrors.relation = "请输入称谓";
- isValid = false;
- }
- if (this.shouldValidateField("name", "family") && !this.familyMemberForm.name) {
- this.familyMemberErrors.name = "请输入姓名";
- isValid = false;
- }
- if (this.shouldValidateField("workplaceOrAddress", "family") && !this.familyMemberForm.workplaceOrAddress) {
- this.familyMemberErrors.workplaceOrAddress = "请输入工作单位/家庭地址";
- isValid = false;
- }
- if (this.shouldValidateField("position", "family") && !this.familyMemberForm.position) {
- this.familyMemberErrors.position = "请输入职务";
- isValid = false;
- }
- if (this.shouldValidateField("phone", "family") && !this.familyMemberForm.phone) {
- this.familyMemberErrors.phone = "请输入联系电话";
- isValid = false;
- } else if (this.shouldValidateField("phone", "family") && this.familyMemberForm.phone && !/^1[3-9]\d{9}$/.test(this.familyMemberForm.phone)) {
- this.familyMemberErrors.phone = "请输入正确的手机号";
- isValid = false;
- }
- if (!isValid) {
- common_vendor.index.showToast({
- title: "请完善家庭成员信息",
- icon: "none"
- });
- return;
- }
- if (this.isEditing) {
- this.familyMembers[this.editingIndex] = { ...this.familyMemberForm };
- common_vendor.index.showToast({
- title: "修改成功",
- icon: "success"
- });
- this.isEditing = false;
- this.editingIndex = -1;
- } else {
- this.familyMembers.push({ ...this.familyMemberForm });
- common_vendor.index.showToast({
- title: "添加成功",
- icon: "success"
- });
- }
- this.resetFamilyMemberForm();
- },
- // 添加重置错误信息的方法
- resetFamilyMemberErrors() {
- this.familyMemberErrors = {
- relation: "",
- name: "",
- phone: "",
- workplaceOrAddress: "",
- position: ""
- };
- },
- // 修改重置表单的方法
- resetFamilyMemberForm() {
- this.familyMemberForm = {
- relation: "",
- name: "",
- workplaceOrAddress: "",
- position: "",
- phone: "",
- isEmergencyContact: false
- };
- this.resetFamilyMemberErrors();
- },
- editFamilyMember(index) {
- this.isEditing = true;
- this.editingIndex = index;
- this.familyMemberForm = { ...this.familyMembers[index] };
- common_vendor.index.pageScrollTo({
- selector: ".family-member-form",
- duration: 300
- });
- },
- cancelEdit() {
- this.isEditing = false;
- this.editingIndex = -1;
- this.familyMemberForm = {
- relation: "",
- name: "",
- workplaceOrAddress: "",
- position: "",
- phone: "",
- isEmergencyContact: false
- };
- },
- deleteFamilyMember(index) {
- if (this.isEditing && this.editingIndex === index) {
- this.cancelEdit();
- }
- this.familyMembers.splice(index, 1);
- common_vendor.index.showToast({
- title: "已删除",
- icon: "none"
- });
- },
- // 选择应聘来源类型
- selectSourceType(type) {
- this.formData.sourceType = type;
- if (type === "social") {
- this.formData.socialSource = "BOSS";
- } else {
- this.formData.socialSource = "";
- }
- },
- // 选择社招来源
- selectSocialSource(source) {
- this.formData.sourceType = "social";
- this.formData.socialSource = source;
- },
- // 教育经历相关方法
- bindStartTimeChange(e) {
- this.educationForm.startTime = e.detail.value;
- },
- bindEndTimeChange(e) {
- this.educationForm.endTime = e.detail.value;
- },
- bindDegreeChange(e) {
- this.degreeIndex = e.detail.value;
- this.educationForm.degree = this.degreeOptions[this.degreeIndex];
- },
- saveEducation() {
- this.resetEducationErrors();
- let isValid = true;
- if (this.shouldValidateField("startTime", "education") && !this.educationForm.startTime) {
- this.educationErrors.startTime = "请选择开始时间";
- isValid = false;
- }
- if (this.shouldValidateField("endTime", "education") && !this.educationForm.endTime) {
- this.educationErrors.endTime = "请选择结束时间";
- isValid = false;
- }
- if (this.shouldValidateField("schoolName", "education") && !this.educationForm.schoolName) {
- this.educationErrors.schoolName = "请输入学校名称";
- isValid = false;
- }
- if (this.shouldValidateField("major", "education") && !this.educationForm.major) {
- this.educationErrors.major = "请输入专业";
- isValid = false;
- }
- if (this.shouldValidateField("degree", "education") && !this.educationForm.degree) {
- this.educationErrors.degree = "请选择学历";
- isValid = false;
- }
- if (!isValid) {
- common_vendor.index.showToast({
- title: "请完善教育经历信息",
- icon: "none"
- });
- return;
- }
- if (this.isEditingEducation) {
- this.educationList[this.editingEducationIndex] = { ...this.educationForm };
- common_vendor.index.showToast({
- title: "修改成功",
- icon: "success"
- });
- this.isEditingEducation = false;
- this.editingEducationIndex = -1;
- } else {
- this.educationList.push({ ...this.educationForm });
- common_vendor.index.showToast({
- title: "添加成功",
- icon: "success"
- });
- }
- this.educationForm = {
- startTime: "",
- endTime: "",
- schoolName: "",
- major: "",
- degree: ""
- };
- this.degreeIndex = -1;
- },
- editEducation(index) {
- this.isEditingEducation = true;
- this.editingEducationIndex = index;
- this.educationForm = { ...this.educationList[index] };
- this.degreeIndex = this.degreeOptions.findIndex((item) => item === this.educationForm.degree);
- common_vendor.index.pageScrollTo({
- selector: ".education-form",
- duration: 300
- });
- },
- cancelEditEducation() {
- this.isEditingEducation = false;
- this.editingEducationIndex = -1;
- this.educationForm = {
- startTime: "",
- endTime: "",
- schoolName: "",
- major: "",
- degree: ""
- };
- this.degreeIndex = -1;
- },
- deleteEducation(index) {
- if (this.isEditingEducation && this.editingEducationIndex === index) {
- this.cancelEditEducation();
- }
- this.educationList.splice(index, 1);
- common_vendor.index.showToast({
- title: "已删除",
- icon: "none"
- });
- },
- // 工作经历相关方法
- bindWorkStartTimeChange(e) {
- this.workForm.startTime = e.detail.value;
- },
- bindWorkEndTimeChange(e) {
- this.workForm.endTime = e.detail.value;
- },
- saveWork() {
- this.workErrors = {
- startTime: "",
- endTime: "",
- companyName: "",
- department: "",
- position: "",
- employeeCount: "",
- monthlySalary: "",
- supervisor: "",
- supervisorPhone: ""
- };
- let isValid = true;
- if (this.shouldValidateField("startTime", "work") && !this.workForm.startTime) {
- this.workErrors.startTime = "请选择开始时间";
- isValid = false;
- }
- if (this.shouldValidateField("endTime", "work") && !this.workForm.endTime) {
- this.workErrors.endTime = "请选择结束时间";
- isValid = false;
- }
- if (this.shouldValidateField("companyName", "work") && !this.workForm.companyName) {
- this.workErrors.companyName = "请输入单位名称";
- isValid = false;
- }
- if (this.shouldValidateField("department", "work") && !this.workForm.department) {
- this.workErrors.department = "请输入任职部门";
- isValid = false;
- }
- if (this.shouldValidateField("position", "work") && !this.workForm.position) {
- this.workErrors.position = "请输入担任职务";
- isValid = false;
- }
- if (this.shouldValidateField("employeeCount", "work") && !this.workForm.employeeCount) {
- this.workErrors.employeeCount = "请输入单位人数";
- isValid = false;
- }
- if (this.shouldValidateField("monthlySalary", "work") && !this.workForm.monthlySalary) {
- this.workErrors.monthlySalary = "请输入月薪";
- isValid = false;
- }
- if (this.shouldValidateField("supervisor", "work") && !this.workForm.supervisor) {
- this.workErrors.supervisor = "请输入直属上级";
- isValid = false;
- }
- if (this.shouldValidateField("supervisorPhone", "work") && !this.workForm.supervisorPhone) {
- this.workErrors.supervisorPhone = "请输入直属上级电话";
- isValid = false;
- }
- if (!isValid) {
- common_vendor.index.showToast({
- title: "请完善工作经历信息",
- icon: "none"
- });
- return;
- }
- if (this.isEditingWork) {
- this.workList[this.editingWorkIndex] = { ...this.workForm };
- common_vendor.index.showToast({
- title: "修改成功",
- icon: "success"
- });
- this.isEditingWork = false;
- this.editingWorkIndex = -1;
- } else {
- this.workList.push({ ...this.workForm });
- common_vendor.index.showToast({
- title: "添加成功",
- icon: "success"
- });
- }
- this.workForm = {
- startTime: "",
- endTime: "",
- companyName: "",
- department: "",
- employeeCount: "",
- position: "",
- monthlySalary: "",
- supervisor: "",
- supervisorPhone: ""
- };
- },
- editWork(index) {
- this.isEditingWork = true;
- this.editingWorkIndex = index;
- this.workForm = { ...this.workList[index] };
- common_vendor.index.pageScrollTo({
- selector: ".work-form",
- duration: 300
- });
- },
- cancelEditWork() {
- this.isEditingWork = false;
- this.editingWorkIndex = -1;
- this.workForm = {
- startTime: "",
- endTime: "",
- companyName: "",
- department: "",
- employeeCount: "",
- position: "",
- monthlySalary: "",
- supervisor: "",
- supervisorPhone: ""
- };
- },
- deleteWork(index) {
- if (this.isEditingWork && this.editingWorkIndex === index) {
- this.cancelEditWork();
- }
- this.workList.splice(index, 1);
- common_vendor.index.showToast({
- title: "已删除",
- icon: "none"
- });
- },
- submitForm() {
- var _a, _b;
- if (!this.validateCurrentStep()) {
- return;
- }
- const allRequired = [
- "name",
- "gender",
- "phone",
- "idCard",
- "ethnic",
- "currentAddress"
- ];
- let isValid = true;
- allRequired.forEach((field) => {
- if (this.shouldValidateField(field) && !this.validateField(field, this.formData[field])) {
- isValid = false;
- }
- });
- if (this.shouldValidateField("skills") && !((_a = this.formData.skills) == null ? void 0 : _a.trim())) {
- this.formErrors.skills = "请描述您的专业技能";
- isValid = false;
- }
- if (this.shouldValidateField("training") && !((_b = this.formData.training) == null ? void 0 : _b.trim())) {
- this.formErrors.training = "请描述您的培训经历";
- isValid = false;
- }
- if (!isValid) {
- common_vendor.index.showToast({
- title: "请完善所有必填信息",
- icon: "none"
- });
- return;
- }
- const userInfo = common_vendor.index.getStorageSync("userInfo");
- if (!userInfo) {
- common_vendor.index.showToast({
- title: "用户信息获取失败,请重新登录",
- icon: "none",
- duration: 2e3
- });
- return;
- }
- try {
- const userData = JSON.parse(userInfo);
- const submitData = {
- tenant_id: 1,
- user_id: userData.id,
- personal_info: {
- name: this.formData.name,
- gender: this.formData.gender,
- phone: this.formData.phone,
- id_card: this.formData.idCard,
- address: this.formData.currentAddress,
- professional_skills: this.formData.skills ? this.formData.skills.split(",") : []
- },
- profile: {
- female_status: this.getFemaleStatus(),
- marital_status: this.getMaritalStatus(),
- height: parseFloat(this.formData.height) || 0,
- weight: parseFloat(this.formData.weight) || 0,
- ethnicity: this.formData.ethnic,
- current_address: this.formData.currentAddress,
- expected_salary: parseFloat(this.formData.expectedSalary) || 0
- },
- educations: this.formatEducations(),
- family_members: this.formatFamilyMembers(),
- work_experiences: this.formatWorkExperiences()
- };
- if (!submitData.personal_info.name || !submitData.personal_info.gender || !submitData.personal_info.phone) {
- common_vendor.index.showToast({
- title: "基本信息不完整",
- icon: "none",
- duration: 2e3
- });
- return;
- }
- this.sendFormData(submitData);
- } catch (error) {
- console.error("数据处理错误:", error);
- common_vendor.index.showToast({
- title: "数据处理错误,请重试",
- icon: "none",
- duration: 2e3
- });
- }
- },
- // 辅助方法:发送表单数据
- sendFormData(submitData) {
- common_vendor.index.showLoading({ title: "提交中..." });
- const token = common_vendor.index.getStorageSync("token");
- common_vendor.index.request({
- url: `${common_config.apiBaseUrl}/wechat/user/profile/update`,
- method: "POST",
- data: submitData,
- header: {
- "content-type": "application/json",
- "Authorization": token ? `Bearer ${token}` : ""
- },
- success: (res) => {
- common_vendor.index.hideLoading();
- if (res.statusCode === 200) {
- if (res.data.code === 2e3) {
- common_vendor.index.showToast({
- title: "提交成功",
- icon: "success",
- duration: 2e3
- });
- setTimeout(() => {
- common_vendor.index.navigateTo({
- url: "/pages/interview-notice/interview-notice"
- });
- }, 2e3);
- } else {
- common_vendor.index.showToast({
- title: res.data.msg || "提交失败",
- icon: "none",
- duration: 2e3
- });
- }
- } else {
- common_vendor.index.showToast({
- title: "服务器响应错误",
- icon: "none",
- duration: 2e3
- });
- }
- },
- fail: (err) => {
- console.error("提交失败:", err);
- common_vendor.index.hideLoading();
- if (err.errMsg.includes("timeout")) {
- common_vendor.index.showToast({
- title: "请求超时,请检查网络后重试",
- icon: "none",
- duration: 2e3
- });
- } else if (err.errMsg.includes("fail")) {
- common_vendor.index.showToast({
- title: "网络连接失败,请检查网络设置",
- icon: "none",
- duration: 2e3
- });
- } else {
- common_vendor.index.showToast({
- title: "提交失败,请稍后重试",
- icon: "none",
- duration: 2e3
- });
- }
- },
- complete: () => {
- }
- });
- },
- // 数据格式化方法
- getFemaleStatus() {
- if (this.formData.gender !== "女")
- return 0;
- const statusMap = { "孕期": 1, "产期": 2, "哺乳期": 3 };
- return statusMap[this.formData.threePeriod] || 0;
- },
- getMaritalStatus() {
- const statusMap = { "未婚": 0, "已婚": 1, "离异": 2, "丧偶": 3 };
- return statusMap[this.formData.marriage] || 0;
- },
- formatEducations() {
- return this.educationList.map((edu, index) => ({
- education_type: index === 0 ? 1 : 2,
- degree: this.mapDegreeToNumber(edu.degree),
- start_date: edu.startTime,
- end_date: edu.endTime,
- school_name: edu.schoolName,
- major: edu.major
- }));
- },
- formatFamilyMembers() {
- return this.familyMembers.map((member) => ({
- relation: member.relation,
- name: member.name,
- workplace: member.workplaceOrAddress,
- position: member.position,
- phone: member.phone
- //is_emergency_contact: member.isEmergencyContact||false // 添加紧急联系人标识
- }));
- },
- formatWorkExperiences() {
- return this.workList.map((work) => ({
- start_date: work.startTime,
- end_date: work.endTime,
- company_name: work.companyName,
- department: work.department,
- company_size: work.employeeCount,
- position: work.position,
- monthly_salary: work.monthlySalary,
- supervisor_name: work.supervisor,
- supervisor_phone: work.supervisorPhone
- }));
- },
- // 学历映射辅助方法
- mapDegreeToNumber(degreeText) {
- const degreeMap = {
- "高中": 1,
- "中专": 1,
- "大专": 2,
- "本科": 3,
- "硕士": 4,
- "博士": 5
- };
- return degreeMap[degreeText] || 6;
- },
- prevStep() {
- const prevIndex = this.currentStepIndex - 1;
- if (prevIndex >= 0) {
- this.currentStep = this.steps[prevIndex].id;
- common_vendor.index.pageScrollTo({
- scrollTop: 0,
- duration: 300
- });
- }
- },
- nextStep() {
- if (!this.validateCurrentStep()) {
- return;
- }
- if (this.currentStep === 1) {
- this.verifyIdentity();
- return;
- }
- const nextIndex = this.currentStepIndex + 1;
- if (nextIndex < this.steps.length) {
- if (this.steps[nextIndex].id === 6 && !this.shouldShowSkillsStep) {
- const skipIndex = nextIndex + 1;
- if (skipIndex < this.steps.length) {
- this.currentStep = this.steps[skipIndex].id;
- }
- } else {
- this.currentStep = this.steps[nextIndex].id;
- }
- common_vendor.index.pageScrollTo({
- scrollTop: 0,
- duration: 300
- });
- }
- },
- // 身份验证方法
- verifyIdentity() {
- this.formErrors = {
- name: "",
- idCard: "",
- phone: ""
- };
- common_vendor.index.showLoading({
- title: "身份验证中..."
- });
- common_vendor.index.request({
- url: `${common_config.apiBaseUrl}/wechat/identity/verify`,
- method: "POST",
- data: {
- name: this.formData.name,
- id_number: this.formData.idCard,
- mobile: this.formData.phone
- },
- header: {
- "content-type": "application/x-www-form-urlencoded"
- },
- success: (res) => {
- common_vendor.index.hideLoading();
- console.log(res);
- if (res.data.code === 200) {
- const nextIndex = this.currentStepIndex + 1;
- if (nextIndex < this.steps.length) {
- this.currentStep = this.steps[nextIndex].id;
- common_vendor.index.pageScrollTo({
- scrollTop: 0,
- duration: 300
- });
- }
- this.setUserInfo(this.formData);
- } else {
- this.handleVerificationError(res.data);
- }
- },
- fail: (err) => {
- this.handleRequestError(err);
- }
- });
- },
- setUserInfo(data) {
- common_vendor.index.request({
- url: `${common_config.apiBaseUrl}/wechat/updateUserInfo`,
- method: "POST",
- data: {
- openid: JSON.parse(common_vendor.index.getStorageSync("userInfo")).openid,
- name: data.name,
- id_card: data.idCard,
- purePhoneNumber: data.phone,
- tenant_id: 1,
- examine: 0
- },
- header: {
- "content-type": "application/x-www-form-urlencoded"
- },
- success: (res) => {
- console.log(res);
- }
- });
- },
- // 处理验证错误
- handleVerificationError(data) {
- this.formErrors.name = "姓名验证失败,请检查姓名是否正确";
- this.formErrors.idCard = "身份证号验证失败,请检查身份证号是否正确";
- this.formErrors.phone = "手机号验证失败,请检查手机号是否正确";
- common_vendor.index.showToast({
- title: data.msg || "身份验证失败",
- icon: "none"
- });
- },
- // 处理请求错误
- handleRequestError(err) {
- common_vendor.index.hideLoading();
- common_vendor.index.showToast({
- title: "网络错误,请检查网络连接",
- icon: "none",
- duration: 2e3
- });
- console.error("请求失败:", err);
- },
- // 验证当前步骤的必填项
- validateCurrentStep() {
- var _a, _b;
- let isValid = true;
- switch (this.currentStep) {
- case 1:
- const basicFields = ["name", "gender", "phone", "idCard", "ethnic", "currentAddress"];
- basicFields.forEach((field) => {
- if (this.shouldValidateField(field) && !this.validateField(field, this.formData[field])) {
- isValid = false;
- }
- });
- if (this.shouldValidateField("threePeriod") && this.formData.gender === "女" && this.threePeriodIndex === -1) {
- this.formErrors.threePeriod = "请选择三期状态";
- isValid = false;
- }
- if (this.shouldValidateField("height") && this.formData.height) {
- isValid = this.validateField("height", this.formData.height) && isValid;
- }
- if (this.shouldValidateField("weight") && this.formData.weight) {
- isValid = this.validateField("weight", this.formData.weight) && isValid;
- }
- if (this.shouldValidateField("expectedSalary") && this.formData.expectedSalary) {
- isValid = this.validateField("expectedSalary", this.formData.expectedSalary) && isValid;
- }
- break;
- case 3:
- console.log(this.familyMembers.length);
- if (this.familyMembers.length == 0) {
- common_vendor.index.showToast({
- title: "请至少添加一位家庭成员",
- icon: "none"
- });
- isValid = false;
- }
- break;
- case 5:
- if (this.educationList.length === 0) {
- common_vendor.index.showToast({
- title: "请至少添加一项教育经历",
- icon: "none"
- });
- isValid = false;
- }
- break;
- case 6:
- if (this.shouldValidateField("skills") && !((_a = this.formData.skills) == null ? void 0 : _a.trim())) {
- this.formErrors.skills = "请描述您的专业技能";
- isValid = false;
- }
- if (this.shouldValidateField("training") && !((_b = this.formData.training) == null ? void 0 : _b.trim())) {
- this.formErrors.training = "请描述您的培训经历";
- isValid = false;
- }
- break;
- case 8:
- if (this.workList.length === 0) {
- common_vendor.index.showToast({
- title: "请至少添加一项工作经历",
- icon: "none"
- });
- isValid = false;
- }
- break;
- }
- return isValid;
- },
- // Add method to fetch user data
- fetchUserData() {
- this.isLoading = true;
- const userInfo = common_vendor.index.getStorageSync("userInfo") ? JSON.parse(common_vendor.index.getStorageSync("userInfo")) : {};
- const openid = userInfo.openid;
- if (!openid) {
- common_vendor.index.showToast({
- title: "用户信息获取失败,请重新登录",
- icon: "none"
- });
- this.isLoading = false;
- return;
- }
- common_vendor.index.request({
- url: `${common_config.apiBaseUrl}/api/wechat/user/get_full_info?tenant_id=1&openid=${openid}`,
- method: "GET",
- success: (res) => {
- this.showPromiseModal = true;
- this.populateFormData(res.data.data);
- },
- fail: (err) => {
- },
- complete: () => {
- this.isLoading = false;
- }
- });
- },
- // Add method to populate form data with fetched data
- populateFormData(data) {
- const { user_info, profile, educations, work_experiences, family_members } = data;
- if (user_info) {
- this.formData.name = user_info.name || "";
- this.formData.gender = user_info.gender_text || "";
- this.genderIndex = this.genderOptions.findIndex((item) => item === this.formData.gender);
- this.formData.idCard = user_info.id_card || "";
- this.formData.phone = user_info.phone || "";
- this.formData.email = user_info.email || "";
- }
- if (profile) {
- this.formData.political = profile.political_status || "";
- this.politicalIndex = this.politicalOptions.findIndex((item) => item === this.formData.political);
- this.formData.ethnic = profile.ethnicity || "";
- this.ethnicIndex = this.ethnicOptions.findIndex((item) => item === this.formData.ethnic);
- this.formData.height = profile.height || "";
- this.formData.weight = profile.weight || "";
- this.formData.nativePlace = profile.native_place || "";
- this.formData.residence = profile.household_location || "";
- this.formData.currentAddress = profile.current_address || "";
- this.formData.marriage = profile.marital_status_text || "";
- this.marriageIndex = this.marriageOptions.findIndex((item) => item === this.formData.marriage);
- if (this.formData.gender === "女" && profile.female_status !== void 0) {
- const femaleStatusMap = { 0: "无", 1: "孕期", 2: "产期", 3: "哺乳期" };
- this.formData.threePeriod = femaleStatusMap[profile.female_status] || "无";
- this.threePeriodIndex = this.threePeriodOptions.findIndex((item) => item === this.formData.threePeriod);
- }
- this.formData.expectedSalary = profile.expected_salary || "";
- this.formData.emergencyContact = profile.emergency_contact || "";
- this.formData.emergencyPhone = profile.emergency_phone || "";
- this.formData.hobby = profile.specialties || "";
- this.formData.motto = profile.life_motto || "";
- const sourceTypeMap = {
- 1: "school",
- 2: "social",
- 3: "social",
- 4: "social",
- 5: "social"
- };
- const socialSourceMap = {
- 2: "BOSS",
- 3: "zhilian",
- 4: "liepin",
- 5: "other"
- };
- this.formData.sourceType = sourceTypeMap[profile.recruitment_source] || "social";
- if (this.formData.sourceType === "social") {
- this.formData.socialSource = socialSourceMap[profile.recruitment_source] || "";
- if (this.formData.socialSource === "other") {
- this.formData.otherSocialSource = profile.recruitment_source_detail || "";
- }
- } else if (this.formData.sourceType === "school") {
- this.formData.otherSchoolSource = profile.recruitment_source_detail || "";
- }
- }
- if (educations && educations.length > 0) {
- this.educationList = educations.map((edu) => {
- const degreeMap = {
- 1: "高中",
- 2: "大专",
- 3: "本科",
- 4: "硕士",
- 5: "博士"
- };
- return {
- startTime: edu.start_date || "",
- endTime: edu.end_date || "",
- schoolName: edu.school_name || "",
- major: edu.major || "",
- degree: degreeMap[edu.degree] || ""
- };
- });
- }
- if (work_experiences && work_experiences.length > 0) {
- this.workList = work_experiences.map((work) => {
- return {
- startTime: work.start_date || "",
- endTime: work.end_date || "",
- companyName: work.company_name || "",
- department: work.department || "",
- employeeCount: work.company_size || "",
- position: work.position || "",
- monthlySalary: work.monthly_salary || "",
- supervisor: work.supervisor_name || "",
- supervisorPhone: work.supervisor_phone || ""
- };
- });
- }
- if (family_members && family_members.length > 0) {
- this.familyMembers = family_members.map((member) => {
- return {
- relation: member.relation || "",
- name: member.name || "",
- workplaceOrAddress: member.workplace || "",
- position: member.position || "",
- phone: member.phone || "",
- isEmergencyContact: member.isEmergencyContact || false
- };
- });
- }
- },
- // 处理紧急联系人开关变化
- handleEmergencyContactChange(e) {
- this.familyMemberForm.isEmergencyContact = e.detail.value;
- if (e.detail.value) {
- this.formData.emergencyContact = this.familyMemberForm.name;
- this.formData.emergencyPhone = this.familyMemberForm.phone;
- }
- },
- // 添加重置教育经历错误信息的方法
- resetEducationErrors() {
- this.educationErrors = {
- startTime: "",
- endTime: "",
- schoolName: "",
- major: "",
- degree: ""
- };
- },
- // 添加通用验证方法
- validateField(fieldName, value) {
- const rule = this.validationRules[fieldName];
- if (!rule)
- return true;
- if (!this.shouldValidateField(fieldName)) {
- return true;
- }
- this.formErrors[fieldName] = "";
- if (rule.required && !value) {
- this.formErrors[fieldName] = rule.message;
- return false;
- }
- if (rule.pattern && value && !rule.pattern.test(value)) {
- this.formErrors[fieldName] = rule.message;
- return false;
- }
- return true;
- }
- },
- // 添加监听器来清除错误信息
- watch: {
- "formData.name": function(newVal) {
- if (newVal && this.formErrors.name) {
- this.formErrors.name = "";
- }
- },
- "formData.idCard": function(newVal) {
- if (newVal && this.formErrors.idCard) {
- this.formErrors.idCard = "";
- }
- },
- "formData.phone": function(newVal) {
- if (newVal && this.formErrors.phone) {
- this.formErrors.phone = "";
- }
- },
- "formData.gender": function(newVal) {
- if (newVal && this.formErrors.gender) {
- this.formErrors.gender = "";
- }
- },
- "formData.ethnic": function(newVal) {
- if (newVal && this.formErrors.ethnic) {
- this.formErrors.ethnic = "";
- }
- },
- "formData.currentAddress": function(newVal) {
- if (newVal && this.formErrors.currentAddress) {
- this.formErrors.currentAddress = "";
- }
- },
- "formData.height": function(newVal) {
- if (newVal && this.formErrors.height) {
- this.formErrors.height = "";
- }
- },
- "formData.weight": function(newVal) {
- if (newVal && this.formErrors.weight) {
- this.formErrors.weight = "";
- }
- },
- "formData.expectedSalary": function(newVal) {
- if (newVal && this.formErrors.expectedSalary) {
- this.formErrors.expectedSalary = "";
- }
- },
- "familyMemberForm.relation": function(newVal) {
- if (newVal)
- this.familyMemberErrors.relation = "";
- },
- "familyMemberForm.name": function(newVal) {
- if (newVal)
- this.familyMemberErrors.name = "";
- },
- "familyMemberForm.phone": function(newVal) {
- if (newVal)
- this.familyMemberErrors.phone = "";
- },
- /* 'familyMemberForm.workplaceOrAddress': function(newVal) {
- if (newVal) this.familyMemberErrors.workplaceOrAddress = '';
- },
- 'familyMemberForm.position': function(newVal) {
- if (newVal) this.familyMemberErrors.position = '';
- }, */
- "workForm.companyName": function(newVal) {
- if (newVal && this.workErrors.companyName) {
- this.workErrors.companyName = "";
- }
- },
- "workForm.department": function(newVal) {
- if (newVal && this.workErrors.department) {
- this.workErrors.department = "";
- }
- },
- "workForm.position": function(newVal) {
- if (newVal && this.workErrors.position) {
- this.workErrors.position = "";
- }
- },
- "workForm.employeeCount": function(newVal) {
- if (newVal && this.workErrors.employeeCount) {
- this.workErrors.employeeCount = "";
- }
- },
- "workForm.monthlySalary": function(newVal) {
- if (newVal && this.workErrors.monthlySalary) {
- this.workErrors.monthlySalary = "";
- }
- },
- "workForm.supervisor": function(newVal) {
- if (newVal && this.workErrors.supervisor) {
- this.workErrors.supervisor = "";
- }
- },
- "workForm.supervisorPhone": function(newVal) {
- if (newVal && this.workErrors.supervisorPhone) {
- this.workErrors.supervisorPhone = "";
- }
- },
- "formData.training": function(newVal) {
- if (newVal && this.formErrors.training) {
- this.formErrors.training = "";
- }
- },
- "educationForm.startTime": function(newVal) {
- if (newVal)
- this.educationErrors.startTime = "";
- },
- "educationForm.endTime": function(newVal) {
- if (newVal)
- this.educationErrors.endTime = "";
- },
- "educationForm.schoolName": function(newVal) {
- if (newVal)
- this.educationErrors.schoolName = "";
- },
- "educationForm.major": function(newVal) {
- if (newVal)
- this.educationErrors.major = "";
- },
- "educationForm.degree": function(newVal) {
- if (newVal)
- this.educationErrors.degree = "";
- },
- // 添加对表单字段的实时验证
- "formData": {
- handler(newVal) {
- const currentStepFields = {
- 1: ["name", "gender", "phone", "idCard", "ethnic", "currentAddress", "height", "weight", "expectedSalary"],
- 6: ["skills", "training"]
- }[this.currentStep];
- if (currentStepFields) {
- currentStepFields.forEach((field) => {
- if (newVal[field] !== void 0 && this.shouldValidateField(field)) {
- this.validateField(field, newVal[field]);
- }
- });
- }
- },
- deep: true
- }
- }
- };
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
- return common_vendor.e({
- a: $data.isLoading
- }, $data.isLoading ? {} : {}, {
- b: $data.showPromiseModal
- }, $data.showPromiseModal ? {
- c: $data.promiseChecked,
- d: common_vendor.o((...args) => $options.togglePromiseChecked && $options.togglePromiseChecked(...args)),
- e: !$data.promiseChecked,
- f: common_vendor.o((...args) => $options.confirmPromise && $options.confirmPromise(...args))
- } : {}, {
- g: $data.currentStep === 1
- }, $data.currentStep === 1 ? common_vendor.e({
- h: $options.showNameField
- }, $options.showNameField ? common_vendor.e({
- i: $data.formErrors.name ? 1 : "",
- j: $data.formData.name,
- k: common_vendor.o(($event) => $data.formData.name = $event.detail.value),
- l: $data.formErrors.name
- }, $data.formErrors.name ? {
- m: common_vendor.t($data.formErrors.name)
- } : {}) : {}, {
- n: $options.showGenderField
- }, $options.showGenderField ? common_vendor.e({
- o: common_vendor.t($data.genderOptions[$data.genderIndex] || "请选择性别"),
- p: $data.formErrors.gender ? 1 : "",
- q: common_vendor.o((...args) => $options.bindGenderChange && $options.bindGenderChange(...args)),
- r: $data.genderIndex,
- s: $data.genderOptions,
- t: $data.formErrors.gender
- }, $data.formErrors.gender ? {
- v: common_vendor.t($data.formErrors.gender)
- } : {}) : {}, {
- w: $data.formData.gender === "女"
- }, $data.formData.gender === "女" ? common_vendor.e({
- x: common_vendor.t($data.threePeriodOptions[$data.threePeriodIndex] || "请选择"),
- y: common_vendor.o((...args) => $options.bindThreePeriodChange && $options.bindThreePeriodChange(...args)),
- z: $data.threePeriodIndex,
- A: $data.threePeriodOptions,
- B: $data.formErrors.threePeriod ? 1 : "",
- C: $data.formErrors.threePeriod
- }, $data.formErrors.threePeriod ? {
- D: common_vendor.t($data.formErrors.threePeriod)
- } : {}) : {}, {
- E: $options.showPhoneField
- }, $options.showPhoneField ? common_vendor.e({
- F: $data.formErrors.phone ? 1 : "",
- G: $data.formData.phone,
- H: common_vendor.o(($event) => $data.formData.phone = $event.detail.value),
- I: $data.formErrors.phone
- }, $data.formErrors.phone ? {
- J: common_vendor.t($data.formErrors.phone)
- } : {}) : {}, {
- K: $options.showIdCardField
- }, $options.showIdCardField ? common_vendor.e({
- L: $data.formErrors.idCard ? 1 : "",
- M: $data.formData.idCard,
- N: common_vendor.o(($event) => $data.formData.idCard = $event.detail.value),
- O: $data.formErrors.idCard
- }, $data.formErrors.idCard ? {
- P: common_vendor.t($data.formErrors.idCard)
- } : {}) : {}, {
- Q: $options.showEthnicField
- }, $options.showEthnicField ? common_vendor.e({
- R: common_vendor.t($data.ethnicOptions[$data.ethnicIndex] || "请选择民族"),
- S: $data.formErrors.ethnic ? 1 : "",
- T: common_vendor.o((...args) => $options.bindEthnicChange && $options.bindEthnicChange(...args)),
- U: $data.ethnicIndex,
- V: $data.ethnicOptions,
- W: $data.formErrors.ethnic
- }, $data.formErrors.ethnic ? {
- X: common_vendor.t($data.formErrors.ethnic)
- } : {}) : {}, {
- Y: $options.showHeightField
- }, $options.showHeightField ? {
- Z: $data.formData.height,
- aa: common_vendor.o(($event) => $data.formData.height = $event.detail.value)
- } : {}, {
- ab: $options.showWeightField
- }, $options.showWeightField ? {
- ac: $data.formData.weight,
- ad: common_vendor.o(($event) => $data.formData.weight = $event.detail.value)
- } : {}, {
- ae: $data.formErrors.currentAddress ? 1 : "",
- af: $data.formData.currentAddress,
- ag: common_vendor.o(($event) => $data.formData.currentAddress = $event.detail.value),
- ah: $data.formErrors.currentAddress
- }, $data.formErrors.currentAddress ? {
- ai: common_vendor.t($data.formErrors.currentAddress)
- } : {}, {
- aj: $data.formData.residence,
- ak: common_vendor.o(($event) => $data.formData.residence = $event.detail.value),
- al: common_vendor.t($data.marriageOptions[$data.marriageIndex] || "请选择婚育状况"),
- am: common_vendor.o((...args) => $options.bindMarriageChange && $options.bindMarriageChange(...args)),
- an: $data.marriageIndex,
- ao: $data.marriageOptions,
- ap: $data.formData.expectedSalary,
- aq: common_vendor.o(($event) => $data.formData.expectedSalary = $event.detail.value)
- }) : {}, {
- ar: $data.currentStep === 3
- }, $data.currentStep === 3 ? common_vendor.e({
- as: $data.familyMembers.length > 0
- }, $data.familyMembers.length > 0 ? {
- at: common_vendor.f($data.familyMembers, (member, index, i0) => {
- return common_vendor.e({
- a: common_vendor.t(index + 1),
- b: common_vendor.o(($event) => $options.editFamilyMember(index), index),
- c: common_vendor.o(($event) => $options.deleteFamilyMember(index), index)
- }, $options.showFamilyRelationField ? {
- d: common_vendor.t(member.relation)
- } : {}, $options.showFamilyNameField ? {
- e: common_vendor.t(member.name)
- } : {}, $options.showFamilyWorkplaceField ? {
- f: common_vendor.t(member.workplaceOrAddress)
- } : {}, $options.showFamilyPositionField ? {
- g: common_vendor.t(member.position)
- } : {}, $options.showFamilyPhoneField ? {
- h: common_vendor.t(member.phone)
- } : {}, {
- i: common_vendor.t(member.isEmergencyContact ? "是" : "否"),
- j: index
- });
- }),
- av: $options.showFamilyRelationField,
- aw: $options.showFamilyNameField,
- ax: $options.showFamilyWorkplaceField,
- ay: $options.showFamilyPositionField,
- az: $options.showFamilyPhoneField
- } : {}, {
- aA: common_vendor.t($data.isEditing ? "编辑家庭成员" : "添加家庭成员"),
- aB: $data.isEditing
- }, $data.isEditing ? {
- aC: common_vendor.o((...args) => $options.cancelEdit && $options.cancelEdit(...args))
- } : {}, {
- aD: $options.showFamilyRelationField
- }, $options.showFamilyRelationField ? common_vendor.e({
- aE: $data.familyMemberErrors.relation ? 1 : "",
- aF: $data.familyMemberForm.relation,
- aG: common_vendor.o(($event) => $data.familyMemberForm.relation = $event.detail.value),
- aH: $data.familyMemberErrors.relation
- }, $data.familyMemberErrors.relation ? {
- aI: common_vendor.t($data.familyMemberErrors.relation)
- } : {}) : {}, {
- aJ: $options.showFamilyNameField
- }, $options.showFamilyNameField ? common_vendor.e({
- aK: $data.familyMemberErrors.name ? 1 : "",
- aL: $data.familyMemberForm.name,
- aM: common_vendor.o(($event) => $data.familyMemberForm.name = $event.detail.value),
- aN: $data.familyMemberErrors.name
- }, $data.familyMemberErrors.name ? {
- aO: common_vendor.t($data.familyMemberErrors.name)
- } : {}) : {}, {
- aP: $options.showFamilyWorkplaceField
- }, $options.showFamilyWorkplaceField ? {
- aQ: $data.familyMemberForm.workplaceOrAddress,
- aR: common_vendor.o(($event) => $data.familyMemberForm.workplaceOrAddress = $event.detail.value)
- } : {}, {
- aS: $options.showFamilyPositionField
- }, $options.showFamilyPositionField ? {
- aT: $data.familyMemberForm.position,
- aU: common_vendor.o(($event) => $data.familyMemberForm.position = $event.detail.value)
- } : {}, {
- aV: $options.showFamilyPhoneField
- }, $options.showFamilyPhoneField ? common_vendor.e({
- aW: $data.familyMemberErrors.phone ? 1 : "",
- aX: $data.familyMemberForm.phone,
- aY: common_vendor.o(($event) => $data.familyMemberForm.phone = $event.detail.value),
- aZ: $data.familyMemberErrors.phone
- }, $data.familyMemberErrors.phone ? {
- ba: common_vendor.t($data.familyMemberErrors.phone)
- } : {}) : {}, {
- bb: $data.familyMemberForm.isEmergencyContact,
- bc: common_vendor.o((...args) => $options.handleEmergencyContactChange && $options.handleEmergencyContactChange(...args)),
- bd: common_vendor.t($data.isEditing ? "✓" : "+"),
- be: common_vendor.o((...args) => $options.saveFamilyMember && $options.saveFamilyMember(...args)),
- bf: common_vendor.t($data.isEditing ? "保存修改" : "添加成员")
- }) : {}, {
- bg: $data.currentStep === 5
- }, $data.currentStep === 5 ? common_vendor.e({
- bh: $data.educationList.length > 0
- }, $data.educationList.length > 0 ? {
- bi: common_vendor.f($data.educationList, (edu, index, i0) => {
- return common_vendor.e({
- a: common_vendor.t(index === 0 ? "第一学历" : "最高学历"),
- b: common_vendor.o(($event) => $options.editEducation(index), index),
- c: common_vendor.o(($event) => $options.deleteEducation(index), index)
- }, $options.showEducationTimeField ? {
- d: common_vendor.t(edu.startTime),
- e: common_vendor.t(edu.endTime)
- } : {}, $options.showEducationSchoolField ? {
- f: common_vendor.t(edu.schoolName)
- } : {}, $options.showEducationMajorField ? {
- g: common_vendor.t(edu.major)
- } : {}, $options.showEducationDegreeField ? {
- h: common_vendor.t(edu.degree)
- } : {}, {
- i: index
- });
- }),
- bj: $options.showEducationTimeField,
- bk: $options.showEducationSchoolField,
- bl: $options.showEducationMajorField,
- bm: $options.showEducationDegreeField
- } : {}, {
- bn: $data.educationList.length < 2 || $data.isEditingEducation
- }, $data.educationList.length < 2 || $data.isEditingEducation ? common_vendor.e({
- bo: common_vendor.t($data.isEditingEducation ? "编辑教育经历" : $data.educationList.length === 0 ? "添加第一学历" : "添加最高学历"),
- bp: $data.isEditingEducation
- }, $data.isEditingEducation ? {
- bq: common_vendor.o((...args) => $options.cancelEditEducation && $options.cancelEditEducation(...args))
- } : {}, {
- br: $options.showEducationTimeField
- }, $options.showEducationTimeField ? common_vendor.e({
- bs: common_vendor.t($data.educationForm.startTime || "开始时间"),
- bt: $data.educationForm.startTime,
- bv: common_vendor.o((...args) => $options.bindStartTimeChange && $options.bindStartTimeChange(...args)),
- bw: $data.educationErrors.startTime ? 1 : "",
- bx: common_vendor.t($data.educationForm.endTime || "结束时间"),
- by: $data.educationForm.endTime,
- bz: common_vendor.o((...args) => $options.bindEndTimeChange && $options.bindEndTimeChange(...args)),
- bA: $data.educationErrors.endTime ? 1 : "",
- bB: $data.educationErrors.startTime
- }, $data.educationErrors.startTime ? {
- bC: common_vendor.t($data.educationErrors.startTime)
- } : {}, {
- bD: $data.educationErrors.endTime
- }, $data.educationErrors.endTime ? {
- bE: common_vendor.t($data.educationErrors.endTime)
- } : {}) : {}, {
- bF: $options.showEducationSchoolField
- }, $options.showEducationSchoolField ? common_vendor.e({
- bG: $data.educationErrors.schoolName ? 1 : "",
- bH: $data.educationForm.schoolName,
- bI: common_vendor.o(($event) => $data.educationForm.schoolName = $event.detail.value),
- bJ: $data.educationErrors.schoolName
- }, $data.educationErrors.schoolName ? {
- bK: common_vendor.t($data.educationErrors.schoolName)
- } : {}) : {}, {
- bL: $options.showEducationMajorField
- }, $options.showEducationMajorField ? common_vendor.e({
- bM: $data.educationErrors.major ? 1 : "",
- bN: $data.educationForm.major,
- bO: common_vendor.o(($event) => $data.educationForm.major = $event.detail.value),
- bP: $data.educationErrors.major
- }, $data.educationErrors.major ? {
- bQ: common_vendor.t($data.educationErrors.major)
- } : {}) : {}, {
- bR: $options.showEducationDegreeField
- }, $options.showEducationDegreeField ? common_vendor.e({
- bS: common_vendor.t($data.degreeOptions[$data.degreeIndex] || "请选择学历"),
- bT: common_vendor.o((...args) => $options.bindDegreeChange && $options.bindDegreeChange(...args)),
- bU: $data.degreeIndex,
- bV: $data.degreeOptions,
- bW: $data.educationErrors.degree ? 1 : "",
- bX: $data.educationErrors.degree
- }, $data.educationErrors.degree ? {
- bY: common_vendor.t($data.educationErrors.degree)
- } : {}) : {}, {
- bZ: common_vendor.t($data.isEditingEducation ? "✓" : "+"),
- ca: common_vendor.o((...args) => $options.saveEducation && $options.saveEducation(...args)),
- cb: common_vendor.t($data.isEditingEducation ? "保存修改" : "添加学历")
- }) : {}) : {}, {
- cc: $data.currentStep === 6 && ($options.showRequireTrainingInfoField || $options.showRequireProfessionalSkillsField)
- }, $data.currentStep === 6 && ($options.showRequireTrainingInfoField || $options.showRequireProfessionalSkillsField) ? common_vendor.e({
- cd: $options.showRequireTrainingInfoField
- }, $options.showRequireTrainingInfoField ? {} : {}, {
- ce: $options.showRequireTrainingInfoField
- }, $options.showRequireTrainingInfoField ? common_vendor.e({
- cf: $data.formErrors.skills ? 1 : "",
- cg: $data.formData.skills,
- ch: common_vendor.o(($event) => $data.formData.skills = $event.detail.value),
- ci: $data.formErrors.skills
- }, $data.formErrors.skills ? {
- cj: common_vendor.t($data.formErrors.skills)
- } : {}) : {}, {
- ck: $options.showRequireProfessionalSkillsField
- }, $options.showRequireProfessionalSkillsField ? {} : {}, {
- cl: $options.showRequireProfessionalSkillsField
- }, $options.showRequireProfessionalSkillsField ? common_vendor.e({
- cm: $data.formErrors.training ? 1 : "",
- cn: $data.formData.training,
- co: common_vendor.o(($event) => $data.formData.training = $event.detail.value),
- cp: $data.formErrors.training
- }, $data.formErrors.training ? {
- cq: common_vendor.t($data.formErrors.training)
- } : {}) : {}) : {}, {
- cr: $data.currentStep === 8
- }, $data.currentStep === 8 ? common_vendor.e({
- cs: $data.workList.length > 0
- }, $data.workList.length > 0 ? {
- ct: common_vendor.f($data.workList, (work, index, i0) => {
- return common_vendor.e({
- a: common_vendor.t(index + 1),
- b: common_vendor.o(($event) => $options.editWork(index), index),
- c: common_vendor.o(($event) => $options.deleteWork(index), index)
- }, $options.showWorkTimeField ? {
- d: common_vendor.t(work.startTime),
- e: common_vendor.t(work.endTime)
- } : {}, $options.showWorkCompanyField ? {
- f: common_vendor.t(work.companyName)
- } : {}, $options.showWorkDepartmentField ? {
- g: common_vendor.t(work.department)
- } : {}, $options.showWorkEmployeeCountField ? {
- h: common_vendor.t(work.employeeCount)
- } : {}, $options.showWorkPositionField ? {
- i: common_vendor.t(work.position)
- } : {}, {
- j: common_vendor.t(work.monthlySalary),
- k: common_vendor.t(work.supervisor),
- l: common_vendor.t(work.supervisorPhone),
- m: index
- });
- }),
- cv: $options.showWorkTimeField,
- cw: $options.showWorkCompanyField,
- cx: $options.showWorkDepartmentField,
- cy: $options.showWorkEmployeeCountField,
- cz: $options.showWorkPositionField
- } : {}, {
- cA: $data.workList.length < 2 || $data.isEditingWork
- }, $data.workList.length < 2 || $data.isEditingWork ? common_vendor.e({
- cB: common_vendor.t($data.isEditingWork ? "编辑工作经历" : "添加工作经历"),
- cC: $data.isEditingWork
- }, $data.isEditingWork ? {
- cD: common_vendor.o((...args) => $options.cancelEditWork && $options.cancelEditWork(...args))
- } : {}, {
- cE: $options.showWorkTimeField
- }, $options.showWorkTimeField ? common_vendor.e({
- cF: common_vendor.t($data.workForm.startTime || "开始时间"),
- cG: $data.workForm.startTime,
- cH: common_vendor.o((...args) => $options.bindWorkStartTimeChange && $options.bindWorkStartTimeChange(...args)),
- cI: $data.workErrors.startTime ? 1 : "",
- cJ: common_vendor.t($data.workForm.endTime || "结束时间"),
- cK: $data.workForm.endTime,
- cL: common_vendor.o((...args) => $options.bindWorkEndTimeChange && $options.bindWorkEndTimeChange(...args)),
- cM: $data.workErrors.endTime ? 1 : "",
- cN: $data.workErrors.startTime
- }, $data.workErrors.startTime ? {
- cO: common_vendor.t($data.workErrors.startTime)
- } : {}, {
- cP: $data.workErrors.endTime
- }, $data.workErrors.endTime ? {
- cQ: common_vendor.t($data.workErrors.endTime)
- } : {}) : {}, {
- cR: $options.showWorkCompanyField
- }, $options.showWorkCompanyField ? common_vendor.e({
- cS: $data.workErrors.companyName ? 1 : "",
- cT: $data.workForm.companyName,
- cU: common_vendor.o(($event) => $data.workForm.companyName = $event.detail.value),
- cV: $data.workErrors.companyName
- }, $data.workErrors.companyName ? {
- cW: common_vendor.t($data.workErrors.companyName)
- } : {}) : {}, {
- cX: $options.showWorkEmployeeCountField
- }, $options.showWorkEmployeeCountField ? common_vendor.e({
- cY: $data.workErrors.employeeCount ? 1 : "",
- cZ: $data.workForm.employeeCount,
- da: common_vendor.o(($event) => $data.workForm.employeeCount = $event.detail.value),
- db: $data.workErrors.employeeCount
- }, $data.workErrors.employeeCount ? {
- dc: common_vendor.t($data.workErrors.employeeCount)
- } : {}) : {}, {
- dd: $options.showWorkDepartmentField
- }, $options.showWorkDepartmentField ? common_vendor.e({
- de: $data.workErrors.department ? 1 : "",
- df: $data.workForm.department,
- dg: common_vendor.o(($event) => $data.workForm.department = $event.detail.value),
- dh: $data.workErrors.department
- }, $data.workErrors.department ? {
- di: common_vendor.t($data.workErrors.department)
- } : {}) : {}, {
- dj: $options.showWorkPositionField
- }, $options.showWorkPositionField ? common_vendor.e({
- dk: $data.workErrors.position ? 1 : "",
- dl: $data.workForm.position,
- dm: common_vendor.o(($event) => $data.workForm.position = $event.detail.value),
- dn: $data.workErrors.position
- }, $data.workErrors.position ? {
- dp: common_vendor.t($data.workErrors.position)
- } : {}) : {}, {
- dq: $data.workForm.monthlySalary,
- dr: common_vendor.o(($event) => $data.workForm.monthlySalary = $event.detail.value),
- ds: $data.workErrors.monthlySalary
- }, $data.workErrors.monthlySalary ? {
- dt: common_vendor.t($data.workErrors.monthlySalary)
- } : {}, {
- dv: $data.workForm.supervisor,
- dw: common_vendor.o(($event) => $data.workForm.supervisor = $event.detail.value),
- dx: $data.workErrors.supervisor
- }, $data.workErrors.supervisor ? {
- dy: common_vendor.t($data.workErrors.supervisor)
- } : {}, {
- dz: $data.workForm.supervisorPhone,
- dA: common_vendor.o(($event) => $data.workForm.supervisorPhone = $event.detail.value),
- dB: $data.workErrors.supervisorPhone
- }, $data.workErrors.supervisorPhone ? {
- dC: common_vendor.t($data.workErrors.supervisorPhone)
- } : {}, {
- dD: common_vendor.t($data.isEditingWork ? "✓" : "+"),
- dE: common_vendor.o((...args) => $options.saveWork && $options.saveWork(...args)),
- dF: common_vendor.t($data.isEditingWork ? "保存修改" : "添加工作经历")
- }) : {}) : {}, {
- dG: $options.showPrevButton
- }, $options.showPrevButton ? {
- dH: common_vendor.o((...args) => $options.prevStep && $options.prevStep(...args))
- } : {}, {
- dI: $options.showNextButton
- }, $options.showNextButton ? {
- dJ: common_vendor.o((...args) => $options.nextStep && $options.nextStep(...args))
- } : {}, {
- dK: $options.showSubmitButton
- }, $options.showSubmitButton ? {
- dL: common_vendor.o((...args) => $options.submitForm && $options.submitForm(...args))
- } : {});
- }
- const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
- wx.createPage(MiniProgramPage);
|