Personal.vue 93 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313
  1. <template>
  2. <view class="personal-container">
  3. <!-- Add loading indicator -->
  4. <view class="loading-container" v-if="isLoading">
  5. <view class="loading-spinner"></view>
  6. <text class="loading-text">加载中...</text>
  7. </view>
  8. <!-- 添加承诺书弹框 -->
  9. <view class="promise-modal" v-if="showPromiseModal">
  10. <view class="promise-content">
  11. <view class="promise-title">入职承诺书</view>
  12. <scroll-view scroll-y class="promise-text">
  13. <text>
  14. 本人郑重承诺:
  15. 所提交的入职登记表、学历证书、职业资格证明、工作履历等全部个人信息及证明材料均真实、准确、完整。若经公司核查发现存在虚构工作经历、伪造学历证书、隐瞒竞业限制义务、虚报健康状况等任何不实或欺诈情形,本人自愿承担以下责任:
  16. 1. 法律责任:因信息不实引发的劳动纠纷、民事赔偿、行政处罚或刑事追责,由本人独立承担全部法律后果,公司不承担任何连带责任;
  17. 2. 劳动关系处理:公司有权立即解除劳动合同,无需支付经济补偿,并保留向本人追偿因信息欺诈导致公司经济损失(包括但不限于招聘成本、培训费用、商誉损失等)的权利;
  18. 3. 其他后果:若已入职,公司可单方撤销录用决定,要求返还已发放的工资、福利等费用,并可将不实行为记入个人档案。
  19. 本人确认已充分理解上述条款内容,无任何歧义,并自愿受其约束。
  20. </text>
  21. </scroll-view>
  22. <view class="promise-checkbox">
  23. <checkbox :checked="promiseChecked" @click="togglePromiseChecked" />
  24. <text>我已阅读并同意以上承诺书内容</text>
  25. </view>
  26. <view class="promise-buttons">
  27. <button class="promise-btn confirm-btn" :disabled="!promiseChecked" @click="confirmPromise">确认</button>
  28. </view>
  29. </view>
  30. </view>
  31. <view class="form-title">个人信息表</view>
  32. <!-- 添加步骤指示器 -->
  33. <!-- <view class="steps-indicator">
  34. <view
  35. v-for="(step, index) in steps"
  36. :key="step.id"
  37. class="step-item"
  38. :class="{ 'active': currentStep >= step.id, 'current': currentStep === step.id }"
  39. >
  40. <view class="step-number">{{ step.id }}</view>
  41. <view class="step-name">{{ step.name }}</view>
  42. </view>
  43. </view> -->
  44. <!-- 根据currentStep渲染对应的表单内容 -->
  45. <view class="form-content">
  46. <!-- 第一步:基本信息 -->
  47. <view v-if="currentStep === 1" class="form-container">
  48. <!-- 第一行 -->
  49. <view class="form-row">
  50. <view class="form-item" v-if="showNameField">
  51. <text class="label required">姓名</text>
  52. <input type="text" v-model="formData.name" placeholder="请输入姓名" :class="{'input-error': formErrors.name}" />
  53. <text v-if="formErrors.name" class="error-message">{{formErrors.name}}</text>
  54. </view>
  55. <view class="form-item" v-if="showGenderField">
  56. <text class="label required">性别</text>
  57. <picker @change="bindGenderChange" :value="genderIndex" :range="genderOptions">
  58. <view class="picker-text" :class="{'input-error': formErrors.gender}">{{ genderOptions[genderIndex] || '请选择性别' }}</view>
  59. </picker>
  60. <text v-if="formErrors.gender" class="error-message">{{formErrors.gender}}</text>
  61. </view>
  62. <!-- 当性别为女时显示三期选择 -->
  63. <view class="form-row" v-if="formData.gender === '女'">
  64. <view class="form-item" >
  65. <text class="label required">是否为三期</text>
  66. <picker @change="bindThreePeriodChange" :value="threePeriodIndex" :range="threePeriodOptions" :class="{'input-error': formErrors.threePeriod}">
  67. <view class="picker-text">{{ threePeriodOptions[threePeriodIndex] || '请选择' }}</view>
  68. </picker>
  69. <text v-if="formErrors.threePeriod" class="error-message">{{formErrors.threePeriod}}</text>
  70. </view>
  71. </view>
  72. <view class="form-row">
  73. <view class="form-item" v-if="showPhoneField">
  74. <text class="label required">手机号</text>
  75. <input
  76. type="number"
  77. v-model="formData.phone"
  78. placeholder="请输入手机号"
  79. :class="{'input-error': formErrors.phone}"
  80. maxlength="11"
  81. @input="validatePhone"
  82. />
  83. <text v-if="formErrors.phone" class="error-message">{{formErrors.phone}}</text>
  84. </view>
  85. </view>
  86. <!-- <view class="form-item">
  87. <text class="label">出生日期</text>
  88. <picker mode="date" :value="formData.birthDate" @change="bindDateChange">
  89. <view class="picker-text">{{ formData.birthDate || '请选择日期' }}</view>
  90. </picker>
  91. </view> -->
  92. </view>
  93. <view class="form-item" v-if="showIdCardField">
  94. <text class="label required">身份证号</text>
  95. <input type="idcard" v-model="formData.idCard" placeholder="请输入身份证号" :class="{'input-error': formErrors.idCard}" />
  96. <text v-if="formErrors.idCard" class="error-message">{{formErrors.idCard}}</text>
  97. </view>
  98. <!-- <view class="form-item">
  99. <text class="label">政治面貌</text>
  100. <picker @change="bindPoliticalChange" :value="politicalIndex" :range="politicalOptions">
  101. <view class="picker-text">{{ politicalOptions[politicalIndex] || '请选择政治面貌' }}</view>
  102. </picker>
  103. </view> -->
  104. <view class="form-item" v-if="showEthnicField">
  105. <text class="label required">民族</text>
  106. <picker @change="bindEthnicChange" :value="ethnicIndex" :range="ethnicOptions">
  107. <view class="picker-text" :class="{'input-error': formErrors.ethnic}">{{ ethnicOptions[ethnicIndex] || '请选择民族' }}</view>
  108. </picker>
  109. <text v-if="formErrors.ethnic" class="error-message">{{formErrors.ethnic}}</text>
  110. </view>
  111. <!-- 第三行 -->
  112. <view class="form-row">
  113. <view class="form-item" v-if="showHeightField">
  114. <text class="label">身高(cm)</text>
  115. <input type="digit" step="0.01" v-model="formData.height"
  116. @input="handleInput($event, 'height', 2)"
  117. @blur="handleBlur('height')" placeholder="请输入身高" />
  118. </view>
  119. <view class="form-item" v-if="showWeightField">
  120. <text class="label">体重(kg)</text>
  121. <input type="digit" step="0.01" v-model="formData.weight"
  122. @input="handleInput($event, 'weight', 2)"
  123. @blur="handleBlur('weight')"
  124. placeholder="请输入体重" />
  125. </view>
  126. <view class="form-item" v-if="showCurrentAddress">
  127. <text class="label required">现居住地址</text>
  128. <input type="text" v-model="formData.currentAddress" placeholder="请输入现居住地址" :class="{'input-error': formErrors.currentAddress}" />
  129. <text v-if="formErrors.currentAddress" class="error-message">{{formErrors.currentAddress}}</text>
  130. </view>
  131. <!-- <view class="form-item">
  132. <text class="label">籍贯</text>
  133. <input type="text" v-model="formData.nativePlace" placeholder="请输入籍贯" />
  134. </view> -->
  135. </view>
  136. <!-- 第四行 -->
  137. <view class="form-row">
  138. <view class="form-item" v-if="showResidence">
  139. <text class="label">户口所在地</text>
  140. <input type="text" v-model="formData.residence" placeholder="请输入户口所在地" />
  141. </view>
  142. <view class="form-item" v-if="showMarriageIndex">
  143. <text class="label">婚育状况</text>
  144. <picker @change="bindMarriageChange" :value="marriageIndex" :range="marriageOptions">
  145. <view class="picker-text">{{ marriageOptions[marriageIndex] || '请选择婚育状况' }}</view>
  146. </picker>
  147. </view>
  148. <view class="form-item" v-if="showExpectedSalary">
  149. <text class="label">期望薪资(元/月)</text>
  150. <input
  151. type="number"
  152. v-model="formData.expectedSalary"
  153. placeholder="请输入期望薪资"
  154. @change="validateExpectedSalary"
  155. :class="{'input-error': formErrors.expectedSalary}"
  156. max="100000"
  157. />
  158. <text v-if="formErrors.expectedSalary" class="error-message">{{formErrors.expectedSalary}}</text>
  159. </view>
  160. </view>
  161. </view>
  162. <!-- 第二步:家庭成员 -->
  163. <view v-if="currentStep === 3" class="form-container">
  164. <view class="section-title">家庭主要成员信息</view>
  165. <!-- 已添加的家庭成员列表 -->
  166. <view class="family-members-list" v-if="familyMembers.length > 0">
  167. <view class="family-member-item" v-for="(member, index) in familyMembers" :key="index">
  168. <view class="family-member-header">
  169. <text class="family-member-title">成员 {{index + 1}}</text>
  170. <view class="family-member-actions">
  171. <text class="family-member-edit" @click="editFamilyMember(index)">编辑</text>
  172. <text class="family-member-delete" @click="deleteFamilyMember(index)">删除</text>
  173. </view>
  174. </view>
  175. <view class="family-member-content">
  176. <view class="family-member-row" v-if="showFamilyRelationField">
  177. <text class="family-member-label">称谓:</text>
  178. <text class="family-member-value">{{member.relation}}</text>
  179. </view>
  180. <view class="family-member-row" v-if="showFamilyNameField">
  181. <text class="family-member-label">姓名:</text>
  182. <text class="family-member-value">{{member.name}}</text>
  183. </view>
  184. <view class="family-member-row" v-if="showFamilyWorkplaceField">
  185. <text class="family-member-label">工作单位/家庭地址:</text>
  186. <text class="family-member-value">{{member.workplaceOrAddress}}</text>
  187. </view>
  188. <view class="family-member-row" v-if="showFamilyPositionField">
  189. <text class="family-member-label">职务:</text>
  190. <text class="family-member-value">{{member.position}}</text>
  191. </view>
  192. <view class="family-member-row" v-if="showFamilyPhoneField">
  193. <text class="family-member-label">联系电话:</text>
  194. <text class="family-member-value">{{member.phone}}</text>
  195. </view>
  196. <view class="family-member-row">
  197. <text class="family-member-label">是否为紧急联系人:</text>
  198. <text class="family-member-value">{{member.isEmergencyContact ? '是' : '否'}}</text>
  199. </view>
  200. </view>
  201. </view>
  202. </view>
  203. <!-- 家庭成员信息表单 -->
  204. <view class="family-member-form">
  205. <view class="form-subtitle">
  206. {{ isEditing ? '编辑家庭成员' : '添加家庭成员' }}
  207. <text v-if="isEditing" class="cancel-edit" @click="cancelEdit">取消编辑</text>
  208. </view>
  209. <view class="form-row">
  210. <view class="form-item" v-if="showFamilyRelationField">
  211. <text class="label required">称谓</text>
  212. <input
  213. type="text"
  214. v-model="familyMemberForm.relation"
  215. placeholder="如:父亲、母亲、配偶等"
  216. :class="{'input-error': familyMemberErrors.relation}"
  217. />
  218. <text v-if="familyMemberErrors.relation" class="error-message">{{familyMemberErrors.relation}}</text>
  219. </view>
  220. <view class="form-item" v-if="showFamilyNameField">
  221. <text class="label required">姓名</text>
  222. <input
  223. type="text"
  224. v-model="familyMemberForm.name"
  225. placeholder="请输入姓名"
  226. :class="{'input-error': familyMemberErrors.name}"
  227. />
  228. <text v-if="familyMemberErrors.name" class="error-message">{{familyMemberErrors.name}}</text>
  229. </view>
  230. </view>
  231. <view class="form-row">
  232. <view class="form-item" v-if="showFamilyWorkplaceField">
  233. <text class="label ">工作单位/家庭地址</text>
  234. <input type="text" v-model="familyMemberForm.workplaceOrAddress" placeholder="请输入工作单位或家庭地址" />
  235. <!-- <text v-if="familyMemberErrors.workplaceOrAddress" class="error-message">{{familyMemberErrors.workplaceOrAddress}}</text> -->
  236. </view>
  237. <view class="form-item" v-if="showFamilyPositionField">
  238. <text class="label ">职务</text>
  239. <input type="text" v-model="familyMemberForm.position" placeholder="请输入职务" />
  240. <!-- <text v-if="familyMemberErrors.position" class="error-message">{{familyMemberErrors.position}}</text> -->
  241. </view>
  242. </view>
  243. <view class="form-row">
  244. <view class="form-item" v-if="showFamilyPhoneField">
  245. <text class="label required">联系电话</text>
  246. <input
  247. type="number"
  248. v-model="familyMemberForm.phone"
  249. placeholder="请输入联系电话"
  250. maxlength="11"
  251. @input="validatePhone"
  252. :class="{'input-error': familyMemberErrors.phone}"
  253. />
  254. <text v-if="familyMemberErrors.phone" class="error-message">{{familyMemberErrors.phone}}</text>
  255. </view>
  256. </view>
  257. <view class="form-row" v-if="showFamilyisEmergency">
  258. <view class="form-item">
  259. <text class="label">是否为紧急联系人</text>
  260. <switch :checked="familyMemberForm.isEmergencyContact" @change="handleEmergencyContactChange" />
  261. </view>
  262. </view>
  263. <view class="form-row button-row">
  264. <view class="form-item button-container">
  265. <button class="circle-btn" @click="saveFamilyMember">
  266. <text class="btn-icon">{{ isEditing ? '✓' : '+' }}</text>
  267. </button>
  268. <text class="btn-text">{{ isEditing ? '保存修改' : '添加成员' }}</text>
  269. </view>
  270. </view>
  271. </view>
  272. </view>
  273. <!-- 第三步:教育经历 -->
  274. <view v-if="currentStep === 5" class="form-container">
  275. <view class="section-title">教育经历</view>
  276. <!-- 已添加的教育经历列表 -->
  277. <view class="education-list" v-if="educationList.length > 0">
  278. <view class="education-item" v-for="(edu, index) in educationList" :key="index">
  279. <view class="education-header">
  280. <text class="education-title">{{ index === 0 ? '第一学历' : '最高学历' }}</text>
  281. <view class="education-actions">
  282. <text class="education-edit" @click="editEducation(index)">编辑</text>
  283. <text class="education-delete" @click="deleteEducation(index)">删除</text>
  284. </view>
  285. </view>
  286. <view class="education-content">
  287. <view class="education-row" v-if="showEducationTimeField">
  288. <text class="education-label">起止时间:</text>
  289. <text class="education-value">{{edu.startTime}} 至 {{edu.endTime}}</text>
  290. </view>
  291. <view class="education-row" v-if="showEducationSchoolField">
  292. <text class="education-label">学校名称:</text>
  293. <text class="education-value">{{edu.schoolName}}</text>
  294. </view>
  295. <view class="education-row" v-if="showEducationMajorField">
  296. <text class="education-label">专业:</text>
  297. <text class="education-value">{{edu.major}}</text>
  298. </view>
  299. <view class="education-row" v-if="showEducationDegreeField">
  300. <text class="education-label">学历:</text>
  301. <text class="education-value">{{edu.degree}}</text>
  302. </view>
  303. </view>
  304. </view>
  305. </view>
  306. <!-- 教育经历表单 -->
  307. <view class="education-form" v-if="educationList.length < 2 || isEditingEducation">
  308. <view class="form-subtitle">
  309. {{ isEditingEducation ? '编辑教育经历' : (educationList.length === 0 ? '添加第一学历' : '添加最高学历') }}
  310. <text v-if="isEditingEducation" class="cancel-edit" @click="cancelEditEducation">取消编辑</text>
  311. </view>
  312. <view class="form-row">
  313. <view class="form-item" v-if="showEducationTimeField">
  314. <text class="label required">起止时间</text>
  315. <view class="date-range">
  316. <picker
  317. mode="date"
  318. :value="educationForm.startTime"
  319. @change="bindStartTimeChange"
  320. :class="{'input-error': educationErrors.startTime}"
  321. >
  322. <view class="picker-text">{{ educationForm.startTime || '开始时间' }}</view>
  323. </picker>
  324. <text class="date-separator">至</text>
  325. <picker
  326. mode="date"
  327. :value="educationForm.endTime"
  328. @change="bindEndTimeChange"
  329. :class="{'input-error': educationErrors.endTime}"
  330. >
  331. <view class="picker-text">{{ educationForm.endTime || '结束时间' }}</view>
  332. </picker>
  333. </view>
  334. <text v-if="educationErrors.startTime" class="error-message">{{educationErrors.startTime}}</text>
  335. <text v-if="educationErrors.endTime" class="error-message">{{educationErrors.endTime}}</text>
  336. </view>
  337. </view>
  338. <view class="form-row">
  339. <view class="form-item" v-if="showEducationSchoolField">
  340. <text class="label required">学校名称</text>
  341. <input
  342. type="text"
  343. v-model="educationForm.schoolName"
  344. placeholder="请输入学校名称"
  345. :class="{'input-error': educationErrors.schoolName}"
  346. />
  347. <text v-if="educationErrors.schoolName" class="error-message">{{educationErrors.schoolName}}</text>
  348. </view>
  349. <view class="form-item" v-if="showEducationMajorField">
  350. <text class="label required">专业</text>
  351. <input
  352. type="text"
  353. v-model="educationForm.major"
  354. placeholder="请输入专业"
  355. :class="{'input-error': educationErrors.major}"
  356. />
  357. <text v-if="educationErrors.major" class="error-message">{{educationErrors.major}}</text>
  358. </view>
  359. </view>
  360. <view class="form-row">
  361. <view class="form-item" v-if="showEducationDegreeField">
  362. <text class="label required">学历</text>
  363. <picker
  364. @change="bindDegreeChange"
  365. :value="degreeIndex"
  366. :range="degreeOptions"
  367. :class="{'input-error': educationErrors.degree}"
  368. >
  369. <view class="picker-text">{{ degreeOptions[degreeIndex] || '请选择学历' }}</view>
  370. </picker>
  371. <text v-if="educationErrors.degree" class="error-message">{{educationErrors.degree}}</text>
  372. </view>
  373. </view>
  374. <view class="form-row button-row">
  375. <view class="form-item button-container">
  376. <button class="circle-btn" @click="saveEducation">
  377. <text class="btn-icon">{{ isEditingEducation ? '✓' : '+' }}</text>
  378. </button>
  379. <text class="btn-text">{{ isEditingEducation ? '保存修改' : '添加学历' }}</text>
  380. </view>
  381. </view>
  382. </view>
  383. </view>
  384. <!-- 第四步:专业技能 -->
  385. <view v-if="currentStep === 6 && (showRequireTrainingInfoField || showRequireProfessionalSkillsField)" class="form-container">
  386. <view class="section-title" v-if="showRequireTrainingInfoField"><text class="required" style="margin-right: 4rpx;color: #ff4d4f;">*</text>专业技能</view>
  387. <view class="skills-container" v-if="showRequireTrainingInfoField">
  388. <textarea
  389. v-model="formData.skills"
  390. placeholder="请描述您的专业技能"
  391. class="skills-textarea"
  392. :class="{'input-error': formErrors.skills}"
  393. maxlength="500"
  394. ></textarea>
  395. <text v-if="formErrors.skills" class="error-message">{{formErrors.skills}}</text>
  396. </view>
  397. <view class="section-title" v-if="showRequireProfessionalSkillsField"><text class="required" style="margin-right: 4rpx;color: #ff4d4f;">*</text>培训经历</view>
  398. <view class="training-container" v-if="showRequireProfessionalSkillsField">
  399. <textarea
  400. v-model="formData.training"
  401. placeholder="请填写您接受过的培训经历"
  402. class="training-textarea"
  403. :class="{'input-error': formErrors.training}"
  404. maxlength="500"
  405. ></textarea>
  406. <text v-if="formErrors.training" class="error-message">{{formErrors.training}}</text>
  407. </view>
  408. </view>
  409. <!-- 第五步:工作经历 -->
  410. <view v-if="currentStep === 8" class="form-container">
  411. <view class="section-title">工作经历</view>
  412. <!-- 已添加的工作经历列表 -->
  413. <view class="work-list" v-if="workList.length > 0">
  414. <view class="work-item" v-for="(work, index) in workList" :key="index">
  415. <view class="work-header">
  416. <text class="work-title">单位{{ index + 1 }}</text>
  417. <view class="work-actions">
  418. <text class="work-edit" @click="editWork(index)">编辑</text>
  419. <text class="work-delete" @click="deleteWork(index)">删除</text>
  420. </view>
  421. </view>
  422. <view class="work-content">
  423. <view class="work-row" v-if="showWorkTimeField">
  424. <text class="work-label">起止时间:</text>
  425. <text class="work-value">{{work.startTime}} 至 {{work.endTime}}</text>
  426. </view>
  427. <view class="work-row" v-if="showWorkCompanyField">
  428. <text class="work-label">单位名称:</text>
  429. <text class="work-value">{{work.companyName}}</text>
  430. </view>
  431. <view class="work-row" v-if="showWorkDepartmentField">
  432. <text class="work-label">任职部门:</text>
  433. <text class="work-value">{{work.department}}</text>
  434. </view>
  435. <view class="work-row" v-if="showWorkEmployeeCountField">
  436. <text class="work-label">单位人数:</text>
  437. <text class="work-value">{{work.employeeCount}}</text>
  438. </view>
  439. <view class="work-row" v-if="showWorkPositionField">
  440. <text class="work-label">担任职务:</text>
  441. <text class="work-value">{{work.position}}</text>
  442. </view>
  443. <view class="work-row" v-if="showWorkMonthlySalary">
  444. <text class="work-label">月总收入:</text>
  445. <text class="work-value">{{work.monthlySalary}}</text>
  446. </view>
  447. <view class="work-row" v-if="showWorkSupervisor">
  448. <text class="work-label" >直接领导:</text>
  449. <text class="work-value">{{work.supervisor}}</text>
  450. </view>
  451. <view class="work-row" v-if="showWorkSupervisorPhone">
  452. <text class="work-label">领导电话:</text>
  453. <text class="work-value">{{work.supervisorPhone}}</text>
  454. </view>
  455. </view>
  456. </view>
  457. </view>
  458. <!-- 工作经历表单 -->
  459. <view class="work-form" v-if="workList.length < 2 || isEditingWork">
  460. <view class="form-subtitle">
  461. {{ isEditingWork ? '编辑工作经历' : '添加工作经历' }}
  462. <text v-if="isEditingWork" class="cancel-edit" @click="cancelEditWork">取消编辑</text>
  463. </view>
  464. <view class="form-row">
  465. <view class="form-item" v-if="showWorkTimeField">
  466. <text class="label required">起止时间</text>
  467. <view class="date-range">
  468. <picker
  469. mode="date"
  470. :value="workForm.startTime"
  471. @change="bindWorkStartTimeChange"
  472. :class="{'input-error': workErrors.startTime}"
  473. >
  474. <view class="picker-text">{{ workForm.startTime || '开始时间' }}</view>
  475. </picker>
  476. <text class="date-separator">至</text>
  477. <picker
  478. mode="date"
  479. :value="workForm.endTime"
  480. @change="bindWorkEndTimeChange"
  481. :class="{'input-error': workErrors.endTime}"
  482. >
  483. <view class="picker-text">{{ workForm.endTime || '结束时间' }}</view>
  484. </picker>
  485. </view>
  486. <text v-if="workErrors.startTime" class="error-message">{{workErrors.startTime}}</text>
  487. <text v-if="workErrors.endTime" class="error-message">{{workErrors.endTime}}</text>
  488. </view>
  489. </view>
  490. <view class="form-row">
  491. <view class="form-item" v-if="showWorkCompanyField">
  492. <text class="label required">单位名称</text>
  493. <input
  494. type="text"
  495. v-model="workForm.companyName"
  496. placeholder="请输入单位名称"
  497. :class="{'input-error': workErrors.companyName}"
  498. />
  499. <text v-if="workErrors.companyName" class="error-message">{{workErrors.companyName}}</text>
  500. </view>
  501. <view class="form-item" v-if="showWorkEmployeeCountField">
  502. <text class="label required">单位人数</text>
  503. <input
  504. type="number"
  505. v-model="workForm.employeeCount"
  506. placeholder="请输入单位人数"
  507. :class="{'input-error': workErrors.employeeCount}"
  508. max="10000"
  509. @change="validateEmployeeCount"
  510. />
  511. <text v-if="workErrors.employeeCount" class="error-message">{{workErrors.employeeCount}}</text>
  512. </view>
  513. </view>
  514. <view class="form-row">
  515. <view class="form-item" v-if="showWorkDepartmentField">
  516. <text class="label required">任职部门</text>
  517. <input
  518. type="text"
  519. v-model="workForm.department"
  520. placeholder="请输入任职部门"
  521. :class="{'input-error': workErrors.department}"
  522. />
  523. <text v-if="workErrors.department" class="error-message">{{workErrors.department}}</text>
  524. </view>
  525. <view class="form-item" v-if="showWorkPositionField">
  526. <text class="label required">担任职务</text>
  527. <input
  528. type="text"
  529. v-model="workForm.position"
  530. placeholder="请输入担任职务"
  531. :class="{'input-error': workErrors.position}"
  532. />
  533. <text v-if="workErrors.position" class="error-message">{{workErrors.position}}</text>
  534. </view>
  535. </view>
  536. <view class="form-row">
  537. <view class="form-item" v-if="showWorkMonthlySalary">
  538. <text class="label required">月总收入</text>
  539. <input
  540. type="number"
  541. v-model="workForm.monthlySalary"
  542. placeholder="请输入月总收入"
  543. :class="{'input-error': workErrors.monthlySalary}"
  544. max="100000"
  545. min="0"
  546. @input="validateMonthlySalary"
  547. />
  548. <text v-if="workErrors.monthlySalary" class="error-message">{{workErrors.monthlySalary}}</text>
  549. </view>
  550. </view>
  551. <view class="form-row">
  552. <view class="form-item" v-if="showWorkSupervisor">
  553. <text class="label required">直接领导</text>
  554. <input type="text" v-model="workForm.supervisor" placeholder="请输入直接领导姓名" />
  555. <text v-if="workErrors.supervisor" class="error-message">{{workErrors.supervisor}}</text>
  556. </view>
  557. <view class="form-item" v-if="showWorkSupervisorPhone">
  558. <text class="label">领导电话</text>
  559. <input
  560. type="number"
  561. v-model="workForm.supervisorPhone"
  562. maxlength="11"
  563. placeholder="请输入领导电话"
  564. @input="validatePhone"
  565. />
  566. <text v-if="workErrors.supervisorPhone" class="error-message">{{workErrors.supervisorPhone}}</text>
  567. </view>
  568. </view>
  569. <view class="form-row button-row">
  570. <view class="form-item button-container">
  571. <button class="circle-btn" @click="saveWork">
  572. <text class="btn-icon">{{ isEditingWork ? '✓' : '+' }}</text>
  573. </button>
  574. <text class="btn-text">{{ isEditingWork ? '保存修改' : '添加工作经历' }}</text>
  575. </view>
  576. </view>
  577. </view>
  578. </view>
  579. </view>
  580. <!-- 修改导航按钮逻辑 -->
  581. <view class="nav-buttons">
  582. <button
  583. v-if="showPrevButton"
  584. class="nav-btn prev-btn"
  585. @click="prevStep"
  586. >上一步</button>
  587. <button
  588. v-if="showNextButton"
  589. class="nav-btn next-btn"
  590. @click="nextStep"
  591. >下一步</button>
  592. <button
  593. v-if="showSubmitButton"
  594. class="submit-btn"
  595. @click="submitForm"
  596. >提交</button>
  597. </view>
  598. </view>
  599. </template>
  600. <script>
  601. import { apiBaseUrl } from '@/common/config.js';
  602. export default {
  603. data() {
  604. return {
  605. // 添加承诺书相关数据
  606. showPromiseModal: true,
  607. promiseChecked: false,
  608. formData: {
  609. name: '',
  610. gender: '',
  611. threePeriod: '',
  612. birthDate: '',
  613. idCard: '',
  614. political: '',
  615. ethnic: '',
  616. height: '',
  617. weight: '',
  618. nativePlace: '',
  619. residence: '',
  620. marriage: '',
  621. expectedSalary: '',
  622. phone: '',
  623. email: '',
  624. currentAddress: '',
  625. emergencyContact: '',
  626. emergencyPhone: '',
  627. hobby: '',
  628. motto: '',
  629. // 添加应聘来源相关字段
  630. sourceType: 'social', // 默认为社招
  631. socialSource: '', // 社招来源
  632. otherSocialSource: '', // 其他社招来源
  633. otherSchoolSource: '', // 其他学校来源
  634. // 添加技能和培训字段
  635. skills: '',
  636. training: '',
  637. },
  638. genderOptions: ['男', '女'],
  639. genderIndex: -1,
  640. threePeriodOptions: ['无', '孕期', '产期', '哺乳期'],
  641. threePeriodIndex: -1,
  642. politicalOptions: ['群众', '共青团员', '中共党员', '民主党派'],
  643. politicalIndex: -1,
  644. ethnicOptions: ['汉族', '蒙古族', '回族', '藏族', '维吾尔族', '其他'],
  645. ethnicIndex: -1,
  646. marriageOptions: ['未婚', '已婚', '离异', '丧偶'],
  647. marriageIndex: -1,
  648. familyMembers: [],
  649. familyMemberForm: {
  650. relation: '',
  651. name: '',
  652. workplaceOrAddress: '',
  653. position: '',
  654. phone: '',
  655. isEmergencyContact: false // 添加新字段
  656. },
  657. isEditing: false,
  658. editingIndex: -1,
  659. // 添加教育经历相关数据
  660. educationList: [],
  661. educationForm: {
  662. startTime: '',
  663. endTime: '',
  664. schoolName: '',
  665. major: '',
  666. degree: ''
  667. },
  668. isEditingEducation: false,
  669. editingEducationIndex: -1,
  670. degreeOptions: ['高中', '中专', '大专', '本科', '硕士', '博士'],
  671. degreeIndex: -1,
  672. // 添加工作经历相关数据
  673. workList: [],
  674. workForm: {
  675. startTime: '',
  676. endTime: '',
  677. companyName: '',
  678. department: '',
  679. employeeCount: '',
  680. position: '',
  681. monthlySalary: '',
  682. supervisor: '',
  683. supervisorPhone: ''
  684. },
  685. isEditingWork: false,
  686. editingWorkIndex: -1,
  687. // 添加步骤控制
  688. currentStep: 1,
  689. steps: [
  690. { id: 1, name: '基本信息' },
  691. { id: 3, name: '家庭成员' },
  692. { id: 5, name: '教育经历' },
  693. { id: 6, name: '专业技能' },
  694. { id: 8, name: '工作经历' }
  695. ],
  696. formErrors: {
  697. name: '',
  698. idCard: '',
  699. phone: '',
  700. gender: '',
  701. ethnic: '',
  702. currentAddress: '',
  703. height: '',
  704. weight: '',
  705. expectedSalary: '',
  706. skills: '',
  707. training: '',
  708. threePeriod: '' // 添加这一行
  709. },
  710. // Add loading state
  711. isLoading: true,
  712. familyMemberErrors: {
  713. relation: '',
  714. name: '',
  715. phone: '',
  716. workplaceOrAddress: '',
  717. position: ''
  718. },
  719. workErrors: {
  720. startTime: '',
  721. endTime: '',
  722. companyName: '',
  723. department: '',
  724. position: '',
  725. employeeCount: '',
  726. monthlySalary: '',
  727. supervisor: '',
  728. supervisorPhone: ''
  729. },
  730. // 在 data 中添加教育经历的错误提示对象
  731. educationErrors: {
  732. startTime: '',
  733. endTime: '',
  734. schoolName: '',
  735. major: '',
  736. degree: ''
  737. },
  738. // 添加统一的验证规则
  739. validationRules: {
  740. name: {
  741. required: true,
  742. message: '请输入姓名'
  743. },
  744. phone: {
  745. required: true,
  746. pattern: /^1[3-9]\d{9}$/,
  747. message: '请输入正确的手机号码',
  748. maxLength: 11
  749. },
  750. idCard: {
  751. required: true,
  752. pattern: /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/,
  753. message: '请输入正确的身份证号码'
  754. },
  755. gender: {
  756. required: true,
  757. message: '请选择性别'
  758. },
  759. ethnic: {
  760. required: true,
  761. message: '请选择民族'
  762. },
  763. currentAddress: {
  764. required: true,
  765. message: '请输入现居住地址'
  766. },
  767. height: {
  768. pattern: /^\d+(\.\d{1,2})?$/,
  769. message: '请输入正确的身高(cm)'
  770. },
  771. weight: {
  772. pattern: /^\d+(\.\d{1,2})?$/,
  773. message: '请输入正确的体重(kg)'
  774. },
  775. expectedSalary: {
  776. pattern: /^\d+(\.\d{1,2})?$/,
  777. message: '请输入正确的期望薪资'
  778. }
  779. },
  780. // 获取配置信息
  781. configData: (() => {
  782. try {
  783. const configStr = uni.getStorageSync('configData');
  784. if (configStr && configStr.trim()) {
  785. return JSON.parse(configStr);
  786. }
  787. return {};
  788. } catch (error) {
  789. console.warn('解析配置数据失败:', error);
  790. return {};
  791. }
  792. })()
  793. }
  794. },
  795. onLoad() {
  796. // Fetch user data when component loads
  797. this.fetchUserData();
  798. console.log(this.configData)
  799. },
  800. computed: {
  801. // 添加计算属性来控制按钮显示
  802. showPrevButton() {
  803. return this.currentStep !== 1;
  804. },
  805. showNextButton() {
  806. return this.currentStep !== 8;
  807. },
  808. showSubmitButton() {
  809. return this.currentStep === 8;
  810. },
  811. // 获取当前步骤在数组中的索引
  812. currentStepIndex() {
  813. return this.steps.findIndex(step => step.id === this.currentStep);
  814. },
  815. // 添加安全的配置访问器
  816. safeConfigData() {
  817. return this.configData || {};
  818. },
  819. safeProfileFieldsConfig() {
  820. return this.safeConfigData.profile_fields_config || {};
  821. },
  822. safeFamilyFieldsConfig() {
  823. return this.safeConfigData.family_fields_config || {};
  824. },
  825. safeEducationFieldsConfig() {
  826. return this.safeConfigData.education_fields_config || {};
  827. },
  828. safeWorkFieldsConfig() {
  829. return this.safeConfigData.work_experience_fields_config || {};
  830. },
  831. // 字段显示控制方法
  832. showNameField() {
  833. return Object.keys(this.safeProfileFieldsConfig).length === 0 || this.safeProfileFieldsConfig.name?.visible !== false;
  834. },
  835. showGenderField() {
  836. return Object.keys(this.safeProfileFieldsConfig).length === 0 || this.safeProfileFieldsConfig.gender?.visible !== false;
  837. },
  838. showPhoneField() {
  839. return Object.keys(this.safeProfileFieldsConfig).length === 0 || this.safeProfileFieldsConfig.phone?.visible !== false;
  840. },
  841. showIdCardField() {
  842. return Object.keys(this.safeProfileFieldsConfig).length === 0 || this.safeProfileFieldsConfig.id_card?.visible !== false;
  843. },
  844. showEthnicField() {
  845. return Object.keys(this.safeProfileFieldsConfig).length === 0 || this.safeProfileFieldsConfig.ethnicity?.visible !== false;
  846. },
  847. showHeightField() {
  848. return Object.keys(this.safeProfileFieldsConfig).length === 0 || this.safeProfileFieldsConfig.height?.visible !== false;
  849. },
  850. showWeightField() {
  851. return Object.keys(this.safeProfileFieldsConfig).length === 0 || this.safeProfileFieldsConfig.weight?.visible !== false;
  852. },
  853. showCurrentAddress(){
  854. return Object.keys(this.safeProfileFieldsConfig).length === 0 || this.safeProfileFieldsConfig.current_address?.visible !== false;
  855. },
  856. showResidence(){
  857. return Object.keys(this.safeProfileFieldsConfig).length === 0 || this.safeProfileFieldsConfig.household_location?.visible !== false;
  858. },
  859. showMarriageIndex(){
  860. return this.safeProfileFieldsConfig.marital_status?.visible !== false;
  861. },
  862. showExpectedSalary(){
  863. return this.safeProfileFieldsConfig.expected_salary?.visible !== false;
  864. },
  865. // 家庭成员字段显示控制
  866. showFamilyRelationField() {
  867. return Object.keys(this.safeFamilyFieldsConfig).length === 0 || this.safeFamilyFieldsConfig.relation?.visible !== false;
  868. },
  869. showFamilyNameField() {
  870. return Object.keys(this.safeFamilyFieldsConfig).length === 0 || this.safeFamilyFieldsConfig.name?.visible !== false;
  871. },
  872. showFamilyWorkplaceField() {
  873. return Object.keys(this.safeFamilyFieldsConfig).length === 0 || this.safeFamilyFieldsConfig.workplace?.visible !== false;
  874. },
  875. showFamilyPositionField() {
  876. return Object.keys(this.safeFamilyFieldsConfig).length === 0 || this.safeFamilyFieldsConfig.position?.visible !== false;
  877. },
  878. showFamilyPhoneField() {
  879. return Object.keys(this.safeFamilyFieldsConfig).length === 0 || this.safeFamilyFieldsConfig.phone?.visible !== false;
  880. },
  881. showFamilyisEmergency(){
  882. this.safeFamilyFieldsConfig.family_contact_person?.visible !== false;
  883. },
  884. // 教育经历字段显示控制
  885. showEducationTimeField() {
  886. return Object.keys(this.safeEducationFieldsConfig).length === 0 || (this.safeEducationFieldsConfig.start_date?.visible !== false && this.safeEducationFieldsConfig.end_date?.visible !== false);
  887. },
  888. showEducationSchoolField() {
  889. return Object.keys(this.safeEducationFieldsConfig).length === 0 || this.safeEducationFieldsConfig.school_name?.visible !== false;
  890. },
  891. showEducationMajorField() {
  892. return Object.keys(this.safeEducationFieldsConfig).length === 0 || this.safeEducationFieldsConfig.major?.visible !== false;
  893. },
  894. showEducationDegreeField() {
  895. return Object.keys(this.safeEducationFieldsConfig).length === 0 || this.safeEducationFieldsConfig.degree?.visible !== false;
  896. },
  897. // 工作经历字段显示控制
  898. showWorkTimeField() {
  899. return Object.keys(this.safeWorkFieldsConfig).length === 0 || (this.safeWorkFieldsConfig.start_date?.visible !== false && this.safeWorkFieldsConfig.end_date?.visible !== false);
  900. },
  901. showWorkCompanyField() {
  902. return Object.keys(this.safeWorkFieldsConfig).length === 0 || this.safeWorkFieldsConfig.company_name?.visible !== false;
  903. },
  904. showWorkDepartmentField() {
  905. return Object.keys(this.safeWorkFieldsConfig).length === 0 || this.safeWorkFieldsConfig.department?.visible !== false;
  906. },
  907. showWorkEmployeeCountField() {
  908. return Object.keys(this.safeWorkFieldsConfig).length === 0 || this.safeWorkFieldsConfig.company_size?.visible !== false;
  909. },
  910. showWorkPositionField() {
  911. return Object.keys(this.safeWorkFieldsConfig).length === 0 || this.safeWorkFieldsConfig.position?.visible !== false;
  912. },
  913. showWorkMonthlySalary(){
  914. return this.safeWorkFieldsConfig.monthly_income?.visible
  915. },
  916. showWorkSupervisor(){
  917. return this.safeWorkFieldsConfig.direct_supervisor?.visible
  918. },
  919. showWorkSupervisorPhone(){
  920. return this.safeWorkFieldsConfig.supervisor_phone?.visible
  921. },
  922. showRequireProfessionalSkillsField() { //受培训
  923. console.log(this.safeConfigData.require_professional_skills)
  924. const value = this.safeConfigData.require_professional_skills
  925. return value === undefined || value === null ? true : value
  926. },
  927. showRequireTrainingInfoField() { //专业技能
  928. console.log(this.safeConfigData.require_training_info)
  929. const value = this.safeConfigData.require_training_info
  930. return value === undefined || value === null ? true : value
  931. },
  932. shouldShowSkillsStep() {
  933. return this.showRequireTrainingInfoField || this.showRequireProfessionalSkillsField;
  934. },
  935. // 判断是否显示教育经历步骤
  936. shouldShowEducationStep() {
  937. // 如果没有配置数据,默认显示
  938. if (Object.keys(this.safeEducationFieldsConfig).length === 0) {
  939. return true;
  940. }
  941. // 检查所有教育经历字段是否都被隐藏
  942. const fields = ['start_date', 'end_date', 'school_name', 'major', 'degree'];
  943. return fields.some(field => this.safeEducationFieldsConfig[field]?.visible !== false);
  944. },
  945. // 判断是否显示家庭成员步骤
  946. shouldShowFamilyStep() {
  947. // 如果没有配置数据,默认显示
  948. if (Object.keys(this.safeFamilyFieldsConfig).length === 0) {
  949. return true;
  950. }
  951. // 检查所有家庭成员字段是否都被隐藏
  952. const fields = ['relation', 'name', 'workplace', 'position', 'phone'];
  953. return fields.some(field => this.safeFamilyFieldsConfig[field]?.visible !== false);
  954. },
  955. },
  956. methods: {
  957. // 输入时限制小数位数
  958. handleInput(event, field, maxDecimals) {
  959. let value = event.detail.value;
  960. // 1. 过滤非法字符并限制小数位
  961. value = value
  962. .replace(/[^\d.-]/g, '')
  963. .replace(/(\..*)\./g, '$1')
  964. .replace(/(-\d*)-/g, '$1')
  965. .replace(new RegExp(`^(-?\\d*\\.\\d{${maxDecimals}}).*$`), '$1');
  966. // 2. 处理以小数点开头的情况
  967. if (value.startsWith('.')) {
  968. value = '0' + value;
  969. }
  970. // 3. 更新数据
  971. this.formData[field] = value;
  972. // 4. 强制同步输入框显示
  973. this.$nextTick(() => {
  974. event.target.value = value;
  975. });
  976. },
  977. // 失焦时补全小数位
  978. handleBlur(field, precision = 2) {
  979. const val = this.formData[field];
  980. if (val === '' || val === undefined || val === null) return;
  981. const num = parseFloat(val);
  982. if (!isNaN(num)) {
  983. this.formData[field] = num.toFixed(precision);
  984. } else {
  985. this.formData[field] = '';
  986. }
  987. },
  988. // 添加承诺书相关方法
  989. togglePromiseChecked() {
  990. this.promiseChecked = !this.promiseChecked;
  991. },
  992. confirmPromise() {
  993. if (this.promiseChecked) {
  994. this.showPromiseModal = false;
  995. } else {
  996. uni.showToast({
  997. title: '请先阅读并同意承诺书内容',
  998. icon: 'none'
  999. });
  1000. }
  1001. },
  1002. // 添加字段是否需要验证的判断方法
  1003. shouldValidateField(fieldName, section) {
  1004. section = section || 'profile';
  1005. switch (section) {
  1006. case 'profile':
  1007. const fieldShowMap = {
  1008. 'name': this.showNameField,
  1009. 'gender': this.showGenderField,
  1010. 'phone': this.showPhoneField,
  1011. 'idCard': this.showIdCardField,
  1012. 'ethnic': this.showEthnicField,
  1013. 'height': this.showHeightField,
  1014. 'weight': this.showWeightField,
  1015. 'currentAddress': this.showCurrentAddress, // 现居住地址总是显示和必填
  1016. 'expectedSalary': this.showExpectedSalary, // 期望薪资总是显示
  1017. 'skills': this.showRequireTrainingInfoField, // 专业技能根据配置显示和必填
  1018. 'training': this.showRequireProfessionalSkillsField, // 培训经历根据配置显示和必填
  1019. 'threePeriod': this.formData.gender === '女' // 只有女性时才需要验证三期状态
  1020. };
  1021. return fieldShowMap[fieldName] !== false;
  1022. case 'family':
  1023. const familyFieldShowMap = {
  1024. 'relation': this.showFamilyRelationField,
  1025. 'name': this.showFamilyNameField,
  1026. 'phone': this.showFamilyPhoneField,
  1027. 'workplaceOrAddress': this.showFamilyWorkplaceField,
  1028. 'position': this.showFamilyPositionField,
  1029. 'isEmergencyContact':this.showFamilyisEmergency
  1030. };
  1031. return familyFieldShowMap[fieldName] !== false;
  1032. case 'education':
  1033. const educationFieldShowMap = {
  1034. 'startTime': this.showEducationTimeField,
  1035. 'endTime': this.showEducationTimeField,
  1036. 'schoolName': this.showEducationSchoolField,
  1037. 'major': this.showEducationMajorField,
  1038. 'degree': this.showEducationDegreeField
  1039. };
  1040. return educationFieldShowMap[fieldName] !== false;
  1041. case 'work':
  1042. const workFieldShowMap = {
  1043. 'startTime': this.showWorkTimeField,
  1044. 'endTime': this.showWorkTimeField,
  1045. 'companyName': this.showWorkCompanyField,
  1046. 'department': this.showWorkDepartmentField,
  1047. 'position': this.showWorkPositionField,
  1048. 'employeeCount': this.showWorkEmployeeCountField,
  1049. 'monthlySalary': this.showWorkMonthlySalary, // 月薪总是需要验证
  1050. 'supervisor': this.showWorkSupervisor, // 直接领导总是需要验证
  1051. 'supervisorPhone': this.showWorkSupervisorPhone // 领导电话总是需要验证
  1052. };
  1053. return workFieldShowMap[fieldName] !== false;
  1054. default:
  1055. return true;
  1056. }
  1057. },
  1058. bindGenderChange(e) {
  1059. this.genderIndex = e.detail.value;
  1060. this.formData.gender = this.genderOptions[this.genderIndex];
  1061. // 清除性别的错误提示
  1062. if (this.formErrors.gender) {
  1063. this.formErrors.gender = '';
  1064. }
  1065. // 如果性别从女变为男,清空三期选择
  1066. if (this.formData.gender !== '女') {
  1067. this.formData.threePeriod = '';
  1068. this.threePeriodIndex = -1;
  1069. this.formErrors.threePeriod = ''; // 清除三期状态的错误提示
  1070. }
  1071. },
  1072. bindThreePeriodChange(e) {
  1073. this.threePeriodIndex = e.detail.value;
  1074. this.formData.threePeriod = this.threePeriodOptions[this.threePeriodIndex];
  1075. // 清除三期状态的错误提示
  1076. if (this.formErrors.threePeriod) {
  1077. this.formErrors.threePeriod = '';
  1078. }
  1079. },
  1080. bindPoliticalChange(e) {
  1081. this.politicalIndex = e.detail.value;
  1082. this.formData.political = this.politicalOptions[this.politicalIndex];
  1083. },
  1084. bindEthnicChange(e) {
  1085. this.ethnicIndex = e.detail.value;
  1086. this.formData.ethnic = this.ethnicOptions[this.ethnicIndex];
  1087. // 清除民族的错误提示
  1088. if (this.formErrors.ethnic) {
  1089. this.formErrors.ethnic = '';
  1090. }
  1091. },
  1092. bindMarriageChange(e) {
  1093. this.marriageIndex = e.detail.value;
  1094. this.formData.marriage = this.marriageOptions[this.marriageIndex];
  1095. },
  1096. bindDateChange(e) {
  1097. this.formData.birthDate = e.detail.value;
  1098. },
  1099. saveFamilyMember() {
  1100. // 重置错误信息
  1101. this.resetFamilyMemberErrors();
  1102. // 验证必填字段
  1103. let isValid = true;
  1104. // 只验证显示的字段
  1105. if (this.shouldValidateField('relation', 'family') && !this.familyMemberForm.relation) {
  1106. this.familyMemberErrors.relation = '请输入称谓';
  1107. isValid = false;
  1108. }
  1109. if (this.shouldValidateField('name', 'family') && !this.familyMemberForm.name) {
  1110. this.familyMemberErrors.name = '请输入姓名';
  1111. isValid = false;
  1112. }
  1113. // if (this.shouldValidateField('workplaceOrAddress', 'family') && !this.familyMemberForm.workplaceOrAddress) {
  1114. // this.familyMemberErrors.workplaceOrAddress = '请输入工作单位/家庭地址';
  1115. // isValid = false;
  1116. // }
  1117. // if (this.shouldValidateField('position', 'family') && !this.familyMemberForm.position) {
  1118. // this.familyMemberErrors.position = '请输入职务';
  1119. // isValid = false;
  1120. // }
  1121. if (this.shouldValidateField('phone', 'family') && !this.familyMemberForm.phone) {
  1122. this.familyMemberErrors.phone = '请输入联系电话';
  1123. isValid = false;
  1124. } else if (this.shouldValidateField('phone', 'family') && this.familyMemberForm.phone && !/^1[3-9]\d{9}$/.test(this.familyMemberForm.phone)) {
  1125. this.familyMemberErrors.phone = '请输入正确的手机号';
  1126. isValid = false;
  1127. }
  1128. if (!isValid) {
  1129. uni.showToast({
  1130. title: '请完善家庭成员信息',
  1131. icon: 'none'
  1132. });
  1133. return;
  1134. }
  1135. // 原有的保存逻辑
  1136. if (this.isEditing) {
  1137. this.familyMembers[this.editingIndex] = {...this.familyMemberForm};
  1138. uni.showToast({
  1139. title: '修改成功',
  1140. icon: 'success'
  1141. });
  1142. this.isEditing = false;
  1143. this.editingIndex = -1;
  1144. } else {
  1145. this.familyMembers.push({...this.familyMemberForm});
  1146. uni.showToast({
  1147. title: '添加成功',
  1148. icon: 'success'
  1149. });
  1150. }
  1151. // 重置表单和错误信息
  1152. this.resetFamilyMemberForm();
  1153. },
  1154. // 添加重置错误信息的方法
  1155. resetFamilyMemberErrors() {
  1156. this.familyMemberErrors = {
  1157. relation: '',
  1158. name: '',
  1159. phone: '',
  1160. workplaceOrAddress: '',
  1161. position: ''
  1162. };
  1163. },
  1164. // 修改重置表单的方法
  1165. resetFamilyMemberForm() {
  1166. this.familyMemberForm = {
  1167. relation: '',
  1168. name: '',
  1169. workplaceOrAddress: '',
  1170. position: '',
  1171. phone: '',
  1172. isEmergencyContact: false
  1173. };
  1174. this.resetFamilyMemberErrors();
  1175. },
  1176. editFamilyMember(index) {
  1177. this.isEditing = true;
  1178. this.editingIndex = index;
  1179. this.familyMemberForm = {...this.familyMembers[index]};
  1180. uni.pageScrollTo({
  1181. selector: '.family-member-form',
  1182. duration: 300
  1183. });
  1184. },
  1185. cancelEdit() {
  1186. this.isEditing = false;
  1187. this.editingIndex = -1;
  1188. this.familyMemberForm = {
  1189. relation: '',
  1190. name: '',
  1191. workplaceOrAddress: '',
  1192. position: '',
  1193. phone: '',
  1194. isEmergencyContact: false
  1195. };
  1196. },
  1197. deleteFamilyMember(index) {
  1198. if (this.isEditing && this.editingIndex === index) {
  1199. this.cancelEdit();
  1200. }
  1201. this.familyMembers.splice(index, 1);
  1202. uni.showToast({
  1203. title: '已删除',
  1204. icon: 'none'
  1205. });
  1206. },
  1207. // 选择应聘来源类型
  1208. selectSourceType(type) {
  1209. this.formData.sourceType = type;
  1210. if (type === 'social') {
  1211. // 默认选择第一个社招来源
  1212. this.formData.socialSource = 'BOSS';
  1213. } else {
  1214. // 清空社招来源
  1215. this.formData.socialSource = '';
  1216. }
  1217. },
  1218. // 选择社招来源
  1219. selectSocialSource(source) {
  1220. this.formData.sourceType = 'social';
  1221. this.formData.socialSource = source;
  1222. },
  1223. // 教育经历相关方法
  1224. bindStartTimeChange(e) {
  1225. const startTime = e.detail.value;
  1226. if (this.educationForm.endTime && startTime > this.educationForm.endTime) {
  1227. uni.showToast({
  1228. title: '开始时间不能大于结束时间',
  1229. icon: 'none'
  1230. });
  1231. return;
  1232. }
  1233. this.educationForm.startTime = startTime;
  1234. this.educationErrors.startTime = false;
  1235. },
  1236. bindEndTimeChange(e) {
  1237. const endTime = e.detail.value;
  1238. if (this.educationForm.startTime && endTime < this.educationForm.startTime) {
  1239. uni.showToast({
  1240. title: '结束时间不能小于开始时间',
  1241. icon: 'none'
  1242. });
  1243. return;
  1244. }
  1245. this.educationForm.endTime = endTime;
  1246. this.educationErrors.endTime = false;
  1247. },
  1248. bindDegreeChange(e) {
  1249. this.degreeIndex = e.detail.value;
  1250. this.educationForm.degree = this.degreeOptions[this.degreeIndex];
  1251. },
  1252. saveEducation() {
  1253. // 重置错误信息
  1254. this.resetEducationErrors();
  1255. // 验证必填字段
  1256. let isValid = true;
  1257. // 只验证显示的字段
  1258. if (this.shouldValidateField('startTime', 'education') && !this.educationForm.startTime) {
  1259. this.educationErrors.startTime = '请选择开始时间';
  1260. isValid = false;
  1261. }
  1262. if (this.shouldValidateField('endTime', 'education') && !this.educationForm.endTime) {
  1263. this.educationErrors.endTime = '请选择结束时间';
  1264. isValid = false;
  1265. }
  1266. if (this.shouldValidateField('schoolName', 'education') && !this.educationForm.schoolName) {
  1267. this.educationErrors.schoolName = '请输入学校名称';
  1268. isValid = false;
  1269. }
  1270. if (this.shouldValidateField('major', 'education') && !this.educationForm.major) {
  1271. this.educationErrors.major = '请输入专业';
  1272. isValid = false;
  1273. }
  1274. if (this.shouldValidateField('degree', 'education') && !this.educationForm.degree) {
  1275. this.educationErrors.degree = '请选择学历';
  1276. isValid = false;
  1277. }
  1278. if (!isValid) {
  1279. uni.showToast({
  1280. title: '请完善教育经历信息',
  1281. icon: 'none'
  1282. });
  1283. return;
  1284. }
  1285. // 验证通过后的保存逻辑
  1286. if (this.isEditingEducation) {
  1287. this.educationList[this.editingEducationIndex] = {...this.educationForm};
  1288. uni.showToast({
  1289. title: '修改成功',
  1290. icon: 'success'
  1291. });
  1292. this.isEditingEducation = false;
  1293. this.editingEducationIndex = -1;
  1294. } else {
  1295. this.educationList.push({...this.educationForm});
  1296. uni.showToast({
  1297. title: '添加成功',
  1298. icon: 'success'
  1299. });
  1300. }
  1301. // 重置表单
  1302. this.educationForm = {
  1303. startTime: '',
  1304. endTime: '',
  1305. schoolName: '',
  1306. major: '',
  1307. degree: ''
  1308. };
  1309. this.degreeIndex = -1;
  1310. },
  1311. editEducation(index) {
  1312. this.isEditingEducation = true;
  1313. this.editingEducationIndex = index;
  1314. this.educationForm = {...this.educationList[index]};
  1315. // 设置学历索引
  1316. this.degreeIndex = this.degreeOptions.findIndex(item => item === this.educationForm.degree);
  1317. uni.pageScrollTo({
  1318. selector: '.education-form',
  1319. duration: 300
  1320. });
  1321. },
  1322. cancelEditEducation() {
  1323. this.isEditingEducation = false;
  1324. this.editingEducationIndex = -1;
  1325. this.educationForm = {
  1326. startTime: '',
  1327. endTime: '',
  1328. schoolName: '',
  1329. major: '',
  1330. degree: ''
  1331. };
  1332. this.degreeIndex = -1;
  1333. },
  1334. deleteEducation(index) {
  1335. if (this.isEditingEducation && this.editingEducationIndex === index) {
  1336. this.cancelEditEducation();
  1337. }
  1338. this.educationList.splice(index, 1);
  1339. uni.showToast({
  1340. title: '已删除',
  1341. icon: 'none'
  1342. });
  1343. },
  1344. // 工作经历相关方法
  1345. bindWorkStartTimeChange(e) {
  1346. const startTime = e.detail.value;
  1347. if (this.workForm.endTime && startTime > this.workForm.endTime) {
  1348. uni.showToast({
  1349. title: '开始时间不能大于结束时间',
  1350. icon: 'none'
  1351. });
  1352. return;
  1353. }
  1354. this.workForm.startTime = startTime;
  1355. this.workErrors.startTime = false;
  1356. },
  1357. bindWorkEndTimeChange(e) {
  1358. const endTime = e.detail.value;
  1359. if (this.workForm.startTime && endTime < this.workForm.startTime) {
  1360. uni.showToast({
  1361. title: '结束时间不能小于开始时间',
  1362. icon: 'none'
  1363. });
  1364. return;
  1365. }
  1366. this.workForm.endTime = endTime;
  1367. this.workErrors.endTime = false;
  1368. },
  1369. saveWork() {
  1370. // 重置所有工作经历相关的错误信息
  1371. this.workErrors = {
  1372. startTime: '',
  1373. endTime: '',
  1374. companyName: '',
  1375. department: '',
  1376. position: '',
  1377. employeeCount: '',
  1378. monthlySalary: '',
  1379. supervisor: '',
  1380. supervisorPhone: ''
  1381. };
  1382. // 验证必填字段
  1383. let isValid = true;
  1384. // 只验证显示的字段
  1385. if (this.shouldValidateField('startTime', 'work') && !this.workForm.startTime) {
  1386. this.workErrors.startTime = '请选择开始时间';
  1387. isValid = false;
  1388. }
  1389. if (this.shouldValidateField('endTime', 'work') && !this.workForm.endTime) {
  1390. this.workErrors.endTime = '请选择结束时间';
  1391. isValid = false;
  1392. }
  1393. if (this.shouldValidateField('companyName', 'work') && !this.workForm.companyName) {
  1394. this.workErrors.companyName = '请输入单位名称';
  1395. isValid = false;
  1396. }
  1397. if (this.shouldValidateField('department', 'work') && !this.workForm.department) {
  1398. this.workErrors.department = '请输入任职部门';
  1399. isValid = false;
  1400. }
  1401. if (this.shouldValidateField('position', 'work') && !this.workForm.position) {
  1402. this.workErrors.position = '请输入担任职务';
  1403. isValid = false;
  1404. }
  1405. if (this.shouldValidateField('employeeCount', 'work') && !this.workForm.employeeCount) {
  1406. this.workErrors.employeeCount = '请输入单位人数';
  1407. isValid = false;
  1408. }
  1409. if (this.shouldValidateField('monthlySalary', 'work') && !this.workForm.monthlySalary) {
  1410. this.workErrors.monthlySalary = '请输入月薪';
  1411. isValid = false;
  1412. }
  1413. if (this.shouldValidateField('supervisor', 'work') && !this.workForm.supervisor) {
  1414. this.workErrors.supervisor = '请输入直属上级';
  1415. isValid = false;
  1416. }
  1417. // if (this.shouldValidateField('supervisorPhone', 'work') && !this.workForm.supervisorPhone) {
  1418. // this.workErrors.supervisorPhone = '请输入直属上级电话';
  1419. // isValid = false;
  1420. // }
  1421. // 如果验证不通过,直接返回
  1422. if (!isValid) {
  1423. uni.showToast({
  1424. title: '请完善工作经历信息',
  1425. icon: 'none'
  1426. });
  1427. return;
  1428. }
  1429. // 验证通过后的保存逻辑
  1430. if (this.isEditingWork) {
  1431. this.workList[this.editingWorkIndex] = {...this.workForm};
  1432. uni.showToast({
  1433. title: '修改成功',
  1434. icon: 'success'
  1435. });
  1436. this.isEditingWork = false;
  1437. this.editingWorkIndex = -1;
  1438. } else {
  1439. this.workList.push({...this.workForm});
  1440. uni.showToast({
  1441. title: '添加成功',
  1442. icon: 'success'
  1443. });
  1444. }
  1445. // 重置表单
  1446. this.workForm = {
  1447. startTime: '',
  1448. endTime: '',
  1449. companyName: '',
  1450. department: '',
  1451. employeeCount: '',
  1452. position: '',
  1453. monthlySalary: '',
  1454. supervisor: '',
  1455. supervisorPhone: ''
  1456. };
  1457. },
  1458. editWork(index) {
  1459. this.isEditingWork = true;
  1460. this.editingWorkIndex = index;
  1461. this.workForm = {...this.workList[index]};
  1462. uni.pageScrollTo({
  1463. selector: '.work-form',
  1464. duration: 300
  1465. });
  1466. },
  1467. cancelEditWork() {
  1468. this.isEditingWork = false;
  1469. this.editingWorkIndex = -1;
  1470. this.workForm = {
  1471. startTime: '',
  1472. endTime: '',
  1473. companyName: '',
  1474. department: '',
  1475. employeeCount: '',
  1476. position: '',
  1477. monthlySalary: '',
  1478. supervisor: '',
  1479. supervisorPhone: ''
  1480. };
  1481. },
  1482. deleteWork(index) {
  1483. if (this.isEditingWork && this.editingWorkIndex === index) {
  1484. this.cancelEditWork();
  1485. }
  1486. this.workList.splice(index, 1);
  1487. uni.showToast({
  1488. title: '已删除',
  1489. icon: 'none'
  1490. });
  1491. },
  1492. submitForm() {
  1493. // 先验证当前步骤
  1494. if (!this.validateCurrentStep()) {
  1495. return;
  1496. }
  1497. // 验证所有必填字段
  1498. const allRequired = [
  1499. 'name', 'gender', 'phone', 'idCard', 'ethnic', 'currentAddress'
  1500. ];
  1501. let isValid = true;
  1502. allRequired.forEach(field => {
  1503. // 只验证显示的字段
  1504. if (this.shouldValidateField(field) && !this.validateField(field, this.formData[field])) {
  1505. isValid = false;
  1506. }
  1507. });
  1508. // 验证专业技能和培训
  1509. if (this.shouldValidateField('skills') && !this.formData.skills?.trim()) {
  1510. this.formErrors.skills = '请描述您的专业技能';
  1511. isValid = false;
  1512. }
  1513. if (this.shouldValidateField('training') && !this.formData.training?.trim()) {
  1514. this.formErrors.training = '请描述您的培训经历';
  1515. isValid = false;
  1516. }
  1517. if (!isValid) {
  1518. uni.showToast({
  1519. title: '请完善所有必填信息',
  1520. icon: 'none'
  1521. });
  1522. return;
  1523. }
  1524. // 检查必要的用户信息
  1525. const userInfo = uni.getStorageSync('userInfo');
  1526. if (!userInfo) {
  1527. uni.showToast({
  1528. title: '用户信息获取失败,请重新登录',
  1529. icon: 'none',
  1530. duration: 2000
  1531. });
  1532. return;
  1533. }
  1534. try {
  1535. const userData = JSON.parse(userInfo);
  1536. const submitData = {
  1537. tenant_id: 1,
  1538. user_id: userData.id,
  1539. personal_info: {
  1540. name: this.formData.name,
  1541. gender: this.formData.gender,
  1542. phone: this.formData.phone,
  1543. id_card: this.formData.idCard,
  1544. address: this.formData.currentAddress,
  1545. professional_skills: this.formData.skills ? this.formData.skills.split(',') : []
  1546. },
  1547. profile: {
  1548. female_status: this.getFemaleStatus(),
  1549. marital_status: this.getMaritalStatus(),
  1550. height: parseFloat(this.formData.height) || 0,
  1551. weight: parseFloat(this.formData.weight) || 0,
  1552. ethnicity: this.formData.ethnic,
  1553. current_address: this.formData.currentAddress,
  1554. expected_salary: parseFloat(this.formData.expectedSalary) || 0
  1555. },
  1556. educations: this.formatEducations(),
  1557. family_members: this.formatFamilyMembers(),
  1558. work_experiences: this.formatWorkExperiences()
  1559. };
  1560. // 数据检查
  1561. if (!submitData.personal_info.name || !submitData.personal_info.gender || !submitData.personal_info.phone) {
  1562. uni.showToast({
  1563. title: '基本信息不完整',
  1564. icon: 'none',
  1565. duration: 2000
  1566. });
  1567. return;
  1568. }
  1569. this.sendFormData(submitData);
  1570. } catch (error) {
  1571. console.error('数据处理错误:', error);
  1572. uni.showToast({
  1573. title: '数据处理错误,请重试',
  1574. icon: 'none',
  1575. duration: 2000
  1576. });
  1577. }
  1578. },
  1579. // 辅助方法:发送表单数据
  1580. sendFormData(submitData) {
  1581. uni.showLoading({ title: '提交中...' });
  1582. // 添加请求头和token
  1583. const token = uni.getStorageSync('token');
  1584. uni.request({
  1585. url: `${apiBaseUrl}/wechat/user/profile/update`,
  1586. method: 'POST',
  1587. data: submitData,
  1588. header: {
  1589. 'content-type': 'application/json',
  1590. 'Authorization': token ? `Bearer ${token}` : ''
  1591. },
  1592. success: (res) => {
  1593. uni.hideLoading();
  1594. if (res.statusCode === 200) {
  1595. if (res.data.code === 2000) {
  1596. uni.showToast({
  1597. title: '提交成功',
  1598. icon: 'success',
  1599. duration: 2000
  1600. });
  1601. setTimeout(() => {
  1602. uni.navigateTo({
  1603. url: '/pages/interview-notice/interview-notice'
  1604. });
  1605. }, 2000);
  1606. } else {
  1607. uni.showToast({
  1608. title: res.data.msg || '提交失败',
  1609. icon: 'none',
  1610. duration: 2000
  1611. });
  1612. }
  1613. } else {
  1614. uni.showToast({
  1615. title: '服务器响应错误',
  1616. icon: 'none',
  1617. duration: 2000
  1618. });
  1619. }
  1620. },
  1621. fail: (err) => {
  1622. console.error('提交失败:', err);
  1623. uni.hideLoading();
  1624. // 检查具体错误类型
  1625. if (err.errMsg.includes('timeout')) {
  1626. uni.showToast({
  1627. title: '请求超时,请检查网络后重试',
  1628. icon: 'none',
  1629. duration: 2000
  1630. });
  1631. } else if (err.errMsg.includes('fail')) {
  1632. uni.showToast({
  1633. title: '网络连接失败,请检查网络设置',
  1634. icon: 'none',
  1635. duration: 2000
  1636. });
  1637. } else {
  1638. uni.showToast({
  1639. title: '提交失败,请稍后重试',
  1640. icon: 'none',
  1641. duration: 2000
  1642. });
  1643. }
  1644. },
  1645. complete: () => {
  1646. // 可以在这里添加完成后的处理逻辑
  1647. }
  1648. });
  1649. },
  1650. // 数据格式化方法
  1651. getFemaleStatus() {
  1652. if (this.formData.gender !== '女') return 0;
  1653. const statusMap = { '孕期': 1, '产期': 2, '哺乳期': 3 };
  1654. return statusMap[this.formData.threePeriod] || 0;
  1655. },
  1656. getMaritalStatus() {
  1657. const statusMap = { '未婚': 0, '已婚': 1, '离异': 2, '丧偶': 3 };
  1658. return statusMap[this.formData.marriage] || 0;
  1659. },
  1660. formatEducations() {
  1661. return this.educationList.map((edu, index) => ({
  1662. education_type: index === 0 ? 1 : 2,
  1663. degree: this.mapDegreeToNumber(edu.degree),
  1664. start_date: edu.startTime,
  1665. end_date: edu.endTime,
  1666. school_name: edu.schoolName,
  1667. major: edu.major
  1668. }));
  1669. },
  1670. formatFamilyMembers() {
  1671. return this.familyMembers.map(member => ({
  1672. relation: member.relation,
  1673. name: member.name,
  1674. workplace: member.workplaceOrAddress,
  1675. position: member.position,
  1676. phone: member.phone,
  1677. //is_emergency_contact: member.isEmergencyContact||false // 添加紧急联系人标识
  1678. }));
  1679. },
  1680. formatWorkExperiences() {
  1681. return this.workList.map(work => ({
  1682. start_date: work.startTime,
  1683. end_date: work.endTime,
  1684. company_name: work.companyName,
  1685. department: work.department,
  1686. company_size: work.employeeCount,
  1687. position: work.position,
  1688. monthly_salary: work.monthlySalary,
  1689. supervisor_name: work.supervisor,
  1690. supervisor_phone: work.supervisorPhone
  1691. }));
  1692. },
  1693. // 学历映射辅助方法
  1694. mapDegreeToNumber(degreeText) {
  1695. const degreeMap = {
  1696. '高中': 1,
  1697. '中专': 1,
  1698. '大专': 2,
  1699. '本科': 3,
  1700. '硕士': 4,
  1701. '博士': 5
  1702. };
  1703. return degreeMap[degreeText] || 6; // 默认为其他
  1704. },
  1705. prevStep() {
  1706. const prevIndex = this.currentStepIndex - 1;
  1707. if (prevIndex >= 0) {
  1708. let targetIndex = prevIndex;
  1709. // 检查上一步是否需要跳过
  1710. while (targetIndex >= 0) {
  1711. const stepId = this.steps[targetIndex].id;
  1712. // 如果是专业技能步骤且不需要显示,则跳过
  1713. if (stepId === 6 && !this.shouldShowSkillsStep) {
  1714. targetIndex--;
  1715. continue;
  1716. }
  1717. // 如果是教育经历步骤且不需要显示,则跳过
  1718. if (stepId === 5 && !this.shouldShowEducationStep) {
  1719. targetIndex--;
  1720. continue;
  1721. }
  1722. // 如果是家庭成员步骤且不需要显示,则跳过
  1723. if (stepId === 3 && !this.shouldShowFamilyStep) {
  1724. targetIndex--;
  1725. continue;
  1726. }
  1727. // 找到有效步骤,跳出循环
  1728. break;
  1729. }
  1730. // 如果找到有效步骤,跳转到该步骤
  1731. if (targetIndex >= 0) {
  1732. this.currentStep = this.steps[targetIndex].id;
  1733. }
  1734. // 滚动到页面顶部
  1735. uni.pageScrollTo({
  1736. scrollTop: 0,
  1737. duration: 300
  1738. });
  1739. }
  1740. },
  1741. nextStep() {
  1742. // 验证当前步骤
  1743. if (!this.validateCurrentStep()) {
  1744. return;
  1745. }
  1746. // 如果是第一步,需要进行身份验证
  1747. if (this.currentStep === 1) {
  1748. this.verifyIdentity();
  1749. return;
  1750. }
  1751. const nextIndex = this.currentStepIndex + 1;
  1752. if (nextIndex < this.steps.length) {
  1753. let targetIndex = nextIndex;
  1754. // 检查下一步是否需要跳过
  1755. while (targetIndex < this.steps.length) {
  1756. const stepId = this.steps[targetIndex].id;
  1757. // 如果是家庭成员步骤且不需要显示,则跳过
  1758. if (stepId === 3 && !this.shouldShowFamilyStep) {
  1759. targetIndex++;
  1760. continue;
  1761. }
  1762. // 如果是教育经历步骤且不需要显示,则跳过
  1763. if (stepId === 5 && !this.shouldShowEducationStep) {
  1764. targetIndex++;
  1765. continue;
  1766. }
  1767. // 如果是专业技能步骤且不需要显示,则跳过
  1768. if (stepId === 6 && !this.shouldShowSkillsStep) {
  1769. targetIndex++;
  1770. continue;
  1771. }
  1772. // 找到有效步骤,跳出循环
  1773. break;
  1774. }
  1775. // 如果找到有效步骤,跳转到该步骤
  1776. if (targetIndex < this.steps.length) {
  1777. this.currentStep = this.steps[targetIndex].id;
  1778. }
  1779. // 滚动到页面顶部
  1780. uni.pageScrollTo({
  1781. scrollTop: 0,
  1782. duration: 300
  1783. });
  1784. }
  1785. },
  1786. // 身份验证方法
  1787. verifyIdentity() {
  1788. // 清空错误信息
  1789. this.formErrors = {
  1790. name: '',
  1791. idCard: '',
  1792. phone: ''
  1793. };
  1794. uni.showLoading({
  1795. title: '身份验证中...'
  1796. });
  1797. uni.request({
  1798. url: `${apiBaseUrl}/wechat/identity/verify`,
  1799. method: 'POST',
  1800. data: {
  1801. name: this.formData.name,
  1802. id_number: this.formData.idCard,
  1803. mobile: this.formData.phone
  1804. },
  1805. header: {
  1806. 'content-type': 'application/x-www-form-urlencoded'
  1807. },
  1808. success: (res) => {
  1809. uni.hideLoading();
  1810. console.log(res);
  1811. if (res.data.code === 200) {
  1812. // 验证通过,进入下一步
  1813. const nextIndex = this.currentStepIndex + 1;
  1814. if (nextIndex < this.steps.length) {
  1815. this.currentStep = this.steps[nextIndex].id;
  1816. uni.pageScrollTo({
  1817. scrollTop: 0,
  1818. duration: 300
  1819. });
  1820. }
  1821. /* 保存姓名 */
  1822. this.setUserInfo(this.formData);
  1823. } else {
  1824. // 验证失败,显示错误信息
  1825. this.handleVerificationError(res.data);
  1826. }
  1827. },
  1828. fail: (err) => {
  1829. this.handleRequestError(err);
  1830. }
  1831. });
  1832. },
  1833. setUserInfo(data) {
  1834. uni.request({
  1835. url: `${apiBaseUrl}/wechat/updateUserInfo`,
  1836. method: 'POST',
  1837. data: {
  1838. openid: JSON.parse(uni.getStorageSync('userInfo')).openid,
  1839. name: data.name,
  1840. id_card: data.idCard,
  1841. purePhoneNumber: data.phone,
  1842. tenant_id: 1,
  1843. examine:0
  1844. },
  1845. header: {
  1846. 'content-type': 'application/x-www-form-urlencoded'
  1847. },
  1848. success: (res) => {
  1849. console.log(res);
  1850. }
  1851. });
  1852. },
  1853. // 处理验证错误
  1854. handleVerificationError(data) {
  1855. this.formErrors.name = '姓名验证失败,请检查姓名是否正确';
  1856. this.formErrors.idCard = '身份证号验证失败,请检查身份证号是否正确';
  1857. this.formErrors.phone = '手机号验证失败,请检查手机号是否正确';
  1858. uni.showToast({
  1859. title: data.msg || '身份验证失败',
  1860. icon: 'none'
  1861. });
  1862. },
  1863. // 处理请求错误
  1864. handleRequestError(err) {
  1865. uni.hideLoading();
  1866. uni.showToast({
  1867. title: '网络错误,请检查网络连接',
  1868. icon: 'none',
  1869. duration: 2000
  1870. });
  1871. console.error('请求失败:', err);
  1872. },
  1873. // 验证当前步骤的必填项
  1874. validateCurrentStep() {
  1875. let isValid = true;
  1876. switch (this.currentStep) {
  1877. case 1: // 基本信息
  1878. const basicFields = ['name', 'gender', 'phone', 'idCard', 'ethnic', 'currentAddress'];
  1879. basicFields.forEach(field => {
  1880. // 只验证显示的字段
  1881. if (this.shouldValidateField(field) && !this.validateField(field, this.formData[field])) {
  1882. isValid = false;
  1883. }
  1884. });
  1885. // 特殊验证:女性三期状态
  1886. if (this.shouldValidateField('threePeriod') && this.formData.gender === '女' && this.threePeriodIndex === -1) {
  1887. this.formErrors.threePeriod = '请选择三期状态';
  1888. isValid = false;
  1889. }
  1890. // 可选字段验证(如果有值则验证格式)
  1891. if (this.shouldValidateField('height') && this.formData.height) {
  1892. isValid = this.validateField('height', this.formData.height) && isValid;
  1893. }
  1894. if (this.shouldValidateField('weight') && this.formData.weight) {
  1895. isValid = this.validateField('weight', this.formData.weight) && isValid;
  1896. }
  1897. if (this.shouldValidateField('expectedSalary') && this.formData.expectedSalary) {
  1898. isValid = this.validateField('expectedSalary', this.formData.expectedSalary) && isValid;
  1899. }
  1900. break;
  1901. case 3: // 家庭成员
  1902. console.log(this.familyMembers.length);
  1903. if (this.familyMembers.length == 0) {
  1904. uni.showToast({
  1905. title: '请至少添加一位家庭成员',
  1906. icon: 'none'
  1907. });
  1908. isValid = false;
  1909. }
  1910. break;
  1911. case 5: // 教育经历
  1912. if (this.educationList.length === 0) {
  1913. uni.showToast({
  1914. title: '请至少添加一项教育经历',
  1915. icon: 'none'
  1916. });
  1917. isValid = false;
  1918. }
  1919. break;
  1920. case 6: // 专业技能
  1921. if (this.shouldValidateField('skills') && !this.formData.skills?.trim()) {
  1922. this.formErrors.skills = '请描述您的专业技能';
  1923. isValid = false;
  1924. }
  1925. if (this.shouldValidateField('training') && !this.formData.training?.trim()) {
  1926. this.formErrors.training = '请描述您的培训经历';
  1927. isValid = false;
  1928. }
  1929. break;
  1930. case 8: // 工作经历
  1931. if (this.workList.length === 0) {
  1932. uni.showToast({
  1933. title: '请至少添加一项工作经历',
  1934. icon: 'none'
  1935. });
  1936. isValid = false;
  1937. }
  1938. break;
  1939. }
  1940. /* if (!isValid) {
  1941. uni.showToast({
  1942. title: '请完善所有必填信息',
  1943. icon: 'none'
  1944. });
  1945. } */
  1946. return isValid;
  1947. },
  1948. // Add method to fetch user data
  1949. fetchUserData() {
  1950. this.isLoading = true;
  1951. // Get openid from storage
  1952. const userInfo = uni.getStorageSync('userInfo') ? JSON.parse(uni.getStorageSync('userInfo')) : {};
  1953. const openid = userInfo.openid;
  1954. if (!openid) {
  1955. uni.showToast({
  1956. title: '用户信息获取失败,请重新登录',
  1957. icon: 'none'
  1958. });
  1959. this.isLoading = false;
  1960. return;
  1961. }
  1962. uni.request({
  1963. url: `${apiBaseUrl}/api/wechat/user/get_full_info?tenant_id=1&openid=${openid}`,
  1964. method: 'GET',
  1965. success: (res) => {
  1966. // 无论结果如何,都保持承诺书显示状态
  1967. this.showPromiseModal = true;
  1968. /* if (res.data.code === 2000) { */
  1969. // Successfully fetched data
  1970. this.populateFormData(res.data.data);
  1971. /* } else {
  1972. uni.showToast({
  1973. title: res.data.msg || '获取用户信息失败',
  1974. icon: 'none'
  1975. });
  1976. } */
  1977. },
  1978. fail: (err) => {
  1979. /* console.error('获取用户信息失败:', err);
  1980. uni.showToast({
  1981. title: '网络错误,请检查网络连接',
  1982. icon: 'none'
  1983. }); */
  1984. },
  1985. complete: () => {
  1986. this.isLoading = false;
  1987. }
  1988. });
  1989. },
  1990. // Add method to populate form data with fetched data
  1991. populateFormData(data) {
  1992. const { user_info, profile, educations, work_experiences, family_members } = data;
  1993. // Populate basic user info
  1994. if (user_info) {
  1995. this.formData.name = user_info.name || '';
  1996. this.formData.gender = user_info.gender_text || '';
  1997. this.genderIndex = this.genderOptions.findIndex(item => item === this.formData.gender);
  1998. this.formData.idCard = user_info.id_card || '';
  1999. this.formData.phone = user_info.phone || '';
  2000. this.formData.email = user_info.email || '';
  2001. }
  2002. // Populate profile data
  2003. if (profile) {
  2004. // Set political status
  2005. this.formData.political = profile.political_status || '';
  2006. this.politicalIndex = this.politicalOptions.findIndex(item => item === this.formData.political);
  2007. // Set ethnic
  2008. this.formData.ethnic = profile.ethnicity || '';
  2009. this.ethnicIndex = this.ethnicOptions.findIndex(item => item === this.formData.ethnic);
  2010. // Set height and weight
  2011. this.formData.height = profile.height || '';
  2012. this.formData.weight = profile.weight || '';
  2013. // Set native place and residence
  2014. this.formData.nativePlace = profile.native_place || '';
  2015. this.formData.residence = profile.household_location || '';
  2016. // Set current address
  2017. this.formData.currentAddress = profile.current_address || '';
  2018. // Set marriage status
  2019. this.formData.marriage = profile.marital_status_text || '';
  2020. this.marriageIndex = this.marriageOptions.findIndex(item => item === this.formData.marriage);
  2021. // Set three period status for female
  2022. if (this.formData.gender === '女' && profile.female_status !== undefined) {
  2023. const femaleStatusMap = {0: '无', 1: '孕期', 2: '产期', 3: '哺乳期'};
  2024. this.formData.threePeriod = femaleStatusMap[profile.female_status] || '无';
  2025. this.threePeriodIndex = this.threePeriodOptions.findIndex(item => item === this.formData.threePeriod);
  2026. }
  2027. // Set expected salary
  2028. this.formData.expectedSalary = profile.expected_salary || '';
  2029. // Set emergency contact
  2030. this.formData.emergencyContact = profile.emergency_contact || '';
  2031. this.formData.emergencyPhone = profile.emergency_phone || '';
  2032. // Set hobby and motto
  2033. this.formData.hobby = profile.specialties || '';
  2034. this.formData.motto = profile.life_motto || '';
  2035. // Set recruitment source
  2036. const sourceTypeMap = {
  2037. 1: 'school',
  2038. 2: 'social',
  2039. 3: 'social',
  2040. 4: 'social',
  2041. 5: 'social'
  2042. };
  2043. const socialSourceMap = {
  2044. 2: 'BOSS',
  2045. 3: 'zhilian',
  2046. 4: 'liepin',
  2047. 5: 'other'
  2048. };
  2049. this.formData.sourceType = sourceTypeMap[profile.recruitment_source] || 'social';
  2050. if (this.formData.sourceType === 'social') {
  2051. this.formData.socialSource = socialSourceMap[profile.recruitment_source] || '';
  2052. if (this.formData.socialSource === 'other') {
  2053. this.formData.otherSocialSource = profile.recruitment_source_detail || '';
  2054. }
  2055. } else if (this.formData.sourceType === 'school') {
  2056. this.formData.otherSchoolSource = profile.recruitment_source_detail || '';
  2057. }
  2058. }
  2059. // Populate educations data
  2060. if (educations && educations.length > 0) {
  2061. this.educationList = educations.map(edu => {
  2062. const degreeMap = {
  2063. 1: '高中',
  2064. 2: '大专',
  2065. 3: '本科',
  2066. 4: '硕士',
  2067. 5: '博士'
  2068. };
  2069. return {
  2070. startTime: edu.start_date || '',
  2071. endTime: edu.end_date || '',
  2072. schoolName: edu.school_name || '',
  2073. major: edu.major || '',
  2074. degree: degreeMap[edu.degree] || ''
  2075. };
  2076. });
  2077. }
  2078. // Populate work experience data
  2079. if (work_experiences && work_experiences.length > 0) {
  2080. this.workList = work_experiences.map(work => {
  2081. return {
  2082. startTime: work.start_date || '',
  2083. endTime: work.end_date || '',
  2084. companyName: work.company_name || '',
  2085. department: work.department || '',
  2086. employeeCount: work.company_size || '',
  2087. position: work.position || '',
  2088. monthlySalary: work.monthly_salary || '',
  2089. supervisor: work.supervisor_name || '',
  2090. supervisorPhone: work.supervisor_phone || ''
  2091. };
  2092. });
  2093. }
  2094. // Populate family members data
  2095. if (family_members && family_members.length > 0) {
  2096. this.familyMembers = family_members.map(member => {
  2097. return {
  2098. relation: member.relation || '',
  2099. name: member.name || '',
  2100. workplaceOrAddress: member.workplace || '',
  2101. position: member.position || '',
  2102. phone: member.phone || '',
  2103. isEmergencyContact: member.isEmergencyContact || false
  2104. };
  2105. });
  2106. }
  2107. // 移除这段代码,确保承诺书始终显示
  2108. // if (user_info && user_info.is_profile_complete) {
  2109. // this.showPromiseModal = false;
  2110. // }
  2111. },
  2112. // 处理紧急联系人开关变化
  2113. handleEmergencyContactChange(e) {
  2114. this.familyMemberForm.isEmergencyContact = e.detail.value;
  2115. // 如果设置为紧急联系人,自动填充到紧急联系人字段
  2116. if (e.detail.value) {
  2117. this.formData.emergencyContact = this.familyMemberForm.name;
  2118. this.formData.emergencyPhone = this.familyMemberForm.phone;
  2119. }
  2120. },
  2121. // 添加重置教育经历错误信息的方法
  2122. resetEducationErrors() {
  2123. this.educationErrors = {
  2124. startTime: '',
  2125. endTime: '',
  2126. schoolName: '',
  2127. major: '',
  2128. degree: ''
  2129. };
  2130. },
  2131. // 添加通用验证方法
  2132. validateField(fieldName, value) {
  2133. const rule = this.validationRules[fieldName];
  2134. if (!rule) return true;
  2135. // 如果字段被隐藏,不进行验证
  2136. if (!this.shouldValidateField(fieldName)) {
  2137. return true;
  2138. }
  2139. // 重置该字段的错误信息
  2140. this.formErrors[fieldName] = '';
  2141. // 必填验证
  2142. if (rule.required && !value) {
  2143. this.formErrors[fieldName] = rule.message;
  2144. return false;
  2145. }
  2146. // 正则验证
  2147. if (rule.pattern && value && !rule.pattern.test(value)) {
  2148. this.formErrors[fieldName] = rule.message;
  2149. return false;
  2150. }
  2151. return true;
  2152. },
  2153. validateExpectedSalary(e) {
  2154. const value = e.detail.value;
  2155. console.log(value);
  2156. if (value === '') {
  2157. this.formData.expectedSalary = '';
  2158. this.formErrors.expectedSalary = '';
  2159. return;
  2160. }
  2161. let num = parseFloat(value);
  2162. if (isNaN(num)) {
  2163. this.formErrors.expectedSalary = '请输入有效的数字';
  2164. return;
  2165. }
  2166. if (num < 0) {
  2167. num = 0;
  2168. this.formErrors.expectedSalary = '薪资不能小于0';
  2169. } else if (num > 100000) {
  2170. num = 100000;
  2171. this.formErrors.expectedSalary = '薪资不能超过100000';
  2172. }
  2173. this.formData.expectedSalary = num.toString();
  2174. },
  2175. validateEmployeeCount(e) {
  2176. const value = e.detail.value;
  2177. if (value === '') {
  2178. this.workForm.employeeCount = '';
  2179. this.workErrors.employeeCount = '';
  2180. return;
  2181. }
  2182. let num = parseInt(value);
  2183. if (isNaN(num)) {
  2184. this.workErrors.employeeCount = '请输入有效的数字';
  2185. return;
  2186. }
  2187. if (num < 0) {
  2188. num = 0;
  2189. this.workErrors.employeeCount = '人数不能小于0';
  2190. } else if (num > 10000) {
  2191. num = 10000;
  2192. this.workErrors.employeeCount = '人数不能超过10000';
  2193. }
  2194. this.workForm.employeeCount = num.toString();
  2195. },
  2196. validateMonthlySalary(e) {
  2197. const value = e.detail.value;
  2198. if (value === '') {
  2199. this.workForm.monthlySalary = '';
  2200. this.workErrors.monthlySalary = '';
  2201. return;
  2202. }
  2203. let num = parseInt(value);
  2204. if (isNaN(num)) {
  2205. this.workErrors.monthlySalary = '请输入有效的数字';
  2206. return;
  2207. }
  2208. if (num < 0) {
  2209. num = 0;
  2210. this.workErrors.monthlySalary = '月总收入不能小于0';
  2211. } else if (num > 100000) {
  2212. num = 100000;
  2213. this.workErrors.monthlySalary = '月总收入不能超过100000';
  2214. } else {
  2215. this.workErrors.monthlySalary = '';
  2216. }
  2217. this.workForm.monthlySalary = num.toString();
  2218. },
  2219. // 添加手机号验证方法
  2220. validatePhone(e) {
  2221. const value = e.detail.value;
  2222. if (value.length > 11) {
  2223. this.formData.phone = value.slice(0, 11);
  2224. }
  2225. // 实时验证手机号格式
  2226. if (value && !/^1[3-9]\d{0,9}$/.test(value)) {
  2227. this.formErrors.phone = '请输入正确的手机号码';
  2228. } else {
  2229. this.formErrors.phone = '';
  2230. }
  2231. }
  2232. },
  2233. // 添加监听器来清除错误信息
  2234. watch: {
  2235. 'formData.name': function(newVal) {
  2236. if (newVal && this.formErrors.name) {
  2237. this.formErrors.name = '';
  2238. }
  2239. },
  2240. 'formData.idCard': function(newVal) {
  2241. if (newVal && this.formErrors.idCard) {
  2242. this.formErrors.idCard = '';
  2243. }
  2244. },
  2245. 'formData.phone': function(newVal) {
  2246. if (newVal && this.formErrors.phone) {
  2247. this.formErrors.phone = '';
  2248. }
  2249. },
  2250. 'formData.gender': function(newVal) {
  2251. if (newVal && this.formErrors.gender) {
  2252. this.formErrors.gender = '';
  2253. }
  2254. },
  2255. 'formData.ethnic': function(newVal) {
  2256. if (newVal && this.formErrors.ethnic) {
  2257. this.formErrors.ethnic = '';
  2258. }
  2259. },
  2260. 'formData.currentAddress': function(newVal) {
  2261. if (newVal && this.formErrors.currentAddress) {
  2262. this.formErrors.currentAddress = '';
  2263. }
  2264. },
  2265. 'formData.height': function(newVal) {
  2266. if (newVal && this.formErrors.height) {
  2267. this.formErrors.height = '';
  2268. }
  2269. },
  2270. 'formData.weight': function(newVal) {
  2271. if (newVal && this.formErrors.weight) {
  2272. this.formErrors.weight = '';
  2273. }
  2274. },
  2275. 'formData.expectedSalary': function(newVal) {
  2276. if (newVal && this.formErrors.expectedSalary) {
  2277. this.formErrors.expectedSalary = '';
  2278. }
  2279. },
  2280. 'familyMemberForm.relation': function(newVal) {
  2281. if (newVal) this.familyMemberErrors.relation = '';
  2282. },
  2283. 'familyMemberForm.name': function(newVal) {
  2284. if (newVal) this.familyMemberErrors.name = '';
  2285. },
  2286. 'familyMemberForm.phone': function(newVal) {
  2287. if (newVal) this.familyMemberErrors.phone = '';
  2288. },
  2289. /* 'familyMemberForm.workplaceOrAddress': function(newVal) {
  2290. if (newVal) this.familyMemberErrors.workplaceOrAddress = '';
  2291. },
  2292. 'familyMemberForm.position': function(newVal) {
  2293. if (newVal) this.familyMemberErrors.position = '';
  2294. }, */
  2295. 'workForm.companyName': function(newVal) {
  2296. if (newVal && this.workErrors.companyName) {
  2297. this.workErrors.companyName = '';
  2298. }
  2299. },
  2300. 'workForm.department': function(newVal) {
  2301. if (newVal && this.workErrors.department) {
  2302. this.workErrors.department = '';
  2303. }
  2304. },
  2305. 'workForm.position': function(newVal) {
  2306. if (newVal && this.workErrors.position) {
  2307. this.workErrors.position = '';
  2308. }
  2309. },
  2310. 'workForm.employeeCount': function(newVal) {
  2311. if (newVal && this.workErrors.employeeCount) {
  2312. this.workErrors.employeeCount = '';
  2313. }
  2314. },
  2315. 'workForm.monthlySalary': function(newVal) {
  2316. if (newVal && this.workErrors.monthlySalary) {
  2317. this.workErrors.monthlySalary = '';
  2318. }
  2319. },
  2320. 'workForm.supervisor': function(newVal) {
  2321. if (newVal && this.workErrors.supervisor) {
  2322. this.workErrors.supervisor = '';
  2323. }
  2324. },
  2325. // 'workForm.supervisorPhone': function(newVal) {
  2326. // if (newVal && this.workErrors.supervisorPhone) {
  2327. // this.workErrors.supervisorPhone = '';
  2328. // }
  2329. // },
  2330. 'formData.training': function(newVal) {
  2331. if (newVal && this.formErrors.training) {
  2332. this.formErrors.training = '';
  2333. }
  2334. },
  2335. 'educationForm.startTime': function(newVal) {
  2336. if (newVal) this.educationErrors.startTime = '';
  2337. },
  2338. 'educationForm.endTime': function(newVal) {
  2339. if (newVal) this.educationErrors.endTime = '';
  2340. },
  2341. 'educationForm.schoolName': function(newVal) {
  2342. if (newVal) this.educationErrors.schoolName = '';
  2343. },
  2344. 'educationForm.major': function(newVal) {
  2345. if (newVal) this.educationErrors.major = '';
  2346. },
  2347. 'educationForm.degree': function(newVal) {
  2348. if (newVal) this.educationErrors.degree = '';
  2349. },
  2350. // 添加对表单字段的实时验证
  2351. 'formData': {
  2352. handler(newVal) {
  2353. // 只验证当前步骤的字段
  2354. const currentStepFields = {
  2355. 1: ['name', 'gender', 'phone', 'idCard', 'ethnic', 'currentAddress', 'height', 'weight', 'expectedSalary'],
  2356. 6: ['skills', 'training']
  2357. }[this.currentStep];
  2358. if (currentStepFields) {
  2359. currentStepFields.forEach(field => {
  2360. if (newVal[field] !== undefined && this.shouldValidateField(field)) {
  2361. this.validateField(field, newVal[field]);
  2362. }
  2363. });
  2364. }
  2365. },
  2366. deep: true
  2367. }
  2368. },
  2369. }
  2370. </script>
  2371. <style>
  2372. .personal-container {
  2373. padding: 20rpx;
  2374. }
  2375. .form-title {
  2376. font-size: 36rpx;
  2377. font-weight: bold;
  2378. text-align: center;
  2379. margin-bottom: 30rpx;
  2380. }
  2381. .form-container {
  2382. background-color: #fff;
  2383. border-radius: 10rpx;
  2384. padding: 20rpx;
  2385. }
  2386. .section-title {
  2387. font-size: 32rpx;
  2388. font-weight: bold;
  2389. margin: 30rpx 0 20rpx 10rpx;
  2390. color: #333;
  2391. border-left: 4rpx solid #0039b3;
  2392. padding-left: 15rpx;
  2393. }
  2394. .form-row {
  2395. display: flex;
  2396. flex-direction: row;
  2397. margin-bottom: 20rpx;
  2398. flex-wrap: wrap;
  2399. }
  2400. .form-item {
  2401. flex: 1;
  2402. min-width: 300rpx;
  2403. margin: 10rpx;
  2404. border-bottom: 1px solid #eee;
  2405. padding-bottom: 10rpx;
  2406. }
  2407. .label {
  2408. font-size: 28rpx;
  2409. color: #333;
  2410. margin-right: 10rpx;
  2411. display: block;
  2412. margin-bottom: 10rpx;
  2413. position: relative;
  2414. padding-left: 14rpx; /* 为星号预留空间 */
  2415. }
  2416. input {
  2417. font-size: 28rpx;
  2418. height: 60rpx;
  2419. }
  2420. .picker-text {
  2421. font-size: 28rpx;
  2422. height: 60rpx;
  2423. line-height: 60rpx;
  2424. color: #666;
  2425. }
  2426. .submit-btn {
  2427. margin-top: 40rpx;
  2428. background-color: #0039b3;
  2429. color: #fff;
  2430. }
  2431. .family-members-list {
  2432. margin-top: 20rpx;
  2433. }
  2434. .family-member-item {
  2435. background-color: #f8f8f8;
  2436. border-radius: 8rpx;
  2437. padding: 20rpx;
  2438. margin-bottom: 20rpx;
  2439. }
  2440. .family-member-header {
  2441. display: flex;
  2442. justify-content: space-between;
  2443. align-items: center;
  2444. margin-bottom: 15rpx;
  2445. border-bottom: 1px solid #eee;
  2446. padding-bottom: 10rpx;
  2447. }
  2448. .family-member-title {
  2449. font-size: 30rpx;
  2450. font-weight: bold;
  2451. color: #333;
  2452. }
  2453. .family-member-actions {
  2454. display: flex;
  2455. gap: 20rpx;
  2456. }
  2457. .family-member-edit {
  2458. font-size: 26rpx;
  2459. color: #1890ff;
  2460. }
  2461. .family-member-delete {
  2462. font-size: 26rpx;
  2463. color: #ff4d4f;
  2464. }
  2465. .form-subtitle {
  2466. font-size: 28rpx;
  2467. font-weight: bold;
  2468. margin-bottom: 20rpx;
  2469. display: flex;
  2470. justify-content: space-between;
  2471. align-items: center;
  2472. }
  2473. .cancel-edit {
  2474. font-size: 26rpx;
  2475. color: #999;
  2476. font-weight: normal;
  2477. }
  2478. .family-member-content {
  2479. padding: 10rpx 0;
  2480. }
  2481. .family-member-row {
  2482. display: flex;
  2483. margin-bottom: 10rpx;
  2484. }
  2485. .family-member-label {
  2486. font-size: 26rpx;
  2487. color: #666;
  2488. width: 200rpx;
  2489. }
  2490. .family-member-value {
  2491. font-size: 26rpx;
  2492. color: #333;
  2493. flex: 1;
  2494. }
  2495. .family-member-form {
  2496. background-color: #fff;
  2497. border-radius: 8rpx;
  2498. padding: 20rpx;
  2499. margin-top: 20rpx;
  2500. }
  2501. .form-row button-row {
  2502. display: flex;
  2503. justify-content: center;
  2504. margin-top: 20rpx;
  2505. }
  2506. .form-item button-container {
  2507. display: flex;
  2508. flex-direction: column;
  2509. align-items: center;
  2510. }
  2511. .circle-btn {
  2512. width: 40rpx;
  2513. height: 40rpx;
  2514. border-radius: 50%;
  2515. background-color: #0039b3;
  2516. display: flex;
  2517. justify-content: center;
  2518. align-items: center;
  2519. margin-bottom: 10rpx;
  2520. }
  2521. .btn-icon {
  2522. font-size: 32rpx;
  2523. color: #fff;
  2524. }
  2525. .btn-text {
  2526. font-size: 28rpx;
  2527. color: #333;
  2528. }
  2529. /* 添加圆形按钮相关样式 */
  2530. .button-row {
  2531. justify-content: center;
  2532. margin-top: 30rpx;
  2533. }
  2534. .button-container {
  2535. display: flex;
  2536. flex-direction: column;
  2537. align-items: center;
  2538. border-bottom: none;
  2539. min-width: auto;
  2540. }
  2541. .circle-btn {
  2542. width: 100rpx;
  2543. height: 100rpx;
  2544. border-radius: 50%;
  2545. padding: 0;
  2546. display: flex;
  2547. align-items: center;
  2548. justify-content: center;
  2549. background-color: #0039b3;
  2550. box-shadow: 0 6rpx 16rpx rgba(0, 0, 0, 0.1);
  2551. margin: 0;
  2552. }
  2553. .btn-icon {
  2554. font-size: 50rpx;
  2555. color: #fff;
  2556. line-height: 1;
  2557. }
  2558. .btn-text {
  2559. font-size: 24rpx;
  2560. color: #666;
  2561. margin-top: 10rpx;
  2562. }
  2563. /* 编辑状态下的按钮颜色 */
  2564. .circle-btn.editing {
  2565. background-color: #1890ff;
  2566. }
  2567. /* 移除原来的添加按钮样式 */
  2568. .add-member-btn {
  2569. display: none;
  2570. }
  2571. /* 应聘来源样式 */
  2572. .source-container {
  2573. background-color: #fff;
  2574. border-radius: 10rpx;
  2575. padding: 20rpx;
  2576. margin-bottom: 30rpx;
  2577. }
  2578. .source-row {
  2579. display: flex;
  2580. margin-bottom: 20rpx;
  2581. align-items: flex-start;
  2582. }
  2583. .source-label {
  2584. width: 120rpx;
  2585. font-size: 28rpx;
  2586. color: #333;
  2587. padding-top: 6rpx;
  2588. }
  2589. .source-options {
  2590. flex: 1;
  2591. display: flex;
  2592. flex-wrap: wrap;
  2593. }
  2594. .source-option {
  2595. display: flex;
  2596. align-items: center;
  2597. margin-right: 30rpx;
  2598. margin-bottom: 15rpx;
  2599. }
  2600. .source-option text {
  2601. font-size: 28rpx;
  2602. margin-left: 8rpx;
  2603. }
  2604. .other-option {
  2605. flex-basis: 100%;
  2606. margin-top: 10rpx;
  2607. }
  2608. .other-option input {
  2609. border-bottom: 1px solid #eee;
  2610. width: 300rpx;
  2611. margin-left: 10rpx;
  2612. font-size: 28rpx;
  2613. }
  2614. /* 教育经历样式 */
  2615. .education-list {
  2616. margin-top: 20rpx;
  2617. }
  2618. .education-item {
  2619. background-color: #f8f8f8;
  2620. border-radius: 8rpx;
  2621. padding: 20rpx;
  2622. margin-bottom: 20rpx;
  2623. }
  2624. .education-header {
  2625. display: flex;
  2626. justify-content: space-between;
  2627. align-items: center;
  2628. margin-bottom: 15rpx;
  2629. border-bottom: 1px solid #eee;
  2630. padding-bottom: 10rpx;
  2631. }
  2632. .education-title {
  2633. font-size: 30rpx;
  2634. font-weight: bold;
  2635. color: #333;
  2636. }
  2637. .education-actions {
  2638. display: flex;
  2639. gap: 20rpx;
  2640. }
  2641. .education-edit {
  2642. font-size: 26rpx;
  2643. color: #1890ff;
  2644. }
  2645. .education-delete {
  2646. font-size: 26rpx;
  2647. color: #ff4d4f;
  2648. }
  2649. .education-content {
  2650. padding: 10rpx 0;
  2651. }
  2652. .education-row {
  2653. display: flex;
  2654. margin-bottom: 10rpx;
  2655. }
  2656. .education-label {
  2657. font-size: 26rpx;
  2658. color: #666;
  2659. width: 150rpx;
  2660. }
  2661. .education-value {
  2662. font-size: 26rpx;
  2663. color: #333;
  2664. flex: 1;
  2665. }
  2666. .education-form {
  2667. background-color: #fff;
  2668. border-radius: 8rpx;
  2669. padding: 20rpx;
  2670. margin-top: 20rpx;
  2671. }
  2672. .date-range {
  2673. display: flex;
  2674. align-items: center;
  2675. justify-content: space-around;
  2676. }
  2677. .date-separator {
  2678. margin: 0 10rpx;
  2679. color: #666;
  2680. }
  2681. /* 专业技能和培训样式 */
  2682. .skills-container, .training-container {
  2683. background-color: #fff;
  2684. border-radius: 10rpx;
  2685. padding: 20rpx;
  2686. margin-bottom: 20rpx;
  2687. }
  2688. .skills-textarea, .training-textarea {
  2689. width: 100%;
  2690. height: 200rpx;
  2691. font-size: 28rpx;
  2692. line-height: 1.5;
  2693. padding: 10rpx;
  2694. box-sizing: border-box;
  2695. border: 1px solid #eee;
  2696. border-radius: 6rpx;
  2697. }
  2698. /* 工作经历样式 */
  2699. .work-list {
  2700. margin-top: 20rpx;
  2701. }
  2702. .work-item {
  2703. background-color: #f8f8f8;
  2704. border-radius: 8rpx;
  2705. padding: 20rpx;
  2706. margin-bottom: 20rpx;
  2707. }
  2708. .work-header {
  2709. display: flex;
  2710. justify-content: space-between;
  2711. align-items: center;
  2712. margin-bottom: 15rpx;
  2713. border-bottom: 1px solid #eee;
  2714. padding-bottom: 10rpx;
  2715. }
  2716. .work-title {
  2717. font-size: 30rpx;
  2718. font-weight: bold;
  2719. color: #333;
  2720. }
  2721. .work-actions {
  2722. display: flex;
  2723. gap: 20rpx;
  2724. }
  2725. .work-edit {
  2726. font-size: 26rpx;
  2727. color: #1890ff;
  2728. }
  2729. .work-delete {
  2730. font-size: 26rpx;
  2731. color: #ff4d4f;
  2732. }
  2733. .work-content {
  2734. padding: 10rpx 0;
  2735. }
  2736. .work-row {
  2737. display: flex;
  2738. margin-bottom: 10rpx;
  2739. }
  2740. .work-label {
  2741. font-size: 26rpx;
  2742. color: #666;
  2743. width: 150rpx;
  2744. }
  2745. .work-value {
  2746. font-size: 26rpx;
  2747. color: #333;
  2748. flex: 1;
  2749. }
  2750. .work-form {
  2751. background-color: #fff;
  2752. border-radius: 8rpx;
  2753. padding: 20rpx;
  2754. margin-top: 20rpx;
  2755. }
  2756. /* 步骤指示器样式 */
  2757. .steps-indicator {
  2758. display: flex;
  2759. justify-content: space-between;
  2760. margin-bottom: 30rpx;
  2761. padding: 20rpx;
  2762. background-color: #fff;
  2763. border-radius: 10rpx;
  2764. overflow-x: auto;
  2765. }
  2766. .step-item {
  2767. display: flex;
  2768. flex-direction: column;
  2769. align-items: center;
  2770. position: relative;
  2771. min-width: 120rpx;
  2772. }
  2773. .step-item:not(:last-child)::after {
  2774. content: '';
  2775. position: absolute;
  2776. top: 20rpx;
  2777. right: -50%;
  2778. width: 100%;
  2779. height: 2rpx;
  2780. background-color: #ddd;
  2781. z-index: 1;
  2782. }
  2783. .step-item.active:not(:last-child)::after {
  2784. background-color: #0039b3;
  2785. }
  2786. .step-number {
  2787. width: 40rpx;
  2788. height: 40rpx;
  2789. border-radius: 50%;
  2790. background-color: #ddd;
  2791. color: #fff;
  2792. display: flex;
  2793. justify-content: center;
  2794. align-items: center;
  2795. font-size: 24rpx;
  2796. margin-bottom: 10rpx;
  2797. position: relative;
  2798. z-index: 2;
  2799. }
  2800. .step-item.active .step-number {
  2801. background-color: #0039b3;
  2802. }
  2803. .step-item.current .step-number {
  2804. background-color: #0039b3;
  2805. box-shadow: 0 0 0 4rpx rgba(0, 122, 255, 0.2);
  2806. }
  2807. .step-name {
  2808. font-size: 22rpx;
  2809. color: #999;
  2810. text-align: center;
  2811. }
  2812. .step-item.active .step-name {
  2813. color: #333;
  2814. }
  2815. .step-item.current .step-name {
  2816. color: #0039b3;
  2817. font-weight: bold;
  2818. }
  2819. /* 导航按钮样式 */
  2820. .nav-buttons {
  2821. display: flex;
  2822. justify-content: space-between;
  2823. margin-top: 40rpx;
  2824. padding: 0 20rpx;
  2825. }
  2826. .nav-btn {
  2827. flex: 1;
  2828. margin: 0 10rpx;
  2829. height: 80rpx;
  2830. line-height: 80rpx;
  2831. text-align: center;
  2832. border-radius: 40rpx;
  2833. font-size: 28rpx;
  2834. }
  2835. .prev-btn {
  2836. background-color: #f0f0f0;
  2837. color: #666;
  2838. }
  2839. .next-btn {
  2840. background-color: #0039b3;
  2841. color: #fff;
  2842. }
  2843. .submit-btn {
  2844. flex: 1;
  2845. margin: 0 10rpx;
  2846. height: 80rpx;
  2847. line-height: 80rpx;
  2848. text-align: center;
  2849. border-radius: 40rpx;
  2850. font-size: 28rpx;
  2851. background-color: #0039b3;
  2852. color: #fff;
  2853. }
  2854. /* 确认提交页样式 */
  2855. .confirm-container {
  2856. background-color: #fff;
  2857. border-radius: 10rpx;
  2858. padding: 20rpx;
  2859. margin-bottom: 30rpx;
  2860. }
  2861. .confirm-message {
  2862. padding: 20rpx;
  2863. background-color: #f6f6f6;
  2864. border-radius: 8rpx;
  2865. margin-bottom: 20rpx;
  2866. }
  2867. .info-summary {
  2868. padding: 20rpx;
  2869. }
  2870. .summary-item {
  2871. display: flex;
  2872. margin-bottom: 15rpx;
  2873. }
  2874. .summary-label {
  2875. width: 150rpx;
  2876. font-size: 28rpx;
  2877. color: #666;
  2878. }
  2879. .summary-value {
  2880. flex: 1;
  2881. font-size: 28rpx;
  2882. color: #333;
  2883. }
  2884. .input-error {
  2885. border-bottom: 1px solid #ff4d4f !important;
  2886. }
  2887. .error-message {
  2888. color: #ff4d4f;
  2889. font-size: 24rpx;
  2890. margin-top: 6rpx;
  2891. display: block;
  2892. }
  2893. /* 添加承诺书弹框样式 */
  2894. .promise-modal {
  2895. position: fixed;
  2896. top: 0;
  2897. left: 0;
  2898. right: 0;
  2899. bottom: 0;
  2900. background-color: rgba(0, 0, 0, 0.5);
  2901. z-index: 999;
  2902. display: flex;
  2903. justify-content: center;
  2904. align-items: center;
  2905. }
  2906. .promise-content {
  2907. width: 80%;
  2908. max-width: 600rpx;
  2909. background-color: #fff;
  2910. border-radius: 12rpx;
  2911. padding: 30rpx;
  2912. box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.1);
  2913. }
  2914. .promise-title {
  2915. font-size: 34rpx;
  2916. font-weight: bold;
  2917. text-align: center;
  2918. margin-bottom: 20rpx;
  2919. color: #333;
  2920. }
  2921. .promise-text {
  2922. height: 600rpx;
  2923. margin-bottom: 20rpx;
  2924. /* padding: 20rpx; */
  2925. background-color: #f8f8f8;
  2926. border-radius: 8rpx;
  2927. font-size: 28rpx;
  2928. line-height: 1.6;
  2929. color: #333;
  2930. }
  2931. .promise-checkbox {
  2932. display: flex;
  2933. align-items: center;
  2934. margin-bottom: 30rpx;
  2935. padding: 0 10rpx;
  2936. }
  2937. .promise-checkbox text {
  2938. font-size: 28rpx;
  2939. margin-left: 10rpx;
  2940. color: #333;
  2941. }
  2942. .promise-buttons {
  2943. display: flex;
  2944. justify-content: center;
  2945. }
  2946. .promise-btn {
  2947. width: 200rpx;
  2948. height: 80rpx;
  2949. line-height: 80rpx;
  2950. text-align: center;
  2951. border-radius: 40rpx;
  2952. font-size: 28rpx;
  2953. }
  2954. .confirm-btn {
  2955. background-color: #0039b3;
  2956. color: #fff;
  2957. }
  2958. .confirm-btn[disabled] {
  2959. background-color: #cccccc;
  2960. color: #ffffff;
  2961. }
  2962. /* Loading indicator styles */
  2963. .loading-container {
  2964. position: fixed;
  2965. top: 0;
  2966. left: 0;
  2967. right: 0;
  2968. bottom: 0;
  2969. background-color: rgba(255, 255, 255, 0.8);
  2970. display: flex;
  2971. flex-direction: column;
  2972. justify-content: center;
  2973. align-items: center;
  2974. z-index: 1000;
  2975. }
  2976. .loading-spinner {
  2977. width: 60rpx;
  2978. height: 60rpx;
  2979. border: 6rpx solid #f3f3f3;
  2980. border-top: 6rpx solid #0039b3;
  2981. border-radius: 50%;
  2982. animation: spin 1s linear infinite;
  2983. margin-bottom: 20rpx;
  2984. }
  2985. .loading-text {
  2986. font-size: 28rpx;
  2987. color: #666;
  2988. }
  2989. @keyframes spin {
  2990. 0% { transform: rotate(0deg); }
  2991. 100% { transform: rotate(360deg); }
  2992. }
  2993. /* 添加开关样式 */
  2994. .form-item switch {
  2995. margin-top: 10rpx;
  2996. }
  2997. /* 修改必填项标签的样式 */
  2998. .label.required::before {
  2999. content: '*';
  3000. color: #ff4d4f;
  3001. margin-right: 4rpx;
  3002. position: absolute;
  3003. left: 0;
  3004. top: -4rpx;
  3005. }
  3006. /* 修改必填项标签的样式 */
  3007. /* .label.required::after {
  3008. content: '*';
  3009. color: #ff4d4f;
  3010. margin-left: 4rpx;
  3011. } */
  3012. </style>