Personal.vue 100 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513
  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. const allRequired = [
  1657. 'name', 'gender', 'phone', 'idCard', 'ethnic', 'currentAddress'
  1658. ];
  1659. let isValid = true;
  1660. allRequired.forEach(field => {
  1661. // 只验证显示的字段
  1662. if (this.shouldValidateField(field) && !this.validateField(field, this.formData[field])) {
  1663. isValid = false;
  1664. }
  1665. });
  1666. // 验证专业技能和培训
  1667. if (this.shouldValidateField('skills') && !this.formData.skills?.trim()) {
  1668. this.formErrors.skills = '请描述您的专业技能';
  1669. isValid = false;
  1670. }
  1671. if (this.shouldValidateField('training') && !this.formData.training?.trim()) {
  1672. this.formErrors.training = '请描述您的培训经历';
  1673. isValid = false;
  1674. }
  1675. if (!isValid) {
  1676. uni.showToast({
  1677. title: '请完善所有必填信息',
  1678. icon: 'none'
  1679. });
  1680. return;
  1681. }
  1682. // 检查必要的用户信息
  1683. const userInfo = uni.getStorageSync('userInfo');
  1684. if (!userInfo) {
  1685. uni.showToast({
  1686. title: '用户信息获取失败,请重新登录',
  1687. icon: 'none',
  1688. duration: 2000
  1689. });
  1690. return;
  1691. }
  1692. try {
  1693. const userData = JSON.parse(userInfo);
  1694. const submitData = {
  1695. tenant_id: 1,
  1696. user_id: userData.id,
  1697. personal_info: {
  1698. name: this.formData.name,
  1699. gender: this.formData.gender,
  1700. phone: this.formData.phone,
  1701. id_card: this.formData.idCard,
  1702. address: this.formData.currentAddress,
  1703. professional_skills: this.formData.skills ? this.formData.skills.split(',') : []
  1704. },
  1705. profile: {
  1706. female_status: this.getFemaleStatus(),
  1707. marital_status: this.getMaritalStatus(),
  1708. height: parseFloat(this.formData.height) || 0,
  1709. weight: parseFloat(this.formData.weight) || 0,
  1710. ethnicity: this.formData.ethnic,
  1711. current_address: this.formData.currentAddress,
  1712. expected_salary: parseFloat(this.formData.expectedSalary) || 0
  1713. },
  1714. educations: this.formatEducations(),
  1715. family_members: this.formatFamilyMembers(),
  1716. work_experiences: this.formatWorkExperiences()
  1717. };
  1718. // 数据检查
  1719. if (!submitData.personal_info.name || !submitData.personal_info.gender || !submitData.personal_info.phone) {
  1720. uni.showToast({
  1721. title: '基本信息不完整',
  1722. icon: 'none',
  1723. duration: 2000
  1724. });
  1725. return;
  1726. }
  1727. this.sendFormData(submitData);
  1728. } catch (error) {
  1729. console.error('数据处理错误:', error);
  1730. uni.showToast({
  1731. title: '数据处理错误,请重试',
  1732. icon: 'none',
  1733. duration: 2000
  1734. });
  1735. }
  1736. },
  1737. // 辅助方法:发送表单数据
  1738. sendFormData(submitData) {
  1739. uni.showLoading({ title: '提交中...' });
  1740. // 添加请求头和token
  1741. const token = uni.getStorageSync('token');
  1742. uni.request({
  1743. url: `${apiBaseUrl}/wechat/user/profile/update`,
  1744. method: 'POST',
  1745. data: submitData,
  1746. header: {
  1747. 'content-type': 'application/json',
  1748. 'Authorization': token ? `Bearer ${token}` : ''
  1749. },
  1750. success: (res) => {
  1751. uni.hideLoading();
  1752. if (res.statusCode === 200) {
  1753. if (res.data.code === 2000) {
  1754. uni.showToast({
  1755. title: '提交成功',
  1756. icon: 'success',
  1757. duration: 2000
  1758. });
  1759. setTimeout(() => {
  1760. uni.navigateTo({
  1761. url: '/pages/interview-notice/interview-notice'
  1762. });
  1763. }, 2000);
  1764. } else {
  1765. uni.showToast({
  1766. title: res.data.msg || '提交失败',
  1767. icon: 'none',
  1768. duration: 2000
  1769. });
  1770. }
  1771. } else {
  1772. uni.showToast({
  1773. title: '服务器响应错误',
  1774. icon: 'none',
  1775. duration: 2000
  1776. });
  1777. }
  1778. },
  1779. fail: (err) => {
  1780. console.error('提交失败:', err);
  1781. uni.hideLoading();
  1782. // 检查具体错误类型
  1783. if (err.errMsg.includes('timeout')) {
  1784. uni.showToast({
  1785. title: '请求超时,请检查网络后重试',
  1786. icon: 'none',
  1787. duration: 2000
  1788. });
  1789. } else if (err.errMsg.includes('fail')) {
  1790. uni.showToast({
  1791. title: '网络连接失败,请检查网络设置',
  1792. icon: 'none',
  1793. duration: 2000
  1794. });
  1795. } else {
  1796. uni.showToast({
  1797. title: '提交失败,请稍后重试',
  1798. icon: 'none',
  1799. duration: 2000
  1800. });
  1801. }
  1802. },
  1803. complete: () => {
  1804. // 可以在这里添加完成后的处理逻辑
  1805. }
  1806. });
  1807. },
  1808. // 数据格式化方法
  1809. getFemaleStatus() {
  1810. if (this.formData.gender !== '女') return 0;
  1811. const statusMap = { '孕期': 1, '产期': 2, '哺乳期': 3 };
  1812. return statusMap[this.formData.threePeriod] || 0;
  1813. },
  1814. getMaritalStatus() {
  1815. const statusMap = { '未婚': 0, '已婚': 1, '离异': 2, '丧偶': 3 };
  1816. return statusMap[this.formData.marriage] || 0;
  1817. },
  1818. formatEducations() {
  1819. return this.educationList.map((edu, index) => ({
  1820. education_type: index === 0 ? 1 : 2,
  1821. degree: this.mapDegreeToNumber(edu.degree),
  1822. start_date: edu.startTime,
  1823. end_date: edu.endTime,
  1824. school_name: edu.schoolName,
  1825. major: edu.major
  1826. }));
  1827. },
  1828. formatFamilyMembers() {
  1829. return this.familyMembers.map(member => ({
  1830. relation: member.relation,
  1831. name: member.name,
  1832. workplace: member.workplaceOrAddress,
  1833. position: member.position,
  1834. phone: member.phone,
  1835. //is_emergency_contact: member.isEmergencyContact||false // 添加紧急联系人标识
  1836. }));
  1837. },
  1838. formatWorkExperiences() {
  1839. return this.workList.map(work => ({
  1840. start_date: work.startTime,
  1841. end_date: work.endTime,
  1842. company_name: work.companyName,
  1843. department: work.department,
  1844. company_size: work.employeeCount,
  1845. position: work.position,
  1846. monthly_salary: work.monthlySalary,
  1847. supervisor_name: work.supervisor,
  1848. supervisor_phone: work.supervisorPhone
  1849. }));
  1850. },
  1851. // 学历映射辅助方法
  1852. mapDegreeToNumber(degreeText) {
  1853. const degreeMap = {
  1854. '高中': 1,
  1855. '中专': 1,
  1856. '大专': 2,
  1857. '本科': 3,
  1858. '硕士': 4,
  1859. '博士': 5
  1860. };
  1861. return degreeMap[degreeText] || 6; // 默认为其他
  1862. },
  1863. prevStep() {
  1864. const prevIndex = this.currentStepIndex - 1;
  1865. if (prevIndex >= 0) {
  1866. let targetIndex = prevIndex;
  1867. // 检查上一步是否需要跳过
  1868. while (targetIndex >= 0) {
  1869. const stepId = this.steps[targetIndex].id;
  1870. // 如果是专业技能步骤且不需要显示,则跳过
  1871. if (stepId === 6 && !this.shouldShowSkillsStep) {
  1872. targetIndex--;
  1873. continue;
  1874. }
  1875. // 如果是教育经历步骤且不需要显示,则跳过
  1876. if (stepId === 5 && !this.shouldShowEducationStep) {
  1877. targetIndex--;
  1878. continue;
  1879. }
  1880. // 如果是家庭成员步骤且不需要显示,则跳过
  1881. if (stepId === 3 && !this.shouldShowFamilyStep) {
  1882. targetIndex--;
  1883. continue;
  1884. }
  1885. // 如果是工作经历步骤且不需要显示,则跳过
  1886. if (stepId === 8 && !this.shouldShowWorkStep) {
  1887. targetIndex--;
  1888. continue;
  1889. }
  1890. // 找到有效步骤,跳出循环
  1891. break;
  1892. }
  1893. // 如果找到有效步骤,跳转到该步骤
  1894. if (targetIndex >= 0) {
  1895. this.currentStep = this.steps[targetIndex].id;
  1896. }
  1897. // 滚动到页面顶部
  1898. uni.pageScrollTo({
  1899. scrollTop: 0,
  1900. duration: 300
  1901. });
  1902. }
  1903. },
  1904. nextStep() {
  1905. // 验证当前步骤
  1906. if (!this.validateCurrentStep()) {
  1907. return;
  1908. }
  1909. // 如果是第一步,需要进行身份验证
  1910. if (this.currentStep === 1) {
  1911. this.verifyIdentity();
  1912. return;
  1913. }
  1914. const nextIndex = this.currentStepIndex + 1;
  1915. if (nextIndex < this.steps.length) {
  1916. let targetIndex = nextIndex;
  1917. // 检查下一步是否需要跳过
  1918. while (targetIndex < this.steps.length) {
  1919. const stepId = this.steps[targetIndex].id;
  1920. console.log(this.steps[targetIndex].id)
  1921. // 如果是家庭成员步骤且不需要显示,则跳过
  1922. if (stepId === 3 && !this.shouldShowFamilyStep) {
  1923. targetIndex++;
  1924. continue;
  1925. }
  1926. // 如果是教育经历步骤且不需要显示,则跳过
  1927. if (stepId === 5 && !this.shouldShowEducationStep) {
  1928. targetIndex++;
  1929. continue;
  1930. }
  1931. // 如果是专业技能步骤且不需要显示,则跳过
  1932. if (stepId === 6 && !this.shouldShowSkillsStep) {
  1933. targetIndex++;
  1934. continue;
  1935. }
  1936. // 如果是工作经历步骤且不需要显示,则跳过
  1937. if (stepId === 8 && !this.shouldShowWorkStep) {
  1938. targetIndex++;
  1939. continue;
  1940. }
  1941. // 找到有效步骤,跳出循环
  1942. break;
  1943. }
  1944. // 如果找到有效步骤,跳转到该步骤
  1945. if (targetIndex < this.steps.length) {
  1946. this.currentStep = this.steps[targetIndex].id;
  1947. } else {
  1948. // 如果没有找到下一个有效步骤,说明当前步骤是最后一个需要显示的步骤
  1949. // 此时应该显示提交按钮,不需要跳转
  1950. console.log('当前步骤是最后一个需要显示的步骤,显示提交按钮');
  1951. }
  1952. // 滚动到页面顶部
  1953. uni.pageScrollTo({
  1954. scrollTop: 0,
  1955. duration: 300
  1956. });
  1957. }
  1958. },
  1959. // 身份验证方法
  1960. verifyIdentity() {
  1961. // 清空错误信息
  1962. this.formErrors = {
  1963. name: '',
  1964. idCard: '',
  1965. phone: ''
  1966. };
  1967. uni.showLoading({
  1968. title: '身份验证中...'
  1969. });
  1970. uni.request({
  1971. url: `${apiBaseUrl}/wechat/identity/verify`,
  1972. method: 'POST',
  1973. data: {
  1974. name: this.formData.name,
  1975. id_number: this.formData.idCard,
  1976. mobile: this.formData.phone
  1977. },
  1978. header: {
  1979. 'content-type': 'application/x-www-form-urlencoded'
  1980. },
  1981. success: (res) => {
  1982. uni.hideLoading();
  1983. console.log(res);
  1984. if (res.data.code === 200) {
  1985. // 验证通过,进入下一步
  1986. let targetIndex = this.currentStepIndex + 1;
  1987. // 跳过不需要显示的步骤(与 nextStep 保持一致)
  1988. while (targetIndex < this.steps.length) {
  1989. const stepId = this.steps[targetIndex].id;
  1990. if (stepId === 3 && !this.shouldShowFamilyStep) { targetIndex++; continue; }
  1991. if (stepId === 5 && !this.shouldShowEducationStep) { targetIndex++; continue; }
  1992. if (stepId === 6 && !this.shouldShowSkillsStep) { targetIndex++; continue; }
  1993. if (stepId === 8 && !this.shouldShowWorkStep) { targetIndex++; continue; }
  1994. break;
  1995. }
  1996. if (targetIndex < this.steps.length) {
  1997. this.currentStep = this.steps[targetIndex].id;
  1998. uni.pageScrollTo({ scrollTop: 0, duration: 300 });
  1999. } else {
  2000. // 如果没有找到下一个有效步骤,说明当前步骤是最后一个需要显示的步骤
  2001. // 此时应该显示提交按钮,不需要跳转
  2002. console.log('身份验证通过后,当前步骤是最后一个需要显示的步骤,显示提交按钮');
  2003. }
  2004. /* 保存姓名 */
  2005. this.setUserInfo(this.formData);
  2006. } else {
  2007. // 验证失败,显示错误信息
  2008. this.handleVerificationError(res.data);
  2009. }
  2010. },
  2011. fail: (err) => {
  2012. this.handleRequestError(err);
  2013. }
  2014. });
  2015. },
  2016. setUserInfo(data) {
  2017. uni.request({
  2018. url: `${apiBaseUrl}/wechat/updateUserInfo`,
  2019. method: 'POST',
  2020. data: {
  2021. openid: JSON.parse(uni.getStorageSync('userInfo')).openid,
  2022. name: data.name,
  2023. id_card: data.idCard,
  2024. purePhoneNumber: data.phone,
  2025. tenant_id: 1,
  2026. examine:0
  2027. },
  2028. header: {
  2029. 'content-type': 'application/x-www-form-urlencoded'
  2030. },
  2031. success: (res) => {
  2032. console.log(res);
  2033. }
  2034. });
  2035. },
  2036. // 处理验证错误
  2037. handleVerificationError(data) {
  2038. this.formErrors.name = '姓名验证失败,请检查姓名是否正确';
  2039. this.formErrors.idCard = '身份证号验证失败,请检查身份证号是否正确';
  2040. this.formErrors.phone = '手机号验证失败,请检查手机号是否正确';
  2041. uni.showToast({
  2042. title: data.msg || '身份验证失败',
  2043. icon: 'none'
  2044. });
  2045. },
  2046. // 处理请求错误
  2047. handleRequestError(err) {
  2048. uni.hideLoading();
  2049. uni.showToast({
  2050. title: '网络错误,请检查网络连接',
  2051. icon: 'none',
  2052. duration: 2000
  2053. });
  2054. console.error('请求失败:', err);
  2055. },
  2056. // 验证当前步骤的必填项
  2057. validateCurrentStep() {
  2058. let isValid = true;
  2059. switch (this.currentStep) {
  2060. case 1: // 基本信息
  2061. const basicFields = ['name', 'gender', 'phone', 'idCard', 'ethnic', 'currentAddress'];
  2062. basicFields.forEach(field => {
  2063. // 只验证显示的字段
  2064. if (this.shouldValidateField(field) && !this.validateField(field, this.formData[field])) {
  2065. isValid = false;
  2066. }
  2067. });
  2068. // 特殊验证:女性三期状态
  2069. if (this.shouldValidateField('threePeriod') && this.formData.gender === '女' && this.threePeriodIndex === -1) {
  2070. this.formErrors.threePeriod = '请选择三期状态';
  2071. isValid = false;
  2072. }
  2073. // 可选字段验证(如果有值则验证格式)
  2074. if (this.shouldValidateField('height') && this.formData.height) {
  2075. isValid = this.validateField('height', this.formData.height) && isValid;
  2076. }
  2077. if (this.shouldValidateField('weight') && this.formData.weight) {
  2078. isValid = this.validateField('weight', this.formData.weight) && isValid;
  2079. }
  2080. if (this.shouldValidateField('expectedSalary') && this.formData.expectedSalary) {
  2081. isValid = this.validateField('expectedSalary', this.formData.expectedSalary) && isValid;
  2082. }
  2083. break;
  2084. case 3: // 家庭成员
  2085. console.log(this.familyMembers.length);
  2086. if (this.familyMembers.length == 0) {
  2087. uni.showToast({
  2088. title: '请至少添加一位家庭成员',
  2089. icon: 'none'
  2090. });
  2091. isValid = false;
  2092. }
  2093. break;
  2094. case 5: // 教育经历
  2095. if (this.educationList.length === 0) {
  2096. uni.showToast({
  2097. title: '请至少添加一项教育经历',
  2098. icon: 'none'
  2099. });
  2100. isValid = false;
  2101. }
  2102. break;
  2103. case 6: // 专业技能
  2104. if (this.shouldValidateField('skills') && !this.formData.skills?.trim()) {
  2105. this.formErrors.skills = '请描述您的专业技能';
  2106. isValid = false;
  2107. }
  2108. if (this.shouldValidateField('training') && !this.formData.training?.trim()) {
  2109. this.formErrors.training = '请描述您的培训经历';
  2110. isValid = false;
  2111. }
  2112. break;
  2113. case 8: // 工作经历
  2114. if (this.workList.length === 0) {
  2115. uni.showToast({
  2116. title: '请至少添加一项工作经历',
  2117. icon: 'none'
  2118. });
  2119. isValid = false;
  2120. }
  2121. break;
  2122. }
  2123. /* if (!isValid) {
  2124. uni.showToast({
  2125. title: '请完善所有必填信息',
  2126. icon: 'none'
  2127. });
  2128. } */
  2129. return isValid;
  2130. },
  2131. // Add method to fetch user data
  2132. fetchUserData() {
  2133. this.isLoading = true;
  2134. // Get openid from storage
  2135. const userInfo = uni.getStorageSync('userInfo') ? JSON.parse(uni.getStorageSync('userInfo')) : {};
  2136. const openid = userInfo.openid;
  2137. if (!openid) {
  2138. uni.showToast({
  2139. title: '用户信息获取失败,请重新登录',
  2140. icon: 'none'
  2141. });
  2142. this.isLoading = false;
  2143. return;
  2144. }
  2145. uni.request({
  2146. url: `${apiBaseUrl}/api/wechat/user/get_full_info?tenant_id=1&openid=${openid}`,
  2147. method: 'GET',
  2148. success: (res) => {
  2149. // 无论结果如何,都保持承诺书显示状态
  2150. this.showPromiseModal = true;
  2151. /* if (res.data.code === 2000) { */
  2152. // Successfully fetched data
  2153. this.populateFormData(res.data.data);
  2154. /* } else {
  2155. uni.showToast({
  2156. title: res.data.msg || '获取用户信息失败',
  2157. icon: 'none'
  2158. });
  2159. } */
  2160. },
  2161. fail: (err) => {
  2162. /* console.error('获取用户信息失败:', err);
  2163. uni.showToast({
  2164. title: '网络错误,请检查网络连接',
  2165. icon: 'none'
  2166. }); */
  2167. },
  2168. complete: () => {
  2169. this.isLoading = false;
  2170. // 数据加载完成后,检查当前步骤是否需要显示
  2171. this.$nextTick(() => {
  2172. this.ensureValidStep();
  2173. });
  2174. }
  2175. });
  2176. },
  2177. // Add method to populate form data with fetched data
  2178. populateFormData(data) {
  2179. const { user_info, profile, educations, work_experiences, family_members } = data;
  2180. // Populate basic user info
  2181. if (user_info) {
  2182. this.formData.name = user_info.name || '';
  2183. this.formData.gender = user_info.gender_text || '';
  2184. this.genderIndex = this.genderOptions.findIndex(item => item === this.formData.gender);
  2185. this.formData.idCard = user_info.id_card || '';
  2186. this.formData.phone = user_info.phone || '';
  2187. this.formData.email = user_info.email || '';
  2188. }
  2189. // Populate profile data
  2190. if (profile) {
  2191. // Set political status
  2192. this.formData.political = profile.political_status || '';
  2193. this.politicalIndex = this.politicalOptions.findIndex(item => item === this.formData.political);
  2194. // Set ethnic
  2195. this.formData.ethnic = profile.ethnicity || '';
  2196. this.ethnicIndex = this.ethnicOptions.findIndex(item => item === this.formData.ethnic);
  2197. // Set height and weight
  2198. this.formData.height = profile.height || '';
  2199. this.formData.weight = profile.weight || '';
  2200. // Set native place and residence
  2201. this.formData.nativePlace = profile.native_place || '';
  2202. this.formData.residence = profile.household_location || '';
  2203. // Set current address
  2204. this.formData.currentAddress = profile.current_address || '';
  2205. // Set marriage status
  2206. this.formData.marriage = profile.marital_status_text || '';
  2207. this.marriageIndex = this.marriageOptions.findIndex(item => item === this.formData.marriage);
  2208. // Set three period status for female
  2209. if (this.formData.gender === '女' && profile.female_status !== undefined) {
  2210. const femaleStatusMap = {0: '无', 1: '孕期', 2: '产期', 3: '哺乳期'};
  2211. this.formData.threePeriod = femaleStatusMap[profile.female_status] || '无';
  2212. this.threePeriodIndex = this.threePeriodOptions.findIndex(item => item === this.formData.threePeriod);
  2213. }
  2214. // Set expected salary
  2215. this.formData.expectedSalary = profile.expected_salary || '';
  2216. // Set emergency contact
  2217. this.formData.emergencyContact = profile.emergency_contact || '';
  2218. this.formData.emergencyPhone = profile.emergency_phone || '';
  2219. // Set hobby and motto
  2220. this.formData.hobby = profile.specialties || '';
  2221. this.formData.motto = profile.life_motto || '';
  2222. // Set recruitment source
  2223. const sourceTypeMap = {
  2224. 1: 'school',
  2225. 2: 'social',
  2226. 3: 'social',
  2227. 4: 'social',
  2228. 5: 'social'
  2229. };
  2230. const socialSourceMap = {
  2231. 2: 'BOSS',
  2232. 3: 'zhilian',
  2233. 4: 'liepin',
  2234. 5: 'other'
  2235. };
  2236. this.formData.sourceType = sourceTypeMap[profile.recruitment_source] || 'social';
  2237. if (this.formData.sourceType === 'social') {
  2238. this.formData.socialSource = socialSourceMap[profile.recruitment_source] || '';
  2239. if (this.formData.socialSource === 'other') {
  2240. this.formData.otherSocialSource = profile.recruitment_source_detail || '';
  2241. }
  2242. } else if (this.formData.sourceType === 'school') {
  2243. this.formData.otherSchoolSource = profile.recruitment_source_detail || '';
  2244. }
  2245. }
  2246. // Populate educations data
  2247. if (educations && educations.length > 0) {
  2248. this.educationList = educations.map(edu => {
  2249. const degreeMap = {
  2250. 1: '高中',
  2251. 2: '大专',
  2252. 3: '本科',
  2253. 4: '硕士',
  2254. 5: '博士'
  2255. };
  2256. return {
  2257. startTime: edu.start_date || '',
  2258. endTime: edu.end_date || '',
  2259. schoolName: edu.school_name || '',
  2260. major: edu.major || '',
  2261. degree: degreeMap[edu.degree] || ''
  2262. };
  2263. });
  2264. }
  2265. // Populate work experience data
  2266. if (work_experiences && work_experiences.length > 0) {
  2267. this.workList = work_experiences.map(work => {
  2268. return {
  2269. startTime: work.start_date || '',
  2270. endTime: work.end_date || '',
  2271. companyName: work.company_name || '',
  2272. department: work.department || '',
  2273. employeeCount: work.company_size || '',
  2274. position: work.position || '',
  2275. monthlySalary: work.monthly_salary || '',
  2276. supervisor: work.supervisor_name || '',
  2277. supervisorPhone: work.supervisor_phone || ''
  2278. };
  2279. });
  2280. }
  2281. // Populate family members data
  2282. if (family_members && family_members.length > 0) {
  2283. this.familyMembers = family_members.map(member => {
  2284. return {
  2285. relation: member.relation || '',
  2286. name: member.name || '',
  2287. workplaceOrAddress: member.workplace || '',
  2288. position: member.position || '',
  2289. phone: member.phone || '',
  2290. isEmergencyContact: member.isEmergencyContact || false
  2291. };
  2292. });
  2293. }
  2294. // 移除这段代码,确保承诺书始终显示
  2295. // if (user_info && user_info.is_profile_complete) {
  2296. // this.showPromiseModal = false;
  2297. // }
  2298. },
  2299. // 处理紧急联系人开关变化
  2300. handleEmergencyContactChange(e) {
  2301. this.familyMemberForm.isEmergencyContact = e.detail.value;
  2302. // 如果设置为紧急联系人,自动填充到紧急联系人字段
  2303. if (e.detail.value) {
  2304. this.formData.emergencyContact = this.familyMemberForm.name;
  2305. this.formData.emergencyPhone = this.familyMemberForm.phone;
  2306. }
  2307. },
  2308. // 添加重置教育经历错误信息的方法
  2309. resetEducationErrors() {
  2310. this.educationErrors = {
  2311. startTime: '',
  2312. endTime: '',
  2313. schoolName: '',
  2314. major: '',
  2315. degree: ''
  2316. };
  2317. },
  2318. // 添加通用验证方法
  2319. validateField(fieldName, value) {
  2320. const rule = this.validationRules[fieldName];
  2321. if (!rule) return true;
  2322. // 如果字段被隐藏,不进行验证
  2323. if (!this.shouldValidateField(fieldName)) {
  2324. return true;
  2325. }
  2326. // 重置该字段的错误信息
  2327. this.formErrors[fieldName] = '';
  2328. // 必填验证
  2329. if (rule.required && !value) {
  2330. this.formErrors[fieldName] = rule.message;
  2331. return false;
  2332. }
  2333. // 正则验证
  2334. if (rule.pattern && value && !rule.pattern.test(value)) {
  2335. this.formErrors[fieldName] = rule.message;
  2336. return false;
  2337. }
  2338. return true;
  2339. },
  2340. validateExpectedSalary(e) {
  2341. const value = e.detail.value;
  2342. console.log(value);
  2343. if (value === '') {
  2344. this.formData.expectedSalary = '';
  2345. this.formErrors.expectedSalary = '';
  2346. return;
  2347. }
  2348. let num = parseFloat(value);
  2349. if (isNaN(num)) {
  2350. this.formErrors.expectedSalary = '请输入有效的数字';
  2351. return;
  2352. }
  2353. if (num < 0) {
  2354. num = 0;
  2355. this.formErrors.expectedSalary = '薪资不能小于0';
  2356. } else if (num > 100000) {
  2357. num = 100000;
  2358. this.formErrors.expectedSalary = '薪资不能超过100000';
  2359. }
  2360. this.formData.expectedSalary = num.toString();
  2361. },
  2362. validateEmployeeCount(e) {
  2363. const value = e.detail.value;
  2364. if (value === '') {
  2365. this.workForm.employeeCount = '';
  2366. this.workErrors.employeeCount = '';
  2367. return;
  2368. }
  2369. let num = parseInt(value);
  2370. if (isNaN(num)) {
  2371. this.workErrors.employeeCount = '请输入有效的数字';
  2372. return;
  2373. }
  2374. if (num < 0) {
  2375. num = 0;
  2376. this.workErrors.employeeCount = '人数不能小于0';
  2377. } else if (num > 10000) {
  2378. num = 10000;
  2379. this.workErrors.employeeCount = '人数不能超过10000';
  2380. }
  2381. this.workForm.employeeCount = num.toString();
  2382. },
  2383. validateMonthlySalary(e) {
  2384. const value = e.detail.value;
  2385. if (value === '') {
  2386. this.workForm.monthlySalary = '';
  2387. this.workErrors.monthlySalary = '';
  2388. return;
  2389. }
  2390. let num = parseInt(value);
  2391. if (isNaN(num)) {
  2392. this.workErrors.monthlySalary = '请输入有效的数字';
  2393. return;
  2394. }
  2395. if (num < 0) {
  2396. num = 0;
  2397. this.workErrors.monthlySalary = '月总收入不能小于0';
  2398. } else if (num > 100000) {
  2399. num = 100000;
  2400. this.workErrors.monthlySalary = '月总收入不能超过100000';
  2401. } else {
  2402. this.workErrors.monthlySalary = '';
  2403. }
  2404. this.workForm.monthlySalary = num.toString();
  2405. },
  2406. // 添加手机号验证方法
  2407. validatePhone(e) {
  2408. const value = e.detail.value;
  2409. if (value.length > 11) {
  2410. this.formData.phone = value.slice(0, 11);
  2411. }
  2412. // 实时验证手机号格式
  2413. if (value && !/^1[3-9]\d{0,9}$/.test(value)) {
  2414. this.formErrors.phone = '请输入正确的手机号码';
  2415. } else {
  2416. this.formErrors.phone = '';
  2417. }
  2418. }
  2419. },
  2420. // 添加监听器来清除错误信息
  2421. watch: {
  2422. 'formData.name': function(newVal) {
  2423. if (newVal && this.formErrors.name) {
  2424. this.formErrors.name = '';
  2425. }
  2426. },
  2427. 'formData.idCard': function(newVal) {
  2428. if (newVal && this.formErrors.idCard) {
  2429. this.formErrors.idCard = '';
  2430. }
  2431. },
  2432. 'formData.phone': function(newVal) {
  2433. if (newVal && this.formErrors.phone) {
  2434. this.formErrors.phone = '';
  2435. }
  2436. },
  2437. 'formData.gender': function(newVal) {
  2438. if (newVal && this.formErrors.gender) {
  2439. this.formErrors.gender = '';
  2440. }
  2441. },
  2442. 'formData.ethnic': function(newVal) {
  2443. if (newVal && this.formErrors.ethnic) {
  2444. this.formErrors.ethnic = '';
  2445. }
  2446. },
  2447. 'formData.currentAddress': function(newVal) {
  2448. if (newVal && this.formErrors.currentAddress) {
  2449. this.formErrors.currentAddress = '';
  2450. }
  2451. },
  2452. 'formData.height': function(newVal) {
  2453. if (newVal && this.formErrors.height) {
  2454. this.formErrors.height = '';
  2455. }
  2456. },
  2457. 'formData.weight': function(newVal) {
  2458. if (newVal && this.formErrors.weight) {
  2459. this.formErrors.weight = '';
  2460. }
  2461. },
  2462. 'formData.expectedSalary': function(newVal) {
  2463. if (newVal && this.formErrors.expectedSalary) {
  2464. this.formErrors.expectedSalary = '';
  2465. }
  2466. },
  2467. 'familyMemberForm.relation': function(newVal) {
  2468. if (newVal) this.familyMemberErrors.relation = '';
  2469. },
  2470. 'familyMemberForm.name': function(newVal) {
  2471. if (newVal) this.familyMemberErrors.name = '';
  2472. },
  2473. 'familyMemberForm.phone': function(newVal) {
  2474. if (newVal) this.familyMemberErrors.phone = '';
  2475. },
  2476. /* 'familyMemberForm.workplaceOrAddress': function(newVal) {
  2477. if (newVal) this.familyMemberErrors.workplaceOrAddress = '';
  2478. },
  2479. 'familyMemberForm.position': function(newVal) {
  2480. if (newVal) this.familyMemberErrors.position = '';
  2481. }, */
  2482. 'workForm.companyName': function(newVal) {
  2483. if (newVal && this.workErrors.companyName) {
  2484. this.workErrors.companyName = '';
  2485. }
  2486. },
  2487. 'workForm.department': function(newVal) {
  2488. if (newVal && this.workErrors.department) {
  2489. this.workErrors.department = '';
  2490. }
  2491. },
  2492. 'workForm.position': function(newVal) {
  2493. if (newVal && this.workErrors.position) {
  2494. this.workErrors.position = '';
  2495. }
  2496. },
  2497. 'workForm.employeeCount': function(newVal) {
  2498. if (newVal && this.workErrors.employeeCount) {
  2499. this.workErrors.employeeCount = '';
  2500. }
  2501. },
  2502. 'workForm.monthlySalary': function(newVal) {
  2503. if (newVal && this.workErrors.monthlySalary) {
  2504. this.workErrors.monthlySalary = '';
  2505. }
  2506. },
  2507. 'workForm.supervisor': function(newVal) {
  2508. if (newVal && this.workErrors.supervisor) {
  2509. this.workErrors.supervisor = '';
  2510. }
  2511. },
  2512. // 'workForm.supervisorPhone': function(newVal) {
  2513. // if (newVal && this.workErrors.supervisorPhone) {
  2514. // this.workErrors.supervisorPhone = '';
  2515. // }
  2516. // },
  2517. 'formData.training': function(newVal) {
  2518. if (newVal && this.formErrors.training) {
  2519. this.formErrors.training = '';
  2520. }
  2521. },
  2522. 'educationForm.startTime': function(newVal) {
  2523. if (newVal) this.educationErrors.startTime = '';
  2524. },
  2525. 'educationForm.endTime': function(newVal) {
  2526. if (newVal) this.educationErrors.endTime = '';
  2527. },
  2528. 'educationForm.schoolName': function(newVal) {
  2529. if (newVal) this.educationErrors.schoolName = '';
  2530. },
  2531. 'educationForm.major': function(newVal) {
  2532. if (newVal) this.educationErrors.major = '';
  2533. },
  2534. 'educationForm.degree': function(newVal) {
  2535. if (newVal) this.educationErrors.degree = '';
  2536. },
  2537. // 添加对表单字段的实时验证
  2538. 'formData': {
  2539. handler(newVal) {
  2540. // 只验证当前步骤的字段
  2541. const currentStepFields = {
  2542. 1: ['name', 'gender', 'phone', 'idCard', 'ethnic', 'currentAddress', 'height', 'weight', 'expectedSalary'],
  2543. 6: ['skills', 'training']
  2544. }[this.currentStep];
  2545. if (currentStepFields) {
  2546. currentStepFields.forEach(field => {
  2547. if (newVal[field] !== undefined && this.shouldValidateField(field)) {
  2548. this.validateField(field, newVal[field]);
  2549. }
  2550. });
  2551. }
  2552. },
  2553. deep: true
  2554. }
  2555. },
  2556. }
  2557. </script>
  2558. <style>
  2559. .personal-container {
  2560. padding: 20rpx;
  2561. }
  2562. .form-title {
  2563. font-size: 36rpx;
  2564. font-weight: bold;
  2565. text-align: center;
  2566. margin-bottom: 30rpx;
  2567. }
  2568. .form-container {
  2569. background-color: #fff;
  2570. border-radius: 10rpx;
  2571. padding: 20rpx;
  2572. }
  2573. .section-title {
  2574. font-size: 32rpx;
  2575. font-weight: bold;
  2576. margin: 30rpx 0 20rpx 10rpx;
  2577. color: #333;
  2578. border-left: 4rpx solid #0039b3;
  2579. padding-left: 15rpx;
  2580. }
  2581. .form-row {
  2582. display: flex;
  2583. flex-direction: row;
  2584. margin-bottom: 20rpx;
  2585. flex-wrap: wrap;
  2586. }
  2587. .form-item {
  2588. flex: 1;
  2589. min-width: 300rpx;
  2590. margin: 10rpx;
  2591. border-bottom: 1px solid #eee;
  2592. padding-bottom: 10rpx;
  2593. }
  2594. .label {
  2595. font-size: 28rpx;
  2596. color: #333;
  2597. margin-right: 10rpx;
  2598. display: block;
  2599. margin-bottom: 10rpx;
  2600. position: relative;
  2601. padding-left: 14rpx; /* 为星号预留空间 */
  2602. }
  2603. input {
  2604. font-size: 28rpx;
  2605. height: 60rpx;
  2606. }
  2607. .picker-text {
  2608. font-size: 28rpx;
  2609. height: 60rpx;
  2610. line-height: 60rpx;
  2611. color: #666;
  2612. }
  2613. .submit-btn {
  2614. margin-top: 40rpx;
  2615. background-color: #0039b3;
  2616. color: #fff;
  2617. }
  2618. .family-members-list {
  2619. margin-top: 20rpx;
  2620. }
  2621. .family-member-item {
  2622. background-color: #f8f8f8;
  2623. border-radius: 8rpx;
  2624. padding: 20rpx;
  2625. margin-bottom: 20rpx;
  2626. }
  2627. .family-member-header {
  2628. display: flex;
  2629. justify-content: space-between;
  2630. align-items: center;
  2631. margin-bottom: 15rpx;
  2632. border-bottom: 1px solid #eee;
  2633. padding-bottom: 10rpx;
  2634. }
  2635. .family-member-title {
  2636. font-size: 30rpx;
  2637. font-weight: bold;
  2638. color: #333;
  2639. }
  2640. .family-member-actions {
  2641. display: flex;
  2642. gap: 20rpx;
  2643. }
  2644. .family-member-edit {
  2645. font-size: 26rpx;
  2646. color: #1890ff;
  2647. }
  2648. .family-member-delete {
  2649. font-size: 26rpx;
  2650. color: #ff4d4f;
  2651. }
  2652. .form-subtitle {
  2653. font-size: 28rpx;
  2654. font-weight: bold;
  2655. margin-bottom: 20rpx;
  2656. display: flex;
  2657. justify-content: space-between;
  2658. align-items: center;
  2659. }
  2660. .cancel-edit {
  2661. font-size: 26rpx;
  2662. color: #999;
  2663. font-weight: normal;
  2664. }
  2665. .family-member-content {
  2666. padding: 10rpx 0;
  2667. }
  2668. .family-member-row {
  2669. display: flex;
  2670. margin-bottom: 10rpx;
  2671. }
  2672. .family-member-label {
  2673. font-size: 26rpx;
  2674. color: #666;
  2675. width: 200rpx;
  2676. }
  2677. .family-member-value {
  2678. font-size: 26rpx;
  2679. color: #333;
  2680. flex: 1;
  2681. }
  2682. .family-member-form {
  2683. background-color: #fff;
  2684. border-radius: 8rpx;
  2685. padding: 20rpx;
  2686. margin-top: 20rpx;
  2687. }
  2688. .form-row button-row {
  2689. display: flex;
  2690. justify-content: center;
  2691. margin-top: 20rpx;
  2692. }
  2693. .form-item button-container {
  2694. display: flex;
  2695. flex-direction: column;
  2696. align-items: center;
  2697. }
  2698. .circle-btn {
  2699. width: 40rpx;
  2700. height: 40rpx;
  2701. border-radius: 50%;
  2702. background-color: #0039b3;
  2703. display: flex;
  2704. justify-content: center;
  2705. align-items: center;
  2706. margin-bottom: 10rpx;
  2707. }
  2708. .btn-icon {
  2709. font-size: 32rpx;
  2710. color: #fff;
  2711. }
  2712. .btn-text {
  2713. font-size: 28rpx;
  2714. color: #333;
  2715. }
  2716. /* 添加圆形按钮相关样式 */
  2717. .button-row {
  2718. justify-content: center;
  2719. margin-top: 30rpx;
  2720. }
  2721. .button-container {
  2722. display: flex;
  2723. flex-direction: column;
  2724. align-items: center;
  2725. border-bottom: none;
  2726. min-width: auto;
  2727. }
  2728. .circle-btn {
  2729. width: 100rpx;
  2730. height: 100rpx;
  2731. border-radius: 50%;
  2732. padding: 0;
  2733. display: flex;
  2734. align-items: center;
  2735. justify-content: center;
  2736. background-color: #0039b3;
  2737. box-shadow: 0 6rpx 16rpx rgba(0, 0, 0, 0.1);
  2738. margin: 0;
  2739. }
  2740. .btn-icon {
  2741. font-size: 50rpx;
  2742. color: #fff;
  2743. line-height: 1;
  2744. }
  2745. .btn-text {
  2746. font-size: 24rpx;
  2747. color: #666;
  2748. margin-top: 10rpx;
  2749. }
  2750. /* 编辑状态下的按钮颜色 */
  2751. .circle-btn.editing {
  2752. background-color: #1890ff;
  2753. }
  2754. /* 移除原来的添加按钮样式 */
  2755. .add-member-btn {
  2756. display: none;
  2757. }
  2758. /* 应聘来源样式 */
  2759. .source-container {
  2760. background-color: #fff;
  2761. border-radius: 10rpx;
  2762. padding: 20rpx;
  2763. margin-bottom: 30rpx;
  2764. }
  2765. .source-row {
  2766. display: flex;
  2767. margin-bottom: 20rpx;
  2768. align-items: flex-start;
  2769. }
  2770. .source-label {
  2771. width: 120rpx;
  2772. font-size: 28rpx;
  2773. color: #333;
  2774. padding-top: 6rpx;
  2775. }
  2776. .source-options {
  2777. flex: 1;
  2778. display: flex;
  2779. flex-wrap: wrap;
  2780. }
  2781. .source-option {
  2782. display: flex;
  2783. align-items: center;
  2784. margin-right: 30rpx;
  2785. margin-bottom: 15rpx;
  2786. }
  2787. .source-option text {
  2788. font-size: 28rpx;
  2789. margin-left: 8rpx;
  2790. }
  2791. .other-option {
  2792. flex-basis: 100%;
  2793. margin-top: 10rpx;
  2794. }
  2795. .other-option input {
  2796. border-bottom: 1px solid #eee;
  2797. width: 300rpx;
  2798. margin-left: 10rpx;
  2799. font-size: 28rpx;
  2800. }
  2801. /* 教育经历样式 */
  2802. .education-list {
  2803. margin-top: 20rpx;
  2804. }
  2805. .education-item {
  2806. background-color: #f8f8f8;
  2807. border-radius: 8rpx;
  2808. padding: 20rpx;
  2809. margin-bottom: 20rpx;
  2810. }
  2811. .education-header {
  2812. display: flex;
  2813. justify-content: space-between;
  2814. align-items: center;
  2815. margin-bottom: 15rpx;
  2816. border-bottom: 1px solid #eee;
  2817. padding-bottom: 10rpx;
  2818. }
  2819. .education-title {
  2820. font-size: 30rpx;
  2821. font-weight: bold;
  2822. color: #333;
  2823. }
  2824. .education-actions {
  2825. display: flex;
  2826. gap: 20rpx;
  2827. }
  2828. .education-edit {
  2829. font-size: 26rpx;
  2830. color: #1890ff;
  2831. }
  2832. .education-delete {
  2833. font-size: 26rpx;
  2834. color: #ff4d4f;
  2835. }
  2836. .education-content {
  2837. padding: 10rpx 0;
  2838. }
  2839. .education-row {
  2840. display: flex;
  2841. margin-bottom: 10rpx;
  2842. }
  2843. .education-label {
  2844. font-size: 26rpx;
  2845. color: #666;
  2846. width: 150rpx;
  2847. }
  2848. .education-value {
  2849. font-size: 26rpx;
  2850. color: #333;
  2851. flex: 1;
  2852. }
  2853. .education-form {
  2854. background-color: #fff;
  2855. border-radius: 8rpx;
  2856. padding: 20rpx;
  2857. margin-top: 20rpx;
  2858. }
  2859. .date-range {
  2860. display: flex;
  2861. align-items: center;
  2862. justify-content: space-around;
  2863. }
  2864. .date-separator {
  2865. margin: 0 10rpx;
  2866. color: #666;
  2867. }
  2868. /* 专业技能和培训样式 */
  2869. .skills-container, .training-container {
  2870. background-color: #fff;
  2871. border-radius: 10rpx;
  2872. padding: 20rpx;
  2873. margin-bottom: 20rpx;
  2874. }
  2875. .skills-textarea, .training-textarea {
  2876. width: 100%;
  2877. height: 200rpx;
  2878. font-size: 28rpx;
  2879. line-height: 1.5;
  2880. padding: 10rpx;
  2881. box-sizing: border-box;
  2882. border: 1px solid #eee;
  2883. border-radius: 6rpx;
  2884. }
  2885. /* 工作经历样式 */
  2886. .work-list {
  2887. margin-top: 20rpx;
  2888. }
  2889. .work-item {
  2890. background-color: #f8f8f8;
  2891. border-radius: 8rpx;
  2892. padding: 20rpx;
  2893. margin-bottom: 20rpx;
  2894. }
  2895. .work-header {
  2896. display: flex;
  2897. justify-content: space-between;
  2898. align-items: center;
  2899. margin-bottom: 15rpx;
  2900. border-bottom: 1px solid #eee;
  2901. padding-bottom: 10rpx;
  2902. }
  2903. .work-title {
  2904. font-size: 30rpx;
  2905. font-weight: bold;
  2906. color: #333;
  2907. }
  2908. .work-actions {
  2909. display: flex;
  2910. gap: 20rpx;
  2911. }
  2912. .work-edit {
  2913. font-size: 26rpx;
  2914. color: #1890ff;
  2915. }
  2916. .work-delete {
  2917. font-size: 26rpx;
  2918. color: #ff4d4f;
  2919. }
  2920. .work-content {
  2921. padding: 10rpx 0;
  2922. }
  2923. .work-row {
  2924. display: flex;
  2925. margin-bottom: 10rpx;
  2926. }
  2927. .work-label {
  2928. font-size: 26rpx;
  2929. color: #666;
  2930. width: 150rpx;
  2931. }
  2932. .work-value {
  2933. font-size: 26rpx;
  2934. color: #333;
  2935. flex: 1;
  2936. }
  2937. .work-form {
  2938. background-color: #fff;
  2939. border-radius: 8rpx;
  2940. padding: 20rpx;
  2941. margin-top: 20rpx;
  2942. }
  2943. /* 步骤指示器样式 */
  2944. .steps-indicator {
  2945. display: flex;
  2946. justify-content: space-between;
  2947. margin-bottom: 30rpx;
  2948. padding: 20rpx;
  2949. background-color: #fff;
  2950. border-radius: 10rpx;
  2951. overflow-x: auto;
  2952. }
  2953. .step-item {
  2954. display: flex;
  2955. flex-direction: column;
  2956. align-items: center;
  2957. position: relative;
  2958. min-width: 120rpx;
  2959. }
  2960. .step-item:not(:last-child)::after {
  2961. content: '';
  2962. position: absolute;
  2963. top: 20rpx;
  2964. right: -50%;
  2965. width: 100%;
  2966. height: 2rpx;
  2967. background-color: #ddd;
  2968. z-index: 1;
  2969. }
  2970. .step-item.active:not(:last-child)::after {
  2971. background-color: #0039b3;
  2972. }
  2973. .step-number {
  2974. width: 40rpx;
  2975. height: 40rpx;
  2976. border-radius: 50%;
  2977. background-color: #ddd;
  2978. color: #fff;
  2979. display: flex;
  2980. justify-content: center;
  2981. align-items: center;
  2982. font-size: 24rpx;
  2983. margin-bottom: 10rpx;
  2984. position: relative;
  2985. z-index: 2;
  2986. }
  2987. .step-item.active .step-number {
  2988. background-color: #0039b3;
  2989. }
  2990. .step-item.current .step-number {
  2991. background-color: #0039b3;
  2992. box-shadow: 0 0 0 4rpx rgba(0, 122, 255, 0.2);
  2993. }
  2994. .step-name {
  2995. font-size: 22rpx;
  2996. color: #999;
  2997. text-align: center;
  2998. }
  2999. .step-item.active .step-name {
  3000. color: #333;
  3001. }
  3002. .step-item.current .step-name {
  3003. color: #0039b3;
  3004. font-weight: bold;
  3005. }
  3006. /* 导航按钮样式 */
  3007. .nav-buttons {
  3008. display: flex;
  3009. justify-content: space-between;
  3010. margin-top: 40rpx;
  3011. padding: 0 20rpx;
  3012. }
  3013. .nav-btn {
  3014. flex: 1;
  3015. margin: 0 10rpx;
  3016. height: 80rpx;
  3017. line-height: 80rpx;
  3018. text-align: center;
  3019. border-radius: 40rpx;
  3020. font-size: 28rpx;
  3021. }
  3022. .prev-btn {
  3023. background-color: #f0f0f0;
  3024. color: #666;
  3025. }
  3026. .next-btn {
  3027. background-color: #0039b3;
  3028. color: #fff;
  3029. }
  3030. .submit-btn {
  3031. flex: 1;
  3032. margin: 0 10rpx;
  3033. height: 80rpx;
  3034. line-height: 80rpx;
  3035. text-align: center;
  3036. border-radius: 40rpx;
  3037. font-size: 28rpx;
  3038. background-color: #0039b3;
  3039. color: #fff;
  3040. }
  3041. /* 确认提交页样式 */
  3042. .confirm-container {
  3043. background-color: #fff;
  3044. border-radius: 10rpx;
  3045. padding: 20rpx;
  3046. margin-bottom: 30rpx;
  3047. }
  3048. .confirm-message {
  3049. padding: 20rpx;
  3050. background-color: #f6f6f6;
  3051. border-radius: 8rpx;
  3052. margin-bottom: 20rpx;
  3053. }
  3054. .info-summary {
  3055. padding: 20rpx;
  3056. }
  3057. .summary-item {
  3058. display: flex;
  3059. margin-bottom: 15rpx;
  3060. }
  3061. .summary-label {
  3062. width: 150rpx;
  3063. font-size: 28rpx;
  3064. color: #666;
  3065. }
  3066. .summary-value {
  3067. flex: 1;
  3068. font-size: 28rpx;
  3069. color: #333;
  3070. }
  3071. .input-error {
  3072. border-bottom: 1px solid #ff4d4f !important;
  3073. }
  3074. .error-message {
  3075. color: #ff4d4f;
  3076. font-size: 24rpx;
  3077. margin-top: 6rpx;
  3078. display: block;
  3079. }
  3080. /* 添加承诺书弹框样式 */
  3081. .promise-modal {
  3082. position: fixed;
  3083. top: 0;
  3084. left: 0;
  3085. right: 0;
  3086. bottom: 0;
  3087. background-color: rgba(0, 0, 0, 0.5);
  3088. z-index: 999;
  3089. display: flex;
  3090. justify-content: center;
  3091. align-items: center;
  3092. }
  3093. .promise-content {
  3094. width: 80%;
  3095. max-width: 600rpx;
  3096. background-color: #fff;
  3097. border-radius: 12rpx;
  3098. padding: 30rpx;
  3099. box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.1);
  3100. }
  3101. .promise-title {
  3102. font-size: 34rpx;
  3103. font-weight: bold;
  3104. text-align: center;
  3105. margin-bottom: 20rpx;
  3106. color: #333;
  3107. }
  3108. .promise-text {
  3109. height: 600rpx;
  3110. margin-bottom: 20rpx;
  3111. /* padding: 20rpx; */
  3112. background-color: #f8f8f8;
  3113. border-radius: 8rpx;
  3114. font-size: 28rpx;
  3115. line-height: 1.6;
  3116. color: #333;
  3117. }
  3118. .promise-checkbox {
  3119. display: flex;
  3120. align-items: center;
  3121. margin-bottom: 30rpx;
  3122. padding: 0 10rpx;
  3123. }
  3124. .promise-checkbox text {
  3125. font-size: 28rpx;
  3126. margin-left: 10rpx;
  3127. color: #333;
  3128. }
  3129. .promise-buttons {
  3130. display: flex;
  3131. justify-content: center;
  3132. }
  3133. .promise-btn {
  3134. width: 200rpx;
  3135. height: 80rpx;
  3136. line-height: 80rpx;
  3137. text-align: center;
  3138. border-radius: 40rpx;
  3139. font-size: 28rpx;
  3140. }
  3141. .confirm-btn {
  3142. background-color: #0039b3;
  3143. color: #fff;
  3144. }
  3145. .confirm-btn[disabled] {
  3146. background-color: #cccccc;
  3147. color: #ffffff;
  3148. }
  3149. /* Loading indicator styles */
  3150. .loading-container {
  3151. position: fixed;
  3152. top: 0;
  3153. left: 0;
  3154. right: 0;
  3155. bottom: 0;
  3156. background-color: rgba(255, 255, 255, 0.8);
  3157. display: flex;
  3158. flex-direction: column;
  3159. justify-content: center;
  3160. align-items: center;
  3161. z-index: 1000;
  3162. }
  3163. .loading-spinner {
  3164. width: 60rpx;
  3165. height: 60rpx;
  3166. border: 6rpx solid #f3f3f3;
  3167. border-top: 6rpx solid #0039b3;
  3168. border-radius: 50%;
  3169. animation: spin 1s linear infinite;
  3170. margin-bottom: 20rpx;
  3171. }
  3172. .loading-text {
  3173. font-size: 28rpx;
  3174. color: #666;
  3175. }
  3176. @keyframes spin {
  3177. 0% { transform: rotate(0deg); }
  3178. 100% { transform: rotate(360deg); }
  3179. }
  3180. /* 添加开关样式 */
  3181. .form-item switch {
  3182. margin-top: 10rpx;
  3183. }
  3184. /* 修改必填项标签的样式 */
  3185. .label.required::before {
  3186. content: '*';
  3187. color: #ff4d4f;
  3188. margin-right: 4rpx;
  3189. position: absolute;
  3190. left: 0;
  3191. top: -4rpx;
  3192. }
  3193. /* 修改必填项标签的样式 */
  3194. /* .label.required::after {
  3195. content: '*';
  3196. color: #ff4d4f;
  3197. margin-left: 4rpx;
  3198. } */
  3199. </style>