Personal.js 38 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106
  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_experiences: this.workList.map((work) => ({
  585. start_date: work.startTime,
  586. end_date: work.endTime,
  587. company_name: work.companyName,
  588. //单位名称
  589. department: work.department,
  590. //任职部门
  591. company_size: work.employeeCount,
  592. //员工人数
  593. position: work.position,
  594. //担任职务
  595. monthly_salary: work.monthlySalary,
  596. //月薪
  597. supervisor_name: work.supervisor,
  598. //直属上级
  599. supervisor_phone: work.supervisorPhone
  600. //直属上级电话
  601. }))
  602. // 培训经历可以从技能和培训文本框中提取
  603. /* trainings: this.formData.training ? [{
  604. training_name: "培训经历",
  605. description: this.formData.training
  606. }] : [] */
  607. };
  608. console.log("提交的表单数据:", submitData);
  609. common_vendor.index.showLoading({
  610. title: "提交中..."
  611. });
  612. common_vendor.index.request({
  613. url: `${common_config.apiBaseUrl}/wechat/user/profile/update`,
  614. // 根据实际API路径调整
  615. method: "POST",
  616. data: submitData,
  617. success: (res) => {
  618. common_vendor.index.hideLoading();
  619. this.formErrors = {
  620. name: "",
  621. idCard: "",
  622. phone: ""
  623. };
  624. if (res.data.code === 2e3) {
  625. this.currentStep++;
  626. common_vendor.index.switchTab({
  627. url: "/pages/index/index"
  628. });
  629. } else {
  630. let errorMsg = res.data.msg || "身份验证失败";
  631. common_vendor.index.showToast({
  632. title: errorMsg,
  633. icon: "none",
  634. duration: 2e3
  635. });
  636. }
  637. },
  638. fail: (err) => {
  639. common_vendor.index.hideLoading();
  640. common_vendor.index.showToast({
  641. title: "网络错误,请检查网络连接",
  642. icon: "none"
  643. });
  644. console.error("提交失败:", err);
  645. }
  646. });
  647. },
  648. // 学历映射辅助方法
  649. mapDegreeToNumber(degreeText) {
  650. const degreeMap = {
  651. "高中": 1,
  652. "中专": 1,
  653. "大专": 2,
  654. "本科": 3,
  655. "硕士": 4,
  656. "博士": 5
  657. };
  658. return degreeMap[degreeText] || 6;
  659. },
  660. prevStep() {
  661. if (this.currentStep > 1) {
  662. this.currentStep--;
  663. common_vendor.index.pageScrollTo({
  664. scrollTop: 0,
  665. duration: 300
  666. });
  667. }
  668. },
  669. nextStep() {
  670. if (!this.validateCurrentStep()) {
  671. return;
  672. }
  673. if (this.currentStep === 1) {
  674. this.formErrors = {
  675. name: "",
  676. idCard: "",
  677. phone: ""
  678. };
  679. common_vendor.index.showLoading({
  680. title: "身份验证中..."
  681. });
  682. common_vendor.index.request({
  683. url: `${common_config.apiBaseUrl}/wechat/identity/verify`,
  684. method: "POST",
  685. data: {
  686. name: this.formData.name,
  687. id_number: this.formData.idCard,
  688. mobile: this.formData.phone
  689. },
  690. header: {
  691. "content-type": "application/x-www-form-urlencoded"
  692. },
  693. success: (res) => {
  694. common_vendor.index.hideLoading();
  695. if (res.data.code === 200) {
  696. this.currentStep++;
  697. common_vendor.index.pageScrollTo({
  698. scrollTop: 0,
  699. duration: 300
  700. });
  701. } else {
  702. res.data.msg || "身份验证失败";
  703. this.formErrors.name = "姓名验证失败,请检查姓名是否正确";
  704. this.formErrors.idCard = "身份证号验证失败,请检查身份证号是否正确";
  705. this.formErrors.phone = "手机号验证失败,请检查手机号是否正确";
  706. }
  707. },
  708. fail: (err) => {
  709. common_vendor.index.hideLoading();
  710. common_vendor.index.showToast({
  711. title: "网络错误,请检查网络连接",
  712. icon: "none",
  713. duration: 2e3
  714. });
  715. console.error("身份验证请求失败:", err);
  716. }
  717. });
  718. } else {
  719. if (this.currentStep < this.steps.length) {
  720. this.currentStep++;
  721. common_vendor.index.pageScrollTo({
  722. scrollTop: 0,
  723. duration: 300
  724. });
  725. }
  726. }
  727. },
  728. // 验证当前步骤的必填项
  729. validateCurrentStep() {
  730. switch (this.currentStep) {
  731. case 1:
  732. if (!this.formData.name) {
  733. common_vendor.index.showToast({
  734. title: "请输入姓名",
  735. icon: "none"
  736. });
  737. return false;
  738. }
  739. if (this.genderIndex === -1) {
  740. common_vendor.index.showToast({
  741. title: "请选择性别",
  742. icon: "none"
  743. });
  744. return false;
  745. }
  746. if (this.formData.gender === "女" && this.threePeriodIndex === -1) {
  747. common_vendor.index.showToast({
  748. title: "请选择是否为三期",
  749. icon: "none"
  750. });
  751. return false;
  752. }
  753. return true;
  754. case 2:
  755. if (!this.formData.emergencyContact) {
  756. common_vendor.index.showToast({
  757. title: "请输入紧急联系人",
  758. icon: "none"
  759. });
  760. return false;
  761. }
  762. if (!this.formData.emergencyPhone) {
  763. common_vendor.index.showToast({
  764. title: "请输入紧急联系人电话",
  765. icon: "none"
  766. });
  767. return false;
  768. }
  769. return true;
  770. case 3:
  771. if (this.familyMembers.length === 0) {
  772. common_vendor.index.showToast({
  773. title: "请至少添加一位家庭成员",
  774. icon: "none"
  775. });
  776. return false;
  777. }
  778. return true;
  779. case 4:
  780. if (this.formData.sourceType === "school" && !this.formData.otherSchoolSource) {
  781. common_vendor.index.showToast({
  782. title: "请填写学校来源",
  783. icon: "none"
  784. });
  785. return false;
  786. }
  787. if (this.formData.sourceType === "social") {
  788. if (!this.formData.socialSource) {
  789. common_vendor.index.showToast({
  790. title: "请选择社招来源",
  791. icon: "none"
  792. });
  793. return false;
  794. }
  795. if (this.formData.socialSource === "other" && !this.formData.otherSocialSource) {
  796. common_vendor.index.showToast({
  797. title: "请填写其他社招来源",
  798. icon: "none"
  799. });
  800. return false;
  801. }
  802. }
  803. return true;
  804. case 5:
  805. if (this.educationList.length === 0) {
  806. common_vendor.index.showToast({
  807. title: "请至少添加一项教育经历",
  808. icon: "none"
  809. });
  810. return false;
  811. }
  812. return true;
  813. case 6:
  814. return true;
  815. case 7:
  816. return true;
  817. case 8:
  818. if (this.workList.length === 0) {
  819. common_vendor.index.showToast({
  820. title: "请至少添加一项工作经历",
  821. icon: "none"
  822. });
  823. return false;
  824. }
  825. return true;
  826. default:
  827. return true;
  828. }
  829. }
  830. },
  831. // 添加监听器来清除错误信息
  832. watch: {
  833. "formData.name": function(newVal) {
  834. if (newVal && this.formErrors.name) {
  835. this.formErrors.name = "";
  836. }
  837. },
  838. "formData.idCard": function(newVal) {
  839. if (newVal && this.formErrors.idCard) {
  840. this.formErrors.idCard = "";
  841. }
  842. },
  843. "formData.phone": function(newVal) {
  844. if (newVal && this.formErrors.phone) {
  845. this.formErrors.phone = "";
  846. }
  847. }
  848. }
  849. };
  850. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  851. return common_vendor.e({
  852. a: $data.showPromiseModal
  853. }, $data.showPromiseModal ? {
  854. b: $data.promiseChecked,
  855. c: common_vendor.o((...args) => $options.togglePromiseChecked && $options.togglePromiseChecked(...args)),
  856. d: !$data.promiseChecked,
  857. e: common_vendor.o((...args) => $options.confirmPromise && $options.confirmPromise(...args))
  858. } : {}, {
  859. f: $data.currentStep === 1
  860. }, $data.currentStep === 1 ? common_vendor.e({
  861. g: $data.formErrors.name ? 1 : "",
  862. h: $data.formData.name,
  863. i: common_vendor.o(($event) => $data.formData.name = $event.detail.value),
  864. j: $data.formErrors.name
  865. }, $data.formErrors.name ? {
  866. k: common_vendor.t($data.formErrors.name)
  867. } : {}, {
  868. l: common_vendor.t($data.genderOptions[$data.genderIndex] || "请选择性别"),
  869. m: common_vendor.o((...args) => $options.bindGenderChange && $options.bindGenderChange(...args)),
  870. n: $data.genderIndex,
  871. o: $data.genderOptions,
  872. p: $data.formData.gender === "女"
  873. }, $data.formData.gender === "女" ? {
  874. q: common_vendor.t($data.threePeriodOptions[$data.threePeriodIndex] || "请选择"),
  875. r: common_vendor.o((...args) => $options.bindThreePeriodChange && $options.bindThreePeriodChange(...args)),
  876. s: $data.threePeriodIndex,
  877. t: $data.threePeriodOptions
  878. } : {}, {
  879. v: $data.formErrors.phone ? 1 : "",
  880. w: $data.formData.phone,
  881. x: common_vendor.o(($event) => $data.formData.phone = $event.detail.value),
  882. y: $data.formErrors.phone
  883. }, $data.formErrors.phone ? {
  884. z: common_vendor.t($data.formErrors.phone)
  885. } : {}, {
  886. A: $data.formErrors.idCard ? 1 : "",
  887. B: $data.formData.idCard,
  888. C: common_vendor.o(($event) => $data.formData.idCard = $event.detail.value),
  889. D: $data.formErrors.idCard
  890. }, $data.formErrors.idCard ? {
  891. E: common_vendor.t($data.formErrors.idCard)
  892. } : {}, {
  893. F: common_vendor.t($data.politicalOptions[$data.politicalIndex] || "请选择政治面貌"),
  894. G: common_vendor.o((...args) => $options.bindPoliticalChange && $options.bindPoliticalChange(...args)),
  895. H: $data.politicalIndex,
  896. I: $data.politicalOptions,
  897. J: common_vendor.t($data.ethnicOptions[$data.ethnicIndex] || "请选择民族"),
  898. K: common_vendor.o((...args) => $options.bindEthnicChange && $options.bindEthnicChange(...args)),
  899. L: $data.ethnicIndex,
  900. M: $data.ethnicOptions,
  901. N: $data.formData.height,
  902. O: common_vendor.o(($event) => $data.formData.height = $event.detail.value),
  903. P: $data.formData.weight,
  904. Q: common_vendor.o(($event) => $data.formData.weight = $event.detail.value),
  905. R: $data.formData.nativePlace,
  906. S: common_vendor.o(($event) => $data.formData.nativePlace = $event.detail.value),
  907. T: $data.formData.residence,
  908. U: common_vendor.o(($event) => $data.formData.residence = $event.detail.value),
  909. V: common_vendor.t($data.marriageOptions[$data.marriageIndex] || "请选择婚育状况"),
  910. W: common_vendor.o((...args) => $options.bindMarriageChange && $options.bindMarriageChange(...args)),
  911. X: $data.marriageIndex,
  912. Y: $data.marriageOptions,
  913. Z: $data.formData.expectedSalary,
  914. aa: common_vendor.o(($event) => $data.formData.expectedSalary = $event.detail.value)
  915. }) : {}, {
  916. ab: $data.currentStep === 2
  917. }, $data.currentStep === 2 ? {
  918. ac: $data.formData.email,
  919. ad: common_vendor.o(($event) => $data.formData.email = $event.detail.value),
  920. ae: $data.formData.currentAddress,
  921. af: common_vendor.o(($event) => $data.formData.currentAddress = $event.detail.value),
  922. ag: $data.formData.emergencyContact,
  923. ah: common_vendor.o(($event) => $data.formData.emergencyContact = $event.detail.value),
  924. ai: $data.formData.emergencyPhone,
  925. aj: common_vendor.o(($event) => $data.formData.emergencyPhone = $event.detail.value),
  926. ak: $data.formData.hobby,
  927. al: common_vendor.o(($event) => $data.formData.hobby = $event.detail.value),
  928. am: $data.formData.motto,
  929. an: common_vendor.o(($event) => $data.formData.motto = $event.detail.value)
  930. } : {}, {
  931. ao: $data.currentStep === 3
  932. }, $data.currentStep === 3 ? common_vendor.e({
  933. ap: $data.familyMembers.length > 0
  934. }, $data.familyMembers.length > 0 ? {
  935. aq: common_vendor.f($data.familyMembers, (member, index, i0) => {
  936. return {
  937. a: common_vendor.t(index + 1),
  938. b: common_vendor.o(($event) => $options.editFamilyMember(index), index),
  939. c: common_vendor.o(($event) => $options.deleteFamilyMember(index), index),
  940. d: common_vendor.t(member.relation),
  941. e: common_vendor.t(member.name),
  942. f: common_vendor.t(member.workplaceOrAddress),
  943. g: common_vendor.t(member.position),
  944. h: common_vendor.t(member.phone),
  945. i: index
  946. };
  947. })
  948. } : {}, {
  949. ar: common_vendor.t($data.isEditing ? "编辑家庭成员" : "添加家庭成员"),
  950. as: $data.isEditing
  951. }, $data.isEditing ? {
  952. at: common_vendor.o((...args) => $options.cancelEdit && $options.cancelEdit(...args))
  953. } : {}, {
  954. av: $data.familyMemberForm.relation,
  955. aw: common_vendor.o(($event) => $data.familyMemberForm.relation = $event.detail.value),
  956. ax: $data.familyMemberForm.name,
  957. ay: common_vendor.o(($event) => $data.familyMemberForm.name = $event.detail.value),
  958. az: $data.familyMemberForm.workplaceOrAddress,
  959. aA: common_vendor.o(($event) => $data.familyMemberForm.workplaceOrAddress = $event.detail.value),
  960. aB: $data.familyMemberForm.position,
  961. aC: common_vendor.o(($event) => $data.familyMemberForm.position = $event.detail.value),
  962. aD: $data.familyMemberForm.phone,
  963. aE: common_vendor.o(($event) => $data.familyMemberForm.phone = $event.detail.value),
  964. aF: common_vendor.t($data.isEditing ? "✓" : "+"),
  965. aG: common_vendor.o((...args) => $options.saveFamilyMember && $options.saveFamilyMember(...args)),
  966. aH: common_vendor.t($data.isEditing ? "保存修改" : "添加成员")
  967. }) : {}, {
  968. aI: $data.currentStep === 4
  969. }, $data.currentStep === 4 ? {
  970. aJ: $data.formData.sourceType === "social" && $data.formData.socialSource === "BOSS",
  971. aK: common_vendor.o(($event) => $options.selectSocialSource("BOSS")),
  972. aL: $data.formData.sourceType === "social" && $data.formData.socialSource === "zhilian",
  973. aM: common_vendor.o(($event) => $options.selectSocialSource("zhilian")),
  974. aN: $data.formData.sourceType === "social" && $data.formData.socialSource === "liepin",
  975. aO: common_vendor.o(($event) => $options.selectSocialSource("liepin")),
  976. aP: $data.formData.sourceType !== "social" || $data.formData.socialSource !== "other",
  977. aQ: common_vendor.o(($event) => $options.selectSocialSource("other")),
  978. aR: $data.formData.otherSocialSource,
  979. aS: common_vendor.o(($event) => $data.formData.otherSocialSource = $event.detail.value)
  980. } : {}, {
  981. aT: $data.currentStep === 5
  982. }, $data.currentStep === 5 ? common_vendor.e({
  983. aU: $data.educationList.length > 0
  984. }, $data.educationList.length > 0 ? {
  985. aV: common_vendor.f($data.educationList, (edu, index, i0) => {
  986. return {
  987. a: common_vendor.t(index === 0 ? "第一学历" : "最高学历"),
  988. b: common_vendor.o(($event) => $options.editEducation(index), index),
  989. c: common_vendor.o(($event) => $options.deleteEducation(index), index),
  990. d: common_vendor.t(edu.startTime),
  991. e: common_vendor.t(edu.endTime),
  992. f: common_vendor.t(edu.schoolName),
  993. g: common_vendor.t(edu.major),
  994. h: common_vendor.t(edu.degree),
  995. i: index
  996. };
  997. })
  998. } : {}, {
  999. aW: $data.educationList.length < 2 || $data.isEditingEducation
  1000. }, $data.educationList.length < 2 || $data.isEditingEducation ? common_vendor.e({
  1001. aX: common_vendor.t($data.isEditingEducation ? "编辑教育经历" : $data.educationList.length === 0 ? "添加第一学历" : "添加最高学历"),
  1002. aY: $data.isEditingEducation
  1003. }, $data.isEditingEducation ? {
  1004. aZ: common_vendor.o((...args) => $options.cancelEditEducation && $options.cancelEditEducation(...args))
  1005. } : {}, {
  1006. ba: common_vendor.t($data.educationForm.startTime || "开始时间"),
  1007. bb: $data.educationForm.startTime,
  1008. bc: common_vendor.o((...args) => $options.bindStartTimeChange && $options.bindStartTimeChange(...args)),
  1009. bd: common_vendor.t($data.educationForm.endTime || "结束时间"),
  1010. be: $data.educationForm.endTime,
  1011. bf: common_vendor.o((...args) => $options.bindEndTimeChange && $options.bindEndTimeChange(...args)),
  1012. bg: $data.educationForm.schoolName,
  1013. bh: common_vendor.o(($event) => $data.educationForm.schoolName = $event.detail.value),
  1014. bi: $data.educationForm.major,
  1015. bj: common_vendor.o(($event) => $data.educationForm.major = $event.detail.value),
  1016. bk: common_vendor.t($data.degreeOptions[$data.degreeIndex] || "请选择学历"),
  1017. bl: common_vendor.o((...args) => $options.bindDegreeChange && $options.bindDegreeChange(...args)),
  1018. bm: $data.degreeIndex,
  1019. bn: $data.degreeOptions,
  1020. bo: common_vendor.t($data.isEditingEducation ? "✓" : "+"),
  1021. bp: common_vendor.o((...args) => $options.saveEducation && $options.saveEducation(...args)),
  1022. bq: common_vendor.t($data.isEditingEducation ? "保存修改" : "添加学历")
  1023. }) : {}) : {}, {
  1024. br: $data.currentStep === 6
  1025. }, $data.currentStep === 6 ? {
  1026. bs: $data.formData.skills,
  1027. bt: common_vendor.o(($event) => $data.formData.skills = $event.detail.value)
  1028. } : {}, {
  1029. bv: $data.currentStep === 7
  1030. }, $data.currentStep === 7 ? {
  1031. bw: $data.formData.training,
  1032. bx: common_vendor.o(($event) => $data.formData.training = $event.detail.value)
  1033. } : {}, {
  1034. by: $data.currentStep === 8
  1035. }, $data.currentStep === 8 ? common_vendor.e({
  1036. bz: $data.workList.length > 0
  1037. }, $data.workList.length > 0 ? {
  1038. bA: common_vendor.f($data.workList, (work, index, i0) => {
  1039. return {
  1040. a: common_vendor.t(index + 1),
  1041. b: common_vendor.o(($event) => $options.editWork(index), index),
  1042. c: common_vendor.o(($event) => $options.deleteWork(index), index),
  1043. d: common_vendor.t(work.startTime),
  1044. e: common_vendor.t(work.endTime),
  1045. f: common_vendor.t(work.companyName),
  1046. g: common_vendor.t(work.department),
  1047. h: common_vendor.t(work.employeeCount),
  1048. i: common_vendor.t(work.position),
  1049. j: common_vendor.t(work.monthlySalary),
  1050. k: common_vendor.t(work.supervisor),
  1051. l: common_vendor.t(work.supervisorPhone),
  1052. m: index
  1053. };
  1054. })
  1055. } : {}, {
  1056. bB: $data.workList.length < 2 || $data.isEditingWork
  1057. }, $data.workList.length < 2 || $data.isEditingWork ? common_vendor.e({
  1058. bC: common_vendor.t($data.isEditingWork ? "编辑工作经历" : "添加工作经历"),
  1059. bD: $data.isEditingWork
  1060. }, $data.isEditingWork ? {
  1061. bE: common_vendor.o((...args) => $options.cancelEditWork && $options.cancelEditWork(...args))
  1062. } : {}, {
  1063. bF: common_vendor.t($data.workForm.startTime || "开始时间"),
  1064. bG: $data.workForm.startTime,
  1065. bH: common_vendor.o((...args) => $options.bindWorkStartTimeChange && $options.bindWorkStartTimeChange(...args)),
  1066. bI: common_vendor.t($data.workForm.endTime || "结束时间"),
  1067. bJ: $data.workForm.endTime,
  1068. bK: common_vendor.o((...args) => $options.bindWorkEndTimeChange && $options.bindWorkEndTimeChange(...args)),
  1069. bL: $data.workForm.companyName,
  1070. bM: common_vendor.o(($event) => $data.workForm.companyName = $event.detail.value),
  1071. bN: $data.workForm.employeeCount,
  1072. bO: common_vendor.o(($event) => $data.workForm.employeeCount = $event.detail.value),
  1073. bP: $data.workForm.department,
  1074. bQ: common_vendor.o(($event) => $data.workForm.department = $event.detail.value),
  1075. bR: $data.workForm.position,
  1076. bS: common_vendor.o(($event) => $data.workForm.position = $event.detail.value),
  1077. bT: $data.workForm.monthlySalary,
  1078. bU: common_vendor.o(($event) => $data.workForm.monthlySalary = $event.detail.value),
  1079. bV: $data.workForm.supervisor,
  1080. bW: common_vendor.o(($event) => $data.workForm.supervisor = $event.detail.value),
  1081. bX: $data.workForm.supervisorPhone,
  1082. bY: common_vendor.o(($event) => $data.workForm.supervisorPhone = $event.detail.value),
  1083. bZ: common_vendor.t($data.isEditingWork ? "✓" : "+"),
  1084. ca: common_vendor.o((...args) => $options.saveWork && $options.saveWork(...args)),
  1085. cb: common_vendor.t($data.isEditingWork ? "保存修改" : "添加工作经历")
  1086. }) : {}) : {}, {
  1087. cc: $data.currentStep === 9
  1088. }, $data.currentStep === 9 ? {
  1089. cd: common_vendor.t($data.formData.name),
  1090. ce: common_vendor.t($data.formData.gender)
  1091. } : {}, {
  1092. cf: $data.currentStep > 1
  1093. }, $data.currentStep > 1 ? {
  1094. cg: common_vendor.o((...args) => $options.prevStep && $options.prevStep(...args))
  1095. } : {}, {
  1096. ch: $data.currentStep < $data.steps.length
  1097. }, $data.currentStep < $data.steps.length ? {
  1098. ci: common_vendor.o((...args) => $options.nextStep && $options.nextStep(...args))
  1099. } : {}, {
  1100. cj: $data.currentStep === $data.steps.length
  1101. }, $data.currentStep === $data.steps.length ? {
  1102. ck: common_vendor.o((...args) => $options.submitForm && $options.submitForm(...args))
  1103. } : {});
  1104. }
  1105. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
  1106. wx.createPage(MiniProgramPage);