Personal.vue 108 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790
  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="showSubmitButton"
  589. class="submit-btn"
  590. @click="submitForm"
  591. >提交</button>
  592. <button
  593. v-else
  594. class="nav-btn next-btn"
  595. @click="nextStep"
  596. >下一步</button>
  597. <!-- v-if="showNextButton" -->
  598. </view>
  599. </view>
  600. </template>
  601. <script>
  602. import { apiBaseUrl } from '@/common/config.js';
  603. export default {
  604. data() {
  605. return {
  606. // 添加承诺书相关数据
  607. showPromiseModal: true,
  608. promiseChecked: false,
  609. formData: {
  610. name: '',
  611. gender: '',
  612. threePeriod: '',
  613. birthDate: '',
  614. idCard: '',
  615. political: '',
  616. ethnic: '',
  617. height: '',
  618. weight: '',
  619. nativePlace: '',
  620. residence: '',
  621. marriage: '',
  622. expectedSalary: '',
  623. phone: '',
  624. email: '',
  625. currentAddress: '',
  626. emergencyContact: '',
  627. emergencyPhone: '',
  628. hobby: '',
  629. motto: '',
  630. // 添加应聘来源相关字段
  631. sourceType: 'social', // 默认为社招
  632. socialSource: '', // 社招来源
  633. otherSocialSource: '', // 其他社招来源
  634. otherSchoolSource: '', // 其他学校来源
  635. // 添加技能和培训字段
  636. skills: '',
  637. training: '',
  638. },
  639. genderOptions: ['男', '女'],
  640. genderIndex: -1,
  641. threePeriodOptions: ['无', '孕期', '产期', '哺乳期'],
  642. threePeriodIndex: -1,
  643. politicalOptions: ['群众', '共青团员', '中共党员', '民主党派'],
  644. politicalIndex: -1,
  645. ethnicOptions: ['汉族', '壮族', '回族', '满族', '维吾尔族', '苗族', '彝族', '土家族', '藏族', '蒙古族', '侗族', '布依族', '瑶族', '白族', '朝鲜族', '哈尼族', '黎族', '哈萨克族', '傣族', '畲族', '其他'],
  646. ethnicIndex: -1,
  647. marriageOptions: ['未婚', '已婚', '离异', '丧偶'],
  648. marriageIndex: -1,
  649. familyMembers: [],
  650. familyMemberForm: {
  651. relation: '',
  652. name: '',
  653. workplaceOrAddress: '',
  654. position: '',
  655. phone: '',
  656. isEmergencyContact: false // 添加新字段
  657. },
  658. isEditing: false,
  659. editingIndex: -1,
  660. // 添加教育经历相关数据
  661. educationList: [],
  662. educationForm: {
  663. startTime: '',
  664. endTime: '',
  665. schoolName: '',
  666. major: '',
  667. degree: ''
  668. },
  669. isEditingEducation: false,
  670. editingEducationIndex: -1,
  671. degreeOptions: ['高中', '中专', '大专', '本科', '硕士', '博士'],
  672. degreeIndex: -1,
  673. // 添加工作经历相关数据
  674. workList: [],
  675. workForm: {
  676. startTime: '',
  677. endTime: '',
  678. companyName: '',
  679. department: '',
  680. employeeCount: '',
  681. position: '',
  682. monthlySalary: '',
  683. supervisor: '',
  684. supervisorPhone: ''
  685. },
  686. isEditingWork: false,
  687. editingWorkIndex: -1,
  688. // 添加步骤控制
  689. currentStep: 1,
  690. steps: [
  691. { id: 1, name: '基本信息' },
  692. { id: 3, name: '家庭成员' },
  693. { id: 5, name: '教育经历' },
  694. { id: 6, name: '专业技能' },
  695. { id: 8, name: '工作经历' }
  696. ],
  697. formErrors: {
  698. name: '',
  699. idCard: '',
  700. phone: '',
  701. gender: '',
  702. ethnic: '',
  703. currentAddress: '',
  704. height: '',
  705. weight: '',
  706. expectedSalary: '',
  707. skills: '',
  708. training: '',
  709. threePeriod: '' // 添加这一行
  710. },
  711. // Add loading state
  712. isLoading: true,
  713. familyMemberErrors: {
  714. relation: '',
  715. name: '',
  716. phone: '',
  717. workplaceOrAddress: '',
  718. position: ''
  719. },
  720. workErrors: {
  721. startTime: '',
  722. endTime: '',
  723. companyName: '',
  724. department: '',
  725. position: '',
  726. employeeCount: '',
  727. monthlySalary: '',
  728. supervisor: '',
  729. supervisorPhone: ''
  730. },
  731. // 在 data 中添加教育经历的错误提示对象
  732. educationErrors: {
  733. startTime: '',
  734. endTime: '',
  735. schoolName: '',
  736. major: '',
  737. degree: ''
  738. },
  739. // 添加统一的验证规则
  740. validationRules: {
  741. name: {
  742. required: true,
  743. message: '请输入姓名'
  744. },
  745. phone: {
  746. required: true,
  747. pattern: /^1[3-9]\d{9}$/,
  748. message: '请输入正确的手机号码',
  749. maxLength: 11
  750. },
  751. idCard: {
  752. required: true,
  753. pattern: /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/,
  754. message: '请输入正确的身份证号码'
  755. },
  756. gender: {
  757. required: true,
  758. message: '请选择性别'
  759. },
  760. ethnic: {
  761. required: true,
  762. message: '请选择民族'
  763. },
  764. currentAddress: {
  765. required: true,
  766. message: '请输入现居住地址'
  767. },
  768. height: {
  769. pattern: /^\d+(\.\d{1,2})?$/,
  770. message: '请输入正确的身高(cm)'
  771. },
  772. weight: {
  773. pattern: /^\d+(\.\d{1,2})?$/,
  774. message: '请输入正确的体重(kg)'
  775. },
  776. expectedSalary: {
  777. pattern: /^\d+(\.\d{1,2})?$/,
  778. message: '请输入正确的期望薪资'
  779. }
  780. },
  781. // 获取配置信息
  782. configData: (() => {
  783. try {
  784. const configStr = uni.getStorageSync('configData');
  785. if (configStr && configStr.trim()) {
  786. return JSON.parse(configStr);
  787. }
  788. return {};
  789. } catch (error) {
  790. console.warn('解析配置数据失败:', error);
  791. return {};
  792. }
  793. })()
  794. }
  795. },
  796. onLoad() {
  797. // Fetch user data when component loads
  798. this.fetchUserData();
  799. console.log(this.configData)
  800. },
  801. watch: {
  802. // 监听步骤显示状态的变化
  803. shouldShowWorkStep(newVal) {
  804. console.log('工作经历显示状态变化:', newVal);
  805. if (!newVal && this.currentStep === 8) {
  806. // 如果工作经历不需要显示且当前在工作经历页面,跳转到最后一个可见步骤
  807. this.$nextTick(() => {
  808. this.jumpToLastVisibleStep();
  809. });
  810. }
  811. },
  812. shouldShowSkillsStep(newVal) {
  813. console.log('专业技能显示状态变化:', newVal);
  814. },
  815. shouldShowEducationStep(newVal) {
  816. console.log('教育经历显示状态变化:', newVal);
  817. },
  818. shouldShowFamilyStep(newVal) {
  819. console.log('家庭成员显示状态变化:', newVal);
  820. }
  821. },
  822. computed: {
  823. // 添加计算属性来控制按钮显示
  824. showPrevButton() {
  825. return this.currentStep !== 1;
  826. },
  827. showNextButton() {
  828. const currentIndex = this.currentStepIndex;
  829. if (currentIndex === -1) return false;
  830. for (let i = currentIndex + 1; i < this.steps.length; i++) {
  831. const nextStepId = this.steps[i].id;
  832. let shouldShowNextStep = true;
  833. switch (nextStepId) {
  834. case 3:
  835. shouldShowNextStep = this.shouldShowFamilyStep;
  836. break;
  837. case 5:
  838. shouldShowNextStep = this.shouldShowEducationStep;
  839. break;
  840. case 6:
  841. shouldShowNextStep = this.shouldShowSkillsStep;
  842. break;
  843. case 8:
  844. shouldShowNextStep = this.shouldShowWorkStep;
  845. break;
  846. default:
  847. shouldShowNextStep = true;
  848. }
  849. if (shouldShowNextStep) return true;
  850. }
  851. return false;
  852. },
  853. showSubmitButton() {
  854. // 找到所有需要显示的步骤中的最后一个
  855. let lastVisibleStepId = null;
  856. for (let i = this.steps.length - 1; i >= 0; i--) {
  857. const stepId = this.steps[i].id;
  858. let shouldShowStep = false;
  859. switch (stepId) {
  860. case 3: // 家庭成员
  861. shouldShowStep = this.shouldShowFamilyStep;
  862. break;
  863. case 5: // 教育经历
  864. shouldShowStep = this.shouldShowEducationStep;
  865. break;
  866. case 6: // 专业技能
  867. shouldShowStep = this.shouldShowSkillsStep;
  868. break;
  869. case 8: // 工作经历
  870. shouldShowStep = this.shouldShowWorkStep;
  871. break;
  872. default:
  873. // 非特殊步骤默认显示
  874. shouldShowStep = true;
  875. }
  876. if (shouldShowStep) {
  877. lastVisibleStepId = stepId;
  878. break;
  879. }
  880. }
  881. // 调试信息
  882. console.log('当前步骤:', this.currentStep);
  883. console.log('最后一个可见步骤:', lastVisibleStepId);
  884. console.log('家庭成员显示:', this.shouldShowFamilyStep);
  885. console.log('教育经历显示:', this.shouldShowEducationStep);
  886. console.log('专业技能显示:', this.shouldShowSkillsStep);
  887. console.log('工作经历显示:', this.shouldShowWorkStep);
  888. console.log('是否显示提交按钮:', this.currentStep === lastVisibleStepId);
  889. // 如果当前步骤是最后一个需要显示的步骤,显示提交按钮
  890. return this.currentStep === lastVisibleStepId;
  891. },
  892. // 获取当前步骤在数组中的索引
  893. currentStepIndex() {
  894. return this.steps.findIndex(step => step.id === this.currentStep);
  895. },
  896. // 添加安全的配置访问器
  897. safeConfigData() {
  898. return this.configData || {};
  899. },
  900. safeProfileFieldsConfig() {
  901. return this.safeConfigData.profile_fields_config || {};
  902. },
  903. safeFamilyFieldsConfig() {
  904. return this.safeConfigData.family_fields_config || {};
  905. },
  906. safeEducationFieldsConfig() {
  907. return this.safeConfigData.education_fields_config || {};
  908. },
  909. safeWorkFieldsConfig() {
  910. return this.safeConfigData.work_experience_fields_config || {};
  911. },
  912. // 字段显示控制方法
  913. showNameField() {
  914. return Object.keys(this.safeProfileFieldsConfig).length === 0 || this.safeProfileFieldsConfig.name?.visible !== false;
  915. },
  916. showGenderField() {
  917. return Object.keys(this.safeProfileFieldsConfig).length === 0 || this.safeProfileFieldsConfig.gender?.visible !== false;
  918. },
  919. showPhoneField() {
  920. return Object.keys(this.safeProfileFieldsConfig).length === 0 || this.safeProfileFieldsConfig.phone?.visible !== false;
  921. },
  922. showIdCardField() {
  923. return Object.keys(this.safeProfileFieldsConfig).length === 0 || this.safeProfileFieldsConfig.id_card?.visible !== false;
  924. },
  925. showEthnicField() {
  926. return Object.keys(this.safeProfileFieldsConfig).length === 0 || this.safeProfileFieldsConfig.ethnicity?.visible !== false;
  927. },
  928. showHeightField() {
  929. return Object.keys(this.safeProfileFieldsConfig).length === 0 || this.safeProfileFieldsConfig.height?.visible !== false;
  930. },
  931. showWeightField() {
  932. return Object.keys(this.safeProfileFieldsConfig).length === 0 || this.safeProfileFieldsConfig.weight?.visible !== false;
  933. },
  934. showCurrentAddress(){
  935. return Object.keys(this.safeProfileFieldsConfig).length === 0 || this.safeProfileFieldsConfig.current_address?.visible !== false;
  936. },
  937. showResidence(){
  938. return Object.keys(this.safeProfileFieldsConfig).length === 0 || this.safeProfileFieldsConfig.household_location?.visible !== false;
  939. },
  940. showMarriageIndex(){
  941. return this.safeProfileFieldsConfig.marital_status?.visible !== false;
  942. },
  943. showExpectedSalary(){
  944. return this.safeProfileFieldsConfig.expected_salary?.visible !== false;
  945. },
  946. // 家庭成员字段显示控制
  947. showFamilyRelationField() {
  948. return Object.keys(this.safeFamilyFieldsConfig).length === 0 || this.safeFamilyFieldsConfig.relation?.visible !== false;
  949. },
  950. showFamilyNameField() {
  951. return Object.keys(this.safeFamilyFieldsConfig).length === 0 || this.safeFamilyFieldsConfig.name?.visible !== false;
  952. },
  953. showFamilyWorkplaceField() {
  954. return Object.keys(this.safeFamilyFieldsConfig).length === 0 || this.safeFamilyFieldsConfig.workplace?.visible !== false;
  955. },
  956. showFamilyPositionField() {
  957. return Object.keys(this.safeFamilyFieldsConfig).length === 0 || this.safeFamilyFieldsConfig.position?.visible !== false;
  958. },
  959. showFamilyPhoneField() {
  960. return Object.keys(this.safeFamilyFieldsConfig).length === 0 || this.safeFamilyFieldsConfig.phone?.visible !== false;
  961. },
  962. showFamilyisEmergency(){
  963. // this.safeFamilyFieldsConfig.family_contact_person?.visible !== false;
  964. return Object.keys(this.safeFamilyFieldsConfig).length === 0 || this.safeFamilyFieldsConfig.family_contact_person?.visible !== false;
  965. },
  966. // 教育经历字段显示控制
  967. showEducationTimeField() {
  968. return Object.keys(this.safeEducationFieldsConfig).length === 0 || (this.safeEducationFieldsConfig.start_date?.visible !== false && this.safeEducationFieldsConfig.end_date?.visible !== false);
  969. },
  970. showEducationSchoolField() {
  971. return Object.keys(this.safeEducationFieldsConfig).length === 0 || this.safeEducationFieldsConfig.school_name?.visible !== false;
  972. },
  973. showEducationMajorField() {
  974. return Object.keys(this.safeEducationFieldsConfig).length === 0 || this.safeEducationFieldsConfig.major?.visible !== false;
  975. },
  976. showEducationDegreeField() {
  977. return Object.keys(this.safeEducationFieldsConfig).length === 0 || this.safeEducationFieldsConfig.degree?.visible !== false;
  978. },
  979. // 工作经历字段显示控制
  980. showWorkTimeField() {
  981. return Object.keys(this.safeWorkFieldsConfig).length === 0 || (this.safeWorkFieldsConfig.start_date?.visible !== false && this.safeWorkFieldsConfig.end_date?.visible !== false);
  982. },
  983. showWorkCompanyField() {
  984. return Object.keys(this.safeWorkFieldsConfig).length === 0 || this.safeWorkFieldsConfig.company_name?.visible !== false;
  985. },
  986. showWorkDepartmentField() {
  987. return Object.keys(this.safeWorkFieldsConfig).length === 0 || this.safeWorkFieldsConfig.department?.visible !== false;
  988. },
  989. showWorkEmployeeCountField() {
  990. return Object.keys(this.safeWorkFieldsConfig).length === 0 || this.safeWorkFieldsConfig.company_size?.visible !== false;
  991. },
  992. showWorkPositionField() {
  993. return Object.keys(this.safeWorkFieldsConfig).length === 0 || this.safeWorkFieldsConfig.position?.visible !== false;
  994. },
  995. showWorkMonthlySalary(){
  996. return this.safeWorkFieldsConfig.monthly_salary?.visible
  997. },
  998. showWorkSupervisor(){
  999. return this.safeWorkFieldsConfig.direct_supervisor?.visible
  1000. },
  1001. showWorkSupervisorPhone(){
  1002. return this.safeWorkFieldsConfig.supervisor_phone?.visible
  1003. },
  1004. showRequireProfessionalSkillsField() { //受培训
  1005. console.log(this.safeConfigData.require_professional_skills)
  1006. const value = this.safeConfigData.require_professional_skills
  1007. return value === undefined || value === null ? true : value
  1008. },
  1009. showRequireTrainingInfoField() { //专业技能
  1010. console.log(this.safeConfigData.require_training_info)
  1011. const value = this.safeConfigData.require_training_info
  1012. return value === undefined || value === null ? true : value
  1013. },
  1014. shouldShowSkillsStep() {
  1015. return this.showRequireTrainingInfoField || this.showRequireProfessionalSkillsField;
  1016. },
  1017. // 判断是否显示教育经历步骤
  1018. shouldShowEducationStep() {
  1019. // 如果没有配置数据,默认显示
  1020. if (Object.keys(this.safeEducationFieldsConfig).length === 0) {
  1021. return true;
  1022. }
  1023. // 检查所有教育经历字段是否都被隐藏
  1024. const fields = ['start_date', 'end_date', 'school_name', 'major', 'degree'];
  1025. return fields.some(field => this.safeEducationFieldsConfig[field]?.visible !== false);
  1026. },
  1027. // 判断是否显示家庭成员步骤
  1028. shouldShowFamilyStep() {
  1029. // 如果没有配置数据,默认显示
  1030. if (Object.keys(this.safeFamilyFieldsConfig).length === 0) {
  1031. return true;
  1032. }
  1033. // 检查所有家庭成员字段是否都被隐藏
  1034. const fields = ['relation', 'name', 'workplace', 'position', 'phone'];
  1035. return fields.some(field => this.safeFamilyFieldsConfig[field]?.visible !== false);
  1036. },
  1037. // 判断是否显示工作经历
  1038. shouldShowWorkStep() {
  1039. // 如果没有配置数据,默认显示
  1040. if (Object.keys(this.safeWorkFieldsConfig).length === 0) {
  1041. return true;
  1042. }
  1043. // 检查所有家庭成员字段是否都被隐藏
  1044. const fields = ['start_date', 'end_date', 'company_name', 'department', 'company_size','position','monthly_salary','direct_supervisor','supervisor_phone'];
  1045. return fields.some(field => this.safeWorkFieldsConfig[field]?.visible !== false);
  1046. },
  1047. },
  1048. methods: {
  1049. // 确保当前步骤是有效的(如果需要显示的话)
  1050. ensureValidStep() {
  1051. const currentStepId = this.currentStep;
  1052. let shouldShowCurrentStep = true;
  1053. // 检查当前步骤是否需要显示
  1054. switch (currentStepId) {
  1055. case 3: // 家庭成员
  1056. shouldShowCurrentStep = this.shouldShowFamilyStep;
  1057. break;
  1058. case 5: // 教育经历
  1059. shouldShowCurrentStep = this.shouldShowEducationStep;
  1060. break;
  1061. case 6: // 专业技能
  1062. shouldShowCurrentStep = this.shouldShowSkillsStep;
  1063. break;
  1064. case 8: // 工作经历
  1065. shouldShowCurrentStep = this.shouldShowWorkStep;
  1066. break;
  1067. default:
  1068. // 非特殊步骤默认显示
  1069. shouldShowCurrentStep = true;
  1070. }
  1071. // 如果当前步骤不需要显示,跳转到最后一个可见步骤
  1072. if (!shouldShowCurrentStep) {
  1073. this.jumpToLastVisibleStep();
  1074. }
  1075. },
  1076. // 跳转到最后一个可见步骤
  1077. jumpToLastVisibleStep() {
  1078. let lastVisibleStepId = null;
  1079. // 从后往前查找最后一个需要显示的步骤
  1080. for (let i = this.steps.length - 1; i >= 0; i--) {
  1081. const stepId = this.steps[i].id;
  1082. let shouldShowStep = false;
  1083. switch (stepId) {
  1084. case 3: // 家庭成员
  1085. shouldShowStep = this.shouldShowFamilyStep;
  1086. break;
  1087. case 5: // 教育经历
  1088. shouldShowStep = this.shouldShowEducationStep;
  1089. break;
  1090. case 6: // 专业技能
  1091. shouldShowStep = this.shouldShowSkillsStep;
  1092. break;
  1093. case 8: // 工作经历
  1094. shouldShowStep = this.shouldShowWorkStep;
  1095. break;
  1096. default:
  1097. // 非特殊步骤默认显示
  1098. shouldShowStep = true;
  1099. }
  1100. if (shouldShowStep) {
  1101. lastVisibleStepId = stepId;
  1102. break;
  1103. }
  1104. }
  1105. // 跳转到最后一个可见步骤
  1106. if (lastVisibleStepId) {
  1107. console.log('跳转到最后一个可见步骤:', lastVisibleStepId);
  1108. this.currentStep = lastVisibleStepId;
  1109. // 滚动到页面顶部
  1110. uni.pageScrollTo({
  1111. scrollTop: 0,
  1112. duration: 300
  1113. });
  1114. }
  1115. },
  1116. // 输入时限制小数位数
  1117. handleInput(event, field, maxDecimals) {
  1118. let value = event.detail.value;
  1119. // 1. 过滤非法字符并限制小数位
  1120. value = value
  1121. .replace(/[^\d.-]/g, '')
  1122. .replace(/(\..*)\./g, '$1')
  1123. .replace(/(-\d*)-/g, '$1')
  1124. .replace(new RegExp(`^(-?\\d*\\.\\d{${maxDecimals}}).*$`), '$1');
  1125. // 2. 处理以小数点开头的情况
  1126. if (value.startsWith('.')) {
  1127. value = '0' + value;
  1128. }
  1129. // 3. 更新数据
  1130. this.formData[field] = value;
  1131. // 4. 强制同步输入框显示
  1132. this.$nextTick(() => {
  1133. event.target.value = value;
  1134. });
  1135. },
  1136. // 失焦时补全小数位
  1137. handleBlur(field, precision = 2) {
  1138. const val = this.formData[field];
  1139. if (val === '' || val === undefined || val === null) return;
  1140. const num = parseFloat(val);
  1141. if (!isNaN(num)) {
  1142. this.formData[field] = num.toFixed(precision);
  1143. } else {
  1144. this.formData[field] = '';
  1145. }
  1146. },
  1147. // 添加承诺书相关方法
  1148. togglePromiseChecked() {
  1149. this.promiseChecked = !this.promiseChecked;
  1150. },
  1151. confirmPromise() {
  1152. if (this.promiseChecked) {
  1153. this.showPromiseModal = false;
  1154. } else {
  1155. uni.showToast({
  1156. title: '请先阅读并同意承诺书内容',
  1157. icon: 'none'
  1158. });
  1159. }
  1160. },
  1161. // 添加字段是否需要验证的判断方法
  1162. shouldValidateField(fieldName, section) {
  1163. section = section || 'profile';
  1164. switch (section) {
  1165. case 'profile':
  1166. const fieldShowMap = {
  1167. 'name': this.showNameField,
  1168. 'gender': this.showGenderField,
  1169. 'phone': this.showPhoneField,
  1170. 'idCard': this.showIdCardField,
  1171. 'ethnic': this.showEthnicField,
  1172. 'height': this.showHeightField,
  1173. 'weight': this.showWeightField,
  1174. 'currentAddress': this.showCurrentAddress, // 现居住地址总是显示和必填
  1175. 'expectedSalary': this.showExpectedSalary, // 期望薪资总是显示
  1176. 'skills': this.showRequireTrainingInfoField, // 专业技能根据配置显示和必填
  1177. 'training': this.showRequireProfessionalSkillsField, // 培训经历根据配置显示和必填
  1178. 'threePeriod': this.formData.gender === '女' // 只有女性时才需要验证三期状态
  1179. };
  1180. return fieldShowMap[fieldName] !== false;
  1181. case 'family':
  1182. const familyFieldShowMap = {
  1183. 'relation': this.showFamilyRelationField,
  1184. 'name': this.showFamilyNameField,
  1185. 'phone': this.showFamilyPhoneField,
  1186. 'workplaceOrAddress': this.showFamilyWorkplaceField,
  1187. 'position': this.showFamilyPositionField,
  1188. 'isEmergencyContact':this.showFamilyisEmergency
  1189. };
  1190. return familyFieldShowMap[fieldName] !== false;
  1191. case 'education':
  1192. const educationFieldShowMap = {
  1193. 'startTime': this.showEducationTimeField,
  1194. 'endTime': this.showEducationTimeField,
  1195. 'schoolName': this.showEducationSchoolField,
  1196. 'major': this.showEducationMajorField,
  1197. 'degree': this.showEducationDegreeField
  1198. };
  1199. return educationFieldShowMap[fieldName] !== false;
  1200. case 'work':
  1201. const workFieldShowMap = {
  1202. 'startTime': this.showWorkTimeField,
  1203. 'endTime': this.showWorkTimeField,
  1204. 'companyName': this.showWorkCompanyField,
  1205. 'department': this.showWorkDepartmentField,
  1206. 'position': this.showWorkPositionField,
  1207. 'employeeCount': this.showWorkEmployeeCountField,
  1208. 'monthlySalary': this.showWorkMonthlySalary, // 月薪总是需要验证
  1209. 'supervisor': this.showWorkSupervisor, // 直接领导总是需要验证
  1210. 'supervisorPhone': this.showWorkSupervisorPhone // 领导电话总是需要验证
  1211. };
  1212. return workFieldShowMap[fieldName] !== false;
  1213. default:
  1214. return true;
  1215. }
  1216. },
  1217. bindGenderChange(e) {
  1218. this.genderIndex = e.detail.value;
  1219. this.formData.gender = this.genderOptions[this.genderIndex];
  1220. // 清除性别的错误提示
  1221. if (this.formErrors.gender) {
  1222. this.formErrors.gender = '';
  1223. }
  1224. // 如果性别从女变为男,清空三期选择
  1225. if (this.formData.gender !== '女') {
  1226. this.formData.threePeriod = '';
  1227. this.threePeriodIndex = -1;
  1228. this.formErrors.threePeriod = ''; // 清除三期状态的错误提示
  1229. }
  1230. },
  1231. bindThreePeriodChange(e) {
  1232. this.threePeriodIndex = e.detail.value;
  1233. this.formData.threePeriod = this.threePeriodOptions[this.threePeriodIndex];
  1234. // 清除三期状态的错误提示
  1235. if (this.formErrors.threePeriod) {
  1236. this.formErrors.threePeriod = '';
  1237. }
  1238. },
  1239. bindPoliticalChange(e) {
  1240. this.politicalIndex = e.detail.value;
  1241. this.formData.political = this.politicalOptions[this.politicalIndex];
  1242. },
  1243. bindEthnicChange(e) {
  1244. this.ethnicIndex = e.detail.value;
  1245. this.formData.ethnic = this.ethnicOptions[this.ethnicIndex];
  1246. // 清除民族的错误提示
  1247. if (this.formErrors.ethnic) {
  1248. this.formErrors.ethnic = '';
  1249. }
  1250. },
  1251. bindMarriageChange(e) {
  1252. this.marriageIndex = e.detail.value;
  1253. this.formData.marriage = this.marriageOptions[this.marriageIndex];
  1254. },
  1255. bindDateChange(e) {
  1256. this.formData.birthDate = e.detail.value;
  1257. },
  1258. saveFamilyMember() {
  1259. // 重置错误信息
  1260. this.resetFamilyMemberErrors();
  1261. // 验证必填字段
  1262. let isValid = true;
  1263. // 只验证显示的字段
  1264. if (this.shouldValidateField('relation', 'family') && !this.familyMemberForm.relation) {
  1265. this.familyMemberErrors.relation = '请输入称谓';
  1266. isValid = false;
  1267. }
  1268. if (this.shouldValidateField('name', 'family') && !this.familyMemberForm.name) {
  1269. this.familyMemberErrors.name = '请输入姓名';
  1270. isValid = false;
  1271. }
  1272. // if (this.shouldValidateField('workplaceOrAddress', 'family') && !this.familyMemberForm.workplaceOrAddress) {
  1273. // this.familyMemberErrors.workplaceOrAddress = '请输入工作单位/家庭地址';
  1274. // isValid = false;
  1275. // }
  1276. // if (this.shouldValidateField('position', 'family') && !this.familyMemberForm.position) {
  1277. // this.familyMemberErrors.position = '请输入职务';
  1278. // isValid = false;
  1279. // }
  1280. // if (this.shouldValidateField('phone', 'family') && !this.familyMemberForm.phone) {
  1281. // this.familyMemberErrors.phone = '请输入联系电话';
  1282. // isValid = false;
  1283. // } else
  1284. if (this.shouldValidateField('phone', 'family') && this.familyMemberForm.phone && !/^1[3-9]\d{9}$/.test(this.familyMemberForm.phone)) {
  1285. this.familyMemberErrors.phone = '请输入正确的手机号';
  1286. isValid = false;
  1287. }
  1288. if (!isValid) {
  1289. uni.showToast({
  1290. title: '请完善家庭成员信息',
  1291. icon: 'none'
  1292. });
  1293. return;
  1294. }
  1295. // 原有的保存逻辑
  1296. if (this.isEditing) {
  1297. this.familyMembers[this.editingIndex] = {...this.familyMemberForm};
  1298. uni.showToast({
  1299. title: '修改成功',
  1300. icon: 'success'
  1301. });
  1302. this.isEditing = false;
  1303. this.editingIndex = -1;
  1304. } else {
  1305. this.familyMembers.push({...this.familyMemberForm});
  1306. uni.showToast({
  1307. title: '添加成功',
  1308. icon: 'success'
  1309. });
  1310. }
  1311. // 重置表单和错误信息
  1312. this.resetFamilyMemberForm();
  1313. },
  1314. // 添加重置错误信息的方法
  1315. resetFamilyMemberErrors() {
  1316. this.familyMemberErrors = {
  1317. relation: '',
  1318. name: '',
  1319. phone: '',
  1320. workplaceOrAddress: '',
  1321. position: ''
  1322. };
  1323. },
  1324. // 修改重置表单的方法
  1325. resetFamilyMemberForm() {
  1326. this.familyMemberForm = {
  1327. relation: '',
  1328. name: '',
  1329. workplaceOrAddress: '',
  1330. position: '',
  1331. phone: '',
  1332. isEmergencyContact: false
  1333. };
  1334. this.resetFamilyMemberErrors();
  1335. },
  1336. editFamilyMember(index) {
  1337. this.isEditing = true;
  1338. this.editingIndex = index;
  1339. this.familyMemberForm = {...this.familyMembers[index]};
  1340. uni.pageScrollTo({
  1341. selector: '.family-member-form',
  1342. duration: 300
  1343. });
  1344. },
  1345. cancelEdit() {
  1346. this.isEditing = false;
  1347. this.editingIndex = -1;
  1348. this.familyMemberForm = {
  1349. relation: '',
  1350. name: '',
  1351. workplaceOrAddress: '',
  1352. position: '',
  1353. phone: '',
  1354. isEmergencyContact: false
  1355. };
  1356. },
  1357. deleteFamilyMember(index) {
  1358. if (this.isEditing && this.editingIndex === index) {
  1359. this.cancelEdit();
  1360. }
  1361. this.familyMembers.splice(index, 1);
  1362. uni.showToast({
  1363. title: '已删除',
  1364. icon: 'none'
  1365. });
  1366. },
  1367. // 选择应聘来源类型
  1368. selectSourceType(type) {
  1369. this.formData.sourceType = type;
  1370. if (type === 'social') {
  1371. // 默认选择第一个社招来源
  1372. this.formData.socialSource = 'BOSS';
  1373. } else {
  1374. // 清空社招来源
  1375. this.formData.socialSource = '';
  1376. }
  1377. },
  1378. // 选择社招来源
  1379. selectSocialSource(source) {
  1380. this.formData.sourceType = 'social';
  1381. this.formData.socialSource = source;
  1382. },
  1383. // 教育经历相关方法
  1384. bindStartTimeChange(e) {
  1385. const startTime = e.detail.value;
  1386. if (this.educationForm.endTime && startTime > this.educationForm.endTime) {
  1387. uni.showToast({
  1388. title: '开始时间不能大于结束时间',
  1389. icon: 'none'
  1390. });
  1391. return;
  1392. }
  1393. this.educationForm.startTime = startTime;
  1394. this.educationErrors.startTime = false;
  1395. },
  1396. bindEndTimeChange(e) {
  1397. const endTime = e.detail.value;
  1398. if (this.educationForm.startTime && endTime < this.educationForm.startTime) {
  1399. uni.showToast({
  1400. title: '结束时间不能小于开始时间',
  1401. icon: 'none'
  1402. });
  1403. return;
  1404. }
  1405. this.educationForm.endTime = endTime;
  1406. this.educationErrors.endTime = false;
  1407. },
  1408. bindDegreeChange(e) {
  1409. this.degreeIndex = e.detail.value;
  1410. this.educationForm.degree = this.degreeOptions[this.degreeIndex];
  1411. },
  1412. saveEducation() {
  1413. // 重置错误信息
  1414. this.resetEducationErrors();
  1415. // 验证必填字段
  1416. let isValid = true;
  1417. // 只验证显示的字段
  1418. if (this.shouldValidateField('startTime', 'education') && !this.educationForm.startTime) {
  1419. this.educationErrors.startTime = '请选择开始时间';
  1420. isValid = false;
  1421. }
  1422. if (this.shouldValidateField('endTime', 'education') && !this.educationForm.endTime) {
  1423. this.educationErrors.endTime = '请选择结束时间';
  1424. isValid = false;
  1425. }
  1426. if (this.shouldValidateField('schoolName', 'education') && !this.educationForm.schoolName) {
  1427. this.educationErrors.schoolName = '请输入学校名称';
  1428. isValid = false;
  1429. }
  1430. if (this.shouldValidateField('major', 'education') && !this.educationForm.major) {
  1431. this.educationErrors.major = '请输入专业';
  1432. isValid = false;
  1433. }
  1434. if (this.shouldValidateField('degree', 'education') && !this.educationForm.degree) {
  1435. this.educationErrors.degree = '请选择学历';
  1436. isValid = false;
  1437. }
  1438. if (!isValid) {
  1439. uni.showToast({
  1440. title: '请完善教育经历信息',
  1441. icon: 'none'
  1442. });
  1443. return;
  1444. }
  1445. // 验证通过后的保存逻辑
  1446. if (this.isEditingEducation) {
  1447. this.educationList[this.editingEducationIndex] = {...this.educationForm};
  1448. uni.showToast({
  1449. title: '修改成功',
  1450. icon: 'success'
  1451. });
  1452. this.isEditingEducation = false;
  1453. this.editingEducationIndex = -1;
  1454. } else {
  1455. this.educationList.push({...this.educationForm});
  1456. uni.showToast({
  1457. title: '添加成功',
  1458. icon: 'success'
  1459. });
  1460. }
  1461. // 重置表单
  1462. this.educationForm = {
  1463. startTime: '',
  1464. endTime: '',
  1465. schoolName: '',
  1466. major: '',
  1467. degree: ''
  1468. };
  1469. this.degreeIndex = -1;
  1470. },
  1471. editEducation(index) {
  1472. this.isEditingEducation = true;
  1473. this.editingEducationIndex = index;
  1474. this.educationForm = {...this.educationList[index]};
  1475. // 设置学历索引
  1476. this.degreeIndex = this.degreeOptions.findIndex(item => item === this.educationForm.degree);
  1477. uni.pageScrollTo({
  1478. selector: '.education-form',
  1479. duration: 300
  1480. });
  1481. },
  1482. cancelEditEducation() {
  1483. this.isEditingEducation = false;
  1484. this.editingEducationIndex = -1;
  1485. this.educationForm = {
  1486. startTime: '',
  1487. endTime: '',
  1488. schoolName: '',
  1489. major: '',
  1490. degree: ''
  1491. };
  1492. this.degreeIndex = -1;
  1493. },
  1494. deleteEducation(index) {
  1495. if (this.isEditingEducation && this.editingEducationIndex === index) {
  1496. this.cancelEditEducation();
  1497. }
  1498. this.educationList.splice(index, 1);
  1499. uni.showToast({
  1500. title: '已删除',
  1501. icon: 'none'
  1502. });
  1503. },
  1504. // 工作经历相关方法
  1505. bindWorkStartTimeChange(e) {
  1506. const startTime = e.detail.value;
  1507. if (this.workForm.endTime && startTime > this.workForm.endTime) {
  1508. uni.showToast({
  1509. title: '开始时间不能大于结束时间',
  1510. icon: 'none'
  1511. });
  1512. return;
  1513. }
  1514. this.workForm.startTime = startTime;
  1515. this.workErrors.startTime = false;
  1516. },
  1517. bindWorkEndTimeChange(e) {
  1518. const endTime = e.detail.value;
  1519. if (this.workForm.startTime && endTime < this.workForm.startTime) {
  1520. uni.showToast({
  1521. title: '结束时间不能小于开始时间',
  1522. icon: 'none'
  1523. });
  1524. return;
  1525. }
  1526. this.workForm.endTime = endTime;
  1527. this.workErrors.endTime = false;
  1528. },
  1529. saveWork() {
  1530. // 重置所有工作经历相关的错误信息
  1531. this.workErrors = {
  1532. startTime: '',
  1533. endTime: '',
  1534. companyName: '',
  1535. department: '',
  1536. position: '',
  1537. employeeCount: '',
  1538. monthlySalary: '',
  1539. supervisor: '',
  1540. supervisorPhone: ''
  1541. };
  1542. // 验证必填字段
  1543. let isValid = true;
  1544. // 只验证显示的字段
  1545. if (this.shouldValidateField('startTime', 'work') && !this.workForm.startTime) {
  1546. this.workErrors.startTime = '请选择开始时间';
  1547. isValid = false;
  1548. }
  1549. if (this.shouldValidateField('endTime', 'work') && !this.workForm.endTime) {
  1550. this.workErrors.endTime = '请选择结束时间';
  1551. isValid = false;
  1552. }
  1553. if (this.shouldValidateField('companyName', 'work') && !this.workForm.companyName) {
  1554. this.workErrors.companyName = '请输入单位名称';
  1555. isValid = false;
  1556. }
  1557. if (this.shouldValidateField('department', 'work') && !this.workForm.department) {
  1558. this.workErrors.department = '请输入任职部门';
  1559. isValid = false;
  1560. }
  1561. if (this.shouldValidateField('position', 'work') && !this.workForm.position) {
  1562. this.workErrors.position = '请输入担任职务';
  1563. isValid = false;
  1564. }
  1565. if (this.shouldValidateField('employeeCount', 'work') && !this.workForm.employeeCount) {
  1566. this.workErrors.employeeCount = '请输入单位人数';
  1567. isValid = false;
  1568. }
  1569. if (this.shouldValidateField('monthlySalary', 'work') && !this.workForm.monthlySalary) {
  1570. this.workErrors.monthlySalary = '请输入月总收入';
  1571. isValid = false;
  1572. }
  1573. // if (this.shouldValidateField('supervisor', 'work') && !this.workForm.supervisor) {
  1574. // this.workErrors.supervisor = '请输入直属上级';
  1575. // isValid = false;
  1576. // }
  1577. // if (this.shouldValidateField('supervisorPhone', 'work') && !this.workForm.supervisorPhone) {
  1578. // this.workErrors.supervisorPhone = '请输入直属上级电话';
  1579. // isValid = false;
  1580. // }
  1581. // 如果验证不通过,直接返回
  1582. if (!isValid) {
  1583. uni.showToast({
  1584. title: '请完善工作经历信息',
  1585. icon: 'none'
  1586. });
  1587. return;
  1588. }
  1589. // 验证通过后的保存逻辑
  1590. if (this.isEditingWork) {
  1591. this.workList[this.editingWorkIndex] = {...this.workForm};
  1592. uni.showToast({
  1593. title: '修改成功',
  1594. icon: 'success'
  1595. });
  1596. this.isEditingWork = false;
  1597. this.editingWorkIndex = -1;
  1598. } else {
  1599. this.workList.push({...this.workForm});
  1600. uni.showToast({
  1601. title: '添加成功',
  1602. icon: 'success'
  1603. });
  1604. }
  1605. // 重置表单
  1606. this.workForm = {
  1607. startTime: '',
  1608. endTime: '',
  1609. companyName: '',
  1610. department: '',
  1611. employeeCount: '',
  1612. position: '',
  1613. monthlySalary: '',
  1614. supervisor: '',
  1615. supervisorPhone: ''
  1616. };
  1617. },
  1618. editWork(index) {
  1619. this.isEditingWork = true;
  1620. this.editingWorkIndex = index;
  1621. this.workForm = {...this.workList[index]};
  1622. uni.pageScrollTo({
  1623. selector: '.work-form',
  1624. duration: 300
  1625. });
  1626. },
  1627. cancelEditWork() {
  1628. this.isEditingWork = false;
  1629. this.editingWorkIndex = -1;
  1630. this.workForm = {
  1631. startTime: '',
  1632. endTime: '',
  1633. companyName: '',
  1634. department: '',
  1635. employeeCount: '',
  1636. position: '',
  1637. monthlySalary: '',
  1638. supervisor: '',
  1639. supervisorPhone: ''
  1640. };
  1641. },
  1642. deleteWork(index) {
  1643. if (this.isEditingWork && this.editingWorkIndex === index) {
  1644. this.cancelEditWork();
  1645. }
  1646. this.workList.splice(index, 1);
  1647. uni.showToast({
  1648. title: '已删除',
  1649. icon: 'none'
  1650. });
  1651. },
  1652. submitForm() {
  1653. // 先验证当前步骤
  1654. if (!this.validateCurrentStep()) {
  1655. return;
  1656. }
  1657. // 在提交前检查并自动保存所有未保存的表单
  1658. this.autoSaveAllUnsavedForms();
  1659. // 验证所有必填字段
  1660. const allRequired = [
  1661. 'name', 'gender', 'phone', 'idCard', 'ethnic', 'currentAddress'
  1662. ];
  1663. let isValid = true;
  1664. allRequired.forEach(field => {
  1665. // 只验证显示的字段
  1666. if (this.shouldValidateField(field) && !this.validateField(field, this.formData[field])) {
  1667. isValid = false;
  1668. }
  1669. });
  1670. // 验证专业技能和培训
  1671. if (this.shouldValidateField('skills') && !this.formData.skills?.trim()) {
  1672. this.formErrors.skills = '请描述您的专业技能';
  1673. isValid = false;
  1674. }
  1675. if (this.shouldValidateField('training') && !this.formData.training?.trim()) {
  1676. this.formErrors.training = '请描述您的培训经历';
  1677. isValid = false;
  1678. }
  1679. if (!isValid) {
  1680. uni.showToast({
  1681. title: '请完善所有必填信息',
  1682. icon: 'none'
  1683. });
  1684. return;
  1685. }
  1686. // 检查必要的用户信息
  1687. const userInfo = uni.getStorageSync('userInfo');
  1688. if (!userInfo) {
  1689. uni.showToast({
  1690. title: '用户信息获取失败,请重新登录',
  1691. icon: 'none',
  1692. duration: 2000
  1693. });
  1694. return;
  1695. }
  1696. try {
  1697. const userData = JSON.parse(userInfo);
  1698. const submitData = {
  1699. tenant_id: uni.getStorageSync('tenant_id') ||JSON.parse(uni.getStorageSync('userInfo')).tenant_id ||1,
  1700. user_id: userData.id,
  1701. personal_info: {
  1702. name: this.formData.name,
  1703. gender: this.formData.gender,
  1704. phone: this.formData.phone,
  1705. id_card: this.formData.idCard,
  1706. address: this.formData.currentAddress,
  1707. professional_skills: this.formData.skills ? this.formData.skills.split(',') : []
  1708. },
  1709. profile: {
  1710. female_status: this.getFemaleStatus(),
  1711. marital_status: this.getMaritalStatus(),
  1712. height: parseFloat(this.formData.height) || 0,
  1713. weight: parseFloat(this.formData.weight) || 0,
  1714. ethnicity: this.formData.ethnic,
  1715. current_address: this.formData.currentAddress,
  1716. expected_salary: parseFloat(this.formData.expectedSalary) || 0
  1717. },
  1718. educations: this.formatEducations(),
  1719. family_members: this.formatFamilyMembers(),
  1720. work_experiences: this.formatWorkExperiences()
  1721. };
  1722. // 数据检查
  1723. if (!submitData.personal_info.name || !submitData.personal_info.gender || !submitData.personal_info.phone) {
  1724. uni.showToast({
  1725. title: '基本信息不完整',
  1726. icon: 'none',
  1727. duration: 2000
  1728. });
  1729. return;
  1730. }
  1731. this.sendFormData(submitData);
  1732. } catch (error) {
  1733. console.error('数据处理错误:', error);
  1734. uni.showToast({
  1735. title: '数据处理错误,请重试',
  1736. icon: 'none',
  1737. duration: 2000
  1738. });
  1739. }
  1740. },
  1741. // 辅助方法:发送表单数据
  1742. sendFormData(submitData) {
  1743. uni.showLoading({ title: '提交中...' });
  1744. // 添加请求头和token
  1745. const token = uni.getStorageSync('token');
  1746. uni.request({
  1747. url: `${apiBaseUrl}/wechat/user/profile/update`,
  1748. method: 'POST',
  1749. data: submitData,
  1750. header: {
  1751. 'content-type': 'application/json',
  1752. 'Authorization': token ? `Bearer ${token}` : ''
  1753. },
  1754. success: (res) => {
  1755. uni.hideLoading();
  1756. if (res.statusCode === 200) {
  1757. if (res.data.code === 2000) {
  1758. uni.showToast({
  1759. title: '提交成功',
  1760. icon: 'success',
  1761. duration: 2000
  1762. });
  1763. setTimeout(() => {
  1764. uni.navigateTo({
  1765. url: '/pages/interview-notice/interview-notice'
  1766. });
  1767. }, 2000);
  1768. } else {
  1769. uni.showToast({
  1770. title: res.data.msg || '提交失败',
  1771. icon: 'none',
  1772. duration: 2000
  1773. });
  1774. }
  1775. } else {
  1776. uni.showToast({
  1777. title: '服务器响应错误',
  1778. icon: 'none',
  1779. duration: 2000
  1780. });
  1781. }
  1782. },
  1783. fail: (err) => {
  1784. console.error('提交失败:', err);
  1785. uni.hideLoading();
  1786. // 检查具体错误类型
  1787. if (err.errMsg.includes('timeout')) {
  1788. uni.showToast({
  1789. title: '请求超时,请检查网络后重试',
  1790. icon: 'none',
  1791. duration: 2000
  1792. });
  1793. } else if (err.errMsg.includes('fail')) {
  1794. uni.showToast({
  1795. title: '网络连接失败,请检查网络设置',
  1796. icon: 'none',
  1797. duration: 2000
  1798. });
  1799. } else {
  1800. uni.showToast({
  1801. title: '提交失败,请稍后重试',
  1802. icon: 'none',
  1803. duration: 2000
  1804. });
  1805. }
  1806. },
  1807. complete: () => {
  1808. // 可以在这里添加完成后的处理逻辑
  1809. }
  1810. });
  1811. },
  1812. // 数据格式化方法
  1813. getFemaleStatus() {
  1814. if (this.formData.gender !== '女') return 0;
  1815. const statusMap = { '孕期': 1, '产期': 2, '哺乳期': 3 };
  1816. return statusMap[this.formData.threePeriod] || 0;
  1817. },
  1818. getMaritalStatus() {
  1819. const statusMap = { '未婚': 0, '已婚': 1, '离异': 2, '丧偶': 3 };
  1820. return statusMap[this.formData.marriage] || 0;
  1821. },
  1822. formatEducations() {
  1823. return this.educationList.map((edu, index) => ({
  1824. education_type: index === 0 ? 1 : 2,
  1825. degree: this.mapDegreeToNumber(edu.degree),
  1826. start_date: edu.startTime,
  1827. end_date: edu.endTime,
  1828. school_name: edu.schoolName,
  1829. major: edu.major
  1830. }));
  1831. },
  1832. formatFamilyMembers() {
  1833. return this.familyMembers.map(member => ({
  1834. relation: member.relation,
  1835. name: member.name,
  1836. workplace: member.workplaceOrAddress,
  1837. position: member.position,
  1838. phone: member.phone,
  1839. //is_emergency_contact: member.isEmergencyContact||false // 添加紧急联系人标识
  1840. }));
  1841. },
  1842. formatWorkExperiences() {
  1843. return this.workList.map(work => ({
  1844. start_date: work.startTime,
  1845. end_date: work.endTime,
  1846. company_name: work.companyName,
  1847. department: work.department,
  1848. company_size: parseInt(work.employeeCount)||0,
  1849. position: work.position,
  1850. monthly_salary: work.monthlySalary||0,
  1851. supervisor_name: work.supervisor,
  1852. supervisor_phone: work.supervisorPhone
  1853. }));
  1854. },
  1855. // 学历映射辅助方法
  1856. mapDegreeToNumber(degreeText) {
  1857. const degreeMap = {
  1858. '高中': 1,
  1859. '中专': 1,
  1860. '大专': 2,
  1861. '本科': 3,
  1862. '硕士': 4,
  1863. '博士': 5
  1864. };
  1865. return degreeMap[degreeText] || 6; // 默认为其他
  1866. },
  1867. prevStep() {
  1868. const prevIndex = this.currentStepIndex - 1;
  1869. if (prevIndex >= 0) {
  1870. let targetIndex = prevIndex;
  1871. // 检查上一步是否需要跳过
  1872. while (targetIndex >= 0) {
  1873. const stepId = this.steps[targetIndex].id;
  1874. // 如果是专业技能步骤且不需要显示,则跳过
  1875. if (stepId === 6 && !this.shouldShowSkillsStep) {
  1876. targetIndex--;
  1877. continue;
  1878. }
  1879. // 如果是教育经历步骤且不需要显示,则跳过
  1880. if (stepId === 5 && !this.shouldShowEducationStep) {
  1881. targetIndex--;
  1882. continue;
  1883. }
  1884. // 如果是家庭成员步骤且不需要显示,则跳过
  1885. if (stepId === 3 && !this.shouldShowFamilyStep) {
  1886. targetIndex--;
  1887. continue;
  1888. }
  1889. // 如果是工作经历步骤且不需要显示,则跳过
  1890. if (stepId === 8 && !this.shouldShowWorkStep) {
  1891. targetIndex--;
  1892. continue;
  1893. }
  1894. // 找到有效步骤,跳出循环
  1895. break;
  1896. }
  1897. // 如果找到有效步骤,跳转到该步骤
  1898. if (targetIndex >= 0) {
  1899. this.currentStep = this.steps[targetIndex].id;
  1900. }
  1901. // 滚动到页面顶部
  1902. uni.pageScrollTo({
  1903. scrollTop: 0,
  1904. duration: 300
  1905. });
  1906. }
  1907. },
  1908. nextStep() {
  1909. // 验证当前步骤
  1910. if (!this.validateCurrentStep()) {
  1911. return;
  1912. }
  1913. // 如果是第一步,需要进行身份验证
  1914. if (this.currentStep === 1) {
  1915. this.verifyIdentity();
  1916. return;
  1917. }
  1918. const nextIndex = this.currentStepIndex + 1;
  1919. if (nextIndex < this.steps.length) {
  1920. let targetIndex = nextIndex;
  1921. // 检查下一步是否需要跳过
  1922. while (targetIndex < this.steps.length) {
  1923. const stepId = this.steps[targetIndex].id;
  1924. console.log(this.steps[targetIndex].id)
  1925. // 如果是家庭成员步骤且不需要显示,则跳过
  1926. if (stepId === 3 && !this.shouldShowFamilyStep) {
  1927. targetIndex++;
  1928. continue;
  1929. }
  1930. // 如果是教育经历步骤且不需要显示,则跳过
  1931. if (stepId === 5 && !this.shouldShowEducationStep) {
  1932. targetIndex++;
  1933. continue;
  1934. }
  1935. // 如果是专业技能步骤且不需要显示,则跳过
  1936. if (stepId === 6 && !this.shouldShowSkillsStep) {
  1937. targetIndex++;
  1938. continue;
  1939. }
  1940. // 如果是工作经历步骤且不需要显示,则跳过
  1941. if (stepId === 8 && !this.shouldShowWorkStep) {
  1942. targetIndex++;
  1943. continue;
  1944. }
  1945. // 找到有效步骤,跳出循环
  1946. break;
  1947. }
  1948. // 如果找到有效步骤,跳转到该步骤
  1949. if (targetIndex < this.steps.length) {
  1950. this.currentStep = this.steps[targetIndex].id;
  1951. } else {
  1952. // 如果没有找到下一个有效步骤,说明当前步骤是最后一个需要显示的步骤
  1953. // 此时应该显示提交按钮,不需要跳转
  1954. console.log('当前步骤是最后一个需要显示的步骤,显示提交按钮');
  1955. }
  1956. // 滚动到页面顶部
  1957. uni.pageScrollTo({
  1958. scrollTop: 0,
  1959. duration: 300
  1960. });
  1961. }
  1962. },
  1963. // 身份验证方法
  1964. verifyIdentity() {
  1965. // 清空错误信息
  1966. this.formErrors = {
  1967. name: '',
  1968. idCard: '',
  1969. phone: ''
  1970. };
  1971. uni.showLoading({
  1972. title: '身份验证中...'
  1973. });
  1974. uni.request({
  1975. url: `${apiBaseUrl}/wechat/identity/verify`,
  1976. method: 'POST',
  1977. data: {
  1978. name: this.formData.name,
  1979. id_number: this.formData.idCard,
  1980. mobile: this.formData.phone
  1981. },
  1982. header: {
  1983. 'content-type': 'application/x-www-form-urlencoded'
  1984. },
  1985. success: (res) => {
  1986. uni.hideLoading();
  1987. console.log(res);
  1988. if (res.data.code === 200) {
  1989. // 验证通过,进入下一步
  1990. let targetIndex = this.currentStepIndex + 1;
  1991. // 跳过不需要显示的步骤(与 nextStep 保持一致)
  1992. while (targetIndex < this.steps.length) {
  1993. const stepId = this.steps[targetIndex].id;
  1994. if (stepId === 3 && !this.shouldShowFamilyStep) { targetIndex++; continue; }
  1995. if (stepId === 5 && !this.shouldShowEducationStep) { targetIndex++; continue; }
  1996. if (stepId === 6 && !this.shouldShowSkillsStep) { targetIndex++; continue; }
  1997. if (stepId === 8 && !this.shouldShowWorkStep) { targetIndex++; continue; }
  1998. break;
  1999. }
  2000. if (targetIndex < this.steps.length) {
  2001. this.currentStep = this.steps[targetIndex].id;
  2002. uni.pageScrollTo({ scrollTop: 0, duration: 300 });
  2003. } else {
  2004. // 如果没有找到下一个有效步骤,说明当前步骤是最后一个需要显示的步骤
  2005. // 此时应该显示提交按钮,不需要跳转
  2006. console.log('身份验证通过后,当前步骤是最后一个需要显示的步骤,显示提交按钮');
  2007. }
  2008. /* 保存姓名 */
  2009. this.setUserInfo(this.formData);
  2010. } else {
  2011. // 验证失败,显示错误信息
  2012. this.handleVerificationError(res.data);
  2013. }
  2014. },
  2015. fail: (err) => {
  2016. this.handleRequestError(err);
  2017. }
  2018. });
  2019. },
  2020. setUserInfo(data) {
  2021. uni.request({
  2022. url: `${apiBaseUrl}/wechat/updateUserInfo`,
  2023. method: 'POST',
  2024. data: {
  2025. openid: JSON.parse(uni.getStorageSync('userInfo')).openid,
  2026. name: data.name,
  2027. id_card: data.idCard,
  2028. purePhoneNumber: data.phone,
  2029. tenant_id:uni.getStorageSync('tenant_id') ||JSON.parse(uni.getStorageSync('userInfo')).tenant_id || 1,
  2030. examine:0
  2031. },
  2032. header: {
  2033. 'content-type': 'application/x-www-form-urlencoded'
  2034. },
  2035. success: (res) => {
  2036. console.log(res);
  2037. }
  2038. });
  2039. },
  2040. // 处理验证错误
  2041. handleVerificationError(data) {
  2042. this.formErrors.name = '姓名验证失败,请检查姓名是否正确';
  2043. this.formErrors.idCard = '身份证号验证失败,请检查身份证号是否正确';
  2044. this.formErrors.phone = '手机号验证失败,请检查手机号是否正确';
  2045. uni.showToast({
  2046. title: data.msg || '身份验证失败',
  2047. icon: 'none'
  2048. });
  2049. },
  2050. // 处理请求错误
  2051. handleRequestError(err) {
  2052. uni.hideLoading();
  2053. uni.showToast({
  2054. title: '网络错误,请检查网络连接',
  2055. icon: 'none',
  2056. duration: 2000
  2057. });
  2058. console.error('请求失败:', err);
  2059. },
  2060. // 验证当前步骤的必填项
  2061. validateCurrentStep() {
  2062. let isValid = true;
  2063. switch (this.currentStep) {
  2064. case 1: // 基本信息
  2065. const basicFields = ['name', 'gender', 'phone', 'idCard', 'ethnic', 'currentAddress'];
  2066. basicFields.forEach(field => {
  2067. // 只验证显示的字段
  2068. if (this.shouldValidateField(field) && !this.validateField(field, this.formData[field])) {
  2069. isValid = false;
  2070. }
  2071. });
  2072. // 特殊验证:女性三期状态
  2073. if (this.shouldValidateField('threePeriod') && this.formData.gender === '女' && this.threePeriodIndex === -1) {
  2074. this.formErrors.threePeriod = '请选择三期状态';
  2075. isValid = false;
  2076. }
  2077. // 可选字段验证(如果有值则验证格式)
  2078. if (this.shouldValidateField('height') && this.formData.height) {
  2079. isValid = this.validateField('height', this.formData.height) && isValid;
  2080. }
  2081. if (this.shouldValidateField('weight') && this.formData.weight) {
  2082. isValid = this.validateField('weight', this.formData.weight) && isValid;
  2083. }
  2084. if (this.shouldValidateField('expectedSalary') && this.formData.expectedSalary) {
  2085. isValid = this.validateField('expectedSalary', this.formData.expectedSalary) && isValid;
  2086. }
  2087. break;
  2088. case 3: // 家庭成员
  2089. // 检查是否有未保存的家庭成员表单
  2090. if (this.hasUnsavedFamilyMemberForm()) {
  2091. // 尝试自动保存
  2092. if (!this.autoSaveFamilyMember()) {
  2093. isValid = false;
  2094. break;
  2095. }
  2096. }
  2097. console.log(this.familyMembers.length);
  2098. if (this.familyMembers.length == 0) {
  2099. uni.showToast({
  2100. title: '请至少添加一位家庭成员',
  2101. icon: 'none'
  2102. });
  2103. isValid = false;
  2104. }
  2105. break;
  2106. case 5: // 教育经历
  2107. // 检查是否有未保存的教育经历表单
  2108. if (this.hasUnsavedEducationForm()) {
  2109. // 尝试自动保存
  2110. if (!this.autoSaveEducation()) {
  2111. isValid = false;
  2112. break;
  2113. }
  2114. }
  2115. if (this.educationList.length === 0) {
  2116. uni.showToast({
  2117. title: '请至少添加一项教育经历',
  2118. icon: 'none'
  2119. });
  2120. isValid = false;
  2121. }
  2122. break;
  2123. case 6: // 专业技能
  2124. if (this.shouldValidateField('skills') && !this.formData.skills?.trim()) {
  2125. this.formErrors.skills = '请描述您的专业技能';
  2126. isValid = false;
  2127. }
  2128. if (this.shouldValidateField('training') && !this.formData.training?.trim()) {
  2129. this.formErrors.training = '请描述您的培训经历';
  2130. isValid = false;
  2131. }
  2132. break;
  2133. case 8: // 工作经历
  2134. // 检查是否有未保存的工作经历表单
  2135. if (this.hasUnsavedWorkForm()) {
  2136. // 尝试自动保存
  2137. if (!this.autoSaveWork()) {
  2138. isValid = false;
  2139. break;
  2140. }
  2141. }
  2142. if (this.workList.length === 0) {
  2143. uni.showToast({
  2144. title: '请至少添加一项工作经历',
  2145. icon: 'none'
  2146. });
  2147. isValid = false;
  2148. }
  2149. break;
  2150. }
  2151. /* if (!isValid) {
  2152. uni.showToast({
  2153. title: '请完善所有必填信息',
  2154. icon: 'none'
  2155. });
  2156. } */
  2157. return isValid;
  2158. },
  2159. // Add method to fetch user data
  2160. fetchUserData() {
  2161. this.isLoading = true;
  2162. // Get openid from storage
  2163. const userInfo = uni.getStorageSync('userInfo') ? JSON.parse(uni.getStorageSync('userInfo')) : {};
  2164. const openid = userInfo.openid;
  2165. if (!openid) {
  2166. uni.showToast({
  2167. title: '用户信息获取失败,请重新登录',
  2168. icon: 'none'
  2169. });
  2170. this.isLoading = false;
  2171. return;
  2172. }
  2173. uni.request({
  2174. url: `${apiBaseUrl}/api/wechat/user/get_full_info?tenant_id=${uni.getStorageSync('tenant_id') || JSON.parse(uni.getStorageSync('userInfo')).tenant_id ||1}&openid=${openid}`,
  2175. method: 'GET',
  2176. success: (res) => {
  2177. // 无论结果如何,都保持承诺书显示状态
  2178. this.showPromiseModal = true;
  2179. /* if (res.data.code === 2000) { */
  2180. // Successfully fetched data
  2181. this.populateFormData(res.data.data);
  2182. /* } else {
  2183. uni.showToast({
  2184. title: res.data.msg || '获取用户信息失败',
  2185. icon: 'none'
  2186. });
  2187. } */
  2188. },
  2189. fail: (err) => {
  2190. /* console.error('获取用户信息失败:', err);
  2191. uni.showToast({
  2192. title: '网络错误,请检查网络连接',
  2193. icon: 'none'
  2194. }); */
  2195. },
  2196. complete: () => {
  2197. this.isLoading = false;
  2198. // 数据加载完成后,检查当前步骤是否需要显示
  2199. this.$nextTick(() => {
  2200. this.ensureValidStep();
  2201. });
  2202. }
  2203. });
  2204. },
  2205. // Add method to populate form data with fetched data
  2206. populateFormData(data) {
  2207. const { user_info, profile, educations, work_experiences, family_members } = data;
  2208. // Populate basic user info
  2209. if (user_info) {
  2210. this.formData.name = user_info.name || '';
  2211. this.formData.gender = user_info.gender_text || '';
  2212. this.genderIndex = this.genderOptions.findIndex(item => item === this.formData.gender);
  2213. this.formData.idCard = user_info.id_card || '';
  2214. this.formData.phone = user_info.phone || '';
  2215. this.formData.email = user_info.email || '';
  2216. }
  2217. // Populate profile data
  2218. if (profile) {
  2219. // Set political status
  2220. this.formData.political = profile.political_status || '';
  2221. this.politicalIndex = this.politicalOptions.findIndex(item => item === this.formData.political);
  2222. // Set ethnic
  2223. this.formData.ethnic = profile.ethnicity || '';
  2224. this.ethnicIndex = this.ethnicOptions.findIndex(item => item === this.formData.ethnic);
  2225. // Set height and weight
  2226. this.formData.height = profile.height || '';
  2227. this.formData.weight = profile.weight || '';
  2228. // Set native place and residence
  2229. this.formData.nativePlace = profile.native_place || '';
  2230. this.formData.residence = profile.household_location || '';
  2231. // Set current address
  2232. this.formData.currentAddress = profile.current_address || '';
  2233. // Set marriage status
  2234. this.formData.marriage = profile.marital_status_text || '';
  2235. this.marriageIndex = this.marriageOptions.findIndex(item => item === this.formData.marriage);
  2236. // Set three period status for female
  2237. if (this.formData.gender === '女' && profile.female_status !== undefined) {
  2238. const femaleStatusMap = {0: '无', 1: '孕期', 2: '产期', 3: '哺乳期'};
  2239. this.formData.threePeriod = femaleStatusMap[profile.female_status] || '无';
  2240. this.threePeriodIndex = this.threePeriodOptions.findIndex(item => item === this.formData.threePeriod);
  2241. }
  2242. // Set expected salary
  2243. this.formData.expectedSalary = profile.expected_salary || '';
  2244. // Set emergency contact
  2245. this.formData.emergencyContact = profile.emergency_contact || '';
  2246. this.formData.emergencyPhone = profile.emergency_phone || '';
  2247. // Set hobby and motto
  2248. this.formData.hobby = profile.specialties || '';
  2249. this.formData.motto = profile.life_motto || '';
  2250. // Set recruitment source
  2251. const sourceTypeMap = {
  2252. 1: 'school',
  2253. 2: 'social',
  2254. 3: 'social',
  2255. 4: 'social',
  2256. 5: 'social'
  2257. };
  2258. const socialSourceMap = {
  2259. 2: 'BOSS',
  2260. 3: 'zhilian',
  2261. 4: 'liepin',
  2262. 5: 'other'
  2263. };
  2264. this.formData.sourceType = sourceTypeMap[profile.recruitment_source] || 'social';
  2265. if (this.formData.sourceType === 'social') {
  2266. this.formData.socialSource = socialSourceMap[profile.recruitment_source] || '';
  2267. if (this.formData.socialSource === 'other') {
  2268. this.formData.otherSocialSource = profile.recruitment_source_detail || '';
  2269. }
  2270. } else if (this.formData.sourceType === 'school') {
  2271. this.formData.otherSchoolSource = profile.recruitment_source_detail || '';
  2272. }
  2273. }
  2274. // Populate educations data
  2275. if (educations && educations.length > 0) {
  2276. this.educationList = educations.map(edu => {
  2277. const degreeMap = {
  2278. 1: '高中',
  2279. 2: '大专',
  2280. 3: '本科',
  2281. 4: '硕士',
  2282. 5: '博士'
  2283. };
  2284. return {
  2285. startTime: edu.start_date || '',
  2286. endTime: edu.end_date || '',
  2287. schoolName: edu.school_name || '',
  2288. major: edu.major || '',
  2289. degree: degreeMap[edu.degree] || ''
  2290. };
  2291. });
  2292. }
  2293. // Populate work experience data
  2294. if (work_experiences && work_experiences.length > 0) {
  2295. this.workList = work_experiences.map(work => {
  2296. return {
  2297. startTime: work.start_date || '',
  2298. endTime: work.end_date || '',
  2299. companyName: work.company_name || '',
  2300. department: work.department || '',
  2301. employeeCount: work.company_size || '',
  2302. position: work.position || '',
  2303. monthlySalary: work.monthly_salary || '',
  2304. supervisor: work.supervisor_name || '',
  2305. supervisorPhone: work.supervisor_phone || ''
  2306. };
  2307. });
  2308. }
  2309. // Populate family members data
  2310. if (family_members && family_members.length > 0) {
  2311. this.familyMembers = family_members.map(member => {
  2312. return {
  2313. relation: member.relation || '',
  2314. name: member.name || '',
  2315. workplaceOrAddress: member.workplace || '',
  2316. position: member.position || '',
  2317. phone: member.phone || '',
  2318. isEmergencyContact: member.isEmergencyContact || false
  2319. };
  2320. });
  2321. }
  2322. // 移除这段代码,确保承诺书始终显示
  2323. // if (user_info && user_info.is_profile_complete) {
  2324. // this.showPromiseModal = false;
  2325. // }
  2326. },
  2327. // 处理紧急联系人开关变化
  2328. handleEmergencyContactChange(e) {
  2329. this.familyMemberForm.isEmergencyContact = e.detail.value;
  2330. // 如果设置为紧急联系人,自动填充到紧急联系人字段
  2331. if (e.detail.value) {
  2332. this.formData.emergencyContact = this.familyMemberForm.name;
  2333. this.formData.emergencyPhone = this.familyMemberForm.phone;
  2334. }
  2335. },
  2336. // 添加重置教育经历错误信息的方法
  2337. resetEducationErrors() {
  2338. this.educationErrors = {
  2339. startTime: '',
  2340. endTime: '',
  2341. schoolName: '',
  2342. major: '',
  2343. degree: ''
  2344. };
  2345. },
  2346. // 添加通用验证方法
  2347. validateField(fieldName, value) {
  2348. const rule = this.validationRules[fieldName];
  2349. if (!rule) return true;
  2350. // 如果字段被隐藏,不进行验证
  2351. if (!this.shouldValidateField(fieldName)) {
  2352. return true;
  2353. }
  2354. // 重置该字段的错误信息
  2355. this.formErrors[fieldName] = '';
  2356. // 必填验证
  2357. if (rule.required && !value) {
  2358. this.formErrors[fieldName] = rule.message;
  2359. return false;
  2360. }
  2361. // 正则验证
  2362. if (rule.pattern && value && !rule.pattern.test(value)) {
  2363. this.formErrors[fieldName] = rule.message;
  2364. return false;
  2365. }
  2366. return true;
  2367. },
  2368. validateExpectedSalary(e) {
  2369. const value = e.detail.value;
  2370. console.log(value);
  2371. if (value === '') {
  2372. this.formData.expectedSalary = '';
  2373. this.formErrors.expectedSalary = '';
  2374. return;
  2375. }
  2376. let num = parseFloat(value);
  2377. if (isNaN(num)) {
  2378. this.formErrors.expectedSalary = '请输入有效的数字';
  2379. return;
  2380. }
  2381. if (num < 0) {
  2382. num = 0;
  2383. this.formErrors.expectedSalary = '薪资不能小于0';
  2384. } else if (num > 100000) {
  2385. num = 100000;
  2386. this.formErrors.expectedSalary = '薪资不能超过100000';
  2387. }
  2388. this.formData.expectedSalary = num.toString();
  2389. },
  2390. validateEmployeeCount(e) {
  2391. const value = e.detail.value;
  2392. if (value === '') {
  2393. this.workForm.employeeCount = '';
  2394. this.workErrors.employeeCount = '';
  2395. return;
  2396. }
  2397. let num = parseInt(value);
  2398. if (isNaN(num)) {
  2399. this.workErrors.employeeCount = '请输入有效的数字';
  2400. return;
  2401. }
  2402. if (num < 0) {
  2403. num = 0;
  2404. this.workErrors.employeeCount = '人数不能小于0';
  2405. } else if (num > 10000) {
  2406. num = 10000;
  2407. this.workErrors.employeeCount = '人数不能超过10000';
  2408. }
  2409. this.workForm.employeeCount = num.toString();
  2410. },
  2411. validateMonthlySalary(e) {
  2412. const value = e.detail.value;
  2413. if (value === '') {
  2414. this.workForm.monthlySalary = '';
  2415. this.workErrors.monthlySalary = '';
  2416. return;
  2417. }
  2418. let num = parseInt(value);
  2419. if (isNaN(num)) {
  2420. this.workErrors.monthlySalary = '请输入有效的数字';
  2421. return;
  2422. }
  2423. if (num < 0) {
  2424. num = 0;
  2425. this.workErrors.monthlySalary = '月总收入不能小于0';
  2426. } else if (num > 100000) {
  2427. num = 100000;
  2428. this.workErrors.monthlySalary = '月总收入不能超过100000';
  2429. } else {
  2430. this.workErrors.monthlySalary = '';
  2431. }
  2432. this.workForm.monthlySalary = num.toString();
  2433. },
  2434. // 添加手机号验证方法
  2435. validatePhone(e) {
  2436. const value = e.detail.value;
  2437. if (value.length > 11) {
  2438. this.formData.phone = value.slice(0, 11);
  2439. }
  2440. // 实时验证手机号格式
  2441. if (value && !/^1[3-9]\d{0,9}$/.test(value)) {
  2442. this.formErrors.phone = '请输入正确的手机号码';
  2443. } else {
  2444. this.formErrors.phone = '';
  2445. }
  2446. },
  2447. // 检查是否有未保存的家庭成员表单
  2448. hasUnsavedFamilyMemberForm() {
  2449. return this.familyMemberForm.relation ||
  2450. this.familyMemberForm.name ||
  2451. this.familyMemberForm.workplaceOrAddress ||
  2452. this.familyMemberForm.position ||
  2453. this.familyMemberForm.phone;
  2454. },
  2455. // 检查是否有未保存的教育经历表单
  2456. hasUnsavedEducationForm() {
  2457. return this.educationForm.startTime ||
  2458. this.educationForm.endTime ||
  2459. this.educationForm.schoolName ||
  2460. this.educationForm.major ||
  2461. this.educationForm.degree;
  2462. },
  2463. // 检查是否有未保存的工作经历表单
  2464. hasUnsavedWorkForm() {
  2465. return this.workForm.startTime ||
  2466. this.workForm.endTime ||
  2467. this.workForm.companyName ||
  2468. this.workForm.department ||
  2469. this.workForm.position ||
  2470. this.workForm.employeeCount ||
  2471. this.workForm.monthlySalary ||
  2472. this.workForm.supervisor ||
  2473. this.workForm.supervisorPhone;
  2474. },
  2475. // 自动保存家庭成员
  2476. autoSaveFamilyMember() {
  2477. // 重置错误信息
  2478. this.resetFamilyMemberErrors();
  2479. // 验证必填字段
  2480. let isValid = true;
  2481. // 只验证显示的字段
  2482. if (this.shouldValidateField('relation', 'family') && !this.familyMemberForm.relation) {
  2483. this.familyMemberErrors.relation = '请输入称谓';
  2484. isValid = false;
  2485. }
  2486. if (this.shouldValidateField('name', 'family') && !this.familyMemberForm.name) {
  2487. this.familyMemberErrors.name = '请输入姓名';
  2488. isValid = false;
  2489. }
  2490. if (!isValid) {
  2491. uni.showToast({
  2492. title: '请完善家庭成员必填信息',
  2493. icon: 'none'
  2494. });
  2495. return false;
  2496. }
  2497. // 自动保存逻辑
  2498. if (this.isEditing) {
  2499. this.familyMembers[this.editingIndex] = {...this.familyMemberForm};
  2500. this.isEditing = false;
  2501. this.editingIndex = -1;
  2502. } else {
  2503. this.familyMembers.push({...this.familyMemberForm});
  2504. }
  2505. // 重置表单
  2506. this.resetFamilyMemberForm();
  2507. uni.showToast({
  2508. title: '已自动保存',
  2509. icon: 'success',
  2510. duration: 1500
  2511. });
  2512. return true;
  2513. },
  2514. // 自动保存教育经历
  2515. autoSaveEducation() {
  2516. // 重置错误信息
  2517. this.resetEducationErrors();
  2518. // 验证必填字段
  2519. let isValid = true;
  2520. // 只验证显示的字段
  2521. if (this.shouldValidateField('startTime', 'education') && !this.educationForm.startTime) {
  2522. this.educationErrors.startTime = '请选择开始时间';
  2523. isValid = false;
  2524. }
  2525. if (this.shouldValidateField('endTime', 'education') && !this.educationForm.endTime) {
  2526. this.educationErrors.endTime = '请选择结束时间';
  2527. isValid = false;
  2528. }
  2529. if (this.shouldValidateField('schoolName', 'education') && !this.educationForm.schoolName) {
  2530. this.educationErrors.schoolName = '请输入学校名称';
  2531. isValid = false;
  2532. }
  2533. if (this.shouldValidateField('major', 'education') && !this.educationForm.major) {
  2534. this.educationErrors.major = '请输入专业';
  2535. isValid = false;
  2536. }
  2537. if (this.shouldValidateField('degree', 'education') && !this.educationForm.degree) {
  2538. this.educationErrors.degree = '请选择学历';
  2539. isValid = false;
  2540. }
  2541. if (!isValid) {
  2542. uni.showToast({
  2543. title: '请完善教育经历必填信息',
  2544. icon: 'none'
  2545. });
  2546. return false;
  2547. }
  2548. // 自动保存逻辑
  2549. if (this.isEditingEducation) {
  2550. this.educationList[this.editingEducationIndex] = {...this.educationForm};
  2551. this.isEditingEducation = false;
  2552. this.editingEducationIndex = -1;
  2553. } else {
  2554. this.educationList.push({...this.educationForm});
  2555. }
  2556. // 重置表单
  2557. this.educationForm = {
  2558. startTime: '',
  2559. endTime: '',
  2560. schoolName: '',
  2561. major: '',
  2562. degree: ''
  2563. };
  2564. this.degreeIndex = -1;
  2565. uni.showToast({
  2566. title: '已自动保存',
  2567. icon: 'success',
  2568. duration: 1500
  2569. });
  2570. return true;
  2571. },
  2572. // 自动保存工作经历
  2573. autoSaveWork() {
  2574. // 重置所有工作经历相关的错误信息
  2575. this.workErrors = {
  2576. startTime: '',
  2577. endTime: '',
  2578. companyName: '',
  2579. department: '',
  2580. position: '',
  2581. employeeCount: '',
  2582. monthlySalary: '',
  2583. supervisor: '',
  2584. supervisorPhone: ''
  2585. };
  2586. // 验证必填字段
  2587. let isValid = true;
  2588. // 只验证显示的字段
  2589. if (this.shouldValidateField('startTime', 'work') && !this.workForm.startTime) {
  2590. this.workErrors.startTime = '请选择开始时间';
  2591. isValid = false;
  2592. }
  2593. if (this.shouldValidateField('endTime', 'work') && !this.workForm.endTime) {
  2594. this.workErrors.endTime = '请选择结束时间';
  2595. isValid = false;
  2596. }
  2597. if (this.shouldValidateField('companyName', 'work') && !this.workForm.companyName) {
  2598. this.workErrors.companyName = '请输入单位名称';
  2599. isValid = false;
  2600. }
  2601. if (this.shouldValidateField('employeeCount', 'work') && !this.workForm.employeeCount) {
  2602. this.workErrors.employeeCount = '请输入单位人数';
  2603. isValid = false;
  2604. }
  2605. if (!isValid) {
  2606. uni.showToast({
  2607. title: '请完善工作经历必填信息',
  2608. icon: 'none'
  2609. });
  2610. return false;
  2611. }
  2612. // 自动保存逻辑
  2613. if (this.isEditingWork) {
  2614. this.workList[this.editingWorkIndex] = {...this.workForm};
  2615. this.isEditingWork = false;
  2616. this.editingWorkIndex = -1;
  2617. } else {
  2618. this.workList.push({...this.workForm});
  2619. }
  2620. // 重置表单
  2621. this.workForm = {
  2622. startTime: '',
  2623. endTime: '',
  2624. companyName: '',
  2625. department: '',
  2626. employeeCount: '',
  2627. position: '',
  2628. monthlySalary: '',
  2629. supervisor: '',
  2630. supervisorPhone: ''
  2631. };
  2632. uni.showToast({
  2633. title: '已自动保存',
  2634. icon: 'success',
  2635. duration: 1500
  2636. });
  2637. return true;
  2638. },
  2639. // 自动保存所有未保存的表单
  2640. autoSaveAllUnsavedForms() {
  2641. // 检查并自动保存家庭成员表单
  2642. if (this.hasUnsavedFamilyMemberForm()) {
  2643. this.autoSaveFamilyMember();
  2644. }
  2645. // 检查并自动保存教育经历表单
  2646. if (this.hasUnsavedEducationForm()) {
  2647. this.autoSaveEducation();
  2648. }
  2649. // 检查并自动保存工作经历表单
  2650. if (this.hasUnsavedWorkForm()) {
  2651. this.autoSaveWork();
  2652. }
  2653. }
  2654. },
  2655. // 添加监听器来清除错误信息
  2656. watch: {
  2657. 'formData.name': function(newVal) {
  2658. if (newVal && this.formErrors.name) {
  2659. this.formErrors.name = '';
  2660. }
  2661. },
  2662. 'formData.idCard': function(newVal) {
  2663. if (newVal && this.formErrors.idCard) {
  2664. this.formErrors.idCard = '';
  2665. }
  2666. },
  2667. 'formData.phone': function(newVal) {
  2668. if (newVal && this.formErrors.phone) {
  2669. this.formErrors.phone = '';
  2670. }
  2671. },
  2672. 'formData.gender': function(newVal) {
  2673. if (newVal && this.formErrors.gender) {
  2674. this.formErrors.gender = '';
  2675. }
  2676. },
  2677. 'formData.ethnic': function(newVal) {
  2678. if (newVal && this.formErrors.ethnic) {
  2679. this.formErrors.ethnic = '';
  2680. }
  2681. },
  2682. 'formData.currentAddress': function(newVal) {
  2683. if (newVal && this.formErrors.currentAddress) {
  2684. this.formErrors.currentAddress = '';
  2685. }
  2686. },
  2687. 'formData.height': function(newVal) {
  2688. if (newVal && this.formErrors.height) {
  2689. this.formErrors.height = '';
  2690. }
  2691. },
  2692. 'formData.weight': function(newVal) {
  2693. if (newVal && this.formErrors.weight) {
  2694. this.formErrors.weight = '';
  2695. }
  2696. },
  2697. 'formData.expectedSalary': function(newVal) {
  2698. if (newVal && this.formErrors.expectedSalary) {
  2699. this.formErrors.expectedSalary = '';
  2700. }
  2701. },
  2702. 'familyMemberForm.relation': function(newVal) {
  2703. if (newVal) this.familyMemberErrors.relation = '';
  2704. },
  2705. 'familyMemberForm.name': function(newVal) {
  2706. if (newVal) this.familyMemberErrors.name = '';
  2707. },
  2708. 'familyMemberForm.phone': function(newVal) {
  2709. if (newVal) this.familyMemberErrors.phone = '';
  2710. },
  2711. /* 'familyMemberForm.workplaceOrAddress': function(newVal) {
  2712. if (newVal) this.familyMemberErrors.workplaceOrAddress = '';
  2713. },
  2714. 'familyMemberForm.position': function(newVal) {
  2715. if (newVal) this.familyMemberErrors.position = '';
  2716. }, */
  2717. 'workForm.companyName': function(newVal) {
  2718. if (newVal && this.workErrors.companyName) {
  2719. this.workErrors.companyName = '';
  2720. }
  2721. },
  2722. 'workForm.department': function(newVal) {
  2723. if (newVal && this.workErrors.department) {
  2724. this.workErrors.department = '';
  2725. }
  2726. },
  2727. 'workForm.position': function(newVal) {
  2728. if (newVal && this.workErrors.position) {
  2729. this.workErrors.position = '';
  2730. }
  2731. },
  2732. 'workForm.employeeCount': function(newVal) {
  2733. if (newVal && this.workErrors.employeeCount) {
  2734. this.workErrors.employeeCount = '';
  2735. }
  2736. },
  2737. 'workForm.monthlySalary': function(newVal) {
  2738. if (newVal && this.workErrors.monthlySalary) {
  2739. this.workErrors.monthlySalary = '';
  2740. }
  2741. },
  2742. 'workForm.supervisor': function(newVal) {
  2743. if (newVal && this.workErrors.supervisor) {
  2744. this.workErrors.supervisor = '';
  2745. }
  2746. },
  2747. // 'workForm.supervisorPhone': function(newVal) {
  2748. // if (newVal && this.workErrors.supervisorPhone) {
  2749. // this.workErrors.supervisorPhone = '';
  2750. // }
  2751. // },
  2752. 'formData.training': function(newVal) {
  2753. if (newVal && this.formErrors.training) {
  2754. this.formErrors.training = '';
  2755. }
  2756. },
  2757. 'educationForm.startTime': function(newVal) {
  2758. if (newVal) this.educationErrors.startTime = '';
  2759. },
  2760. 'educationForm.endTime': function(newVal) {
  2761. if (newVal) this.educationErrors.endTime = '';
  2762. },
  2763. 'educationForm.schoolName': function(newVal) {
  2764. if (newVal) this.educationErrors.schoolName = '';
  2765. },
  2766. 'educationForm.major': function(newVal) {
  2767. if (newVal) this.educationErrors.major = '';
  2768. },
  2769. 'educationForm.degree': function(newVal) {
  2770. if (newVal) this.educationErrors.degree = '';
  2771. },
  2772. // 添加对表单字段的实时验证
  2773. 'formData': {
  2774. handler(newVal) {
  2775. // 只验证当前步骤的字段
  2776. const currentStepFields = {
  2777. 1: ['name', 'gender', 'phone', 'idCard', 'ethnic', 'currentAddress', 'height', 'weight', 'expectedSalary'],
  2778. 6: ['skills', 'training']
  2779. }[this.currentStep];
  2780. if (currentStepFields) {
  2781. currentStepFields.forEach(field => {
  2782. if (newVal[field] !== undefined && this.shouldValidateField(field)) {
  2783. this.validateField(field, newVal[field]);
  2784. }
  2785. });
  2786. }
  2787. },
  2788. deep: true
  2789. }
  2790. },
  2791. }
  2792. </script>
  2793. <style>
  2794. .personal-container {
  2795. padding: 20rpx;
  2796. }
  2797. .form-title {
  2798. font-size: 36rpx;
  2799. font-weight: bold;
  2800. text-align: center;
  2801. margin-bottom: 30rpx;
  2802. }
  2803. .form-container {
  2804. background-color: #fff;
  2805. border-radius: 10rpx;
  2806. padding: 20rpx;
  2807. }
  2808. .section-title {
  2809. font-size: 32rpx;
  2810. font-weight: bold;
  2811. margin: 30rpx 0 20rpx 10rpx;
  2812. color: #333;
  2813. border-left: 4rpx solid #0039b3;
  2814. padding-left: 15rpx;
  2815. }
  2816. .form-row {
  2817. display: flex;
  2818. flex-direction: row;
  2819. margin-bottom: 20rpx;
  2820. flex-wrap: wrap;
  2821. }
  2822. .form-item {
  2823. flex: 1;
  2824. min-width: 300rpx;
  2825. margin: 10rpx;
  2826. border-bottom: 1px solid #eee;
  2827. padding-bottom: 10rpx;
  2828. }
  2829. .label {
  2830. font-size: 28rpx;
  2831. color: #333;
  2832. margin-right: 10rpx;
  2833. display: block;
  2834. margin-bottom: 10rpx;
  2835. position: relative;
  2836. padding-left: 14rpx; /* 为星号预留空间 */
  2837. }
  2838. input {
  2839. font-size: 28rpx;
  2840. height: 60rpx;
  2841. }
  2842. .picker-text {
  2843. font-size: 28rpx;
  2844. height: 60rpx;
  2845. line-height: 60rpx;
  2846. color: #666;
  2847. }
  2848. .submit-btn {
  2849. margin-top: 40rpx;
  2850. background-color: #0039b3;
  2851. color: #fff;
  2852. }
  2853. .family-members-list {
  2854. margin-top: 20rpx;
  2855. }
  2856. .family-member-item {
  2857. background-color: #f8f8f8;
  2858. border-radius: 8rpx;
  2859. padding: 20rpx;
  2860. margin-bottom: 20rpx;
  2861. }
  2862. .family-member-header {
  2863. display: flex;
  2864. justify-content: space-between;
  2865. align-items: center;
  2866. margin-bottom: 15rpx;
  2867. border-bottom: 1px solid #eee;
  2868. padding-bottom: 10rpx;
  2869. }
  2870. .family-member-title {
  2871. font-size: 30rpx;
  2872. font-weight: bold;
  2873. color: #333;
  2874. }
  2875. .family-member-actions {
  2876. display: flex;
  2877. gap: 20rpx;
  2878. }
  2879. .family-member-edit {
  2880. font-size: 26rpx;
  2881. color: #1890ff;
  2882. }
  2883. .family-member-delete {
  2884. font-size: 26rpx;
  2885. color: #ff4d4f;
  2886. }
  2887. .form-subtitle {
  2888. font-size: 28rpx;
  2889. font-weight: bold;
  2890. margin-bottom: 20rpx;
  2891. display: flex;
  2892. justify-content: space-between;
  2893. align-items: center;
  2894. }
  2895. .cancel-edit {
  2896. font-size: 26rpx;
  2897. color: #999;
  2898. font-weight: normal;
  2899. }
  2900. .family-member-content {
  2901. padding: 10rpx 0;
  2902. }
  2903. .family-member-row {
  2904. display: flex;
  2905. margin-bottom: 10rpx;
  2906. }
  2907. .family-member-label {
  2908. font-size: 26rpx;
  2909. color: #666;
  2910. width: 200rpx;
  2911. }
  2912. .family-member-value {
  2913. font-size: 26rpx;
  2914. color: #333;
  2915. flex: 1;
  2916. }
  2917. .family-member-form {
  2918. background-color: #fff;
  2919. border-radius: 8rpx;
  2920. padding: 20rpx;
  2921. margin-top: 20rpx;
  2922. }
  2923. .form-row button-row {
  2924. display: flex;
  2925. justify-content: center;
  2926. margin-top: 20rpx;
  2927. }
  2928. .form-item button-container {
  2929. display: flex;
  2930. flex-direction: column;
  2931. align-items: center;
  2932. }
  2933. .circle-btn {
  2934. width: 40rpx;
  2935. height: 40rpx;
  2936. border-radius: 50%;
  2937. background-color: #0039b3;
  2938. display: flex;
  2939. justify-content: center;
  2940. align-items: center;
  2941. margin-bottom: 10rpx;
  2942. }
  2943. .btn-icon {
  2944. font-size: 32rpx;
  2945. color: #fff;
  2946. }
  2947. .btn-text {
  2948. font-size: 28rpx;
  2949. color: #333;
  2950. }
  2951. /* 添加圆形按钮相关样式 */
  2952. .button-row {
  2953. justify-content: center;
  2954. margin-top: 30rpx;
  2955. }
  2956. .button-container {
  2957. display: flex;
  2958. flex-direction: column;
  2959. align-items: center;
  2960. border-bottom: none;
  2961. min-width: auto;
  2962. }
  2963. .circle-btn {
  2964. width: 100rpx;
  2965. height: 100rpx;
  2966. border-radius: 50%;
  2967. padding: 0;
  2968. display: flex;
  2969. align-items: center;
  2970. justify-content: center;
  2971. background-color: #0039b3;
  2972. box-shadow: 0 6rpx 16rpx rgba(0, 0, 0, 0.1);
  2973. margin: 0;
  2974. }
  2975. .btn-icon {
  2976. font-size: 50rpx;
  2977. color: #fff;
  2978. line-height: 1;
  2979. }
  2980. .btn-text {
  2981. font-size: 24rpx;
  2982. color: #666;
  2983. margin-top: 10rpx;
  2984. }
  2985. /* 编辑状态下的按钮颜色 */
  2986. .circle-btn.editing {
  2987. background-color: #1890ff;
  2988. }
  2989. /* 移除原来的添加按钮样式 */
  2990. .add-member-btn {
  2991. display: none;
  2992. }
  2993. /* 应聘来源样式 */
  2994. .source-container {
  2995. background-color: #fff;
  2996. border-radius: 10rpx;
  2997. padding: 20rpx;
  2998. margin-bottom: 30rpx;
  2999. }
  3000. .source-row {
  3001. display: flex;
  3002. margin-bottom: 20rpx;
  3003. align-items: flex-start;
  3004. }
  3005. .source-label {
  3006. width: 120rpx;
  3007. font-size: 28rpx;
  3008. color: #333;
  3009. padding-top: 6rpx;
  3010. }
  3011. .source-options {
  3012. flex: 1;
  3013. display: flex;
  3014. flex-wrap: wrap;
  3015. }
  3016. .source-option {
  3017. display: flex;
  3018. align-items: center;
  3019. margin-right: 30rpx;
  3020. margin-bottom: 15rpx;
  3021. }
  3022. .source-option text {
  3023. font-size: 28rpx;
  3024. margin-left: 8rpx;
  3025. }
  3026. .other-option {
  3027. flex-basis: 100%;
  3028. margin-top: 10rpx;
  3029. }
  3030. .other-option input {
  3031. border-bottom: 1px solid #eee;
  3032. width: 300rpx;
  3033. margin-left: 10rpx;
  3034. font-size: 28rpx;
  3035. }
  3036. /* 教育经历样式 */
  3037. .education-list {
  3038. margin-top: 20rpx;
  3039. }
  3040. .education-item {
  3041. background-color: #f8f8f8;
  3042. border-radius: 8rpx;
  3043. padding: 20rpx;
  3044. margin-bottom: 20rpx;
  3045. }
  3046. .education-header {
  3047. display: flex;
  3048. justify-content: space-between;
  3049. align-items: center;
  3050. margin-bottom: 15rpx;
  3051. border-bottom: 1px solid #eee;
  3052. padding-bottom: 10rpx;
  3053. }
  3054. .education-title {
  3055. font-size: 30rpx;
  3056. font-weight: bold;
  3057. color: #333;
  3058. }
  3059. .education-actions {
  3060. display: flex;
  3061. gap: 20rpx;
  3062. }
  3063. .education-edit {
  3064. font-size: 26rpx;
  3065. color: #1890ff;
  3066. }
  3067. .education-delete {
  3068. font-size: 26rpx;
  3069. color: #ff4d4f;
  3070. }
  3071. .education-content {
  3072. padding: 10rpx 0;
  3073. }
  3074. .education-row {
  3075. display: flex;
  3076. margin-bottom: 10rpx;
  3077. }
  3078. .education-label {
  3079. font-size: 26rpx;
  3080. color: #666;
  3081. width: 150rpx;
  3082. }
  3083. .education-value {
  3084. font-size: 26rpx;
  3085. color: #333;
  3086. flex: 1;
  3087. }
  3088. .education-form {
  3089. background-color: #fff;
  3090. border-radius: 8rpx;
  3091. padding: 20rpx;
  3092. margin-top: 20rpx;
  3093. }
  3094. .date-range {
  3095. display: flex;
  3096. align-items: center;
  3097. justify-content: space-around;
  3098. }
  3099. .date-separator {
  3100. margin: 0 10rpx;
  3101. color: #666;
  3102. }
  3103. /* 专业技能和培训样式 */
  3104. .skills-container, .training-container {
  3105. background-color: #fff;
  3106. border-radius: 10rpx;
  3107. padding: 20rpx;
  3108. margin-bottom: 20rpx;
  3109. }
  3110. .skills-textarea, .training-textarea {
  3111. width: 100%;
  3112. height: 200rpx;
  3113. font-size: 28rpx;
  3114. line-height: 1.5;
  3115. padding: 10rpx;
  3116. box-sizing: border-box;
  3117. border: 1px solid #eee;
  3118. border-radius: 6rpx;
  3119. }
  3120. /* 工作经历样式 */
  3121. .work-list {
  3122. margin-top: 20rpx;
  3123. }
  3124. .work-item {
  3125. background-color: #f8f8f8;
  3126. border-radius: 8rpx;
  3127. padding: 20rpx;
  3128. margin-bottom: 20rpx;
  3129. }
  3130. .work-header {
  3131. display: flex;
  3132. justify-content: space-between;
  3133. align-items: center;
  3134. margin-bottom: 15rpx;
  3135. border-bottom: 1px solid #eee;
  3136. padding-bottom: 10rpx;
  3137. }
  3138. .work-title {
  3139. font-size: 30rpx;
  3140. font-weight: bold;
  3141. color: #333;
  3142. }
  3143. .work-actions {
  3144. display: flex;
  3145. gap: 20rpx;
  3146. }
  3147. .work-edit {
  3148. font-size: 26rpx;
  3149. color: #1890ff;
  3150. }
  3151. .work-delete {
  3152. font-size: 26rpx;
  3153. color: #ff4d4f;
  3154. }
  3155. .work-content {
  3156. padding: 10rpx 0;
  3157. }
  3158. .work-row {
  3159. display: flex;
  3160. margin-bottom: 10rpx;
  3161. }
  3162. .work-label {
  3163. font-size: 26rpx;
  3164. color: #666;
  3165. width: 150rpx;
  3166. }
  3167. .work-value {
  3168. font-size: 26rpx;
  3169. color: #333;
  3170. flex: 1;
  3171. }
  3172. .work-form {
  3173. background-color: #fff;
  3174. border-radius: 8rpx;
  3175. padding: 20rpx;
  3176. margin-top: 20rpx;
  3177. }
  3178. /* 步骤指示器样式 */
  3179. .steps-indicator {
  3180. display: flex;
  3181. justify-content: space-between;
  3182. margin-bottom: 30rpx;
  3183. padding: 20rpx;
  3184. background-color: #fff;
  3185. border-radius: 10rpx;
  3186. overflow-x: auto;
  3187. }
  3188. .step-item {
  3189. display: flex;
  3190. flex-direction: column;
  3191. align-items: center;
  3192. position: relative;
  3193. min-width: 120rpx;
  3194. }
  3195. .step-item:not(:last-child)::after {
  3196. content: '';
  3197. position: absolute;
  3198. top: 20rpx;
  3199. right: -50%;
  3200. width: 100%;
  3201. height: 2rpx;
  3202. background-color: #ddd;
  3203. z-index: 1;
  3204. }
  3205. .step-item.active:not(:last-child)::after {
  3206. background-color: #0039b3;
  3207. }
  3208. .step-number {
  3209. width: 40rpx;
  3210. height: 40rpx;
  3211. border-radius: 50%;
  3212. background-color: #ddd;
  3213. color: #fff;
  3214. display: flex;
  3215. justify-content: center;
  3216. align-items: center;
  3217. font-size: 24rpx;
  3218. margin-bottom: 10rpx;
  3219. position: relative;
  3220. z-index: 2;
  3221. }
  3222. .step-item.active .step-number {
  3223. background-color: #0039b3;
  3224. }
  3225. .step-item.current .step-number {
  3226. background-color: #0039b3;
  3227. box-shadow: 0 0 0 4rpx rgba(0, 122, 255, 0.2);
  3228. }
  3229. .step-name {
  3230. font-size: 22rpx;
  3231. color: #999;
  3232. text-align: center;
  3233. }
  3234. .step-item.active .step-name {
  3235. color: #333;
  3236. }
  3237. .step-item.current .step-name {
  3238. color: #0039b3;
  3239. font-weight: bold;
  3240. }
  3241. /* 导航按钮样式 */
  3242. .nav-buttons {
  3243. display: flex;
  3244. justify-content: space-between;
  3245. margin-top: 40rpx;
  3246. padding: 0 20rpx;
  3247. }
  3248. .nav-btn {
  3249. flex: 1;
  3250. margin: 0 10rpx;
  3251. height: 80rpx;
  3252. line-height: 80rpx;
  3253. text-align: center;
  3254. border-radius: 40rpx;
  3255. font-size: 28rpx;
  3256. }
  3257. .prev-btn {
  3258. background-color: #f0f0f0;
  3259. color: #666;
  3260. }
  3261. .next-btn {
  3262. background-color: #0039b3;
  3263. color: #fff;
  3264. }
  3265. .submit-btn {
  3266. flex: 1;
  3267. margin: 0 10rpx;
  3268. height: 80rpx;
  3269. line-height: 80rpx;
  3270. text-align: center;
  3271. border-radius: 40rpx;
  3272. font-size: 28rpx;
  3273. background-color: #0039b3;
  3274. color: #fff;
  3275. }
  3276. /* 确认提交页样式 */
  3277. .confirm-container {
  3278. background-color: #fff;
  3279. border-radius: 10rpx;
  3280. padding: 20rpx;
  3281. margin-bottom: 30rpx;
  3282. }
  3283. .confirm-message {
  3284. padding: 20rpx;
  3285. background-color: #f6f6f6;
  3286. border-radius: 8rpx;
  3287. margin-bottom: 20rpx;
  3288. }
  3289. .info-summary {
  3290. padding: 20rpx;
  3291. }
  3292. .summary-item {
  3293. display: flex;
  3294. margin-bottom: 15rpx;
  3295. }
  3296. .summary-label {
  3297. width: 150rpx;
  3298. font-size: 28rpx;
  3299. color: #666;
  3300. }
  3301. .summary-value {
  3302. flex: 1;
  3303. font-size: 28rpx;
  3304. color: #333;
  3305. }
  3306. .input-error {
  3307. border-bottom: 1px solid #ff4d4f !important;
  3308. }
  3309. .error-message {
  3310. color: #ff4d4f;
  3311. font-size: 24rpx;
  3312. margin-top: 6rpx;
  3313. display: block;
  3314. }
  3315. /* 添加承诺书弹框样式 */
  3316. .promise-modal {
  3317. position: fixed;
  3318. top: 0;
  3319. left: 0;
  3320. right: 0;
  3321. bottom: 0;
  3322. background-color: rgba(0, 0, 0, 0.5);
  3323. z-index: 999;
  3324. display: flex;
  3325. justify-content: center;
  3326. align-items: center;
  3327. }
  3328. .promise-content {
  3329. width: 80%;
  3330. max-width: 600rpx;
  3331. background-color: #fff;
  3332. border-radius: 12rpx;
  3333. padding: 30rpx;
  3334. box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.1);
  3335. }
  3336. .promise-title {
  3337. font-size: 34rpx;
  3338. font-weight: bold;
  3339. text-align: center;
  3340. margin-bottom: 20rpx;
  3341. color: #333;
  3342. }
  3343. .promise-text {
  3344. height: 600rpx;
  3345. margin-bottom: 20rpx;
  3346. /* padding: 20rpx; */
  3347. background-color: #f8f8f8;
  3348. border-radius: 8rpx;
  3349. font-size: 28rpx;
  3350. line-height: 1.6;
  3351. color: #333;
  3352. }
  3353. .promise-checkbox {
  3354. display: flex;
  3355. align-items: center;
  3356. margin-bottom: 30rpx;
  3357. padding: 0 10rpx;
  3358. }
  3359. .promise-checkbox text {
  3360. font-size: 28rpx;
  3361. margin-left: 10rpx;
  3362. color: #333;
  3363. }
  3364. .promise-buttons {
  3365. display: flex;
  3366. justify-content: center;
  3367. }
  3368. .promise-btn {
  3369. width: 200rpx;
  3370. height: 80rpx;
  3371. line-height: 80rpx;
  3372. text-align: center;
  3373. border-radius: 40rpx;
  3374. font-size: 28rpx;
  3375. }
  3376. .confirm-btn {
  3377. background-color: #0039b3;
  3378. color: #fff;
  3379. }
  3380. .confirm-btn[disabled] {
  3381. background-color: #cccccc;
  3382. color: #ffffff;
  3383. }
  3384. /* Loading indicator styles */
  3385. .loading-container {
  3386. position: fixed;
  3387. top: 0;
  3388. left: 0;
  3389. right: 0;
  3390. bottom: 0;
  3391. background-color: rgba(255, 255, 255, 0.8);
  3392. display: flex;
  3393. flex-direction: column;
  3394. justify-content: center;
  3395. align-items: center;
  3396. z-index: 1000;
  3397. }
  3398. .loading-spinner {
  3399. width: 60rpx;
  3400. height: 60rpx;
  3401. border: 6rpx solid #f3f3f3;
  3402. border-top: 6rpx solid #0039b3;
  3403. border-radius: 50%;
  3404. animation: spin 1s linear infinite;
  3405. margin-bottom: 20rpx;
  3406. }
  3407. .loading-text {
  3408. font-size: 28rpx;
  3409. color: #666;
  3410. }
  3411. @keyframes spin {
  3412. 0% { transform: rotate(0deg); }
  3413. 100% { transform: rotate(360deg); }
  3414. }
  3415. /* 添加开关样式 */
  3416. .form-item switch {
  3417. margin-top: 10rpx;
  3418. }
  3419. /* 修改必填项标签的样式 */
  3420. .label.required::before {
  3421. content: '*';
  3422. color: #ff4d4f;
  3423. margin-right: 4rpx;
  3424. position: absolute;
  3425. left: 0;
  3426. top: -4rpx;
  3427. }
  3428. /* 修改必填项标签的样式 */
  3429. /* .label.required::after {
  3430. content: '*';
  3431. color: #ff4d4f;
  3432. margin-left: 4rpx;
  3433. } */
  3434. </style>