| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226 |
- "use strict";
- const common_vendor = require("../../common/vendor.js");
- const api_student = require("../../api/student.js");
- const api_studentEducation = require("../../api/studentEducation.js");
- const api_studentExperience = require("../../api/studentExperience.js");
- const api_studentProject = require("../../api/studentProject.js");
- const common_assets = require("../../common/assets.js");
- const StepLayout = () => "../../components/step-layout/step-layout.js";
- const _sfc_main = {
- components: {
- StepLayout
- },
- setup() {
- const educationList = common_vendor.ref([]);
- const workList = common_vendor.ref([]);
- const projectList = common_vendor.ref([]);
- const isEditMode = common_vendor.ref(false);
- const loadData = async () => {
- const userInfo = common_vendor.index.getStorageSync("userInfo");
- const studentId = userInfo ? userInfo.studentId : null;
- if (!studentId)
- return;
- try {
- const res = await api_student.getStudent(studentId);
- if (res.code === 200 && res.data) {
- educationList.value = res.data.educationList || [];
- workList.value = res.data.experienceList || [];
- projectList.value = res.data.projectList || [];
- }
- } catch (err) {
- common_vendor.index.__f__("error", "at pages/experience/experience.js:32", "加载经历失败", err);
- }
- };
- common_vendor.onMounted(() => {
- const options = getCurrentPages()[getCurrentPages().length - 1].options;
- if (options && options.editMode === "1") {
- isEditMode.value = true;
- }
- loadData();
- common_vendor.index.$on("refresh_experience", () => {
- loadData();
- });
- });
- common_vendor.onUnmounted(() => {
- common_vendor.index.$off("refresh_experience");
- });
- const showModal = common_vendor.ref(false);
- const modalContent = common_vendor.ref("");
- let currentDeleteType = "";
- let currentDeleteId = null;
- const openModal = (type, content, id) => {
- currentDeleteType = type;
- modalContent.value = content;
- currentDeleteId = id;
- showModal.value = true;
- };
- const closeModal = () => {
- showModal.value = false;
- };
- const confirmDelete = async () => {
- common_vendor.index.showLoading({ title: "删除中..." });
- try {
- if (currentDeleteType === "education") {
- await api_studentEducation.delStudentEducation(currentDeleteId);
- } else if (currentDeleteType === "work") {
- await api_studentExperience.delStudentExperience(currentDeleteId);
- } else if (currentDeleteType === "project") {
- await api_studentProject.delStudentProject(currentDeleteId);
- }
- common_vendor.index.showToast({ title: "删除成功", icon: "success" });
- loadData();
- } catch (err) {
- common_vendor.index.showToast({ title: "删除失败", icon: "none" });
- } finally {
- closeModal();
- common_vendor.index.hideLoading();
- }
- };
- const addEducation = () => {
- common_vendor.index.navigateTo({ url: "/pages/experience/add-education" });
- };
- const editEducation = (i) => {
- common_vendor.index.setStorageSync("edit_data_education", educationList.value[i]);
- common_vendor.index.navigateTo({ url: "/pages/experience/add-education?index=" + i });
- };
- const deleteEducation = (i) => {
- openModal("education", "确定要删除这段教育经历吗?", educationList.value[i].id);
- };
- const addWork = () => {
- common_vendor.index.navigateTo({ url: "/pages/experience/add-work" });
- };
- const editWork = (i) => {
- common_vendor.index.setStorageSync("edit_data_work", workList.value[i]);
- common_vendor.index.navigateTo({ url: "/pages/experience/add-work?index=" + i });
- };
- const deleteWork = (i) => {
- openModal("work", "确定要删除这段工作经历吗?", workList.value[i].id);
- };
- const addProject = () => {
- common_vendor.index.navigateTo({ url: "/pages/experience/add-project" });
- };
- const editProject = (i) => {
- common_vendor.index.setStorageSync("edit_data_project", projectList.value[i]);
- common_vendor.index.navigateTo({ url: "/pages/experience/add-project?index=" + i });
- };
- const deleteProject = (i) => {
- openModal("project", "确定要删除这段项目经历吗?", projectList.value[i].id);
- };
- const goNext = () => {
- const url = isEditMode.value ? "/pages/intention/intention?editMode=1" : "/pages/intention/intention";
- common_vendor.index.navigateTo({ url });
- };
- const goSkip = () => {
- const url = isEditMode.value ? "/pages/intention/intention?editMode=1" : "/pages/intention/intention";
- common_vendor.index.navigateTo({ url });
- };
- return {
- educationList,
- workList,
- projectList,
- showModal,
- modalContent,
- closeModal,
- confirmDelete,
- addEducation,
- editEducation,
- deleteEducation,
- addWork,
- editWork,
- deleteWork,
- addProject,
- editProject,
- deleteProject,
- goNext,
- goSkip,
- isEditMode
- };
- }
- };
- if (!Array) {
- const _easycom_step_layout2 = common_vendor.resolveComponent("step-layout");
- _easycom_step_layout2();
- }
- const _easycom_step_layout = () => "../../components/step-layout/step-layout.js";
- if (!Math) {
- _easycom_step_layout();
- }
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
- return common_vendor.e({
- a: common_vendor.o((...args) => _ctx.addEducation && _ctx.addEducation(...args)),
- b: _ctx.educationList.length === 0
- }, _ctx.educationList.length === 0 ? {
- c: common_assets._imports_0$1
- } : {}, {
- d: common_vendor.f(_ctx.educationList, (item, index, i0) => {
- return common_vendor.e({
- a: common_vendor.o(($event) => _ctx.deleteEducation(index), index),
- b: common_vendor.t(item.school),
- c: common_vendor.t(item.education || item.degree || ""),
- d: common_vendor.t((item.education || item.degree) && item.educationType ? "·" : ""),
- e: common_vendor.t(item.educationType || ""),
- f: common_vendor.t((item.education || item.degree || item.educationType) && item.major ? "·" : ""),
- g: common_vendor.t(item.major || ""),
- h: item.time || item.startTime
- }, item.time || item.startTime ? {
- i: common_vendor.t(item.startTime ? item.startTime + "—" + (item.endTime ? item.endTime : "至今") : item.time)
- } : {}, {
- j: index,
- k: common_vendor.o(($event) => _ctx.editEducation(index), index)
- });
- }),
- e: common_vendor.o((...args) => _ctx.addWork && _ctx.addWork(...args)),
- f: _ctx.workList.length === 0
- }, _ctx.workList.length === 0 ? {
- g: common_assets._imports_0$1
- } : {}, {
- h: common_vendor.f(_ctx.workList, (item, index, i0) => {
- return common_vendor.e({
- a: common_vendor.o(($event) => _ctx.deleteWork(index), index),
- b: common_vendor.t(item.company),
- c: item.isHidden === 1 || item.isHidden === true
- }, item.isHidden === 1 || item.isHidden === true ? {} : {}, {
- d: common_vendor.t(item.positionName || item.position || "工作经历"),
- e: item.time || item.startTime
- }, item.time || item.startTime ? {
- f: common_vendor.t(item.startTime ? item.startTime + "—" + (item.endTime ? item.endTime : "至今") : item.time)
- } : {}, {
- g: index,
- h: common_vendor.o(($event) => _ctx.editWork(index), index)
- });
- }),
- i: common_vendor.o((...args) => _ctx.addProject && _ctx.addProject(...args)),
- j: _ctx.projectList.length === 0
- }, _ctx.projectList.length === 0 ? {
- k: common_assets._imports_0$1
- } : {}, {
- l: common_vendor.f(_ctx.projectList, (item, index, i0) => {
- return common_vendor.e({
- a: common_vendor.o(($event) => _ctx.deleteProject(index), index),
- b: common_vendor.t(item.name),
- c: common_vendor.t(item.role || "项目经历"),
- d: item.time || item.startTime
- }, item.time || item.startTime ? {
- e: common_vendor.t(item.startTime ? item.startTime + "—" + (item.endTime ? item.endTime : "至今") : item.time)
- } : {}, {
- f: common_vendor.t(item.desc),
- g: index,
- h: common_vendor.o(($event) => _ctx.editProject(index), index)
- });
- }),
- m: common_vendor.o((...args) => _ctx.closeModal && _ctx.closeModal(...args)),
- n: common_vendor.t(_ctx.modalContent),
- o: common_vendor.o((...args) => _ctx.closeModal && _ctx.closeModal(...args)),
- p: common_vendor.o((...args) => _ctx.confirmDelete && _ctx.confirmDelete(...args)),
- q: _ctx.showModal ? 1 : "",
- r: common_vendor.o(_ctx.goNext),
- s: common_vendor.o(_ctx.goSkip),
- t: common_vendor.p({
- title: "填写工作经历",
- showSkip: !_ctx.isEditMode
- })
- });
- }
- const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-5164d016"]]);
- wx.createPage(MiniProgramPage);
- //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/experience/experience.js.map
|