LoaderPage.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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', this.bookUrl);
  55. }
  56. }
  57. loadFle() {
  58. }
  59. openHelp() {
  60. }
  61. openComments() {
  62. window.open('http://samlib.ru/comment/b/bookpauk/bookpauk_reader', '_blank');
  63. }
  64. keyHook(event) {
  65. //недостатки сторонних ui
  66. if (document.activeElement === this.$refs.input.$refs.input && event.type == 'keyup' && event.key == 'Enter') {
  67. this.submitUrl();
  68. }
  69. }
  70. }
  71. //-----------------------------------------------------------------------------
  72. </script>
  73. <style scoped>
  74. .main {
  75. flex: 1;
  76. display: flex;
  77. flex-direction: column;
  78. }
  79. .part {
  80. flex: 1;
  81. display: flex;
  82. flex-direction: column;
  83. justify-content: center;
  84. align-items: center;
  85. }
  86. .greeting {
  87. font-size: 130%;
  88. line-height: 170%;
  89. }
  90. .bold-font {
  91. font-weight: bold;
  92. }
  93. .clickable {
  94. color: blue;
  95. text-decoration: underline;
  96. cursor: pointer;
  97. }
  98. .center {
  99. justify-content: flex-start;
  100. padding: 0 10px 0 10px;
  101. }
  102. .bottom {
  103. justify-content: flex-end;
  104. }
  105. .bottom-span {
  106. font-size: 70%;
  107. margin-bottom: 10px;
  108. }
  109. .el-input {
  110. max-width: 700px;
  111. }
  112. .space {
  113. height: 20px;
  114. }
  115. </style>