Добавлено отображение даты поступления
This commit is contained in:
@@ -50,7 +50,7 @@ export default class BaseList {
|
|||||||
expandedSeries = [];
|
expandedSeries = [];
|
||||||
|
|
||||||
showCounts = true;
|
showCounts = true;
|
||||||
showRate = true;
|
showRates = true;
|
||||||
showGenres = true;
|
showGenres = true;
|
||||||
showDeleted = false;
|
showDeleted = false;
|
||||||
abCacheEnabled = true;
|
abCacheEnabled = true;
|
||||||
@@ -81,7 +81,7 @@ export default class BaseList {
|
|||||||
this.expandedAuthor = _.cloneDeep(settings.expandedAuthor);
|
this.expandedAuthor = _.cloneDeep(settings.expandedAuthor);
|
||||||
this.expandedSeries = _.cloneDeep(settings.expandedSeries);
|
this.expandedSeries = _.cloneDeep(settings.expandedSeries);
|
||||||
this.showCounts = settings.showCounts;
|
this.showCounts = settings.showCounts;
|
||||||
this.showRate = settings.showRate;
|
this.showRates = settings.showRates;
|
||||||
this.showGenres = settings.showGenres;
|
this.showGenres = settings.showGenres;
|
||||||
this.showDeleted = settings.showDeleted;
|
this.showDeleted = settings.showDeleted;
|
||||||
this.abCacheEnabled = settings.abCacheEnabled;
|
this.abCacheEnabled = settings.abCacheEnabled;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="row items-center q-my-sm">
|
<div class="row items-center q-my-sm">
|
||||||
<div class="row items-center no-wrap">
|
<div class="row items-center no-wrap">
|
||||||
<div v-if="showRate || showDeleted">
|
<div v-if="showRates || showDeleted">
|
||||||
<div v-if="showRate && !book.del">
|
<div v-if="showRates && !book.del">
|
||||||
<div v-if="book.librate">
|
<div v-if="book.librate">
|
||||||
<q-knob
|
<q-knob
|
||||||
:model-value="book.librate"
|
:model-value="book.librate"
|
||||||
@@ -76,6 +76,10 @@
|
|||||||
{{ bookGenre }}
|
{{ bookGenre }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div v-if="showDates && book.date" class="q-ml-sm">
|
||||||
|
{{ bookDate }}
|
||||||
|
</div>
|
||||||
|
|
||||||
<div v-show="false">
|
<div v-show="false">
|
||||||
{{ book }}
|
{{ book }}
|
||||||
</div>
|
</div>
|
||||||
@@ -86,6 +90,8 @@
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
import vueComponent from '../../vueComponent.js';
|
import vueComponent from '../../vueComponent.js';
|
||||||
|
|
||||||
|
import * as utils from '../../../share/utils';
|
||||||
|
|
||||||
const componentOptions = {
|
const componentOptions = {
|
||||||
components: {
|
components: {
|
||||||
},
|
},
|
||||||
@@ -106,9 +112,10 @@ class BookView {
|
|||||||
titleColor: { type: String, default: 'text-blue-10'},
|
titleColor: { type: String, default: 'text-blue-10'},
|
||||||
};
|
};
|
||||||
|
|
||||||
showRate = true;
|
showRates = true;
|
||||||
showGenres = true;
|
showGenres = true;
|
||||||
showDeleted = false;
|
showDeleted = false;
|
||||||
|
showDates = false;
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
this.loadSettings();
|
this.loadSettings();
|
||||||
@@ -117,8 +124,9 @@ class BookView {
|
|||||||
loadSettings() {
|
loadSettings() {
|
||||||
const settings = this.settings;
|
const settings = this.settings;
|
||||||
|
|
||||||
this.showRate = settings.showRate;
|
this.showRates = settings.showRates;
|
||||||
this.showGenres = settings.showGenres;
|
this.showGenres = settings.showGenres;
|
||||||
|
this.showDates = settings.showDates;
|
||||||
this.showDeleted = settings.showDeleted;
|
this.showDeleted = settings.showDeleted;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,6 +182,14 @@ class BookView {
|
|||||||
return `(${result.join(' / ')})`;
|
return `(${result.join(' / ')})`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get bookDate() {
|
||||||
|
if (!this.book.date)
|
||||||
|
return '';
|
||||||
|
|
||||||
|
const date = utils.parseDate(this.book.date);
|
||||||
|
return utils.formatDate(date, 'noDate');
|
||||||
|
}
|
||||||
|
|
||||||
selectAuthor() {
|
selectAuthor() {
|
||||||
this.$emit('bookEvent', {action: 'authorClick', book: this.book});
|
this.$emit('bookEvent', {action: 'authorClick', book: this.book});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,15 +30,19 @@
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<DivBtn class="q-ml-md text-white bg-secondary" :size="30" :icon-size="24" :imt="1" icon="la la-cog" round @click="settingsDialogVisible = true">
|
<DivBtn class="q-ml-md text-white bg-secondary" :size="30" :icon-size="24" :imt="1" icon="la la-cog" round @click="settingsDialogVisible = true">
|
||||||
<q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%" max-width="400px">
|
<template #tooltip>
|
||||||
Настройки
|
<q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%" max-width="400px">
|
||||||
</q-tooltip>
|
Настройки
|
||||||
|
</q-tooltip>
|
||||||
|
</template>
|
||||||
</DivBtn>
|
</DivBtn>
|
||||||
|
|
||||||
<DivBtn class="q-ml-sm text-white bg-secondary" :size="30" :icon-size="24" icon="la la-question" round @click="showSearchHelp">
|
<DivBtn class="q-ml-sm text-white bg-secondary" :size="30" :icon-size="24" icon="la la-question" round @click="showSearchHelp">
|
||||||
<q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%" max-width="400px">
|
<template #tooltip>
|
||||||
Памятка
|
<q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%" max-width="400px">
|
||||||
</q-tooltip>
|
Памятка
|
||||||
|
</q-tooltip>
|
||||||
|
</template>
|
||||||
</DivBtn>
|
</DivBtn>
|
||||||
|
|
||||||
<div class="col"></div>
|
<div class="col"></div>
|
||||||
@@ -90,13 +94,15 @@
|
|||||||
|
|
||||||
<div class="q-mx-xs" />
|
<div class="q-mx-xs" />
|
||||||
<DivBtn
|
<DivBtn
|
||||||
class="text-white bg-info q-mt-xs" :size="34" :icon-size="24" :imt="1"
|
class="text-grey-5 bg-yellow-1 q-mt-xs" :size="34" :icon-size="24" round
|
||||||
:icon="(extendedParams ? 'la la-angle-double-up' : 'la la-angle-double-down')"
|
:icon="(extendedParams ? 'la la-angle-double-up' : 'la la-angle-double-down')"
|
||||||
@click="extendedParams = !extendedParams"
|
@click="extendedParams = !extendedParams"
|
||||||
>
|
>
|
||||||
<q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%" max-width="400px">
|
<template #tooltip>
|
||||||
{{ `${(extendedParams ? 'Скрыть' : 'Показать')} дополнительные критерии поиска` }}
|
<q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%" max-width="400px">
|
||||||
</q-tooltip>
|
{{ `${(extendedParams ? 'Скрыть' : 'Показать')} дополнительные критерии поиска` }}
|
||||||
|
</q-tooltip>
|
||||||
|
</template>
|
||||||
</DivBtn>
|
</DivBtn>
|
||||||
</div>
|
</div>
|
||||||
<div v-show="extendedParams" class="row q-mx-md q-mb-xs items-center">
|
<div v-show="extendedParams" class="row q-mx-md q-mb-xs items-center">
|
||||||
@@ -188,8 +194,9 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<q-checkbox v-model="showCounts" size="36px" label="Показывать количество" />
|
<q-checkbox v-model="showCounts" size="36px" label="Показывать количество" />
|
||||||
<q-checkbox v-model="showRate" size="36px" label="Показывать оценки" />
|
<q-checkbox v-model="showRates" size="36px" label="Показывать оценки" />
|
||||||
<q-checkbox v-model="showGenres" size="36px" label="Показывать жанры" />
|
<q-checkbox v-model="showGenres" size="36px" label="Показывать жанры" />
|
||||||
|
<q-checkbox v-model="showDates" size="36px" label="Показывать даты поступления" />
|
||||||
<q-checkbox v-model="showDeleted" size="36px" label="Показывать удаленные" />
|
<q-checkbox v-model="showDeleted" size="36px" label="Показывать удаленные" />
|
||||||
<q-checkbox v-model="abCacheEnabled" size="36px" label="Кешировать запросы" />
|
<q-checkbox v-model="abCacheEnabled" size="36px" label="Кешировать запросы" />
|
||||||
</div>
|
</div>
|
||||||
@@ -279,12 +286,15 @@ const componentOptions = {
|
|||||||
showCounts(newValue) {
|
showCounts(newValue) {
|
||||||
this.setSetting('showCounts', newValue);
|
this.setSetting('showCounts', newValue);
|
||||||
},
|
},
|
||||||
showRate(newValue) {
|
showRates(newValue) {
|
||||||
this.setSetting('showRate', newValue);
|
this.setSetting('showRates', newValue);
|
||||||
},
|
},
|
||||||
showGenres(newValue) {
|
showGenres(newValue) {
|
||||||
this.setSetting('showGenres', newValue);
|
this.setSetting('showGenres', newValue);
|
||||||
},
|
},
|
||||||
|
showDates(newValue) {
|
||||||
|
this.setSetting('showDates', newValue);
|
||||||
|
},
|
||||||
showDeleted(newValue) {
|
showDeleted(newValue) {
|
||||||
this.setSetting('showDeleted', newValue);
|
this.setSetting('showDeleted', newValue);
|
||||||
},
|
},
|
||||||
@@ -368,8 +378,9 @@ class Search {
|
|||||||
|
|
||||||
//settings
|
//settings
|
||||||
showCounts = true;
|
showCounts = true;
|
||||||
showRate = true;
|
showRates = true;
|
||||||
showGenres = true;
|
showGenres = true;
|
||||||
|
showDates = true;
|
||||||
showDeleted = false;
|
showDeleted = false;
|
||||||
abCacheEnabled = true;
|
abCacheEnabled = true;
|
||||||
langDefault = '';
|
langDefault = '';
|
||||||
@@ -447,8 +458,9 @@ class Search {
|
|||||||
this.expanded = _.cloneDeep(settings.expanded);
|
this.expanded = _.cloneDeep(settings.expanded);
|
||||||
this.expandedSeries = _.cloneDeep(settings.expandedSeries);
|
this.expandedSeries = _.cloneDeep(settings.expandedSeries);
|
||||||
this.showCounts = settings.showCounts;
|
this.showCounts = settings.showCounts;
|
||||||
this.showRate = settings.showRate;
|
this.showRates = settings.showRates;
|
||||||
this.showGenres = settings.showGenres;
|
this.showGenres = settings.showGenres;
|
||||||
|
this.showDates = settings.showDates;
|
||||||
this.showDeleted = settings.showDeleted;
|
this.showDeleted = settings.showDeleted;
|
||||||
this.abCacheEnabled = settings.abCacheEnabled;
|
this.abCacheEnabled = settings.abCacheEnabled;
|
||||||
this.langDefault = settings.langDefault;
|
this.langDefault = settings.langDefault;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
<i :class="icon" :style="`font-size: ${iconSize}px; margin-top: ${imt}px`" />
|
<i :class="icon" :style="`font-size: ${iconSize}px; margin-top: ${imt}px`" />
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
</div>
|
</div>
|
||||||
|
<slot name="tooltip"></slot>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -98,3 +98,30 @@ export function makeValidFilename(filename, repl = '_') {
|
|||||||
else
|
else
|
||||||
throw new Error('Invalid filename');
|
throw new Error('Invalid filename');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function formatDate(d, format = 'normal') {
|
||||||
|
switch (format) {
|
||||||
|
case 'normal':
|
||||||
|
return `${d.getDate().toString().padStart(2, '0')}.${(d.getMonth() + 1).toString().padStart(2, '0')}.${d.getFullYear()} ` +
|
||||||
|
`${d.getHours().toString().padStart(2, '0')}:${d.getMinutes().toString().padStart(2, '0')}`;
|
||||||
|
case 'coDate':
|
||||||
|
return `${d.getFullYear()}-${(d.getMonth() + 1).toString().padStart(2, '0')}-${d.getDate().toString().padStart(2, '0')}`;
|
||||||
|
case 'coMonth':
|
||||||
|
return `${(d.getMonth() + 1).toString().padStart(2, '0')}`;
|
||||||
|
case 'noDate':
|
||||||
|
return `${d.getDate().toString().padStart(2, '0')}.${(d.getMonth() + 1).toString().padStart(2, '0')}.${d.getFullYear()}`;
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new Error('formatDate: unknown date format');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function parseDate(sqlDate) {
|
||||||
|
const d = sqlDate.split('-');
|
||||||
|
const result = new Date();
|
||||||
|
result.setDate(parseInt(d[2], 10));
|
||||||
|
result.setMonth(parseInt(d[1], 10) - 1);
|
||||||
|
result.setYear(parseInt(d[0], 10));
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
@@ -8,8 +8,9 @@ const state = {
|
|||||||
expandedAuthor: [],
|
expandedAuthor: [],
|
||||||
expandedSeries: [],
|
expandedSeries: [],
|
||||||
showCounts: true,
|
showCounts: true,
|
||||||
showRate: true,
|
showRates: true,
|
||||||
showGenres: true,
|
showGenres: true,
|
||||||
|
showDates: false,
|
||||||
showDeleted: false,
|
showDeleted: false,
|
||||||
abCacheEnabled: true,
|
abCacheEnabled: true,
|
||||||
langDefault: '',
|
langDefault: '',
|
||||||
|
|||||||
Reference in New Issue
Block a user