Personal.vue 73 KB

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