diff --git a/client/components/Reader/RecentBooksPage/RecentBooksPage.vue b/client/components/Reader/RecentBooksPage/RecentBooksPage.vue index 7f38920d..8bdca700 100644 --- a/client/components/Reader/RecentBooksPage/RecentBooksPage.vue +++ b/client/components/Reader/RecentBooksPage/RecentBooksPage.vue @@ -46,20 +46,20 @@
- {{ (item.group ? item.group.length + 1 : 0) }} верси{{ wordEnding((item.group ? item.group.length : 0), 1) }} + {{ (item.group ? item.group.length + 1 : 0) }} верси{{ wordEnding((item.group ? item.group.length + 1 : 0), 1) }}
-
+
{{ item.num }}
-
- Чит: {{ item.touchTime }} +
+ Читался: {{ item.touchTime }}
-
- Загр: {{ item.addTime }} +
+ Загружен: {{ item.loadTime }}
@@ -238,7 +238,7 @@ class RecentBooksPage { loadSettings() { const settings = this.settings; this.showSameBook = settings.recentShowSameBook; - this.sortMethod = settings.recentSortMethod || 'addTimeDesc'; + this.sortMethod = settings.recentSortMethod || 'loadTimeDesc'; } get settings() { @@ -261,8 +261,9 @@ class RecentBooksPage { let d = new Date(); d.setTime(book.touchTime); const touchTime = utils.formatDate(d); - d.setTime(book.addTime); - const addTime = utils.formatDate(d); + const loadTimeRaw = (book.loadTime ? book.loadTime : 0);//book.addTime); + d.setTime(loadTimeRaw); + const loadTime = utils.formatDate(d); let readPart = 0; let perc = ''; @@ -282,7 +283,7 @@ class RecentBooksPage { result.push({ touchTime, - addTime, + loadTime, desc: { author, title: `${title}${perc}${textLen}`, @@ -298,7 +299,7 @@ class RecentBooksPage { inGroup: false, //для сортировки - addTimeRaw: book.addTime, + loadTimeRaw, touchTimeRaw: book.touchTime, descString: `${author}${title}${perc}${textLen}`, }); @@ -307,7 +308,7 @@ class RecentBooksPage { //нумерация let num = 0; - result.sort((a, b) => b.addTimeRaw - a.addTimeRaw); + result.sort((a, b) => b.loadTimeRaw - a.loadTimeRaw); for (const book of result) { num++; book.num = num; @@ -326,11 +327,11 @@ class RecentBooksPage { //сортировка switch (this.sortMethod) { - case 'addTimeDesc': - result.sort((a, b) => b.addTimeRaw - a.addTimeRaw); + case 'loadTimeDesc': + result.sort((a, b) => b.loadTimeRaw - a.loadTimeRaw); break; - case 'addTimeAsc': - result.sort((a, b) => a.addTimeRaw - b.addTimeRaw); + case 'loadTimeAsc': + result.sort((a, b) => a.loadTimeRaw - b.loadTimeRaw); break; case 'touchTimeDesc': result.sort((a, b) => b.touchTimeRaw - a.touchTimeRaw); diff --git a/client/components/Reader/share/bookManager.js b/client/components/Reader/share/bookManager.js index 20f52199..5a37cea2 100644 --- a/client/components/Reader/share/bookManager.js +++ b/client/components/Reader/share/bookManager.js @@ -90,6 +90,8 @@ class BookManager { newRecent[newKey] = _.cloneDeep(book); newRecent[newKey].key = newKey; + if (!newRecent[newKey].loadTime) + newRecent[newKey].loadTime = newRecent[newKey].addTime; } this.recent = newRecent; @@ -231,7 +233,7 @@ class BookManager { async addBook(newBook, callback) { let meta = {url: newBook.url, path: newBook.path}; meta.key = this.keyFromPath(meta.path); - meta.addTime = Date.now(); + meta.addTime = Date.now();//время добавления в кеш const cb = (perc) => { const p = Math.round(30*perc/100); @@ -405,7 +407,10 @@ class BookManager { async setRecentBook(value) { let result = this.metaOnly(value); - result.touchTime = Date.now(); + result.touchTime = Date.now();//время последнего чтения + if (!result.loadTime) + result.loadTime = Date.now();//время загрузки файла + result.deleted = 0; if (this.recent[result.key]) {