SettingsDialog.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <template>
  2. <Dialog ref="dialog" v-model="dialogVisible">
  3. <template #header>
  4. <div class="row items-center" style="font-size: 110%">
  5. <q-icon class="q-mr-sm text-green" name="la la-cog" size="28px"></q-icon>
  6. Настройки
  7. </div>
  8. </template>
  9. <div class="q-mx-md column" style="min-width: 300px; font-size: 120%;">
  10. <div class="row items-center q-ml-sm">
  11. <div class="q-mr-sm">
  12. Результатов на странице
  13. </div>
  14. <q-select
  15. v-model="limit" :options="limitOptions" class="bg-white"
  16. dropdown-icon="la la-angle-down la-sm"
  17. outlined dense emit-value map-options
  18. />
  19. </div>
  20. <q-checkbox v-show="config.latestVersion" v-model="showNewReleaseAvailable" size="36px" label="Уведомлять о выходе новой версии" />
  21. <q-checkbox v-model="downloadAsZip" size="36px" label="Скачивать книги в виде zip-архива" />
  22. <q-checkbox v-model="showCounts" size="36px" label="Показывать количество" />
  23. <q-checkbox v-model="showRates" size="36px" label="Показывать оценки" />
  24. <q-checkbox v-model="showInfo" size="36px" label="Показывать кнопку (инфо)" />
  25. <q-checkbox v-model="showGenres" size="36px" label="Показывать жанры" />
  26. <q-checkbox v-model="showDates" size="36px" label="Показывать даты поступления" />
  27. <q-checkbox v-model="showDeleted" size="36px" label="Показывать удаленные" />
  28. <q-checkbox v-model="abCacheEnabled" size="36px" label="Кешировать запросы" />
  29. </div>
  30. <template #footer>
  31. <q-btn class="q-px-md q-ml-sm" color="primary" dense no-caps @click="okClick">
  32. OK
  33. </q-btn>
  34. </template>
  35. </Dialog>
  36. </template>
  37. <script>
  38. //-----------------------------------------------------------------------------
  39. import vueComponent from '../../vueComponent.js';
  40. import Dialog from '../../share/Dialog.vue';
  41. const componentOptions = {
  42. components: {
  43. Dialog
  44. },
  45. watch: {
  46. modelValue(newValue) {
  47. this.dialogVisible = newValue;
  48. },
  49. dialogVisible(newValue) {
  50. this.$emit('update:modelValue', newValue);
  51. },
  52. settings() {
  53. this.loadSettings();
  54. },
  55. limit(newValue) {
  56. this.commit('setSettings', {'limit': newValue});
  57. },
  58. downloadAsZip(newValue) {
  59. this.commit('setSettings', {'downloadAsZip': newValue});
  60. },
  61. showCounts(newValue) {
  62. this.commit('setSettings', {'showCounts': newValue});
  63. },
  64. showRates(newValue) {
  65. this.commit('setSettings', {'showRates': newValue});
  66. },
  67. showInfo(newValue) {
  68. this.commit('setSettings', {'showInfo': newValue});
  69. },
  70. showGenres(newValue) {
  71. this.commit('setSettings', {'showGenres': newValue});
  72. },
  73. showDates(newValue) {
  74. this.commit('setSettings', {'showDates': newValue});
  75. },
  76. showDeleted(newValue) {
  77. this.commit('setSettings', {'showDeleted': newValue});
  78. },
  79. abCacheEnabled(newValue) {
  80. this.commit('setSettings', {'abCacheEnabled': newValue});
  81. },
  82. showNewReleaseAvailable(newValue) {
  83. this.commit('setSettings', {'showNewReleaseAvailable': newValue});
  84. },
  85. }
  86. };
  87. class SettingsDialog {
  88. _options = componentOptions;
  89. _props = {
  90. modelValue: Boolean,
  91. };
  92. dialogVisible = false;
  93. //settings
  94. limit = 20;
  95. downloadAsZip = false;
  96. showCounts = true;
  97. showRates = true;
  98. showInfo = true;
  99. showGenres = true;
  100. showDates = true;
  101. showDeleted = false;
  102. abCacheEnabled = true;
  103. showNewReleaseAvailable = true;
  104. limitOptions = [
  105. {label: '10', value: 10},
  106. {label: '20', value: 20},
  107. {label: '50', value: 50},
  108. {label: '100', value: 100},
  109. {label: '200', value: 200},
  110. {label: '500', value: 500},
  111. {label: '1000', value: 1000},
  112. ];
  113. created() {
  114. this.commit = this.$store.commit;
  115. this.loadSettings();
  116. }
  117. mounted() {
  118. }
  119. get config() {
  120. return this.$store.state.config;
  121. }
  122. get settings() {
  123. return this.$store.state.settings;
  124. }
  125. loadSettings() {
  126. const settings = this.settings;
  127. this.limit = settings.limit;
  128. this.downloadAsZip = settings.downloadAsZip;
  129. this.showCounts = settings.showCounts;
  130. this.showRates = settings.showRates;
  131. this.showInfo = settings.showInfo;
  132. this.showGenres = settings.showGenres;
  133. this.showDates = settings.showDates;
  134. this.showDeleted = settings.showDeleted;
  135. this.abCacheEnabled = settings.abCacheEnabled;
  136. this.showNewReleaseAvailable = settings.showNewReleaseAvailable;
  137. }
  138. okClick() {
  139. this.dialogVisible = false;
  140. }
  141. }
  142. export default vueComponent(SettingsDialog);
  143. //-----------------------------------------------------------------------------
  144. </script>
  145. <style scoped>
  146. </style>