LoaderPage.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <template>
  2. <div ref="main" class="main">
  3. <div class="part">
  4. <span class="greeting bold-font">{{ title }}</span>
  5. <span class="greeting">Добро пожаловать!</span>
  6. <span class="greeting">Поддерживаются форматы: fb2, fb2.zip, html, txt</span>
  7. </div>
  8. <div class="part center">
  9. <el-input ref="input" placeholder="URL книги" v-model="bookUrl">
  10. <el-button slot="append" icon="el-icon-check" @click="submitUrl"></el-button>
  11. </el-input>
  12. <div class="space"></div>
  13. <el-button size="mini" @click="loadFle">
  14. Загрузить файл с диска
  15. </el-button>
  16. <div class="space"></div>
  17. <span v-if="config.mode == 'omnireader'" class="bottom-span clickable" @click="openComments">Комментарии</span>
  18. </div>
  19. <div class="part bottom">
  20. <span class="bottom-span clickable" @click="openHelp">Справка</span>
  21. <span class="bottom-span clickable" @click="openDonate">Донат</span>
  22. <span class="bottom-span">{{ version }}</span>
  23. </div>
  24. </div>
  25. </template>
  26. <script>
  27. //-----------------------------------------------------------------------------
  28. import Vue from 'vue';
  29. import Component from 'vue-class-component';
  30. export default @Component({
  31. })
  32. class LoaderPage extends Vue {
  33. bookUrl = null;
  34. loadPercent = 0;
  35. created() {
  36. this.commit = this.$store.commit;
  37. this.config = this.$store.state.config;
  38. }
  39. mounted() {
  40. this.progress = this.$refs.progress;
  41. }
  42. activated() {
  43. this.$refs.input.focus();
  44. }
  45. get title() {
  46. if (this.config.mode == 'omnireader')
  47. return 'Omni Reader - браузерная онлайн-читалка.';
  48. return 'Универсальная читалка книг и ресурсов интернета.';
  49. }
  50. get version() {
  51. return `v${this.config.version}`;
  52. }
  53. async submitUrl() {
  54. if (this.bookUrl) {
  55. this.$emit('load-book', {url: this.bookUrl});
  56. this.bookUrl = '';
  57. }
  58. }
  59. loadFle() {
  60. }
  61. openHelp() {
  62. }
  63. openDonate() {
  64. }
  65. openComments() {
  66. window.open('http://samlib.ru/comment/b/bookpauk/bookpauk_reader', '_blank');
  67. }
  68. keyHook(event) {
  69. //недостатки сторонних ui
  70. if (document.activeElement === this.$refs.input.$refs.input && event.type == 'keydown' && event.key == 'Enter') {
  71. this.submitUrl();
  72. }
  73. }
  74. }
  75. //-----------------------------------------------------------------------------
  76. </script>
  77. <style scoped>
  78. .main {
  79. flex: 1;
  80. display: flex;
  81. flex-direction: column;
  82. }
  83. .part {
  84. flex: 1;
  85. display: flex;
  86. flex-direction: column;
  87. justify-content: center;
  88. align-items: center;
  89. }
  90. .greeting {
  91. font-size: 130%;
  92. line-height: 170%;
  93. }
  94. .bold-font {
  95. font-weight: bold;
  96. }
  97. .clickable {
  98. color: blue;
  99. text-decoration: underline;
  100. cursor: pointer;
  101. }
  102. .center {
  103. justify-content: flex-start;
  104. padding: 0 10px 0 10px;
  105. }
  106. .bottom {
  107. justify-content: flex-end;
  108. }
  109. .bottom-span {
  110. font-size: 70%;
  111. margin-bottom: 10px;
  112. }
  113. .el-input {
  114. max-width: 700px;
  115. }
  116. .space {
  117. height: 20px;
  118. }
  119. </style>