Personal.js 76 KB

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