123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991 |
- <template>
- <view class="personal-container">
- <!-- Add loading indicator -->
- <view class="loading-container" v-if="isLoading">
- <view class="loading-spinner"></view>
- <text class="loading-text">加载中...</text>
- </view>
-
- <!-- 添加承诺书弹框 -->
- <view class="promise-modal" v-if="showPromiseModal">
- <view class="promise-content">
- <view class="promise-title">入职承诺书</view>
- <scroll-view scroll-y class="promise-text">
- <text>
- 本人郑重承诺:
- 所提交的入职登记表、学历证书、职业资格证明、工作履历等全部个人信息及证明材料均真实、准确、完整。若经公司核查发现存在虚构工作经历、伪造学历证书、隐瞒竞业限制义务、虚报健康状况等任何不实或欺诈情形,本人自愿承担以下责任:
-
- 1. 法律责任:因信息不实引发的劳动纠纷、民事赔偿、行政处罚或刑事追责,由本人独立承担全部法律后果,公司不承担任何连带责任;
-
- 2. 劳动关系处理:公司有权立即解除劳动合同,无需支付经济补偿,并保留向本人追偿因信息欺诈导致公司经济损失(包括但不限于招聘成本、培训费用、商誉损失等)的权利;
-
- 3. 其他后果:若已入职,公司可单方撤销录用决定,要求返还已发放的工资、福利等费用,并可将不实行为记入个人档案。
-
- 本人确认已充分理解上述条款内容,无任何歧义,并自愿受其约束。
- </text>
- </scroll-view>
- <view class="promise-checkbox">
- <checkbox :checked="promiseChecked" @click="togglePromiseChecked" />
- <text>我已阅读并同意以上承诺书内容</text>
- </view>
- <view class="promise-buttons">
- <button class="promise-btn confirm-btn" :disabled="!promiseChecked" @click="confirmPromise">确认</button>
- </view>
- </view>
- </view>
-
- <view class="form-title">个人信息表</view>
-
- <!-- 添加步骤指示器 -->
- <!-- <view class="steps-indicator">
- <view
- v-for="(step, index) in steps"
- :key="step.id"
- class="step-item"
- :class="{ 'active': currentStep >= step.id, 'current': currentStep === step.id }"
- >
- <view class="step-number">{{ step.id }}</view>
- <view class="step-name">{{ step.name }}</view>
- </view>
- </view> -->
-
- <!-- 根据currentStep渲染对应的表单内容 -->
- <view class="form-content">
- <!-- 第一步:基本信息 -->
- <view v-if="currentStep === 1" class="form-container">
- <!-- 第一行 -->
- <view class="form-row">
- <view class="form-item" v-if="showNameField">
- <text class="label required">姓名</text>
- <input type="text" v-model="formData.name" placeholder="请输入姓名" :class="{'input-error': formErrors.name}" />
- <text v-if="formErrors.name" class="error-message">{{formErrors.name}}</text>
- </view>
- <view class="form-item" v-if="showGenderField">
- <text class="label required">性别</text>
- <picker @change="bindGenderChange" :value="genderIndex" :range="genderOptions">
- <view class="picker-text" :class="{'input-error': formErrors.gender}">{{ genderOptions[genderIndex] || '请选择性别' }}</view>
- </picker>
- <text v-if="formErrors.gender" class="error-message">{{formErrors.gender}}</text>
- </view>
- <!-- 当性别为女时显示三期选择 -->
- <view class="form-item" v-if="formData.gender === '女'">
- <text class="label required">是否为三期</text>
- <picker @change="bindThreePeriodChange" :value="threePeriodIndex" :range="threePeriodOptions" :class="{'input-error': formErrors.threePeriod}">
- <view class="picker-text">{{ threePeriodOptions[threePeriodIndex] || '请选择' }}</view>
- </picker>
- <text v-if="formErrors.threePeriod" class="error-message">{{formErrors.threePeriod}}</text>
- </view>
- <view class="form-row">
- <view class="form-item" v-if="showPhoneField">
- <text class="label required">手机号</text>
- <input type="number" v-model="formData.phone" placeholder="请输入手机号" :class="{'input-error': formErrors.phone}" />
- <text v-if="formErrors.phone" class="error-message">{{formErrors.phone}}</text>
- </view>
- </view>
- <!-- <view class="form-item">
- <text class="label">出生日期</text>
- <picker mode="date" :value="formData.birthDate" @change="bindDateChange">
- <view class="picker-text">{{ formData.birthDate || '请选择日期' }}</view>
- </picker>
- </view> -->
- </view>
- <view class="form-item" v-if="showIdCardField">
- <text class="label required">身份证号</text>
- <input type="idcard" v-model="formData.idCard" placeholder="请输入身份证号" :class="{'input-error': formErrors.idCard}" />
- <text v-if="formErrors.idCard" class="error-message">{{formErrors.idCard}}</text>
- </view>
- <!-- <view class="form-item">
- <text class="label">政治面貌</text>
- <picker @change="bindPoliticalChange" :value="politicalIndex" :range="politicalOptions">
- <view class="picker-text">{{ politicalOptions[politicalIndex] || '请选择政治面貌' }}</view>
- </picker>
- </view> -->
- <view class="form-item" v-if="showEthnicField">
- <text class="label required">民族</text>
- <picker @change="bindEthnicChange" :value="ethnicIndex" :range="ethnicOptions">
- <view class="picker-text" :class="{'input-error': formErrors.ethnic}">{{ ethnicOptions[ethnicIndex] || '请选择民族' }}</view>
- </picker>
- <text v-if="formErrors.ethnic" class="error-message">{{formErrors.ethnic}}</text>
- </view>
-
- <!-- 第三行 -->
- <view class="form-row">
- <view class="form-item" v-if="showHeightField">
- <text class="label">身高(cm)</text>
- <input type="digit" v-model="formData.height" placeholder="请输入身高" />
- </view>
- <view class="form-item" v-if="showWeightField">
- <text class="label">体重(kg)</text>
- <input type="digit" v-model="formData.weight" placeholder="请输入体重" />
- </view>
- <view class="form-item">
- <text class="label required">现居住地址</text>
- <input type="text" v-model="formData.currentAddress" placeholder="请输入现居住地址" :class="{'input-error': formErrors.currentAddress}" />
- <text v-if="formErrors.currentAddress" class="error-message">{{formErrors.currentAddress}}</text>
- </view>
- <!-- <view class="form-item">
- <text class="label">籍贯</text>
- <input type="text" v-model="formData.nativePlace" placeholder="请输入籍贯" />
- </view> -->
- </view>
-
- <!-- 第四行 -->
- <view class="form-row">
- <view class="form-item">
- <text class="label">户口所在地</text>
- <input type="text" v-model="formData.residence" placeholder="请输入户口所在地" />
- </view>
- <view class="form-item">
- <text class="label">婚育状况</text>
- <picker @change="bindMarriageChange" :value="marriageIndex" :range="marriageOptions">
- <view class="picker-text">{{ marriageOptions[marriageIndex] || '请选择婚育状况' }}</view>
- </picker>
- </view>
- <view class="form-item">
- <text class="label">期望薪资(元/月)</text>
- <input type="digit" v-model="formData.expectedSalary" placeholder="请输入期望薪资" />
- </view>
- </view>
- </view>
-
- <!-- 第二步:家庭成员 -->
- <view v-if="currentStep === 3" class="form-container">
- <view class="section-title">家庭主要成员信息</view>
-
- <!-- 已添加的家庭成员列表 -->
- <view class="family-members-list" v-if="familyMembers.length > 0">
- <view class="family-member-item" v-for="(member, index) in familyMembers" :key="index">
- <view class="family-member-header">
- <text class="family-member-title">成员 {{index + 1}}</text>
- <view class="family-member-actions">
- <text class="family-member-edit" @click="editFamilyMember(index)">编辑</text>
- <text class="family-member-delete" @click="deleteFamilyMember(index)">删除</text>
- </view>
- </view>
- <view class="family-member-content">
- <view class="family-member-row" v-if="showFamilyRelationField">
- <text class="family-member-label">称谓:</text>
- <text class="family-member-value">{{member.relation}}</text>
- </view>
- <view class="family-member-row" v-if="showFamilyNameField">
- <text class="family-member-label">姓名:</text>
- <text class="family-member-value">{{member.name}}</text>
- </view>
- <view class="family-member-row" v-if="showFamilyWorkplaceField">
- <text class="family-member-label">工作单位/家庭地址:</text>
- <text class="family-member-value">{{member.workplaceOrAddress}}</text>
- </view>
- <view class="family-member-row" v-if="showFamilyPositionField">
- <text class="family-member-label">职务:</text>
- <text class="family-member-value">{{member.position}}</text>
- </view>
- <view class="family-member-row" v-if="showFamilyPhoneField">
- <text class="family-member-label">联系电话:</text>
- <text class="family-member-value">{{member.phone}}</text>
- </view>
- <view class="family-member-row">
- <text class="family-member-label">是否为紧急联系人:</text>
- <text class="family-member-value">{{member.isEmergencyContact ? '是' : '否'}}</text>
- </view>
- </view>
- </view>
- </view>
-
- <!-- 家庭成员信息表单 -->
- <view class="family-member-form">
- <view class="form-subtitle">
- {{ isEditing ? '编辑家庭成员' : '添加家庭成员' }}
- <text v-if="isEditing" class="cancel-edit" @click="cancelEdit">取消编辑</text>
- </view>
-
- <view class="form-row">
- <view class="form-item" v-if="showFamilyRelationField">
- <text class="label required">称谓</text>
- <input
- type="text"
- v-model="familyMemberForm.relation"
- placeholder="如:父亲、母亲、配偶等"
- :class="{'input-error': familyMemberErrors.relation}"
- />
- <text v-if="familyMemberErrors.relation" class="error-message">{{familyMemberErrors.relation}}</text>
- </view>
- <view class="form-item" v-if="showFamilyNameField">
- <text class="label required">姓名</text>
- <input
- type="text"
- v-model="familyMemberForm.name"
- placeholder="请输入姓名"
- :class="{'input-error': familyMemberErrors.name}"
- />
- <text v-if="familyMemberErrors.name" class="error-message">{{familyMemberErrors.name}}</text>
- </view>
- </view>
-
- <view class="form-row">
- <view class="form-item" v-if="showFamilyWorkplaceField">
- <text class="label ">工作单位/家庭地址</text>
- <input type="text" v-model="familyMemberForm.workplaceOrAddress" placeholder="请输入工作单位或家庭地址" />
- <!-- <text v-if="familyMemberErrors.workplaceOrAddress" class="error-message">{{familyMemberErrors.workplaceOrAddress}}</text> -->
- </view>
- <view class="form-item" v-if="showFamilyPositionField">
- <text class="label ">职务</text>
- <input type="text" v-model="familyMemberForm.position" placeholder="请输入职务" />
- <!-- <text v-if="familyMemberErrors.position" class="error-message">{{familyMemberErrors.position}}</text> -->
- </view>
- </view>
-
- <view class="form-row">
- <view class="form-item" v-if="showFamilyPhoneField">
- <text class="label required">联系电话</text>
- <input
- type="number"
- v-model="familyMemberForm.phone"
- placeholder="请输入联系电话"
- :class="{'input-error': familyMemberErrors.phone}"
- />
- <text v-if="familyMemberErrors.phone" class="error-message">{{familyMemberErrors.phone}}</text>
- </view>
- </view>
-
- <view class="form-row">
- <view class="form-item">
- <text class="label">是否为紧急联系人</text>
- <switch :checked="familyMemberForm.isEmergencyContact" @change="handleEmergencyContactChange" />
- </view>
- </view>
-
- <view class="form-row button-row">
- <view class="form-item button-container">
- <button class="circle-btn" @click="saveFamilyMember">
- <text class="btn-icon">{{ isEditing ? '✓' : '+' }}</text>
- </button>
- <text class="btn-text">{{ isEditing ? '保存修改' : '添加成员' }}</text>
- </view>
- </view>
- </view>
- </view>
-
- <!-- 第三步:教育经历 -->
- <view v-if="currentStep === 5" class="form-container">
- <view class="section-title">教育经历</view>
-
- <!-- 已添加的教育经历列表 -->
- <view class="education-list" v-if="educationList.length > 0">
- <view class="education-item" v-for="(edu, index) in educationList" :key="index">
- <view class="education-header">
- <text class="education-title">{{ index === 0 ? '第一学历' : '最高学历' }}</text>
- <view class="education-actions">
- <text class="education-edit" @click="editEducation(index)">编辑</text>
- <text class="education-delete" @click="deleteEducation(index)">删除</text>
- </view>
- </view>
- <view class="education-content">
- <view class="education-row" v-if="showEducationTimeField">
- <text class="education-label">起止时间:</text>
- <text class="education-value">{{edu.startTime}} 至 {{edu.endTime}}</text>
- </view>
- <view class="education-row" v-if="showEducationSchoolField">
- <text class="education-label">学校名称:</text>
- <text class="education-value">{{edu.schoolName}}</text>
- </view>
- <view class="education-row" v-if="showEducationMajorField">
- <text class="education-label">专业:</text>
- <text class="education-value">{{edu.major}}</text>
- </view>
- <view class="education-row" v-if="showEducationDegreeField">
- <text class="education-label">学历:</text>
- <text class="education-value">{{edu.degree}}</text>
- </view>
- </view>
- </view>
- </view>
-
- <!-- 教育经历表单 -->
- <view class="education-form" v-if="educationList.length < 2 || isEditingEducation">
- <view class="form-subtitle">
- {{ isEditingEducation ? '编辑教育经历' : (educationList.length === 0 ? '添加第一学历' : '添加最高学历') }}
- <text v-if="isEditingEducation" class="cancel-edit" @click="cancelEditEducation">取消编辑</text>
- </view>
-
- <view class="form-row">
- <view class="form-item" v-if="showEducationTimeField">
- <text class="label required">起止时间</text>
- <view class="date-range">
- <picker
- mode="date"
- :value="educationForm.startTime"
- @change="bindStartTimeChange"
- :class="{'input-error': educationErrors.startTime}"
- >
- <view class="picker-text">{{ educationForm.startTime || '开始时间' }}</view>
- </picker>
- <text class="date-separator">至</text>
- <picker
- mode="date"
- :value="educationForm.endTime"
- @change="bindEndTimeChange"
- :class="{'input-error': educationErrors.endTime}"
- >
- <view class="picker-text">{{ educationForm.endTime || '结束时间' }}</view>
- </picker>
- </view>
- <text v-if="educationErrors.startTime" class="error-message">{{educationErrors.startTime}}</text>
- <text v-if="educationErrors.endTime" class="error-message">{{educationErrors.endTime}}</text>
- </view>
- </view>
-
- <view class="form-row">
- <view class="form-item" v-if="showEducationSchoolField">
- <text class="label required">学校名称</text>
- <input
- type="text"
- v-model="educationForm.schoolName"
- placeholder="请输入学校名称"
- :class="{'input-error': educationErrors.schoolName}"
- />
- <text v-if="educationErrors.schoolName" class="error-message">{{educationErrors.schoolName}}</text>
- </view>
- <view class="form-item" v-if="showEducationMajorField">
- <text class="label required">专业</text>
- <input
- type="text"
- v-model="educationForm.major"
- placeholder="请输入专业"
- :class="{'input-error': educationErrors.major}"
- />
- <text v-if="educationErrors.major" class="error-message">{{educationErrors.major}}</text>
- </view>
- </view>
-
- <view class="form-row">
- <view class="form-item" v-if="showEducationDegreeField">
- <text class="label required">学历</text>
- <picker
- @change="bindDegreeChange"
- :value="degreeIndex"
- :range="degreeOptions"
- :class="{'input-error': educationErrors.degree}"
- >
- <view class="picker-text">{{ degreeOptions[degreeIndex] || '请选择学历' }}</view>
- </picker>
- <text v-if="educationErrors.degree" class="error-message">{{educationErrors.degree}}</text>
- </view>
- </view>
-
- <view class="form-row button-row">
- <view class="form-item button-container">
- <button class="circle-btn" @click="saveEducation">
- <text class="btn-icon">{{ isEditingEducation ? '✓' : '+' }}</text>
- </button>
- <text class="btn-text">{{ isEditingEducation ? '保存修改' : '添加学历' }}</text>
- </view>
- </view>
- </view>
- </view>
-
- <!-- 第四步:专业技能 -->
- <view v-if="currentStep === 6" class="form-container">
- <view class="section-title"><text class="required" style="margin-right: 4rpx;color: #ff4d4f;">*</text>专业技能</view>
- <view class="skills-container">
- <textarea
- v-model="formData.skills"
- placeholder="请描述您的专业技能"
- class="skills-textarea"
- :class="{'input-error': formErrors.skills}"
- ></textarea>
- <text v-if="formErrors.skills" class="error-message">{{formErrors.skills}}</text>
- </view>
- <view class="section-title"><text class="required" style="margin-right: 4rpx;color: #ff4d4f;">*</text>受过的培训</view>
- <view class="training-container">
- <textarea
- v-model="formData.training"
- placeholder="请描述您接受过的培训经历"
- class="training-textarea"
- :class="{'input-error': formErrors.training}"
- ></textarea>
- <text v-if="formErrors.training" class="error-message">{{formErrors.training}}</text>
- </view>
- </view>
-
- <!-- 第五步:工作经历 -->
- <view v-if="currentStep === 8" class="form-container">
- <view class="section-title">工作经历</view>
-
- <!-- 已添加的工作经历列表 -->
- <view class="work-list" v-if="workList.length > 0">
- <view class="work-item" v-for="(work, index) in workList" :key="index">
- <view class="work-header">
- <text class="work-title">单位{{ index + 1 }}</text>
- <view class="work-actions">
- <text class="work-edit" @click="editWork(index)">编辑</text>
- <text class="work-delete" @click="deleteWork(index)">删除</text>
- </view>
- </view>
- <view class="work-content">
- <view class="work-row" v-if="showWorkTimeField">
- <text class="work-label">起止时间:</text>
- <text class="work-value">{{work.startTime}} 至 {{work.endTime}}</text>
- </view>
- <view class="work-row" v-if="showWorkCompanyField">
- <text class="work-label">单位名称:</text>
- <text class="work-value">{{work.companyName}}</text>
- </view>
- <view class="work-row" v-if="showWorkDepartmentField">
- <text class="work-label">任职部门:</text>
- <text class="work-value">{{work.department}}</text>
- </view>
- <view class="work-row" v-if="showWorkEmployeeCountField">
- <text class="work-label">单位人数:</text>
- <text class="work-value">{{work.employeeCount}}</text>
- </view>
- <view class="work-row" v-if="showWorkPositionField">
- <text class="work-label">担任职务:</text>
- <text class="work-value">{{work.position}}</text>
- </view>
- <view class="work-row" >
- <text class="work-label">月总收入:</text>
- <text class="work-value">{{work.monthlySalary}}</text>
- </view>
- <view class="work-row" >
- <text class="work-label">直接领导:</text>
- <text class="work-value">{{work.supervisor}}</text>
- </view>
- <view class="work-row" >
- <text class="work-label">领导电话:</text>
- <text class="work-value">{{work.supervisorPhone}}</text>
- </view>
- </view>
- </view>
- </view>
-
- <!-- 工作经历表单 -->
- <view class="work-form" v-if="workList.length < 2 || isEditingWork">
- <view class="form-subtitle">
- {{ isEditingWork ? '编辑工作经历' : '添加工作经历' }}
- <text v-if="isEditingWork" class="cancel-edit" @click="cancelEditWork">取消编辑</text>
- </view>
-
- <view class="form-row">
- <view class="form-item" v-if="showWorkTimeField">
- <text class="label required">起止时间</text>
- <view class="date-range">
- <picker
- mode="date"
- :value="workForm.startTime"
- @change="bindWorkStartTimeChange"
- :class="{'input-error': workErrors.startTime}"
- >
- <view class="picker-text">{{ workForm.startTime || '开始时间' }}</view>
- </picker>
- <text class="date-separator">至</text>
- <picker
- mode="date"
- :value="workForm.endTime"
- @change="bindWorkEndTimeChange"
- :class="{'input-error': workErrors.endTime}"
- >
- <view class="picker-text">{{ workForm.endTime || '结束时间' }}</view>
- </picker>
- </view>
- <text v-if="workErrors.startTime" class="error-message">{{workErrors.startTime}}</text>
- <text v-if="workErrors.endTime" class="error-message">{{workErrors.endTime}}</text>
- </view>
- </view>
-
- <view class="form-row">
- <view class="form-item" v-if="showWorkCompanyField">
- <text class="label required">单位名称</text>
- <input
- type="text"
- v-model="workForm.companyName"
- placeholder="请输入单位名称"
- :class="{'input-error': workErrors.companyName}"
- />
- <text v-if="workErrors.companyName" class="error-message">{{workErrors.companyName}}</text>
- </view>
- <view class="form-item" v-if="showWorkEmployeeCountField">
- <text class="label required">单位人数</text>
- <input
- type="number"
- v-model="workForm.employeeCount"
- placeholder="请输入单位人数"
- :class="{'input-error': workErrors.employeeCount}"
- />
- <text v-if="workErrors.employeeCount" class="error-message">{{workErrors.employeeCount}}</text>
- </view>
- </view>
-
- <view class="form-row">
- <view class="form-item" v-if="showWorkDepartmentField">
- <text class="label required">任职部门</text>
- <input
- type="text"
- v-model="workForm.department"
- placeholder="请输入任职部门"
- :class="{'input-error': workErrors.department}"
- />
- <text v-if="workErrors.department" class="error-message">{{workErrors.department}}</text>
- </view>
- <view class="form-item" v-if="showWorkPositionField">
- <text class="label required">担任职务</text>
- <input
- type="text"
- v-model="workForm.position"
- placeholder="请输入担任职务"
- :class="{'input-error': workErrors.position}"
- />
- <text v-if="workErrors.position" class="error-message">{{workErrors.position}}</text>
- </view>
- </view>
-
- <view class="form-row">
- <view class="form-item" >
- <text class="label required">月总收入</text>
- <input type="number" v-model="workForm.monthlySalary" placeholder="请输入月总收入" />
- <text v-if="workErrors.monthlySalary" class="error-message">{{workErrors.monthlySalary}}</text>
- </view>
- </view>
-
- <view class="form-row">
- <view class="form-item" >
- <text class="label required">直接领导</text>
- <input type="text" v-model="workForm.supervisor" placeholder="请输入直接领导姓名" />
- <text v-if="workErrors.supervisor" class="error-message">{{workErrors.supervisor}}</text>
- </view>
- <view class="form-item">
- <text class="label required">领导电话</text>
- <input type="number" v-model="workForm.supervisorPhone" placeholder="请输入领导电话" />
- <text v-if="workErrors.supervisorPhone" class="error-message">{{workErrors.supervisorPhone}}</text>
- </view>
- </view>
-
- <view class="form-row button-row">
- <view class="form-item button-container">
- <button class="circle-btn" @click="saveWork">
- <text class="btn-icon">{{ isEditingWork ? '✓' : '+' }}</text>
- </button>
- <text class="btn-text">{{ isEditingWork ? '保存修改' : '添加工作经历' }}</text>
- </view>
- </view>
- </view>
- </view>
- </view>
-
- <!-- 修改导航按钮逻辑 -->
- <view class="nav-buttons">
- <button
- v-if="showPrevButton"
- class="nav-btn prev-btn"
- @click="prevStep"
- >上一步</button>
-
- <button
- v-if="showNextButton"
- class="nav-btn next-btn"
- @click="nextStep"
- >下一步</button>
-
- <button
- v-if="showSubmitButton"
- class="submit-btn"
- @click="submitForm"
- >提交</button>
- </view>
- </view>
- </template>
- <script>
- import { apiBaseUrl } from '@/common/config.js';
- export default {
- data() {
- return {
- // 添加承诺书相关数据
- showPromiseModal: true,
- promiseChecked: false,
-
- formData: {
- name: '',
- gender: '',
- threePeriod: '',
- birthDate: '',
- idCard: '',
- political: '',
- ethnic: '',
- height: '',
- weight: '',
- nativePlace: '',
- residence: '',
- marriage: '',
- expectedSalary: '',
- phone: '',
- email: '',
- currentAddress: '',
- emergencyContact: '',
- emergencyPhone: '',
- hobby: '',
- motto: '',
- // 添加应聘来源相关字段
- sourceType: 'social', // 默认为社招
- socialSource: '', // 社招来源
- otherSocialSource: '', // 其他社招来源
- otherSchoolSource: '', // 其他学校来源
- // 添加技能和培训字段
- skills: '',
- training: '',
- },
- genderOptions: ['男', '女'],
- genderIndex: -1,
- threePeriodOptions: ['无', '孕期', '产期', '哺乳期'],
- threePeriodIndex: -1,
- politicalOptions: ['群众', '共青团员', '中共党员', '民主党派'],
- politicalIndex: -1,
- ethnicOptions: ['汉族', '蒙古族', '回族', '藏族', '维吾尔族', '其他'],
- ethnicIndex: -1,
- marriageOptions: ['未婚', '已婚', '离异', '丧偶'],
- marriageIndex: -1,
- familyMembers: [],
- familyMemberForm: {
- relation: '',
- name: '',
- workplaceOrAddress: '',
- position: '',
- phone: '',
- isEmergencyContact: false // 添加新字段
- },
- isEditing: false,
- editingIndex: -1,
- // 添加教育经历相关数据
- educationList: [],
- educationForm: {
- startTime: '',
- endTime: '',
- schoolName: '',
- major: '',
- degree: ''
- },
- isEditingEducation: false,
- editingEducationIndex: -1,
- degreeOptions: ['高中', '中专', '大专', '本科', '硕士', '博士'],
- degreeIndex: -1,
- // 添加工作经历相关数据
- workList: [],
- workForm: {
- startTime: '',
- endTime: '',
- companyName: '',
- department: '',
- employeeCount: '',
- position: '',
- monthlySalary: '',
- supervisor: '',
- supervisorPhone: ''
- },
- isEditingWork: false,
- editingWorkIndex: -1,
- // 添加步骤控制
- currentStep: 1,
- steps: [
- { id: 1, name: '基本信息' },
- { id: 3, name: '家庭成员' },
- { id: 5, name: '教育经历' },
- { id: 6, name: '专业技能' },
- { id: 8, name: '工作经历' }
- ],
- formErrors: {
- name: '',
- idCard: '',
- phone: '',
- gender: '',
- ethnic: '',
- currentAddress: '',
- height: '',
- weight: '',
- expectedSalary: '',
- skills: '',
- training: '',
- threePeriod: '' // 添加这一行
- },
- // Add loading state
- isLoading: true,
- familyMemberErrors: {
- relation: '',
- name: '',
- phone: '',
- workplaceOrAddress: '',
- position: ''
- },
- workErrors: {
- startTime: '',
- endTime: '',
- companyName: '',
- department: '',
- position: '',
- employeeCount: '',
- monthlySalary: '',
- supervisor: '',
- supervisorPhone: ''
- },
- // 在 data 中添加教育经历的错误提示对象
- educationErrors: {
- startTime: '',
- endTime: '',
- schoolName: '',
- major: '',
- degree: ''
- },
- // 添加统一的验证规则
- validationRules: {
- name: {
- required: true,
- message: '请输入姓名'
- },
- phone: {
- required: true,
- pattern: /^1[3-9]\d{9}$/,
- message: '请输入正确的手机号码'
- },
- idCard: {
- required: true,
- pattern: /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/,
- message: '请输入正确的身份证号码'
- },
- gender: {
- required: true,
- message: '请选择性别'
- },
- ethnic: {
- required: true,
- message: '请选择民族'
- },
- currentAddress: {
- required: true,
- message: '请输入现居住地址'
- },
- height: {
- pattern: /^\d+(\.\d{1,2})?$/,
- message: '请输入正确的身高(cm)'
- },
- weight: {
- pattern: /^\d+(\.\d{1,2})?$/,
- message: '请输入正确的体重(kg)'
- },
- expectedSalary: {
- pattern: /^\d+(\.\d{1,2})?$/,
- message: '请输入正确的期望薪资'
- }
- },
- // 获取配置信息
- configData: (() => {
- try {
- const configStr = uni.getStorageSync('configData');
- if (configStr && configStr.trim()) {
- return JSON.parse(configStr);
- }
- return {};
- } catch (error) {
- console.warn('解析配置数据失败:', error);
- return {};
- }
- })()
- }
- },
- onLoad() {
- // Fetch user data when component loads
- this.fetchUserData();
- console.log(this.configData)
- },
- computed: {
- // 添加计算属性来控制按钮显示
- showPrevButton() {
- return this.currentStep !== 1;
- },
- showNextButton() {
- return this.currentStep !== 8;
- },
- showSubmitButton() {
- return this.currentStep === 8;
- },
- // 获取当前步骤在数组中的索引
- currentStepIndex() {
- return this.steps.findIndex(step => step.id === this.currentStep);
- },
- // 添加安全的配置访问器
- safeConfigData() {
- return this.configData || {};
- },
- safeProfileFieldsConfig() {
- return this.safeConfigData.profile_fields_config || {};
- },
- safeFamilyFieldsConfig() {
- return this.safeConfigData.family_fields_config || {};
- },
- safeEducationFieldsConfig() {
- return this.safeConfigData.education_fields_config || {};
- },
- safeWorkFieldsConfig() {
- return this.safeConfigData.work_experience_fields_config || {};
- },
- // 字段显示控制方法
- showNameField() {
- return Object.keys(this.safeProfileFieldsConfig).length === 0 || this.safeProfileFieldsConfig.name?.visible !== false;
- },
- showGenderField() {
- return Object.keys(this.safeProfileFieldsConfig).length === 0 || this.safeProfileFieldsConfig.gender?.visible !== false;
- },
- showPhoneField() {
- return Object.keys(this.safeProfileFieldsConfig).length === 0 || this.safeProfileFieldsConfig.phone?.visible !== false;
- },
- showIdCardField() {
- return Object.keys(this.safeProfileFieldsConfig).length === 0 || this.safeProfileFieldsConfig.id_card?.visible !== false;
- },
- showEthnicField() {
- return Object.keys(this.safeProfileFieldsConfig).length === 0 || this.safeProfileFieldsConfig.ethnic?.visible !== false;
- },
- showHeightField() {
- return Object.keys(this.safeProfileFieldsConfig).length === 0 || this.safeProfileFieldsConfig.height?.visible !== false;
- },
- showWeightField() {
- return Object.keys(this.safeProfileFieldsConfig).length === 0 || this.safeProfileFieldsConfig.weight?.visible !== false;
- },
- // 家庭成员字段显示控制
- showFamilyRelationField() {
- return Object.keys(this.safeFamilyFieldsConfig).length === 0 || this.safeFamilyFieldsConfig.relation?.visible !== false;
- },
- showFamilyNameField() {
- return Object.keys(this.safeFamilyFieldsConfig).length === 0 || this.safeFamilyFieldsConfig.name?.visible !== false;
- },
- showFamilyWorkplaceField() {
- return Object.keys(this.safeFamilyFieldsConfig).length === 0 || this.safeFamilyFieldsConfig.workplace_or_address?.visible !== false;
- },
- showFamilyPositionField() {
- return Object.keys(this.safeFamilyFieldsConfig).length === 0 || this.safeFamilyFieldsConfig.position?.visible !== false;
- },
- showFamilyPhoneField() {
- return Object.keys(this.safeFamilyFieldsConfig).length === 0 || this.safeFamilyFieldsConfig.phone?.visible !== false;
- },
- // 教育经历字段显示控制
- showEducationTimeField() {
- return Object.keys(this.safeEducationFieldsConfig).length === 0 || this.safeEducationFieldsConfig.start_time?.visible !== false;
- },
- showEducationSchoolField() {
- return Object.keys(this.safeEducationFieldsConfig).length === 0 || this.safeEducationFieldsConfig.school_name?.visible !== false;
- },
- showEducationMajorField() {
- return Object.keys(this.safeEducationFieldsConfig).length === 0 || this.safeEducationFieldsConfig.major?.visible !== false;
- },
- showEducationDegreeField() {
- return Object.keys(this.safeEducationFieldsConfig).length === 0 || this.safeEducationFieldsConfig.degree?.visible !== false;
- },
- // 工作经历字段显示控制
- showWorkTimeField() {
- return Object.keys(this.safeWorkFieldsConfig).length === 0 || this.safeWorkFieldsConfig.start_time?.visible !== false;
- },
- showWorkCompanyField() {
- return Object.keys(this.safeWorkFieldsConfig).length === 0 || this.safeWorkFieldsConfig.company_name?.visible !== false;
- },
- showWorkDepartmentField() {
- return Object.keys(this.safeWorkFieldsConfig).length === 0 || this.safeWorkFieldsConfig.department?.visible !== false;
- },
- showWorkEmployeeCountField() {
- return Object.keys(this.safeWorkFieldsConfig).length === 0 || this.safeWorkFieldsConfig.employee_count?.visible !== false;
- },
- showWorkPositionField() {
- return Object.keys(this.safeWorkFieldsConfig).length === 0 || this.safeWorkFieldsConfig.position?.visible !== false;
- }
- },
- methods: {
- // 添加承诺书相关方法
- togglePromiseChecked() {
- this.promiseChecked = !this.promiseChecked;
- },
- confirmPromise() {
- if (this.promiseChecked) {
- this.showPromiseModal = false;
- } else {
- uni.showToast({
- title: '请先阅读并同意承诺书内容',
- icon: 'none'
- });
- }
- },
-
- // 添加字段是否需要验证的判断方法
- shouldValidateField(fieldName, section) {
- section = section || 'profile';
- switch (section) {
- case 'profile':
- const fieldShowMap = {
- 'name': this.showNameField,
- 'gender': this.showGenderField,
- 'phone': this.showPhoneField,
- 'idCard': this.showIdCardField,
- 'ethnic': this.showEthnicField,
- 'height': this.showHeightField,
- 'weight': this.showWeightField,
- 'currentAddress': true, // 现居住地址总是显示和必填
- 'expectedSalary': true, // 期望薪资总是显示
- 'skills': true, // 专业技能总是显示和必填
- 'training': true, // 培训经历总是显示和必填
- 'threePeriod': this.formData.gender === '女' // 只有女性时才需要验证三期状态
- };
- return fieldShowMap[fieldName] !== false;
-
- case 'family':
- const familyFieldShowMap = {
- 'relation': this.showFamilyRelationField,
- 'name': this.showFamilyNameField,
- 'phone': this.showFamilyPhoneField,
- 'workplaceOrAddress': this.showFamilyWorkplaceField,
- 'position': this.showFamilyPositionField
- };
- return familyFieldShowMap[fieldName] !== false;
-
- case 'education':
- const educationFieldShowMap = {
- 'startTime': this.showEducationTimeField,
- 'endTime': this.showEducationTimeField,
- 'schoolName': this.showEducationSchoolField,
- 'major': this.showEducationMajorField,
- 'degree': this.showEducationDegreeField
- };
- return educationFieldShowMap[fieldName] !== false;
-
- case 'work':
- const workFieldShowMap = {
- 'startTime': this.showWorkTimeField,
- 'endTime': this.showWorkTimeField,
- 'companyName': this.showWorkCompanyField,
- 'department': this.showWorkDepartmentField,
- 'position': this.showWorkPositionField,
- 'employeeCount': this.showWorkEmployeeCountField,
- 'monthlySalary': true, // 月薪总是需要验证
- 'supervisor': true, // 直接领导总是需要验证
- 'supervisorPhone': true // 领导电话总是需要验证
- };
- return workFieldShowMap[fieldName] !== false;
-
- default:
- return true;
- }
- },
-
- bindGenderChange(e) {
- this.genderIndex = e.detail.value;
- this.formData.gender = this.genderOptions[this.genderIndex];
- // 清除性别的错误提示
- if (this.formErrors.gender) {
- this.formErrors.gender = '';
- }
-
- // 如果性别从女变为男,清空三期选择
- if (this.formData.gender !== '女') {
- this.formData.threePeriod = '';
- this.threePeriodIndex = -1;
- this.formErrors.threePeriod = ''; // 清除三期状态的错误提示
- }
- },
- bindThreePeriodChange(e) {
- this.threePeriodIndex = e.detail.value;
- this.formData.threePeriod = this.threePeriodOptions[this.threePeriodIndex];
- // 清除三期状态的错误提示
- if (this.formErrors.threePeriod) {
- this.formErrors.threePeriod = '';
- }
- },
- bindPoliticalChange(e) {
- this.politicalIndex = e.detail.value;
- this.formData.political = this.politicalOptions[this.politicalIndex];
- },
- bindEthnicChange(e) {
- this.ethnicIndex = e.detail.value;
- this.formData.ethnic = this.ethnicOptions[this.ethnicIndex];
- // 清除民族的错误提示
- if (this.formErrors.ethnic) {
- this.formErrors.ethnic = '';
- }
- },
- bindMarriageChange(e) {
- this.marriageIndex = e.detail.value;
- this.formData.marriage = this.marriageOptions[this.marriageIndex];
- },
- bindDateChange(e) {
- this.formData.birthDate = e.detail.value;
- },
- saveFamilyMember() {
- // 重置错误信息
- this.resetFamilyMemberErrors();
-
- // 验证必填字段
- let isValid = true;
-
- // 只验证显示的字段
- if (this.shouldValidateField('relation', 'family') && !this.familyMemberForm.relation) {
- this.familyMemberErrors.relation = '请输入称谓';
- isValid = false;
- }
-
- if (this.shouldValidateField('name', 'family') && !this.familyMemberForm.name) {
- this.familyMemberErrors.name = '请输入姓名';
- isValid = false;
- }
-
- if (this.shouldValidateField('workplaceOrAddress', 'family') && !this.familyMemberForm.workplaceOrAddress) {
- this.familyMemberErrors.workplaceOrAddress = '请输入工作单位/家庭地址';
- isValid = false;
- }
-
- if (this.shouldValidateField('position', 'family') && !this.familyMemberForm.position) {
- this.familyMemberErrors.position = '请输入职务';
- isValid = false;
- }
-
- if (this.shouldValidateField('phone', 'family') && !this.familyMemberForm.phone) {
- this.familyMemberErrors.phone = '请输入联系电话';
- isValid = false;
- } else if (this.shouldValidateField('phone', 'family') && this.familyMemberForm.phone && !/^1[3-9]\d{9}$/.test(this.familyMemberForm.phone)) {
- this.familyMemberErrors.phone = '请输入正确的手机号';
- isValid = false;
- }
-
- if (!isValid) {
- uni.showToast({
- title: '请完善家庭成员信息',
- icon: 'none'
- });
- return;
- }
-
- // 原有的保存逻辑
- if (this.isEditing) {
- this.familyMembers[this.editingIndex] = {...this.familyMemberForm};
- uni.showToast({
- title: '修改成功',
- icon: 'success'
- });
- this.isEditing = false;
- this.editingIndex = -1;
- } else {
- this.familyMembers.push({...this.familyMemberForm});
- uni.showToast({
- title: '添加成功',
- icon: 'success'
- });
- }
-
- // 重置表单和错误信息
- this.resetFamilyMemberForm();
- },
-
- // 添加重置错误信息的方法
- resetFamilyMemberErrors() {
- this.familyMemberErrors = {
- relation: '',
- name: '',
- phone: '',
- workplaceOrAddress: '',
- position: ''
- };
- },
-
- // 修改重置表单的方法
- resetFamilyMemberForm() {
- this.familyMemberForm = {
- relation: '',
- name: '',
- workplaceOrAddress: '',
- position: '',
- phone: '',
- isEmergencyContact: false
- };
- this.resetFamilyMemberErrors();
- },
- editFamilyMember(index) {
- this.isEditing = true;
- this.editingIndex = index;
-
- this.familyMemberForm = {...this.familyMembers[index]};
-
- uni.pageScrollTo({
- selector: '.family-member-form',
- duration: 300
- });
- },
- cancelEdit() {
- this.isEditing = false;
- this.editingIndex = -1;
-
- this.familyMemberForm = {
- relation: '',
- name: '',
- workplaceOrAddress: '',
- position: '',
- phone: '',
- isEmergencyContact: false
- };
- },
- deleteFamilyMember(index) {
- if (this.isEditing && this.editingIndex === index) {
- this.cancelEdit();
- }
-
- this.familyMembers.splice(index, 1);
- uni.showToast({
- title: '已删除',
- icon: 'none'
- });
- },
- // 选择应聘来源类型
- selectSourceType(type) {
- this.formData.sourceType = type;
- if (type === 'social') {
- // 默认选择第一个社招来源
- this.formData.socialSource = 'BOSS';
- } else {
- // 清空社招来源
- this.formData.socialSource = '';
- }
- },
-
- // 选择社招来源
- selectSocialSource(source) {
- this.formData.sourceType = 'social';
- this.formData.socialSource = source;
- },
-
- // 教育经历相关方法
- bindStartTimeChange(e) {
- this.educationForm.startTime = e.detail.value;
- },
- bindEndTimeChange(e) {
- this.educationForm.endTime = e.detail.value;
- },
- bindDegreeChange(e) {
- this.degreeIndex = e.detail.value;
- this.educationForm.degree = this.degreeOptions[this.degreeIndex];
- },
- saveEducation() {
- // 重置错误信息
- this.resetEducationErrors();
-
- // 验证必填字段
- let isValid = true;
-
- // 只验证显示的字段
- if (this.shouldValidateField('startTime', 'education') && !this.educationForm.startTime) {
- this.educationErrors.startTime = '请选择开始时间';
- isValid = false;
- }
-
- if (this.shouldValidateField('endTime', 'education') && !this.educationForm.endTime) {
- this.educationErrors.endTime = '请选择结束时间';
- isValid = false;
- }
-
- if (this.shouldValidateField('schoolName', 'education') && !this.educationForm.schoolName) {
- this.educationErrors.schoolName = '请输入学校名称';
- isValid = false;
- }
-
- if (this.shouldValidateField('major', 'education') && !this.educationForm.major) {
- this.educationErrors.major = '请输入专业';
- isValid = false;
- }
-
- if (this.shouldValidateField('degree', 'education') && !this.educationForm.degree) {
- this.educationErrors.degree = '请选择学历';
- isValid = false;
- }
-
- if (!isValid) {
- uni.showToast({
- title: '请完善教育经历信息',
- icon: 'none'
- });
- return;
- }
-
- // 验证通过后的保存逻辑
- if (this.isEditingEducation) {
- this.educationList[this.editingEducationIndex] = {...this.educationForm};
-
- uni.showToast({
- title: '修改成功',
- icon: 'success'
- });
-
- this.isEditingEducation = false;
- this.editingEducationIndex = -1;
- } else {
- this.educationList.push({...this.educationForm});
-
- uni.showToast({
- title: '添加成功',
- icon: 'success'
- });
- }
-
- // 重置表单
- this.educationForm = {
- startTime: '',
- endTime: '',
- schoolName: '',
- major: '',
- degree: ''
- };
- this.degreeIndex = -1;
- },
- editEducation(index) {
- this.isEditingEducation = true;
- this.editingEducationIndex = index;
-
- this.educationForm = {...this.educationList[index]};
- // 设置学历索引
- this.degreeIndex = this.degreeOptions.findIndex(item => item === this.educationForm.degree);
-
- uni.pageScrollTo({
- selector: '.education-form',
- duration: 300
- });
- },
- cancelEditEducation() {
- this.isEditingEducation = false;
- this.editingEducationIndex = -1;
-
- this.educationForm = {
- startTime: '',
- endTime: '',
- schoolName: '',
- major: '',
- degree: ''
- };
- this.degreeIndex = -1;
- },
- deleteEducation(index) {
- if (this.isEditingEducation && this.editingEducationIndex === index) {
- this.cancelEditEducation();
- }
-
- this.educationList.splice(index, 1);
- uni.showToast({
- title: '已删除',
- icon: 'none'
- });
- },
- // 工作经历相关方法
- bindWorkStartTimeChange(e) {
- this.workForm.startTime = e.detail.value;
- },
- bindWorkEndTimeChange(e) {
- this.workForm.endTime = e.detail.value;
- },
- saveWork() {
- // 重置所有工作经历相关的错误信息
- this.workErrors = {
- startTime: '',
- endTime: '',
- companyName: '',
- department: '',
- position: '',
- employeeCount: '',
- monthlySalary: '',
- supervisor: '',
- supervisorPhone: ''
- };
- // 验证必填字段
- let isValid = true;
- // 只验证显示的字段
- if (this.shouldValidateField('startTime', 'work') && !this.workForm.startTime) {
- this.workErrors.startTime = '请选择开始时间';
- isValid = false;
- }
- if (this.shouldValidateField('endTime', 'work') && !this.workForm.endTime) {
- this.workErrors.endTime = '请选择结束时间';
- isValid = false;
- }
- if (this.shouldValidateField('companyName', 'work') && !this.workForm.companyName) {
- this.workErrors.companyName = '请输入单位名称';
- isValid = false;
- }
- if (this.shouldValidateField('department', 'work') && !this.workForm.department) {
- this.workErrors.department = '请输入任职部门';
- isValid = false;
- }
- if (this.shouldValidateField('position', 'work') && !this.workForm.position) {
- this.workErrors.position = '请输入担任职务';
- isValid = false;
- }
- if (this.shouldValidateField('employeeCount', 'work') && !this.workForm.employeeCount) {
- this.workErrors.employeeCount = '请输入单位人数';
- isValid = false;
- }
- if (this.shouldValidateField('monthlySalary', 'work') && !this.workForm.monthlySalary) {
- this.workErrors.monthlySalary = '请输入月薪';
- isValid = false;
- }
- if (this.shouldValidateField('supervisor', 'work') && !this.workForm.supervisor) {
- this.workErrors.supervisor = '请输入直属上级';
- isValid = false;
- }
- if (this.shouldValidateField('supervisorPhone', 'work') && !this.workForm.supervisorPhone) {
- this.workErrors.supervisorPhone = '请输入直属上级电话';
- isValid = false;
- }
- // 如果验证不通过,直接返回
- if (!isValid) {
- uni.showToast({
- title: '请完善工作经历信息',
- icon: 'none'
- });
- return;
- }
- // 验证通过后的保存逻辑
- if (this.isEditingWork) {
- this.workList[this.editingWorkIndex] = {...this.workForm};
-
- uni.showToast({
- title: '修改成功',
- icon: 'success'
- });
-
- this.isEditingWork = false;
- this.editingWorkIndex = -1;
- } else {
- this.workList.push({...this.workForm});
-
- uni.showToast({
- title: '添加成功',
- icon: 'success'
- });
- }
-
- // 重置表单
- this.workForm = {
- startTime: '',
- endTime: '',
- companyName: '',
- department: '',
- employeeCount: '',
- position: '',
- monthlySalary: '',
- supervisor: '',
- supervisorPhone: ''
- };
- },
- editWork(index) {
- this.isEditingWork = true;
- this.editingWorkIndex = index;
-
- this.workForm = {...this.workList[index]};
-
- uni.pageScrollTo({
- selector: '.work-form',
- duration: 300
- });
- },
- cancelEditWork() {
- this.isEditingWork = false;
- this.editingWorkIndex = -1;
-
- this.workForm = {
- startTime: '',
- endTime: '',
- companyName: '',
- department: '',
- employeeCount: '',
- position: '',
- monthlySalary: '',
- supervisor: '',
- supervisorPhone: ''
- };
- },
- deleteWork(index) {
- if (this.isEditingWork && this.editingWorkIndex === index) {
- this.cancelEditWork();
- }
-
- this.workList.splice(index, 1);
- uni.showToast({
- title: '已删除',
- icon: 'none'
- });
- },
- submitForm() {
- // 先验证当前步骤
- if (!this.validateCurrentStep()) {
- return;
- }
- // 验证所有必填字段
- const allRequired = [
- 'name', 'gender', 'phone', 'idCard', 'ethnic', 'currentAddress'
- ];
- let isValid = true;
- allRequired.forEach(field => {
- // 只验证显示的字段
- if (this.shouldValidateField(field) && !this.validateField(field, this.formData[field])) {
- isValid = false;
- }
- });
- // 验证专业技能和培训
- if (this.shouldValidateField('skills') && !this.formData.skills?.trim()) {
- this.formErrors.skills = '请描述您的专业技能';
- isValid = false;
- }
- if (this.shouldValidateField('training') && !this.formData.training?.trim()) {
- this.formErrors.training = '请描述您的培训经历';
- isValid = false;
- }
- if (!isValid) {
- uni.showToast({
- title: '请完善所有必填信息',
- icon: 'none'
- });
- return;
- }
- // 检查必要的用户信息
- const userInfo = uni.getStorageSync('userInfo');
- if (!userInfo) {
- uni.showToast({
- title: '用户信息获取失败,请重新登录',
- icon: 'none',
- duration: 2000
- });
- return;
- }
- try {
- const userData = JSON.parse(userInfo);
- const submitData = {
- tenant_id: 1,
- user_id: userData.id,
- personal_info: {
- name: this.formData.name,
- gender: this.formData.gender,
- phone: this.formData.phone,
- id_card: this.formData.idCard,
- address: this.formData.currentAddress,
- professional_skills: this.formData.skills ? this.formData.skills.split(',') : []
- },
- profile: {
- female_status: this.getFemaleStatus(),
- marital_status: this.getMaritalStatus(),
- height: parseFloat(this.formData.height) || 0,
- weight: parseFloat(this.formData.weight) || 0,
- ethnicity: this.formData.ethnic,
- current_address: this.formData.currentAddress,
- expected_salary: parseFloat(this.formData.expectedSalary) || 0
- },
- educations: this.formatEducations(),
- family_members: this.formatFamilyMembers(),
- work_experiences: this.formatWorkExperiences()
- };
- // 数据检查
- if (!submitData.personal_info.name || !submitData.personal_info.gender || !submitData.personal_info.phone) {
- uni.showToast({
- title: '基本信息不完整',
- icon: 'none',
- duration: 2000
- });
- return;
- }
- this.sendFormData(submitData);
- } catch (error) {
- console.error('数据处理错误:', error);
- uni.showToast({
- title: '数据处理错误,请重试',
- icon: 'none',
- duration: 2000
- });
- }
- },
- // 辅助方法:发送表单数据
- sendFormData(submitData) {
- uni.showLoading({ title: '提交中...' });
- // 添加请求头和token
- const token = uni.getStorageSync('token');
-
- uni.request({
- url: `${apiBaseUrl}/wechat/user/profile/update`,
- method: 'POST',
- data: submitData,
- header: {
- 'content-type': 'application/json',
- 'Authorization': token ? `Bearer ${token}` : ''
- },
- success: (res) => {
- uni.hideLoading();
-
- if (res.statusCode === 200) {
- if (res.data.code === 2000) {
- uni.showToast({
- title: '提交成功',
- icon: 'success',
- duration: 2000
- });
- setTimeout(() => {
- uni.navigateTo({
- url: '/pages/interview-notice/interview-notice'
- });
- }, 2000);
- } else {
- uni.showToast({
- title: res.data.msg || '提交失败',
- icon: 'none',
- duration: 2000
- });
- }
- } else {
- uni.showToast({
- title: '服务器响应错误',
- icon: 'none',
- duration: 2000
- });
- }
- },
- fail: (err) => {
- console.error('提交失败:', err);
- uni.hideLoading();
-
- // 检查具体错误类型
- if (err.errMsg.includes('timeout')) {
- uni.showToast({
- title: '请求超时,请检查网络后重试',
- icon: 'none',
- duration: 2000
- });
- } else if (err.errMsg.includes('fail')) {
- uni.showToast({
- title: '网络连接失败,请检查网络设置',
- icon: 'none',
- duration: 2000
- });
- } else {
- uni.showToast({
- title: '提交失败,请稍后重试',
- icon: 'none',
- duration: 2000
- });
- }
- },
- complete: () => {
- // 可以在这里添加完成后的处理逻辑
- }
- });
- },
- // 数据格式化方法
- getFemaleStatus() {
- if (this.formData.gender !== '女') return 0;
- const statusMap = { '孕期': 1, '产期': 2, '哺乳期': 3 };
- return statusMap[this.formData.threePeriod] || 0;
- },
- getMaritalStatus() {
- const statusMap = { '未婚': 0, '已婚': 1, '离异': 2, '丧偶': 3 };
- return statusMap[this.formData.marriage] || 0;
- },
- formatEducations() {
- return this.educationList.map((edu, index) => ({
- education_type: index === 0 ? 1 : 2,
- degree: this.mapDegreeToNumber(edu.degree),
- start_date: edu.startTime,
- end_date: edu.endTime,
- school_name: edu.schoolName,
- major: edu.major
- }));
- },
- formatFamilyMembers() {
- return this.familyMembers.map(member => ({
- relation: member.relation,
- name: member.name,
- workplace: member.workplaceOrAddress,
- position: member.position,
- phone: member.phone,
- //is_emergency_contact: member.isEmergencyContact||false // 添加紧急联系人标识
- }));
- },
- formatWorkExperiences() {
- return this.workList.map(work => ({
- start_date: work.startTime,
- end_date: work.endTime,
- company_name: work.companyName,
- department: work.department,
- company_size: work.employeeCount,
- position: work.position,
- monthly_salary: work.monthlySalary,
- supervisor_name: work.supervisor,
- supervisor_phone: work.supervisorPhone
- }));
- },
- // 学历映射辅助方法
- mapDegreeToNumber(degreeText) {
- const degreeMap = {
- '高中': 1,
- '中专': 1,
- '大专': 2,
- '本科': 3,
- '硕士': 4,
- '博士': 5
- };
- return degreeMap[degreeText] || 6; // 默认为其他
- },
- prevStep() {
- const prevIndex = this.currentStepIndex - 1;
- if (prevIndex >= 0) {
- this.currentStep = this.steps[prevIndex].id;
- // 滚动到页面顶部
- uni.pageScrollTo({
- scrollTop: 0,
- duration: 300
- });
- }
- },
- nextStep() {
- // 验证当前步骤
- if (!this.validateCurrentStep()) {
- return;
- }
-
- // 如果是第一步,需要进行身份验证
- if (this.currentStep === 1) {
- this.verifyIdentity();
- return;
- }
-
- const nextIndex = this.currentStepIndex + 1;
- if (nextIndex < this.steps.length) {
- this.currentStep = this.steps[nextIndex].id;
- // 滚动到页面顶部
- uni.pageScrollTo({
- scrollTop: 0,
- duration: 300
- });
- }
- },
- // 身份验证方法
- verifyIdentity() {
- // 清空错误信息
- this.formErrors = {
- name: '',
- idCard: '',
- phone: ''
- };
-
- uni.showLoading({
- title: '身份验证中...'
- });
-
- uni.request({
- url: `${apiBaseUrl}/wechat/identity/verify`,
- method: 'POST',
- data: {
- name: this.formData.name,
- id_number: this.formData.idCard,
- mobile: this.formData.phone
- },
- header: {
- 'content-type': 'application/x-www-form-urlencoded'
- },
- success: (res) => {
- uni.hideLoading();
- console.log(res);
- if (res.data.code === 200) {
- // 验证通过,进入下一步
- const nextIndex = this.currentStepIndex + 1;
- if (nextIndex < this.steps.length) {
- this.currentStep = this.steps[nextIndex].id;
- uni.pageScrollTo({
- scrollTop: 0,
- duration: 300
- });
- }
- /* 保存姓名 */
- this.setUserInfo(this.formData);
- } else {
- // 验证失败,显示错误信息
- this.handleVerificationError(res.data);
- }
- },
- fail: (err) => {
- this.handleRequestError(err);
- }
- });
- },
- setUserInfo(data) {
- uni.request({
- url: `${apiBaseUrl}/wechat/updateUserInfo`,
- method: 'POST',
- data: {
- openid: JSON.parse(uni.getStorageSync('userInfo')).openid,
- name: data.name,
- id_card: data.idCard,
- purePhoneNumber: data.phone,
- tenant_id: 1,
- examine:0
- },
- header: {
- 'content-type': 'application/x-www-form-urlencoded'
- },
- success: (res) => {
- console.log(res);
- }
- });
- },
- // 处理验证错误
- handleVerificationError(data) {
- this.formErrors.name = '姓名验证失败,请检查姓名是否正确';
- this.formErrors.idCard = '身份证号验证失败,请检查身份证号是否正确';
- this.formErrors.phone = '手机号验证失败,请检查手机号是否正确';
-
- uni.showToast({
- title: data.msg || '身份验证失败',
- icon: 'none'
- });
- },
- // 处理请求错误
- handleRequestError(err) {
- uni.hideLoading();
- uni.showToast({
- title: '网络错误,请检查网络连接',
- icon: 'none',
- duration: 2000
- });
- console.error('请求失败:', err);
- },
- // 验证当前步骤的必填项
- validateCurrentStep() {
- let isValid = true;
- switch (this.currentStep) {
- case 1: // 基本信息
- const basicFields = ['name', 'gender', 'phone', 'idCard', 'ethnic', 'currentAddress'];
- basicFields.forEach(field => {
- // 只验证显示的字段
- if (this.shouldValidateField(field) && !this.validateField(field, this.formData[field])) {
- isValid = false;
- }
- });
- // 特殊验证:女性三期状态
- if (this.shouldValidateField('threePeriod') && this.formData.gender === '女' && this.threePeriodIndex === -1) {
- this.formErrors.threePeriod = '请选择三期状态';
- isValid = false;
- }
- // 可选字段验证(如果有值则验证格式)
- if (this.shouldValidateField('height') && this.formData.height) {
- isValid = this.validateField('height', this.formData.height) && isValid;
- }
- if (this.shouldValidateField('weight') && this.formData.weight) {
- isValid = this.validateField('weight', this.formData.weight) && isValid;
- }
- if (this.shouldValidateField('expectedSalary') && this.formData.expectedSalary) {
- isValid = this.validateField('expectedSalary', this.formData.expectedSalary) && isValid;
- }
- break;
- case 3: // 家庭成员
- console.log(this.familyMembers.length);
- if (this.familyMembers.length == 0) {
- uni.showToast({
- title: '请至少添加一位家庭成员',
- icon: 'none'
- });
- isValid = false;
- }
- break;
- case 5: // 教育经历
- if (this.educationList.length === 0) {
- uni.showToast({
- title: '请至少添加一项教育经历',
- icon: 'none'
- });
- isValid = false;
- }
- break;
- case 6: // 专业技能
- if (this.shouldValidateField('skills') && !this.formData.skills?.trim()) {
- this.formErrors.skills = '请描述您的专业技能';
- isValid = false;
- }
- if (this.shouldValidateField('training') && !this.formData.training?.trim()) {
- this.formErrors.training = '请描述您的培训经历';
- isValid = false;
- }
- break;
- case 8: // 工作经历
- if (this.workList.length === 0) {
- uni.showToast({
- title: '请至少添加一项工作经历',
- icon: 'none'
- });
- isValid = false;
- }
- break;
- }
- /* if (!isValid) {
- uni.showToast({
- title: '请完善所有必填信息',
- icon: 'none'
- });
- } */
- return isValid;
- },
- // Add method to fetch user data
- fetchUserData() {
- this.isLoading = true;
-
- // Get openid from storage
- const userInfo = uni.getStorageSync('userInfo') ? JSON.parse(uni.getStorageSync('userInfo')) : {};
- const openid = userInfo.openid;
-
- if (!openid) {
- uni.showToast({
- title: '用户信息获取失败,请重新登录',
- icon: 'none'
- });
- this.isLoading = false;
- return;
- }
-
- uni.request({
- url: `${apiBaseUrl}/api/wechat/user/get_full_info?tenant_id=1&openid=${openid}`,
- method: 'GET',
- success: (res) => {
- // 无论结果如何,都保持承诺书显示状态
- this.showPromiseModal = true;
-
- /* if (res.data.code === 2000) { */
- // Successfully fetched data
- this.populateFormData(res.data.data);
- /* } else {
- uni.showToast({
- title: res.data.msg || '获取用户信息失败',
- icon: 'none'
- });
- } */
- },
- fail: (err) => {
- /* console.error('获取用户信息失败:', err);
- uni.showToast({
- title: '网络错误,请检查网络连接',
- icon: 'none'
- }); */
- },
- complete: () => {
- this.isLoading = false;
- }
- });
- },
-
- // Add method to populate form data with fetched data
- populateFormData(data) {
- const { user_info, profile, educations, work_experiences, family_members } = data;
-
- // Populate basic user info
- if (user_info) {
- this.formData.name = user_info.name || '';
- this.formData.gender = user_info.gender_text || '';
- this.genderIndex = this.genderOptions.findIndex(item => item === this.formData.gender);
- this.formData.idCard = user_info.id_card || '';
- this.formData.phone = user_info.phone || '';
- this.formData.email = user_info.email || '';
- }
-
- // Populate profile data
- if (profile) {
- // Set political status
- this.formData.political = profile.political_status || '';
- this.politicalIndex = this.politicalOptions.findIndex(item => item === this.formData.political);
-
- // Set ethnic
- this.formData.ethnic = profile.ethnicity || '';
- this.ethnicIndex = this.ethnicOptions.findIndex(item => item === this.formData.ethnic);
-
- // Set height and weight
- this.formData.height = profile.height || '';
- this.formData.weight = profile.weight || '';
-
- // Set native place and residence
- this.formData.nativePlace = profile.native_place || '';
- this.formData.residence = profile.household_location || '';
-
- // Set current address
- this.formData.currentAddress = profile.current_address || '';
-
- // Set marriage status
- this.formData.marriage = profile.marital_status_text || '';
- this.marriageIndex = this.marriageOptions.findIndex(item => item === this.formData.marriage);
-
- // Set three period status for female
- if (this.formData.gender === '女' && profile.female_status !== undefined) {
- const femaleStatusMap = {0: '无', 1: '孕期', 2: '产期', 3: '哺乳期'};
- this.formData.threePeriod = femaleStatusMap[profile.female_status] || '无';
- this.threePeriodIndex = this.threePeriodOptions.findIndex(item => item === this.formData.threePeriod);
- }
-
- // Set expected salary
- this.formData.expectedSalary = profile.expected_salary || '';
-
- // Set emergency contact
- this.formData.emergencyContact = profile.emergency_contact || '';
- this.formData.emergencyPhone = profile.emergency_phone || '';
-
- // Set hobby and motto
- this.formData.hobby = profile.specialties || '';
- this.formData.motto = profile.life_motto || '';
-
- // Set recruitment source
- const sourceTypeMap = {
- 1: 'school',
- 2: 'social',
- 3: 'social',
- 4: 'social',
- 5: 'social'
- };
-
- const socialSourceMap = {
- 2: 'BOSS',
- 3: 'zhilian',
- 4: 'liepin',
- 5: 'other'
- };
-
- this.formData.sourceType = sourceTypeMap[profile.recruitment_source] || 'social';
-
- if (this.formData.sourceType === 'social') {
- this.formData.socialSource = socialSourceMap[profile.recruitment_source] || '';
-
- if (this.formData.socialSource === 'other') {
- this.formData.otherSocialSource = profile.recruitment_source_detail || '';
- }
- } else if (this.formData.sourceType === 'school') {
- this.formData.otherSchoolSource = profile.recruitment_source_detail || '';
- }
- }
-
- // Populate educations data
- if (educations && educations.length > 0) {
- this.educationList = educations.map(edu => {
- const degreeMap = {
- 1: '高中',
- 2: '大专',
- 3: '本科',
- 4: '硕士',
- 5: '博士'
- };
-
- return {
- startTime: edu.start_date || '',
- endTime: edu.end_date || '',
- schoolName: edu.school_name || '',
- major: edu.major || '',
- degree: degreeMap[edu.degree] || ''
- };
- });
- }
-
- // Populate work experience data
- if (work_experiences && work_experiences.length > 0) {
- this.workList = work_experiences.map(work => {
- return {
- startTime: work.start_date || '',
- endTime: work.end_date || '',
- companyName: work.company_name || '',
- department: work.department || '',
- employeeCount: work.company_size || '',
- position: work.position || '',
- monthlySalary: work.monthly_salary || '',
- supervisor: work.supervisor_name || '',
- supervisorPhone: work.supervisor_phone || ''
- };
- });
- }
-
- // Populate family members data
- if (family_members && family_members.length > 0) {
- this.familyMembers = family_members.map(member => {
- return {
- relation: member.relation || '',
- name: member.name || '',
- workplaceOrAddress: member.workplace || '',
- position: member.position || '',
- phone: member.phone || '',
- isEmergencyContact: member.isEmergencyContact || false
- };
- });
- }
-
- // 移除这段代码,确保承诺书始终显示
- // if (user_info && user_info.is_profile_complete) {
- // this.showPromiseModal = false;
- // }
- },
- // 处理紧急联系人开关变化
- handleEmergencyContactChange(e) {
- this.familyMemberForm.isEmergencyContact = e.detail.value;
-
- // 如果设置为紧急联系人,自动填充到紧急联系人字段
- if (e.detail.value) {
- this.formData.emergencyContact = this.familyMemberForm.name;
- this.formData.emergencyPhone = this.familyMemberForm.phone;
- }
- },
- // 添加重置教育经历错误信息的方法
- resetEducationErrors() {
- this.educationErrors = {
- startTime: '',
- endTime: '',
- schoolName: '',
- major: '',
- degree: ''
- };
- },
- // 添加通用验证方法
- validateField(fieldName, value) {
- const rule = this.validationRules[fieldName];
- if (!rule) return true;
- // 如果字段被隐藏,不进行验证
- if (!this.shouldValidateField(fieldName)) {
- return true;
- }
- // 重置该字段的错误信息
- this.formErrors[fieldName] = '';
- // 必填验证
- if (rule.required && !value) {
- this.formErrors[fieldName] = rule.message;
- return false;
- }
- // 正则验证
- if (rule.pattern && value && !rule.pattern.test(value)) {
- this.formErrors[fieldName] = rule.message;
- return false;
- }
- return true;
- },
- },
- // 添加监听器来清除错误信息
- watch: {
- 'formData.name': function(newVal) {
- if (newVal && this.formErrors.name) {
- this.formErrors.name = '';
- }
- },
- 'formData.idCard': function(newVal) {
- if (newVal && this.formErrors.idCard) {
- this.formErrors.idCard = '';
- }
- },
- 'formData.phone': function(newVal) {
- if (newVal && this.formErrors.phone) {
- this.formErrors.phone = '';
- }
- },
- 'formData.gender': function(newVal) {
- if (newVal && this.formErrors.gender) {
- this.formErrors.gender = '';
- }
- },
- 'formData.ethnic': function(newVal) {
- if (newVal && this.formErrors.ethnic) {
- this.formErrors.ethnic = '';
- }
- },
- 'formData.currentAddress': function(newVal) {
- if (newVal && this.formErrors.currentAddress) {
- this.formErrors.currentAddress = '';
- }
- },
- 'formData.height': function(newVal) {
- if (newVal && this.formErrors.height) {
- this.formErrors.height = '';
- }
- },
- 'formData.weight': function(newVal) {
- if (newVal && this.formErrors.weight) {
- this.formErrors.weight = '';
- }
- },
- 'formData.expectedSalary': function(newVal) {
- if (newVal && this.formErrors.expectedSalary) {
- this.formErrors.expectedSalary = '';
- }
- },
- 'familyMemberForm.relation': function(newVal) {
- if (newVal) this.familyMemberErrors.relation = '';
- },
- 'familyMemberForm.name': function(newVal) {
- if (newVal) this.familyMemberErrors.name = '';
- },
- 'familyMemberForm.phone': function(newVal) {
- if (newVal) this.familyMemberErrors.phone = '';
- },
- /* 'familyMemberForm.workplaceOrAddress': function(newVal) {
- if (newVal) this.familyMemberErrors.workplaceOrAddress = '';
- },
- 'familyMemberForm.position': function(newVal) {
- if (newVal) this.familyMemberErrors.position = '';
- }, */
- 'workForm.companyName': function(newVal) {
- if (newVal && this.workErrors.companyName) {
- this.workErrors.companyName = '';
- }
- },
- 'workForm.department': function(newVal) {
- if (newVal && this.workErrors.department) {
- this.workErrors.department = '';
- }
- },
- 'workForm.position': function(newVal) {
- if (newVal && this.workErrors.position) {
- this.workErrors.position = '';
- }
- },
- 'workForm.employeeCount': function(newVal) {
- if (newVal && this.workErrors.employeeCount) {
- this.workErrors.employeeCount = '';
- }
- },
- 'workForm.monthlySalary': function(newVal) {
- if (newVal && this.workErrors.monthlySalary) {
- this.workErrors.monthlySalary = '';
- }
- },
- 'workForm.supervisor': function(newVal) {
- if (newVal && this.workErrors.supervisor) {
- this.workErrors.supervisor = '';
- }
- },
- 'workForm.supervisorPhone': function(newVal) {
- if (newVal && this.workErrors.supervisorPhone) {
- this.workErrors.supervisorPhone = '';
- }
- },
- 'formData.training': function(newVal) {
- if (newVal && this.formErrors.training) {
- this.formErrors.training = '';
- }
- },
- 'educationForm.startTime': function(newVal) {
- if (newVal) this.educationErrors.startTime = '';
- },
- 'educationForm.endTime': function(newVal) {
- if (newVal) this.educationErrors.endTime = '';
- },
- 'educationForm.schoolName': function(newVal) {
- if (newVal) this.educationErrors.schoolName = '';
- },
- 'educationForm.major': function(newVal) {
- if (newVal) this.educationErrors.major = '';
- },
- 'educationForm.degree': function(newVal) {
- if (newVal) this.educationErrors.degree = '';
- },
- // 添加对表单字段的实时验证
- 'formData': {
- handler(newVal) {
- // 只验证当前步骤的字段
- const currentStepFields = {
- 1: ['name', 'gender', 'phone', 'idCard', 'ethnic', 'currentAddress', 'height', 'weight', 'expectedSalary'],
- 6: ['skills', 'training']
- }[this.currentStep];
- if (currentStepFields) {
- currentStepFields.forEach(field => {
- if (newVal[field] !== undefined && this.shouldValidateField(field)) {
- this.validateField(field, newVal[field]);
- }
- });
- }
- },
- deep: true
- }
- },
- }
- </script>
- <style>
- .personal-container {
- padding: 20rpx;
- }
- .form-title {
- font-size: 36rpx;
- font-weight: bold;
- text-align: center;
- margin-bottom: 30rpx;
- }
- .form-container {
- background-color: #fff;
- border-radius: 10rpx;
- padding: 20rpx;
- }
- .section-title {
- font-size: 32rpx;
- font-weight: bold;
- margin: 30rpx 0 20rpx 10rpx;
- color: #333;
- border-left: 4rpx solid #0039b3;
- padding-left: 15rpx;
- }
- .form-row {
- display: flex;
- flex-direction: row;
- margin-bottom: 20rpx;
- flex-wrap: wrap;
- }
- .form-item {
- flex: 1;
- min-width: 300rpx;
- margin: 10rpx;
- border-bottom: 1px solid #eee;
- padding-bottom: 10rpx;
- }
- .label {
- font-size: 28rpx;
- color: #333;
- margin-right: 10rpx;
- display: block;
- margin-bottom: 10rpx;
- position: relative;
- padding-left: 14rpx; /* 为星号预留空间 */
- }
- input {
- font-size: 28rpx;
- height: 60rpx;
- }
- .picker-text {
- font-size: 28rpx;
- height: 60rpx;
- line-height: 60rpx;
- color: #666;
- }
- .submit-btn {
- margin-top: 40rpx;
- background-color: #0039b3;
- color: #fff;
- }
- .family-members-list {
- margin-top: 20rpx;
- }
- .family-member-item {
- background-color: #f8f8f8;
- border-radius: 8rpx;
- padding: 20rpx;
- margin-bottom: 20rpx;
- }
- .family-member-header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 15rpx;
- border-bottom: 1px solid #eee;
- padding-bottom: 10rpx;
- }
- .family-member-title {
- font-size: 30rpx;
- font-weight: bold;
- color: #333;
- }
- .family-member-actions {
- display: flex;
- gap: 20rpx;
- }
- .family-member-edit {
- font-size: 26rpx;
- color: #1890ff;
- }
- .family-member-delete {
- font-size: 26rpx;
- color: #ff4d4f;
- }
- .form-subtitle {
- font-size: 28rpx;
- font-weight: bold;
- margin-bottom: 20rpx;
- display: flex;
- justify-content: space-between;
- align-items: center;
- }
- .cancel-edit {
- font-size: 26rpx;
- color: #999;
- font-weight: normal;
- }
- .family-member-content {
- padding: 10rpx 0;
- }
- .family-member-row {
- display: flex;
- margin-bottom: 10rpx;
- }
- .family-member-label {
- font-size: 26rpx;
- color: #666;
- width: 200rpx;
- }
- .family-member-value {
- font-size: 26rpx;
- color: #333;
- flex: 1;
- }
- .family-member-form {
- background-color: #fff;
- border-radius: 8rpx;
- padding: 20rpx;
- margin-top: 20rpx;
- }
- .form-row button-row {
- display: flex;
- justify-content: center;
- margin-top: 20rpx;
- }
- .form-item button-container {
- display: flex;
- flex-direction: column;
- align-items: center;
- }
- .circle-btn {
- width: 40rpx;
- height: 40rpx;
- border-radius: 50%;
- background-color: #0039b3;
- display: flex;
- justify-content: center;
- align-items: center;
- margin-bottom: 10rpx;
- }
- .btn-icon {
- font-size: 32rpx;
- color: #fff;
- }
- .btn-text {
- font-size: 28rpx;
- color: #333;
- }
- /* 添加圆形按钮相关样式 */
- .button-row {
- justify-content: center;
- margin-top: 30rpx;
- }
- .button-container {
- display: flex;
- flex-direction: column;
- align-items: center;
- border-bottom: none;
- min-width: auto;
- }
- .circle-btn {
- width: 100rpx;
- height: 100rpx;
- border-radius: 50%;
- padding: 0;
- display: flex;
- align-items: center;
- justify-content: center;
- background-color: #0039b3;
- box-shadow: 0 6rpx 16rpx rgba(0, 0, 0, 0.1);
- margin: 0;
- }
- .btn-icon {
- font-size: 50rpx;
- color: #fff;
- line-height: 1;
- }
- .btn-text {
- font-size: 24rpx;
- color: #666;
- margin-top: 10rpx;
- }
- /* 编辑状态下的按钮颜色 */
- .circle-btn.editing {
- background-color: #1890ff;
- }
- /* 移除原来的添加按钮样式 */
- .add-member-btn {
- display: none;
- }
- /* 应聘来源样式 */
- .source-container {
- background-color: #fff;
- border-radius: 10rpx;
- padding: 20rpx;
- margin-bottom: 30rpx;
- }
-
- .source-row {
- display: flex;
- margin-bottom: 20rpx;
- align-items: flex-start;
- }
-
- .source-label {
- width: 120rpx;
- font-size: 28rpx;
- color: #333;
- padding-top: 6rpx;
- }
-
- .source-options {
- flex: 1;
- display: flex;
- flex-wrap: wrap;
- }
-
- .source-option {
- display: flex;
- align-items: center;
- margin-right: 30rpx;
- margin-bottom: 15rpx;
- }
-
- .source-option text {
- font-size: 28rpx;
- margin-left: 8rpx;
- }
-
- .other-option {
- flex-basis: 100%;
- margin-top: 10rpx;
- }
-
- .other-option input {
- border-bottom: 1px solid #eee;
- width: 300rpx;
- margin-left: 10rpx;
- font-size: 28rpx;
- }
- /* 教育经历样式 */
- .education-list {
- margin-top: 20rpx;
- }
-
- .education-item {
- background-color: #f8f8f8;
- border-radius: 8rpx;
- padding: 20rpx;
- margin-bottom: 20rpx;
- }
-
- .education-header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 15rpx;
- border-bottom: 1px solid #eee;
- padding-bottom: 10rpx;
- }
-
- .education-title {
- font-size: 30rpx;
- font-weight: bold;
- color: #333;
- }
-
- .education-actions {
- display: flex;
- gap: 20rpx;
- }
-
- .education-edit {
- font-size: 26rpx;
- color: #1890ff;
- }
-
- .education-delete {
- font-size: 26rpx;
- color: #ff4d4f;
- }
-
- .education-content {
- padding: 10rpx 0;
- }
-
- .education-row {
- display: flex;
- margin-bottom: 10rpx;
- }
-
- .education-label {
- font-size: 26rpx;
- color: #666;
- width: 150rpx;
- }
-
- .education-value {
- font-size: 26rpx;
- color: #333;
- flex: 1;
- }
-
- .education-form {
- background-color: #fff;
- border-radius: 8rpx;
- padding: 20rpx;
- margin-top: 20rpx;
- }
- .date-range {
- display: flex;
- align-items: center;
- justify-content: space-around;
- }
-
- .date-separator {
- margin: 0 10rpx;
- color: #666;
- }
- /* 专业技能和培训样式 */
- .skills-container, .training-container {
- background-color: #fff;
- border-radius: 10rpx;
- padding: 20rpx;
- margin-bottom: 20rpx;
- }
-
- .skills-textarea, .training-textarea {
- width: 100%;
- height: 200rpx;
- font-size: 28rpx;
- line-height: 1.5;
- padding: 10rpx;
- box-sizing: border-box;
- border: 1px solid #eee;
- border-radius: 6rpx;
- }
- /* 工作经历样式 */
- .work-list {
- margin-top: 20rpx;
- }
-
- .work-item {
- background-color: #f8f8f8;
- border-radius: 8rpx;
- padding: 20rpx;
- margin-bottom: 20rpx;
- }
-
- .work-header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 15rpx;
- border-bottom: 1px solid #eee;
- padding-bottom: 10rpx;
- }
-
- .work-title {
- font-size: 30rpx;
- font-weight: bold;
- color: #333;
- }
-
- .work-actions {
- display: flex;
- gap: 20rpx;
- }
-
- .work-edit {
- font-size: 26rpx;
- color: #1890ff;
- }
-
- .work-delete {
- font-size: 26rpx;
- color: #ff4d4f;
- }
-
- .work-content {
- padding: 10rpx 0;
- }
-
- .work-row {
- display: flex;
- margin-bottom: 10rpx;
- }
-
- .work-label {
- font-size: 26rpx;
- color: #666;
- width: 150rpx;
- }
-
- .work-value {
- font-size: 26rpx;
- color: #333;
- flex: 1;
- }
-
- .work-form {
- background-color: #fff;
- border-radius: 8rpx;
- padding: 20rpx;
- margin-top: 20rpx;
- }
- /* 步骤指示器样式 */
- .steps-indicator {
- display: flex;
- justify-content: space-between;
- margin-bottom: 30rpx;
- padding: 20rpx;
- background-color: #fff;
- border-radius: 10rpx;
- overflow-x: auto;
- }
- .step-item {
- display: flex;
- flex-direction: column;
- align-items: center;
- position: relative;
- min-width: 120rpx;
- }
- .step-item:not(:last-child)::after {
- content: '';
- position: absolute;
- top: 20rpx;
- right: -50%;
- width: 100%;
- height: 2rpx;
- background-color: #ddd;
- z-index: 1;
- }
- .step-item.active:not(:last-child)::after {
- background-color: #0039b3;
- }
- .step-number {
- width: 40rpx;
- height: 40rpx;
- border-radius: 50%;
- background-color: #ddd;
- color: #fff;
- display: flex;
- justify-content: center;
- align-items: center;
- font-size: 24rpx;
- margin-bottom: 10rpx;
- position: relative;
- z-index: 2;
- }
- .step-item.active .step-number {
- background-color: #0039b3;
- }
- .step-item.current .step-number {
- background-color: #0039b3;
- box-shadow: 0 0 0 4rpx rgba(0, 122, 255, 0.2);
- }
- .step-name {
- font-size: 22rpx;
- color: #999;
- text-align: center;
- }
- .step-item.active .step-name {
- color: #333;
- }
- .step-item.current .step-name {
- color: #0039b3;
- font-weight: bold;
- }
- /* 导航按钮样式 */
- .nav-buttons {
- display: flex;
- justify-content: space-between;
- margin-top: 40rpx;
- padding: 0 20rpx;
- }
- .nav-btn {
- flex: 1;
- margin: 0 10rpx;
- height: 80rpx;
- line-height: 80rpx;
- text-align: center;
- border-radius: 40rpx;
- font-size: 28rpx;
- }
- .prev-btn {
- background-color: #f0f0f0;
- color: #666;
- }
- .next-btn {
- background-color: #0039b3;
- color: #fff;
- }
- .submit-btn {
- flex: 1;
- margin: 0 10rpx;
- height: 80rpx;
- line-height: 80rpx;
- text-align: center;
- border-radius: 40rpx;
- font-size: 28rpx;
- background-color: #0039b3;
- color: #fff;
- }
- /* 确认提交页样式 */
- .confirm-container {
- background-color: #fff;
- border-radius: 10rpx;
- padding: 20rpx;
- margin-bottom: 30rpx;
- }
- .confirm-message {
- padding: 20rpx;
- background-color: #f6f6f6;
- border-radius: 8rpx;
- margin-bottom: 20rpx;
- }
- .info-summary {
- padding: 20rpx;
- }
- .summary-item {
- display: flex;
- margin-bottom: 15rpx;
- }
- .summary-label {
- width: 150rpx;
- font-size: 28rpx;
- color: #666;
- }
- .summary-value {
- flex: 1;
- font-size: 28rpx;
- color: #333;
- }
- .input-error {
- border-bottom: 1px solid #ff4d4f !important;
- }
- .error-message {
- color: #ff4d4f;
- font-size: 24rpx;
- margin-top: 6rpx;
- display: block;
- }
- /* 添加承诺书弹框样式 */
- .promise-modal {
- position: fixed;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- background-color: rgba(0, 0, 0, 0.5);
- z-index: 999;
- display: flex;
- justify-content: center;
- align-items: center;
- }
-
- .promise-content {
- width: 80%;
- max-width: 600rpx;
- background-color: #fff;
- border-radius: 12rpx;
- padding: 30rpx;
- box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.1);
- }
-
- .promise-title {
- font-size: 34rpx;
- font-weight: bold;
- text-align: center;
- margin-bottom: 20rpx;
- color: #333;
- }
-
- .promise-text {
- height: 600rpx;
- margin-bottom: 20rpx;
- /* padding: 20rpx; */
- background-color: #f8f8f8;
- border-radius: 8rpx;
- font-size: 28rpx;
- line-height: 1.6;
- color: #333;
- }
-
- .promise-checkbox {
- display: flex;
- align-items: center;
- margin-bottom: 30rpx;
- padding: 0 10rpx;
- }
-
- .promise-checkbox text {
- font-size: 28rpx;
- margin-left: 10rpx;
- color: #333;
- }
-
- .promise-buttons {
- display: flex;
- justify-content: center;
- }
-
- .promise-btn {
- width: 200rpx;
- height: 80rpx;
- line-height: 80rpx;
- text-align: center;
- border-radius: 40rpx;
- font-size: 28rpx;
- }
-
- .confirm-btn {
- background-color: #0039b3;
- color: #fff;
- }
-
- .confirm-btn[disabled] {
- background-color: #cccccc;
- color: #ffffff;
- }
- /* Loading indicator styles */
- .loading-container {
- position: fixed;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- background-color: rgba(255, 255, 255, 0.8);
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- z-index: 1000;
- }
-
- .loading-spinner {
- width: 60rpx;
- height: 60rpx;
- border: 6rpx solid #f3f3f3;
- border-top: 6rpx solid #0039b3;
- border-radius: 50%;
- animation: spin 1s linear infinite;
- margin-bottom: 20rpx;
- }
-
- .loading-text {
- font-size: 28rpx;
- color: #666;
- }
-
- @keyframes spin {
- 0% { transform: rotate(0deg); }
- 100% { transform: rotate(360deg); }
- }
- /* 添加开关样式 */
- .form-item switch {
- margin-top: 10rpx;
- }
- /* 修改必填项标签的样式 */
- .label.required::before {
- content: '*';
- color: #ff4d4f;
- margin-right: 4rpx;
- position: absolute;
- left: 0;
- top: -4rpx;
- }
- /* 修改必填项标签的样式 */
- /* .label.required::after {
- content: '*';
- color: #ff4d4f;
- margin-left: 4rpx;
- } */
- </style>
|