SettingsDialog.vue 4.6 KB

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