SettingsDialog.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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-model="downloadAsZip" size="36px" label="Скачивать книги в виде zip-архива" />
  21. <q-checkbox v-model="showCounts" size="36px" label="Показывать количество" />
  22. <q-checkbox v-model="showRates" size="36px" label="Показывать оценки" />
  23. <q-checkbox v-model="showInfo" size="36px" label="Показывать кнопку (инфо)" />
  24. <q-checkbox v-model="showGenres" size="36px" label="Показывать жанры" />
  25. <q-checkbox v-model="showDates" size="36px" label="Показывать даты поступления" />
  26. <q-checkbox v-model="showDeleted" size="36px" label="Показывать удаленные" />
  27. <q-checkbox v-model="abCacheEnabled" size="36px" label="Кешировать запросы" />
  28. </div>
  29. <template #footer>
  30. <q-btn class="q-px-md q-ml-sm" color="primary" dense no-caps @click="okClick">
  31. OK
  32. </q-btn>
  33. </template>
  34. </Dialog>
  35. </template>
  36. <script>
  37. //-----------------------------------------------------------------------------
  38. import vueComponent from '../../vueComponent.js';
  39. import Dialog from '../../share/Dialog.vue';
  40. const componentOptions = {
  41. components: {
  42. Dialog
  43. },
  44. watch: {
  45. modelValue(newValue) {
  46. this.dialogVisible = newValue;
  47. },
  48. dialogVisible(newValue) {
  49. this.$emit('update:modelValue', newValue);
  50. },
  51. settings() {
  52. this.loadSettings();
  53. },
  54. limit(newValue) {
  55. this.commit('setSettings', {'limit': newValue});
  56. },
  57. downloadAsZip(newValue) {
  58. this.commit('setSettings', {'downloadAsZip': newValue});
  59. },
  60. showCounts(newValue) {
  61. this.commit('setSettings', {'showCounts': newValue});
  62. },
  63. showRates(newValue) {
  64. this.commit('setSettings', {'showRates': newValue});
  65. },
  66. showInfo(newValue) {
  67. this.commit('setSettings', {'showInfo': newValue});
  68. },
  69. showGenres(newValue) {
  70. this.commit('setSettings', {'showGenres': newValue});
  71. },
  72. showDates(newValue) {
  73. this.commit('setSettings', {'showDates': newValue});
  74. },
  75. showDeleted(newValue) {
  76. this.commit('setSettings', {'showDeleted': newValue});
  77. },
  78. abCacheEnabled(newValue) {
  79. this.commit('setSettings', {'abCacheEnabled': newValue});
  80. },
  81. }
  82. };
  83. class SettingsDialog {
  84. _options = componentOptions;
  85. _props = {
  86. modelValue: Boolean,
  87. };
  88. dialogVisible = false;
  89. //settings
  90. limit = 20;
  91. downloadAsZip = false;
  92. showCounts = true;
  93. showRates = true;
  94. showInfo = true;
  95. showGenres = true;
  96. showDates = true;
  97. showDeleted = false;
  98. abCacheEnabled = true;
  99. limitOptions = [
  100. {label: '10', value: 10},
  101. {label: '20', value: 20},
  102. {label: '50', value: 50},
  103. {label: '100', value: 100},
  104. {label: '200', value: 200},
  105. {label: '500', value: 500},
  106. {label: '1000', value: 1000},
  107. ];
  108. created() {
  109. this.commit = this.$store.commit;
  110. this.loadSettings();
  111. }
  112. mounted() {
  113. }
  114. get settings() {
  115. return this.$store.state.settings;
  116. }
  117. loadSettings() {
  118. const settings = this.settings;
  119. this.limit = settings.limit;
  120. this.downloadAsZip = settings.downloadAsZip;
  121. this.showCounts = settings.showCounts;
  122. this.showRates = settings.showRates;
  123. this.showInfo = settings.showInfo;
  124. this.showGenres = settings.showGenres;
  125. this.showDates = settings.showDates;
  126. this.showDeleted = settings.showDeleted;
  127. this.abCacheEnabled = settings.abCacheEnabled;
  128. }
  129. okClick() {
  130. this.dialogVisible = false;
  131. }
  132. }
  133. export default vueComponent(SettingsDialog);
  134. //-----------------------------------------------------------------------------
  135. </script>
  136. <style scoped>
  137. </style>