Browse Source

Работа над расширенным поиском

Book Pauk 2 years ago
parent
commit
3a26a12807

+ 7 - 5
client/components/Search/BookView/BookView.vue

@@ -33,7 +33,7 @@
         </div>
 
         <div class="q-ml-sm column">
-            <div v-if="(mode == 'series' || mode == 'title') && bookAuthor" class="row">
+            <div v-if="(mode == 'series' || mode == 'title' || mode == 'extended') && bookAuthor" class="row">
                 <div class="clickable2 text-green-10" @click.stop.prevent="emit('authorClick')">
                     {{ bookAuthor }}
                 </div>
@@ -46,7 +46,7 @@
                 <div class="clickable2" :class="titleColor" @click.stop.prevent="emit('titleClick')">
                     {{ book.title }}
                 </div>
-                <div v-if="mode == 'title' && bookSeries" class="q-ml-xs clickable2" @click.stop.prevent="emit('seriesClick')">
+                <div v-if="(mode == 'title' || mode == 'extended') && bookSeries" class="q-ml-xs clickable2" @click.stop.prevent="emit('seriesClick')">
                     {{ bookSeries }}
                 </div>
 
@@ -79,10 +79,10 @@
                     {{ bookDate }}
                 </div>
             </div>
-        </div>
 
-        <div v-show="false">
-            {{ book }}
+            <div v-show="showJson && mode == 'extended'">
+                <pre style="font-size: 80%">{{ book }}</pre>
+            </div>
         </div>
     </div>
 </template>
@@ -117,6 +117,7 @@ class BookView {
     showGenres = true;
     showDeleted = false;
     showDates = false;
+    showJson = false;
 
     created() {
         this.loadSettings();
@@ -130,6 +131,7 @@ class BookView {
         this.showGenres = settings.showGenres;
         this.showDates = settings.showDates;
         this.showDeleted = settings.showDeleted;
+        this.showJson = settings.showJson;
     }
 
     get settings() {

+ 1 - 1
client/components/Search/ExtendedList/ExtendedList.vue

@@ -9,7 +9,7 @@
         <div v-for="item in tableData" :key="item.key" class="column" :class="{'odd-item': item.num % 2}" style="font-size: 120%">
             <BookView
                 class="q-ml-md"
-                :book="item.book" mode="title" :genre-map="genreMap" :show-read-link="showReadLink" @book-event="bookEvent"
+                :book="item.book" mode="extended" :genre-map="genreMap" :show-read-link="showReadLink" @book-event="bookEvent"
             />
         </div>
         <!-- Формирование списка конец ------------------------------------------------------------------>

+ 9 - 0
client/components/Search/Search.vue

@@ -227,6 +227,10 @@
                 <div v-show="list.totalFound > 0" class="text-bold" style="font-size: 120%; padding-bottom: 2px">
                     {{ foundCountMessage }}
                 </div>
+
+                <div v-show="list.totalFound > 0 && isExtendedSearch" class="q-ml-md">
+                    <q-checkbox v-model="showJson" size="36px" label="Показывать JSON" />
+                </div>
             </div>
 
             <!-- Формирование списка ------------------------------------------------------------------------>
@@ -361,6 +365,9 @@ const componentOptions = {
         langDefault() {
             this.updateSearchFromRouteQuery(this.$route);
         },
+        showJson(newValue) {
+            this.setSetting('showJson', newValue);
+        },
         list: {
             handler(newValue) {
                 this.updateGenreTreeIfNeeded();
@@ -433,6 +440,7 @@ class Search {
     langDefault = '';
     limit = 20;
     extendedParams = false;
+    showJson = false;
 
     //stuff
     prevList = {};
@@ -525,6 +533,7 @@ class Search {
         this.expandedSeries = _.cloneDeep(settings.expandedSeries);
         this.abCacheEnabled = settings.abCacheEnabled;
         this.langDefault = settings.langDefault;
+        this.showJson = settings.showJson;
     }
 
     recvMessage(d) {

+ 1 - 0
client/store/root.js

@@ -16,6 +16,7 @@ const state = {
         showDeleted: false,
         abCacheEnabled: true,
         langDefault: '',
+        showJson: false,
     },    
 };