fix: 任务卡片去掉重复的进度数字
This commit is contained in:
@@ -95,9 +95,20 @@ function noteText(job: DownloadJob) {
|
||||
text = "保存编号进度时文件被拒绝访问,已下载的内容还在,点继续即可";
|
||||
}
|
||||
if (!text || text === statusLabel(job)) return "";
|
||||
if (text === "正在读取并下载" || text === "准备中") return "";
|
||||
if (/^已完成 \d+(,已读取 \d+)?(,失败 \d+)?$/.test(text)) return "";
|
||||
if (/^已完成 \d+\/\d+,失败 \d+$/.test(text)) return "";
|
||||
return text;
|
||||
}
|
||||
|
||||
function cardFacts(job: DownloadJob) {
|
||||
if (waitingToRead(job)) return [job.id, "等待读取编号", `已写入 ${job.writtenRows} 行`];
|
||||
const progress = scanning(job)
|
||||
? [`已下载 ${job.completed}`, `已读取 ${job.discovered || 0} 个栅格`]
|
||||
: [`${job.completed}/${job.total} 个栅格`];
|
||||
return [job.id, ...progress, `已写入 ${job.writtenRows} 行`];
|
||||
}
|
||||
|
||||
function waitingToRead(job: DownloadJob) {
|
||||
return Boolean(job.wholeCity) && job.status === "queued";
|
||||
}
|
||||
@@ -183,15 +194,6 @@ async function changeConcurrency(job: DownloadJob, value: number | null) {
|
||||
}
|
||||
}
|
||||
|
||||
function countText(job: DownloadJob) {
|
||||
const written = `已写入 ${job.writtenRows} 行`;
|
||||
if (waitingToRead(job)) return `${job.id} · 等待读取 · ${written}`;
|
||||
const progress = scanning(job)
|
||||
? `已完成 ${job.completed} · 已读取 ${job.discovered || 0} 个栅格`
|
||||
: `${job.completed}/${job.total} 个栅格`;
|
||||
return `${job.id} · ${progress} · ${written}`;
|
||||
}
|
||||
|
||||
async function saveLimit(value: number | null) {
|
||||
if (!value) return;
|
||||
try {
|
||||
@@ -481,7 +483,9 @@ async function removeJob(job: DownloadJob, files: boolean) {
|
||||
</span>
|
||||
<div>
|
||||
<h3>{{ job.name }}</h3>
|
||||
<div class="sub">{{ countText(job) }}</div>
|
||||
<div class="task-meta">
|
||||
<span v-for="fact in cardFacts(job)" :key="fact">{{ fact }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="task-actions" @click.stop>
|
||||
@@ -519,9 +523,9 @@ async function removeJob(job: DownloadJob, files: boolean) {
|
||||
<n-tag size="small" :type="job.status === 'running' ? 'info' : job.status === 'done' ? 'success' : job.status === 'paused' ? 'warning' : 'default'">
|
||||
{{ statusLabel(job) }}
|
||||
</n-tag>
|
||||
<span v-if="noteText(job)" class="sub">{{ noteText(job) }}</span>
|
||||
<span v-if="noteText(job)" class="task-notice">{{ noteText(job) }}</span>
|
||||
</span>
|
||||
<span class="sub">失败 {{ job.failed }} · {{ formatSize(job.fileBytes) }}</span>
|
||||
<span class="task-size">失败 {{ job.failed }} · {{ formatSize(job.fileBytes) }}</span>
|
||||
</div>
|
||||
<ul v-if="job.failures?.length" class="fail-list">
|
||||
<li v-for="item in job.failures.slice(0, 3)" :key="item.id">{{ item.id }}:{{ item.message }}</li>
|
||||
|
||||
+26
-1
@@ -479,12 +479,37 @@ select {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.foot-status .sub {
|
||||
.task-meta {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
margin-top: 4px;
|
||||
color: var(--muted);
|
||||
font-size: 13px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.task-meta span:not(:last-child)::after {
|
||||
content: "·";
|
||||
margin: 0 8px;
|
||||
color: var(--line);
|
||||
}
|
||||
|
||||
.task-notice {
|
||||
overflow: hidden;
|
||||
color: var(--muted);
|
||||
font-size: 13px;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.task-size {
|
||||
flex: none;
|
||||
color: var(--muted);
|
||||
font-size: 13px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.task h3 {
|
||||
margin: 0;
|
||||
font-size: 15px;
|
||||
|
||||
Reference in New Issue
Block a user