LoaderPage.vue 3.0 KB

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