Personal.js 38 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099
  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. },
  62. isEditing: false,
  63. editingIndex: -1,
  64. // 添加教育经历相关数据
  65. educationList: [],
  66. educationForm: {
  67. startTime: "",
  68. endTime: "",
  69. schoolName: "",
  70. major: "",
  71. degree: ""
  72. },
  73. isEditingEducation: false,
  74. editingEducationIndex: -1,
  75. degreeOptions: ["高中", "中专", "大专", "本科", "硕士", "博士"],
  76. degreeIndex: -1,
  77. // 添加工作经历相关数据
  78. workList: [],
  79. workForm: {
  80. startTime: "",
  81. endTime: "",
  82. companyName: "",
  83. department: "",
  84. employeeCount: "",
  85. position: "",
  86. monthlySalary: "",
  87. supervisor: "",
  88. supervisorPhone: ""
  89. },
  90. isEditingWork: false,
  91. editingWorkIndex: -1,
  92. // 添加步骤控制
  93. currentStep: 1,
  94. steps: [
  95. { id: 1, name: "个人基本信息" },
  96. { id: 2, name: "紧急联系人信息" },
  97. { id: 3, name: "家庭成员信息" },
  98. { id: 4, name: "应聘来源" },
  99. { id: 5, name: "教育经历" },
  100. { id: 6, name: "专业技能" },
  101. { id: 7, name: "培训经历" },
  102. { id: 8, name: "工作经历" },
  103. { id: 9, name: "确认提交" }
  104. ],
  105. formErrors: {
  106. name: "",
  107. idCard: "",
  108. phone: ""
  109. }
  110. };
  111. },
  112. methods: {
  113. // 添加承诺书相关方法
  114. togglePromiseChecked() {
  115. this.promiseChecked = !this.promiseChecked;
  116. },
  117. confirmPromise() {
  118. if (this.promiseChecked) {
  119. this.showPromiseModal = false;
  120. } else {
  121. common_vendor.index.showToast({
  122. title: "请先阅读并同意承诺书内容",
  123. icon: "none"
  124. });
  125. }
  126. },
  127. bindGenderChange(e) {
  128. this.genderIndex = e.detail.value;
  129. this.formData.gender = this.genderOptions[this.genderIndex];
  130. if (this.formData.gender !== "女") {
  131. this.formData.threePeriod = "";
  132. this.threePeriodIndex = -1;
  133. }
  134. },
  135. bindThreePeriodChange(e) {
  136. this.threePeriodIndex = e.detail.value;
  137. this.formData.threePeriod = this.threePeriodOptions[this.threePeriodIndex];
  138. },
  139. bindPoliticalChange(e) {
  140. this.politicalIndex = e.detail.value;
  141. this.formData.political = this.politicalOptions[this.politicalIndex];
  142. },
  143. bindEthnicChange(e) {
  144. this.ethnicIndex = e.detail.value;
  145. this.formData.ethnic = this.ethnicOptions[this.ethnicIndex];
  146. },
  147. bindMarriageChange(e) {
  148. this.marriageIndex = e.detail.value;
  149. this.formData.marriage = this.marriageOptions[this.marriageIndex];
  150. },
  151. bindDateChange(e) {
  152. this.formData.birthDate = e.detail.value;
  153. },
  154. saveFamilyMember() {
  155. if (!this.familyMemberForm.relation) {
  156. common_vendor.index.showToast({
  157. title: "请输入称谓",
  158. icon: "none"
  159. });
  160. return;
  161. }
  162. if (!this.familyMemberForm.name) {
  163. common_vendor.index.showToast({
  164. title: "请输入姓名",
  165. icon: "none"
  166. });
  167. return;
  168. }
  169. if (!this.familyMemberForm.phone) {
  170. common_vendor.index.showToast({
  171. title: "请输入联系电话",
  172. icon: "none"
  173. });
  174. return;
  175. }
  176. if (this.isEditing) {
  177. this.familyMembers[this.editingIndex] = { ...this.familyMemberForm };
  178. common_vendor.index.showToast({
  179. title: "修改成功",
  180. icon: "success"
  181. });
  182. this.isEditing = false;
  183. this.editingIndex = -1;
  184. } else {
  185. this.familyMembers.push({ ...this.familyMemberForm });
  186. common_vendor.index.showToast({
  187. title: "添加成功",
  188. icon: "success"
  189. });
  190. }
  191. this.familyMemberForm = {
  192. relation: "",
  193. name: "",
  194. workplaceOrAddress: "",
  195. position: "",
  196. phone: ""
  197. };
  198. },
  199. editFamilyMember(index) {
  200. this.isEditing = true;
  201. this.editingIndex = index;
  202. this.familyMemberForm = { ...this.familyMembers[index] };
  203. common_vendor.index.pageScrollTo({
  204. selector: ".family-member-form",
  205. duration: 300
  206. });
  207. },
  208. cancelEdit() {
  209. this.isEditing = false;
  210. this.editingIndex = -1;
  211. this.familyMemberForm = {
  212. relation: "",
  213. name: "",
  214. workplaceOrAddress: "",
  215. position: "",
  216. phone: ""
  217. };
  218. },
  219. deleteFamilyMember(index) {
  220. if (this.isEditing && this.editingIndex === index) {
  221. this.cancelEdit();
  222. }
  223. this.familyMembers.splice(index, 1);
  224. common_vendor.index.showToast({
  225. title: "已删除",
  226. icon: "none"
  227. });
  228. },
  229. // 选择应聘来源类型
  230. selectSourceType(type) {
  231. this.formData.sourceType = type;
  232. if (type === "social") {
  233. this.formData.socialSource = "BOSS";
  234. } else {
  235. this.formData.socialSource = "";
  236. }
  237. },
  238. // 选择社招来源
  239. selectSocialSource(source) {
  240. this.formData.sourceType = "social";
  241. this.formData.socialSource = source;
  242. },
  243. // 教育经历相关方法
  244. bindStartTimeChange(e) {
  245. this.educationForm.startTime = e.detail.value;
  246. },
  247. bindEndTimeChange(e) {
  248. this.educationForm.endTime = e.detail.value;
  249. },
  250. bindDegreeChange(e) {
  251. this.degreeIndex = e.detail.value;
  252. this.educationForm.degree = this.degreeOptions[this.degreeIndex];
  253. },
  254. saveEducation() {
  255. if (!this.educationForm.startTime) {
  256. common_vendor.index.showToast({
  257. title: "请选择开始时间",
  258. icon: "none"
  259. });
  260. return;
  261. }
  262. if (!this.educationForm.endTime) {
  263. common_vendor.index.showToast({
  264. title: "请选择结束时间",
  265. icon: "none"
  266. });
  267. return;
  268. }
  269. if (!this.educationForm.schoolName) {
  270. common_vendor.index.showToast({
  271. title: "请输入学校名称",
  272. icon: "none"
  273. });
  274. return;
  275. }
  276. if (!this.educationForm.major) {
  277. common_vendor.index.showToast({
  278. title: "请输入专业",
  279. icon: "none"
  280. });
  281. return;
  282. }
  283. if (!this.educationForm.degree) {
  284. common_vendor.index.showToast({
  285. title: "请选择学历",
  286. icon: "none"
  287. });
  288. return;
  289. }
  290. if (this.isEditingEducation) {
  291. this.educationList[this.editingEducationIndex] = { ...this.educationForm };
  292. common_vendor.index.showToast({
  293. title: "修改成功",
  294. icon: "success"
  295. });
  296. this.isEditingEducation = false;
  297. this.editingEducationIndex = -1;
  298. } else {
  299. this.educationList.push({ ...this.educationForm });
  300. common_vendor.index.showToast({
  301. title: "添加成功",
  302. icon: "success"
  303. });
  304. }
  305. this.educationForm = {
  306. startTime: "",
  307. endTime: "",
  308. schoolName: "",
  309. major: "",
  310. degree: ""
  311. };
  312. this.degreeIndex = -1;
  313. },
  314. editEducation(index) {
  315. this.isEditingEducation = true;
  316. this.editingEducationIndex = index;
  317. this.educationForm = { ...this.educationList[index] };
  318. this.degreeIndex = this.degreeOptions.findIndex((item) => item === this.educationForm.degree);
  319. common_vendor.index.pageScrollTo({
  320. selector: ".education-form",
  321. duration: 300
  322. });
  323. },
  324. cancelEditEducation() {
  325. this.isEditingEducation = false;
  326. this.editingEducationIndex = -1;
  327. this.educationForm = {
  328. startTime: "",
  329. endTime: "",
  330. schoolName: "",
  331. major: "",
  332. degree: ""
  333. };
  334. this.degreeIndex = -1;
  335. },
  336. deleteEducation(index) {
  337. if (this.isEditingEducation && this.editingEducationIndex === index) {
  338. this.cancelEditEducation();
  339. }
  340. this.educationList.splice(index, 1);
  341. common_vendor.index.showToast({
  342. title: "已删除",
  343. icon: "none"
  344. });
  345. },
  346. // 工作经历相关方法
  347. bindWorkStartTimeChange(e) {
  348. this.workForm.startTime = e.detail.value;
  349. },
  350. bindWorkEndTimeChange(e) {
  351. this.workForm.endTime = e.detail.value;
  352. },
  353. saveWork() {
  354. if (!this.workForm.startTime) {
  355. common_vendor.index.showToast({
  356. title: "请选择开始时间",
  357. icon: "none"
  358. });
  359. return;
  360. }
  361. if (!this.workForm.endTime) {
  362. common_vendor.index.showToast({
  363. title: "请选择结束时间",
  364. icon: "none"
  365. });
  366. return;
  367. }
  368. if (!this.workForm.companyName) {
  369. common_vendor.index.showToast({
  370. title: "请输入单位名称",
  371. icon: "none"
  372. });
  373. return;
  374. }
  375. if (!this.workForm.department) {
  376. common_vendor.index.showToast({
  377. title: "请输入任职部门",
  378. icon: "none"
  379. });
  380. return;
  381. }
  382. if (!this.workForm.position) {
  383. common_vendor.index.showToast({
  384. title: "请输入担任职务",
  385. icon: "none"
  386. });
  387. return;
  388. }
  389. if (this.isEditingWork) {
  390. this.workList[this.editingWorkIndex] = { ...this.workForm };
  391. common_vendor.index.showToast({
  392. title: "修改成功",
  393. icon: "success"
  394. });
  395. this.isEditingWork = false;
  396. this.editingWorkIndex = -1;
  397. } else {
  398. this.workList.push({ ...this.workForm });
  399. common_vendor.index.showToast({
  400. title: "添加成功",
  401. icon: "success"
  402. });
  403. }
  404. this.workForm = {
  405. startTime: "",
  406. endTime: "",
  407. companyName: "",
  408. department: "",
  409. employeeCount: "",
  410. position: "",
  411. monthlySalary: "",
  412. supervisor: "",
  413. supervisorPhone: ""
  414. };
  415. },
  416. editWork(index) {
  417. this.isEditingWork = true;
  418. this.editingWorkIndex = index;
  419. this.workForm = { ...this.workList[index] };
  420. common_vendor.index.pageScrollTo({
  421. selector: ".work-form",
  422. duration: 300
  423. });
  424. },
  425. cancelEditWork() {
  426. this.isEditingWork = false;
  427. this.editingWorkIndex = -1;
  428. this.workForm = {
  429. startTime: "",
  430. endTime: "",
  431. companyName: "",
  432. department: "",
  433. employeeCount: "",
  434. position: "",
  435. monthlySalary: "",
  436. supervisor: "",
  437. supervisorPhone: ""
  438. };
  439. },
  440. deleteWork(index) {
  441. if (this.isEditingWork && this.editingWorkIndex === index) {
  442. this.cancelEditWork();
  443. }
  444. this.workList.splice(index, 1);
  445. common_vendor.index.showToast({
  446. title: "已删除",
  447. icon: "none"
  448. });
  449. },
  450. submitForm() {
  451. if (!this.formData.name) {
  452. common_vendor.index.showToast({
  453. title: "请输入姓名",
  454. icon: "none"
  455. });
  456. return;
  457. }
  458. if (this.genderIndex === -1) {
  459. common_vendor.index.showToast({
  460. title: "请选择性别",
  461. icon: "none"
  462. });
  463. return;
  464. }
  465. if (this.formData.gender === "女" && this.threePeriodIndex === -1) {
  466. common_vendor.index.showToast({
  467. title: "请选择是否为三期",
  468. icon: "none"
  469. });
  470. return;
  471. }
  472. if (!this.formData.emergencyContact) {
  473. common_vendor.index.showToast({
  474. title: "请输入紧急联系人",
  475. icon: "none"
  476. });
  477. return;
  478. }
  479. if (!this.formData.emergencyPhone) {
  480. common_vendor.index.showToast({
  481. title: "请输入紧急联系人电话",
  482. icon: "none"
  483. });
  484. return;
  485. }
  486. if (this.familyMembers.length === 0) {
  487. common_vendor.index.showToast({
  488. title: "请至少添加一位家庭成员",
  489. icon: "none"
  490. });
  491. return;
  492. }
  493. if (this.formData.sourceType === "school" && !this.formData.otherSchoolSource) {
  494. common_vendor.index.showToast({
  495. title: "请填写学校来源",
  496. icon: "none"
  497. });
  498. return;
  499. }
  500. if (this.formData.sourceType === "social") {
  501. if (!this.formData.socialSource) {
  502. common_vendor.index.showToast({
  503. title: "请选择社招来源",
  504. icon: "none"
  505. });
  506. return;
  507. }
  508. if (this.formData.socialSource === "other" && !this.formData.otherSocialSource) {
  509. common_vendor.index.showToast({
  510. title: "请填写其他社招来源",
  511. icon: "none"
  512. });
  513. return;
  514. }
  515. }
  516. if (this.educationList.length === 0) {
  517. common_vendor.index.showToast({
  518. title: "请至少添加一项教育经历",
  519. icon: "none"
  520. });
  521. return;
  522. }
  523. if (this.workList.length === 0) {
  524. common_vendor.index.showToast({
  525. title: "请至少添加一项工作经历",
  526. icon: "none"
  527. });
  528. return;
  529. }
  530. const submitData = {
  531. tenant_id: 1,
  532. user_id: JSON.parse(common_vendor.index.getStorageSync("userInfo")).id,
  533. // 从存储中获取用户ID
  534. personal_info: {
  535. name: this.formData.name,
  536. gender: this.formData.gender,
  537. birth_date: this.formData.birthDate,
  538. phone: this.formData.phone,
  539. id_card: this.formData.idCard,
  540. email: this.formData.email,
  541. address: this.formData.currentAddress,
  542. professional_skills: this.formData.skills ? this.formData.skills.split(",") : []
  543. },
  544. profile: {
  545. // 女性特殊状态映射
  546. female_status: this.formData.gender === "女" ? this.formData.threePeriod === "孕期" ? 1 : this.formData.threePeriod === "产期" ? 2 : this.formData.threePeriod === "哺乳期" ? 3 : 0 : 0,
  547. // 婚姻状况映射
  548. marital_status: this.formData.marriage === "未婚" ? 0 : this.formData.marriage === "已婚" ? 1 : this.formData.marriage === "离异" ? 2 : this.formData.marriage === "丧偶" ? 3 : 0,
  549. height: parseFloat(this.formData.height) || 0,
  550. weight: parseFloat(this.formData.weight) || 0,
  551. political_status: this.formData.political,
  552. ethnicity: this.formData.ethnic,
  553. native_place: this.formData.nativePlace,
  554. household_location: this.formData.residence,
  555. current_address: this.formData.currentAddress,
  556. expected_salary: parseFloat(this.formData.expectedSalary) || 0,
  557. emergency_contact: this.formData.emergencyContact,
  558. emergency_phone: this.formData.emergencyPhone,
  559. specialties: this.formData.hobby,
  560. life_motto: this.formData.motto,
  561. // 应聘来源映射
  562. recruitment_source: this.formData.sourceType === "social" ? this.formData.socialSource === "BOSS" ? 2 : this.formData.socialSource === "zhilian" ? 3 : this.formData.socialSource === "liepin" ? 4 : 5 : 1,
  563. recruitment_source_detail: this.formData.sourceType === "social" ? this.formData.socialSource === "other" ? this.formData.otherSocialSource : this.formData.socialSource === "BOSS" ? "BOSS直聘" : this.formData.socialSource === "zhilian" ? "智联招聘" : this.formData.socialSource === "liepin" ? "猎聘" : "" : this.formData.otherSchoolSource
  564. },
  565. // 教育经历映射
  566. education: this.educationList.map((edu, index) => ({
  567. education_type: index === 0 ? 1 : 2,
  568. // 第一个为第一学历,第二个为最高学历
  569. degree: this.mapDegreeToNumber(edu.degree),
  570. start_date: edu.startTime,
  571. end_date: edu.endTime,
  572. school_name: edu.schoolName,
  573. major: edu.major
  574. })),
  575. // 家庭成员映射
  576. family_members: this.familyMembers.map((member) => ({
  577. relation: member.relation,
  578. name: member.name,
  579. workplace: member.workplaceOrAddress,
  580. position: member.position,
  581. phone: member.phone
  582. })),
  583. // 工作经历映射
  584. work_experience: this.workList.map((work) => ({
  585. start_date: work.startTime,
  586. end_date: work.endTime,
  587. company_name: work.companyName,
  588. department: work.department,
  589. employee_count: work.employeeCount,
  590. position: work.position,
  591. monthly_salary: work.monthlySalary,
  592. supervisor: work.supervisor,
  593. supervisor_phone: work.supervisorPhone
  594. })),
  595. // 培训经历可以从技能和培训文本框中提取
  596. trainings: this.formData.training ? [{
  597. training_name: "培训经历",
  598. description: this.formData.training
  599. }] : []
  600. };
  601. console.log("提交的表单数据:", submitData);
  602. common_vendor.index.showLoading({
  603. title: "提交中..."
  604. });
  605. common_vendor.index.request({
  606. url: `${common_config.apiBaseUrl}/wechat/user/profile/update`,
  607. // 根据实际API路径调整
  608. method: "POST",
  609. data: submitData,
  610. success: (res) => {
  611. common_vendor.index.hideLoading();
  612. this.formErrors = {
  613. name: "",
  614. idCard: "",
  615. phone: ""
  616. };
  617. if (res.data.code === 2e3) {
  618. this.currentStep++;
  619. common_vendor.index.switchTab({
  620. url: "/pages/index/index"
  621. });
  622. } else {
  623. let errorMsg = res.data.msg || "身份验证失败";
  624. common_vendor.index.showToast({
  625. title: errorMsg,
  626. icon: "none",
  627. duration: 2e3
  628. });
  629. }
  630. },
  631. fail: (err) => {
  632. common_vendor.index.hideLoading();
  633. common_vendor.index.showToast({
  634. title: "网络错误,请检查网络连接",
  635. icon: "none"
  636. });
  637. console.error("提交失败:", err);
  638. }
  639. });
  640. },
  641. // 学历映射辅助方法
  642. mapDegreeToNumber(degreeText) {
  643. const degreeMap = {
  644. "高中": 1,
  645. "中专": 1,
  646. "大专": 2,
  647. "本科": 3,
  648. "硕士": 4,
  649. "博士": 5
  650. };
  651. return degreeMap[degreeText] || 6;
  652. },
  653. prevStep() {
  654. if (this.currentStep > 1) {
  655. this.currentStep--;
  656. common_vendor.index.pageScrollTo({
  657. scrollTop: 0,
  658. duration: 300
  659. });
  660. }
  661. },
  662. nextStep() {
  663. if (!this.validateCurrentStep()) {
  664. return;
  665. }
  666. if (this.currentStep === 1) {
  667. this.formErrors = {
  668. name: "",
  669. idCard: "",
  670. phone: ""
  671. };
  672. common_vendor.index.showLoading({
  673. title: "身份验证中..."
  674. });
  675. common_vendor.index.request({
  676. url: `${common_config.apiBaseUrl}/wechat/identity/verify`,
  677. method: "POST",
  678. data: {
  679. name: this.formData.name,
  680. id_number: this.formData.idCard,
  681. mobile: this.formData.phone
  682. },
  683. header: {
  684. "content-type": "application/x-www-form-urlencoded"
  685. },
  686. success: (res) => {
  687. common_vendor.index.hideLoading();
  688. if (res.data.code === 200) {
  689. this.currentStep++;
  690. common_vendor.index.pageScrollTo({
  691. scrollTop: 0,
  692. duration: 300
  693. });
  694. } else {
  695. res.data.msg || "身份验证失败";
  696. this.formErrors.name = "姓名验证失败,请检查姓名是否正确";
  697. this.formErrors.idCard = "身份证号验证失败,请检查身份证号是否正确";
  698. this.formErrors.phone = "手机号验证失败,请检查手机号是否正确";
  699. }
  700. },
  701. fail: (err) => {
  702. common_vendor.index.hideLoading();
  703. common_vendor.index.showToast({
  704. title: "网络错误,请检查网络连接",
  705. icon: "none",
  706. duration: 2e3
  707. });
  708. console.error("身份验证请求失败:", err);
  709. }
  710. });
  711. } else {
  712. if (this.currentStep < this.steps.length) {
  713. this.currentStep++;
  714. common_vendor.index.pageScrollTo({
  715. scrollTop: 0,
  716. duration: 300
  717. });
  718. }
  719. }
  720. },
  721. // 验证当前步骤的必填项
  722. validateCurrentStep() {
  723. switch (this.currentStep) {
  724. case 1:
  725. if (!this.formData.name) {
  726. common_vendor.index.showToast({
  727. title: "请输入姓名",
  728. icon: "none"
  729. });
  730. return false;
  731. }
  732. if (this.genderIndex === -1) {
  733. common_vendor.index.showToast({
  734. title: "请选择性别",
  735. icon: "none"
  736. });
  737. return false;
  738. }
  739. if (this.formData.gender === "女" && this.threePeriodIndex === -1) {
  740. common_vendor.index.showToast({
  741. title: "请选择是否为三期",
  742. icon: "none"
  743. });
  744. return false;
  745. }
  746. return true;
  747. case 2:
  748. if (!this.formData.emergencyContact) {
  749. common_vendor.index.showToast({
  750. title: "请输入紧急联系人",
  751. icon: "none"
  752. });
  753. return false;
  754. }
  755. if (!this.formData.emergencyPhone) {
  756. common_vendor.index.showToast({
  757. title: "请输入紧急联系人电话",
  758. icon: "none"
  759. });
  760. return false;
  761. }
  762. return true;
  763. case 3:
  764. if (this.familyMembers.length === 0) {
  765. common_vendor.index.showToast({
  766. title: "请至少添加一位家庭成员",
  767. icon: "none"
  768. });
  769. return false;
  770. }
  771. return true;
  772. case 4:
  773. if (this.formData.sourceType === "school" && !this.formData.otherSchoolSource) {
  774. common_vendor.index.showToast({
  775. title: "请填写学校来源",
  776. icon: "none"
  777. });
  778. return false;
  779. }
  780. if (this.formData.sourceType === "social") {
  781. if (!this.formData.socialSource) {
  782. common_vendor.index.showToast({
  783. title: "请选择社招来源",
  784. icon: "none"
  785. });
  786. return false;
  787. }
  788. if (this.formData.socialSource === "other" && !this.formData.otherSocialSource) {
  789. common_vendor.index.showToast({
  790. title: "请填写其他社招来源",
  791. icon: "none"
  792. });
  793. return false;
  794. }
  795. }
  796. return true;
  797. case 5:
  798. if (this.educationList.length === 0) {
  799. common_vendor.index.showToast({
  800. title: "请至少添加一项教育经历",
  801. icon: "none"
  802. });
  803. return false;
  804. }
  805. return true;
  806. case 6:
  807. return true;
  808. case 7:
  809. return true;
  810. case 8:
  811. if (this.workList.length === 0) {
  812. common_vendor.index.showToast({
  813. title: "请至少添加一项工作经历",
  814. icon: "none"
  815. });
  816. return false;
  817. }
  818. return true;
  819. default:
  820. return true;
  821. }
  822. }
  823. },
  824. // 添加监听器来清除错误信息
  825. watch: {
  826. "formData.name": function(newVal) {
  827. if (newVal && this.formErrors.name) {
  828. this.formErrors.name = "";
  829. }
  830. },
  831. "formData.idCard": function(newVal) {
  832. if (newVal && this.formErrors.idCard) {
  833. this.formErrors.idCard = "";
  834. }
  835. },
  836. "formData.phone": function(newVal) {
  837. if (newVal && this.formErrors.phone) {
  838. this.formErrors.phone = "";
  839. }
  840. }
  841. }
  842. };
  843. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  844. return common_vendor.e({
  845. a: $data.showPromiseModal
  846. }, $data.showPromiseModal ? {
  847. b: $data.promiseChecked,
  848. c: common_vendor.o((...args) => $options.togglePromiseChecked && $options.togglePromiseChecked(...args)),
  849. d: !$data.promiseChecked,
  850. e: common_vendor.o((...args) => $options.confirmPromise && $options.confirmPromise(...args))
  851. } : {}, {
  852. f: $data.currentStep === 1
  853. }, $data.currentStep === 1 ? common_vendor.e({
  854. g: $data.formErrors.name ? 1 : "",
  855. h: $data.formData.name,
  856. i: common_vendor.o(($event) => $data.formData.name = $event.detail.value),
  857. j: $data.formErrors.name
  858. }, $data.formErrors.name ? {
  859. k: common_vendor.t($data.formErrors.name)
  860. } : {}, {
  861. l: common_vendor.t($data.genderOptions[$data.genderIndex] || "请选择性别"),
  862. m: common_vendor.o((...args) => $options.bindGenderChange && $options.bindGenderChange(...args)),
  863. n: $data.genderIndex,
  864. o: $data.genderOptions,
  865. p: $data.formData.gender === "女"
  866. }, $data.formData.gender === "女" ? {
  867. q: common_vendor.t($data.threePeriodOptions[$data.threePeriodIndex] || "请选择"),
  868. r: common_vendor.o((...args) => $options.bindThreePeriodChange && $options.bindThreePeriodChange(...args)),
  869. s: $data.threePeriodIndex,
  870. t: $data.threePeriodOptions
  871. } : {}, {
  872. v: $data.formErrors.phone ? 1 : "",
  873. w: $data.formData.phone,
  874. x: common_vendor.o(($event) => $data.formData.phone = $event.detail.value),
  875. y: $data.formErrors.phone
  876. }, $data.formErrors.phone ? {
  877. z: common_vendor.t($data.formErrors.phone)
  878. } : {}, {
  879. A: $data.formErrors.idCard ? 1 : "",
  880. B: $data.formData.idCard,
  881. C: common_vendor.o(($event) => $data.formData.idCard = $event.detail.value),
  882. D: $data.formErrors.idCard
  883. }, $data.formErrors.idCard ? {
  884. E: common_vendor.t($data.formErrors.idCard)
  885. } : {}, {
  886. F: common_vendor.t($data.politicalOptions[$data.politicalIndex] || "请选择政治面貌"),
  887. G: common_vendor.o((...args) => $options.bindPoliticalChange && $options.bindPoliticalChange(...args)),
  888. H: $data.politicalIndex,
  889. I: $data.politicalOptions,
  890. J: common_vendor.t($data.ethnicOptions[$data.ethnicIndex] || "请选择民族"),
  891. K: common_vendor.o((...args) => $options.bindEthnicChange && $options.bindEthnicChange(...args)),
  892. L: $data.ethnicIndex,
  893. M: $data.ethnicOptions,
  894. N: $data.formData.height,
  895. O: common_vendor.o(($event) => $data.formData.height = $event.detail.value),
  896. P: $data.formData.weight,
  897. Q: common_vendor.o(($event) => $data.formData.weight = $event.detail.value),
  898. R: $data.formData.nativePlace,
  899. S: common_vendor.o(($event) => $data.formData.nativePlace = $event.detail.value),
  900. T: $data.formData.residence,
  901. U: common_vendor.o(($event) => $data.formData.residence = $event.detail.value),
  902. V: common_vendor.t($data.marriageOptions[$data.marriageIndex] || "请选择婚育状况"),
  903. W: common_vendor.o((...args) => $options.bindMarriageChange && $options.bindMarriageChange(...args)),
  904. X: $data.marriageIndex,
  905. Y: $data.marriageOptions,
  906. Z: $data.formData.expectedSalary,
  907. aa: common_vendor.o(($event) => $data.formData.expectedSalary = $event.detail.value)
  908. }) : {}, {
  909. ab: $data.currentStep === 2
  910. }, $data.currentStep === 2 ? {
  911. ac: $data.formData.email,
  912. ad: common_vendor.o(($event) => $data.formData.email = $event.detail.value),
  913. ae: $data.formData.currentAddress,
  914. af: common_vendor.o(($event) => $data.formData.currentAddress = $event.detail.value),
  915. ag: $data.formData.emergencyContact,
  916. ah: common_vendor.o(($event) => $data.formData.emergencyContact = $event.detail.value),
  917. ai: $data.formData.emergencyPhone,
  918. aj: common_vendor.o(($event) => $data.formData.emergencyPhone = $event.detail.value),
  919. ak: $data.formData.hobby,
  920. al: common_vendor.o(($event) => $data.formData.hobby = $event.detail.value),
  921. am: $data.formData.motto,
  922. an: common_vendor.o(($event) => $data.formData.motto = $event.detail.value)
  923. } : {}, {
  924. ao: $data.currentStep === 3
  925. }, $data.currentStep === 3 ? common_vendor.e({
  926. ap: $data.familyMembers.length > 0
  927. }, $data.familyMembers.length > 0 ? {
  928. aq: common_vendor.f($data.familyMembers, (member, index, i0) => {
  929. return {
  930. a: common_vendor.t(index + 1),
  931. b: common_vendor.o(($event) => $options.editFamilyMember(index), index),
  932. c: common_vendor.o(($event) => $options.deleteFamilyMember(index), index),
  933. d: common_vendor.t(member.relation),
  934. e: common_vendor.t(member.name),
  935. f: common_vendor.t(member.workplaceOrAddress),
  936. g: common_vendor.t(member.position),
  937. h: common_vendor.t(member.phone),
  938. i: index
  939. };
  940. })
  941. } : {}, {
  942. ar: common_vendor.t($data.isEditing ? "编辑家庭成员" : "添加家庭成员"),
  943. as: $data.isEditing
  944. }, $data.isEditing ? {
  945. at: common_vendor.o((...args) => $options.cancelEdit && $options.cancelEdit(...args))
  946. } : {}, {
  947. av: $data.familyMemberForm.relation,
  948. aw: common_vendor.o(($event) => $data.familyMemberForm.relation = $event.detail.value),
  949. ax: $data.familyMemberForm.name,
  950. ay: common_vendor.o(($event) => $data.familyMemberForm.name = $event.detail.value),
  951. az: $data.familyMemberForm.workplaceOrAddress,
  952. aA: common_vendor.o(($event) => $data.familyMemberForm.workplaceOrAddress = $event.detail.value),
  953. aB: $data.familyMemberForm.position,
  954. aC: common_vendor.o(($event) => $data.familyMemberForm.position = $event.detail.value),
  955. aD: $data.familyMemberForm.phone,
  956. aE: common_vendor.o(($event) => $data.familyMemberForm.phone = $event.detail.value),
  957. aF: common_vendor.t($data.isEditing ? "✓" : "+"),
  958. aG: common_vendor.o((...args) => $options.saveFamilyMember && $options.saveFamilyMember(...args)),
  959. aH: common_vendor.t($data.isEditing ? "保存修改" : "添加成员")
  960. }) : {}, {
  961. aI: $data.currentStep === 4
  962. }, $data.currentStep === 4 ? {
  963. aJ: $data.formData.sourceType === "social" && $data.formData.socialSource === "BOSS",
  964. aK: common_vendor.o(($event) => $options.selectSocialSource("BOSS")),
  965. aL: $data.formData.sourceType === "social" && $data.formData.socialSource === "zhilian",
  966. aM: common_vendor.o(($event) => $options.selectSocialSource("zhilian")),
  967. aN: $data.formData.sourceType === "social" && $data.formData.socialSource === "liepin",
  968. aO: common_vendor.o(($event) => $options.selectSocialSource("liepin")),
  969. aP: $data.formData.sourceType !== "social" || $data.formData.socialSource !== "other",
  970. aQ: common_vendor.o(($event) => $options.selectSocialSource("other")),
  971. aR: $data.formData.otherSocialSource,
  972. aS: common_vendor.o(($event) => $data.formData.otherSocialSource = $event.detail.value)
  973. } : {}, {
  974. aT: $data.currentStep === 5
  975. }, $data.currentStep === 5 ? common_vendor.e({
  976. aU: $data.educationList.length > 0
  977. }, $data.educationList.length > 0 ? {
  978. aV: common_vendor.f($data.educationList, (edu, index, i0) => {
  979. return {
  980. a: common_vendor.t(index === 0 ? "第一学历" : "最高学历"),
  981. b: common_vendor.o(($event) => $options.editEducation(index), index),
  982. c: common_vendor.o(($event) => $options.deleteEducation(index), index),
  983. d: common_vendor.t(edu.startTime),
  984. e: common_vendor.t(edu.endTime),
  985. f: common_vendor.t(edu.schoolName),
  986. g: common_vendor.t(edu.major),
  987. h: common_vendor.t(edu.degree),
  988. i: index
  989. };
  990. })
  991. } : {}, {
  992. aW: $data.educationList.length < 2 || $data.isEditingEducation
  993. }, $data.educationList.length < 2 || $data.isEditingEducation ? common_vendor.e({
  994. aX: common_vendor.t($data.isEditingEducation ? "编辑教育经历" : $data.educationList.length === 0 ? "添加第一学历" : "添加最高学历"),
  995. aY: $data.isEditingEducation
  996. }, $data.isEditingEducation ? {
  997. aZ: common_vendor.o((...args) => $options.cancelEditEducation && $options.cancelEditEducation(...args))
  998. } : {}, {
  999. ba: common_vendor.t($data.educationForm.startTime || "开始时间"),
  1000. bb: $data.educationForm.startTime,
  1001. bc: common_vendor.o((...args) => $options.bindStartTimeChange && $options.bindStartTimeChange(...args)),
  1002. bd: common_vendor.t($data.educationForm.endTime || "结束时间"),
  1003. be: $data.educationForm.endTime,
  1004. bf: common_vendor.o((...args) => $options.bindEndTimeChange && $options.bindEndTimeChange(...args)),
  1005. bg: $data.educationForm.schoolName,
  1006. bh: common_vendor.o(($event) => $data.educationForm.schoolName = $event.detail.value),
  1007. bi: $data.educationForm.major,
  1008. bj: common_vendor.o(($event) => $data.educationForm.major = $event.detail.value),
  1009. bk: common_vendor.t($data.degreeOptions[$data.degreeIndex] || "请选择学历"),
  1010. bl: common_vendor.o((...args) => $options.bindDegreeChange && $options.bindDegreeChange(...args)),
  1011. bm: $data.degreeIndex,
  1012. bn: $data.degreeOptions,
  1013. bo: common_vendor.t($data.isEditingEducation ? "✓" : "+"),
  1014. bp: common_vendor.o((...args) => $options.saveEducation && $options.saveEducation(...args)),
  1015. bq: common_vendor.t($data.isEditingEducation ? "保存修改" : "添加学历")
  1016. }) : {}) : {}, {
  1017. br: $data.currentStep === 6
  1018. }, $data.currentStep === 6 ? {
  1019. bs: $data.formData.skills,
  1020. bt: common_vendor.o(($event) => $data.formData.skills = $event.detail.value)
  1021. } : {}, {
  1022. bv: $data.currentStep === 7
  1023. }, $data.currentStep === 7 ? {
  1024. bw: $data.formData.training,
  1025. bx: common_vendor.o(($event) => $data.formData.training = $event.detail.value)
  1026. } : {}, {
  1027. by: $data.currentStep === 8
  1028. }, $data.currentStep === 8 ? common_vendor.e({
  1029. bz: $data.workList.length > 0
  1030. }, $data.workList.length > 0 ? {
  1031. bA: common_vendor.f($data.workList, (work, index, i0) => {
  1032. return {
  1033. a: common_vendor.t(index + 1),
  1034. b: common_vendor.o(($event) => $options.editWork(index), index),
  1035. c: common_vendor.o(($event) => $options.deleteWork(index), index),
  1036. d: common_vendor.t(work.startTime),
  1037. e: common_vendor.t(work.endTime),
  1038. f: common_vendor.t(work.companyName),
  1039. g: common_vendor.t(work.department),
  1040. h: common_vendor.t(work.employeeCount),
  1041. i: common_vendor.t(work.position),
  1042. j: common_vendor.t(work.monthlySalary),
  1043. k: common_vendor.t(work.supervisor),
  1044. l: common_vendor.t(work.supervisorPhone),
  1045. m: index
  1046. };
  1047. })
  1048. } : {}, {
  1049. bB: $data.workList.length < 2 || $data.isEditingWork
  1050. }, $data.workList.length < 2 || $data.isEditingWork ? common_vendor.e({
  1051. bC: common_vendor.t($data.isEditingWork ? "编辑工作经历" : "添加工作经历"),
  1052. bD: $data.isEditingWork
  1053. }, $data.isEditingWork ? {
  1054. bE: common_vendor.o((...args) => $options.cancelEditWork && $options.cancelEditWork(...args))
  1055. } : {}, {
  1056. bF: common_vendor.t($data.workForm.startTime || "开始时间"),
  1057. bG: $data.workForm.startTime,
  1058. bH: common_vendor.o((...args) => $options.bindWorkStartTimeChange && $options.bindWorkStartTimeChange(...args)),
  1059. bI: common_vendor.t($data.workForm.endTime || "结束时间"),
  1060. bJ: $data.workForm.endTime,
  1061. bK: common_vendor.o((...args) => $options.bindWorkEndTimeChange && $options.bindWorkEndTimeChange(...args)),
  1062. bL: $data.workForm.companyName,
  1063. bM: common_vendor.o(($event) => $data.workForm.companyName = $event.detail.value),
  1064. bN: $data.workForm.employeeCount,
  1065. bO: common_vendor.o(($event) => $data.workForm.employeeCount = $event.detail.value),
  1066. bP: $data.workForm.department,
  1067. bQ: common_vendor.o(($event) => $data.workForm.department = $event.detail.value),
  1068. bR: $data.workForm.position,
  1069. bS: common_vendor.o(($event) => $data.workForm.position = $event.detail.value),
  1070. bT: $data.workForm.monthlySalary,
  1071. bU: common_vendor.o(($event) => $data.workForm.monthlySalary = $event.detail.value),
  1072. bV: $data.workForm.supervisor,
  1073. bW: common_vendor.o(($event) => $data.workForm.supervisor = $event.detail.value),
  1074. bX: $data.workForm.supervisorPhone,
  1075. bY: common_vendor.o(($event) => $data.workForm.supervisorPhone = $event.detail.value),
  1076. bZ: common_vendor.t($data.isEditingWork ? "✓" : "+"),
  1077. ca: common_vendor.o((...args) => $options.saveWork && $options.saveWork(...args)),
  1078. cb: common_vendor.t($data.isEditingWork ? "保存修改" : "添加工作经历")
  1079. }) : {}) : {}, {
  1080. cc: $data.currentStep === 9
  1081. }, $data.currentStep === 9 ? {
  1082. cd: common_vendor.t($data.formData.name),
  1083. ce: common_vendor.t($data.formData.gender)
  1084. } : {}, {
  1085. cf: $data.currentStep > 1
  1086. }, $data.currentStep > 1 ? {
  1087. cg: common_vendor.o((...args) => $options.prevStep && $options.prevStep(...args))
  1088. } : {}, {
  1089. ch: $data.currentStep < $data.steps.length
  1090. }, $data.currentStep < $data.steps.length ? {
  1091. ci: common_vendor.o((...args) => $options.nextStep && $options.nextStep(...args))
  1092. } : {}, {
  1093. cj: $data.currentStep === $data.steps.length
  1094. }, $data.currentStep === $data.steps.length ? {
  1095. ck: common_vendor.o((...args) => $options.submitForm && $options.submitForm(...args))
  1096. } : {});
  1097. }
  1098. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
  1099. wx.createPage(MiniProgramPage);