| 1 |
- "use strict";const e=require("../../common/vendor.js"),t=require("../../common/assets.js"),a=require("../../api/position.js"),i=require("../../api/dict.js");Math||l();const l=()=>"../../components/custom-tabbar/custom-tabbar.js",n={__name:"jobs",setup(l){const n=()=>{const t=e.index.getStorageSync("userInfo");if(!t)return null;const a=t.id||t.studentId||null;return console.log("[getStudentId] userInfo:",JSON.stringify(t),"=> id:",a),a},r=e.ref(20),o=e.ref(8),u=e.ref(32),s=e.ref(""),v=e.ref("comprehensive"),c=e.ref(0),d=e.ref(["全部"]),m=e.ref([""]),p=e.ref([]),g=e.ref(1),f=e.ref(10),y=e.ref(!0),h=e.ref(!1),w=e.ref(!1),x=e.ref(null),k=()=>{w.value=!1},S=e.ref({jobType:"",minSalary:0,maxSalary:50,experience:"",education:"",workCity:"",workProvince:"",workDistrict:""}),_=e.computed((()=>{let e=0;return S.value.experience&&e++,S.value.education&&e++,(S.value.minSalary>0||S.value.maxSalary<50)&&e++,S.value.workCity&&e++,S.value.workDistrict&&e++,e})),b=(e=!1)=>{if(h.value)return;if(e&&(g.value=1,y.value=!0,p.value=[]),!y.value)return;h.value=!0;let t=m.value[c.value]||"";!t&&S.value.jobType&&(t=S.value.jobType);const i={pageNum:g.value,pageSize:f.value,postName:s.value.trim(),postType:t,schoolRequirement:S.value.education||"",gradeRequirement:S.value.experience||"",minSalary:S.value.minSalary,maxSalary:S.value.maxSalary,workCity:S.value.workCity||"",workProvince:S.value.workProvince||"",workDistrict:S.value.workDistrict||""},l=n();l&&(i.studentId=l),"latest"===v.value&&(i.orderByColumn="createTime",i.isAsc="desc"),a.getPositionList(i).then((t=>{if(200===t.code){const a=t.rows||[];let i=a.map((e=>({id:e.id,title:e.postName,salaryText:e.salaryRange||"面议",tags:[e.workCity+(e.workDistrict?" "+e.workDistrict:""),e.educationRequirementLabel||e.educationRequirement,e.gradeRequirementLabel||e.gradeRequirement].filter(Boolean),isUrgent:1===e.isUrgent,count:e.recruitNum||1,deadline:e.registrationEndDate?e.registrationEndDate.split(" ")[0]:"长期有效",isExpiring:!1,company:e.companyName||"平台推荐",rawTenantId:e.tenantId,location:(e.workProvince||"")+(e.workCity?"·"+e.workCity:"")+(e.workDistrict?" "+e.workDistrict:""),logo:e.companyAvatar||"/static/images/default-company.svg"})));p.value=e?i:[...p.value,...i],p.value.length>=t.total||a.length<f.value?y.value=i.length>=f.value:g.value++}})).finally((()=>{h.value=!1}))},T=()=>{b(!1)},D=()=>{b(!0)},I=()=>{if(s.value.trim()){let t=e.index.getStorageSync("search_history");t=t?JSON.parse(t):[],t=t.filter((e=>e!==s.value.trim())),t.unshift(s.value.trim()),t.length>10&&(t=t.slice(0,10)),e.index.setStorageSync("search_history",JSON.stringify(t))}b(!0)};e.watch([c,v],(()=>{b(!0)}));const j=()=>{e.index.navigateTo({url:"/pages/jobs/filter"})},R=e.computed((()=>{const e=o.value+u.value+8;return r.value+e+82}));return e.onPullDownRefresh((async()=>{await b(!0),e.index.stopPullDownRefresh()})),e.onShow((()=>{b(!0)})),e.onMounted((()=>{e.index.$on("updateFilters",(e=>{S.value=e,void 0!==e.keyword&&(s.value=e.keyword),b(!0)})),i.getDicts("main_position_type").then((e=>{e.data&&e.data.length>0?(d.value=["全部岗位",...e.data.map((e=>e.dictLabel))],m.value=["",...e.data.map((e=>e.dictValue))]):(d.value=["全部岗位","全职","实习","兼职"],m.value=["","0","1","2"])}));try{const t=e.index.getSystemInfoSync(),a=e.index.getMenuButtonBoundingClientRect();t&&a&&(r.value=t.statusBarHeight||20,o.value=a.top-t.statusBarHeight,u.value=a.height)}catch(t){}})),e.onUnmounted((()=>{e.index.$off("updateFilters")})),e.onPullDownRefresh((async()=>{b(!0),setTimeout((()=>{e.index.stopPullDownRefresh()}),800)})),(i,l)=>e.e({a:t._imports_0$3,b:e.o(I),c:e.o([e=>s.value=e.detail.value,D]),d:s.value,e:u.value+"px",f:r.value+o.value+"px",g:e.f(d.value,((t,a,i)=>({a:e.t(t),b:c.value===a?1:"",c:a,d:e.o((e=>c.value=a),a)}))),h:e.t(_.value>0?"· "+_.value:""),i:e.o(j),j:"comprehensive"===v.value?1:"",k:e.o((e=>v.value="comprehensive")),l:"latest"===v.value?1:"",m:e.o((e=>v.value="latest")),n:h.value&&0===p.value.length},h.value&&0===p.value.length?{}:e.e({o:e.f(p.value,((t,a,i)=>e.e({a:e.t(t.title),b:t.isUrgent},(t.isUrgent,{}),{c:e.t(t.salaryText),d:e.f(t.tags,((t,a,i)=>({a:e.t(t),b:a}))),e:e.t(t.count),f:e.t(t.deadline),g:t.isExpiring},(t.isExpiring,{}),{h:t.logo,i:e.t(t.company),j:e.t(t.location),k:e.o((e=>{return a=t,x.value=a,void(w.value=!0);var a}),t.id||a),l:t.id||a,m:0===a?1:"",n:e.o((a=>(t=>{e.index.navigateTo({url:"/pages/jobdetail/index?id="+t.id})})(t)),t.id||a)}))),p:t._imports_0$2,q:t._imports_1$1,r:t._imports_2$1,s:t._imports_3$1,t:0===p.value.length},(p.value.length,{}),{v:p.value.length>0&&!y.value},(p.value.length>0&&y.value,{}),{w:R.value+"px",x:e.o(T)}),{y:e.p({activeIndex:0}),z:w.value},w.value?{A:t._imports_3$1,B:e.o(k),C:e.o((t=>(()=>{if(!x.value)return;const t=n(),i=x.value;k(),p.value=p.value.filter((e=>e.id!==i.id)),t&&a.dislikePosition(t,i.id).catch((()=>{})),e.index.showToast({title:"已屏蔽该岗位",icon:"none"})})())),D:e.o((t=>(()=>{if(!x.value)return;const t=n(),i=x.value;k(),p.value=p.value.filter((e=>e.rawTenantId!==i.rawTenantId)),t&&i.rawTenantId&&a.dislikeCompany(t,i.rawTenantId).catch((()=>{})),e.index.showToast({title:"已屏蔽该公司",icon:"none"})})())),E:e.o((()=>{})),F:e.o(k),G:e.o((()=>{}))}:{})}},r=e._export_sfc(n,[["__scopeId","data-v-f0274d61"]]);wx.createPage(r);
|