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 } } } })