增加公共下载进度、增加接收SKU、密钥分别存放

This commit is contained in:
super
2026-05-28 16:41:20 +08:00
parent 59a5fee7b4
commit 7ac6cbf5b0
119 changed files with 4077 additions and 293 deletions
@@ -0,0 +1,133 @@
<template>
<div v-if="visibleItems.length" class="download-progress-panel">
<div class="download-progress-title">下载进度</div>
<div v-for="item in visibleItems" :key="item.id" class="download-progress-item" :class="item.status">
<div class="download-progress-head">
<span class="download-progress-name" :title="item.filename">{{ item.filename }}</span>
<button type="button" class="download-progress-close" @click="clearDownloadProgress(item.id)">×</button>
</div>
<div class="download-progress-meta">
<span>{{ downloadProgressText(item) }}</span>
<span>{{ item.percent }}%</span>
</div>
<div class="download-progress-track">
<div class="download-progress-bar" :style="{ width: `${item.percent}%` }"></div>
</div>
<div class="download-progress-size">
{{ formatDownloadBytes(item.downloaded) }} / {{ formatDownloadBytes(item.total) }}
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { computed } from 'vue'
import {
clearDownloadProgress,
downloadProgressText,
formatDownloadBytes,
useDownloadProgress,
} from '@/shared/utils/download-progress'
const { items } = useDownloadProgress()
const visibleItems = computed(() => items.value.slice(0, 5))
</script>
<style scoped>
.download-progress-panel {
position: fixed;
right: 22px;
bottom: 22px;
z-index: 3000;
width: 360px;
max-width: calc(100vw - 44px);
padding: 14px;
border: 1px solid rgba(105, 135, 166, .42);
border-radius: 14px;
background: rgba(18, 23, 30, .96);
box-shadow: 0 18px 60px rgba(0, 0, 0, .48);
backdrop-filter: blur(10px);
}
.download-progress-title {
margin-bottom: 10px;
color: #eef6ff;
font-size: 14px;
font-weight: 800;
}
.download-progress-item {
padding: 10px;
border: 1px solid rgba(77, 96, 116, .5);
border-radius: 10px;
background: rgba(31, 39, 49, .92);
}
.download-progress-item + .download-progress-item {
margin-top: 8px;
}
.download-progress-head,
.download-progress-meta,
.download-progress-size {
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
}
.download-progress-name {
min-width: 0;
overflow: hidden;
color: #f4f8fc;
font-size: 13px;
font-weight: 700;
text-overflow: ellipsis;
white-space: nowrap;
}
.download-progress-close {
border: none;
background: transparent;
color: #8d9cab;
font-size: 18px;
line-height: 1;
cursor: pointer;
}
.download-progress-meta {
margin-top: 8px;
color: #9fcfff;
font-size: 12px;
}
.download-progress-track {
height: 8px;
margin-top: 7px;
overflow: hidden;
border-radius: 999px;
background: #27313b;
}
.download-progress-bar {
height: 100%;
border-radius: inherit;
background: linear-gradient(90deg, #35d0ba, #4aa3ff);
transition: width .2s ease;
}
.download-progress-size {
margin-top: 6px;
color: #8794a1;
font-size: 11px;
}
.download-progress-item.success .download-progress-meta {
color: #64d98a;
}
.download-progress-item.failed .download-progress-meta {
color: #ff8d8d;
}
</style>