Personal.js 73 KB

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