From cfb9ed8dfd52115356eb24486cb4263ed9081096 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 25 Jun 2026 17:22:41 +0800 Subject: [PATCH] =?UTF-8?q?style:=20HomeView=20=E5=8F=8C=E6=A0=8F=E9=BB=91?= =?UTF-8?q?=E9=87=91=E6=94=B9=E5=9B=BD=E8=81=98=E7=BA=A2=E7=99=BD=E5=BA=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude --- offer_frontend/src/views/portal/HomeView.vue | 655 ++++++++++++------- 1 file changed, 412 insertions(+), 243 deletions(-) diff --git a/offer_frontend/src/views/portal/HomeView.vue b/offer_frontend/src/views/portal/HomeView.vue index 926f702..8101459 100644 --- a/offer_frontend/src/views/portal/HomeView.vue +++ b/offer_frontend/src/views/portal/HomeView.vue @@ -7,20 +7,6 @@ 全部企业 {{ totalOrgs }} - -
-
- -
-
- 全部职位 - 查看所有企业岗位 -
-
@@ -210,6 +255,12 @@ const pageSize = 20 const filters = reactive({ search: '', location: '', category: '', education: '' }) +const eduLevels = [ + { key: '博士', label: '博士' }, + { key: '硕士', label: '硕士' }, + { key: '本科及以下', label: '本科' }, +] + const totalOrgs = computed(() => { return orgs.value.reduce((n, o) => n + 1 + (o.children?.length || 0), 0) }) @@ -218,12 +269,33 @@ const hasFilters = computed(() => { return filters.search || filters.location || filters.category || filters.education }) +const eduGroups = computed(() => { + const groups = { '博士': [], '硕士': [], '本科及以下': [] } + jobs.value.forEach(job => { + if (groups[job.education] !== undefined) { + groups[job.education].push(job) + } + }) + return groups +}) + +const eduTotals = computed(() => { + const totals = {} + for (const [key, list] of Object.entries(eduGroups.value)) { + totals[key] = list.reduce((sum, job) => sum + (job.headcount || 0), 0) + } + return totals +}) + async function fetchJobs(page = 1) { jobsLoading.value = true jobsError.value = false try { const params = { page } - if (selectedOrg.value) params.organization = selectedOrg.value.id + if (selectedOrg.value) { + params.organization = selectedOrg.value.id + params.page_size = 200 // 选中公司时拉取全部岗位用于分组 + } if (filters.search) params.search = filters.search if (filters.location) params.location = filters.location if (filters.category) params.category = filters.category @@ -277,6 +349,9 @@ onMounted(async () => { const child = org.children?.find(c => c.id === targetOrgId) if (child) { selectedOrg.value = child; break } } + } else if (orgs.value.length > 0) { + // 默认选中第一家公司 + selectedOrg.value = orgs.value[0] } } catch { orgsError.value = true } finally { orgsLoading.value = false } @@ -286,13 +361,15 @@ onMounted(async () => {