LoaderPage.vue 3.2 KB

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