Personal.js 78 KB

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