闫增涛
2024-05-06 e8ec903206cb82e4dbb4687291d5f7788e7ff046
pages/bibliographyList/index.js
@@ -33,6 +33,9 @@
      emailError: false,
      loading: true, //开启骨架屏加载
      hidden: true, //是否展示内容
      height: '',
      dialogBox: false,
      inputStyle: 'border: 2rpx solid rgba(220,220,220,1);border-radius: 12rpx; padding: 0 0 0 16rpx;height:70rpx',
    },
    /**
@@ -55,6 +58,15 @@
        }
      }
      this.onTabsChange(event)
      var that = this;
      // 动态获取屏幕高度
      wx.getSystemInfo({
        success: (result) => {
          that.setData({
            height: result.windowHeight
          });
        },
      })
    },
    /**
@@ -108,29 +120,20 @@
    },
    onTabsChange(event) {
      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
        })
      this.setData({
        isMore: null,
        tabValue: value,
      })
      if (value == '0') {
        this.higherGet()
      } else if (value == '1') {
        this.vocationalGet()
      } else if (value == '2') {
        this.teacherGet()
      }
    },
    //高等教育
    higherGet(keyword) {
      // console.log(keyword, 'keyword');
      let searchObj = {
        'Name*': keyword,
        '||author*': keyword,
@@ -157,7 +160,6 @@
        },
        SysType: 'CmsItem'
      }).then(res => {
        res.datas.forEach(item => {
          item.determine = true
        })
@@ -169,6 +171,11 @@
          loading: false, //开启骨架屏加载
          hidden: false, //是否展示内容
        })
        if (res.datas.length < 7 && res.datas.length > 0) {
          this.setData({
            isMore: false
          })
        }
      })
      wx.stopPullDownRefresh()
    },
@@ -209,6 +216,11 @@
          vocationalList: res.datas,
          vocationalTotal: res.total
        })
        if (res.datas.length < 7 && this.datas.length > 0) {
          this.setData({
            isMore: false
          })
        }
      })
      wx.stopPullDownRefresh()
    },
@@ -249,6 +261,11 @@
          teacherList: res.datas,
          teacherTotal: res.total
        })
        if (res.datas.length < 7 && this.datas.length > 0) {
          this.setData({
            isMore: false
          })
        }
      })
      wx.stopPullDownRefresh()
    },
@@ -400,32 +417,42 @@
      const key = e.currentTarget.dataset.key;
      const item = e.currentTarget.dataset.item;
      this.setData({
        Md5: item.datas.freeFile.FileList[0].Md5
        Md5: item.datas.freeFile.FileList[0].Md5,
        dialogBox: true
      })
      wx.showModal({
        title: '请输入邮箱',
        content: '',
        confirmColor: '#ff6c00',
        cancelColor: '#949494',
        placeholderText: '请输入邮箱号',
        editable: true,
        complete: (res) => {
          if (res.cancel) {
            console.log('取消');
          }
          if (res.confirm) {
            this.setData({
              input: res.content
            })
            this.confirmM()
          }
        }
      // wx.showModal({
      //   title: '请输入邮箱',
      //   content: '',
      //   confirmColor: '#ff6c00',
      //   cancelColor: '#949494',
      //   placeholderText: '请输入邮箱号',
      //   editable: true,
      //   complete: (res) => {
      //     if (res.cancel) {
      //       console.log('取消');
      //     }
      //     if (res.confirm) {
      //       this.setData({
      //         input: res.content
      //       })
      //       this.confirmM()
      //     }
      //   }
      // })
    },
    // 弹窗取消
    closeDialog() {
      this.setData({
        dialogBox: false
      })
    },
    //提交
    confirmM(e) {
      const isEmailValid = /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/.test(this.data.input);
      if (isEmailValid && this.data.input) {
        this.setData({
          dialogBox: false
        })
        let query = {
          eMail: this.data.input,
          md5s: [this.data.Md5]
@@ -446,4 +473,9 @@
        });
      }
    },
    inputChange(e) {
      this.setData({
        input: e.detail.value
      })
    }
  })