Работа над проектом

This commit is contained in:
Book Pauk
2022-09-02 13:48:30 +07:00
parent 6542d17b0b
commit 63a7eddcab
2 changed files with 38 additions and 4 deletions

View File

@@ -51,14 +51,18 @@
/>
<div class="q-mx-xs" />
<q-input
v-model="genre" :maxlength="inputMaxLength" :debounce="inputDebounce"
class="bg-white q-mt-xs" style="width: 200px;" label="Жанр" stack-label outlined dense clearable readonly
v-model="genreNames" :maxlength="inputMaxLength" :debounce="inputDebounce"
class="bg-white q-mt-xs" input-style="cursor: pointer" style="width: 200px;" label="Жанр" stack-label outlined dense clearable readonly
@click="selectGenre"
/>
>
<q-tooltip v-if="genreNames" :delay="500" anchor="bottom right" content-style="font-size: 80%" max-width="400px">
{{ genreNames }}
</q-tooltip>
</q-input>
<div class="q-mx-xs" />
<q-input
v-model="lang" :maxlength="inputMaxLength" :debounce="inputDebounce"
class="bg-white q-mt-xs" style="width: 80px;" label="Язык" stack-label outlined dense clearable readonly
class="bg-white q-mt-xs" input-style="cursor: pointer" style="width: 80px;" label="Язык" stack-label outlined dense clearable readonly
@click="selectLang"
/>
<div class="q-mx-xs" />
@@ -325,6 +329,20 @@ class Search {
return this.$store.state.settings;
}
get genreNames() {
let result = [];
const genre = new Set(this.genre.split(','));
for (const section of this.genreTree) {
for (const g of section.value)
if (genre.has(g.value))
result.push(g.name);
}
return result.join(', ');
}
makeTitle() {
const collection = this.config.dbConfig.inpxInfo.collection.split('\n');
this.collection = collection[0].trim();

View File

@@ -223,12 +223,28 @@ class WebWorker {
}
//добавим к жанрам те, что нашлись при парсинге
const genreParsed = new Set();
const rows = await db.select({table: 'genre', map: `(r) => ({value: r.value})`});
for (const row of rows) {
genreParsed.add(row.value);
if (!genreValues.has(row.value))
last.value.push({name: row.value, value: row.value});
}
//уберем те, которые не нашлись при парсинге
for (let j = 0; j < genres.length; j++) {
const section = genres[j];
for (let i = 0; i < section.value.length; i++) {
const g = section.value[i];
if (!genreParsed.has(g.value))
section.value.splice(i--, 1);
}
if (!section.value.length)
genres.splice(j--, 1);
}
result = {
genreTree: genres,
inpxHash: (config.inpxHash ? config.inpxHash : ''),