bug
闫增涛
2024-09-09 7eea32a9a7a034e951468bea279688e8db5c1c98
pages/retrievalPage/index.js
@@ -96,8 +96,43 @@
      }
    }
    this.onTabsChange(e)
    // 检查登录状态
    const token = wx.getStorageSync(app.config.tokenKey)
    if (!token) {
      loginInfo(app, (data) => {
        if (data) {
          this.getUserInfo()
        }
      })
    } else {
      this.getUserInfo()
    }
  },
  // 获取登录用户身份
  getUserInfo() {
    app.MG.identity.getCurrentAppUser().then(res => {
      // 用户信息优先级:教师认证 > 微信 > 学生(注册时默认)
      if (res) {
        //获取用户类型
        let teacherRole = res.roleLinks.find((item) => item.role.refCode == 'teacher')
        let teacherInfos = res.infoList.find((item) => item.type == 'teacherInfo')
        let eMailData = res.secretList.find(i => i.type == 'EMail')
        if (eMailData) {
          this.setData({
            input: eMailData.credential
          })
        } else if (teacherRole && teacherInfos) {
          this.setData({
            input: JSON.parse(teacherInfos.data).email
          })
        } else {
          this.setData({
            input: ''
          })
        }
      }
    });
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
@@ -193,7 +228,8 @@
        'Name*': this.data.searchVal.trim(),
        '||author*': this.data.searchVal.trim(),
        '||isbn*': this.data.searchVal.trim(),
        '||seriesName*': this.data.searchVal.trim()
        '||seriesName*': this.data.searchVal.trim(),
        '||projectLeader*': this.data.searchVal.trim()
      }
    }
@@ -235,7 +271,8 @@
        'Name*': this.data.searchVal.trim(),
        '||author*': this.data.searchVal.trim(),
        '||isbn*': this.data.searchVal.trim(),
        '||seriesName*': this.data.searchVal.trim()
        '||seriesName*': this.data.searchVal.trim(),
        '||projectLeader*': this.data.searchVal.trim()
      }
    }
    //课程
@@ -557,6 +594,33 @@
      }
    });
  },
  openBookFair(event) {
    const item = event.currentTarget.dataset.item
    if (item.fileType == "pdf") {
      wx.navigateTo({
        url: "/packageBookService/pages/components/webView/index?md5=" +
          item.freeFile +
          "&fileName=" +
          item.name +
          "&fileType=" +
          item.fileType + "&bookBuy=true"
          // "&freePage=" +
          // this.data.fileInfo.freePage +
          +
          "&bookId=" +
          item.id,
      });
    } else {
      Toast({
        context: this,
        selector: '#t-toast',
        message: '此书不能查看',
        theme: 'warning',
        direction: 'column',
      });
    }
  },
  onSearchSubmit() {
    this.setData({
      loading: true,
@@ -738,7 +802,6 @@
    this.setData({
      [key]: true,
      dialogKey: key,
      input: '',
      Md5: item.datas.freeFile.FileList[0].Md5
    });
  },