Работа над SeriesList
This commit is contained in:
@@ -136,21 +136,19 @@ import { reactive } from 'vue';
|
|||||||
|
|
||||||
import BaseList from '../BaseList';
|
import BaseList from '../BaseList';
|
||||||
|
|
||||||
import authorBooksStorage from '../authorBooksStorage';
|
|
||||||
|
|
||||||
import * as utils from '../../../share/utils';
|
import * as utils from '../../../share/utils';
|
||||||
|
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
|
|
||||||
class SeriesList extends BaseList {
|
class SeriesList extends BaseList {
|
||||||
/*async updateTableData() {
|
async updateTableData() {
|
||||||
let result = [];
|
let result = [];
|
||||||
|
|
||||||
const expandedSet = new Set(this.expandedAuthor);
|
const expandedSet = new Set(this.expandedSeries);
|
||||||
const authors = this.searchResult.author;
|
const series = this.searchResult.series;
|
||||||
if (!authors)
|
if (!series)
|
||||||
return;
|
return;
|
||||||
|
/*
|
||||||
let num = 0;
|
let num = 0;
|
||||||
this.hiddenCount = 0;
|
this.hiddenCount = 0;
|
||||||
for (const rec of authors) {
|
for (const rec of authors) {
|
||||||
@@ -190,10 +188,10 @@ class SeriesList extends BaseList {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.tableData = result;
|
this.tableData = result;
|
||||||
}*/
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
async refresh() {
|
async refresh() {
|
||||||
return;
|
|
||||||
//параметры запроса
|
//параметры запроса
|
||||||
let newQuery = _.cloneDeep(this.search);
|
let newQuery = _.cloneDeep(this.search);
|
||||||
newQuery = newQuery.setDefaults(newQuery);
|
newQuery = newQuery.setDefaults(newQuery);
|
||||||
@@ -204,25 +202,6 @@ class SeriesList extends BaseList {
|
|||||||
return;
|
return;
|
||||||
this.prevQuery = newQuery;
|
this.prevQuery = newQuery;
|
||||||
|
|
||||||
//оптимизация, вместо запроса к серверу, берем из кеша
|
|
||||||
if (this.abCacheEnabled && this.search.author && this.search.author[0] == '=') {
|
|
||||||
const authorSearch = this.search.author.substring(1);
|
|
||||||
const author = this.cachedAuthors[authorSearch];
|
|
||||||
|
|
||||||
if (author) {
|
|
||||||
const key = `author-${author.id}-${this.list.inpxHash}`;
|
|
||||||
let data = await authorBooksStorage.getData(key);
|
|
||||||
|
|
||||||
if (data) {
|
|
||||||
this.list.queryFound = 1;
|
|
||||||
this.list.totalFound = 1;
|
|
||||||
this.searchResult = {author: [author]};
|
|
||||||
await this.updateTableData();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.queryExecute = newQuery;
|
this.queryExecute = newQuery;
|
||||||
|
|
||||||
if (this.refreshing)
|
if (this.refreshing)
|
||||||
@@ -238,13 +217,13 @@ class SeriesList extends BaseList {
|
|||||||
(async() => {
|
(async() => {
|
||||||
await utils.sleep(500);
|
await utils.sleep(500);
|
||||||
if (inSearch)
|
if (inSearch)
|
||||||
this.loadingMessage = 'Поиск авторов...';
|
this.loadingMessage = 'Поиск серий...';
|
||||||
})();
|
})();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const result = await this.api.search(query);
|
const result = await this.api.seriesSearch(query);
|
||||||
|
|
||||||
this.list.queryFound = result.author.length;
|
this.list.queryFound = result.series.length;
|
||||||
this.list.totalFound = result.totalFound;
|
this.list.totalFound = result.totalFound;
|
||||||
this.list.inpxHash = result.inpxHash;
|
this.list.inpxHash = result.inpxHash;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user