f2036f82c20767036fe8c4d627e5694e28e6ab73..ea3fb7a2d5841cf03d87c3e52f327fb0bb9553a5
2025-07-31 QYF-GitLab1
去掉首页教师认证、修改样书申请登录申请登录位置
ea3fb7 对比 | 目录
2025-07-31 QYF-GitLab1
优化资源查看逻辑
0b9f19 对比 | 目录
7个文件已修改
289 ■■■■■ 已修改文件
packageBookService/pages/bookServices/detail/buyResource/index.js 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/components/tree/index.js 106 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/index.js 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageCourse/pages/teachClass/detail/index.js 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageDomain/pages/resourceDetails/document/index.js 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageDomain/pages/sampleBookList/index.js 59 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
services/home/home.js 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/buyResource/index.js
@@ -222,20 +222,6 @@
            // const index = data.findIndex(i => i.id == parent.id)
            parent.isShowIcon = true
          }
          //  else {
          //   // 父级没有销售方式,查找该资源父级
          //   const arr = parent.productLinkPath.split('\\')
          //   const linkData = arr[arr.length - 1] // arr[arr.length - 1] 排除自己
          //   linkData.reverse()
          //   const dataList = linkData.map(ritem => {
          //     const parentData = data.find(citem => citem.id == ritem);
          //     if (parentData) return parentData;
          //   })
          //   if (dataList?.length > 0) {
          //     const index = data.findIndex(i => i.id == dataList[0].id)
          //     data[index].isShowIcon = true
          //   }
          // }
        } else {
          item.isShowIcon = true
        }
