Browse Source

提交一波

Szx 2 years ago
parent
commit
d0f0022c6d
2 changed files with 109 additions and 39 deletions
  1. 33 27
      src/assets/less/reader.less
  2. 76 12
      src/views/Reader/index.ux

+ 33 - 27
src/assets/less/reader.less

@@ -12,7 +12,7 @@
   }
   .reader-title {
     margin: 0 24px;
-    padding: 30px 0;
+    padding: 0 0 30px 0;
     // border-bottom: 2px solid #ccc;
     justify-content: space-between;
     align-items: center;
@@ -29,11 +29,34 @@
       width: 144px;
       height: 42px;
       text-align: center;
-      border-radius: 100px;
+      border-left: 100px;
       background-color: #d9d9d9;
     }
   }
-
+  .back-btn {
+    width: 30%;
+    .back-btn-wrap {
+      height: 50px;
+      border-bottom-right-radius: 25px;
+      border-top-right-radius: 25px;
+      padding: 5px 0;
+      background-color: black;
+      opacity: 0.5;
+      margin-top: 50px;
+      text {
+        padding-right: 10px;
+        height: 100%;
+        color: #fff;
+        font-size: 25px;
+      }
+      image {
+        margin-left: 10px;
+        height: 17px;
+        width: 20px;
+        margin-top: 11px;
+      }
+    }
+  }
   .reader-content {
     margin: 0 24px;
     flex-direction: column;
@@ -71,13 +94,13 @@
           background-repeat: no-repeat;
         }
         .night {
-          background-image: url("../../assets/imgs/sun.png");
+          background-image: url('../../assets/imgs/sun.png');
           border-radius: 100%;
           border-width: 2px;
           border-color: #ee6159;
         }
         .sun {
-          background-image: url("../../assets/imgs/moo.png");
+          background-image: url('../../assets/imgs/moo.png');
         }
       }
       .item-content {
@@ -148,33 +171,16 @@
   justify-content: center;
   z-index: 2;
   .mustBox {
-    background-color: #fff;
-    width: 600px;
-    height: 400px;
+    height: 594px;
+    width: 694px;
     flex-direction: column;
     border-radius: 15px;
     text-align: center;
     justify-content: center;
     align-items: center;
-    .title-must {
-      text-align: center;
-      font-size: 40px;
-      padding-top: 50px;
-      font-weight: bold;
-    }
-    .content {
-      text-align: center;
-      margin: 60px 0;
-      color: #666;
-    }
-    .button-must {
-      text-align: center;
-      color: #fff;
-      margin: 0 auto;
-      width: 250px;
-      height: 80px;
-      background-color: #fd555d;
-      border-radius: 20px;
+    image {
+      height: 100%;
+      width: 100%;
     }
   }
 }

+ 76 - 12
src/views/Reader/index.ux

@@ -2,12 +2,19 @@
  <import name="wechat-page" src="../../components/wechat/index.ux"></import> 
 <template>
   <div id="reader-content">
-    <stack>
-      <div class="reader-wrap" id='list' style="background-color:{{currentColor.color}};padding-bottom: 180px">
-        <div class="reader-title">
+    <stack>   
+      <div class="reader-wrap" id='list' style="background-color:{{currentColor.color}}">
+      <div class="back-btn" @click="backToPak" if="isShowBackBtn">
+        <div class="back-btn-wrap">
+        <image src="../../assets/imgs/white_back.png" ></image>
+        <text>{{back_name}}</text>
+      </div>
+      </div>
+         <div class="reader-title">
           <text class="title" style="color:{{isNight=='night'?'#666':'#333'}}">{{bookinfo.chapter_name}}</text>
           <!-- <text class="add-shelf" @click="addShelf">加入书架1</text> -->
         </div>
+        
         <div class="reader-content">
           <div class="readContent" @click="showMore"><text class="chapter-text" for='content' style="color:{{currentColor.fontColor}};font-size:{{`${readFontSize}px`}}">{{$item}}</text></div>
           <div class="bottom-setting" style="background-color:{{currentColor.btColor}}" if={{showSetting}} @click="stopPop">
@@ -56,15 +63,10 @@
                  <text class="operator catalog" @click="toCatalog">目录</text>
           </div>
     </div>
+    <!--  -->
     <div class="mustToask" show="{{showMustTost}}">
       <div class="mustBox">
-        <text class="title-must">
-          提示
-        </text>
-        <text class="content">
-          添加桌面后方可继续阅读精彩内容
-        </text>
-        <text class="button-must" @click="addDestop">添加到桌面</text>
+        <image src="../../assets/imgs/addImg.png" @click="addDestop"></image>
       </div>
     </div>
   </div>
@@ -75,6 +77,7 @@
 import prompt from '@system.prompt';
 import router from "@system.router";
 import storage from '@system.storage';
+import pkg from '@system.package'
 import it from "../../helper/interface.js";
 import { getChapters, getIsonshelf, postUserShelfBooks, chapterOrders, userAddDsktop } from "../../api";
 import { getAppConfig } from '../../api/utils.js';
@@ -90,9 +93,15 @@ export default {
     send_order_id: "",
     push_id: "",
     canReadecid: "",
-    showtoast: false
+    showtoast: false,
+    back_name: '',
+    back_url: '',
+    back_pkg: '',
+    platform: '',
+    isShowBackBtn: false,
   },
   private: {
+
     bookinfo: {},
     content: [],
     reader_banner: [],
@@ -128,6 +137,55 @@ export default {
     }
   },
   async onInit() {
+
+    if (this.platform) {
+      await storage.set({ key: "platform", value: this.platform });
+    } else {
+      let platform = (await storage.get({ key: "platform" })).data;
+      if (platform) this.platform = platform;
+    }
+    if (this.back_name) {
+      await storage.set({ key: "back_name", value: this.back_name });
+    } else {
+      let back_name = (await storage.get({ key: "back_name" })).data;
+      if (back_name) this.back_name = back_name;
+    }
+    if (this.back_url) {
+      await storage.set({ key: "back_url", value: this.back_url });
+    } else {
+      let back_url = (await storage.get({ key: "back_url" })).data;
+      if (back_url) this.back_url = back_url;
+    }
+    if (this.back_pkg) {
+      await storage.set({ key: "back_pkg", value: this.back_pkg });
+    } else {
+      let back_pkg = (await storage.get({ key: "back_pkg" })).data;
+      if (back_pkg) this.back_pkg = back_pkg;
+    }
+    this.back_name = decodeURI(this.back_name)
+    if (this.platform && this.platform == 'tx_adq') {
+      if (this.back_url) {
+        pkg.hasInstalled({
+          package: this.back_pkg,
+          success: data => {
+            if (!data.result) {
+              this.isShowBackBtn = false
+            }
+            if (data.result) {
+              this.isShowBackBtn = true
+            }
+          },
+          fail: function (data, code) {
+            console.log(data)
+          },
+          complete: data => {
+
+          }
+        })
+      }
+
+    }
+
     if (this.send_order_id) {
       await storage.set({ key: "send_order_id", value: this.send_order_id });
     } else {
@@ -169,6 +227,12 @@ export default {
       params: item.params
     })
   },
+  backToPak() {
+    console.log(12)
+    router.push({
+      uri: this.back_url
+    })
+  },
   backRouter() {
     if (this.back_reader == 1) {
       it.backCreateShortCut(res => {
@@ -365,7 +429,7 @@ export default {
     }
   },
   goNext() {
-    let self =this;
+    let self = this;
     if (this.bookinfo.next_cid == 0) {
       router.push({
         uri: "/views/Raderover",