Personal.js 78 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. const common_config = require("../../common/config.js");
  4. const _sfc_main = {
  5. data() {
  6. return {
  7. // 添加承诺书相关数据
  8. showPromiseModal: true,
  9. promiseChecked: false,
  10. formData: {
  11. name: "",
  12. gender: "",
  13. threePeriod: "",
  14. birthDate: "",
  15. idCard: "",
  16. political: "",
  17. ethnic: "",
  18. height: "",
  19. weight: "",
  20. nativePlace: "",
  21. residence: "",
  22. marriage: "",
  23. expectedSalary: "",
  24. phone: "",
  25. email: "",
  26. currentAddress: "",
  27. emergencyContact: "",
  28. emergencyPhone: "",
  29. hobby: "",
  30. motto: "",
  31. // 添加应聘来源相关字段
  32. sourceType: "social",
  33. // 默认为社招
  34. socialSource: "",
  35. // 社招来源
  36. otherSocialSource: "",
  37. // 其他社招来源
  38. otherSchoolSource: "",
  39. // 其他学校来源
  40. // 添加技能和培训字段
  41. skills: "",
  42. training: ""
  43. },
  44. genderOptions: ["男", "女"],
  45. genderIndex: -1,
  46. threePeriodOptions: ["无", "孕期", "产期", "哺乳期"],
  47. threePeriodIndex: -1,
  48. politicalOptions: ["群众", "共青团员", "中共党员", "民主党派"],
  49. politicalIndex: -1,
  50. ethnicOptions: ["汉族", "蒙古族", "回族", "藏族", "维吾尔族", "其他"],
  51. ethnicIndex: -1,
  52. marriageOptions: ["未婚", "已婚", "离异", "丧偶"],
  53. marriageIndex: -1,
  54. familyMembers: [],
  55. familyMemberForm: {
  56. relation: "",
  57. name: "",
  58. workplaceOrAddress: "",
  59. position: "",
  60. phone: "",
  61. isEmergencyContact: false
  62. // 添加新字段
  63. },
  64. isEditing: false,
  65. editingIndex: -1,
  66. // 添加教育经历相关数据
  67. educationList: [],
  68. educationForm: {
  69. startTime: "",
  70. endTime: "",
  71. schoolName: "",
  72. major: "",
  73. degree: ""
  74. },
  75. isEditingEducation: false,
  76. editingEducationIndex: -1,
  77. degreeOptions: ["高中", "中专", "大专", "本科", "硕士", "博士"],
  78. degreeIndex: -1,
  79. // 添加工作经历相关数据
  80. workList: [],
  81. workForm: {
  82. startTime: "",
  83. endTime: "",
  84. companyName: "",
  85. department: "",
  86. employeeCount: "",
  87. position: "",
  88. monthlySalary: "",
  89. supervisor: "",
  90. supervisorPhone: ""
  91. },
  92. isEditingWork: false,
  93. editingWorkIndex: -1,
  94. // 添加步骤控制
  95. currentStep: 1,
  96. steps: [
  97. { id: 1, name: "基本信息" },
  98. { id: 3, name: "家庭成员" },
  99. { id: 5, name: "教育经历" },
  100. { id: 6, name: "专业技能" },
  101. { id: 8, name: "工作经历" }
  102. ],
  103. formErrors: {
  104. name: "",
  105. idCard: "",
  106. phone: "",
  107. gender: "",
  108. ethnic: "",
  109. currentAddress: "",
  110. height: "",
  111. weight: "",
  112. expectedSalary: "",
  113. skills: "",
  114. training: "",
  115. threePeriod: ""
  116. // 添加这一行
  117. },
  118. // Add loading state
  119. isLoading: true,
  120. familyMemberErrors: {
  121. relation: "",
  122. name: "",
  123. phone: "",
  124. workplaceOrAddress: "",
  125. position: ""
  126. },
  127. workErrors: {
  128. startTime: "",
  129. endTime: "",
  130. companyName: "",
  131. department: "",
  132. position: "",
  133. employeeCount: "",
  134. monthlySalary: "",
  135. supervisor: "",
  136. supervisorPhone: ""
  137. },
  138. // 在 data 中添加教育经历的错误提示对象
  139. educationErrors: {
  140. startTime: "",
  141. endTime: "",
  142. schoolName: "",
  143. major: "",
  144. degree: ""
  145. },
  146. // 添加统一的验证规则
  147. validationRules: {
  148. name: {
  149. required: true,
  150. message: "请输入姓名"
  151. },
  152. phone: {
  153. required: true,
  154. pattern: /^1[3-9]\d{9}$/,
  155. message: "请输入正确的手机号码",
  156. maxLength: 11
  157. },
  158. idCard: {
  159. required: true,
  160. pattern: /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/,
  161. message: "请输入正确的身份证号码"
  162. },
  163. gender: {
  164. required: true,
  165. message: "请选择性别"
  166. },
  167. ethnic: {
  168. required: true,
  169. message: "请选择民族"
  170. },
  171. currentAddress: {
  172. required: true,
  173. message: "请输入现居住地址"
  174. },
  175. height: {
  176. pattern: /^\d+(\.\d{1,2})?$/,
  177. message: "请输入正确的身高(cm)"
  178. },
  179. weight: {
  180. pattern: /^\d+(\.\d{1,2})?$/,
  181. message: "请输入正确的体重(kg)"
  182. },
  183. expectedSalary: {
  184. pattern: /^\d+(\.\d{1,2})?$/,
  185. message: "请输入正确的期望薪资"
  186. }
  187. },
  188. // 获取配置信息
  189. configData: (() => {
  190. try {
  191. const configStr = common_vendor.index.getStorageSync("configData");
  192. if (configStr && configStr.trim()) {
  193. return JSON.parse(configStr);
  194. }
  195. return {};
  196. } catch (error) {
  197. console.warn("解析配置数据失败:", error);
  198. return {};
  199. }
  200. })()
  201. };
  202. },
  203. onLoad() {
  204. this.fetchUserData();
  205. console.log(this.configData);
  206. },
  207. computed: {
  208. // 添加计算属性来控制按钮显示
  209. showPrevButton() {
  210. return this.currentStep !== 1;
  211. },
  212. showNextButton() {
  213. return this.currentStep !== 8;
  214. },
  215. showSubmitButton() {
  216. return this.currentStep === 8;
  217. },
  218. // 获取当前步骤在数组中的索引
  219. currentStepIndex() {
  220. return this.steps.findIndex((step) => step.id === this.currentStep);
  221. },
  222. // 添加安全的配置访问器
  223. safeConfigData() {
  224. return this.configData || {};
  225. },
  226. safeProfileFieldsConfig() {
  227. return this.safeConfigData.profile_fields_config || {};
  228. },
  229. safeFamilyFieldsConfig() {
  230. return this.safeConfigData.family_fields_config || {};
  231. },
  232. safeEducationFieldsConfig() {
  233. return this.safeConfigData.education_fields_config || {};
  234. },
  235. safeWorkFieldsConfig() {
  236. return this.safeConfigData.work_experience_fields_config || {};
  237. },
  238. // 字段显示控制方法
  239. showNameField() {
  240. var _a;
  241. return Object.keys(this.safeProfileFieldsConfig).length === 0 || ((_a = this.safeProfileFieldsConfig.name) == null ? void 0 : _a.visible) !== false;
  242. },
  243. showGenderField() {
  244. var _a;
  245. return Object.keys(this.safeProfileFieldsConfig).length === 0 || ((_a = this.safeProfileFieldsConfig.gender) == null ? void 0 : _a.visible) !== false;
  246. },
  247. showPhoneField() {
  248. var _a;
  249. return Object.keys(this.safeProfileFieldsConfig).length === 0 || ((_a = this.safeProfileFieldsConfig.phone) == null ? void 0 : _a.visible) !== false;
  250. },
  251. showIdCardField() {
  252. var _a;
  253. return Object.keys(this.safeProfileFieldsConfig).length === 0 || ((_a = this.safeProfileFieldsConfig.id_card) == null ? void 0 : _a.visible) !== false;
  254. },
  255. showEthnicField() {
  256. var _a;
  257. return Object.keys(this.safeProfileFieldsConfig).length === 0 || ((_a = this.safeProfileFieldsConfig.ethnicity) == null ? void 0 : _a.visible) !== false;
  258. },
  259. showHeightField() {
  260. var _a;
  261. return Object.keys(this.safeProfileFieldsConfig).length === 0 || ((_a = this.safeProfileFieldsConfig.height) == null ? void 0 : _a.visible) !== false;
  262. },
  263. showWeightField() {
  264. var _a;
  265. return Object.keys(this.safeProfileFieldsConfig).length === 0 || ((_a = this.safeProfileFieldsConfig.weight) == null ? void 0 : _a.visible) !== false;
  266. },
  267. showCurrentAddress() {
  268. var _a;
  269. return Object.keys(this.safeProfileFieldsConfig).length === 0 || ((_a = this.safeProfileFieldsConfig.current_address) == null ? void 0 : _a.visible) !== false;
  270. },
  271. showResidence() {
  272. var _a;
  273. return Object.keys(this.safeProfileFieldsConfig).length === 0 || ((_a = this.safeProfileFieldsConfig.household_location) == null ? void 0 : _a.visible) !== false;
  274. },
  275. showMarriageIndex() {
  276. var _a;
  277. return ((_a = this.safeProfileFieldsConfig.marital_status) == null ? void 0 : _a.visible) !== false;
  278. },
  279. showExpectedSalary() {
  280. var _a;
  281. return ((_a = this.safeProfileFieldsConfig.expected_salary) == null ? void 0 : _a.visible) !== false;
  282. },
  283. // 家庭成员字段显示控制
  284. showFamilyRelationField() {
  285. var _a;
  286. return Object.keys(this.safeFamilyFieldsConfig).length === 0 || ((_a = this.safeFamilyFieldsConfig.relation) == null ? void 0 : _a.visible) !== false;
  287. },
  288. showFamilyNameField() {
  289. var _a;
  290. return Object.keys(this.safeFamilyFieldsConfig).length === 0 || ((_a = this.safeFamilyFieldsConfig.name) == null ? void 0 : _a.visible) !== false;
  291. },
  292. showFamilyWorkplaceField() {
  293. var _a;
  294. return Object.keys(this.safeFamilyFieldsConfig).length === 0 || ((_a = this.safeFamilyFieldsConfig.workplace) == null ? void 0 : _a.visible) !== false;
  295. },
  296. showFamilyPositionField() {
  297. var _a;
  298. return Object.keys(this.safeFamilyFieldsConfig).length === 0 || ((_a = this.safeFamilyFieldsConfig.position) == null ? void 0 : _a.visible) !== false;
  299. },
  300. showFamilyPhoneField() {
  301. var _a;
  302. return Object.keys(this.safeFamilyFieldsConfig).length === 0 || ((_a = this.safeFamilyFieldsConfig.phone) == null ? void 0 : _a.visible) !== false;
  303. },
  304. showFamilyisEmergency() {
  305. var _a;
  306. ((_a = this.safeFamilyFieldsConfig.family_contact_person) == null ? void 0 : _a.visible) !== false;
  307. },
  308. // 教育经历字段显示控制
  309. showEducationTimeField() {
  310. var _a, _b;
  311. return Object.keys(this.safeEducationFieldsConfig).length === 0 || ((_a = this.safeEducationFieldsConfig.start_date) == null ? void 0 : _a.visible) !== false && ((_b = this.safeEducationFieldsConfig.end_date) == null ? void 0 : _b.visible) !== false;
  312. },
  313. showEducationSchoolField() {
  314. var _a;
  315. return Object.keys(this.safeEducationFieldsConfig).length === 0 || ((_a = this.safeEducationFieldsConfig.school_name) == null ? void 0 : _a.visible) !== false;
  316. },
  317. showEducationMajorField() {
  318. var _a;
  319. return Object.keys(this.safeEducationFieldsConfig).length === 0 || ((_a = this.safeEducationFieldsConfig.major) == null ? void 0 : _a.visible) !== false;
  320. },
  321. showEducationDegreeField() {
  322. var _a;
  323. return Object.keys(this.safeEducationFieldsConfig).length === 0 || ((_a = this.safeEducationFieldsConfig.degree) == null ? void 0 : _a.visible) !== false;
  324. },
  325. // 工作经历字段显示控制
  326. showWorkTimeField() {
  327. var _a, _b;
  328. return Object.keys(this.safeWorkFieldsConfig).length === 0 || ((_a = this.safeWorkFieldsConfig.start_date) == null ? void 0 : _a.visible) !== false && ((_b = this.safeWorkFieldsConfig.end_date) == null ? void 0 : _b.visible) !== false;
  329. },
  330. showWorkCompanyField() {
  331. var _a;
  332. return Object.keys(this.safeWorkFieldsConfig).length === 0 || ((_a = this.safeWorkFieldsConfig.company_name) == null ? void 0 : _a.visible) !== false;
  333. },
  334. showWorkDepartmentField() {
  335. var _a;
  336. return Object.keys(this.safeWorkFieldsConfig).length === 0 || ((_a = this.safeWorkFieldsConfig.department) == null ? void 0 : _a.visible) !== false;
  337. },
  338. showWorkEmployeeCountField() {
  339. var _a;
  340. return Object.keys(this.safeWorkFieldsConfig).length === 0 || ((_a = this.safeWorkFieldsConfig.company_size) == null ? void 0 : _a.visible) !== false;
  341. },
  342. showWorkPositionField() {
  343. var _a;
  344. return Object.keys(this.safeWorkFieldsConfig).length === 0 || ((_a = this.safeWorkFieldsConfig.position) == null ? void 0 : _a.visible) !== false;
  345. },
  346. showWorkMonthlySalary() {
  347. var _a;
  348. return (_a = this.safeWorkFieldsConfig.monthly_income) == null ? void 0 : _a.visible;
  349. },
  350. showWorkSupervisor() {
  351. var _a;
  352. return (_a = this.safeWorkFieldsConfig.direct_supervisor) == null ? void 0 : _a.visible;
  353. },
  354. showWorkSupervisorPhone() {
  355. var _a;
  356. return (_a = this.safeWorkFieldsConfig.supervisor_phone) == null ? void 0 : _a.visible;
  357. },
  358. showRequireProfessionalSkillsField() {
  359. console.log(this.safeConfigData.require_professional_skills);
  360. const value = this.safeConfigData.require_professional_skills;
  361. return value === void 0 || value === null ? true : value;
  362. },
  363. showRequireTrainingInfoField() {
  364. console.log(this.safeConfigData.require_training_info);
  365. const value = this.safeConfigData.require_training_info;
  366. return value === void 0 || value === null ? true : value;
  367. },
  368. shouldShowSkillsStep() {
  369. return this.showRequireTrainingInfoField || this.showRequireProfessionalSkillsField;
  370. },
  371. // 判断是否显示教育经历步骤
  372. shouldShowEducationStep() {
  373. if (Object.keys(this.safeEducationFieldsConfig).length === 0) {
  374. return true;
  375. }
  376. const fields = ["start_date", "end_date", "school_name", "major", "degree"];
  377. return fields.some((field) => {
  378. var _a;
  379. return ((_a = this.safeEducationFieldsConfig[field]) == null ? void 0 : _a.visible) !== false;
  380. });
  381. },
  382. // 判断是否显示家庭成员步骤
  383. shouldShowFamilyStep() {
  384. if (Object.keys(this.safeFamilyFieldsConfig).length === 0) {
  385. return true;
  386. }
  387. const fields = ["relation", "name", "workplace", "position", "phone"];
  388. return fields.some((field) => {
  389. var _a;
  390. return ((_a = this.safeFamilyFieldsConfig[field]) == null ? void 0 : _a.visible) !== false;
  391. });
  392. }
  393. },
  394. methods: {
  395. // 输入时限制小数位数
  396. handleInput(event, field, maxDecimals) {
  397. let value = event.detail.value;
  398. value = value.replace(/[^\d.-]/g, "").replace(/(\..*)\./g, "$1").replace(/(-\d*)-/g, "$1").replace(new RegExp(`^(-?\\d*\\.\\d{${maxDecimals}}).*$`), "$1");
  399. if (value.startsWith(".")) {
  400. value = "0" + value;
  401. }
  402. this.formData[field] = value;
  403. this.$nextTick(() => {
  404. event.target.value = value;
  405. });
  406. },
  407. // 失焦时补全小数位
  408. handleBlur(field, precision = 2) {
  409. const val = this.formData[field];
  410. if (val === "" || val === void 0 || val === null)
  411. return;
  412. const num = parseFloat(val);
  413. if (!isNaN(num)) {
  414. this.formData[field] = num.toFixed(precision);
  415. } else {
  416. this.formData[field] = "";
  417. }
  418. },
  419. // 添加承诺书相关方法
  420. togglePromiseChecked() {
  421. this.promiseChecked = !this.promiseChecked;
  422. },
  423. confirmPromise() {
  424. if (this.promiseChecked) {
  425. this.showPromiseModal = false;
  426. } else {
  427. common_vendor.index.showToast({
  428. title: "请先阅读并同意承诺书内容",
  429. icon: "none"
  430. });
  431. }
  432. },
  433. // 添加字段是否需要验证的判断方法
  434. shouldValidateField(fieldName, section) {
  435. section = section || "profile";
  436. switch (section) {
  437. case "profile":
  438. const fieldShowMap = {
  439. "name": this.showNameField,
  440. "gender": this.showGenderField,
  441. "phone": this.showPhoneField,
  442. "idCard": this.showIdCardField,
  443. "ethnic": this.showEthnicField,
  444. "height": this.showHeightField,
  445. "weight": this.showWeightField,
  446. "currentAddress": this.showCurrentAddress,
  447. // 现居住地址总是显示和必填
  448. "expectedSalary": this.showExpectedSalary,
  449. // 期望薪资总是显示
  450. "skills": this.showRequireTrainingInfoField,
  451. // 专业技能根据配置显示和必填
  452. "training": this.showRequireProfessionalSkillsField,
  453. // 培训经历根据配置显示和必填
  454. "threePeriod": this.formData.gender === "女"
  455. // 只有女性时才需要验证三期状态
  456. };
  457. return fieldShowMap[fieldName] !== false;
  458. case "family":
  459. const familyFieldShowMap = {
  460. "relation": this.showFamilyRelationField,
  461. "name": this.showFamilyNameField,
  462. "phone": this.showFamilyPhoneField,
  463. "workplaceOrAddress": this.showFamilyWorkplaceField,
  464. "position": this.showFamilyPositionField,
  465. "isEmergencyContact": this.showFamilyisEmergency
  466. };
  467. return familyFieldShowMap[fieldName] !== false;
  468. case "education":
  469. const educationFieldShowMap = {
  470. "startTime": this.showEducationTimeField,
  471. "endTime": this.showEducationTimeField,
  472. "schoolName": this.showEducationSchoolField,
  473. "major": this.showEducationMajorField,
  474. "degree": this.showEducationDegreeField
  475. };
  476. return educationFieldShowMap[fieldName] !== false;
  477. case "work":
  478. const workFieldShowMap = {
  479. "startTime": this.showWorkTimeField,
  480. "endTime": this.showWorkTimeField,
  481. "companyName": this.showWorkCompanyField,
  482. "department": this.showWorkDepartmentField,
  483. "position": this.showWorkPositionField,
  484. "employeeCount": this.showWorkEmployeeCountField,
  485. "monthlySalary": this.showWorkMonthlySalary,
  486. // 月薪总是需要验证
  487. "supervisor": this.showWorkSupervisor,
  488. // 直接领导总是需要验证
  489. "supervisorPhone": this.showWorkSupervisorPhone
  490. // 领导电话总是需要验证
  491. };
  492. return workFieldShowMap[fieldName] !== false;
  493. default:
  494. return true;
  495. }
  496. },
  497. bindGenderChange(e) {
  498. this.genderIndex = e.detail.value;
  499. this.formData.gender = this.genderOptions[this.genderIndex];
  500. if (this.formErrors.gender) {
  501. this.formErrors.gender = "";
  502. }
  503. if (this.formData.gender !== "女") {
  504. this.formData.threePeriod = "";
  505. this.threePeriodIndex = -1;
  506. this.formErrors.threePeriod = "";
  507. }
  508. },
  509. bindThreePeriodChange(e) {
  510. this.threePeriodIndex = e.detail.value;
  511. this.formData.threePeriod = this.threePeriodOptions[this.threePeriodIndex];
  512. if (this.formErrors.threePeriod) {
  513. this.formErrors.threePeriod = "";
  514. }
  515. },
  516. bindPoliticalChange(e) {
  517. this.politicalIndex = e.detail.value;
  518. this.formData.political = this.politicalOptions[this.politicalIndex];
  519. },
  520. bindEthnicChange(e) {
  521. this.ethnicIndex = e.detail.value;
  522. this.formData.ethnic = this.ethnicOptions[this.ethnicIndex];
  523. if (this.formErrors.ethnic) {
  524. this.formErrors.ethnic = "";
  525. }
  526. },
  527. bindMarriageChange(e) {
  528. this.marriageIndex = e.detail.value;
  529. this.formData.marriage = this.marriageOptions[this.marriageIndex];
  530. },
  531. bindDateChange(e) {
  532. this.formData.birthDate = e.detail.value;
  533. },
  534. saveFamilyMember() {
  535. this.resetFamilyMemberErrors();
  536. let isValid = true;
  537. if (this.shouldValidateField("relation", "family") && !this.familyMemberForm.relation) {
  538. this.familyMemberErrors.relation = "请输入称谓";
  539. isValid = false;
  540. }
  541. if (this.shouldValidateField("name", "family") && !this.familyMemberForm.name) {
  542. this.familyMemberErrors.name = "请输入姓名";
  543. isValid = false;
  544. }
  545. if (this.shouldValidateField("phone", "family") && !this.familyMemberForm.phone) {
  546. this.familyMemberErrors.phone = "请输入联系电话";
  547. isValid = false;
  548. } else if (this.shouldValidateField("phone", "family") && this.familyMemberForm.phone && !/^1[3-9]\d{9}$/.test(this.familyMemberForm.phone)) {
  549. this.familyMemberErrors.phone = "请输入正确的手机号";
  550. isValid = false;
  551. }
  552. if (!isValid) {
  553. common_vendor.index.showToast({
  554. title: "请完善家庭成员信息",
  555. icon: "none"
  556. });
  557. return;
  558. }
  559. if (this.isEditing) {
  560. this.familyMembers[this.editingIndex] = { ...this.familyMemberForm };
  561. common_vendor.index.showToast({
  562. title: "修改成功",
  563. icon: "success"
  564. });
  565. this.isEditing = false;
  566. this.editingIndex = -1;
  567. } else {
  568. this.familyMembers.push({ ...this.familyMemberForm });
  569. common_vendor.index.showToast({
  570. title: "添加成功",
  571. icon: "success"
  572. });
  573. }
  574. this.resetFamilyMemberForm();
  575. },
  576. // 添加重置错误信息的方法
  577. resetFamilyMemberErrors() {
  578. this.familyMemberErrors = {
  579. relation: "",
  580. name: "",
  581. phone: "",
  582. workplaceOrAddress: "",
  583. position: ""
  584. };
  585. },
  586. // 修改重置表单的方法
  587. resetFamilyMemberForm() {
  588. this.familyMemberForm = {
  589. relation: "",
  590. name: "",
  591. workplaceOrAddress: "",
  592. position: "",
  593. phone: "",
  594. isEmergencyContact: false
  595. };
  596. this.resetFamilyMemberErrors();
  597. },
  598. editFamilyMember(index) {
  599. this.isEditing = true;
  600. this.editingIndex = index;
  601. this.familyMemberForm = { ...this.familyMembers[index] };
  602. common_vendor.index.pageScrollTo({
  603. selector: ".family-member-form",
  604. duration: 300
  605. });
  606. },
  607. cancelEdit() {
  608. this.isEditing = false;
  609. this.editingIndex = -1;
  610. this.familyMemberForm = {
  611. relation: "",
  612. name: "",
  613. workplaceOrAddress: "",
  614. position: "",
  615. phone: "",
  616. isEmergencyContact: false
  617. };
  618. },
  619. deleteFamilyMember(index) {
  620. if (this.isEditing && this.editingIndex === index) {
  621. this.cancelEdit();
  622. }
  623. this.familyMembers.splice(index, 1);
  624. common_vendor.index.showToast({
  625. title: "已删除",
  626. icon: "none"
  627. });
  628. },
  629. // 选择应聘来源类型
  630. selectSourceType(type) {
  631. this.formData.sourceType = type;
  632. if (type === "social") {
  633. this.formData.socialSource = "BOSS";
  634. } else {
  635. this.formData.socialSource = "";
  636. }
  637. },
  638. // 选择社招来源
  639. selectSocialSource(source) {
  640. this.formData.sourceType = "social";
  641. this.formData.socialSource = source;
  642. },
  643. // 教育经历相关方法
  644. bindStartTimeChange(e) {
  645. const startTime = e.detail.value;
  646. if (this.educationForm.endTime && startTime > this.educationForm.endTime) {
  647. common_vendor.index.showToast({
  648. title: "开始时间不能大于结束时间",
  649. icon: "none"
  650. });
  651. return;
  652. }
  653. this.educationForm.startTime = startTime;
  654. this.educationErrors.startTime = false;
  655. },
  656. bindEndTimeChange(e) {
  657. const endTime = e.detail.value;
  658. if (this.educationForm.startTime && endTime < this.educationForm.startTime) {
  659. common_vendor.index.showToast({
  660. title: "结束时间不能小于开始时间",
  661. icon: "none"
  662. });
  663. return;
  664. }
  665. this.educationForm.endTime = endTime;
  666. this.educationErrors.endTime = false;
  667. },
  668. bindDegreeChange(e) {
  669. this.degreeIndex = e.detail.value;
  670. this.educationForm.degree = this.degreeOptions[this.degreeIndex];
  671. },
  672. saveEducation() {
  673. this.resetEducationErrors();
  674. let isValid = true;
  675. if (this.shouldValidateField("startTime", "education") && !this.educationForm.startTime) {
  676. this.educationErrors.startTime = "请选择开始时间";
  677. isValid = false;
  678. }
  679. if (this.shouldValidateField("endTime", "education") && !this.educationForm.endTime) {
  680. this.educationErrors.endTime = "请选择结束时间";
  681. isValid = false;
  682. }
  683. if (this.shouldValidateField("schoolName", "education") && !this.educationForm.schoolName) {
  684. this.educationErrors.schoolName = "请输入学校名称";
  685. isValid = false;
  686. }
  687. if (this.shouldValidateField("major", "education") && !this.educationForm.major) {
  688. this.educationErrors.major = "请输入专业";
  689. isValid = false;
  690. }
  691. if (this.shouldValidateField("degree", "education") && !this.educationForm.degree) {
  692. this.educationErrors.degree = "请选择学历";
  693. isValid = false;
  694. }
  695. if (!isValid) {
  696. common_vendor.index.showToast({
  697. title: "请完善教育经历信息",
  698. icon: "none"
  699. });
  700. return;
  701. }
  702. if (this.isEditingEducation) {
  703. this.educationList[this.editingEducationIndex] = { ...this.educationForm };
  704. common_vendor.index.showToast({
  705. title: "修改成功",
  706. icon: "success"
  707. });
  708. this.isEditingEducation = false;
  709. this.editingEducationIndex = -1;
  710. } else {
  711. this.educationList.push({ ...this.educationForm });
  712. common_vendor.index.showToast({
  713. title: "添加成功",
  714. icon: "success"
  715. });
  716. }
  717. this.educationForm = {
  718. startTime: "",
  719. endTime: "",
  720. schoolName: "",
  721. major: "",
  722. degree: ""
  723. };
  724. this.degreeIndex = -1;
  725. },
  726. editEducation(index) {
  727. this.isEditingEducation = true;
  728. this.editingEducationIndex = index;
  729. this.educationForm = { ...this.educationList[index] };
  730. this.degreeIndex = this.degreeOptions.findIndex((item) => item === this.educationForm.degree);
  731. common_vendor.index.pageScrollTo({
  732. selector: ".education-form",
  733. duration: 300
  734. });
  735. },
  736. cancelEditEducation() {
  737. this.isEditingEducation = false;
  738. this.editingEducationIndex = -1;
  739. this.educationForm = {
  740. startTime: "",
  741. endTime: "",
  742. schoolName: "",
  743. major: "",
  744. degree: ""
  745. };
  746. this.degreeIndex = -1;
  747. },
  748. deleteEducation(index) {
  749. if (this.isEditingEducation && this.editingEducationIndex === index) {
  750. this.cancelEditEducation();
  751. }
  752. this.educationList.splice(index, 1);
  753. common_vendor.index.showToast({
  754. title: "已删除",
  755. icon: "none"
  756. });
  757. },
  758. // 工作经历相关方法
  759. bindWorkStartTimeChange(e) {
  760. const startTime = e.detail.value;
  761. if (this.workForm.endTime && startTime > this.workForm.endTime) {
  762. common_vendor.index.showToast({
  763. title: "开始时间不能大于结束时间",
  764. icon: "none"
  765. });
  766. return;
  767. }
  768. this.workForm.startTime = startTime;
  769. this.workErrors.startTime = false;
  770. },
  771. bindWorkEndTimeChange(e) {
  772. const endTime = e.detail.value;
  773. if (this.workForm.startTime && endTime < this.workForm.startTime) {
  774. common_vendor.index.showToast({
  775. title: "结束时间不能小于开始时间",
  776. icon: "none"
  777. });
  778. return;
  779. }
  780. this.workForm.endTime = endTime;
  781. this.workErrors.endTime = false;
  782. },
  783. saveWork() {
  784. this.workErrors = {
  785. startTime: "",
  786. endTime: "",
  787. companyName: "",
  788. department: "",
  789. position: "",
  790. employeeCount: "",
  791. monthlySalary: "",
  792. supervisor: "",
  793. supervisorPhone: ""
  794. };
  795. let isValid = true;
  796. if (this.shouldValidateField("startTime", "work") && !this.workForm.startTime) {
  797. this.workErrors.startTime = "请选择开始时间";
  798. isValid = false;
  799. }
  800. if (this.shouldValidateField("endTime", "work") && !this.workForm.endTime) {
  801. this.workErrors.endTime = "请选择结束时间";
  802. isValid = false;
  803. }
  804. if (this.shouldValidateField("companyName", "work") && !this.workForm.companyName) {
  805. this.workErrors.companyName = "请输入单位名称";
  806. isValid = false;
  807. }
  808. if (this.shouldValidateField("department", "work") && !this.workForm.department) {
  809. this.workErrors.department = "请输入任职部门";
  810. isValid = false;
  811. }
  812. if (this.shouldValidateField("position", "work") && !this.workForm.position) {
  813. this.workErrors.position = "请输入担任职务";
  814. isValid = false;
  815. }
  816. if (this.shouldValidateField("employeeCount", "work") && !this.workForm.employeeCount) {
  817. this.workErrors.employeeCount = "请输入单位人数";
  818. isValid = false;
  819. }
  820. if (this.shouldValidateField("monthlySalary", "work") && !this.workForm.monthlySalary) {
  821. this.workErrors.monthlySalary = "请输入月薪";
  822. isValid = false;
  823. }
  824. if (this.shouldValidateField("supervisor", "work") && !this.workForm.supervisor) {
  825. this.workErrors.supervisor = "请输入直属上级";
  826. isValid = false;
  827. }
  828. if (!isValid) {
  829. common_vendor.index.showToast({
  830. title: "请完善工作经历信息",
  831. icon: "none"
  832. });
  833. return;
  834. }
  835. if (this.isEditingWork) {
  836. this.workList[this.editingWorkIndex] = { ...this.workForm };
  837. common_vendor.index.showToast({
  838. title: "修改成功",
  839. icon: "success"
  840. });
  841. this.isEditingWork = false;
  842. this.editingWorkIndex = -1;
  843. } else {
  844. this.workList.push({ ...this.workForm });
  845. common_vendor.index.showToast({
  846. title: "添加成功",
  847. icon: "success"
  848. });
  849. }
  850. this.workForm = {
  851. startTime: "",
  852. endTime: "",
  853. companyName: "",
  854. department: "",
  855. employeeCount: "",
  856. position: "",
  857. monthlySalary: "",
  858. supervisor: "",
  859. supervisorPhone: ""
  860. };
  861. },
  862. editWork(index) {
  863. this.isEditingWork = true;
  864. this.editingWorkIndex = index;
  865. this.workForm = { ...this.workList[index] };
  866. common_vendor.index.pageScrollTo({
  867. selector: ".work-form",
  868. duration: 300
  869. });
  870. },
  871. cancelEditWork() {
  872. this.isEditingWork = false;
  873. this.editingWorkIndex = -1;
  874. this.workForm = {
  875. startTime: "",
  876. endTime: "",
  877. companyName: "",
  878. department: "",
  879. employeeCount: "",
  880. position: "",
  881. monthlySalary: "",
  882. supervisor: "",
  883. supervisorPhone: ""
  884. };
  885. },
  886. deleteWork(index) {
  887. if (this.isEditingWork && this.editingWorkIndex === index) {
  888. this.cancelEditWork();
  889. }
  890. this.workList.splice(index, 1);
  891. common_vendor.index.showToast({
  892. title: "已删除",
  893. icon: "none"
  894. });
  895. },
  896. submitForm() {
  897. var _a, _b;
  898. if (!this.validateCurrentStep()) {
  899. return;
  900. }
  901. const allRequired = [
  902. "name",
  903. "gender",
  904. "phone",
  905. "idCard",
  906. "ethnic",
  907. "currentAddress"
  908. ];
  909. let isValid = true;
  910. allRequired.forEach((field) => {
  911. if (this.shouldValidateField(field) && !this.validateField(field, this.formData[field])) {
  912. isValid = false;
  913. }
  914. });
  915. if (this.shouldValidateField("skills") && !((_a = this.formData.skills) == null ? void 0 : _a.trim())) {
  916. this.formErrors.skills = "请描述您的专业技能";
  917. isValid = false;
  918. }
  919. if (this.shouldValidateField("training") && !((_b = this.formData.training) == null ? void 0 : _b.trim())) {
  920. this.formErrors.training = "请描述您的培训经历";
  921. isValid = false;
  922. }
  923. if (!isValid) {
  924. common_vendor.index.showToast({
  925. title: "请完善所有必填信息",
  926. icon: "none"
  927. });
  928. return;
  929. }
  930. const userInfo = common_vendor.index.getStorageSync("userInfo");
  931. if (!userInfo) {
  932. common_vendor.index.showToast({
  933. title: "用户信息获取失败,请重新登录",
  934. icon: "none",
  935. duration: 2e3
  936. });
  937. return;
  938. }
  939. try {
  940. const userData = JSON.parse(userInfo);
  941. const submitData = {
  942. tenant_id: 1,
  943. user_id: userData.id,
  944. personal_info: {
  945. name: this.formData.name,
  946. gender: this.formData.gender,
  947. phone: this.formData.phone,
  948. id_card: this.formData.idCard,
  949. address: this.formData.currentAddress,
  950. professional_skills: this.formData.skills ? this.formData.skills.split(",") : []
  951. },
  952. profile: {
  953. female_status: this.getFemaleStatus(),
  954. marital_status: this.getMaritalStatus(),
  955. height: parseFloat(this.formData.height) || 0,
  956. weight: parseFloat(this.formData.weight) || 0,
  957. ethnicity: this.formData.ethnic,
  958. current_address: this.formData.currentAddress,
  959. expected_salary: parseFloat(this.formData.expectedSalary) || 0
  960. },
  961. educations: this.formatEducations(),
  962. family_members: this.formatFamilyMembers(),
  963. work_experiences: this.formatWorkExperiences()
  964. };
  965. if (!submitData.personal_info.name || !submitData.personal_info.gender || !submitData.personal_info.phone) {
  966. common_vendor.index.showToast({
  967. title: "基本信息不完整",
  968. icon: "none",
  969. duration: 2e3
  970. });
  971. return;
  972. }
  973. this.sendFormData(submitData);
  974. } catch (error) {
  975. console.error("数据处理错误:", error);
  976. common_vendor.index.showToast({
  977. title: "数据处理错误,请重试",
  978. icon: "none",
  979. duration: 2e3
  980. });
  981. }
  982. },
  983. // 辅助方法:发送表单数据
  984. sendFormData(submitData) {
  985. common_vendor.index.showLoading({ title: "提交中..." });
  986. const token = common_vendor.index.getStorageSync("token");
  987. common_vendor.index.request({
  988. url: `${common_config.apiBaseUrl}/wechat/user/profile/update`,
  989. method: "POST",
  990. data: submitData,
  991. header: {
  992. "content-type": "application/json",
  993. "Authorization": token ? `Bearer ${token}` : ""
  994. },
  995. success: (res) => {
  996. common_vendor.index.hideLoading();
  997. if (res.statusCode === 200) {
  998. if (res.data.code === 2e3) {
  999. common_vendor.index.showToast({
  1000. title: "提交成功",
  1001. icon: "success",
  1002. duration: 2e3
  1003. });
  1004. setTimeout(() => {
  1005. common_vendor.index.navigateTo({
  1006. url: "/pages/interview-notice/interview-notice"
  1007. });
  1008. }, 2e3);
  1009. } else {
  1010. common_vendor.index.showToast({
  1011. title: res.data.msg || "提交失败",
  1012. icon: "none",
  1013. duration: 2e3
  1014. });
  1015. }
  1016. } else {
  1017. common_vendor.index.showToast({
  1018. title: "服务器响应错误",
  1019. icon: "none",
  1020. duration: 2e3
  1021. });
  1022. }
  1023. },
  1024. fail: (err) => {
  1025. console.error("提交失败:", err);
  1026. common_vendor.index.hideLoading();
  1027. if (err.errMsg.includes("timeout")) {
  1028. common_vendor.index.showToast({
  1029. title: "请求超时,请检查网络后重试",
  1030. icon: "none",
  1031. duration: 2e3
  1032. });
  1033. } else if (err.errMsg.includes("fail")) {
  1034. common_vendor.index.showToast({
  1035. title: "网络连接失败,请检查网络设置",
  1036. icon: "none",
  1037. duration: 2e3
  1038. });
  1039. } else {
  1040. common_vendor.index.showToast({
  1041. title: "提交失败,请稍后重试",
  1042. icon: "none",
  1043. duration: 2e3
  1044. });
  1045. }
  1046. },
  1047. complete: () => {
  1048. }
  1049. });
  1050. },
  1051. // 数据格式化方法
  1052. getFemaleStatus() {
  1053. if (this.formData.gender !== "女")
  1054. return 0;
  1055. const statusMap = { "孕期": 1, "产期": 2, "哺乳期": 3 };
  1056. return statusMap[this.formData.threePeriod] || 0;
  1057. },
  1058. getMaritalStatus() {
  1059. const statusMap = { "未婚": 0, "已婚": 1, "离异": 2, "丧偶": 3 };
  1060. return statusMap[this.formData.marriage] || 0;
  1061. },
  1062. formatEducations() {
  1063. return this.educationList.map((edu, index) => ({
  1064. education_type: index === 0 ? 1 : 2,
  1065. degree: this.mapDegreeToNumber(edu.degree),
  1066. start_date: edu.startTime,
  1067. end_date: edu.endTime,
  1068. school_name: edu.schoolName,
  1069. major: edu.major
  1070. }));
  1071. },
  1072. formatFamilyMembers() {
  1073. return this.familyMembers.map((member) => ({
  1074. relation: member.relation,
  1075. name: member.name,
  1076. workplace: member.workplaceOrAddress,
  1077. position: member.position,
  1078. phone: member.phone
  1079. //is_emergency_contact: member.isEmergencyContact||false // 添加紧急联系人标识
  1080. }));
  1081. },
  1082. formatWorkExperiences() {
  1083. return this.workList.map((work) => ({
  1084. start_date: work.startTime,
  1085. end_date: work.endTime,
  1086. company_name: work.companyName,
  1087. department: work.department,
  1088. company_size: work.employeeCount,
  1089. position: work.position,
  1090. monthly_salary: work.monthlySalary,
  1091. supervisor_name: work.supervisor,
  1092. supervisor_phone: work.supervisorPhone
  1093. }));
  1094. },
  1095. // 学历映射辅助方法
  1096. mapDegreeToNumber(degreeText) {
  1097. const degreeMap = {
  1098. "高中": 1,
  1099. "中专": 1,
  1100. "大专": 2,
  1101. "本科": 3,
  1102. "硕士": 4,
  1103. "博士": 5
  1104. };
  1105. return degreeMap[degreeText] || 6;
  1106. },
  1107. prevStep() {
  1108. const prevIndex = this.currentStepIndex - 1;
  1109. if (prevIndex >= 0) {
  1110. let targetIndex = prevIndex;
  1111. while (targetIndex >= 0) {
  1112. const stepId = this.steps[targetIndex].id;
  1113. if (stepId === 6 && !this.shouldShowSkillsStep) {
  1114. targetIndex--;
  1115. continue;
  1116. }
  1117. if (stepId === 5 && !this.shouldShowEducationStep) {
  1118. targetIndex--;
  1119. continue;
  1120. }
  1121. if (stepId === 3 && !this.shouldShowFamilyStep) {
  1122. targetIndex--;
  1123. continue;
  1124. }
  1125. break;
  1126. }
  1127. if (targetIndex >= 0) {
  1128. this.currentStep = this.steps[targetIndex].id;
  1129. }
  1130. common_vendor.index.pageScrollTo({
  1131. scrollTop: 0,
  1132. duration: 300
  1133. });
  1134. }
  1135. },
  1136. nextStep() {
  1137. if (!this.validateCurrentStep()) {
  1138. return;
  1139. }
  1140. if (this.currentStep === 1) {
  1141. this.verifyIdentity();
  1142. return;
  1143. }
  1144. const nextIndex = this.currentStepIndex + 1;
  1145. if (nextIndex < this.steps.length) {
  1146. let targetIndex = nextIndex;
  1147. while (targetIndex < this.steps.length) {
  1148. const stepId = this.steps[targetIndex].id;
  1149. if (stepId === 3 && !this.shouldShowFamilyStep) {
  1150. targetIndex++;
  1151. continue;
  1152. }
  1153. if (stepId === 5 && !this.shouldShowEducationStep) {
  1154. targetIndex++;
  1155. continue;
  1156. }
  1157. if (stepId === 6 && !this.shouldShowSkillsStep) {
  1158. targetIndex++;
  1159. continue;
  1160. }
  1161. break;
  1162. }
  1163. if (targetIndex < this.steps.length) {
  1164. this.currentStep = this.steps[targetIndex].id;
  1165. }
  1166. common_vendor.index.pageScrollTo({
  1167. scrollTop: 0,
  1168. duration: 300
  1169. });
  1170. }
  1171. },
  1172. // 身份验证方法
  1173. verifyIdentity() {
  1174. this.formErrors = {
  1175. name: "",
  1176. idCard: "",
  1177. phone: ""
  1178. };
  1179. common_vendor.index.showLoading({
  1180. title: "身份验证中..."
  1181. });
  1182. common_vendor.index.request({
  1183. url: `${common_config.apiBaseUrl}/wechat/identity/verify`,
  1184. method: "POST",
  1185. data: {
  1186. name: this.formData.name,
  1187. id_number: this.formData.idCard,
  1188. mobile: this.formData.phone
  1189. },
  1190. header: {
  1191. "content-type": "application/x-www-form-urlencoded"
  1192. },
  1193. success: (res) => {
  1194. common_vendor.index.hideLoading();
  1195. console.log(res);
  1196. if (res.data.code === 200) {
  1197. const nextIndex = this.currentStepIndex + 1;
  1198. if (nextIndex < this.steps.length) {
  1199. this.currentStep = this.steps[nextIndex].id;
  1200. common_vendor.index.pageScrollTo({
  1201. scrollTop: 0,
  1202. duration: 300
  1203. });
  1204. }
  1205. this.setUserInfo(this.formData);
  1206. } else {
  1207. this.handleVerificationError(res.data);
  1208. }
  1209. },
  1210. fail: (err) => {
  1211. this.handleRequestError(err);
  1212. }
  1213. });
  1214. },
  1215. setUserInfo(data) {
  1216. common_vendor.index.request({
  1217. url: `${common_config.apiBaseUrl}/wechat/updateUserInfo`,
  1218. method: "POST",
  1219. data: {
  1220. openid: JSON.parse(common_vendor.index.getStorageSync("userInfo")).openid,
  1221. name: data.name,
  1222. id_card: data.idCard,
  1223. purePhoneNumber: data.phone,
  1224. tenant_id: 1,
  1225. examine: 0
  1226. },
  1227. header: {
  1228. "content-type": "application/x-www-form-urlencoded"
  1229. },
  1230. success: (res) => {
  1231. console.log(res);
  1232. }
  1233. });
  1234. },
  1235. // 处理验证错误
  1236. handleVerificationError(data) {
  1237. this.formErrors.name = "姓名验证失败,请检查姓名是否正确";
  1238. this.formErrors.idCard = "身份证号验证失败,请检查身份证号是否正确";
  1239. this.formErrors.phone = "手机号验证失败,请检查手机号是否正确";
  1240. common_vendor.index.showToast({
  1241. title: data.msg || "身份验证失败",
  1242. icon: "none"
  1243. });
  1244. },
  1245. // 处理请求错误
  1246. handleRequestError(err) {
  1247. common_vendor.index.hideLoading();
  1248. common_vendor.index.showToast({
  1249. title: "网络错误,请检查网络连接",
  1250. icon: "none",
  1251. duration: 2e3
  1252. });
  1253. console.error("请求失败:", err);
  1254. },
  1255. // 验证当前步骤的必填项
  1256. validateCurrentStep() {
  1257. var _a, _b;
  1258. let isValid = true;
  1259. switch (this.currentStep) {
  1260. case 1:
  1261. const basicFields = ["name", "gender", "phone", "idCard", "ethnic", "currentAddress"];
  1262. basicFields.forEach((field) => {
  1263. if (this.shouldValidateField(field) && !this.validateField(field, this.formData[field])) {
  1264. isValid = false;
  1265. }
  1266. });
  1267. if (this.shouldValidateField("threePeriod") && this.formData.gender === "女" && this.threePeriodIndex === -1) {
  1268. this.formErrors.threePeriod = "请选择三期状态";
  1269. isValid = false;
  1270. }
  1271. if (this.shouldValidateField("height") && this.formData.height) {
  1272. isValid = this.validateField("height", this.formData.height) && isValid;
  1273. }
  1274. if (this.shouldValidateField("weight") && this.formData.weight) {
  1275. isValid = this.validateField("weight", this.formData.weight) && isValid;
  1276. }
  1277. if (this.shouldValidateField("expectedSalary") && this.formData.expectedSalary) {
  1278. isValid = this.validateField("expectedSalary", this.formData.expectedSalary) && isValid;
  1279. }
  1280. break;
  1281. case 3:
  1282. console.log(this.familyMembers.length);
  1283. if (this.familyMembers.length == 0) {
  1284. common_vendor.index.showToast({
  1285. title: "请至少添加一位家庭成员",
  1286. icon: "none"
  1287. });
  1288. isValid = false;
  1289. }
  1290. break;
  1291. case 5:
  1292. if (this.educationList.length === 0) {
  1293. common_vendor.index.showToast({
  1294. title: "请至少添加一项教育经历",
  1295. icon: "none"
  1296. });
  1297. isValid = false;
  1298. }
  1299. break;
  1300. case 6:
  1301. if (this.shouldValidateField("skills") && !((_a = this.formData.skills) == null ? void 0 : _a.trim())) {
  1302. this.formErrors.skills = "请描述您的专业技能";
  1303. isValid = false;
  1304. }
  1305. if (this.shouldValidateField("training") && !((_b = this.formData.training) == null ? void 0 : _b.trim())) {
  1306. this.formErrors.training = "请描述您的培训经历";
  1307. isValid = false;
  1308. }
  1309. break;
  1310. case 8:
  1311. if (this.workList.length === 0) {
  1312. common_vendor.index.showToast({
  1313. title: "请至少添加一项工作经历",
  1314. icon: "none"
  1315. });
  1316. isValid = false;
  1317. }
  1318. break;
  1319. }
  1320. return isValid;
  1321. },
  1322. // Add method to fetch user data
  1323. fetchUserData() {
  1324. this.isLoading = true;
  1325. const userInfo = common_vendor.index.getStorageSync("userInfo") ? JSON.parse(common_vendor.index.getStorageSync("userInfo")) : {};
  1326. const openid = userInfo.openid;
  1327. if (!openid) {
  1328. common_vendor.index.showToast({
  1329. title: "用户信息获取失败,请重新登录",
  1330. icon: "none"
  1331. });
  1332. this.isLoading = false;
  1333. return;
  1334. }
  1335. common_vendor.index.request({
  1336. url: `${common_config.apiBaseUrl}/api/wechat/user/get_full_info?tenant_id=1&openid=${openid}`,
  1337. method: "GET",
  1338. success: (res) => {
  1339. this.showPromiseModal = true;
  1340. this.populateFormData(res.data.data);
  1341. },
  1342. fail: (err) => {
  1343. },
  1344. complete: () => {
  1345. this.isLoading = false;
  1346. }
  1347. });
  1348. },
  1349. // Add method to populate form data with fetched data
  1350. populateFormData(data) {
  1351. const { user_info, profile, educations, work_experiences, family_members } = data;
  1352. if (user_info) {
  1353. this.formData.name = user_info.name || "";
  1354. this.formData.gender = user_info.gender_text || "";
  1355. this.genderIndex = this.genderOptions.findIndex((item) => item === this.formData.gender);
  1356. this.formData.idCard = user_info.id_card || "";
  1357. this.formData.phone = user_info.phone || "";
  1358. this.formData.email = user_info.email || "";
  1359. }
  1360. if (profile) {
  1361. this.formData.political = profile.political_status || "";
  1362. this.politicalIndex = this.politicalOptions.findIndex((item) => item === this.formData.political);
  1363. this.formData.ethnic = profile.ethnicity || "";
  1364. this.ethnicIndex = this.ethnicOptions.findIndex((item) => item === this.formData.ethnic);
  1365. this.formData.height = profile.height || "";
  1366. this.formData.weight = profile.weight || "";
  1367. this.formData.nativePlace = profile.native_place || "";
  1368. this.formData.residence = profile.household_location || "";
  1369. this.formData.currentAddress = profile.current_address || "";
  1370. this.formData.marriage = profile.marital_status_text || "";
  1371. this.marriageIndex = this.marriageOptions.findIndex((item) => item === this.formData.marriage);
  1372. if (this.formData.gender === "女" && profile.female_status !== void 0) {
  1373. const femaleStatusMap = { 0: "无", 1: "孕期", 2: "产期", 3: "哺乳期" };
  1374. this.formData.threePeriod = femaleStatusMap[profile.female_status] || "无";
  1375. this.threePeriodIndex = this.threePeriodOptions.findIndex((item) => item === this.formData.threePeriod);
  1376. }
  1377. this.formData.expectedSalary = profile.expected_salary || "";
  1378. this.formData.emergencyContact = profile.emergency_contact || "";
  1379. this.formData.emergencyPhone = profile.emergency_phone || "";
  1380. this.formData.hobby = profile.specialties || "";
  1381. this.formData.motto = profile.life_motto || "";
  1382. const sourceTypeMap = {
  1383. 1: "school",
  1384. 2: "social",
  1385. 3: "social",
  1386. 4: "social",
  1387. 5: "social"
  1388. };
  1389. const socialSourceMap = {
  1390. 2: "BOSS",
  1391. 3: "zhilian",
  1392. 4: "liepin",
  1393. 5: "other"
  1394. };
  1395. this.formData.sourceType = sourceTypeMap[profile.recruitment_source] || "social";
  1396. if (this.formData.sourceType === "social") {
  1397. this.formData.socialSource = socialSourceMap[profile.recruitment_source] || "";
  1398. if (this.formData.socialSource === "other") {
  1399. this.formData.otherSocialSource = profile.recruitment_source_detail || "";
  1400. }
  1401. } else if (this.formData.sourceType === "school") {
  1402. this.formData.otherSchoolSource = profile.recruitment_source_detail || "";
  1403. }
  1404. }
  1405. if (educations && educations.length > 0) {
  1406. this.educationList = educations.map((edu) => {
  1407. const degreeMap = {
  1408. 1: "高中",
  1409. 2: "大专",
  1410. 3: "本科",
  1411. 4: "硕士",
  1412. 5: "博士"
  1413. };
  1414. return {
  1415. startTime: edu.start_date || "",
  1416. endTime: edu.end_date || "",
  1417. schoolName: edu.school_name || "",
  1418. major: edu.major || "",
  1419. degree: degreeMap[edu.degree] || ""
  1420. };
  1421. });
  1422. }
  1423. if (work_experiences && work_experiences.length > 0) {
  1424. this.workList = work_experiences.map((work) => {
  1425. return {
  1426. startTime: work.start_date || "",
  1427. endTime: work.end_date || "",
  1428. companyName: work.company_name || "",
  1429. department: work.department || "",
  1430. employeeCount: work.company_size || "",
  1431. position: work.position || "",
  1432. monthlySalary: work.monthly_salary || "",
  1433. supervisor: work.supervisor_name || "",
  1434. supervisorPhone: work.supervisor_phone || ""
  1435. };
  1436. });
  1437. }
  1438. if (family_members && family_members.length > 0) {
  1439. this.familyMembers = family_members.map((member) => {
  1440. return {
  1441. relation: member.relation || "",
  1442. name: member.name || "",
  1443. workplaceOrAddress: member.workplace || "",
  1444. position: member.position || "",
  1445. phone: member.phone || "",
  1446. isEmergencyContact: member.isEmergencyContact || false
  1447. };
  1448. });
  1449. }
  1450. },
  1451. // 处理紧急联系人开关变化
  1452. handleEmergencyContactChange(e) {
  1453. this.familyMemberForm.isEmergencyContact = e.detail.value;
  1454. if (e.detail.value) {
  1455. this.formData.emergencyContact = this.familyMemberForm.name;
  1456. this.formData.emergencyPhone = this.familyMemberForm.phone;
  1457. }
  1458. },
  1459. // 添加重置教育经历错误信息的方法
  1460. resetEducationErrors() {
  1461. this.educationErrors = {
  1462. startTime: "",
  1463. endTime: "",
  1464. schoolName: "",
  1465. major: "",
  1466. degree: ""
  1467. };
  1468. },
  1469. // 添加通用验证方法
  1470. validateField(fieldName, value) {
  1471. const rule = this.validationRules[fieldName];
  1472. if (!rule)
  1473. return true;
  1474. if (!this.shouldValidateField(fieldName)) {
  1475. return true;
  1476. }
  1477. this.formErrors[fieldName] = "";
  1478. if (rule.required && !value) {
  1479. this.formErrors[fieldName] = rule.message;
  1480. return false;
  1481. }
  1482. if (rule.pattern && value && !rule.pattern.test(value)) {
  1483. this.formErrors[fieldName] = rule.message;
  1484. return false;
  1485. }
  1486. return true;
  1487. },
  1488. validateExpectedSalary(e) {
  1489. const value = e.detail.value;
  1490. console.log(value);
  1491. if (value === "") {
  1492. this.formData.expectedSalary = "";
  1493. this.formErrors.expectedSalary = "";
  1494. return;
  1495. }
  1496. let num = parseFloat(value);
  1497. if (isNaN(num)) {
  1498. this.formErrors.expectedSalary = "请输入有效的数字";
  1499. return;
  1500. }
  1501. if (num < 0) {
  1502. num = 0;
  1503. this.formErrors.expectedSalary = "薪资不能小于0";
  1504. } else if (num > 1e5) {
  1505. num = 1e5;
  1506. this.formErrors.expectedSalary = "薪资不能超过100000";
  1507. }
  1508. this.formData.expectedSalary = num.toString();
  1509. },
  1510. validateEmployeeCount(e) {
  1511. const value = e.detail.value;
  1512. if (value === "") {
  1513. this.workForm.employeeCount = "";
  1514. this.workErrors.employeeCount = "";
  1515. return;
  1516. }
  1517. let num = parseInt(value);
  1518. if (isNaN(num)) {
  1519. this.workErrors.employeeCount = "请输入有效的数字";
  1520. return;
  1521. }
  1522. if (num < 0) {
  1523. num = 0;
  1524. this.workErrors.employeeCount = "人数不能小于0";
  1525. } else if (num > 1e4) {
  1526. num = 1e4;
  1527. this.workErrors.employeeCount = "人数不能超过10000";
  1528. }
  1529. this.workForm.employeeCount = num.toString();
  1530. },
  1531. validateMonthlySalary(e) {
  1532. const value = e.detail.value;
  1533. if (value === "") {
  1534. this.workForm.monthlySalary = "";
  1535. this.workErrors.monthlySalary = "";
  1536. return;
  1537. }
  1538. let num = parseInt(value);
  1539. if (isNaN(num)) {
  1540. this.workErrors.monthlySalary = "请输入有效的数字";
  1541. return;
  1542. }
  1543. if (num < 0) {
  1544. num = 0;
  1545. this.workErrors.monthlySalary = "月总收入不能小于0";
  1546. } else if (num > 1e5) {
  1547. num = 1e5;
  1548. this.workErrors.monthlySalary = "月总收入不能超过100000";
  1549. } else {
  1550. this.workErrors.monthlySalary = "";
  1551. }
  1552. this.workForm.monthlySalary = num.toString();
  1553. },
  1554. // 添加手机号验证方法
  1555. validatePhone(e) {
  1556. const value = e.detail.value;
  1557. if (value.length > 11) {
  1558. this.formData.phone = value.slice(0, 11);
  1559. }
  1560. if (value && !/^1[3-9]\d{0,9}$/.test(value)) {
  1561. this.formErrors.phone = "请输入正确的手机号码";
  1562. } else {
  1563. this.formErrors.phone = "";
  1564. }
  1565. }
  1566. },
  1567. // 添加监听器来清除错误信息
  1568. watch: {
  1569. "formData.name": function(newVal) {
  1570. if (newVal && this.formErrors.name) {
  1571. this.formErrors.name = "";
  1572. }
  1573. },
  1574. "formData.idCard": function(newVal) {
  1575. if (newVal && this.formErrors.idCard) {
  1576. this.formErrors.idCard = "";
  1577. }
  1578. },
  1579. "formData.phone": function(newVal) {
  1580. if (newVal && this.formErrors.phone) {
  1581. this.formErrors.phone = "";
  1582. }
  1583. },
  1584. "formData.gender": function(newVal) {
  1585. if (newVal && this.formErrors.gender) {
  1586. this.formErrors.gender = "";
  1587. }
  1588. },
  1589. "formData.ethnic": function(newVal) {
  1590. if (newVal && this.formErrors.ethnic) {
  1591. this.formErrors.ethnic = "";
  1592. }
  1593. },
  1594. "formData.currentAddress": function(newVal) {
  1595. if (newVal && this.formErrors.currentAddress) {
  1596. this.formErrors.currentAddress = "";
  1597. }
  1598. },
  1599. "formData.height": function(newVal) {
  1600. if (newVal && this.formErrors.height) {
  1601. this.formErrors.height = "";
  1602. }
  1603. },
  1604. "formData.weight": function(newVal) {
  1605. if (newVal && this.formErrors.weight) {
  1606. this.formErrors.weight = "";
  1607. }
  1608. },
  1609. "formData.expectedSalary": function(newVal) {
  1610. if (newVal && this.formErrors.expectedSalary) {
  1611. this.formErrors.expectedSalary = "";
  1612. }
  1613. },
  1614. "familyMemberForm.relation": function(newVal) {
  1615. if (newVal)
  1616. this.familyMemberErrors.relation = "";
  1617. },
  1618. "familyMemberForm.name": function(newVal) {
  1619. if (newVal)
  1620. this.familyMemberErrors.name = "";
  1621. },
  1622. "familyMemberForm.phone": function(newVal) {
  1623. if (newVal)
  1624. this.familyMemberErrors.phone = "";
  1625. },
  1626. /* 'familyMemberForm.workplaceOrAddress': function(newVal) {
  1627. if (newVal) this.familyMemberErrors.workplaceOrAddress = '';
  1628. },
  1629. 'familyMemberForm.position': function(newVal) {
  1630. if (newVal) this.familyMemberErrors.position = '';
  1631. }, */
  1632. "workForm.companyName": function(newVal) {
  1633. if (newVal && this.workErrors.companyName) {
  1634. this.workErrors.companyName = "";
  1635. }
  1636. },
  1637. "workForm.department": function(newVal) {
  1638. if (newVal && this.workErrors.department) {
  1639. this.workErrors.department = "";
  1640. }
  1641. },
  1642. "workForm.position": function(newVal) {
  1643. if (newVal && this.workErrors.position) {
  1644. this.workErrors.position = "";
  1645. }
  1646. },
  1647. "workForm.employeeCount": function(newVal) {
  1648. if (newVal && this.workErrors.employeeCount) {
  1649. this.workErrors.employeeCount = "";
  1650. }
  1651. },
  1652. "workForm.monthlySalary": function(newVal) {
  1653. if (newVal && this.workErrors.monthlySalary) {
  1654. this.workErrors.monthlySalary = "";
  1655. }
  1656. },
  1657. "workForm.supervisor": function(newVal) {
  1658. if (newVal && this.workErrors.supervisor) {
  1659. this.workErrors.supervisor = "";
  1660. }
  1661. },
  1662. // 'workForm.supervisorPhone': function(newVal) {
  1663. // if (newVal && this.workErrors.supervisorPhone) {
  1664. // this.workErrors.supervisorPhone = '';
  1665. // }
  1666. // },
  1667. "formData.training": function(newVal) {
  1668. if (newVal && this.formErrors.training) {
  1669. this.formErrors.training = "";
  1670. }
  1671. },
  1672. "educationForm.startTime": function(newVal) {
  1673. if (newVal)
  1674. this.educationErrors.startTime = "";
  1675. },
  1676. "educationForm.endTime": function(newVal) {
  1677. if (newVal)
  1678. this.educationErrors.endTime = "";
  1679. },
  1680. "educationForm.schoolName": function(newVal) {
  1681. if (newVal)
  1682. this.educationErrors.schoolName = "";
  1683. },
  1684. "educationForm.major": function(newVal) {
  1685. if (newVal)
  1686. this.educationErrors.major = "";
  1687. },
  1688. "educationForm.degree": function(newVal) {
  1689. if (newVal)
  1690. this.educationErrors.degree = "";
  1691. },
  1692. // 添加对表单字段的实时验证
  1693. "formData": {
  1694. handler(newVal) {
  1695. const currentStepFields = {
  1696. 1: ["name", "gender", "phone", "idCard", "ethnic", "currentAddress", "height", "weight", "expectedSalary"],
  1697. 6: ["skills", "training"]
  1698. }[this.currentStep];
  1699. if (currentStepFields) {
  1700. currentStepFields.forEach((field) => {
  1701. if (newVal[field] !== void 0 && this.shouldValidateField(field)) {
  1702. this.validateField(field, newVal[field]);
  1703. }
  1704. });
  1705. }
  1706. },
  1707. deep: true
  1708. }
  1709. }
  1710. };
  1711. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  1712. return common_vendor.e({
  1713. a: $data.isLoading
  1714. }, $data.isLoading ? {} : {}, {
  1715. b: $data.showPromiseModal
  1716. }, $data.showPromiseModal ? {
  1717. c: $data.promiseChecked,
  1718. d: common_vendor.o((...args) => $options.togglePromiseChecked && $options.togglePromiseChecked(...args)),
  1719. e: !$data.promiseChecked,
  1720. f: common_vendor.o((...args) => $options.confirmPromise && $options.confirmPromise(...args))
  1721. } : {}, {
  1722. g: $data.currentStep === 1
  1723. }, $data.currentStep === 1 ? common_vendor.e({
  1724. h: $options.showNameField
  1725. }, $options.showNameField ? common_vendor.e({
  1726. i: $data.formErrors.name ? 1 : "",
  1727. j: $data.formData.name,
  1728. k: common_vendor.o(($event) => $data.formData.name = $event.detail.value),
  1729. l: $data.formErrors.name
  1730. }, $data.formErrors.name ? {
  1731. m: common_vendor.t($data.formErrors.name)
  1732. } : {}) : {}, {
  1733. n: $options.showGenderField
  1734. }, $options.showGenderField ? common_vendor.e({
  1735. o: common_vendor.t($data.genderOptions[$data.genderIndex] || "请选择性别"),
  1736. p: $data.formErrors.gender ? 1 : "",
  1737. q: common_vendor.o((...args) => $options.bindGenderChange && $options.bindGenderChange(...args)),
  1738. r: $data.genderIndex,
  1739. s: $data.genderOptions,
  1740. t: $data.formErrors.gender
  1741. }, $data.formErrors.gender ? {
  1742. v: common_vendor.t($data.formErrors.gender)
  1743. } : {}) : {}, {
  1744. w: $data.formData.gender === "女"
  1745. }, $data.formData.gender === "女" ? common_vendor.e({
  1746. x: common_vendor.t($data.threePeriodOptions[$data.threePeriodIndex] || "请选择"),
  1747. y: common_vendor.o((...args) => $options.bindThreePeriodChange && $options.bindThreePeriodChange(...args)),
  1748. z: $data.threePeriodIndex,
  1749. A: $data.threePeriodOptions,
  1750. B: $data.formErrors.threePeriod ? 1 : "",
  1751. C: $data.formErrors.threePeriod
  1752. }, $data.formErrors.threePeriod ? {
  1753. D: common_vendor.t($data.formErrors.threePeriod)
  1754. } : {}) : {}, {
  1755. E: $options.showPhoneField
  1756. }, $options.showPhoneField ? common_vendor.e({
  1757. F: $data.formErrors.phone ? 1 : "",
  1758. G: common_vendor.o([($event) => $data.formData.phone = $event.detail.value, (...args) => $options.validatePhone && $options.validatePhone(...args)]),
  1759. H: $data.formData.phone,
  1760. I: $data.formErrors.phone
  1761. }, $data.formErrors.phone ? {
  1762. J: common_vendor.t($data.formErrors.phone)
  1763. } : {}) : {}, {
  1764. K: $options.showIdCardField
  1765. }, $options.showIdCardField ? common_vendor.e({
  1766. L: $data.formErrors.idCard ? 1 : "",
  1767. M: $data.formData.idCard,
  1768. N: common_vendor.o(($event) => $data.formData.idCard = $event.detail.value),
  1769. O: $data.formErrors.idCard
  1770. }, $data.formErrors.idCard ? {
  1771. P: common_vendor.t($data.formErrors.idCard)
  1772. } : {}) : {}, {
  1773. Q: $options.showEthnicField
  1774. }, $options.showEthnicField ? common_vendor.e({
  1775. R: common_vendor.t($data.ethnicOptions[$data.ethnicIndex] || "请选择民族"),
  1776. S: $data.formErrors.ethnic ? 1 : "",
  1777. T: common_vendor.o((...args) => $options.bindEthnicChange && $options.bindEthnicChange(...args)),
  1778. U: $data.ethnicIndex,
  1779. V: $data.ethnicOptions,
  1780. W: $data.formErrors.ethnic
  1781. }, $data.formErrors.ethnic ? {
  1782. X: common_vendor.t($data.formErrors.ethnic)
  1783. } : {}) : {}, {
  1784. Y: $options.showHeightField
  1785. }, $options.showHeightField ? {
  1786. Z: common_vendor.o([($event) => $data.formData.height = $event.detail.value, ($event) => $options.handleInput($event, "height", 2)]),
  1787. aa: common_vendor.o(($event) => $options.handleBlur("height")),
  1788. ab: $data.formData.height
  1789. } : {}, {
  1790. ac: $options.showWeightField
  1791. }, $options.showWeightField ? {
  1792. ad: common_vendor.o([($event) => $data.formData.weight = $event.detail.value, ($event) => $options.handleInput($event, "weight", 2)]),
  1793. ae: common_vendor.o(($event) => $options.handleBlur("weight")),
  1794. af: $data.formData.weight
  1795. } : {}, {
  1796. ag: $options.showCurrentAddress
  1797. }, $options.showCurrentAddress ? common_vendor.e({
  1798. ah: $data.formErrors.currentAddress ? 1 : "",
  1799. ai: $data.formData.currentAddress,
  1800. aj: common_vendor.o(($event) => $data.formData.currentAddress = $event.detail.value),
  1801. ak: $data.formErrors.currentAddress
  1802. }, $data.formErrors.currentAddress ? {
  1803. al: common_vendor.t($data.formErrors.currentAddress)
  1804. } : {}) : {}, {
  1805. am: $options.showResidence
  1806. }, $options.showResidence ? {
  1807. an: $data.formData.residence,
  1808. ao: common_vendor.o(($event) => $data.formData.residence = $event.detail.value)
  1809. } : {}, {
  1810. ap: $options.showMarriageIndex
  1811. }, $options.showMarriageIndex ? {
  1812. aq: common_vendor.t($data.marriageOptions[$data.marriageIndex] || "请选择婚育状况"),
  1813. ar: common_vendor.o((...args) => $options.bindMarriageChange && $options.bindMarriageChange(...args)),
  1814. as: $data.marriageIndex,
  1815. at: $data.marriageOptions
  1816. } : {}, {
  1817. av: $options.showExpectedSalary
  1818. }, $options.showExpectedSalary ? common_vendor.e({
  1819. aw: common_vendor.o((...args) => $options.validateExpectedSalary && $options.validateExpectedSalary(...args)),
  1820. ax: $data.formErrors.expectedSalary ? 1 : "",
  1821. ay: $data.formData.expectedSalary,
  1822. az: common_vendor.o(($event) => $data.formData.expectedSalary = $event.detail.value),
  1823. aA: $data.formErrors.expectedSalary
  1824. }, $data.formErrors.expectedSalary ? {
  1825. aB: common_vendor.t($data.formErrors.expectedSalary)
  1826. } : {}) : {}) : {}, {
  1827. aC: $data.currentStep === 3
  1828. }, $data.currentStep === 3 ? common_vendor.e({
  1829. aD: $data.familyMembers.length > 0
  1830. }, $data.familyMembers.length > 0 ? {
  1831. aE: common_vendor.f($data.familyMembers, (member, index, i0) => {
  1832. return common_vendor.e({
  1833. a: common_vendor.t(index + 1),
  1834. b: common_vendor.o(($event) => $options.editFamilyMember(index), index),
  1835. c: common_vendor.o(($event) => $options.deleteFamilyMember(index), index)
  1836. }, $options.showFamilyRelationField ? {
  1837. d: common_vendor.t(member.relation)
  1838. } : {}, $options.showFamilyNameField ? {
  1839. e: common_vendor.t(member.name)
  1840. } : {}, $options.showFamilyWorkplaceField ? {
  1841. f: common_vendor.t(member.workplaceOrAddress)
  1842. } : {}, $options.showFamilyPositionField ? {
  1843. g: common_vendor.t(member.position)
  1844. } : {}, $options.showFamilyPhoneField ? {
  1845. h: common_vendor.t(member.phone)
  1846. } : {}, {
  1847. i: common_vendor.t(member.isEmergencyContact ? "是" : "否"),
  1848. j: index
  1849. });
  1850. }),
  1851. aF: $options.showFamilyRelationField,
  1852. aG: $options.showFamilyNameField,
  1853. aH: $options.showFamilyWorkplaceField,
  1854. aI: $options.showFamilyPositionField,
  1855. aJ: $options.showFamilyPhoneField
  1856. } : {}, {
  1857. aK: common_vendor.t($data.isEditing ? "编辑家庭成员" : "添加家庭成员"),
  1858. aL: $data.isEditing
  1859. }, $data.isEditing ? {
  1860. aM: common_vendor.o((...args) => $options.cancelEdit && $options.cancelEdit(...args))
  1861. } : {}, {
  1862. aN: $options.showFamilyRelationField
  1863. }, $options.showFamilyRelationField ? common_vendor.e({
  1864. aO: $data.familyMemberErrors.relation ? 1 : "",
  1865. aP: $data.familyMemberForm.relation,
  1866. aQ: common_vendor.o(($event) => $data.familyMemberForm.relation = $event.detail.value),
  1867. aR: $data.familyMemberErrors.relation
  1868. }, $data.familyMemberErrors.relation ? {
  1869. aS: common_vendor.t($data.familyMemberErrors.relation)
  1870. } : {}) : {}, {
  1871. aT: $options.showFamilyNameField
  1872. }, $options.showFamilyNameField ? common_vendor.e({
  1873. aU: $data.familyMemberErrors.name ? 1 : "",
  1874. aV: $data.familyMemberForm.name,
  1875. aW: common_vendor.o(($event) => $data.familyMemberForm.name = $event.detail.value),
  1876. aX: $data.familyMemberErrors.name
  1877. }, $data.familyMemberErrors.name ? {
  1878. aY: common_vendor.t($data.familyMemberErrors.name)
  1879. } : {}) : {}, {
  1880. aZ: $options.showFamilyWorkplaceField
  1881. }, $options.showFamilyWorkplaceField ? {
  1882. ba: $data.familyMemberForm.workplaceOrAddress,
  1883. bb: common_vendor.o(($event) => $data.familyMemberForm.workplaceOrAddress = $event.detail.value)
  1884. } : {}, {
  1885. bc: $options.showFamilyPositionField
  1886. }, $options.showFamilyPositionField ? {
  1887. bd: $data.familyMemberForm.position,
  1888. be: common_vendor.o(($event) => $data.familyMemberForm.position = $event.detail.value)
  1889. } : {}, {
  1890. bf: $options.showFamilyPhoneField
  1891. }, $options.showFamilyPhoneField ? common_vendor.e({
  1892. bg: common_vendor.o([($event) => $data.familyMemberForm.phone = $event.detail.value, (...args) => $options.validatePhone && $options.validatePhone(...args)]),
  1893. bh: $data.familyMemberErrors.phone ? 1 : "",
  1894. bi: $data.familyMemberForm.phone,
  1895. bj: $data.familyMemberErrors.phone
  1896. }, $data.familyMemberErrors.phone ? {
  1897. bk: common_vendor.t($data.familyMemberErrors.phone)
  1898. } : {}) : {}, {
  1899. bl: $options.showFamilyisEmergency
  1900. }, $options.showFamilyisEmergency ? {
  1901. bm: $data.familyMemberForm.isEmergencyContact,
  1902. bn: common_vendor.o((...args) => $options.handleEmergencyContactChange && $options.handleEmergencyContactChange(...args))
  1903. } : {}, {
  1904. bo: common_vendor.t($data.isEditing ? "✓" : "+"),
  1905. bp: common_vendor.o((...args) => $options.saveFamilyMember && $options.saveFamilyMember(...args)),
  1906. bq: common_vendor.t($data.isEditing ? "保存修改" : "添加成员")
  1907. }) : {}, {
  1908. br: $data.currentStep === 5
  1909. }, $data.currentStep === 5 ? common_vendor.e({
  1910. bs: $data.educationList.length > 0
  1911. }, $data.educationList.length > 0 ? {
  1912. bt: common_vendor.f($data.educationList, (edu, index, i0) => {
  1913. return common_vendor.e({
  1914. a: common_vendor.t(index === 0 ? "第一学历" : "最高学历"),
  1915. b: common_vendor.o(($event) => $options.editEducation(index), index),
  1916. c: common_vendor.o(($event) => $options.deleteEducation(index), index)
  1917. }, $options.showEducationTimeField ? {
  1918. d: common_vendor.t(edu.startTime),
  1919. e: common_vendor.t(edu.endTime)
  1920. } : {}, $options.showEducationSchoolField ? {
  1921. f: common_vendor.t(edu.schoolName)
  1922. } : {}, $options.showEducationMajorField ? {
  1923. g: common_vendor.t(edu.major)
  1924. } : {}, $options.showEducationDegreeField ? {
  1925. h: common_vendor.t(edu.degree)
  1926. } : {}, {
  1927. i: index
  1928. });
  1929. }),
  1930. bv: $options.showEducationTimeField,
  1931. bw: $options.showEducationSchoolField,
  1932. bx: $options.showEducationMajorField,
  1933. by: $options.showEducationDegreeField
  1934. } : {}, {
  1935. bz: $data.educationList.length < 2 || $data.isEditingEducation
  1936. }, $data.educationList.length < 2 || $data.isEditingEducation ? common_vendor.e({
  1937. bA: common_vendor.t($data.isEditingEducation ? "编辑教育经历" : $data.educationList.length === 0 ? "添加第一学历" : "添加最高学历"),
  1938. bB: $data.isEditingEducation
  1939. }, $data.isEditingEducation ? {
  1940. bC: common_vendor.o((...args) => $options.cancelEditEducation && $options.cancelEditEducation(...args))
  1941. } : {}, {
  1942. bD: $options.showEducationTimeField
  1943. }, $options.showEducationTimeField ? common_vendor.e({
  1944. bE: common_vendor.t($data.educationForm.startTime || "开始时间"),
  1945. bF: $data.educationForm.startTime,
  1946. bG: common_vendor.o((...args) => $options.bindStartTimeChange && $options.bindStartTimeChange(...args)),
  1947. bH: $data.educationErrors.startTime ? 1 : "",
  1948. bI: common_vendor.t($data.educationForm.endTime || "结束时间"),
  1949. bJ: $data.educationForm.endTime,
  1950. bK: common_vendor.o((...args) => $options.bindEndTimeChange && $options.bindEndTimeChange(...args)),
  1951. bL: $data.educationErrors.endTime ? 1 : "",
  1952. bM: $data.educationErrors.startTime
  1953. }, $data.educationErrors.startTime ? {
  1954. bN: common_vendor.t($data.educationErrors.startTime)
  1955. } : {}, {
  1956. bO: $data.educationErrors.endTime
  1957. }, $data.educationErrors.endTime ? {
  1958. bP: common_vendor.t($data.educationErrors.endTime)
  1959. } : {}) : {}, {
  1960. bQ: $options.showEducationSchoolField
  1961. }, $options.showEducationSchoolField ? common_vendor.e({
  1962. bR: $data.educationErrors.schoolName ? 1 : "",
  1963. bS: $data.educationForm.schoolName,
  1964. bT: common_vendor.o(($event) => $data.educationForm.schoolName = $event.detail.value),
  1965. bU: $data.educationErrors.schoolName
  1966. }, $data.educationErrors.schoolName ? {
  1967. bV: common_vendor.t($data.educationErrors.schoolName)
  1968. } : {}) : {}, {
  1969. bW: $options.showEducationMajorField
  1970. }, $options.showEducationMajorField ? common_vendor.e({
  1971. bX: $data.educationErrors.major ? 1 : "",
  1972. bY: $data.educationForm.major,
  1973. bZ: common_vendor.o(($event) => $data.educationForm.major = $event.detail.value),
  1974. ca: $data.educationErrors.major
  1975. }, $data.educationErrors.major ? {
  1976. cb: common_vendor.t($data.educationErrors.major)
  1977. } : {}) : {}, {
  1978. cc: $options.showEducationDegreeField
  1979. }, $options.showEducationDegreeField ? common_vendor.e({
  1980. cd: common_vendor.t($data.degreeOptions[$data.degreeIndex] || "请选择学历"),
  1981. ce: common_vendor.o((...args) => $options.bindDegreeChange && $options.bindDegreeChange(...args)),
  1982. cf: $data.degreeIndex,
  1983. cg: $data.degreeOptions,
  1984. ch: $data.educationErrors.degree ? 1 : "",
  1985. ci: $data.educationErrors.degree
  1986. }, $data.educationErrors.degree ? {
  1987. cj: common_vendor.t($data.educationErrors.degree)
  1988. } : {}) : {}, {
  1989. ck: common_vendor.t($data.isEditingEducation ? "✓" : "+"),
  1990. cl: common_vendor.o((...args) => $options.saveEducation && $options.saveEducation(...args)),
  1991. cm: common_vendor.t($data.isEditingEducation ? "保存修改" : "添加学历")
  1992. }) : {}) : {}, {
  1993. cn: $data.currentStep === 6 && ($options.showRequireTrainingInfoField || $options.showRequireProfessionalSkillsField)
  1994. }, $data.currentStep === 6 && ($options.showRequireTrainingInfoField || $options.showRequireProfessionalSkillsField) ? common_vendor.e({
  1995. co: $options.showRequireTrainingInfoField
  1996. }, $options.showRequireTrainingInfoField ? {} : {}, {
  1997. cp: $options.showRequireTrainingInfoField
  1998. }, $options.showRequireTrainingInfoField ? common_vendor.e({
  1999. cq: $data.formErrors.skills ? 1 : "",
  2000. cr: $data.formData.skills,
  2001. cs: common_vendor.o(($event) => $data.formData.skills = $event.detail.value),
  2002. ct: $data.formErrors.skills
  2003. }, $data.formErrors.skills ? {
  2004. cv: common_vendor.t($data.formErrors.skills)
  2005. } : {}) : {}, {
  2006. cw: $options.showRequireProfessionalSkillsField
  2007. }, $options.showRequireProfessionalSkillsField ? {} : {}, {
  2008. cx: $options.showRequireProfessionalSkillsField
  2009. }, $options.showRequireProfessionalSkillsField ? common_vendor.e({
  2010. cy: $data.formErrors.training ? 1 : "",
  2011. cz: $data.formData.training,
  2012. cA: common_vendor.o(($event) => $data.formData.training = $event.detail.value),
  2013. cB: $data.formErrors.training
  2014. }, $data.formErrors.training ? {
  2015. cC: common_vendor.t($data.formErrors.training)
  2016. } : {}) : {}) : {}, {
  2017. cD: $data.currentStep === 8
  2018. }, $data.currentStep === 8 ? common_vendor.e({
  2019. cE: $data.workList.length > 0
  2020. }, $data.workList.length > 0 ? {
  2021. cF: common_vendor.f($data.workList, (work, index, i0) => {
  2022. return common_vendor.e({
  2023. a: common_vendor.t(index + 1),
  2024. b: common_vendor.o(($event) => $options.editWork(index), index),
  2025. c: common_vendor.o(($event) => $options.deleteWork(index), index)
  2026. }, $options.showWorkTimeField ? {
  2027. d: common_vendor.t(work.startTime),
  2028. e: common_vendor.t(work.endTime)
  2029. } : {}, $options.showWorkCompanyField ? {
  2030. f: common_vendor.t(work.companyName)
  2031. } : {}, $options.showWorkDepartmentField ? {
  2032. g: common_vendor.t(work.department)
  2033. } : {}, $options.showWorkEmployeeCountField ? {
  2034. h: common_vendor.t(work.employeeCount)
  2035. } : {}, $options.showWorkPositionField ? {
  2036. i: common_vendor.t(work.position)
  2037. } : {}, $options.showWorkMonthlySalary ? {
  2038. j: common_vendor.t(work.monthlySalary)
  2039. } : {}, $options.showWorkSupervisor ? {
  2040. k: common_vendor.t(work.supervisor)
  2041. } : {}, $options.showWorkSupervisorPhone ? {
  2042. l: common_vendor.t(work.supervisorPhone)
  2043. } : {}, {
  2044. m: index
  2045. });
  2046. }),
  2047. cG: $options.showWorkTimeField,
  2048. cH: $options.showWorkCompanyField,
  2049. cI: $options.showWorkDepartmentField,
  2050. cJ: $options.showWorkEmployeeCountField,
  2051. cK: $options.showWorkPositionField,
  2052. cL: $options.showWorkMonthlySalary,
  2053. cM: $options.showWorkSupervisor,
  2054. cN: $options.showWorkSupervisorPhone
  2055. } : {}, {
  2056. cO: $data.workList.length < 2 || $data.isEditingWork
  2057. }, $data.workList.length < 2 || $data.isEditingWork ? common_vendor.e({
  2058. cP: common_vendor.t($data.isEditingWork ? "编辑工作经历" : "添加工作经历"),
  2059. cQ: $data.isEditingWork
  2060. }, $data.isEditingWork ? {
  2061. cR: common_vendor.o((...args) => $options.cancelEditWork && $options.cancelEditWork(...args))
  2062. } : {}, {
  2063. cS: $options.showWorkTimeField
  2064. }, $options.showWorkTimeField ? common_vendor.e({
  2065. cT: common_vendor.t($data.workForm.startTime || "开始时间"),
  2066. cU: $data.workForm.startTime,
  2067. cV: common_vendor.o((...args) => $options.bindWorkStartTimeChange && $options.bindWorkStartTimeChange(...args)),
  2068. cW: $data.workErrors.startTime ? 1 : "",
  2069. cX: common_vendor.t($data.workForm.endTime || "结束时间"),
  2070. cY: $data.workForm.endTime,
  2071. cZ: common_vendor.o((...args) => $options.bindWorkEndTimeChange && $options.bindWorkEndTimeChange(...args)),
  2072. da: $data.workErrors.endTime ? 1 : "",
  2073. db: $data.workErrors.startTime
  2074. }, $data.workErrors.startTime ? {
  2075. dc: common_vendor.t($data.workErrors.startTime)
  2076. } : {}, {
  2077. dd: $data.workErrors.endTime
  2078. }, $data.workErrors.endTime ? {
  2079. de: common_vendor.t($data.workErrors.endTime)
  2080. } : {}) : {}, {
  2081. df: $options.showWorkCompanyField
  2082. }, $options.showWorkCompanyField ? common_vendor.e({
  2083. dg: $data.workErrors.companyName ? 1 : "",
  2084. dh: $data.workForm.companyName,
  2085. di: common_vendor.o(($event) => $data.workForm.companyName = $event.detail.value),
  2086. dj: $data.workErrors.companyName
  2087. }, $data.workErrors.companyName ? {
  2088. dk: common_vendor.t($data.workErrors.companyName)
  2089. } : {}) : {}, {
  2090. dl: $options.showWorkEmployeeCountField
  2091. }, $options.showWorkEmployeeCountField ? common_vendor.e({
  2092. dm: $data.workErrors.employeeCount ? 1 : "",
  2093. dn: common_vendor.o((...args) => $options.validateEmployeeCount && $options.validateEmployeeCount(...args)),
  2094. dp: $data.workForm.employeeCount,
  2095. dq: common_vendor.o(($event) => $data.workForm.employeeCount = $event.detail.value),
  2096. dr: $data.workErrors.employeeCount
  2097. }, $data.workErrors.employeeCount ? {
  2098. ds: common_vendor.t($data.workErrors.employeeCount)
  2099. } : {}) : {}, {
  2100. dt: $options.showWorkDepartmentField
  2101. }, $options.showWorkDepartmentField ? common_vendor.e({
  2102. dv: $data.workErrors.department ? 1 : "",
  2103. dw: $data.workForm.department,
  2104. dx: common_vendor.o(($event) => $data.workForm.department = $event.detail.value),
  2105. dy: $data.workErrors.department
  2106. }, $data.workErrors.department ? {
  2107. dz: common_vendor.t($data.workErrors.department)
  2108. } : {}) : {}, {
  2109. dA: $options.showWorkPositionField
  2110. }, $options.showWorkPositionField ? common_vendor.e({
  2111. dB: $data.workErrors.position ? 1 : "",
  2112. dC: $data.workForm.position,
  2113. dD: common_vendor.o(($event) => $data.workForm.position = $event.detail.value),
  2114. dE: $data.workErrors.position
  2115. }, $data.workErrors.position ? {
  2116. dF: common_vendor.t($data.workErrors.position)
  2117. } : {}) : {}, {
  2118. dG: $options.showWorkMonthlySalary
  2119. }, $options.showWorkMonthlySalary ? common_vendor.e({
  2120. dH: $data.workErrors.monthlySalary ? 1 : "",
  2121. dI: common_vendor.o([($event) => $data.workForm.monthlySalary = $event.detail.value, (...args) => $options.validateMonthlySalary && $options.validateMonthlySalary(...args)]),
  2122. dJ: $data.workForm.monthlySalary,
  2123. dK: $data.workErrors.monthlySalary
  2124. }, $data.workErrors.monthlySalary ? {
  2125. dL: common_vendor.t($data.workErrors.monthlySalary)
  2126. } : {}) : {}, {
  2127. dM: $options.showWorkSupervisor
  2128. }, $options.showWorkSupervisor ? common_vendor.e({
  2129. dN: $data.workForm.supervisor,
  2130. dO: common_vendor.o(($event) => $data.workForm.supervisor = $event.detail.value),
  2131. dP: $data.workErrors.supervisor
  2132. }, $data.workErrors.supervisor ? {
  2133. dQ: common_vendor.t($data.workErrors.supervisor)
  2134. } : {}) : {}, {
  2135. dR: $options.showWorkSupervisorPhone
  2136. }, $options.showWorkSupervisorPhone ? common_vendor.e({
  2137. dS: common_vendor.o([($event) => $data.workForm.supervisorPhone = $event.detail.value, (...args) => $options.validatePhone && $options.validatePhone(...args)]),
  2138. dT: $data.workForm.supervisorPhone,
  2139. dU: $data.workErrors.supervisorPhone
  2140. }, $data.workErrors.supervisorPhone ? {
  2141. dV: common_vendor.t($data.workErrors.supervisorPhone)
  2142. } : {}) : {}, {
  2143. dW: common_vendor.t($data.isEditingWork ? "✓" : "+"),
  2144. dX: common_vendor.o((...args) => $options.saveWork && $options.saveWork(...args)),
  2145. dY: common_vendor.t($data.isEditingWork ? "保存修改" : "添加工作经历")
  2146. }) : {}) : {}, {
  2147. dZ: $options.showPrevButton
  2148. }, $options.showPrevButton ? {
  2149. ea: common_vendor.o((...args) => $options.prevStep && $options.prevStep(...args))
  2150. } : {}, {
  2151. eb: $options.showNextButton
  2152. }, $options.showNextButton ? {
  2153. ec: common_vendor.o((...args) => $options.nextStep && $options.nextStep(...args))
  2154. } : {}, {
  2155. ed: $options.showSubmitButton
  2156. }, $options.showSubmitButton ? {
  2157. ee: common_vendor.o((...args) => $options.submitForm && $options.submitForm(...args))
  2158. } : {});
  2159. }
  2160. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
  2161. wx.createPage(MiniProgramPage);