@@ -598,7 +584,7 @@
  // 单个勾选方法
  checkResoucrceInfo(tree, id) {
    function findAndUpdate(node) {
      if (node.sysType == "CmsFolder" && node.children.length > 0) {
      if (node.sysType == "CmsFolder" && node.children?.length > 0) {
        for (let index = 0; index < node.children.length; index++) {
          const element = node.children[index];
          findAndUpdate(element);
packageBookService/pages/bookServices/detail/components/tree/index.js
@@ -162,62 +162,6 @@
      }; // 触发事件的选项
      this.triggerEvent("downloadTeach", myEventDetail, myEventOption);
    },
    // 判断资源是否购买
    resourceIsBuy(data) {
      if (data.saleMethod && data.saleMethod.length) {
        const saleData = data.saleMethod.find((item) => item.SaleType == 'Normal')
        if (saleData.State == 'Disable') return false
        const isSHow = this.properties.buyIds.some(
          (item) => item == saleData.Id
        );
        // 已经购买
        if (isShow) return false
        // 未购买,查看销售方式是否过期
        if (!isShow) {
          const flag = new Date(saleData.EndDate).getTime() >= new Date().getTime() &&
            new Date(saleData.BeginDate).getTime() <= new Date().getTime()
          if (flag) {
            // 为过期 ,需要购买
            return true
          } else {
            // 已过期 无需购买
            return false
          }
        }
      } else {
        return false;
      }
    },
    // 判断当前目标是否已购买
    async getCmsDataByQrcode(item) {
      let query = {
        path: '*',
        queryType: '*',
        productId: this.properties.bookInfo.id,
        itemId: item.id,
        itemFields: {
          // 资源类型,试读文件,是否允许下载等参数
          selectType: [],
          freeFile: [],
          file: [],
          protectedFile: [],
          resourcesClassification: [],
          isDownload: [],
          jsek_resourceBrief: [],
          jsek_link: [],
          jsek_questionBank: [],
          learnSelectType: []
        },
        pading: {
          start: 0,
          size: 999
        }
      }
      const data = await app.MG.store.getProductDetail(query)
      return data?.datas ?? []
    },
    // 跳转音视频播放器
    goPlayer(e) {
@@ -266,35 +210,33 @@
          }
        }
        if (this.properties.tab == "jsek_cloudLearning") {
          // 1.找出所有父级目录和本身(有销售方式) 和 云学习本身(有销售方式) 放到一个数组  为空则暂未开放销售
          let learn = []
          if (this.properties.isCloundHaveSaleMethod) {
            // 1.1 云学习有销售方式,加入父级数组
            learn.push(this.properties.learnMenu)
          } else {
            // 1.2 云学习无销售方式,将父级目录和本身加入数组
            learn = this.handleTreeData(this.properties.learnList).filter(
              (citem) => citem.saleMethod &&
              citem.saleMethod.find((ditem) => ditem.SaleType == 'Normal' && ditem.Price > 0) &&
              new Date(citem.saleMethod.find((ditem) => ditem.SaleType == 'Normal').EndDate).getTime() >= new Date().getTime() &&
              new Date(citem.saleMethod.find((ditem) => ditem.SaleType == 'Normal').BeginDate).getTime() <= new Date().getTime() &&
              item.productLinkPath.includes(citem.productLinkPath)
            )
          }
          // 2.找出这个数组里已购买的 形成新数组     为空则未购买
          let buyList = []
          if (learn.length) buyList = learn.filter((item) => this.properties.buyIds.includes(item.saleMethod.find((citem) => citem.SaleType == 'Normal').Id))
          // 有父级(包含销售方式),且未购买
          if (learn.length && !buyList.length && !item.freeFile) return wx.showToast({
          // // 1.找出所有父级目录和本身(有销售方式) 和 云学习本身(有销售方式) 放到一个数组  为空则暂未开放销售
          // let learn = []
          // if (this.properties.isCloundHaveSaleMethod) {
          //   // 1.1 云学习有销售方式,加入父级数组
          //   learn.push(this.properties.learnMenu)
          // } else {
          //   // 1.2 云学习无销售方式,将父级目录和本身加入数组
          //   learn = this.handleTreeData(this.properties.learnList).filter(
          //     (citem) => citem.saleMethod &&
          //     citem.saleMethod.find((ditem) => ditem.SaleType == 'Normal' && ditem.Price > 0) &&
          //     new Date(citem.saleMethod.find((ditem) => ditem.SaleType == 'Normal').EndDate).getTime() >= new Date().getTime() &&
          //     new Date(citem.saleMethod.find((ditem) => ditem.SaleType == 'Normal').BeginDate).getTime() <= new Date().getTime() &&
          //     item.productLinkPath.includes(citem.productLinkPath)
          //   )
          // }
          // // 2.找出这个数组里已购买的 形成新数组     为空则未购买
          // let buyList = []
          // if (learn.length) buyList = learn.filter((item) => this.properties.buyIds.includes(item.saleMethod.find((citem) => citem.SaleType == 'Normal').Id))
          // // 有父级(包含销售方式),且未购买
          if (!item.isbuy && !item.freeFile) return wx.showToast({
            icon: 'error',
            title: '请先购买该资源',
          })
          if (item.protectedFile || item.freeFile) {
            const currentSaleMaths = await this.getCmsDataByQrcode(item)
            let file = item.fileMap[item.protectedFile] ? item.fileMap[item.protectedFile] : item.fileMap[item.freeFile]
            if (file && file.protectType !== "Public") {
              const isBuyData = currentSaleMaths.purchasedSaleMethodIdList?.includes(item.saleMethod[0]?.Id)
              if (!isBuyData) {
              if (!item.isbuy) {
                return wx.showToast({
                  icon: 'error',
                  title: '请先购买该资源',
@@ -324,7 +266,11 @@
      const token = wx.getStorageSync(app.config.tokenKey);
      if (!token && this.data.tab != 'jsek_teachingResources') {
        loginInfo(app, (data) => {
          if (data) {}
          if (data) {
            wx.redirectTo({
              url: '/packageBookService/pages/bookServices/detail/index?id=' + this.data.bookInfo.id + '&name=' + encodeURI(this.data.bookInfo.name),
            })
          }
        })
      } else {
        goPlayerFun()
packageBookService/pages/bookServices/detail/index.js
@@ -470,6 +470,7 @@
      res.datas.contactInformation = res.datas.contactInformation ? res.datas.contactInformation : '-'
      this.setData({
        bookDetail: res.datas,
        bookName: res.datas.name,
        buyIdList: res.datas.purchasedSaleMethodIdList,
        pageLoading: false
      });
@@ -998,20 +999,24 @@
    for (let item of tree) {
      // 是否显示按钮
      item.isShowIcon = false;
      if (item.sysType == 'CmsItem') {
        // 查找目录下资源销售方式,目录下资源没有销售方式
        if (item.saleMethod?.length == 0) {
          // 查看其父级是否有销售方式
          if (parent.saleMethod?.length > 0) {
            // 父级是有销售方式直接显示按钮
            parent.isShowIcon = true
      if (!wx.getStorageSync(app.config.tokenKey)) {
        item.isShowIcon = false;
      } else {
        if (item.sysType == 'CmsItem') {
          // 查找目录下资源销售方式,目录下资源没有销售方式
          if (item.saleMethod?.length == 0) {
            // 查看其父级是否有销售方式
            if (parent.saleMethod?.length > 0) {
              // 父级是有销售方式直接显示按钮
              parent.isShowIcon = true
            }
          } else {
            item.isShowIcon = true
          }
        } else {
          item.isShowIcon = true
        }
      } else {
        if (item.children?.length > 0) {
          this.handleSalmethodBtn(item.children, data, item)
          if (item.children?.length > 0) {
            this.handleSalmethodBtn(item.children, data, item)
          }
        }
      }
    }
@@ -1724,29 +1729,6 @@
  },
  // 判断资源是否购买
  resourceIsBuy(data) {
    // if (data.saleMethod && data.saleMethod.length) {
    //   const saleData = data.saleMethod.find((item) => item.SaleType == 'Normal')
    //   if (saleData.State == 'Disable') return false
    //   const isShow = this.data.buyIdList.some(
    //     (item) => item == saleData.Id
    //   );
    //   // 已经购买
    //   if (isShow || saleData.Price == 0) return false
    //   // 未购买,查看销售方式是否过期
    //   if (!isShow) {
    //     const flag = new Date(saleData.EndDate).getTime() >= new Date().getTime() &&
    //       new Date(saleData.BeginDate).getTime() <= new Date().getTime()
    //     if (flag) {
    //       // 为过期 ,需要购买
    //       return true
    //     } else {
    //       // 已过期 无需购买
    //       return false
    //     }
    //   }
    // } else {
    //   return false;
    // }
    let linkData = data.productLinkPath.split("\\");
    linkData.reverse()
    let dataList = linkData.map(item => {
packageCourse/pages/teachClass/detail/index.js
@@ -93,7 +93,6 @@
      }]
    }
    app.MG.ugc.getTopicMessageList(data).then((res) => {
      debugger
      const list = res.datas.map((item, i) => {
        item.question = []
        item.bookId = null
packageDomain/pages/resourceDetails/document/index.js
@@ -413,10 +413,16 @@
    let that = this
    //图片
    if (item.selectType == 'picture' || item.learnSelectType == 'picture') {
      let file = isTry ? item.freeFile : item.protectedFile || item.file
      this.setData({
        showData: app.config.requestCtx + '/file/api/ApiDownload?md5=' + file,
      })
      let file = isTry ? item.freeFile : item.protectedFile || item.file;
      if (isTry) {
        this.setData({
          showData: app.config.requestCtx + '/file/api/ApiDownload?md5=' + file,
        })
      } else {
        this.setData({
          showData: app.config.requestCtx + '/file/api/ApiDownloadForAuthorize?md5=' + file + '&token=' + wx.getStorageSync(app.config.tokenKey)
        })
      }
      wx.hideLoading();
    }
    // 下载文件zip
@@ -435,14 +441,20 @@
    }
    //文档等
    if (item.selectType == 'document' || item.selectType == 'pdf' || item.learnSelectType == 'document' || item.learnSelectType == 'pdf') {
      let md5 = isTry ? item.freeFile : item.protectedFile || item.file || item.freeFile
      let md5 = isTry ? item.freeFile : item.protectedFile || item.file || item.freeFile;
      let urlPage = ''
      if (isTry) {
        urlPage = app.config.requestCtx + '/file/api/ApiDownload?md5=' + md5
      } else {
        urlPage = app.config.requestCtx + '/file/api/ApiDownloadForAuthorize?md5=' + md5 + '&token=' + wx.getStorageSync(app.config.tokenKey)
      }
      if (item.fileMap[md5]?.extension == 'xlsx' || item.fileMap[md5]?.extension == 'xls') {
        this.setData({
          selectTypeData: 'excel',
          showMd5: md5,
        })
        wx.request({
          url: app.config.requestCtx + '/file/api/ApiDownload?md5=' + md5,
          url: urlPage,
          method: 'GET', // 请求方式
          responseType: 'arraybuffer', // 指定返回类型为 arraybuffer
          success: (res) => {
@@ -525,25 +537,6 @@
    wx.previewImage({
      urls: urls // 需要预览的图片http链接列表
    })
  },
  // 判断当前点击的数据是否购买
  cmsItemIsBuy(item) {
    let flag = false
    // 买了
    if (this.data.buyList.length) {
      if (this.data.buyList.some(citem => item.productLinkPath.includes(citem.productLinkPath)))
        flag = true
    } else {
      // 没买且无销售方式
      if (!item.saleMethod.length) {
        flag = true
      } else {
        // 没买且销售方式过期//没买,销售方式价格为0
        const itemSaleMethod = item.saleMethod.find(citem => citem.SaleType == 'Normal')
        if (new Date().getTime() > new Date(itemSaleMethod.EndDate).getTime() || itemSaleMethod.Price == 0) flag = true
      }
    }
    return flag
  },
  // 
  scrolltolower(e) {
packageDomain/pages/sampleBookList/index.js
@@ -167,24 +167,31 @@
   */
  onShow() {
    let that = this;
    that.getAlreadyPBookList()
    that.getAlreadyEBookList()
    const token = wx.getStorageSync(app.config.tokenKey)
    if (!token) {
      loginInfo(app, (data) => {
        if (data) {
          that.setData({
            userInfo: JSON.parse(wx.getStorageSync(app.config.userInfoKey))
          })
          that.getAlreadyPBookList()
          that.getAlreadyEBookList()
          that.getSelectPaperBookCount()
          that.getSelectBookCount()
        } else {
          wx.switchTab({
            url: '/pages/home/home',
          })
        }
    if (token) {
      that.setData({
        userInfo: JSON.parse(wx.getStorageSync(app.config.userInfoKey))
      })
      that.getSelectPaperBookCount()
      that.getSelectBookCount()
    }
    // if (!token) {
    //   loginInfo(app, (data) => {
    //     if (data) {
    //       that.setData({
    //         userInfo: JSON.parse(wx.getStorageSync(app.config.userInfoKey))
    //       })
    //     } else {
    //       wx.switchTab({
    //         url: '/pages/home/home',
    //       })
    //     }
    //   })
    // }
    if (wx.getStorageSync("paperBookList") || wx.getStorageSync("electronicBookList")) {
      if (wx.getStorageSync("paperBookList")) {
        that.setData({
@@ -739,6 +746,17 @@
  onChangePaper(e) {
    const item = e.currentTarget.dataset.book;
    const index = this.data.bookList.findIndex(citem => citem.id == item.id)
    const token = wx.getStorageSync(app.config.tokenKey)
    if (!token) {
      loginInfo(app, (data) => {
        if (data) {
          wx.redirectTo({
            url: '/packageDomain/pages/sampleBookList/index',
          })
        }
      })
      return false;
    }
    let role = this.data.userInfo != null ? this.data.userInfo.role : null
    if (role && role == 'Teacher') {
      // 是教师
@@ -805,6 +823,17 @@
  async onChangeElectron(e) {
    const item = e.currentTarget.dataset.book;
    const index = this.data.bookList.findIndex(citem => citem.id == item.id)
    const token = wx.getStorageSync(app.config.tokenKey)
    if (!token) {
      loginInfo(app, (data) => {
        if (data) {
          wx.redirectTo({
            url: '/packageDomain/pages/sampleBookList/index',
          })
        }
      })
      return false;
    }
    let role = this.data.userInfo != null ? this.data.userInfo.role : null
    if (role && role == 'Teacher') {
      // 是教师
services/home/home.js
@@ -49,12 +49,12 @@
          icon: '/static/images/home/shumuxiazai@2x.png',
          url: '/pages/bibliographyList/index',
        },
        {
          text: '教师认证',
          key: 7,
          icon: '/static/images/home/jiaoshirenzheng@2x.png',
          url: '/packageDomain/pages/teacherCertification/index',
        },
        // {
        //   text: '教师认证',
        //   key: 7,
        //   icon: '/static/images/home/jiaoshirenzheng@2x.png',
        //   url: '/packageDomain/pages/teacherCertification/index',
        // },
        {
          text: '样书申请',
          key: 8,