| 1 |
- "use strict";const e=require("../../common/vendor.js"),t=require("../../api/studentExperience.js"),n={setup(){const n=e.ref({company:"",industry:"",startTime:"",endTime:"",positionName:"",department:"",content:"",isIntern:!1,isHidden:!1}),i=e.computed((()=>!!(n.value.company&&n.value.industry&&n.value.startTime&&n.value.positionName&&n.value.content))),o=e.ref(-1),a=e.computed((()=>-1!==o.value));e.onLoad((t=>{if(t&&void 0!==t.index){o.value=parseInt(t.index);const i=e.index.getStorageSync("edit_data_work");i&&(n.value={id:i.id,company:i.company||"",industry:i.industry||"",startTime:i.startTime||"",endTime:i.endTime||"",positionName:i.jobTitle||i.positionName||"",department:i.department||"",content:i.workContent||i.content||"",isIntern:1===i.isInternship||i.isIntern||!1,isHidden:!!i.isHidden})}e.index.setNavigationBarTitle({title:a.value?"修改工作经历":"添加工作经历"}),e.index.$on("select_industry",(e=>{n.value.industry=e})),e.index.$on("select_position",(e=>{n.value.positionName=e}))}));const r=[],s=[],d=(new Date).getFullYear();for(let e=1990;e<=d+10;e++)r.push(e+"年");for(let e=1;e<=12;e++)s.push((e<10?"0"+e:e)+"月");const c=e.ref(!1),l=e.ref("start"),u=e.ref([d-1990,0]),m=e.ref(""),p=e.ref(""),v=e=>{l.value=e;const t="start"===e?m.value:p.value;if(t&&"至今"!==t){const e=t.split(".");let n=r.indexOf(e[0]+"年"),i=s.indexOf(e[1]+"月");-1===n&&(n=d-1990),-1===i&&(i=0),u.value=[n,i]}else u.value=[d-1990,0],"start"!==e||m.value||(m.value=`${d}.01`)};return{form:n,isComplete:i,isEdit:a,goBack:()=>{e.index.navigateBack()},openIndustrySelector:()=>{const t=n.value.industry?encodeURIComponent(n.value.industry):"";e.index.navigateTo({url:`/pages/experience/industry-select?selected=${t}`})},openPositionSelector:()=>{const t=n.value.positionName?encodeURIComponent(n.value.positionName):"";e.index.navigateTo({url:`/pages/experience/position-select?selected=${t}`})},showDatePicker:c,datePickerType:l,datePickerValue:u,yearOptions:r,monthOptions:s,tempStartTime:m,tempEndTime:p,openDatePicker:e=>{m.value=n.value.startTime,p.value=n.value.endTime,c.value=!0,v(e)},closeDatePicker:()=>{c.value=!1},switchDateTab:v,onDatePickerChange:e=>{u.value=e.detail.value;const t=void 0!==u.value[0]?u.value[0]:d-1990,n=void 0!==u.value[1]?u.value[1]:0,i=`${r[t].replace("年","")}.${s[n].replace("月","")}`;"start"===l.value?m.value=i:p.value=i},confirmDatePicker:()=>{n.value.startTime=m.value,n.value.endTime=p.value,c.value=!1},saveForm:async()=>{if(i.value){e.index.showLoading({title:"保存中..."});try{const i=e.index.getStorageSync("userInfo"),o=i?i.studentId:null;if(!o)return e.index.hideLoading(),void e.index.showToast({title:"登录失效,请重新登录",icon:"none"});const r={studentId:o,company:n.value.company,industry:n.value.industry,jobTitle:n.value.positionName,department:n.value.department,startTime:n.value.startTime,endTime:n.value.endTime,workContent:n.value.content,isInternship:n.value.isIntern?1:0,isHidden:n.value.isHidden?1:0};if(a.value){r.id=n.value.id;const i=await t.updateStudentExperience(r);e.index.hideLoading(),200===i.code?(e.index.showToast({title:"修改成功",icon:"success"}),e.index.removeStorageSync("edit_data_work"),setTimeout((()=>{e.index.$emit("refresh_experience"),e.index.navigateBack()}),1e3)):e.index.showToast({title:i.msg||"修改失败",icon:"none"})}else{const n=await t.addStudentExperience(r);e.index.hideLoading(),200===n.code?(e.index.showToast({title:"添加成功",icon:"success"}),setTimeout((()=>{e.index.$emit("refresh_experience"),e.index.navigateBack()}),1e3)):e.index.showToast({title:n.msg||"添加失败",icon:"none"})}}catch(o){e.index.hideLoading(),e.index.showToast({title:"网络异常,保存失败",icon:"none"}),console.error(o)}}}}}};const i=e._export_sfc(n,[["render",function(t,n,i,o,a,r){return e.e({a:!t.form.company},(t.form.company,{}),{b:t.form.company,c:e.o((e=>t.form.company=e.detail.value)),d:e.t(t.form.industry||"请选择"),e:e.n(t.form.industry?"":"is-empty"),f:e.o(((...e)=>t.openIndustrySelector&&t.openIndustrySelector(...e))),g:e.t(t.form.startTime||"入职时间"),h:e.n(t.form.startTime?"":"is-empty"),i:e.o((e=>t.openDatePicker("start"))),j:e.t(t.form.endTime||"至今"),k:e.n(t.form.endTime?"":"is-empty"),l:e.o((e=>t.openDatePicker("end"))),m:e.t(t.form.positionName||"请选择"),n:e.n(t.form.positionName?"":"is-empty"),o:e.o(((...e)=>t.openPositionSelector&&t.openPositionSelector(...e))),p:t.form.department,q:e.o((e=>t.form.department=e.detail.value)),r:t.form.content,s:e.o((e=>t.form.content=e.detail.value)),t:t.form.isIntern,v:e.o((e=>t.form.isIntern=e.detail.value)),w:t.form.isHidden,x:e.o((e=>t.form.isHidden=e.detail.value)),y:t.isEdit},(t.isEdit,{}),{z:t.isComplete?"":1,A:e.o(((...e)=>t.saveForm&&t.saveForm(...e))),B:t.showDatePicker},t.showDatePicker?{C:e.o(((...e)=>t.closeDatePicker&&t.closeDatePicker(...e))),D:e.t(t.tempStartTime||"请选择"),E:e.n("start"===t.datePickerType?"active":""),F:e.o((e=>t.switchDateTab("start"))),G:e.t(t.tempEndTime||"至今"),H:e.n("end"===t.datePickerType?"active":""),I:e.o((e=>t.switchDateTab("end"))),J:e.f(t.yearOptions,((t,n,i)=>({a:e.t(t),b:n}))),K:e.f(t.monthOptions,((t,n,i)=>({a:e.t(t),b:n}))),L:t.datePickerValue,M:e.o(((...e)=>t.onDatePickerChange&&t.onDatePickerChange(...e))),N:e.o(((...e)=>t.confirmDatePicker&&t.confirmDatePicker(...e))),O:e.o((()=>{}))}:{})}],["__scopeId","data-v-33c1c87e"]]);wx.createPage(i);
|