feat: 新增学历字段,首页集成搜索功能并优化布局
- Job模型新增education字段(博士/硕士/本科及以下),支持筛选 - 首页整合搜索栏:关键词、城市、类别、学历下拉筛选 - 左侧企业列表新增"全部职位"选项,搜索与企业选择联动 - 职位详情页展示学历要求,管理后台发布职位支持选择学历 - 导航栏去掉独立"职位列表"入口,统一由首页承载 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
0fc9ad7971
commit
97914d8ff2
|
|
@ -7,7 +7,8 @@ class JobFilter(django_filters.FilterSet):
|
||||||
category = django_filters.CharFilter(lookup_expr='exact')
|
category = django_filters.CharFilter(lookup_expr='exact')
|
||||||
location = django_filters.CharFilter(lookup_expr='icontains')
|
location = django_filters.CharFilter(lookup_expr='icontains')
|
||||||
organization = django_filters.NumberFilter(field_name='organization__id')
|
organization = django_filters.NumberFilter(field_name='organization__id')
|
||||||
|
education = django_filters.BaseInFilter(field_name='education', lookup_expr='in')
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Job
|
model = Job
|
||||||
fields = ['title', 'category', 'location', 'organization']
|
fields = ['title', 'category', 'location', 'organization', 'education']
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
# Generated by Django 4.2.20 on 2026-03-27 05:39
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('jobs', '0002_jobfavorite'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='job',
|
||||||
|
name='education',
|
||||||
|
field=models.CharField(choices=[('博士', '博士'), ('硕士', '硕士'), ('本科及以下', '本科及以下')], default='本科及以下', max_length=20, verbose_name='学历要求'),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
@ -7,6 +7,11 @@ class Job(models.Model):
|
||||||
('published', '已发布'),
|
('published', '已发布'),
|
||||||
('closed', '已关闭'),
|
('closed', '已关闭'),
|
||||||
]
|
]
|
||||||
|
EDUCATION_CHOICES = [
|
||||||
|
('博士', '博士'),
|
||||||
|
('硕士', '硕士'),
|
||||||
|
('本科及以下', '本科及以下'),
|
||||||
|
]
|
||||||
organization = models.ForeignKey(
|
organization = models.ForeignKey(
|
||||||
'organizations.Organization',
|
'organizations.Organization',
|
||||||
on_delete=models.CASCADE,
|
on_delete=models.CASCADE,
|
||||||
|
|
@ -16,6 +21,7 @@ class Job(models.Model):
|
||||||
category = models.CharField(max_length=50, verbose_name='职位类别')
|
category = models.CharField(max_length=50, verbose_name='职位类别')
|
||||||
location = models.CharField(max_length=100, verbose_name='工作地点')
|
location = models.CharField(max_length=100, verbose_name='工作地点')
|
||||||
salary = models.CharField(max_length=50, verbose_name='薪资范围')
|
salary = models.CharField(max_length=50, verbose_name='薪资范围')
|
||||||
|
education = models.CharField(max_length=20, choices=EDUCATION_CHOICES, default='本科及以下', verbose_name='学历要求')
|
||||||
description = models.TextField(verbose_name='职位描述', blank=True)
|
description = models.TextField(verbose_name='职位描述', blank=True)
|
||||||
status = models.CharField(max_length=20, choices=STATUS_CHOICES, default='draft')
|
status = models.CharField(max_length=20, choices=STATUS_CHOICES, default='draft')
|
||||||
created_at = models.DateTimeField(auto_now_add=True)
|
created_at = models.DateTimeField(auto_now_add=True)
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ class JobListSerializer(serializers.ModelSerializer):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Job
|
model = Job
|
||||||
fields = ['id', 'title', 'category', 'location', 'salary',
|
fields = ['id', 'title', 'category', 'location', 'salary', 'education',
|
||||||
'organization', 'organization_name', 'status', 'created_at']
|
'organization', 'organization_name', 'status', 'created_at']
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -24,7 +24,7 @@ class JobDetailSerializer(serializers.ModelSerializer):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Job
|
model = Job
|
||||||
fields = ['id', 'title', 'category', 'location', 'salary',
|
fields = ['id', 'title', 'category', 'location', 'salary', 'education',
|
||||||
'description', 'organization', 'organization_id', 'status', 'created_at']
|
'description', 'organization', 'organization_id', 'status', 'created_at']
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,6 @@
|
||||||
<!-- 导航 -->
|
<!-- 导航 -->
|
||||||
<nav class="main-nav">
|
<nav class="main-nav">
|
||||||
<router-link to="/home" class="nav-link" active-class="active">首页</router-link>
|
<router-link to="/home" class="nav-link" active-class="active">首页</router-link>
|
||||||
<router-link to="/jobs" class="nav-link" active-class="active">职位列表</router-link>
|
|
||||||
<router-link to="/companies" class="nav-link" active-class="active">公司介绍</router-link>
|
<router-link to="/companies" class="nav-link" active-class="active">公司介绍</router-link>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
|
|
@ -71,8 +70,8 @@
|
||||||
<router-view />
|
<router-view />
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
<!-- 页脚 -->
|
<!-- 页脚(全屏面板页隐藏) -->
|
||||||
<footer class="portal-footer">
|
<footer class="portal-footer" v-if="$route.name !== 'Home'">
|
||||||
<div class="footer-inner">
|
<div class="footer-inner">
|
||||||
<div class="footer-logo">
|
<div class="footer-logo">
|
||||||
<div class="f-emblem">招</div>
|
<div class="f-emblem">招</div>
|
||||||
|
|
@ -285,10 +284,17 @@ a { text-decoration: none; }
|
||||||
/* 内容区 — top-bar(~28px) + header(72px) + underline(3px) = ~103px */
|
/* 内容区 — top-bar(~28px) + header(72px) + underline(3px) = ~103px */
|
||||||
.portal-main {
|
.portal-main {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
max-width: 1280px;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
padding: 100px 32px 0;
|
padding-top: 97px;
|
||||||
|
}
|
||||||
|
.portal-main:has(.two-panel) {
|
||||||
|
max-width: none;
|
||||||
|
padding: 97px 0 0;
|
||||||
|
}
|
||||||
|
.portal-main:not(:has(.two-panel)) {
|
||||||
|
max-width: 1280px;
|
||||||
|
padding: 97px 32px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 页脚 */
|
/* 页脚 */
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,13 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="职位名称"><el-input v-model="form.title" /></el-form-item>
|
<el-form-item label="职位名称"><el-input v-model="form.title" /></el-form-item>
|
||||||
<el-form-item label="职位类别"><el-input v-model="form.category" /></el-form-item>
|
<el-form-item label="职位类别"><el-input v-model="form.category" /></el-form-item>
|
||||||
|
<el-form-item label="学历要求">
|
||||||
|
<el-select v-model="form.education" placeholder="请选择学历要求" style="width:100%">
|
||||||
|
<el-option value="博士" label="博士" />
|
||||||
|
<el-option value="硕士" label="硕士" />
|
||||||
|
<el-option value="本科及以下" label="本科及以下" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="工作地点"><el-input v-model="form.location" /></el-form-item>
|
<el-form-item label="工作地点"><el-input v-model="form.location" /></el-form-item>
|
||||||
<el-form-item label="薪资范围"><el-input v-model="form.salary" /></el-form-item>
|
<el-form-item label="薪资范围"><el-input v-model="form.salary" /></el-form-item>
|
||||||
<el-form-item label="职位描述"><el-input v-model="form.description" type="textarea" :rows="5" /></el-form-item>
|
<el-form-item label="职位描述"><el-input v-model="form.description" type="textarea" :rows="5" /></el-form-item>
|
||||||
|
|
@ -95,7 +102,7 @@ const saving = ref(false)
|
||||||
const dialogVisible = ref(false)
|
const dialogVisible = ref(false)
|
||||||
const editingJob = ref(null)
|
const editingJob = ref(null)
|
||||||
const form = reactive({
|
const form = reactive({
|
||||||
title: '', category: '', location: '', salary: '',
|
title: '', category: '', education: '本科及以下', location: '', salary: '',
|
||||||
description: '', status: 'draft', organization_id: null
|
description: '', status: 'draft', organization_id: null
|
||||||
})
|
})
|
||||||
const currentPage = ref(1)
|
const currentPage = ref(1)
|
||||||
|
|
@ -127,6 +134,7 @@ function openDialog(job = null) {
|
||||||
Object.assign(form, {
|
Object.assign(form, {
|
||||||
title: job.title,
|
title: job.title,
|
||||||
category: job.category,
|
category: job.category,
|
||||||
|
education: job.education || '本科及以下',
|
||||||
location: job.location,
|
location: job.location,
|
||||||
salary: job.salary,
|
salary: job.salary,
|
||||||
description: job.description,
|
description: job.description,
|
||||||
|
|
@ -135,7 +143,7 @@ function openDialog(job = null) {
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
Object.assign(form, {
|
Object.assign(form, {
|
||||||
title: '', category: '', location: '', salary: '',
|
title: '', category: '', education: '本科及以下', location: '', salary: '',
|
||||||
description: '', status: 'draft', organization_id: null
|
description: '', status: 'draft', organization_id: null
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,20 @@
|
||||||
<span class="left-title">全部企业</span>
|
<span class="left-title">全部企业</span>
|
||||||
<span class="left-count">{{ totalOrgs }}</span>
|
<span class="left-count">{{ totalOrgs }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- 查看全部按钮 -->
|
||||||
|
<div
|
||||||
|
class="org-row org-all"
|
||||||
|
:class="{ active: !selectedOrg }"
|
||||||
|
@click="clearOrg"
|
||||||
|
>
|
||||||
|
<div class="org-avatar all-avatar">
|
||||||
|
<span>全</span>
|
||||||
|
</div>
|
||||||
|
<div class="org-meta">
|
||||||
|
<span class="org-name">全部职位</span>
|
||||||
|
<span class="org-stat">查看所有企业岗位</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="left-body">
|
<div class="left-body">
|
||||||
<template v-if="orgsLoading">
|
<template v-if="orgsLoading">
|
||||||
<div v-for="i in 4" :key="i" class="skeleton-row" />
|
<div v-for="i in 4" :key="i" class="skeleton-row" />
|
||||||
|
|
@ -19,7 +33,6 @@
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<template v-for="org in orgs" :key="org.id">
|
<template v-for="org in orgs" :key="org.id">
|
||||||
<!-- 集团 -->
|
|
||||||
<div
|
<div
|
||||||
class="org-row"
|
class="org-row"
|
||||||
:class="{ active: selectedOrg?.id === org.id }"
|
:class="{ active: selectedOrg?.id === org.id }"
|
||||||
|
|
@ -34,7 +47,6 @@
|
||||||
<span class="org-stat">在招 <em>{{ org.job_count }}</em> 个岗位</span>
|
<span class="org-stat">在招 <em>{{ org.job_count }}</em> 个岗位</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- 子公司 -->
|
|
||||||
<div
|
<div
|
||||||
v-for="child in org.children"
|
v-for="child in org.children"
|
||||||
:key="child.id"
|
:key="child.id"
|
||||||
|
|
@ -59,22 +71,79 @@
|
||||||
</div>
|
</div>
|
||||||
</aside>
|
</aside>
|
||||||
|
|
||||||
<!-- ── 右栏:岗位列表 ── -->
|
<!-- ── 右栏 ── -->
|
||||||
<section class="panel-right">
|
<section class="panel-right">
|
||||||
<div class="right-header">
|
<!-- 搜索栏 -->
|
||||||
<span class="right-title">职位列表</span>
|
<div class="search-bar">
|
||||||
<span v-if="jobs.length" class="right-count">{{ jobs.length }} 个</span>
|
<div class="search-row">
|
||||||
|
<div class="search-field">
|
||||||
|
<el-input
|
||||||
|
v-model="filters.search"
|
||||||
|
placeholder="职位名称 / 关键词"
|
||||||
|
clearable
|
||||||
|
:prefix-icon="SearchIcon"
|
||||||
|
@keyup.enter="doSearch"
|
||||||
|
@clear="doSearch"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="search-field">
|
||||||
|
<el-input
|
||||||
|
v-model="filters.location"
|
||||||
|
placeholder="城市"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="doSearch"
|
||||||
|
@clear="doSearch"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="search-field">
|
||||||
|
<el-input
|
||||||
|
v-model="filters.category"
|
||||||
|
placeholder="职位类别"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="doSearch"
|
||||||
|
@clear="doSearch"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="search-field">
|
||||||
|
<el-select
|
||||||
|
v-model="filters.education"
|
||||||
|
placeholder="学历要求"
|
||||||
|
clearable
|
||||||
|
@change="doSearch"
|
||||||
|
>
|
||||||
|
<el-option value="博士" label="博士" />
|
||||||
|
<el-option value="硕士" label="硕士" />
|
||||||
|
<el-option value="本科及以下" label="本科及以下" />
|
||||||
|
</el-select>
|
||||||
|
</div>
|
||||||
|
<el-button type="primary" class="search-btn" @click="doSearch">
|
||||||
|
搜索
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
<div class="search-context" v-if="selectedOrg">
|
||||||
|
<span class="context-label">当前企业:</span>
|
||||||
|
<el-tag size="small" closable @close="clearOrg">{{ selectedOrg.name }}</el-tag>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="right-body">
|
|
||||||
<template v-if="jobsLoading">
|
<!-- 结果头 -->
|
||||||
<div v-for="i in 4" :key="i" class="skeleton-row" />
|
<div class="right-header">
|
||||||
|
<span class="right-title">
|
||||||
|
{{ selectedOrg ? selectedOrg.name + ' · 职位列表' : '全部职位' }}
|
||||||
|
</span>
|
||||||
|
<span class="right-count">共 {{ totalJobs }} 个</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 职位列表 -->
|
||||||
|
<div class="right-body" v-loading="jobsLoading">
|
||||||
|
<template v-if="!jobsLoading && !jobsError && jobs.length === 0">
|
||||||
|
<div class="state-tip">
|
||||||
|
{{ hasFilters ? '未找到匹配的职位,请调整筛选条件' : '暂无职位数据' }}
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="jobsError">
|
<template v-else-if="jobsError">
|
||||||
<div class="state-tip">加载失败,请刷新重试</div>
|
<div class="state-tip">加载失败,请刷新重试</div>
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="jobs.length === 0">
|
|
||||||
<div class="state-tip">请选择企业查看职位</div>
|
|
||||||
</template>
|
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<div
|
<div
|
||||||
v-for="job in jobs"
|
v-for="job in jobs"
|
||||||
|
|
@ -82,31 +151,46 @@
|
||||||
class="job-row"
|
class="job-row"
|
||||||
@click="goToJobDetail(job)"
|
@click="goToJobDetail(job)"
|
||||||
>
|
>
|
||||||
<div class="job-row-title">{{ job.title }}</div>
|
<div class="job-row-top">
|
||||||
|
<div class="job-row-title">{{ job.title }}</div>
|
||||||
|
<div class="job-row-salary">{{ job.salary }}</div>
|
||||||
|
</div>
|
||||||
<div class="job-row-meta">
|
<div class="job-row-meta">
|
||||||
<span class="job-org">{{ job.organization?.name }}</span>
|
<span class="job-org">{{ job.organization_name || job.organization?.name }}</span>
|
||||||
|
<span class="meta-dot">·</span>
|
||||||
|
<span>{{ job.location }}</span>
|
||||||
|
<span class="meta-dot" v-if="job.education">·</span>
|
||||||
|
<span v-if="job.education">{{ job.education }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="job-row-tags">
|
<div class="job-row-tags">
|
||||||
|
<span class="tag tag-cat" v-if="job.category">{{ job.category }}</span>
|
||||||
|
<span class="tag tag-edu" v-if="job.education">{{ job.education }}</span>
|
||||||
<span class="tag tag-loc">{{ job.location }}</span>
|
<span class="tag tag-loc">{{ job.location }}</span>
|
||||||
<span class="tag tag-sal">{{ job.salary }}</span>
|
|
||||||
<span class="tag tag-cat">{{ job.category }}</span>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
<!-- 分页 -->
|
||||||
|
<div class="pagination-wrap" v-if="totalJobs > pageSize">
|
||||||
|
<el-pagination
|
||||||
|
layout="prev, pager, next"
|
||||||
|
:total="totalJobs"
|
||||||
|
:page-size="pageSize"
|
||||||
|
v-model:current-page="currentPage"
|
||||||
|
@current-change="handlePageChange"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<!-- ── 右栏:岗位详情 ── -->
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed, onMounted } from 'vue'
|
import { ref, reactive, computed, onMounted } from 'vue'
|
||||||
import { useRouter, useRoute } from 'vue-router'
|
import { useRouter, useRoute } from 'vue-router'
|
||||||
import { useAuthStore } from '@/stores/auth'
|
import { useAuthStore } from '@/stores/auth'
|
||||||
import { ElMessage } from 'element-plus'
|
|
||||||
import { getOrganizations } from '@/api/organizations'
|
import { getOrganizations } from '@/api/organizations'
|
||||||
import { getJobs } from '@/api/jobs'
|
import { getJobs } from '@/api/jobs'
|
||||||
|
import { Search as SearchIcon } from '@element-plus/icons-vue'
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
|
@ -120,25 +204,34 @@ const selectedOrg = ref(null)
|
||||||
const jobs = ref([])
|
const jobs = ref([])
|
||||||
const jobsLoading = ref(false)
|
const jobsLoading = ref(false)
|
||||||
const jobsError = ref(false)
|
const jobsError = ref(false)
|
||||||
|
const totalJobs = ref(0)
|
||||||
|
const currentPage = ref(1)
|
||||||
|
const pageSize = 20
|
||||||
|
|
||||||
|
const filters = reactive({ search: '', location: '', category: '', education: '' })
|
||||||
|
|
||||||
const totalOrgs = computed(() => {
|
const totalOrgs = computed(() => {
|
||||||
return orgs.value.reduce((n, o) => n + 1 + (o.children?.length || 0), 0)
|
return orgs.value.reduce((n, o) => n + 1 + (o.children?.length || 0), 0)
|
||||||
})
|
})
|
||||||
|
|
||||||
function formatDate(dt) {
|
const hasFilters = computed(() => {
|
||||||
if (!dt) return ''
|
return filters.search || filters.location || filters.category || filters.education
|
||||||
return new Date(dt).toLocaleDateString('zh-CN', { year: 'numeric', month: '2-digit', day: '2-digit' })
|
})
|
||||||
}
|
|
||||||
|
|
||||||
async function selectOrg(org) {
|
async function fetchJobs(page = 1) {
|
||||||
selectedOrg.value = org
|
|
||||||
jobs.value = []
|
|
||||||
jobsError.value = false
|
|
||||||
jobsLoading.value = true
|
jobsLoading.value = true
|
||||||
|
jobsError.value = false
|
||||||
try {
|
try {
|
||||||
const { data } = await getJobs({ organization: org.id })
|
const params = { page }
|
||||||
|
if (selectedOrg.value) params.organization = selectedOrg.value.id
|
||||||
|
if (filters.search) params.search = filters.search
|
||||||
|
if (filters.location) params.location = filters.location
|
||||||
|
if (filters.category) params.category = filters.category
|
||||||
|
if (filters.education) params.education = filters.education
|
||||||
|
const { data } = await getJobs(params)
|
||||||
jobs.value = data.results
|
jobs.value = data.results
|
||||||
|
totalJobs.value = data.count
|
||||||
|
currentPage.value = page
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Failed to fetch jobs:', err)
|
console.error('Failed to fetch jobs:', err)
|
||||||
jobsError.value = true
|
jobsError.value = true
|
||||||
|
|
@ -147,6 +240,27 @@ async function selectOrg(org) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function doSearch() {
|
||||||
|
currentPage.value = 1
|
||||||
|
fetchJobs(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
function handlePageChange(page) {
|
||||||
|
fetchJobs(page)
|
||||||
|
}
|
||||||
|
|
||||||
|
async function selectOrg(org) {
|
||||||
|
selectedOrg.value = org
|
||||||
|
currentPage.value = 1
|
||||||
|
fetchJobs(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearOrg() {
|
||||||
|
selectedOrg.value = null
|
||||||
|
currentPage.value = 1
|
||||||
|
fetchJobs(1)
|
||||||
|
}
|
||||||
|
|
||||||
function goToJobDetail(job) {
|
function goToJobDetail(job) {
|
||||||
router.push({ name: 'JobDetail', params: { id: job.id } })
|
router.push({ name: 'JobDetail', params: { id: job.id } })
|
||||||
}
|
}
|
||||||
|
|
@ -157,46 +271,39 @@ onMounted(async () => {
|
||||||
const { data } = await getOrganizations()
|
const { data } = await getOrganizations()
|
||||||
orgs.value = data.results
|
orgs.value = data.results
|
||||||
const targetOrgId = route.query.org ? Number(route.query.org) : null
|
const targetOrgId = route.query.org ? Number(route.query.org) : null
|
||||||
let targetOrg = null
|
|
||||||
if (targetOrgId) {
|
if (targetOrgId) {
|
||||||
for (const org of orgs.value) {
|
for (const org of orgs.value) {
|
||||||
if (org.id === targetOrgId) { targetOrg = org; break }
|
if (org.id === targetOrgId) { selectedOrg.value = org; break }
|
||||||
const child = org.children?.find(c => c.id === targetOrgId)
|
const child = org.children?.find(c => c.id === targetOrgId)
|
||||||
if (child) { targetOrg = child; break }
|
if (child) { selectedOrg.value = child; break }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (targetOrg) selectOrg(targetOrg)
|
|
||||||
else if (orgs.value.length > 0) selectOrg(orgs.value[0])
|
|
||||||
} catch { orgsError.value = true }
|
} catch { orgsError.value = true }
|
||||||
finally { orgsLoading.value = false }
|
finally { orgsLoading.value = false }
|
||||||
|
fetchJobs(1)
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
/* ── 变量 ── */
|
|
||||||
.two-panel {
|
.two-panel {
|
||||||
--red: #B8860B;
|
|
||||||
--dark: #1A1A1A;
|
|
||||||
--gold: #B8860B;
|
--gold: #B8860B;
|
||||||
--gold-lt: #D4AF37;
|
--gold-lt: #D4AF37;
|
||||||
--cream: #FAFAFA;
|
--dark: #1A1A1A;
|
||||||
--border: #D3D3D3;
|
--cream: #F7F8FA;
|
||||||
--text: #2A1A1A;
|
--border: #E5E6EB;
|
||||||
--muted: #3A3A3A;
|
--text: #1D2129;
|
||||||
|
--muted: #86909C;
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
height: calc(100vh - 97px);
|
height: calc(100vh - 97px);
|
||||||
min-height: 520px;
|
min-height: 520px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
border-radius: 0;
|
|
||||||
border: none;
|
|
||||||
box-shadow: none;
|
|
||||||
font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
|
font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── 左栏 ── */
|
/* ── 左栏 ── */
|
||||||
.panel-left {
|
.panel-left {
|
||||||
width: 320px;
|
width: 280px;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
@ -218,7 +325,7 @@ onMounted(async () => {
|
||||||
letter-spacing: 0.1em;
|
letter-spacing: 0.1em;
|
||||||
}
|
}
|
||||||
.left-count {
|
.left-count {
|
||||||
background: var(--red);
|
background: var(--gold);
|
||||||
color: #fff;
|
color: #fff;
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
|
|
@ -232,6 +339,14 @@ onMounted(async () => {
|
||||||
.left-body::-webkit-scrollbar-track { background: transparent; }
|
.left-body::-webkit-scrollbar-track { background: transparent; }
|
||||||
.left-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 2px; }
|
.left-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 2px; }
|
||||||
|
|
||||||
|
/* 全部按钮 */
|
||||||
|
.org-all {
|
||||||
|
border-bottom: 1px solid rgba(255,255,255,0.1) !important;
|
||||||
|
}
|
||||||
|
.all-avatar {
|
||||||
|
background: linear-gradient(135deg, #4A90D9, #357ABD) !important;
|
||||||
|
}
|
||||||
|
|
||||||
/* 公司行 */
|
/* 公司行 */
|
||||||
.org-row {
|
.org-row {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
@ -271,8 +386,6 @@ onMounted(async () => {
|
||||||
.org-row.active .org-name { color: var(--gold-lt); }
|
.org-row.active .org-name { color: var(--gold-lt); }
|
||||||
.org-stat { font-size: 11px; color: rgba(255,255,255,0.38); }
|
.org-stat { font-size: 11px; color: rgba(255,255,255,0.38); }
|
||||||
.org-stat em { font-style: normal; color: var(--gold); font-weight: 700; }
|
.org-stat em { font-style: normal; color: var(--gold); font-weight: 700; }
|
||||||
|
|
||||||
/* 子公司缩进 */
|
|
||||||
.org-child { padding-left: 12px; background: rgba(0,0,0,0.12); }
|
.org-child { padding-left: 12px; background: rgba(0,0,0,0.12); }
|
||||||
.child-indent {
|
.child-indent {
|
||||||
display: flex; align-items: center; flex-shrink: 0;
|
display: flex; align-items: center; flex-shrink: 0;
|
||||||
|
|
@ -283,68 +396,130 @@ onMounted(async () => {
|
||||||
background: rgba(184,134,11,0.35);
|
background: rgba(184,134,11,0.35);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── 右栏 (职位列表) ── */
|
/* ── 右栏 ── */
|
||||||
.panel-right {
|
.panel-right {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
flex-shrink: 0;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
background: var(--cream);
|
background: var(--cream);
|
||||||
border-left: 1px solid var(--border);
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 搜索栏 */
|
||||||
|
.search-bar {
|
||||||
|
flex-shrink: 0;
|
||||||
|
background: #fff;
|
||||||
|
padding: 14px 20px;
|
||||||
|
border-bottom: 1px solid var(--border);
|
||||||
|
}
|
||||||
|
.search-row {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.search-field {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
.search-field :deep(.el-input__wrapper),
|
||||||
|
.search-field :deep(.el-select .el-input__wrapper) {
|
||||||
|
border-radius: 6px;
|
||||||
|
}
|
||||||
|
.search-btn {
|
||||||
|
flex-shrink: 0;
|
||||||
|
padding: 8px 24px;
|
||||||
|
border-radius: 6px;
|
||||||
|
font-weight: 600;
|
||||||
|
background: var(--gold) !important;
|
||||||
|
border-color: var(--gold) !important;
|
||||||
|
}
|
||||||
|
.search-btn:hover {
|
||||||
|
background: var(--gold-lt) !important;
|
||||||
|
border-color: var(--gold-lt) !important;
|
||||||
|
}
|
||||||
|
.search-context {
|
||||||
|
margin-top: 10px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
.context-label {
|
||||||
|
font-size: 12px;
|
||||||
|
color: var(--muted);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 结果头 */
|
||||||
.right-header {
|
.right-header {
|
||||||
padding: 14px 16px;
|
padding: 12px 20px;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
border-bottom: 2px solid var(--border);
|
border-bottom: 1px solid var(--border);
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
}
|
}
|
||||||
.right-title { font-size: 13px; font-weight: 600; color: var(--text); }
|
.right-title { font-size: 14px; font-weight: 600; color: var(--text); }
|
||||||
.right-count {
|
.right-count {
|
||||||
font-size: 11px; color: var(--muted);
|
font-size: 12px; color: var(--muted);
|
||||||
background: #F0F0F0; border-radius: 10px; padding: 1px 8px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 职位列表 */
|
||||||
.right-body { flex: 1; overflow-y: auto; }
|
.right-body { flex: 1; overflow-y: auto; }
|
||||||
|
|
||||||
/* 岗位行 */
|
|
||||||
.job-row {
|
.job-row {
|
||||||
padding: 13px 16px;
|
padding: 14px 20px;
|
||||||
border-left: 3px solid transparent;
|
|
||||||
border-bottom: 1px solid var(--border);
|
border-bottom: 1px solid var(--border);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: background 0.15s;
|
transition: background 0.15s;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
}
|
}
|
||||||
.job-row:hover { background: #F8F8F8; }
|
.job-row:hover { background: #FAFBFC; }
|
||||||
|
.job-row-top {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 6px;
|
||||||
|
}
|
||||||
.job-row-title {
|
.job-row-title {
|
||||||
font-size: 13px; font-weight: 600;
|
font-size: 14px; font-weight: 600;
|
||||||
color: var(--text); margin-bottom: 5px;
|
color: var(--text);
|
||||||
|
}
|
||||||
|
.job-row-salary {
|
||||||
|
font-size: 14px; font-weight: 700;
|
||||||
|
color: #E63329;
|
||||||
|
flex-shrink: 0;
|
||||||
|
margin-left: 16px;
|
||||||
}
|
}
|
||||||
.job-row-meta {
|
.job-row-meta {
|
||||||
font-size: 11px; color: var(--muted); margin-bottom: 6px;
|
font-size: 12px; color: var(--muted); margin-bottom: 8px;
|
||||||
|
display: flex; align-items: center; gap: 4px;
|
||||||
}
|
}
|
||||||
.job-org { color: var(--red); }
|
.job-org { color: var(--gold); font-weight: 500; }
|
||||||
.job-row-tags { display: flex; gap: 5px; flex-wrap: wrap; }
|
.meta-dot { color: #D9D9D9; }
|
||||||
|
.job-row-tags { display: flex; gap: 6px; flex-wrap: wrap; }
|
||||||
.tag {
|
.tag {
|
||||||
font-size: 11px; padding: 2px 7px;
|
font-size: 11px; padding: 2px 8px;
|
||||||
border-radius: 3px; font-weight: 500;
|
border-radius: 3px; font-weight: 500;
|
||||||
}
|
}
|
||||||
.tag-loc { background: #E8EEF8; color: #2C5282; }
|
.tag-loc { background: #E8EEF8; color: #2C5282; }
|
||||||
.tag-sal { background: #FFF3E0; color: #B7610A; }
|
|
||||||
.tag-cat { background: #E8F5E9; color: #2E7D32; }
|
.tag-cat { background: #E8F5E9; color: #2E7D32; }
|
||||||
|
.tag-edu { background: #F3E5F5; color: #7B1FA2; }
|
||||||
|
|
||||||
|
/* 分页 */
|
||||||
|
.pagination-wrap {
|
||||||
|
padding: 16px 20px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
background: #fff;
|
||||||
|
border-top: 1px solid var(--border);
|
||||||
|
}
|
||||||
|
|
||||||
/* 空状态 / 骨架 */
|
/* 空状态 / 骨架 */
|
||||||
.state-tip {
|
.state-tip {
|
||||||
display: flex; align-items: center; justify-content: center;
|
display: flex; align-items: center; justify-content: center;
|
||||||
height: 100%; min-height: 100px;
|
height: 200px;
|
||||||
color: var(--muted); font-size: 13px;
|
color: var(--muted); font-size: 13px;
|
||||||
}
|
}
|
||||||
.full-tip { flex-direction: column; gap: 12px; }
|
|
||||||
.empty-icon { opacity: 0.5; }
|
|
||||||
.detail-loading { padding: 24px 28px; }
|
|
||||||
.skeleton-row {
|
.skeleton-row {
|
||||||
height: 14px; background: linear-gradient(90deg, #E8E8E8 25%, #F0F0F0 50%, #E8E8E8 75%);
|
height: 14px; background: linear-gradient(90deg, #E8E8E8 25%, #F0F0F0 50%, #E8E8E8 75%);
|
||||||
background-size: 200% 100%;
|
background-size: 200% 100%;
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,10 @@
|
||||||
<span class="tag-label">工作地点</span>
|
<span class="tag-label">工作地点</span>
|
||||||
<span class="tag-value">{{ job.location }}</span>
|
<span class="tag-value">{{ job.location }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="tag-item">
|
||||||
|
<span class="tag-label">学历要求</span>
|
||||||
|
<span class="tag-value">{{ job.education || '不限' }}</span>
|
||||||
|
</div>
|
||||||
<div class="tag-item">
|
<div class="tag-item">
|
||||||
<span class="tag-label">薪资范围</span>
|
<span class="tag-label">薪资范围</span>
|
||||||
<span class="tag-value salary-val">{{ job.salary }}</span>
|
<span class="tag-value salary-val">{{ job.salary }}</span>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue