feat(admin): 职位管理页面添加发布时间和分享按钮

- 添加发布时间列显示职位创建日期
- 添加分享按钮,点击复制职位详情页链接到剪贴板
- 支持 Clipboard API 和降级方案
This commit is contained in:
TianyangZhang 2026-03-25 17:09:16 +08:00
parent 724eef2b19
commit 10fa8aedfe
1 changed files with 26 additions and 1 deletions

View File

@ -9,6 +9,11 @@
<el-table-column prop="organization_name" label="所属公司" />
<el-table-column prop="location" label="地点" />
<el-table-column prop="salary" label="薪资" />
<el-table-column label="发布时间" width="150">
<template #default="{ row }">
{{ row.created_at?.slice(0, 10) || '-' }}
</template>
</el-table-column>
<el-table-column prop="status" label="状态">
<template #default="{ row }">
<el-tag :type="row.status === 'published' ? 'success' : row.status === 'draft' ? 'info' : 'danger'">
@ -16,9 +21,10 @@
</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" width="180">
<el-table-column label="操作" width="220">
<template #default="{ row }">
<el-button size="small" @click="openDialog(row)">编辑</el-button>
<el-button size="small" @click="shareJob(row)">分享</el-button>
<el-button size="small" type="danger" @click="handleDelete(row.id)">删除</el-button>
</template>
</el-table-column>
@ -155,6 +161,25 @@ async function handleSave() {
}
}
function shareJob(row) {
//
const jobUrl = `${window.location.origin}/#/jobs/${row.id}`
//
navigator.clipboard.writeText(jobUrl).then(() => {
ElMessage.success(`已复制链接:${jobUrl}`)
}).catch(() => {
// 使
const textArea = document.createElement('textarea')
textArea.value = jobUrl
document.body.appendChild(textArea)
textArea.select()
document.execCommand('copy')
document.body.removeChild(textArea)
ElMessage.success(`已复制链接:${jobUrl}`)
})
}
async function handleDelete(id) {
await ElMessageBox.confirm('确认删除该职位?', '提示', { type: 'warning' })
await deleteJob(id)