| | |
| | | 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, |
| | |
| | | loading: true, |
| | | noList: false |
| | | }) |
| | | console.log(this.properties.bookInfo.id, 'this.properties.bookInfo.id'); |
| | | let topicId |
| | | await app.MG.ugc |
| | | .getProductUserSubmitTopic({ |
New file |
| | |
| | | // 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%", |
| | | }); |
| | | } |
| | | }, |
| | | } |
| | | }) |
New file |
| | |
| | | { |
| | | "component": true, |
| | | "usingComponents": {} |
| | | } |
New file |
| | |
| | | <!--packageBookService/pages/components/webView/index.wxml--> |
| | | <view class="page-body"> |
| | | <!-- <web-view bind:message="drawBack" binderror="onError" bindload="onLoadWeb" src="{{src}}"></web-view> --> |
| | | </view> |
New file |
| | |
| | | .page-body { |
| | | width: 100vw; |
| | | height: 500rpx; |
| | | } |
| | |
| | | paperBookCount: 0, //纸质书剩余次数 |
| | | ebookCount: 0, //电子书剩余次数 |
| | | userInfo: {}, |
| | | fileInfo: { |
| | | bookName: "", |
| | | fileType: "", |
| | | md5: "", |
| | | freePage: "" |
| | | }//阅读器数据 |
| | | }, |
| | | |
| | | |
| | |
| | | * 页面上拉触底事件的处理函数 |
| | | */ |
| | | onReachBottom() { |
| | | if (this.data.tabValue == 'jesk_note') { |
| | | if (this.data.tabValue == 'jsek_note') { |
| | | const child = this.selectComponent('#note') |
| | | child.onReachBottom() |
| | | } |
| | |
| | | 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 |
| | |
| | | if (token) { |
| | | child.changeLoading() |
| | | child.getNoteList() |
| | | } |
| | | |
| | | } else if (e.detail.label == '电子书') { |
| | | const child = this.selectComponent('#eBook') |
| | | if (child) { |
| | | child.getProgress() |
| | | } |
| | | |
| | | } |
| | |
| | | } |
| | | }, |
| | | |
| | | 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() { |
| | |
| | | { |
| | | "component": true, |
| | | "usingComponents": { |
| | | "t-icon": "tdesign-miniprogram/icon/icon", |
| | | "t-image": "tdesign-miniprogram/image/image", |
| | |
| | | "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", |
| | |
| | | <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="教学资源" |
| | |
| | | <t-empty icon="folder-open" description="暂无数据" /> |
| | | </view> |
| | | </t-tab-panel> |
| | | <<<<<<< Updated upstream |
| | | <t-tab-panel label="云笔记" value="jesk_note" style="{{tabPanelstyle}}"> |
| | | <note |
| | | bookInfo="{{bookDetail}}" |
| | |
| | | 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> |
| | |
| | | </view> |
| | | <view class="btn-text">纸质样书申请</view> |
| | | </view> |
| | | <<<<<<< Updated upstream |
| | | <view |
| | | class="shopCar {{(tabValue == 'jsek_teachingResources' || tabValue == 'jesk_note') ? 'disabledColor' : 'shopCarColor' }}" |
| | | bind:tap="addBookShopcCar" |
| | |
| | | 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> |
| | | <!-- 我要建议弹窗 --> |
| | |
| | | color: #fff; |
| | | } |
| | | |
| | | .read { |
| | | width: 50%; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | color: #fff; |
| | | } |
| | | |
| | | .shopCarColor { |
| | | background-color: #F1AC37; |
| | | } |
| | |
| | | position: absolute; |
| | | top: 30rpx; |
| | | left: 118rpx; |
| | | } |
| | | |
| | | .webView { |
| | | height: 500rpx; |
| | | } |
| | |
| | | |
| | | onPageScroll(e) { |
| | | this.setData({ |
| | | isWhite: e.scrollTop > 50 ? true : false |
| | | isWhite: e.scrollTop > 20 ? true : false |
| | | }) |
| | | |
| | | }, |