Kaynağa Gözat

解决冲突

xiabx 5 yıl önce
ebeveyn
işleme
c3c978ca77

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

@@ -56,7 +56,7 @@
       }
 
       .read {
-        margin-left: 30px;
+        // margin-left: 30px;
         color: #fff;
         background-color: #ff6060;
       }

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

@@ -1,6 +1,7 @@
 .reader-wrap {
   flex-direction: column;
   background-color: #e6e6e6;
+  width: 100%;
   
   .reader-title {
     margin: 0 24px;

+ 17 - 3
src/components/short/index.ux

@@ -6,6 +6,8 @@
 	</div>
 </template>
 <script>
+import shortcut from '@system.shortcut';
+import prompt from '@system.prompt';
 
 export default {
 	data: {
@@ -16,9 +18,21 @@ export default {
 	},
 	createShortcut() {
 		// 创建快捷方式
-		this.$app.$def.createShortcut(false, (value) => {
-			this.$app.$def.data.backClickCount = Number(value);
-			this.$dispatch('hasShort')
+		shortcut.hasInstalled({
+			success: (ret) => {
+				if (!ret) {
+					shortcut.install({
+						message: "添加【追书云】到桌面,方便下次阅读",
+						success: () => {
+							prompt.showToast("添加成功!");
+							this.$emit("addshort", { installed: true });
+						},
+						fail: (code) => {
+							this.$emit("addshort", { installed: false });
+						}
+					})
+				}
+			}
 		})
 	}
 }

+ 2 - 2
src/helper/interface.js

@@ -15,13 +15,13 @@ const getDeviceInfo = () => {
   })
 }
 //获取是否创建图标
-const getShortCut = (fn) =>{
+const getShortCut = (fn) => {
   shortcut.hasInstalled({
     success: (ret) => {
       fn(ret);
     }
   })
-  
+
 }
 // 判断用户是否创建图标
 const hasCreateShortCut = (isPayPage = false,fn) => {

+ 1 - 1
src/manifest.json

@@ -122,7 +122,7 @@
         "menu": false
       },
       "views/Shelf": {
-        "titleBarText": "我的书架",
+        "titleBarText": "最近阅读",
         "menu": false
       },
       "views/Sign": {

+ 1 - 1
src/views/Detail/index.ux

@@ -13,7 +13,7 @@
           </div>
           <text class="words">字数:{{bookWordsFormat(book.book_word_count)}}</text>
           <div class="user-operator">
-            <text class="add" @click="addShelf">{{book.is_on_user_shelf ? '已加入' : '加入书架'}}</text>
+            <!-- <text class="add" @click="addShelf">{{book.is_on_user_shelf ? '已加入' : '加入书架'}}</text> -->
             <text class="read" @click="toRead(book.first_cid)">立即阅读</text>
           </div>
         </div>

+ 2 - 1
src/views/Home/index.ux

@@ -21,7 +21,7 @@
         <swiper class="swipe-bar" autoplay="true" indicator="false">
           <block for="b in banner.books">
             <div class="swipe-item">
-              <image class="cover" src="{{b.cover_url}}"></image>
+              <image class="cover" src="{{b.banner_url}}"></image>
             </div>
           </block>
         </swiper>
@@ -110,6 +110,7 @@ export default {
     let ret = await getHomeList(sex);
     this.banner = ret.slice(0, 1)[0];
     this.list = ret.slice(1);
+    console.log(this.banner);
   }
 }
 </script>

+ 6 - 4
src/views/Index/index.ux

@@ -28,8 +28,8 @@
       </div>
     </div>
     <image src="../../assets/imgs/sign_show.png" class="sign-icon" @click="changeSignPop"> </image>
-    <sign-page if="showSignPop"></sign-page>
-    <short-page if="showShortPop" @hasShort="hasShort"></short-page>
+    <sign-page if="{{showSignPop}}"></sign-page>
+    <short-page if="{{showShortPop}}" @addshort="shortEnd"></short-page>
     <div class="stack-popup" @click="closeWrap" if="showPopup">
       <div class="customer-popup">
         <text class="title">联系客服</text>
@@ -90,7 +90,6 @@ export default {
   },
   onInit() {
     this.$on('dispathEvt', this.changeSignPop);
-    this.$on('hasShort',this.changeShortCut);
     //今日已签到过不在弹框签到
     this.getCoustom();
   },
@@ -99,11 +98,14 @@ export default {
       this.showShortPop = !value;
     })
   },
+  shortEnd(value) {
+    this.showShortPop = !value.detail.installed;
+  },
   onBackPress() {
     // 退出逻辑
     if (this.$app.$def.data.backClickCount === 0) {
       this.$app.$def.data.backClickCount++;
-      this.$app.$def.createShortcut()
+      this.$app.$def.createShortcut();
       return true;
     }
   },

+ 38 - 16
src/views/Reader/index.ux

@@ -2,21 +2,21 @@
  <import name="wechat-page" src="../../components/wechat/index.ux"></import> 
 <template>
   <div id="reader-content">
-    <list class="reader-wrap" id='list'>
-      <list-item type='title' class="reader-title">
+    <div class="reader-wrap" id='list'>
+      <div type='title' class="reader-title">
         <text class="title">{{bookinfo.chapter_name}}</text>
         <!-- <text class="add-shelf" @click="addShelf">加入书架</text> -->
-      </list-item>
-      <list-item type='content' class="reader-content">
+      </div>
+      <div type='content' class="reader-content">
         <text class="chapter-text" for='content'>{{$item}}</text>
-      </list-item>
-      <list-item type='button' class="reader-operator">
+      </div>
+      <div type='button' class="reader-operator">
         <text class="operator prev" @click="getPrevChapter">上一章</text>
         <text class="operator catalog" @click="toCatalog">目录</text>
         <text class="operator next" @click="getNextChapter">下一章</text>
-      </list-item>
-    </list>
-    <short-page if="{{showShortPop}}"></short-page>
+      </div>
+    </div>
+    <short-page if="{{showShortPop}}" @addshort="shortEnd"></short-page>
     <!-- <wechat-page></wechat-page> -->
   </div>
 
@@ -40,7 +40,6 @@ export default {
   onInit() {
     this.getChapters(this.bid, this.chapter_id)
     this.addShelf();
-    this.$on('hasShort',this.changeShortCut);
   },
   onShow() {
     it.getShortCut((value) => {
@@ -53,14 +52,14 @@ export default {
       r.is_on ? '' : postUserShelfBooks({ bid: this.bid })
     })
   },
-  changeShortCut(){
-    this.showShortPop=false;
+    shortEnd(value) {
+    this.showShortPop = !value.detail.installed;
   },
   getChapters(bid, chapter_id) {
     getChapters({ bid: bid, chapter_id: chapter_id }).then(r => {
       this.content = r.chapter_content.trim().split(/\n/)
       this.bookinfo = r
-      this.$element('list').scrollTo({ index: 0 })
+      // this.$element('list').scrollTo({ index: 0 })
     }).catch(e => {
       console.log('e code')
       console.log(e.data)
@@ -69,7 +68,7 @@ export default {
         chapterOrders({ bid: bid, chapter_id: chapter_id }).then(r => {
           this.content = r.chapter_content.trim().split(/\n/)
           this.bookinfo = r
-          this.$element('list').scrollTo({ index: 0 })
+          // this.$element('list').scrollTo({ index: 0 })
         }).catch(f => {
           console.log('f code')
           console.log(f.data)
@@ -107,11 +106,34 @@ export default {
   },
   getPrevChapter() {
     console.log("get prev chapter");
-    this.getChapters(this.bookinfo.bid, this.bookinfo.prev_cid)
+    // this.getChapters(this.bookinfo.bid, this.bookinfo.prev_cid)
+    router.replace({
+      uri: "/views/Reader",
+      params: {
+        bid: this.bookinfo.bid,
+        chapter_id: this.bookinfo.prev_cid
+      }
+    })
   },
   getNextChapter() {
     console.log("get next chapter");
-    this.getChapters(this.bookinfo.bid, this.bookinfo.next_cid)
+    if (this.bookinfo.next_cid == 0) {
+      router.push({
+        uri: "/views/Raderover",
+        params: {
+          bid: this.bid
+        }
+      })
+      return
+    }
+    // this.getChapters(this.bookinfo.bid, this.bookinfo.next_cid)
+    router.replace({
+      uri: "/views/Reader",
+      params: {
+        bid: this.bookinfo.bid,
+        chapter_id: this.bookinfo.next_cid
+      }
+    })
   }
 }
 </script>

+ 5 - 5
src/views/Shelf/index.ux

@@ -2,14 +2,14 @@
  
 <template>
   <div class="shelf-wrap">
-    <div class="type-bar">
+    <!-- <div class="type-bar">
       <block for="type in typeList">
         <div class="type-item" @click="typeChange(type.index)">
           <text class="{{type.index === current ? 'cur' : ''}}">{{type.name}}</text>
           <text class="choose-bar" show="{{type.index === current}}"></text>
         </div>
       </block>
-    </div>
+    </div> -->
     <div class="shelf-total {{current === 1 ? 'shelf-total__inRecent' : ''}}">
       <text>共{{booksize}}本</text>
       <text class="manager" @click="changeMode">{{modeText}}</text>
@@ -42,8 +42,8 @@
                 <div class="book-info__wrap">
                   <text class="name">{{$item.book_name}}</text>
                   <text class="lastest">最新 {{$item.last_chapter}}</text>
-                  <text class="last-read">上次阅读:{{$item.recent_reading_chapter}}</text>
-                  <text class="shelf-status">❤️ 已加入书架</text>
+                  <text class="last-read">{{$item.recent_reading_chapter}}</text>
+                  <!-- <text class="shelf-status">❤️ 已加入书架</text> -->
                 </div>
               </x-book>
               <div class="book-del__item" show="{{isDelMode}}" @click='deleteBook($item)'>
@@ -70,7 +70,7 @@ export default {
   },
   data() {
     return {
-      current: 0,
+      current: 1,
       isDelMode: false,
       modeText: "管理",
       mockList: [],