fix: 任务详情弹窗中附件下载需抢单后才能下载
This commit is contained in:
parent
aee1138de0
commit
c61b368233
@ -2340,14 +2340,22 @@
|
||||
<div v-if="selectedTask.attachmentUrl" class="detail-section">
|
||||
<h4>附件</h4>
|
||||
<div class="attachment-links">
|
||||
<a v-for="(url, index) in (selectedTask.attachmentUrl || '').split(',')"
|
||||
:key="index"
|
||||
:href="url.trim()"
|
||||
target="_blank"
|
||||
class="attachment-link">
|
||||
<Icon name="download" size="sm" style="margin-right: 4px;" />
|
||||
附件 {{ index + 1 }}
|
||||
</a>
|
||||
<!-- 只有非pending状态或管理员才能下载附件 -->
|
||||
<template v-if="canDownloadAttachment(selectedTask)">
|
||||
<a v-for="(url, index) in (selectedTask.attachmentUrl || '').split(',').filter(u => u.trim())"
|
||||
:key="index"
|
||||
:href="url.trim()"
|
||||
target="_blank"
|
||||
class="attachment-link">
|
||||
<Icon name="download" size="sm" style="margin-right: 4px;" />
|
||||
附件 {{ index + 1 }}
|
||||
</a>
|
||||
</template>
|
||||
<!-- 待接单状态显示锁定提示 -->
|
||||
<div v-else class="attachment-locked-notice">
|
||||
<Icon name="lock" size="sm" style="margin-right: 4px;" />
|
||||
{{ (selectedTask.attachmentUrl || '').split(',').filter(u => u.trim()).length }}个附件(接单后可下载)
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -3347,6 +3355,20 @@ const isHighScoreTask = (task: TaskOrSubTask) => {
|
||||
return task.score && task.score >= 500
|
||||
}
|
||||
|
||||
// 判断是否可以下载附件(非pending状态或管理员可下载)
|
||||
const canDownloadAttachment = (task: TaskOrSubTask) => {
|
||||
// 管理员可以下载
|
||||
const userInfo = JSON.parse(localStorage.getItem('userInfo') || '{}')
|
||||
if (userInfo.isAdmin === 1 || userInfo.isAdmin === true) {
|
||||
return true
|
||||
}
|
||||
// 非pending状态可以下载(已接单、进行中、已完成等)
|
||||
if (task.status !== 'pending') {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// 加载配置数据(从全局store加载)
|
||||
const loadConfigs = async () => {
|
||||
try {
|
||||
@ -7044,6 +7066,17 @@ onUnmounted(() => {
|
||||
color: #31f08b;
|
||||
}
|
||||
}
|
||||
|
||||
.attachment-locked-notice {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: $space-sm $space-md;
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
border: 1px dashed rgba(255, 255, 255, 0.15);
|
||||
border-radius: $radius-md;
|
||||
color: #888;
|
||||
font-size: 13px;
|
||||
}
|
||||
}
|
||||
|
||||
// 分页
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user