litian
2024-03-25 cdfdcec9cc8a7644e70fb28d39a01d438cc74496
详情,阅读器
7个文件已修改
4个文件已添加
220 ■■■■■ 已修改文件
assets/js/config.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/components/note/note.js 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/components/webView/index.js 110 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/components/webView/index.json 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/components/webView/index.wxml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/components/webView/index.wxss 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/index.js 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/index.json 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/index.wxml 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/index.wxss 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/home/home.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
assets/js/config.js
@@ -20,8 +20,8 @@
export const fontUrl = "http://192.168.3.132:5173";
// export const fontUrl = "http://182.92.203.7:3007/jsek/website";
// export const fontUrl = "http://jsysf.bnuic.com/website";
// export const epubUrl = "http://182.92.203.7:3007/epubReadMobile/";
export const epubUrl = "http://jsysf.bnuic.com/epubReadMobile/#/";
export const epubUrl = "http://182.92.203.7:3007/epubReadMobile/";
// export const epubUrl = "http://jsysf.bnuic.com/epubReadMobile/#/";
const config = {
  requestCtx,
packageBookService/pages/bookServices/detail/components/note/note.js
@@ -141,7 +141,6 @@
        loading: true,
        noList: false
      })
      console.log(this.properties.bookInfo.id, 'this.properties.bookInfo.id');
      let topicId
      await app.MG.ugc
        .getProductUserSubmitTopic({
packageBookService/pages/bookServices/detail/components/webView/index.js
New file
@@ -0,0 +1,110 @@
// packageBookService/pages/components/webView/index.js
const app = getApp()
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    fileInfo: {
      type: Object,
      value: {}
    }
  },
  /**
   * 页面的初始数据
   */
  data: {
    src: "",
    link: false,
    epubObj: null,
    currentPage: '',
  },
  methods: {
    onLoadWeb(e) {
      console.log(e, "load")
    },
    onError(e) {
      console.log(e, "err")
    },
    setWebViewSrc() {
      var url = app.config.epubUrl +
        "?md5=" +
        this.properties.fileInfo.md5 +
        "&bookName=" +
        this.properties.fileInfo.bookName +
        "&url=" + app.config.requestCtx +
        "&token=" +
        wx.getStorageSync(app.config.tokenKey) +
        "&recordLocation=" +
        this.data.currentPage
      this.setData({
        src: url
      })
    },
    // 获取UserKey
    getProgress() {
      app.MG.identity
        .getUserKey({
          domain: "bookReadProgress",
          keys: [this.properties.fileInfo.md5],
        })
        .then((res) => {
          if (res.length) {
            try {
              this.setData({
                currentPage: JSON.parse(res[0].value).page,
              });
            } catch (error) {
              this.setData({
                currentPage: "",
              });
            }
            if (this.data.currentPage > this.properties.fileInfo.freePage) {
              this.setData({
                currentPage: "",
              });
            }
          }
          this.setWebViewSrc();
        });
    },
    // 设置userKey
    setProgress(data) {
      if (data.page && data.page != this.data.currentPage) {
        app.MG.identity
          .setUserKey({
            setKeyRequests: [{
              domain: "bookReadProgress",
              key: this.properties.fileInfo.md5,
              value: JSON.stringify(data),
            },],
          })
          .then((res) => { });
      }
    },
    drawBack(e) {
      let {
        currentLocation,
        percentage,
        type
      } =
        e.detail.data[0];
      if (type == "progress" && type != "backDetail") {
        this.setProgress({
          page: currentLocation,
          progress: percentage,
        });
      } else if (type == "backDetail") {
        this.setProgress({
          page: 1,
          progress: "0%",
        });
      }
    },
  }
})
packageBookService/pages/bookServices/detail/components/webView/index.json
New file
@@ -0,0 +1,4 @@
{
  "component": true,
  "usingComponents": {}
}
packageBookService/pages/bookServices/detail/components/webView/index.wxml
New file
@@ -0,0 +1,4 @@
<!--packageBookService/pages/components/webView/index.wxml-->
<view class="page-body">
  <!-- <web-view bind:message="drawBack" binderror="onError" bindload="onLoadWeb" src="{{src}}"></web-view> -->
