闫增涛
2024-03-28 b6923adb7b6a5fcbe4a2eaa06e1ebe0e044ba0e2
pages/bibliographyList/index.js
@@ -7,6 +7,8 @@
     * 页面的初始数据
     */
    data: {
      downloadLoadin: false,
      isMore: null,
      higherList: [],
      vocationalList: [],
      teacherList: [],
@@ -16,7 +18,9 @@
      value: '',
      BarHeight: '',
      navBarHeight: '',
      start: 1,
      tabValue: '',
      keyword: ''
    },
    /**
@@ -35,7 +39,12 @@
        barHeight: systInfo.statusBarHeight,
      })
      let event =
      {
        detail: { value: "0" }
      }
      this.onTabsChange(event)
@@ -92,14 +101,34 @@
    },
    onTabsChange(event) {
      console.log(`Change tab, tab-panel value is ${event.detail.value}.`);
      const value = event.detail.value
      if (value === '0') {
        console.log(value);
        this.setData({
          tabValue: value,
          isMore: false
        })
      } else if (value === '1') {
        console.log(value);
        this.setData({
          tabValue: value,
          isMore: false
        })
      } else if (value === '2') {
        console.log(value);
        this.setData({
          tabValue: value,
          isMore: false
        })
      }
    },
    onTabsClick(event) {
      console.log(`Click tab, tab-panel value is ${event.detail.value}.`);
    },
    //高等教育
    higherGet(keyword) {
      console.log(keyword, 'keyword');
      let searchObj = {
        'Name*': keyword,
        '||author*': keyword,
@@ -112,7 +141,7 @@
        queryType: '*',
        paging: {
          start: '0',
          size: '999'
          size: this.data.start * 9
        },
        coverSize: {
          width: 260
@@ -139,7 +168,7 @@
        })
        console.log(this.data.higherList, '5555');
      })
      wx.stopPullDownRefresh()
    },
@@ -156,7 +185,7 @@
        queryType: '*',
        paging: {
          start: '0',
          size: '999'
          size: this.data.start * 9
        },
        coverSize: {
          width: 260
@@ -181,6 +210,7 @@
        })
      })
      wx.stopPullDownRefresh()
    },
    // 职业教育
    teacherGet(keyword) {
@@ -195,7 +225,7 @@
        queryType: '*',
        paging: {
          start: '0',
          size: '999'
          size: this.data.start * 9
        },
        coverSize: {
          width: 260
@@ -220,10 +250,13 @@
        })
      })
      wx.stopPullDownRefresh()
    },
    downloadData(event) {
      this.setData({
        downloadLoadin: true
      })
      console.log(111);
      const item = event.currentTarget.dataset.item;
      // console.log(item.datas.freeFile.Value);
@@ -253,6 +286,13 @@
          console.log('下载文件失败', res);
        }
      });
      setTimeout(() => {
        this.setData({
          downloadLoadin: false
        });
      }, 2000);
    },
    onSearchSubmit: function (e) {
      const keyword = e.detail.value;
@@ -261,11 +301,95 @@
      this.higherGet(keyword)
      this.vocationalGet(keyword)
      this.teacherGet(keyword)
    },
    goBack() {
      wx.navigateBack();
    },
    onReachBottom(e) {
      if (this.data.tabValue == 0) {
        console.log(0);
        if (this.data.higherList.length < this.data.higherTotal) {
          this.setData({
            isMore: true,
            start: this.data.start + 1
          })
          this.higherGet()
        } else {
          this.setData({
            isMore: true,
          })
          setTimeout(() => {
            this.setData({
              isMore: false
            })
          }, 100)
        }
      } else if (this.data.tabValue == 1) {
        if (this.data.teacherList.length < this.data.teacherTotal) {
          this.setData({
            isMore: true,
            start: this.data.start + 1
          })
          this.teacherGet()
        } else {
          this.setData({
            isMore: true,
          })
          setTimeout(() => {
            this.setData({
              isMore: false
            })
          }, 100)
        }
        console.log(2);
      } else if (this.data.tabValue == 2) {
        if (this.data.vocationalList.length < this.data.vocationalTotal && this.data.vocationalList.length > 9) {
          this.setData({
            isMore: true,
            start: this.data.start + 1
          })
          this.vocationalGet()
        } else {
          this.setData({
            isMore: true,
          })
          setTimeout(() => {
            this.setData({
              isMore: false
            })
          }, 100)
        }
        console.log(2);
      }
    },
    onPullDownRefresh() {
      let keyword = this.data.value
      this.setData({
        start: 1,
      })
      this.higherGet(keyword)
      this.vocationalGet(keyword)
      this.teacherGet(keyword)
    },
  })