diff --git a/client/components/Reader/RecentBooksPage/RecentBooksPage.vue b/client/components/Reader/RecentBooksPage/RecentBooksPage.vue
index ede6a354..c602bbdb 100644
--- a/client/components/Reader/RecentBooksPage/RecentBooksPage.vue
+++ b/client/components/Reader/RecentBooksPage/RecentBooksPage.vue
@@ -39,10 +39,35 @@
+
+
+ Метод сортировки
+
+
+
+
+
+
+
@@ -131,90 +156,6 @@
-
-
@@ -239,6 +180,9 @@ const componentOptions = {
search() {
this.updateTableData();
},
+ sortMethod() {
+ this.updateTableData();
+ },
settings() {
this.loadSettings();
},
@@ -271,6 +215,8 @@ class RecentBooksPage {
//this.$refs.input.focus();//плохо на планшетах
});
+ this.inited = true;
+
(async() => {
this.showBar();
await this.updateTableData();
@@ -289,6 +235,9 @@ class RecentBooksPage {
}
async updateTableData() {
+ if (!this.inited)
+ return;
+
await this.lock.get();
try {
let result = [];
@@ -346,7 +295,6 @@ class RecentBooksPage {
//для сортировки
loadTimeRaw,
touchTimeRaw: book.touchTime,
- descString: `${author}${title}${perc}${textLen}`,
});
}
@@ -385,6 +333,18 @@ class RecentBooksPage {
case 'touchTimeAsc':
result.sort((a, b) => a.touchTimeRaw - b.touchTimeRaw);
break;
+ case 'authorDesc':
+ result.sort((a, b) => b.desc.author.localeCompare(a.desc.author));
+ break;
+ case 'authorAsc':
+ result.sort((a, b) => a.desc.author.localeCompare(b.desc.author));
+ break;
+ case 'titleDesc':
+ result.sort((a, b) => b.desc.title.localeCompare(a.desc.title));
+ break;
+ case 'titleAsc':
+ result.sort((a, b) => a.desc.title.localeCompare(b.desc.title));
+ break;
}
//группировка
@@ -540,6 +500,12 @@ class RecentBooksPage {
this.updateTableData();
}
+ sortMethodSelected() {
+ const newSettings = _.cloneDeep(this.settings);
+ newSettings.recentSortMethod = this.sortMethod;
+ this.commit('reader/setSettings', newSettings);
+ }
+
async scrollToActiveBook() {
this.lockScroll = true;
try {
@@ -586,6 +552,20 @@ class RecentBooksPage {
}
}
+
+ get sortMethodOptions() {
+ return [
+ {label: '↑ Время загрузки', value: 'loadTimeDesc'},
+ {label: '↓ Время загрузки', value: 'loadTimeAsc'},
+ {label: '↑ Время чтения', value: 'touchTimeDesc'},
+ {label: '↓ Время чтения', value: 'touchTimeAsc'},
+ {label: '↑ Автор', value: 'authorDesc'},
+ {label: '↓ Автор', value: 'authorAsc'},
+ {label: '↑ Название', value: 'titleDesc'},
+ {label: '↓ Название', value: 'titleAsc'},
+ ];
+ }
+
close() {
this.$emit('recent-books-close');
}