From 1ec873440138f0aa51e7b288ab1be64a498d49fd Mon Sep 17 00:00:00 2001 From: TianyangZhang Date: Wed, 25 Mar 2026 16:32:33 +0800 Subject: [PATCH] =?UTF-8?q?fix(admin):=20=E4=BF=AE=E5=A4=8D=E7=AE=80?= =?UTF-8?q?=E5=8E=86=E9=99=84=E4=BB=B6=E4=B8=8B=E8=BD=BD=E9=97=AE=E9=A2=98?= =?UTF-8?q?=EF=BC=8C=E5=AE=8C=E5=96=84=E7=AE=80=E5=8E=86=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- offer_backend/apps/resumes/models.py | 9 +- .../src/views/admin/ApplicationManageView.vue | 165 ++++++++++++++++-- offer_frontend/vite.config.js | 3 +- 3 files changed, 165 insertions(+), 12 deletions(-) diff --git a/offer_backend/apps/resumes/models.py b/offer_backend/apps/resumes/models.py index 0189617..720df79 100644 --- a/offer_backend/apps/resumes/models.py +++ b/offer_backend/apps/resumes/models.py @@ -22,11 +22,18 @@ class Resume(models.Model): def to_snapshot(self): """序列化为投递快照,与主表解耦""" + attachment_url = None + if self.attachment: + # 返回相对 URL,前端会处理 + attachment_url = self.attachment.url + return { 'name': self.name, 'gender': self.gender, 'birthday': str(self.birthday) if self.birthday else None, 'education': self.education, 'experience': self.experience, - 'attachment_url': self.attachment.url if self.attachment else None, + 'email': self.user.email, + 'phone': self.user.phone, + 'attachment_url': attachment_url, } diff --git a/offer_frontend/src/views/admin/ApplicationManageView.vue b/offer_frontend/src/views/admin/ApplicationManageView.vue index 79e0b74..3f9b9b3 100644 --- a/offer_frontend/src/views/admin/ApplicationManageView.vue +++ b/offer_frontend/src/views/admin/ApplicationManageView.vue @@ -25,16 +25,70 @@ - -
-

姓名:{{ currentResume.name }}

-

性别:{{ currentResume.gender }}

- 教育经历 -
{{ e.school }} · {{ e.degree }} · {{ e.major }}
- 工作经历 -
{{ e.company }} · {{ e.position }} · {{ e.duration }}
-
- 下载简历附件 + +
+ +
+
基本信息
+
+
+ 姓名: + {{ currentResume.name || '-' }} +
+
+ 性别: + {{ getGenderLabel(currentResume.gender) }} +
+
+ 邮箱: + {{ currentResume.email || '-' }} +
+
+ 手机: + {{ currentResume.phone || '-' }} +
+
+ 生日: + {{ currentResume.birthday || '-' }} +
+
+
+ + +
+
教育经历
+
+
+
{{ e.school }}
+
{{ e.degree }} · {{ e.major }}
+
{{ e.start_year }} - {{ e.end_year }}
+
+
+
暂无教育经历
+
+ + +
+
工作经历
+
+
+
{{ e.company }} - {{ e.position }}
+
{{ e.duration }}
+
{{ e.description }}
+
+
+
暂无工作经历
+
+ + +
+
附件
+
+ + + 下载简历附件 + +
@@ -44,12 +98,20 @@ import { ref, onMounted } from 'vue' import { getManageApplications, updateApplicationStatus } from '@/api/applications' import { ElMessage } from 'element-plus' +import { Download } from '@element-plus/icons-vue' const applications = ref([]) const loading = ref(false) const resumeVisible = ref(false) const currentResume = ref(null) +const genderMap = { + 'male': '男', + 'female': '女', + 'other': '其他', + '': '-' +} + onMounted(async () => { loading.value = true const { data } = await getManageApplications() @@ -68,4 +130,87 @@ function viewResume(row) { currentResume.value = row.resume_snapshot resumeVisible.value = true } + +function getGenderLabel(gender) { + return genderMap[gender] || '-' +} + +function downloadAttachment() { + if (!currentResume.value?.attachment_url) { + ElMessage.warning('附件不可用') + return + } + const link = document.createElement('a') + link.href = currentResume.value.attachment_url + link.download = `${currentResume.value.name}_resume` + link.style.display = 'none' + document.body.appendChild(link) + link.click() + document.body.removeChild(link) + ElMessage.success('下载已启动') +} + + diff --git a/offer_frontend/vite.config.js b/offer_frontend/vite.config.js index 8350944..6df812d 100644 --- a/offer_frontend/vite.config.js +++ b/offer_frontend/vite.config.js @@ -16,7 +16,8 @@ export default defineConfig({ }, server: { proxy: { - '/api': { target: 'http://127.0.0.1:8000', changeOrigin: true } + '/api': { target: 'http://127.0.0.1:8000', changeOrigin: true }, + '/media': { target: 'http://127.0.0.1:8000', changeOrigin: true } } } })