Personal.vue 93 KB

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