Browse Source

阅读器字体大小,章节onshow重新请求

gdy96 5 years ago
parent
commit
59089f3421
2 changed files with 24 additions and 10 deletions
  1. 1 1
      src/assets/less/reader.less
  2. 23 9
      src/views/Catalog/index.ux

+ 1 - 1
src/assets/less/reader.less

@@ -13,7 +13,6 @@
     .title {
       font-weight: bolder;
       color: #1a1a1a;
-      font-size: 48px;
       font-size: 38px;
       padding: 150px 0;
     }
@@ -33,6 +32,7 @@
     flex-direction: column;
 
     .chapter-text {
+      font-size: 19px;
       color: #1a1a1a;
       text-indent: 2em;
       font-size: 32px;

+ 23 - 9
src/views/Catalog/index.ux

@@ -34,7 +34,8 @@ export default {
     chapter_sequence_index: 0,
     startpage: 1,
     loading: false,
-    end: false
+    end: false,
+    index: 1
   },
   onInit() {
     let page = 1
@@ -55,6 +56,26 @@ export default {
 
     })
   },
+  onShow() {
+    if (this.index == 1) return
+    let page = 1
+    var chapter_sequence_index = 0
+    if (this.chapter_sequence) {
+      var chapter_sequence = this.chapter_sequence
+      chapter_sequence_index = chapter_sequence % PER_PAGE_NUM - 1
+      this.chapter_sequence_index = chapter_sequence_index
+      page = Math.ceil(chapter_sequence / PER_PAGE_NUM)
+    }
+    this.startpage = page;
+    getCatalog({ bid: this.bid, page: page, page_size: PER_PAGE_NUM }).then(r => {
+      this.list = r.list
+      this.meta = r.meta
+      setTimeout(() => {
+        this.$element('catalog').scrollTo({ index: chapter_sequence_index })
+      }, 500)
+
+    })
+  },
   jumpReader(info) {
     if (info.is_need_charge == 1) {
       router.push({
@@ -65,6 +86,7 @@ export default {
       })
       return
     }
+    this.index = this.index + 1
     router.push({
       uri: "/views/Reader",
       params: {
@@ -111,17 +133,9 @@ export default {
     getCatalog(params).then(r => {
       if (isLoadPrev) {
         this.list.unshift(...r.list)
-<<<<<<< HEAD
-        console.log(this.list)
-        this.startpage = r.meta.current_page
-      } else {
-        this.list.push(...r.list)
-        console.log(this.list)
-=======
         this.startpage = r.meta.current_page
       } else {
         this.list.push(...r.list)
->>>>>>> c19c95f858f0bf14d84641c777e3999c5531bd6b
         this.meta = r.meta;
       }
     })