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