yiming
2024-03-21 47462dc6c323cc4ac7b32b93051947d351799c1f
pages/retrievalPage/index.js
@@ -9,6 +9,7 @@
   * 页面的初始数据
   */
  data: {
    isMore: null,
    tabPanelstyle: 'display:flex;justify-content:center;align-items:center;',
    navBarHeight: '',
    barHeight: '',
@@ -24,7 +25,12 @@
    biblioClassificationData: [],//书展
    biblioClassificationTotal: 0,
    bookFairData: [],//书目
    bookFairTotal: 0
    bookFairTotal: 0,
    pageCount: {
      page: 1,
      total: 0,
    },
    tabValue: ''
  },
  /**
@@ -44,6 +50,13 @@
    this.retrievalPageGet()
    this.bibliographyGet()
    let event = {
      detail: {
        value: "0"
      }
    }
    this.onTabsChange(event)
  },
  /**
@@ -105,13 +118,47 @@
    this.retrievalPageGet()
    this.bibliographyGet()
  },
  //标签的切换
  onTabsChange(event) {
    console.log(`Change tab, tab-panel searchVal is ${event.detail.searchVal}.`);
    const value = event.detail.value
    if (value === '0') {
      this.setData({
        tabValue: value,
        isMore: false
      })
    } else if (value === '1') {
      console.log(value, 'tab');
      this.setData({
        tabValue: value,
        isMore: false
      })
    } else if (value === '2') {
      this.setData({
        tabValue: value,
        isMore: false
      })
    } else if (value === '3') {
      this.setData({
        tabValue: value,
        isMore: false
      })
    } else if (value === '4') {
      this.setData({
        tabValue: value,
        isMore: false
      })
    } else if (value === '5') {
      this.setData({
        tabValue: value,
        isMore: false
      })
    }
  },
  onTabsClick(event) {
    console.log(`Click tab, tab-panel searchVal is ${event.detail.searchVal}.`);
  },
  retrievalPageGet() {
@@ -149,7 +196,7 @@
      },
      PageQuery: {
        Start: 0,
        Size: 999
        Size: this.data.pageCount.page * 9,
      },
      SortQuery: [
        {
@@ -194,7 +241,7 @@
      },
      PageQuery: {
        Start: 0,
        Size: 999
        Size: this.data.pageCount.page * 4
      },
      SortQuery: [
        {
@@ -238,7 +285,7 @@
      },
      PageQuery: {
        Start: 0,
        Size: 999
        Size: this.data.pageCount.page * 9,
      },
      SortQuery: [
        {
@@ -283,7 +330,7 @@
      },
      PageQuery: {
        Start: 0,
        Size: 999
        Size: this.data.pageCount.page * 6,
      },
      SortQuery: [
        {
@@ -327,7 +374,7 @@
      PageQuery: {
        Start: 0,
        Size: 999
        Size: this.data.pageCount.page * 10
      },
      SortQuery: [
        {
@@ -382,7 +429,8 @@
      })
      this.setData({
        bookData: datas1,
        bookTotal: data1.totalCount
        bookTotal: data1.totalCount,
      })
@@ -434,7 +482,7 @@
      datas5.forEach((items) => {
        items.subtitleName = items.subtitle + items.name
      })
      console.log(datas5, 'sadasd');
      // console.log(datas5, 'sadasd');
      this.setData({
        biblioClassificationData: datas5,
        biblioClassificationTotal: data5.totalCount
@@ -462,7 +510,7 @@
      queryType: '*',
      paging: {
        start: 0,
        size: 999
        size: this.data.pageCount.page * 9,
      },
      coverSize: {
        width: 260
@@ -478,7 +526,7 @@
      },
      SysType: "CmsItem"
    }).then(res => {
      // console.log(res);
      this.setData({
        bookFairData: res.datas,
        bookFairTotal: res.total
@@ -527,8 +575,6 @@
    const item = e.currentTarget.dataset.item
    wx.navigateTo({
      url: '/packageBookService/pages/bookServices/detail/index?id=' + item.id + '&name=' + item.name
    })
  },
  onBookExhibitionDetails(e) {
@@ -547,6 +593,129 @@
  onPullDownRefresh() {
    console.log("下拉刷新...");
  },
  /**
     * 页面上拉触底事件的处理函数
     */
  onReachBottom(e) {
    if (this.data.tabValue == 0) {
      console.log(0);
      if (this.data.bookData.length < this.data.bookTotal) {
        this.setData({
          isMore: true,
          "pageCount.page": this.data.pageCount.page + 1
        })
        this.retrievalPageGet()
      } else {
        this.setData({
          isMore: true,
        })
        setTimeout(() => {
          this.setData({
            isMore: false
          })
        }, 100)
      }
    } else if (this.data.tabValue == 1) {
      if (this.data.courseData.length < this.data.courseTotal) {
        this.setData({
          isMore: true,
          "pageCount.page": this.data.pageCount.page + 1
        })
        this.retrievalPageGet()
      } else {
        this.setData({
          isMore: true,
        })
        setTimeout(() => {
          this.setData({
            isMore: false
          })
        }, 100)
      }
      console.log(2);
    } else if (this.data.tabValue == 2) {
      if (this.data.digitalTextbooksData.length < this.data.digitalTextbooksTotal && this.data.digitalTextbooksData.length > 9) {
        this.setData({
          isMore: true,
          "pageCount.page": this.data.pageCount.page + 1
        })
        this.retrievalPageGet()
      } else {
        this.setData({
          isMore: true,
        })
        setTimeout(() => {
          this.setData({
            isMore: false
          })
        }, 100)
      }
      console.log(2);
    } else if (this.data.tabValue == 3) {
      if (this.data.seminarData.length < this.data.seminarTotal) {
        this.setData({
          isMore: true,
          "pageCount.page": this.data.pageCount.page + 1
        })
        this.retrievalPageGet()
      } else {
        this.setData({
          isMore: true,
        })
        setTimeout(() => {
          this.setData({
            isMore: false
          })
        }, 100)
      }
      console.log(3);
    } else if (this.data.tabValue == 4) {
      if (this.data.bookFairData.length < this.data.bookFairTotal) {
        this.setData({
          isMore: true,
          "pageCount.page": this.data.pageCount.page + 1
        })
        this.bibliographyGet()
      } else {
        this.setData({
          isMore: true,
        })
        setTimeout(() => {
          this.setData({
            isMore: false
          })
        }, 100)
      }
      console.log(4);
    } else if (this.data.tabValue == 5) {
      if (this.data.biblioClassificationData.length < this.data.biblioClassificationTotal) {
        this.setData({
          isMore: true,
          "pageCount.page": this.data.pageCount.page + 1
        })
        this.retrievalPageGet()
      } else {
        this.setData({
          isMore: true,
        })
        setTimeout(() => {
          this.setData({
            isMore: false
          })
        }, 100)
      }
    }
  },
})