css
litian
2024-07-09 e2b9cf5cb19ba0ae4bffd787d96f0d0cb8fb63bf
pages/bibliographyList/index.js
@@ -8,6 +8,7 @@
     * 页面的初始数据
     */
    data: {
      personalDataEmail: '',
      hiddenmodalput: false,
      name: "",
      phoneNum: '',
@@ -33,6 +34,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 +59,17 @@
        }
      }
      this.onTabsChange(event)
      var that = this;
      // 动态获取屏幕高度
      wx.getSystemInfo({
        success: (result) => {
          that.setData({
            height: result.windowHeight
          });
        },
      })
      this.ceShi()
    },
    /**
@@ -108,29 +123,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,
@@ -148,8 +154,8 @@
        },
        fields: {
          jsek_link: [],
          content: [],
          subtitle: [],
          content: [],
          fileType: [],
          jsek_resource: [],
          freeFile: [],
@@ -157,7 +163,6 @@
        },
        SysType: 'CmsItem'
      }).then(res => {
        res.datas.forEach(item => {
          item.determine = true
        })
@@ -169,6 +174,11 @@
          loading: false, //开启骨架屏加载
          hidden: false, //是否展示内容
        })
        if (res.datas.length < 7 && res.datas.length > 0) {
          this.setData({
            isMore: false
          })
        }
      })
      wx.stopPullDownRefresh()
    },
@@ -209,6 +219,11 @@
          vocationalList: res.datas,
          vocationalTotal: res.total
        })
        if (res.datas.length < 7 && this.datas.length > 0) {
          this.setData({
            isMore: false
          })
        }
      })
      wx.stopPullDownRefresh()
    },
@@ -249,6 +264,11 @@
          teacherList: res.datas,
          teacherTotal: res.total
        })
        if (res.datas.length < 7 && this.datas.length > 0) {
          this.setData({
            isMore: false
          })
        }
      })
      wx.stopPullDownRefresh()
    },
@@ -400,37 +420,38 @@
      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.scanCode({
      //   success: res => {
      //     console.log(res);
      //   }
      // })
    },
    // 弹窗取消
    closeDialog() {
      this.setData({
        dialogBox: false,
        // input: ''
      })
    },
    //提交
    confirmM(e) {
      wx.showLoading({
        title: '发送中...',
      })
      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]
        }
        app.MG.file.sendFileWithEmail(query).then(res => {
          wx.hideLoading()
          if (res) {
            wx.showToast({
              icon: 'success',
@@ -446,4 +467,30 @@
        });
      }
    },
    inputChange(e) {
      this.setData({
        input: e.detail.value
      })
    },
    ceShi() {
      let that = this;
      // 获取Storage中的数据
      wx.getStorage({
        key: 'website-front-userInfo',
        success(res) {
          let datas = JSON.parse(res.data)
          console.log(datas.Email);
          let personalData = JSON.parse(datas.data)
          that.setData({
            input: datas.Email
          })
          console.log(that.data.value);
        },
        fail(err) {
          console.error(err);
        }
      });
    }
  })