Personal.vue 107 KB

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