Работа над HistoryPage
This commit is contained in:
@@ -26,8 +26,10 @@
|
||||
Время<br>просм.
|
||||
</template>
|
||||
<template slot-scope="scope"><!-- eslint-disable-line vue/no-unused-vars -->
|
||||
{{ scope.row.touchDate }}<br>
|
||||
{{ scope.row.touchTime }}
|
||||
<div class="desc" @click="loadBook(scope.row.url)">
|
||||
{{ scope.row.touchDate }}<br>
|
||||
{{ scope.row.touchTime }}
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
@@ -46,8 +48,8 @@
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<div class="desc" @click="loadBook(scope.row.url)">
|
||||
<span>{{ scope.row.desc.author }}</span><br>
|
||||
<span>{{ `"${scope.row.desc.title}"` }}</span>
|
||||
<span style="color: green">{{ scope.row.desc.author }}</span><br>
|
||||
<span>{{ scope.row.desc.title }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -113,12 +115,17 @@ class HistoryPage extends Vue {
|
||||
d.setTime(book.touchTime);
|
||||
const t = formatDate(d).split(' ');
|
||||
|
||||
let perc = '';
|
||||
const p = (book.bookPosSeen ? book.bookPosSeen : (book.bookPos ? book.bookPos : 0));
|
||||
if (book.textLength)
|
||||
perc = ` [${((p/book.textLength)*100).toFixed(2)}%]`;
|
||||
|
||||
result.push({
|
||||
touchDateTime: book.touchTime,
|
||||
touchDate: t[0],
|
||||
touchTime: t[1],
|
||||
desc: {
|
||||
title: book.fb2.bookTitle,
|
||||
title: `"${book.fb2.bookTitle}"${perc}`,
|
||||
author: _.compact([
|
||||
book.fb2.lastName,
|
||||
book.fb2.firstName,
|
||||
|
||||
@@ -84,7 +84,7 @@ export default @Component({
|
||||
textPage.bookPos = newValue;
|
||||
}
|
||||
if (this.lastOpenedBook && this.lastOpenedBook.bookPos != newValue) {
|
||||
this.commit('reader/setOpenedBook', Object.assign({}, this.lastOpenedBook, {bookPos: newValue}));
|
||||
this.commit('reader/setOpenedBook', Object.assign({}, this.lastOpenedBook, {bookPos: newValue, bookPosSeen: this.bookPosSeen}));
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -168,6 +168,7 @@ class Reader extends Vue {
|
||||
}
|
||||
|
||||
bookPosChanged(event) {
|
||||
this.bookPosSeen = event.bookPosSeen;
|
||||
this.bookPos = event.bookPos;
|
||||
this.updateRoute();
|
||||
}
|
||||
@@ -311,6 +312,7 @@ class Reader extends Vue {
|
||||
let wasOpened = this.reader.openedBook[key];
|
||||
wasOpened = (wasOpened ? wasOpened : {});
|
||||
const bookPos = (opts.bookPos !== undefined ? opts.bookPos : wasOpened.bookPos);
|
||||
const bookPosSeen = (opts.bookPos !== undefined ? opts.bookPos : wasOpened.bookPosSeen);
|
||||
|
||||
let book = null;
|
||||
|
||||
@@ -322,7 +324,7 @@ class Reader extends Vue {
|
||||
|
||||
// если есть в локальном кеше
|
||||
if (bookParsed) {
|
||||
this.commit('reader/setOpenedBook', Object.assign({bookPos}, bookManager.metaOnly(bookParsed)));
|
||||
this.commit('reader/setOpenedBook', Object.assign({bookPos, bookPosSeen}, bookManager.metaOnly(bookParsed)));
|
||||
this.loaderActive = false;
|
||||
progress.hide(); this.progressActive = false;
|
||||
return;
|
||||
@@ -358,7 +360,7 @@ class Reader extends Vue {
|
||||
});
|
||||
|
||||
// добавляем в историю
|
||||
this.commit('reader/setOpenedBook', Object.assign({bookPos}, bookManager.metaOnly(addedBook)));
|
||||
this.commit('reader/setOpenedBook', Object.assign({bookPos, bookPosSeen}, bookManager.metaOnly(addedBook)));
|
||||
this.updateRoute(true);
|
||||
|
||||
this.loaderActive = false;
|
||||
|
||||
@@ -68,7 +68,7 @@ class TextPage extends Vue {
|
||||
this.reader = this.$store.state.reader;
|
||||
|
||||
this.debouncedEmitPosChange = _.debounce((newValue) => {
|
||||
this.$emit('book-pos-changed', {bookPos: newValue});
|
||||
this.$emit('book-pos-changed', {bookPos: newValue, bookPosSeen: this.bookPosSeen});
|
||||
}, 1000);
|
||||
|
||||
this.debouncedStartClickRepeat = _.debounce((x, y) => {
|
||||
@@ -285,7 +285,7 @@ class TextPage extends Vue {
|
||||
await this.loadFonts();
|
||||
|
||||
//this.draw();
|
||||
|
||||
|
||||
// шрифты хрен знает когда подгружаются, поэтому
|
||||
let i = 0;
|
||||
this.parsed.force = true;
|
||||
@@ -459,6 +459,7 @@ class TextPage extends Vue {
|
||||
if (i >= 0) {
|
||||
this.statusBar = this.drawHelper.drawStatusBar(this.statusBarTop, this.statusBarHeight,
|
||||
lines[i].end, this.parsed.textLength, this.title);
|
||||
this.bookPosSeen = lines[i].end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user