Работа над группировкой
This commit is contained in:
@@ -1146,7 +1146,7 @@ class Reader {
|
|||||||
});
|
});
|
||||||
book = Object.assign({}, wasOpened, {data: resp.data});
|
book = Object.assign({}, wasOpened, {data: resp.data});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
//молчим
|
this.$root.notify.error('Конвертированный файл не найден на сервере', 'Ошибка загрузки');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1186,16 +1186,17 @@ class Reader {
|
|||||||
found = (found ? _.cloneDeep(found) : found);
|
found = (found ? _.cloneDeep(found) : found);
|
||||||
|
|
||||||
if (found) {
|
if (found) {
|
||||||
//спрашиваем, надо ли объединить файлы
|
if (wasOpened.sameBookKey != found.sameBookKey) {
|
||||||
const askResult = (wasOpened.path == found.path) ||
|
//спрашиваем, надо ли объединить файлы
|
||||||
await this.$root.stdDialog.askYesNo(`
|
const askResult = bookManager.keysEqual(found.path, addedBook.path) ||
|
||||||
Файл с именем "${wasOpened.uploadFileName}" уже есть в загруженных.
|
await this.$root.stdDialog.askYesNo(`
|
||||||
<br>Объединить позицию?`, 'Найдена похожая книга');
|
Файл с именем "${wasOpened.uploadFileName}" уже есть в загруженных.
|
||||||
|
<br>Объединить позицию?`, 'Найдена похожая книга');
|
||||||
if (askResult) {
|
if (askResult) {
|
||||||
wasOpened.bookPos = found.bookPos;
|
wasOpened.bookPos = found.bookPos;
|
||||||
wasOpened.bookPosSeen = found.bookPosSeen;
|
wasOpened.bookPosSeen = found.bookPosSeen;
|
||||||
wasOpened.sameBookKey = found.sameBookKey;
|
wasOpened.sameBookKey = found.sameBookKey;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
wasOpened.sameBookKey = wasOpened.uploadFileName;
|
wasOpened.sameBookKey = wasOpened.uploadFileName;
|
||||||
@@ -1204,6 +1205,9 @@ class Reader {
|
|||||||
wasOpened.sameBookKey = addedBook.url;
|
wasOpened.sameBookKey = addedBook.url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!bookManager.keysEqual(wasOpened.path, addedBook.path))
|
||||||
|
delete wasOpened.loadTime;
|
||||||
|
|
||||||
// добавляем в историю
|
// добавляем в историю
|
||||||
await bookManager.setRecentBook(Object.assign(wasOpened, addedBook));
|
await bookManager.setRecentBook(Object.assign(wasOpened, addedBook));
|
||||||
this.mostRecentBook();
|
this.mostRecentBook();
|
||||||
|
|||||||
@@ -70,15 +70,16 @@
|
|||||||
{{ item.desc.author }}
|
{{ item.desc.author }}
|
||||||
</div>
|
</div>
|
||||||
<div>{{ item.desc.title }}</div>
|
<div>{{ item.desc.title }}</div>
|
||||||
|
<!--div>{{ item.path }}</div-->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row q-mt-xs" style="font-size: 80%">
|
<div class="row q-mt-xs" style="font-size: 80%">
|
||||||
<div class="row justify-center row-info-bottom" style="width: 50px">
|
<div class="row justify-center row-info-bottom" style="width: 60px">
|
||||||
{{ item.desc.perc }}
|
|
||||||
</div>
|
|
||||||
<div class="row justify-center row-info-bottom" style="width: 50px">
|
|
||||||
{{ item.desc.textLen }}
|
{{ item.desc.textLen }}
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row justify-center row-info-bottom" style="width: 60px">
|
||||||
|
{{ item.desc.perc }}
|
||||||
|
</div>
|
||||||
<div class="row justify-center row-info-bottom" style="width: 1px">
|
<div class="row justify-center row-info-bottom" style="width: 1px">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -285,7 +286,7 @@ class RecentBooksPage {
|
|||||||
if (book.textLength) {
|
if (book.textLength) {
|
||||||
readPart = p/book.textLength;
|
readPart = p/book.textLength;
|
||||||
perc = `${(readPart*100).toFixed(2)}%`;
|
perc = `${(readPart*100).toFixed(2)}%`;
|
||||||
textLen = `${Math.round(book.textLength/1000)}k`;
|
textLen = `${Math.floor(readPart*book.textLength/1000)}/${Math.floor(book.textLength/1000)}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
const bt = utils.getBookTitle(book.fb2);
|
const bt = utils.getBookTitle(book.fb2);
|
||||||
|
|||||||
@@ -367,6 +367,13 @@ class BookManager {
|
|||||||
keyFromPath(bookPath) {
|
keyFromPath(bookPath) {
|
||||||
return path.basename(bookPath);
|
return path.basename(bookPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
keysEqual(bookPath1, bookPath2) {
|
||||||
|
if (bookPath1 === undefined || bookPath2 === undefined)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return (this.keyFromPath(bookPath1) === this.keyFromPath(bookPath2));
|
||||||
|
}
|
||||||
//-- recent --------------------------------------------------------------
|
//-- recent --------------------------------------------------------------
|
||||||
async recentSetItem(item = null, skipCheck = false) {
|
async recentSetItem(item = null, skipCheck = false) {
|
||||||
const rev = await bmRecentStoreNew.getItem('rev');
|
const rev = await bmRecentStoreNew.getItem('rev');
|
||||||
@@ -506,8 +513,8 @@ class BookManager {
|
|||||||
|
|
||||||
for (const key in this.recent) {
|
for (const key in this.recent) {
|
||||||
const book = this.recent[key];
|
const book = this.recent[key];
|
||||||
if (!book.deleted && book.url == url && book.touchTime > max) {
|
if (!book.deleted && book.url == url && book.loadTime > max) {
|
||||||
max = book.touchTime;
|
max = book.loadTime;
|
||||||
result = book;
|
result = book;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -521,8 +528,8 @@ class BookManager {
|
|||||||
|
|
||||||
for (const key in this.recent) {
|
for (const key in this.recent) {
|
||||||
const book = this.recent[key];
|
const book = this.recent[key];
|
||||||
if (!book.deleted && book.sameBookKey == sameKey && book.touchTime > max) {
|
if (!book.deleted && book.sameBookKey == sameKey && book.loadTime > max) {
|
||||||
max = book.touchTime;
|
max = book.loadTime;
|
||||||
result = book;
|
result = book;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user