Personal.vue 73 KB

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