</view>
packageBookService/pages/bookServices/detail/components/webView/index.wxss
New file
@@ -0,0 +1,4 @@
.page-body {
  width: 100vw;
  height: 500rpx;
}
packageBookService/pages/bookServices/detail/index.js
@@ -67,6 +67,12 @@
    paperBookCount: 0, //纸质书剩余次数
    ebookCount: 0, //电子书剩余次数
    userInfo: {},
    fileInfo: {
      bookName: "",
      fileType: "",
      md5: "",
      freePage: ""
    }//阅读器数据
  },
@@ -157,7 +163,7 @@
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {
    if (this.data.tabValue == 'jesk_note') {
    if (this.data.tabValue == 'jsek_note') {
      const child = this.selectComponent('#note')
      child.onReachBottom()
    }
@@ -352,13 +358,44 @@
          this.setData({
            noFile: true
          });
          if (res.datas[0].bookshelf_pdf) {
            this.setData({
              "fileInfo.bookName": this.data.bookDetail.name,
              "fileInfo.fileType": 'pdf',
              "fileInfo.md5": res.datas[0].bookshelf_pdf,
              "fileInfo.freePage": res.datas[0].bookshelf_probationPage,
            });
          } else if (res.datas[0].bookshelf_protectedEpub) {
            this.setData({
              "fileInfo.bookName": this.data.bookDetail.name,
              "fileInfo.fileType": 'epub',
              "fileInfo.md5": res.datas[0].bookshelf_protectedEpub,
              "fileInfo.freePage": res.datas[0].bookshelf_freeEpub,
            });
          }
        }
      } else {
        if (this.data.bookDetail.pdf || this.data.bookDetail.protectedEpub) {
          this.setData({
            noFile: true
          });
          if (this.data.bookDetail.pdf) {
            this.setData({
              "fileInfo.bookName": this.data.bookDetail.name,
              "fileInfo.fileType": 'pdf',
              "fileInfo.md5": this.data.bookDetail.pdf,
              "fileInfo.freePage": this.data.bookDetail.probationPage,
            });
          } else if (this.data.bookDetail.protectedEpub) {
            this.setData({
              "fileInfo.bookName": this.data.bookDetail.name,
              "fileInfo.fileType": 'epub',
              "fileInfo.md5": this.data.bookDetail.protectedEpub,
              "fileInfo.freePage": this.data.bookDetail.freeEpubPage,
            });
        }
        }
        console.log(this.data.fileInfo, 456)
        this.setData({
          selectedIds: this.data.bookDetail.defaultSaleMethodId,
          bookBuy: this.data.bookDetail.purchasedSaleMethodIdList.indexOf(this.data.bookDetail.defaultSaleMethodId) > -1
@@ -470,6 +507,12 @@
      if (token) {
        child.changeLoading()
        child.getNoteList()
      }
    } else if (e.detail.label == '电子书') {
      const child = this.selectComponent('#eBook')
      if (child) {
        child.getProgress()
      }
    }
@@ -1342,6 +1385,21 @@
    }
  },
  goRead() {
    if (!this.data.noFile) {
      wx.showToast({
        title: '暂无阅读文件',
        icon: 'none',
        duration: 2000
      })
      return false;
    }
    wx.navigateTo({
      url: '/packageBookService/pages/components/webView/index?md5=' + this.data.fileInfo.md5 + '&fileName=' + this.data.fileInfo.bookName + '&fileType=' + this.data.fileInfo.fileType + '&freePage=' + this.data.fileInfo.freePage
    })
  },
  //样书申请
  //申请电子样书
  appplyElectronicBook() {
packageBookService/pages/bookServices/detail/index.json
@@ -1,5 +1,4 @@
{
  "component": true,
  "usingComponents": {
    "t-icon": "tdesign-miniprogram/icon/icon",
    "t-image": "tdesign-miniprogram/image/image",
@@ -14,6 +13,7 @@
    "note": "/packageBookService/pages/bookServices/detail/components/note/note",
    "tree": "/packageBookService/pages/bookServices/detail/components/tree/index",
    "suggest": "/packageBookService/pages/bookServices/detail/components/suggest/suggest",
    "epub-view": "/packageBookService/pages/bookServices/detail/components/webView/index",
    "t-loading": "tdesign-miniprogram/loading/loading",
    "t-dialog": "tdesign-miniprogram/dialog/dialog",
    "t-toast": "tdesign-miniprogram/toast/toast",
packageBookService/pages/bookServices/detail/index.wxml
@@ -173,8 +173,8 @@
          <t-empty icon="folder-open" description="暂无数据" />
        </view>
      </t-tab-panel>
      <t-tab-panel label="电子书" value="1" style="{{tabPanelstyle}}">
        电子书
      <t-tab-panel label="电子书" value="jsek_eBook" style="{{tabPanelstyle}}">
        <epub-view fileInfo="{{fileInfo}}" id="eBook" class="webView"></epub-view>
      </t-tab-panel>
      <t-tab-panel
        label="教学资源"
@@ -248,6 +248,7 @@
          <t-empty icon="folder-open" description="暂无数据" />
        </view>
      </t-tab-panel>
<<<<<<< Updated upstream
      <t-tab-panel label="云笔记" value="jesk_note" style="{{tabPanelstyle}}">
        <note
          bookInfo="{{bookDetail}}"
@@ -255,6 +256,10 @@
          class="note-list"
          bind:changeLoaidng="changeLoaidng"
        ></note>
=======
      <t-tab-panel label="云笔记" value="jsek_note" style="{{tabPanelstyle}}">
        <note bookInfo="{{bookDetail}}" id="note" class="note-list" bind:changeLoaidng="changeLoaidng"></note>
>>>>>>> Stashed changes
      </t-tab-panel>
    </t-tabs>
  </view>
@@ -274,6 +279,7 @@
      </view>
      <view class="btn-text">纸质样书申请</view>
    </view>
<<<<<<< Updated upstream
    <view
      class="shopCar {{(tabValue == 'jsek_teachingResources' || tabValue == 'jesk_note') ? 'disabledColor' : 'shopCarColor' }}"
      bind:tap="addBookShopcCar"
@@ -284,6 +290,13 @@
      bind:tap="buyBtn"
      >立即购买</view
    >
=======
    <view class="shopCar {{(tabValue == 'jsek_teachingResources' || tabValue == 'jsek_note') ? 'disabledColor' : 'shopCarColor' }}" bind:tap="addBookShopcCar" wx:if="{{tabValue != 'jsek_eBook'}}">加入购物车</view>
    <view class="buy  {{(tabValue == 'jsek_teachingResources' || tabValue == 'jsek_note') ? 'disabledColor' : 'buyColor' }}" bind:tap="buyBtn" wx:if="{{tabValue != 'jsek_eBook'}}">立即购买</view>
    <view class="shopCar shopCarColor" bind:tap="addBookShopcCar" wx:if="{{tabValue == 'jsek_eBook' && !bookBuy}}">加入购物车</view>
    <view class="buy buyColor" bind:tap="buyBtn" wx:if="{{tabValue == 'jsek_eBook' && !bookBuy}}">立即购买</view>
    <view class="read buyColor" bind:tap="goRead" wx:if="{{tabValue == 'jsek_eBook' && bookBuy}}">立即查看</view>
>>>>>>> Stashed changes
  </view>
</scroll-view>
<!-- 我要建议弹窗 -->
packageBookService/pages/bookServices/detail/index.wxss
@@ -263,6 +263,14 @@
  color: #fff;
}
.read {
  width: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.shopCarColor {
  background-color: #F1AC37;
}
@@ -339,3 +347,7 @@
  top: 30rpx;
  left: 118rpx;
}
.webView {
  height: 500rpx;
}
pages/home/home.js
@@ -520,7 +520,7 @@
  onPageScroll(e) {
    this.setData({
      isWhite: e.scrollTop > 50 ? true : false
      isWhite: e.scrollTop > 20 ? true : false
    })
  },