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 },