Bläddra i källkod

Поправки багов

Book Pauk 6 år sedan
förälder
incheckning
5a4ef54f52

+ 1 - 0
client/components/Reader/HistoryPage/HistoryPage.vue

@@ -194,6 +194,7 @@ class HistoryPage extends Vue {
 
 
     async handleDel(key) {
     async handleDel(key) {
         await bookManager.delRecentBook({key});
         await bookManager.delRecentBook({key});
+        this.$emit('most-recent-book');
         this.updateTableData();
         this.updateTableData();
     }
     }
 
 

+ 7 - 3
client/components/Reader/Reader.vue

@@ -66,7 +66,7 @@
                 @stop-text-search="stopTextSearch">
                 @stop-text-search="stopTextSearch">
             </SearchPage>
             </SearchPage>
             <CopyTextPage v-if="copyTextActive" ref="copyTextPage" @copy-text-toggle="copyTextToggle"></CopyTextPage>            
             <CopyTextPage v-if="copyTextActive" ref="copyTextPage" @copy-text-toggle="copyTextToggle"></CopyTextPage>            
-            <HistoryPage v-if="historyActive" ref="historyPage" @load-book="loadBook" @history-toggle="historyToggle"></HistoryPage>
+            <HistoryPage v-if="historyActive" ref="historyPage" @load-book="loadBook" @most-recent-book="mostRecentBook" @history-toggle="historyToggle"></HistoryPage>
             <SettingsPage v-if="settingsActive" ref="settingsPage" @settings-toggle="settingsToggle"></SettingsPage>
             <SettingsPage v-if="settingsActive" ref="settingsPage" @settings-toggle="settingsToggle"></SettingsPage>
         </el-main>
         </el-main>
     </el-container>
     </el-container>
@@ -145,6 +145,7 @@ class Reader extends Vue {
     bookPos = null;
     bookPos = null;
     allowUrlParamBookPos = false;
     allowUrlParamBookPos = false;
     showRefreshIcon = true;
     showRefreshIcon = true;
+    mostRecentBookReactive = null;
 
 
     created() {
     created() {
         this.commit = this.$store.commit;
         this.commit = this.$store.commit;
@@ -237,6 +238,7 @@ class Reader extends Vue {
         const result = bookManager.mostRecentBook();
         const result = bookManager.mostRecentBook();
         if (!result)
         if (!result)
             this.closeAllTextPages();
             this.closeAllTextPages();
+        this.mostRecentBookReactive = result;
         return result;
         return result;
     }
     }
 
 
@@ -467,7 +469,7 @@ class Reader extends Vue {
             result = 'ProgressPage';
             result = 'ProgressPage';
         else if (this.loaderActive)
         else if (this.loaderActive)
             result = 'LoaderPage';
             result = 'LoaderPage';
-        else if (this.mostRecentBook())
+        else if (this.mostRecentBookReactive)
             result = 'TextPage';
             result = 'TextPage';
 
 
         if (!result) {
         if (!result) {
@@ -482,7 +484,7 @@ class Reader extends Vue {
         if (this.lastActivePage != result && result == 'TextPage') {
         if (this.lastActivePage != result && result == 'TextPage') {
             //акивируем страницу с текстом
             //акивируем страницу с текстом
             this.$nextTick(async() => {
             this.$nextTick(async() => {
-                const last = this.mostRecentBook();
+                const last = this.mostRecentBookReactive;
 
 
                 const isParsed = await bookManager.hasBookParsed(last);
                 const isParsed = await bookManager.hasBookParsed(last);
                 if (!isParsed) {
                 if (!isParsed) {
@@ -533,6 +535,7 @@ class Reader extends Vue {
                     // если есть в локальном кеше
                     // если есть в локальном кеше
                     if (bookParsed) {
                     if (bookParsed) {
                         await bookManager.setRecentBook(Object.assign({bookPos, bookPosSeen}, bookManager.metaOnly(bookParsed)));
                         await bookManager.setRecentBook(Object.assign({bookPos, bookPosSeen}, bookManager.metaOnly(bookParsed)));
+                        this.mostRecentBook();
                         this.loaderActive = false;
                         this.loaderActive = false;
                         progress.hide(); this.progressActive = false;
                         progress.hide(); this.progressActive = false;
                         this.blinkCachedLoadMessage();
                         this.blinkCachedLoadMessage();
@@ -572,6 +575,7 @@ class Reader extends Vue {
 
 
                 // добавляем в историю
                 // добавляем в историю
                 await bookManager.setRecentBook(Object.assign({bookPos, bookPosSeen}, bookManager.metaOnly(addedBook)));
                 await bookManager.setRecentBook(Object.assign({bookPos, bookPosSeen}, bookManager.metaOnly(addedBook)));
+                this.mostRecentBook();
                 this.updateRoute(true);
                 this.updateRoute(true);
 
 
                 this.loaderActive = false;
                 this.loaderActive = false;