浏览代码

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

Book Pauk 5 年之前
父节点
当前提交
93cf506535
共有 2 个文件被更改,包括 10 次插入3 次删除
  1. 5 3
      client/components/Reader/Reader.vue
  2. 5 0
      client/components/Reader/share/bookManager.js

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

@@ -519,7 +519,7 @@ class Reader extends Vue {
             }
             }
 
 
             if (oldBook && newBook) {
             if (oldBook && newBook) {
-                if (oldBook.key != newBook.key) {
+                if (oldBook.key != newBook.key || oldBook.path != newBook.path) {
                     this.loadingBook = true;
                     this.loadingBook = true;
                     try {
                     try {
                         await this.loadBook(newBook);
                         await this.loadBook(newBook);
@@ -934,7 +934,9 @@ class Reader extends Vue {
 
 
         // уже просматривается сейчас
         // уже просматривается сейчас
         const lastBook = (this.textPage ? this.textPage.lastBook : null);
         const lastBook = (this.textPage ? this.textPage.lastBook : null);
-        if (!opts.force && lastBook && lastBook.url == url && await bookManager.hasBookParsed(lastBook)) {
+        if (!opts.force && lastBook && lastBook.url == url && 
+                (!opts.path || opts.path == lastBook.path) && 
+                await bookManager.hasBookParsed(lastBook)) {
             this.loaderActive = false;
             this.loaderActive = false;
             return;
             return;
         }
         }
@@ -963,7 +965,7 @@ class Reader extends Vue {
 
 
             if (!opts.force) {
             if (!opts.force) {
                 // пытаемся загрузить и распарсить книгу в менеджере из локального кэша
                 // пытаемся загрузить и распарсить книгу в менеджере из локального кэша
-                const bookParsed = await bookManager.getBook({url}, (prog) => {
+                const bookParsed = await bookManager.getBook({url, path: opts.path}, (prog) => {
                     progress.setState({progress: prog});
                     progress.setState({progress: prog});
                 });
                 });
 
 

+ 5 - 0
client/components/Reader/share/bookManager.js

@@ -262,6 +262,11 @@ class BookManager {
                 this.books[meta.key] = result;
                 this.books[meta.key] = result;
         }
         }
 
 
+        //Если файл на сервере изменился, считаем, что в кеше его нету
+        if (meta.path && result && meta.path != result.path) {
+            return;
+        }
+
         if (result && !result.parsed) {
         if (result && !result.parsed) {
             let data = await bmDataStore.getItem(`bmData-${meta.key}`);
             let data = await bmDataStore.getItem(`bmData-${meta.key}`);
             callback(5);
             callback(5);