| | |
| | | // pages/bookExhibitionDetails/index.js |
| | | const app = getApp() |
| | | import { |
| | | loginInfo |
| | | } from '../../assets/js/login'; |
| | | Page({ |
| | | |
| | | /** |
| | | * 页面的初始数据 |
| | | */ |
| | | data: { |
| | | start: 1, |
| | | loading: true, |
| | | hidden: true, |
| | | bookName: '', |
| | | bookBeginDate: '', |
| | | bookCreator: '', |
| | |
| | | bookExhibitionList: [], |
| | | navBarHeight: '', |
| | | barHeight: '', |
| | | subtitleName: '', |
| | | totalSize: '', |
| | | passId: '', |
| | | isMore: null, |
| | | }, |
| | | |
| | | /** |
| | |
| | | navBarHeight: navBarHeight, |
| | | barHeight: systInfo.statusBarHeight, |
| | | }) |
| | | console.log(); |
| | | |
| | | |
| | | this.setData({ |
| | | bookName: options.bookName, |
| | | subtitleName: options.subtitleName |
| | | passId: options.id |
| | | }) |
| | | const token = wx.getStorageSync(app.config.tokenKey) |
| | | if (!token) { |
| | | loginInfo(app, (data) => { |
| | | if (data) { |
| | | this.bookExhibitionGet(this.data.passId) |
| | | this.getBookExhibitionDetails() |
| | | } else { |
| | | this.bookExhibitionGet(this.data.passId) |
| | | this.getBookExhibitionDetails() |
| | | } |
| | | }) |
| | | |
| | | const passId = options.id |
| | | } else { |
| | | this.bookExhibitionGet(this.data.passId) |
| | | this.getBookExhibitionDetails() |
| | | } |
| | | |
| | | this.bookExhibitionGet(passId) |
| | | this.getBookExhibitionDetails(passId) |
| | | }, |
| | | |
| | | /** |
| | |
| | | /** |
| | | * 用户点击右上角分享 |
| | | */ |
| | | onShareAppMessage() { |
| | | |
| | | }, |
| | | onShareAppMessage() {}, |
| | | onShareTimeline() {}, |
| | | |
| | | bookExhibitionGet(passId) { |
| | | wx.showLoading({ |
| | | title: '加载中...', |
| | | this.setData({ |
| | | loading: true, |
| | | hidden: true, |
| | | }) |
| | | console.log(passId, 8988989); |
| | | app.MG.store.getProductDetail({ |
| | | storeInfo: 'jsek_bookFair', //商品库 |
| | | path: '*', //路径 |
| | |
| | | Creator: [] |
| | | } |
| | | }).then(res => { |
| | | console.log(res.datas.datas.Creator.Name, 'res'); |
| | | console.log(res.datas, 'res'); |
| | | this.setData({ |
| | | bookName: res.datas.name, |
| | | bookBeginDate: res.datas.beginDate, |
| | | bookCreator: res.datas.datas.Creator.Name, |
| | | bookContent: res.datas.content, |
| | | bookImage: res.datas.icon |
| | | bookImage: res.datas.icon || '/static/images/bookExhibitionList/banner.png', |
| | | loading: false, |
| | | hidden: false, |
| | | }); |
| | | wx.hideLoading() |
| | | if (res.datas.subtitle == undefined) { |
| | | res.datas.subtitle = ""; |
| | | } |
| | | let title = res.datas.subtitle + this.data.bookName |
| | | wx.setNavigationBarTitle({ |
| | | title: title |
| | | }); |
| | | }) |
| | | }, |
| | | //书展详情接口 |
| | | getBookExhibitionDetails(passId) { |
| | | getBookExhibitionDetails() { |
| | | app.MG.store.getProductList({ |
| | | path: '*', |
| | | storeInfo: 'jsek_bookFair', |
| | | mainProductId: passId, |
| | | mainProductId: this.data.passId, |
| | | queryType: 'Related', // 查询类型: Related:查询关联商品;SubProduct: 查询子商品; |
| | | paging: { |
| | | start: 0, |
| | | size: this.data.start * 6 |
| | | }, |
| | | fields: { |
| | | author: [], |
| | | publicationDate: [], |
| | |
| | | Creator: [] |
| | | } |
| | | }).then(res => { |
| | | |
| | | this.setData({ |
| | | bookExhibitionList: res.datas |
| | | bookExhibitionList: res.datas, |
| | | totalSize: res.total, |
| | | loading: false, |
| | | hidden: false, |
| | | }) |
| | | console.log(this.data.bookExhibitionList, 'bookExhibitionList'); |
| | | }) |
| | | }, |
| | | onBookDetails(event) { |
| | |
| | | goBack() { |
| | | wx.navigateBack(); |
| | | }, |
| | | // 触底函数 |
| | | onReachBottom() { |
| | | if (this.data.bookExhibitionList.length < this.data.totalSize) { |
| | | this.setData({ |
| | | isMore: true, |
| | | start: this.data.start + 1 |
| | | }) |
| | | this.getBookExhibitionDetails() |
| | | } else { |
| | | this.setData({ |
| | | isMore: true, |
| | | }) |
| | | setTimeout(() => { |
| | | this.setData({ |
| | | isMore: false |
| | | }) |
| | | }, 300) |
| | | } |
| | | }, |
| | | |
| | | }) |