Personal.vue 92 KB

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