1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243 |
- "use strict";
- const common_vendor = require("../../common/vendor.js");
- const common_config = require("../../common/config.js");
- const _sfc_main = {
- 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: ""
- },
- 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: 2, name: "紧急联系人信息" },
- { id: 3, name: "家庭成员信息" },
- { id: 4, name: "应聘来源" },
- { id: 5, name: "教育经历" },
- { id: 6, name: "专业技能" },
- { id: 7, name: "培训经历" },
- { id: 8, name: "工作经历" },
- { id: 9, name: "确认提交" }
- ],
- formErrors: {
- name: "",
- idCard: "",
- phone: ""
- },
- // Add loading state
- isLoading: true
- };
- },
- onLoad() {
- this.fetchUserData();
- },
- methods: {
- // 添加承诺书相关方法
- togglePromiseChecked() {
- this.promiseChecked = !this.promiseChecked;
- },
- confirmPromise() {
- if (this.promiseChecked) {
- this.showPromiseModal = false;
- } else {
- common_vendor.index.showToast({
- title: "请先阅读并同意承诺书内容",
- icon: "none"
- });
- }
- },
- bindGenderChange(e) {
- this.genderIndex = e.detail.value;
- this.formData.gender = this.genderOptions[this.genderIndex];
- if (this.formData.gender !== "女") {
- this.formData.threePeriod = "";
- this.threePeriodIndex = -1;
- }
- },
- bindThreePeriodChange(e) {
- this.threePeriodIndex = e.detail.value;
- this.formData.threePeriod = this.threePeriodOptions[this.threePeriodIndex];
- },
- 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];
- },
- bindMarriageChange(e) {
- this.marriageIndex = e.detail.value;
- this.formData.marriage = this.marriageOptions[this.marriageIndex];
- },
- bindDateChange(e) {
- this.formData.birthDate = e.detail.value;
- },
- saveFamilyMember() {
- if (!this.familyMemberForm.relation) {
- common_vendor.index.showToast({
- title: "请输入称谓",
- icon: "none"
- });
- return;
- }
- if (!this.familyMemberForm.name) {
- common_vendor.index.showToast({
- title: "请输入姓名",
- icon: "none"
- });
- return;
- }
- if (!this.familyMemberForm.phone) {
- common_vendor.index.showToast({
- title: "请输入联系电话",
- icon: "none"
- });
- return;
- }
- if (this.isEditing) {
- this.familyMembers[this.editingIndex] = { ...this.familyMemberForm };
- common_vendor.index.showToast({
- title: "修改成功",
- icon: "success"
- });
- this.isEditing = false;
- this.editingIndex = -1;
- } else {
- this.familyMembers.push({ ...this.familyMemberForm });
- common_vendor.index.showToast({
- title: "添加成功",
- icon: "success"
- });
- }
- this.familyMemberForm = {
- relation: "",
- name: "",
- workplaceOrAddress: "",
- position: "",
- phone: ""
- };
- },
- editFamilyMember(index) {
- this.isEditing = true;
- this.editingIndex = index;
- this.familyMemberForm = { ...this.familyMembers[index] };
- common_vendor.index.pageScrollTo({
- selector: ".family-member-form",
- duration: 300
- });
- },
- cancelEdit() {
- this.isEditing = false;
- this.editingIndex = -1;
- this.familyMemberForm = {
- relation: "",
- name: "",
- workplaceOrAddress: "",
- position: "",
- phone: ""
- };
- },
- deleteFamilyMember(index) {
- if (this.isEditing && this.editingIndex === index) {
- this.cancelEdit();
- }
- this.familyMembers.splice(index, 1);
- common_vendor.index.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() {
- if (!this.educationForm.startTime) {
- common_vendor.index.showToast({
- title: "请选择开始时间",
- icon: "none"
- });
- return;
- }
- if (!this.educationForm.endTime) {
- common_vendor.index.showToast({
- title: "请选择结束时间",
- icon: "none"
- });
- return;
- }
- if (!this.educationForm.schoolName) {
- common_vendor.index.showToast({
- title: "请输入学校名称",
- icon: "none"
- });
- return;
- }
- if (!this.educationForm.major) {
- common_vendor.index.showToast({
- title: "请输入专业",
- icon: "none"
- });
- return;
- }
- if (!this.educationForm.degree) {
- common_vendor.index.showToast({
- title: "请选择学历",
- icon: "none"
- });
- return;
- }
- if (this.isEditingEducation) {
- this.educationList[this.editingEducationIndex] = { ...this.educationForm };
- common_vendor.index.showToast({
- title: "修改成功",
- icon: "success"
- });
- this.isEditingEducation = false;
- this.editingEducationIndex = -1;
- } else {
- this.educationList.push({ ...this.educationForm });
- common_vendor.index.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);
- common_vendor.index.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);
- common_vendor.index.showToast({
- title: "已删除",
- icon: "none"
- });
- },
- // 工作经历相关方法
- bindWorkStartTimeChange(e) {
- this.workForm.startTime = e.detail.value;
- },
- bindWorkEndTimeChange(e) {
- this.workForm.endTime = e.detail.value;
- },
- saveWork() {
- if (!this.workForm.startTime) {
- common_vendor.index.showToast({
- title: "请选择开始时间",
- icon: "none"
- });
- return;
- }
- if (!this.workForm.endTime) {
- common_vendor.index.showToast({
- title: "请选择结束时间",
- icon: "none"
- });
- return;
- }
- if (!this.workForm.companyName) {
- common_vendor.index.showToast({
- title: "请输入单位名称",
- icon: "none"
- });
- return;
- }
- if (!this.workForm.department) {
- common_vendor.index.showToast({
- title: "请输入任职部门",
- icon: "none"
- });
- return;
- }
- if (!this.workForm.position) {
- common_vendor.index.showToast({
- title: "请输入担任职务",
- icon: "none"
- });
- return;
- }
- if (this.isEditingWork) {
- this.workList[this.editingWorkIndex] = { ...this.workForm };
- common_vendor.index.showToast({
- title: "修改成功",
- icon: "success"
- });
- this.isEditingWork = false;
- this.editingWorkIndex = -1;
- } else {
- this.workList.push({ ...this.workForm });
- common_vendor.index.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] };
- common_vendor.index.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);
- common_vendor.index.showToast({
- title: "已删除",
- icon: "none"
- });
- },
- submitForm() {
- if (!this.formData.name) {
- common_vendor.index.showToast({
- title: "请输入姓名",
- icon: "none"
- });
- return;
- }
- if (this.genderIndex === -1) {
- common_vendor.index.showToast({
- title: "请选择性别",
- icon: "none"
- });
- return;
- }
- if (this.formData.gender === "女" && this.threePeriodIndex === -1) {
- common_vendor.index.showToast({
- title: "请选择是否为三期",
- icon: "none"
- });
- return;
- }
- if (!this.formData.emergencyContact) {
- common_vendor.index.showToast({
- title: "请输入紧急联系人",
- icon: "none"
- });
- return;
- }
- if (!this.formData.emergencyPhone) {
- common_vendor.index.showToast({
- title: "请输入紧急联系人电话",
- icon: "none"
- });
- return;
- }
- if (this.familyMembers.length === 0) {
- common_vendor.index.showToast({
- title: "请至少添加一位家庭成员",
- icon: "none"
- });
- return;
- }
- if (this.formData.sourceType === "school" && !this.formData.otherSchoolSource) {
- common_vendor.index.showToast({
- title: "请填写学校来源",
- icon: "none"
- });
- return;
- }
- if (this.formData.sourceType === "social") {
- if (!this.formData.socialSource) {
- common_vendor.index.showToast({
- title: "请选择社招来源",
- icon: "none"
- });
- return;
- }
- if (this.formData.socialSource === "other" && !this.formData.otherSocialSource) {
- common_vendor.index.showToast({
- title: "请填写其他社招来源",
- icon: "none"
- });
- return;
- }
- }
- if (this.educationList.length === 0) {
- common_vendor.index.showToast({
- title: "请至少添加一项教育经历",
- icon: "none"
- });
- return;
- }
- if (this.workList.length === 0) {
- common_vendor.index.showToast({
- title: "请至少添加一项工作经历",
- icon: "none"
- });
- return;
- }
- const submitData = {
- tenant_id: 1,
- user_id: JSON.parse(common_vendor.index.getStorageSync("userInfo")).id,
- // 从存储中获取用户ID
- personal_info: {
- name: this.formData.name,
- gender: this.formData.gender,
- birth_date: this.formData.birthDate,
- phone: this.formData.phone,
- id_card: this.formData.idCard,
- email: this.formData.email,
- address: this.formData.currentAddress,
- professional_skills: this.formData.skills ? this.formData.skills.split(",") : []
- },
- profile: {
- // 女性特殊状态映射
- female_status: this.formData.gender === "女" ? this.formData.threePeriod === "孕期" ? 1 : this.formData.threePeriod === "产期" ? 2 : this.formData.threePeriod === "哺乳期" ? 3 : 0 : 0,
- // 婚姻状况映射
- marital_status: this.formData.marriage === "未婚" ? 0 : this.formData.marriage === "已婚" ? 1 : this.formData.marriage === "离异" ? 2 : this.formData.marriage === "丧偶" ? 3 : 0,
- height: parseFloat(this.formData.height) || 0,
- weight: parseFloat(this.formData.weight) || 0,
- political_status: this.formData.political,
- ethnicity: this.formData.ethnic,
- native_place: this.formData.nativePlace,
- household_location: this.formData.residence,
- current_address: this.formData.currentAddress,
- expected_salary: parseFloat(this.formData.expectedSalary) || 0,
- emergency_contact: this.formData.emergencyContact,
- emergency_phone: this.formData.emergencyPhone,
- specialties: this.formData.hobby,
- life_motto: this.formData.motto,
- // 应聘来源映射
- recruitment_source: this.formData.sourceType === "social" ? this.formData.socialSource === "BOSS" ? 2 : this.formData.socialSource === "zhilian" ? 3 : this.formData.socialSource === "liepin" ? 4 : 5 : 1,
- recruitment_source_detail: this.formData.sourceType === "social" ? this.formData.socialSource === "other" ? this.formData.otherSocialSource : this.formData.socialSource === "BOSS" ? "BOSS直聘" : this.formData.socialSource === "zhilian" ? "智联招聘" : this.formData.socialSource === "liepin" ? "猎聘" : "" : this.formData.otherSchoolSource
- },
- // 教育经历映射
- education: 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
- })),
- // 家庭成员映射
- family_members: this.familyMembers.map((member) => ({
- relation: member.relation,
- name: member.name,
- workplace: member.workplaceOrAddress,
- position: member.position,
- phone: member.phone
- })),
- // 工作经历映射
- work_experiences: 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
- //直属上级电话
- }))
- // 培训经历可以从技能和培训文本框中提取
- /* trainings: this.formData.training ? [{
- training_name: "培训经历",
- description: this.formData.training
- }] : [] */
- };
- console.log("提交的表单数据:", submitData);
- common_vendor.index.showLoading({
- title: "提交中..."
- });
- common_vendor.index.request({
- url: `${common_config.apiBaseUrl}/wechat/user/profile/update`,
- // 根据实际API路径调整
- method: "POST",
- data: submitData,
- success: (res) => {
- common_vendor.index.hideLoading();
- this.formErrors = {
- name: "",
- idCard: "",
- phone: ""
- };
- if (res.data.code === 2e3) {
- this.currentStep++;
- common_vendor.index.navigateTo({
- url: "/pages/interview-notice/interview-notice"
- });
- } else {
- let errorMsg = res.data.msg || "身份验证失败";
- common_vendor.index.showToast({
- title: errorMsg,
- icon: "none",
- duration: 2e3
- });
- }
- },
- fail: (err) => {
- common_vendor.index.hideLoading();
- common_vendor.index.showToast({
- title: "网络错误,请检查网络连接",
- icon: "none"
- });
- console.error("提交失败:", err);
- }
- });
- },
- // 学历映射辅助方法
- mapDegreeToNumber(degreeText) {
- const degreeMap = {
- "高中": 1,
- "中专": 1,
- "大专": 2,
- "本科": 3,
- "硕士": 4,
- "博士": 5
- };
- return degreeMap[degreeText] || 6;
- },
- prevStep() {
- if (this.currentStep > 1) {
- this.currentStep--;
- common_vendor.index.pageScrollTo({
- scrollTop: 0,
- duration: 300
- });
- }
- },
- nextStep() {
- if (!this.validateCurrentStep()) {
- return;
- }
- if (this.currentStep === 1) {
- this.formErrors = {
- name: "",
- idCard: "",
- phone: ""
- };
- common_vendor.index.showLoading({
- title: "身份验证中..."
- });
- common_vendor.index.request({
- url: `${common_config.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) => {
- common_vendor.index.hideLoading();
- if (res.data.code === 200) {
- this.currentStep++;
- common_vendor.index.pageScrollTo({
- scrollTop: 0,
- duration: 300
- });
- } else {
- res.data.msg || "身份验证失败";
- this.formErrors.name = "姓名验证失败,请检查姓名是否正确";
- this.formErrors.idCard = "身份证号验证失败,请检查身份证号是否正确";
- this.formErrors.phone = "手机号验证失败,请检查手机号是否正确";
- }
- },
- fail: (err) => {
- common_vendor.index.hideLoading();
- common_vendor.index.showToast({
- title: "网络错误,请检查网络连接",
- icon: "none",
- duration: 2e3
- });
- console.error("身份验证请求失败:", err);
- }
- });
- } else {
- if (this.currentStep < this.steps.length) {
- this.currentStep++;
- common_vendor.index.pageScrollTo({
- scrollTop: 0,
- duration: 300
- });
- }
- }
- },
- // 验证当前步骤的必填项
- validateCurrentStep() {
- switch (this.currentStep) {
- case 1:
- if (!this.formData.name) {
- common_vendor.index.showToast({
- title: "请输入姓名",
- icon: "none"
- });
- return false;
- }
- if (this.genderIndex === -1) {
- common_vendor.index.showToast({
- title: "请选择性别",
- icon: "none"
- });
- return false;
- }
- if (this.formData.gender === "女" && this.threePeriodIndex === -1) {
- common_vendor.index.showToast({
- title: "请选择是否为三期",
- icon: "none"
- });
- return false;
- }
- return true;
- case 2:
- if (!this.formData.emergencyContact) {
- common_vendor.index.showToast({
- title: "请输入紧急联系人",
- icon: "none"
- });
- return false;
- }
- if (!this.formData.emergencyPhone) {
- common_vendor.index.showToast({
- title: "请输入紧急联系人电话",
- icon: "none"
- });
- return false;
- }
- return true;
- case 3:
- if (this.familyMembers.length === 0) {
- common_vendor.index.showToast({
- title: "请至少添加一位家庭成员",
- icon: "none"
- });
- return false;
- }
- return true;
- case 4:
- if (this.formData.sourceType === "school" && !this.formData.otherSchoolSource) {
- common_vendor.index.showToast({
- title: "请填写学校来源",
- icon: "none"
- });
- return false;
- }
- if (this.formData.sourceType === "social") {
- if (!this.formData.socialSource) {
- common_vendor.index.showToast({
- title: "请选择社招来源",
- icon: "none"
- });
- return false;
- }
- if (this.formData.socialSource === "other" && !this.formData.otherSocialSource) {
- common_vendor.index.showToast({
- title: "请填写其他社招来源",
- icon: "none"
- });
- return false;
- }
- }
- return true;
- case 5:
- if (this.educationList.length === 0) {
- common_vendor.index.showToast({
- title: "请至少添加一项教育经历",
- icon: "none"
- });
- return false;
- }
- return true;
- case 6:
- return true;
- case 7:
- return true;
- case 8:
- if (this.workList.length === 0) {
- common_vendor.index.showToast({
- title: "请至少添加一项工作经历",
- icon: "none"
- });
- return false;
- }
- return true;
- default:
- return true;
- }
- },
- // Add method to fetch user data
- fetchUserData() {
- this.isLoading = true;
- const userInfo = common_vendor.index.getStorageSync("userInfo") ? JSON.parse(common_vendor.index.getStorageSync("userInfo")) : {};
- const openid = userInfo.openid;
- if (!openid) {
- common_vendor.index.showToast({
- title: "用户信息获取失败,请重新登录",
- icon: "none"
- });
- this.isLoading = false;
- return;
- }
- common_vendor.index.request({
- url: `${common_config.apiBaseUrl}/api/wechat/user/get_full_info?tenant_id=1&openid=${openid}`,
- method: "GET",
- success: (res) => {
- this.populateFormData(res.data.data);
- },
- fail: (err) => {
- },
- 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;
- 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 || "";
- }
- if (profile) {
- this.formData.political = profile.political_status || "";
- this.politicalIndex = this.politicalOptions.findIndex((item) => item === this.formData.political);
- this.formData.ethnic = profile.ethnicity || "";
- this.ethnicIndex = this.ethnicOptions.findIndex((item) => item === this.formData.ethnic);
- this.formData.height = profile.height || "";
- this.formData.weight = profile.weight || "";
- this.formData.nativePlace = profile.native_place || "";
- this.formData.residence = profile.household_location || "";
- this.formData.currentAddress = profile.current_address || "";
- this.formData.marriage = profile.marital_status_text || "";
- this.marriageIndex = this.marriageOptions.findIndex((item) => item === this.formData.marriage);
- if (this.formData.gender === "女" && profile.female_status !== void 0) {
- const femaleStatusMap = { 0: "无", 1: "孕期", 2: "产期", 3: "哺乳期" };
- this.formData.threePeriod = femaleStatusMap[profile.female_status] || "无";
- this.threePeriodIndex = this.threePeriodOptions.findIndex((item) => item === this.formData.threePeriod);
- }
- this.formData.expectedSalary = profile.expected_salary || "";
- this.formData.emergencyContact = profile.emergency_contact || "";
- this.formData.emergencyPhone = profile.emergency_phone || "";
- this.formData.hobby = profile.specialties || "";
- this.formData.motto = profile.life_motto || "";
- 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 || "";
- }
- }
- 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] || ""
- };
- });
- }
- 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 || ""
- };
- });
- }
- 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 || ""
- };
- });
- }
- if (user_info && user_info.is_profile_complete) {
- this.showPromiseModal = false;
- }
- }
- },
- // 添加监听器来清除错误信息
- 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 = "";
- }
- }
- }
- };
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
- return common_vendor.e({
- a: $data.isLoading
- }, $data.isLoading ? {} : {}, {
- b: $data.showPromiseModal
- }, $data.showPromiseModal ? {
- c: $data.promiseChecked,
- d: common_vendor.o((...args) => $options.togglePromiseChecked && $options.togglePromiseChecked(...args)),
- e: !$data.promiseChecked,
- f: common_vendor.o((...args) => $options.confirmPromise && $options.confirmPromise(...args))
- } : {}, {
- g: $data.currentStep === 1
- }, $data.currentStep === 1 ? common_vendor.e({
- h: $data.formErrors.name ? 1 : "",
- i: $data.formData.name,
- j: common_vendor.o(($event) => $data.formData.name = $event.detail.value),
- k: $data.formErrors.name
- }, $data.formErrors.name ? {
- l: common_vendor.t($data.formErrors.name)
- } : {}, {
- m: common_vendor.t($data.genderOptions[$data.genderIndex] || "请选择性别"),
- n: common_vendor.o((...args) => $options.bindGenderChange && $options.bindGenderChange(...args)),
- o: $data.genderIndex,
- p: $data.genderOptions,
- q: $data.formData.gender === "女"
- }, $data.formData.gender === "女" ? {
- r: common_vendor.t($data.threePeriodOptions[$data.threePeriodIndex] || "请选择"),
- s: common_vendor.o((...args) => $options.bindThreePeriodChange && $options.bindThreePeriodChange(...args)),
- t: $data.threePeriodIndex,
- v: $data.threePeriodOptions
- } : {}, {
- w: $data.formErrors.phone ? 1 : "",
- x: $data.formData.phone,
- y: common_vendor.o(($event) => $data.formData.phone = $event.detail.value),
- z: $data.formErrors.phone
- }, $data.formErrors.phone ? {
- A: common_vendor.t($data.formErrors.phone)
- } : {}, {
- B: $data.formErrors.idCard ? 1 : "",
- C: $data.formData.idCard,
- D: common_vendor.o(($event) => $data.formData.idCard = $event.detail.value),
- E: $data.formErrors.idCard
- }, $data.formErrors.idCard ? {
- F: common_vendor.t($data.formErrors.idCard)
- } : {}, {
- G: common_vendor.t($data.politicalOptions[$data.politicalIndex] || "请选择政治面貌"),
- H: common_vendor.o((...args) => $options.bindPoliticalChange && $options.bindPoliticalChange(...args)),
- I: $data.politicalIndex,
- J: $data.politicalOptions,
- K: common_vendor.t($data.ethnicOptions[$data.ethnicIndex] || "请选择民族"),
- L: common_vendor.o((...args) => $options.bindEthnicChange && $options.bindEthnicChange(...args)),
- M: $data.ethnicIndex,
- N: $data.ethnicOptions,
- O: $data.formData.height,
- P: common_vendor.o(($event) => $data.formData.height = $event.detail.value),
- Q: $data.formData.weight,
- R: common_vendor.o(($event) => $data.formData.weight = $event.detail.value),
- S: $data.formData.nativePlace,
- T: common_vendor.o(($event) => $data.formData.nativePlace = $event.detail.value),
- U: $data.formData.residence,
- V: common_vendor.o(($event) => $data.formData.residence = $event.detail.value),
- W: common_vendor.t($data.marriageOptions[$data.marriageIndex] || "请选择婚育状况"),
- X: common_vendor.o((...args) => $options.bindMarriageChange && $options.bindMarriageChange(...args)),
- Y: $data.marriageIndex,
- Z: $data.marriageOptions,
- aa: $data.formData.expectedSalary,
- ab: common_vendor.o(($event) => $data.formData.expectedSalary = $event.detail.value)
- }) : {}, {
- ac: $data.currentStep === 2
- }, $data.currentStep === 2 ? {
- ad: $data.formData.email,
- ae: common_vendor.o(($event) => $data.formData.email = $event.detail.value),
- af: $data.formData.currentAddress,
- ag: common_vendor.o(($event) => $data.formData.currentAddress = $event.detail.value),
- ah: $data.formData.emergencyContact,
- ai: common_vendor.o(($event) => $data.formData.emergencyContact = $event.detail.value),
- aj: $data.formData.emergencyPhone,
- ak: common_vendor.o(($event) => $data.formData.emergencyPhone = $event.detail.value),
- al: $data.formData.hobby,
- am: common_vendor.o(($event) => $data.formData.hobby = $event.detail.value),
- an: $data.formData.motto,
- ao: common_vendor.o(($event) => $data.formData.motto = $event.detail.value)
- } : {}, {
- ap: $data.currentStep === 3
- }, $data.currentStep === 3 ? common_vendor.e({
- aq: $data.familyMembers.length > 0
- }, $data.familyMembers.length > 0 ? {
- ar: common_vendor.f($data.familyMembers, (member, index, i0) => {
- return {
- a: common_vendor.t(index + 1),
- b: common_vendor.o(($event) => $options.editFamilyMember(index), index),
- c: common_vendor.o(($event) => $options.deleteFamilyMember(index), index),
- d: common_vendor.t(member.relation),
- e: common_vendor.t(member.name),
- f: common_vendor.t(member.workplaceOrAddress),
- g: common_vendor.t(member.position),
- h: common_vendor.t(member.phone),
- i: index
- };
- })
- } : {}, {
- as: common_vendor.t($data.isEditing ? "编辑家庭成员" : "添加家庭成员"),
- at: $data.isEditing
- }, $data.isEditing ? {
- av: common_vendor.o((...args) => $options.cancelEdit && $options.cancelEdit(...args))
- } : {}, {
- aw: $data.familyMemberForm.relation,
- ax: common_vendor.o(($event) => $data.familyMemberForm.relation = $event.detail.value),
- ay: $data.familyMemberForm.name,
- az: common_vendor.o(($event) => $data.familyMemberForm.name = $event.detail.value),
- aA: $data.familyMemberForm.workplaceOrAddress,
- aB: common_vendor.o(($event) => $data.familyMemberForm.workplaceOrAddress = $event.detail.value),
- aC: $data.familyMemberForm.position,
- aD: common_vendor.o(($event) => $data.familyMemberForm.position = $event.detail.value),
- aE: $data.familyMemberForm.phone,
- aF: common_vendor.o(($event) => $data.familyMemberForm.phone = $event.detail.value),
- aG: common_vendor.t($data.isEditing ? "✓" : "+"),
- aH: common_vendor.o((...args) => $options.saveFamilyMember && $options.saveFamilyMember(...args)),
- aI: common_vendor.t($data.isEditing ? "保存修改" : "添加成员")
- }) : {}, {
- aJ: $data.currentStep === 4
- }, $data.currentStep === 4 ? {
- aK: $data.formData.sourceType === "social" && $data.formData.socialSource === "BOSS",
- aL: common_vendor.o(($event) => $options.selectSocialSource("BOSS")),
- aM: $data.formData.sourceType === "social" && $data.formData.socialSource === "zhilian",
- aN: common_vendor.o(($event) => $options.selectSocialSource("zhilian")),
- aO: $data.formData.sourceType === "social" && $data.formData.socialSource === "liepin",
- aP: common_vendor.o(($event) => $options.selectSocialSource("liepin")),
- aQ: $data.formData.sourceType !== "social" || $data.formData.socialSource !== "other",
- aR: common_vendor.o(($event) => $options.selectSocialSource("other")),
- aS: $data.formData.otherSocialSource,
- aT: common_vendor.o(($event) => $data.formData.otherSocialSource = $event.detail.value)
- } : {}, {
- aU: $data.currentStep === 5
- }, $data.currentStep === 5 ? common_vendor.e({
- aV: $data.educationList.length > 0
- }, $data.educationList.length > 0 ? {
- aW: common_vendor.f($data.educationList, (edu, index, i0) => {
- return {
- a: common_vendor.t(index === 0 ? "第一学历" : "最高学历"),
- b: common_vendor.o(($event) => $options.editEducation(index), index),
- c: common_vendor.o(($event) => $options.deleteEducation(index), index),
- d: common_vendor.t(edu.startTime),
- e: common_vendor.t(edu.endTime),
- f: common_vendor.t(edu.schoolName),
- g: common_vendor.t(edu.major),
- h: common_vendor.t(edu.degree),
- i: index
- };
- })
- } : {}, {
- aX: $data.educationList.length < 2 || $data.isEditingEducation
- }, $data.educationList.length < 2 || $data.isEditingEducation ? common_vendor.e({
- aY: common_vendor.t($data.isEditingEducation ? "编辑教育经历" : $data.educationList.length === 0 ? "添加第一学历" : "添加最高学历"),
- aZ: $data.isEditingEducation
- }, $data.isEditingEducation ? {
- ba: common_vendor.o((...args) => $options.cancelEditEducation && $options.cancelEditEducation(...args))
- } : {}, {
- bb: common_vendor.t($data.educationForm.startTime || "开始时间"),
- bc: $data.educationForm.startTime,
- bd: common_vendor.o((...args) => $options.bindStartTimeChange && $options.bindStartTimeChange(...args)),
- be: common_vendor.t($data.educationForm.endTime || "结束时间"),
- bf: $data.educationForm.endTime,
- bg: common_vendor.o((...args) => $options.bindEndTimeChange && $options.bindEndTimeChange(...args)),
- bh: $data.educationForm.schoolName,
- bi: common_vendor.o(($event) => $data.educationForm.schoolName = $event.detail.value),
- bj: $data.educationForm.major,
- bk: common_vendor.o(($event) => $data.educationForm.major = $event.detail.value),
- bl: common_vendor.t($data.degreeOptions[$data.degreeIndex] || "请选择学历"),
- bm: common_vendor.o((...args) => $options.bindDegreeChange && $options.bindDegreeChange(...args)),
- bn: $data.degreeIndex,
- bo: $data.degreeOptions,
- bp: common_vendor.t($data.isEditingEducation ? "✓" : "+"),
- bq: common_vendor.o((...args) => $options.saveEducation && $options.saveEducation(...args)),
- br: common_vendor.t($data.isEditingEducation ? "保存修改" : "添加学历")
- }) : {}) : {}, {
- bs: $data.currentStep === 6
- }, $data.currentStep === 6 ? {
- bt: $data.formData.skills,
- bv: common_vendor.o(($event) => $data.formData.skills = $event.detail.value)
- } : {}, {
- bw: $data.currentStep === 7
- }, $data.currentStep === 7 ? {
- bx: $data.formData.training,
- by: common_vendor.o(($event) => $data.formData.training = $event.detail.value)
- } : {}, {
- bz: $data.currentStep === 8
- }, $data.currentStep === 8 ? common_vendor.e({
- bA: $data.workList.length > 0
- }, $data.workList.length > 0 ? {
- bB: common_vendor.f($data.workList, (work, index, i0) => {
- return {
- a: common_vendor.t(index + 1),
- b: common_vendor.o(($event) => $options.editWork(index), index),
- c: common_vendor.o(($event) => $options.deleteWork(index), index),
- d: common_vendor.t(work.startTime),
- e: common_vendor.t(work.endTime),
- f: common_vendor.t(work.companyName),
- g: common_vendor.t(work.department),
- h: common_vendor.t(work.employeeCount),
- i: common_vendor.t(work.position),
- j: common_vendor.t(work.monthlySalary),
- k: common_vendor.t(work.supervisor),
- l: common_vendor.t(work.supervisorPhone),
- m: index
- };
- })
- } : {}, {
- bC: $data.workList.length < 2 || $data.isEditingWork
- }, $data.workList.length < 2 || $data.isEditingWork ? common_vendor.e({
- bD: common_vendor.t($data.isEditingWork ? "编辑工作经历" : "添加工作经历"),
- bE: $data.isEditingWork
- }, $data.isEditingWork ? {
- bF: common_vendor.o((...args) => $options.cancelEditWork && $options.cancelEditWork(...args))
- } : {}, {
- bG: common_vendor.t($data.workForm.startTime || "开始时间"),
- bH: $data.workForm.startTime,
- bI: common_vendor.o((...args) => $options.bindWorkStartTimeChange && $options.bindWorkStartTimeChange(...args)),
- bJ: common_vendor.t($data.workForm.endTime || "结束时间"),
- bK: $data.workForm.endTime,
- bL: common_vendor.o((...args) => $options.bindWorkEndTimeChange && $options.bindWorkEndTimeChange(...args)),
- bM: $data.workForm.companyName,
- bN: common_vendor.o(($event) => $data.workForm.companyName = $event.detail.value),
- bO: $data.workForm.employeeCount,
- bP: common_vendor.o(($event) => $data.workForm.employeeCount = $event.detail.value),
- bQ: $data.workForm.department,
- bR: common_vendor.o(($event) => $data.workForm.department = $event.detail.value),
- bS: $data.workForm.position,
- bT: common_vendor.o(($event) => $data.workForm.position = $event.detail.value),
- bU: $data.workForm.monthlySalary,
- bV: common_vendor.o(($event) => $data.workForm.monthlySalary = $event.detail.value),
- bW: $data.workForm.supervisor,
- bX: common_vendor.o(($event) => $data.workForm.supervisor = $event.detail.value),
- bY: $data.workForm.supervisorPhone,
- bZ: common_vendor.o(($event) => $data.workForm.supervisorPhone = $event.detail.value),
- ca: common_vendor.t($data.isEditingWork ? "✓" : "+"),
- cb: common_vendor.o((...args) => $options.saveWork && $options.saveWork(...args)),
- cc: common_vendor.t($data.isEditingWork ? "保存修改" : "添加工作经历")
- }) : {}) : {}, {
- cd: $data.currentStep === 9
- }, $data.currentStep === 9 ? {
- ce: common_vendor.t($data.formData.name),
- cf: common_vendor.t($data.formData.gender)
- } : {}, {
- cg: $data.currentStep > 1
- }, $data.currentStep > 1 ? {
- ch: common_vendor.o((...args) => $options.prevStep && $options.prevStep(...args))
- } : {}, {
- ci: $data.currentStep < $data.steps.length
- }, $data.currentStep < $data.steps.length ? {
- cj: common_vendor.o((...args) => $options.nextStep && $options.nextStep(...args))
- } : {}, {
- ck: $data.currentStep === $data.steps.length
- }, $data.currentStep === $data.steps.length ? {
- cl: common_vendor.o((...args) => $options.submitForm && $options.submitForm(...args))
- } : {});
- }
- const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
- wx.createPage(MiniProgramPage);
|