闫增涛
2024-03-26 373ee80774b932a502528b0da5f2eccf112eb762
申请按钮防抖
2个文件已修改
26 ■■■■ 已修改文件
app.json 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/index.js 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app.json
@@ -52,7 +52,8 @@
        "pages/bookServices/detail/index",
        "pages/bookServices/examination/examination",
        "pages/bookServices/webpage/index",
        "pages/components/webView/index"
        "pages/components/webView/index",
        "pages/bookServices/detail/buyResource/index"
      ]
    }
  ],
packageBookService/pages/bookServices/detail/index.js
@@ -34,6 +34,7 @@
    openTeachids: [],
    openLearnids: [],
    openTestids: [],
    applyResourceState: false,  // 申请教学资源按钮防抖
    resourceClassList: [], // 资源所属分类
    applyState: "",  // 教学资源申请状态
    deadline: "",  // 教学资源申请有效日期
@@ -801,8 +802,6 @@
    });
  },
  async buyBook() {
    if (!this.data.expire) {
      let bookOrdersId = ''
@@ -839,7 +838,7 @@
  },
  // 获取教学资源下载是否申请通过
  getApplyInfo(id) {
  async getApplyInfo(id) {
    // 获取当前时间
    const currentDate = new Date()
    let query = {
@@ -852,7 +851,7 @@
      appRefCode: app.config.appRefCode,
      topicIdOrRefCode: 'productDownLoad'
    }
    app.MG.ugc.getTopicMessageList(query).then((res) => {
    await app.MG.ugc.getTopicMessageList(query).then((res) => {
      const applyResource = res.datas.find((item) => {
        let content = []
        try {
@@ -907,10 +906,22 @@
        })
      }
    })
    this.setData({
      applyResourceState: false
    })
    wx.hideLoading()
  },
  // 申请教学资源
  applyResource() {
    if (this.data.applyResourceState) {
      return wx.showToast({
        icon: 'error',
        title: '请勿重复点击',
      })
    }
    this.setData({
      applyResourceState: true
    })
    wx.showLoading({
      title: '加载中',
    })
@@ -934,13 +945,13 @@
        }
      ])
    }
    app.MG.ugc.newTopicMessage(query).then((res) => {
    app.MG.ugc.newTopicMessage(query).then(async (res) => {
      if (res) {
        wx.showToast({
          title: '申请已提交,请待审核通过后下载',
        })
      }
      this.getApplyInfo(this.data.bookDetail.id)
      await this.getApplyInfo(this.data.bookDetail.id)
    })
    //   } else {
    //     ElMessageBox.confirm('请先进行教师认证!', '尊敬的用户,您好!', {