"use strict"; const common_vendor = require("../../common/vendor.js"); const common_assets = require("../../common/assets.js"); const api_student = require("../../api/student.js"); const _sfc_main = { __name: "resume_view", setup(__props) { const studentData = common_vendor.ref({ name: "", mobile: "", email: "", gender: "", genderLabel: "", idCardNumber: "", avatarUrl: "", schoolName: "", education: "", educationLabel: "", availabilityLabel: "", jobType: "", jobTypeLabel: "", availability: "", jobIntention: "", educationList: [], experienceList: [], projectList: [] }); const isLoading = common_vendor.ref(true); const educationMap = { "1": "初中及以下", "2": "高中/中专", "3": "大专", "4": "本科", "5": "硕士", "6": "博士" }; const jobTypeMap = { "1": "全职", "2": "实习", "3": "兼职" }; const genderMap = { "0": "男", "1": "女", "2": "未知" }; const normalizeGenderValue = (value) => { if (value === void 0 || value === null || value === "") return ""; const gender = String(value).trim().toUpperCase(); if (gender === "M") return "0"; if (gender === "F") return "1"; return gender; }; const educationLabel = common_vendor.computed(() => { if (studentData.value.educationList && studentData.value.educationList.length > 0) { const educationLevel = { "初中及以下": 1, "高中": 2, "中专": 2, "大专": 3, "本科": 4, "硕士": 5, "博士": 6 }; let highestEdu = studentData.value.educationList[0]; let maxLevel = educationLevel[highestEdu.education] || 0; for (const edu of studentData.value.educationList) { const level = educationLevel[edu.education] || 0; if (level > maxLevel) { maxLevel = level; highestEdu = edu; } } const label = highestEdu.education || ""; return label + (highestEdu.educationType ? " · " + highestEdu.educationType : ""); } if (studentData.value.educationLabel) return studentData.value.educationLabel; const val = studentData.value.education; if (!val || val === "0" || val === 0) return ""; return educationMap[val] || (/^\d+$/.test(String(val)) ? "" : val); }); const jobTypeLabel = common_vendor.computed(() => { if (studentData.value.jobTypeLabel) return studentData.value.jobTypeLabel; const val = studentData.value.jobType; if (!val) return ""; return jobTypeMap[val] || val; }); const availabilityLabel = common_vendor.computed(() => { return studentData.value.availabilityLabel || studentData.value.availability || ""; }); const genderLabel = common_vendor.computed(() => { if (studentData.value.genderLabel) return studentData.value.genderLabel; const g = normalizeGenderValue(studentData.value.gender); if (!g) return ""; return genderMap[g] || g; }); const jobIntentions = common_vendor.computed(() => { if (!studentData.value.jobIntention) return []; const items = studentData.value.jobIntention.split(",").filter((item) => item.trim()); const intentionMap = { "1": "审计", "2": "咨询", "3": "税务", "4": "财务", "5": "评估" }; return items.map((item) => intentionMap[item.trim()] || item.trim()); }); const birthDate = common_vendor.computed(() => { if (!studentData.value.idCardNumber || studentData.value.idCardNumber.length < 14) return ""; const year = studentData.value.idCardNumber.substring(6, 10); const month = studentData.value.idCardNumber.substring(10, 12); const day = studentData.value.idCardNumber.substring(12, 14); return `${year}-${month}-${day}`; }); const workYears = common_vendor.computed(() => { if (!studentData.value.experienceList || studentData.value.experienceList.length === 0) return 0; let totalMonths = 0; studentData.value.experienceList.forEach((exp) => { if (exp.startTime && exp.endTime) { const start = new Date(exp.startTime); const end = exp.endTime === "至今" ? /* @__PURE__ */ new Date() : new Date(exp.endTime); const months = (end.getFullYear() - start.getFullYear()) * 12 + (end.getMonth() - start.getMonth()); totalMonths += months; } }); return Math.floor(totalMonths / 12); }); const hasPersonalInfo = common_vendor.computed(() => { return studentData.value.gender || birthDate.value || educationLabel.value || studentData.value.schoolName; }); const maskPhone = (phone) => { if (!phone || phone.length < 11) return phone; return phone.substring(0, 3) + "****" + phone.substring(7); }; const formatTimeRange = (start, end) => { if (!start) return ""; const formatDate = (dateStr) => { if (!dateStr) return ""; if (dateStr === "至今") return "至今"; const date = new Date(dateStr); return `${date.getFullYear()}.${String(date.getMonth() + 1).padStart(2, "0")}`; }; return `${formatDate(start)} - ${formatDate(end) || "至今"}`; }; const getEducationLabel = (education) => { return educationMap[education] || education || ""; }; const handleEditResume = () => { common_vendor.index.navigateTo({ url: "/pages/profile/profile?editMode=1" }); }; const fetchResumeData = async () => { const userInfo = common_vendor.index.getStorageSync("userInfo"); if (!userInfo || !userInfo.studentId) { common_vendor.index.showToast({ title: "请先登录", icon: "none" }); setTimeout(() => { common_vendor.index.reLaunch({ url: "/pages/login/login" }); }, 1500); return; } try { isLoading.value = true; const res = await api_student.getStudent(userInfo.studentId); if (res && res.data) { studentData.value = { ...studentData.value, ...res.data, educationList: res.data.educationList || [], experienceList: res.data.experienceList || [], projectList: res.data.projectList || [] }; } else { common_vendor.index.showToast({ title: "获取简历数据失败", icon: "none" }); } } catch (err) { common_vendor.index.__f__("error", "at pages/my/resume_view.vue:314", "获取简历数据异常", err); common_vendor.index.showToast({ title: "网络异常,请重试", icon: "none" }); } finally { isLoading.value = false; common_vendor.index.hideLoading(); } }; common_vendor.onMounted(() => { fetchResumeData(); }); common_vendor.onShow(() => { fetchResumeData(); }); return (_ctx, _cache) => { return common_vendor.e({ a: isLoading.value }, isLoading.value ? {} : common_vendor.e({ b: common_vendor.t(studentData.value.name || "加载中..."), c: jobTypeLabel.value && availabilityLabel.value }, jobTypeLabel.value && availabilityLabel.value ? { d: common_vendor.t(jobTypeLabel.value), e: common_vendor.t(availabilityLabel.value) } : {}, { f: workYears.value || studentData.value.education || studentData.value.schoolName }, workYears.value || studentData.value.education || studentData.value.schoolName ? common_vendor.e({ g: workYears.value }, workYears.value ? { h: common_vendor.t(workYears.value) } : {}, { i: workYears.value && educationLabel.value }, workYears.value && educationLabel.value ? {} : {}, { j: educationLabel.value }, educationLabel.value ? { k: common_vendor.t(educationLabel.value) } : {}, { l: (workYears.value || educationLabel.value) && studentData.value.schoolName }, (workYears.value || educationLabel.value) && studentData.value.schoolName ? {} : {}, { m: studentData.value.schoolName }, studentData.value.schoolName ? { n: common_vendor.t(studentData.value.schoolName) } : {}) : {}, { o: studentData.value.avatarUrl || "/static/images/hr_avatar.svg", p: studentData.value.mobile }, studentData.value.mobile ? { q: common_assets._imports_0$12, r: common_vendor.t(maskPhone(studentData.value.mobile)) } : {}, { s: studentData.value.email }, studentData.value.email ? { t: common_assets._imports_1$4, v: common_vendor.t(studentData.value.email) } : {}, { w: hasPersonalInfo.value }, hasPersonalInfo.value ? common_vendor.e({ x: studentData.value.gender }, studentData.value.gender ? { y: common_vendor.t(genderLabel.value) } : {}, { z: birthDate.value }, birthDate.value ? { A: common_vendor.t(birthDate.value) } : {}, { B: educationLabel.value }, educationLabel.value ? { C: common_vendor.t(educationLabel.value) } : {}, { D: studentData.value.schoolName }, studentData.value.schoolName ? { E: common_vendor.t(studentData.value.schoolName) } : {}) : {}, { F: jobIntentions.value.length > 0 }, jobIntentions.value.length > 0 ? { G: common_vendor.f(jobIntentions.value, (intent, idx, i0) => { return { a: common_vendor.t(intent), b: idx }; }) } : {}, { H: studentData.value.experienceList && studentData.value.experienceList.length > 0 }, studentData.value.experienceList && studentData.value.experienceList.length > 0 ? { I: common_vendor.f(studentData.value.experienceList, (exp, idx, i0) => { return common_vendor.e({ a: common_vendor.t(formatTimeRange(exp.startTime, exp.endTime)), b: common_vendor.t(exp.isHidden === 1 ? "***(已屏蔽)" : exp.company), c: common_vendor.t(exp.jobTitle), d: exp.isInternship === 1 }, exp.isInternship === 1 ? {} : {}, { e: exp.workContent }, exp.workContent ? { f: common_vendor.t(exp.workContent) } : {}, { g: exp.id || idx }); }) } : {}, { J: studentData.value.projectList && studentData.value.projectList.length > 0 }, studentData.value.projectList && studentData.value.projectList.length > 0 ? { K: common_vendor.f(studentData.value.projectList, (proj, idx, i0) => { return common_vendor.e({ a: common_vendor.t(proj.projectName), b: common_vendor.t(formatTimeRange(proj.startTime, proj.endTime)), c: proj.role }, proj.role ? { d: common_vendor.t(proj.role) } : {}, { e: proj.description }, proj.description ? { f: common_vendor.t(proj.description) } : {}, { g: proj.achievement }, proj.achievement ? { h: common_vendor.t(proj.achievement) } : {}, { i: proj.id || idx }); }) } : {}, { L: studentData.value.educationList && studentData.value.educationList.length > 0 }, studentData.value.educationList && studentData.value.educationList.length > 0 ? { M: common_vendor.f(studentData.value.educationList, (edu, idx, i0) => { return common_vendor.e({ a: common_vendor.t(edu.school), b: common_vendor.t(formatTimeRange(edu.startTime, edu.endTime)), c: edu.major }, edu.major ? { d: common_vendor.t(edu.major) } : {}, { e: edu.major && (edu.education || edu.educationType) }, edu.major && (edu.education || edu.educationType) ? {} : {}, { f: edu.education }, edu.education ? { g: common_vendor.t(getEducationLabel(edu.education)) } : {}, { h: edu.education && edu.educationType }, edu.education && edu.educationType ? {} : {}, { i: edu.educationType }, edu.educationType ? { j: common_vendor.t(edu.educationType) } : {}, { k: edu.campusExperience }, edu.campusExperience ? { l: common_vendor.t(edu.campusExperience) } : {}, { m: edu.id || idx }); }) } : {}), { N: common_vendor.o(handleEditResume) }); }; } }; const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-1763c966"]]); wx.createPage(MiniProgramPage); //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/my/resume_view.js.map