From 26d62cdef436343fcc96c762adaa3f1bbca78823 Mon Sep 17 00:00:00 2001 From: haiyangcui Date: Mon, 29 Mar 2021 22:31:19 +0200 Subject: [PATCH] =?UTF-8?q?=E5=8E=86=E5=8F=B2=E9=A1=B5=E9=9D=A2=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=8C=89=E5=AE=8C=E6=88=90=E5=BA=A6=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/History.vue | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/components/History.vue b/src/components/History.vue index c35a4d8..9f8792a 100644 --- a/src/components/History.vue +++ b/src/components/History.vue @@ -79,10 +79,10 @@ @@ -134,7 +134,7 @@
{{props.data.name}}
- {{fmtMSS(props.data.time.toFixed(0))}}/{{fmtMSS(props.data.duration.toFixed(0))}} + {{fmtMSS(props.data.time.toFixed(0))}}/{{fmtMSS(props.data.duration.toFixed(0))}} ({{progress(props.data)}}%) 在线解析 @@ -176,7 +176,7 @@ export default { selectedAreas: [], selectedTypes: [], sortKeyword: '', - sortKeywords: ['按片名', '按上映年份', '按更新时间'], + sortKeywords: ['按片名', '按上映年份', '按更新时间', '按完成度'], selectedYears: { start: 0, end: new Date().getFullYear() }, onlyShowItemsHasUpdate: false } @@ -339,6 +339,9 @@ export default { return new Date(b.detail.last) - new Date(a.detail.last) }) break + case '按完成度': + filteredData.sort(this.sortByProgress) + break default: break } @@ -348,6 +351,16 @@ export default { this.filteredList = this.filteredList.filter(x => x.hasUpdate) } }, + progress (e) { + return e.duration > 0 ? ((e.time / e.duration) * 100).toFixed(0) : 0 + }, + sortByProgress (a, b) { + if (this.progress(a) < this.progress(b)) { + return -1 + } else { + return 1 + } + }, fmtMSS (s) { return (s - (s %= 60)) / 60 + (s > 9 ? ':' : ':0') + s },