Улучшение отображения BookView
This commit is contained in:
@@ -31,9 +31,14 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="q-ml-sm clickable2" @click="selectTitle">
|
||||
<div class="q-ml-sm row items-center">
|
||||
{{ book.serno ? `${book.serno}. ` : '' }}
|
||||
<span :class="titleColor">{{ bookTitle }}</span>
|
||||
<div v-if="showAuthor && book.author">
|
||||
<span class="clickable2 text-green-10" @click="selectAuthor">{{ bookAuthor }}</span>
|
||||
-
|
||||
<span class="clickable2" :class="titleColor" @click="selectTitle">{{ book.title }}</span>
|
||||
</div>
|
||||
<span v-else class="clickable2" :class="titleColor" @click="selectTitle">{{ book.title }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -106,15 +111,13 @@ class BookView {
|
||||
return this.$store.state.settings;
|
||||
}
|
||||
|
||||
get bookTitle() {
|
||||
get bookAuthor() {
|
||||
if (this.showAuthor && this.book.author) {
|
||||
let a = this.book.author.split(',');
|
||||
const author = a.slice(0, 2).join(', ') + (a.length > 2 ? ' и др.' : '');
|
||||
|
||||
return `${author} - ${this.book.title}`;
|
||||
} else {
|
||||
return this.book.title;
|
||||
return a.slice(0, 2).join(', ') + (a.length > 2 ? ' и др.' : '');
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
get bookSize() {
|
||||
@@ -148,6 +151,10 @@ class BookView {
|
||||
return `(${result.join(' / ')})`;
|
||||
}
|
||||
|
||||
selectAuthor() {
|
||||
this.$emit('bookEvent', {action: 'authorClick', book: this.book});
|
||||
}
|
||||
|
||||
selectTitle() {
|
||||
this.$emit('bookEvent', {action: 'titleClick', book: this.book});
|
||||
}
|
||||
|
||||
@@ -814,6 +814,10 @@ class Search {
|
||||
this.search.series = `=${series}`;
|
||||
}
|
||||
|
||||
selectTitle(title) {
|
||||
this.search.title = `=${title}`;
|
||||
}
|
||||
|
||||
async download(book, action) {
|
||||
if (this.downloadFlag)
|
||||
return;
|
||||
@@ -893,8 +897,11 @@ class Search {
|
||||
|
||||
bookEvent(event) {
|
||||
switch (event.action) {
|
||||
case 'authorClick':
|
||||
this.selectAuthor(event.book.author);
|
||||
break;
|
||||
case 'titleClick':
|
||||
this.search.title = `=${event.book.title}`;
|
||||
this.selectTitle(event.book.title);
|
||||
break;
|
||||
case 'download':
|
||||
case 'copyLink':
|
||||
|
||||
Reference in New Issue
Block a user