Personal.vue 72 KB

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