4141 </div >
4242 <!-- 状态 -->
4343 <div class =" status" >
44- <n-flex v-if = " item.status === 'downloading' " vertical :size =" 6" style =" width : 100% " >
44+ <n-flex vertical :size =" 6" style =" width : 100% " >
4545 <n-flex justify =" space-between" >
46- <n-text depth =" 3" style =" font-size : 12px " >{{ item.progress }}%</n-text >
47- <n-text depth =" 3" style =" font-size : 12px " >
46+ <n-text
47+ :type =" item.status === 'failed' ? 'error' : undefined"
48+ :depth =" item.status === 'failed' ? undefined : '3'"
49+ style =" font-size : 12px "
50+ >
51+ {{
52+ item.status === "downloading"
53+ ? `${item.progress}%`
54+ : item.status === "waiting"
55+ ? "等待下载..."
56+ : "下载失败"
57+ }}
58+ </n-text >
59+ <n-text v-if =" item.status === 'downloading'" depth =" 3" style =" font-size : 12px " >
4860 {{ item.transferred }} / {{ item.totalSize }}
4961 </n-text >
5062 </n-flex >
51- <div class =" custom-progress" >
52- <div class =" bar" :style =" { width: item.progress + '%' }" />
53- <div
54- class =" light"
55- v-if =" item.status === 'downloading'"
56- :style =" { left: item.progress + '%' }"
57- />
58- </div >
59- </n-flex >
60- <n-flex v-else-if =" item.status === 'waiting'" vertical :size =" 6" style =" width : 100% " >
61- <n-text depth =" 3" style =" font-size : 12px " >等待下载...</n-text >
62- <n-progress
63- type =" line"
64- :percentage =" 0"
65- :show-indicator =" false"
66- style =" height : 4px "
67- />
68- </n-flex >
69- <n-flex v-else vertical :size =" 6" style =" width : 100% " >
70- <n-text type =" error" style =" font-size : 12px " >下载失败</n-text >
7163 <n-progress
7264 type =" line"
73- :percentage =" 0"
65+ :percentage =" item.status === 'downloading' ? item.progress : 0"
7466 :show-indicator =" false"
75- status =" error"
67+ :status =" item.status === 'failed' ? 'error' : undefined"
68+ :class =" item.status === 'downloading' ? 'downloading-progress' : ''"
7669 style =" height : 4px "
7770 />
7871 </n-flex >
@@ -246,6 +239,10 @@ const sortedDownloadingSongs = computed(() => {
246239 flex : 1 ;
247240 padding-right : 20px ;
248241 padding-left : 12px ;
242+
243+ .downloading-progress {
244+ --n-fill-color : rgb (var (--primary ));
245+ }
249246 }
250247
251248 .actions {
@@ -255,39 +252,6 @@ const sortedDownloadingSongs = computed(() => {
255252 min-width : 120px ;
256253 }
257254 }
258- .custom-progress {
259- position : relative ;
260- width : 100% ;
261- height : 6px ;
262- margin-top : 4px ;
263- background-color : var (--surface-variant-hex );
264- border-radius : 3px ;
265- overflow : hidden ;
266-
267- .bar {
268- height : 100% ;
269- border-radius : 3px ;
270- background : rgb (var (--primary ));
271- background : linear-gradient (
272- 90deg ,
273- rgba (var (--primary ), 0.7 ) 0% ,
274- rgba (var (--primary ), 1 ) 100%
275- );
276- transition : width 0.3s ease-out ;
277- }
278-
279- .light {
280- position : absolute ;
281- top : 0 ;
282- bottom : 0 ;
283- width : 15px ;
284- transform : skewX (-20deg ) translateX (-50% );
285- background : rgba (255 , 255 , 255 , 0.4 );
286- filter : blur (2px );
287- transition : left 0.3s ease-out ;
288- pointer-events : none ;
289- }
290- }
291255 }
292256 }
293257
0 commit comments