闫增涛
2024-04-02 aef06b129be7a3a12ac097db8e372b0cb33c6c42
我的建议,笔记bug修改
11个文件已修改
444 ■■■■ 已修改文件
packageBookService/pages/bookServices/detail/components/note/note.js 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/components/note/note.wxss 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/components/suggest/suggest.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/components/suggest/suggest.wxml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/components/suggest/suggest.wxss 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/index.js 103 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/index.wxss 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/examination/examination.js 262 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/examination/questionList/index.wxml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/list/index.js 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/list/index.wxml 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/components/note/note.js
@@ -63,7 +63,6 @@
      })
    },
    openDialog() {
      console.log(this.properties.bookInfo.name);
      this.setData({
        submitTitle: this.properties.bookInfo.name,
        showNoteDialog: true
@@ -93,12 +92,14 @@
    },
    // 弹窗确定按钮
    confirmSuggest() {
      if (!this.data.submitTitle) {
      const submitTitle = this.data.submitTitle.trim()
      const textvalue = this.data.textvalue.trim()
      if (!submitTitle.length) {
        return wx.showToast({
          icon: 'error',
          title: '请填写笔记标题',
        })
      } else if (!this.data.textvalue) {
      } else if (!textvalue.length) {
        return wx.showToast({
          icon: 'error',
          title: '请填写笔记内容',
@@ -240,13 +241,15 @@
      messageIds.push(id)
      wx.showModal({
        title: '提示',
        content: '确认删除该笔记吗?',//editable如果为true,这就是输入框的内容
        editable: false,//是否显示输入框
        placeholderText: '请输入内容吧',//输入框的默认内容
        content: '确认删除该笔记吗?', //editable如果为true,这就是输入框的内容
        editable: false, //是否显示输入框
        placeholderText: '请输入内容吧', //输入框的默认内容
        success: (res) => {
          if (res.confirm) {
            app.MG.ugc
              .delTopicMessage({ messageIds })
              .delTopicMessage({
                messageIds
              })
              .then((res) => {
                wx.showToast({
                  title: '删除成功',
@@ -277,7 +280,10 @@
        submitTitle: note.name,
        noteId: note.id
      })
      this.openDialog()
      console.log(note.name, this.data.submitTitle);
      this.setData({
        showNoteDialog: true
      })
    },
    // 编辑笔记接口
    updateNote() {
@@ -323,4 +329,4 @@
      })
    }
  }
})
})
packageBookService/pages/bookServices/detail/components/note/note.wxss
@@ -149,4 +149,8 @@
  margin-top: 100rpx;
  display: flex;
  justify-content: center;
}
.t-input__placeholder {
  font-size: 28rpx !important
}
packageBookService/pages/bookServices/detail/components/suggest/suggest.js
@@ -16,7 +16,7 @@
  },
  data: {
    inputStyle: 'border: 2rpx solid rgba(220,220,220,1);border-radius: 12rpx; padding:16rpx',
    inputStyle: 'border: 2rpx solid rgba(220,220,220,1);border-radius: 12rpx; padding:16rpx;font-size: 24rpx;',
    placeholderstyle: 'font-size:28rpx',
    dialogKey: '',
    showWithInput: false,
packageBookService/pages/bookServices/detail/components/suggest/suggest.wxml
@@ -29,7 +29,6 @@
    </view>
    <view class="phone-input">
      <t-input
        clearable
        value="{{inputvalue}}"
        slot="content"
        label=""
@@ -39,6 +38,7 @@
        maxlength="{{11}}"
        class="phone"
        style="{{inputStyle}}"
        placeholder-class="t-input__placeholder input-placeholder"
      />
    </view>
    <view style="width: 100%">
packageBookService/pages/bookServices/detail/components/suggest/suggest.wxss
@@ -1,5 +1,10 @@
/* pages/bookServices/detail/components/suggest/suggest.wxss */
.t-input__placeholder {
.t-input__wrap .t-input__content,
.t-input__control {
  font-size: 28rpx !important;
}
packageBookService/pages/bookServices/detail/index.js
@@ -1010,45 +1010,49 @@
    wx.showLoading({
      title: '加载中',
    })
    // let role = userStore.userInfo ? userStore.userInfo.role : null
    // if (role) {
    //   if (role == 'Teacher') {
    // 申请教学资源
    let query = {
      topicIdOrRefCode: 'productDownLoad',
      type: 'applyForDownload',
      state: 'WaitAudit',
      cmsTypeRefCode: '',
      newDataListRequest: [],
      name: this.data.bookDetail.name, // name为申请的书本名称
      content: JSON.stringify([{
        name: this.data.bookDetail.name,
        id: this.data.bookDetail.id,
        // defaultSaleMethodId: bookData.value.defaultSaleMethodId,
        icon: this.data.bookDetail.icon
      }])
    }
    app.MG.ugc.newTopicMessage(query).then(async (res) => {
      if (res) {
        wx.showToast({
          title: '申请已提交',
          duration: 2000,
    let role = wx.getStorageSync(app.config.userInfoKey).role
    if (role) {
      debugger
      if (role == 'Teacher') {
        // 申请教学资源
        let query = {
          topicIdOrRefCode: 'productDownLoad',
          type: 'applyForDownload',
          state: 'WaitAudit',
          cmsTypeRefCode: '',
          newDataListRequest: [],
          name: this.data.bookDetail.name, // name为申请的书本名称
          content: JSON.stringify([{
            name: this.data.bookDetail.name,
            id: this.data.bookDetail.id,
            // defaultSaleMethodId: bookData.value.defaultSaleMethodId,
            icon: this.data.bookDetail.icon
          }])
        }
        app.MG.ugc.newTopicMessage(query).then(async (res) => {
          if (res) {
            wx.showToast({
              title: '申请已提交',
              duration: 2000,
            })
          }
          await this.getApplyInfo(this.data.bookDetail.id)
        })
      } else {
        wx.showModal({
          title: '尊敬的用户,您好!',
          content: '请先进行教师认证!',
          complete: (res) => {
            if (res.cancel) {}
            if (res.confirm) {
              wx.navigateTo({
                url: '/packageDomain/pages/teacherCertification/index',
              })
            }
          }
        })
      }
      await this.getApplyInfo(this.data.bookDetail.id)
    })
    //   } else {
    //     ElMessageBox.confirm('请先进行教师认证!', '尊敬的用户,您好!', {
    //       confirmButtonText: '去认证',
    //       cancelButtonText: '取消',
    //       type: 'warning'
    //     })
    //       .then(() => {
    //         isShow.value = true
    //       })
    //       .catch(() => { })
    //   }
    // }
    }
  },
  // 教学资源下载前往PC提示Diialog
  closeTeachDownload() {
@@ -1058,10 +1062,27 @@
  },
  // 下载功能
  downloadTeach(e) {
    this.setData({
      isShowTeachDownload: true
    })
    console.log('zhuan', this.data.isShowTeachDownload);
    let role = JSON.parse(wx.getStorageSync(app.config.userInfoKey)).role
    if (role && role == 'Teacher') {
      this.setData({
        isShowTeachDownload: true
      })
    } else {
      wx.showModal({
        title: '尊敬的用户,您好!',
        content: '请先进行教师认证!',
        complete: (res) => {
          if (res.cancel) {
          }
          if (res.confirm) {
            wx.navigateTo({
              url: '/packageDomain/pages/teacherCertification/index',
            })
          }
        }
      })
    }
    //   const data = e.detail.value
    //   // const data
    //   // let role = userStore.userInfo ? userStore.userInfo.role : null
packageBookService/pages/bookServices/detail/index.wxss
@@ -385,4 +385,8 @@
  height: 100%;
  display: flex;
  align-items: center;
}
.suggest-component .t-input__placeholder {
  font-size: 28rpx !important;
}
packageBookService/pages/bookServices/examination/examination.js
@@ -1058,7 +1058,6 @@
          this.setData({
            collectList: JSON.parse(res[0].value)
          })
          // total.value = collectList.value.length
        } catch (error) {}
        if (this.data.collectList && this.data.collectList.length) {
          await this.getCollectDataList()
@@ -1087,12 +1086,6 @@
  // 获取收藏夹
  async getCollectDataList() {
    let questionArr = []
    // this.setData({
    //   cardList: [{
    //     catalogName: '收藏夹',
    //     infoList: []
    //   }]
    // })
    this.setData({
      cardList: [{
        catalogName: '单选题',
@@ -1116,142 +1109,139 @@
    let shortArr = [] // 简答
    let multipleChoiceArr = [] // 多选
    let completionArr = [] // 填空
    let query = {
      path: '*',
      cmsPath: this.data.rootCmsItemId,
      cmsType: '*',
      productId: this.data.bookId,
      queryType: '*',
      itemIds: this.data.collectList.map((item) => item + ''),
      itemFields: {
        Embedded_QuestionBank_Stem: [],
        Embedded_QuestionBank_AnalysisCon: [],
        Embedded_QuestionBank_Answer: [],
        Embedded_QuestionBank_Option: [],
        Embedded_QuestionBank_QuestionType: [],
        Embedded_QuestionBank_StemStyle: [],
        Embedded_QuestionBank_OptionStyle: [],
        Embedded_QuestionBank_KnowledgePoint: [],
        Embedded_QuestionBank_Difficulty: []
    for (let qindex = 0; qindex < this.data.collectList.length; qindex++) {
      const qitem = this.data.collectList[qindex];
      let query = {
        path: '*',
        cmsPath: this.data.rootCmsItemId,
        cmsType: '*',
        productId: this.data.bookId,
        queryType: '*',
        itemIds: qitem + '',
        itemFields: {
          Embedded_QuestionBank_Stem: [],
          Embedded_QuestionBank_AnalysisCon: [],
          Embedded_QuestionBank_Answer: [],
          Embedded_QuestionBank_Option: [],
          Embedded_QuestionBank_QuestionType: [],
          Embedded_QuestionBank_StemStyle: [],
          Embedded_QuestionBank_OptionStyle: [],
          Embedded_QuestionBank_KnowledgePoint: [],
          Embedded_QuestionBank_Difficulty: []
        }
      }
    }
    app.MG.store.getProductDetail(query).then((res) => {
      let questionArr = []
      res.datas.cmsDatas[0].datas.forEach((item, index) => {
        const questionObj = {
          number: index + 1, // 题号
          id: item.id,
          stem: item.Embedded_QuestionBank_QuestionType == 'completion' ?
            JSON.parse(item.Embedded_QuestionBank_Stem)
            .stemTxt.replaceAll('<vacancy>', ',input,')
            .split(',') : JSON.parse(item.Embedded_QuestionBank_Stem), // 题干
          answer: item.Embedded_QuestionBank_Answer, // 答案
          option: item.Embedded_QuestionBank_Option ?
            JSON.parse(item.Embedded_QuestionBank_Option) : '', // 选择题选项
          analysisCon: item.Embedded_QuestionBank_AnalysisCon, // 解析
          questionType: item.Embedded_QuestionBank_QuestionType, // 题型
          optionStyle: item.Embedded_QuestionBank_OptionStyle, // 选项显示类型
          stemStyle: item.Embedded_QuestionBank_StemStyle, // 题干显示类型
          difficulty: item.Embedded_QuestionBank_Difficulty ?
            4 - item.Embedded_QuestionBank_Difficulty : 0, // 难度等级
          userAnswer: item.Embedded_QuestionBank_QuestionType == 'completion' ||
            item.Embedded_QuestionBank_QuestionType == 'multipleChoice' ? [] : '',
          isSubmit: false, // 查看解析
          isRight: null, // 是否正确
          isComplete: false,
          isCollect: true
        }
        // 多选和填空答案肯为数组,要转换JSON格式
        if (
          questionObj.questionType == 'completion' ||
          questionObj.questionType == 'multipleChoice'
        ) {
          try {
            questionObj.answer = JSON.parse(questionObj.answer)
          } catch (error) {
            //
      await app.MG.store.getProductDetail(query).then((res) => {
        let questionArr = []
        res.datas.cmsDatas[0].datas.forEach((item, index) => {
          const questionObj = {
            number: index + 1, // 题号
            id: item.id,
            stem: item.Embedded_QuestionBank_QuestionType == 'completion' ?
              JSON.parse(item.Embedded_QuestionBank_Stem)
              .stemTxt.replaceAll('<vacancy>', ',input,')
              .split(',') : JSON.parse(item.Embedded_QuestionBank_Stem), // 题干
            answer: item.Embedded_QuestionBank_Answer, // 答案
            option: item.Embedded_QuestionBank_Option ?
              JSON.parse(item.Embedded_QuestionBank_Option) : '', // 选择题选项
            analysisCon: item.Embedded_QuestionBank_AnalysisCon, // 解析
            questionType: item.Embedded_QuestionBank_QuestionType, // 题型
            optionStyle: item.Embedded_QuestionBank_OptionStyle, // 选项显示类型
            stemStyle: item.Embedded_QuestionBank_StemStyle, // 题干显示类型
            difficulty: item.Embedded_QuestionBank_Difficulty ?
              4 - item.Embedded_QuestionBank_Difficulty : 0, // 难度等级
            userAnswer: item.Embedded_QuestionBank_QuestionType == 'completion' ||
              item.Embedded_QuestionBank_QuestionType == 'multipleChoice' ? [] : '',
            isSubmit: false, // 查看解析
            isRight: null, // 是否正确
            isComplete: false,
            isCollect: true
          }
        }
        // 填空题改造
        if (questionObj.questionType == 'completion') {
          let index = 0
          for (let i = 0; i < questionObj.stem.length; i++) {
            const item = questionObj.stem[i]
            if (item == 'input') {
              questionObj.stem[i] = {
                num: index,
                data: 'input'
              }
              questionObj.userAnswer[index] = ''
              index++
          // 多选和填空答案肯为数组,要转换JSON格式
          if (
            questionObj.questionType == 'completion' ||
            questionObj.questionType == 'multipleChoice'
          ) {
            try {
              questionObj.answer = JSON.parse(questionObj.answer)
            } catch (error) {
              //
            }
          }
        }
        // 获取图片
        if (questionObj.stemStyle == 'Image' || questionObj.stemStyle == 'TxtAndImage') {
          questionObj.stem.stemImage = getPublicImage(questionObj.stem.stemImage, 150)
        }
        if (questionObj.optionStyle == 'Image' || questionObj.optionStyle == 'TxtAndImage') {
          questionObj.option.forEach(optionItem => {
            if (optionItem.img) optionItem.img = getPublicImage(optionItem.img, 150)
          })
        }
        // 题干富文本处理
        if (questionObj.stemStyle == 'RichText') {
          // questionObj.option.txt = ''
          questionObj.stem.stemTxt = questionObj.stem.stemTxt.replace(/\<img/gi, '<img style="max-width: 300rpx !important;object-fit: contain;" class="stem-rich-img" ').replace(/\<p/gi, '<p class="stem-rich-p"')
          // 填空题改造
          if (questionObj.questionType == 'completion') {
            let index = 0
            for (let i = 0; i < questionObj.stem.length; i++) {
              const item = questionObj.stem[i]
              if (item == 'input') {
                questionObj.stem[i] = {
                  num: index,
                  data: 'input'
                }
                questionObj.userAnswer[index] = ''
                index++
              }
            }
          }
          // 获取图片
          if (questionObj.stemStyle == 'Image' || questionObj.stemStyle == 'TxtAndImage') {
            questionObj.stem.stemImage = getPublicImage(questionObj.stem.stemImage, 150)
          }
          if (questionObj.optionStyle == 'Image' || questionObj.optionStyle == 'TxtAndImage') {
            questionObj.option.forEach(optionItem => {
              if (optionItem.img) optionItem.img = getPublicImage(optionItem.img, 150)
            })
          }
          // 题干富文本处理
          if (questionObj.stemStyle == 'RichText') {
            // questionObj.option.txt = ''
            questionObj.stem.stemTxt = questionObj.stem.stemTxt.replace(/\<img/gi, '<img style="max-width: 300rpx !important;object-fit: contain;" class="stem-rich-img" ').replace(/\<p/gi, '<p class="stem-rich-p"')
        }
        // 选项富文本处理
        if (questionObj.optionStyle == 'RichText' && (questionObj.questionType == 'singleChoice' || questionObj.questionType == 'judge' || questionObj.questionType == 'multipleChoice')) {
          questionObj.option.forEach(item => {
            if (item.txt) item.txt = item.txt.replace(/\<img/gi, '<img class="option-rich-img"').replace(/\<p/gi, '<p class="stem-rich-p"')
          })
        }
        if (item.Embedded_QuestionBank_QuestionType == 'judge') {
          questionObj.type = '判断题'
          judgeArr.push(questionObj)
        } else if (item.Embedded_QuestionBank_QuestionType == 'singleChoice') {
          questionObj.type = '单选题'
          singleChoiceArr.push(questionObj)
        } else if (item.Embedded_QuestionBank_QuestionType == 'multipleChoice') {
          questionObj.type = '多选题'
          multipleChoiceArr.push(questionObj)
        } else if (item.Embedded_QuestionBank_QuestionType == 'completion') {
          questionObj.type = '填空题'
          completionArr.push(questionObj)
        } else if (item.Embedded_QuestionBank_QuestionType == 'shortAnswer') {
          questionObj.type = '简答题'
          shortArr.push(questionObj)
        }
        // questionArr.push(questionObj)
          }
          // 选项富文本处理
          if (questionObj.optionStyle == 'RichText' && (questionObj.questionType == 'singleChoice' || questionObj.questionType == 'judge' || questionObj.questionType == 'multipleChoice')) {
            questionObj.option.forEach(item => {
              if (item.txt) item.txt = item.txt.replace(/\<img/gi, '<img class="option-rich-img"').replace(/\<p/gi, '<p class="stem-rich-p"')
            })
          }
          if (item.Embedded_QuestionBank_QuestionType == 'judge') {
            questionObj.type = '判断题'
            judgeArr.push(questionObj)
          } else if (item.Embedded_QuestionBank_QuestionType == 'singleChoice') {
            questionObj.type = '单选题'
            singleChoiceArr.push(questionObj)
          } else if (item.Embedded_QuestionBank_QuestionType == 'multipleChoice') {
            questionObj.type = '多选题'
            multipleChoiceArr.push(questionObj)
          } else if (item.Embedded_QuestionBank_QuestionType == 'completion') {
            questionObj.type = '填空题'
            completionArr.push(questionObj)
          } else if (item.Embedded_QuestionBank_QuestionType == 'shortAnswer') {
            questionObj.type = '简答题'
            shortArr.push(questionObj)
          }
        })
      })
      // this.setData({
      //   questionDataList: questionArr,
      //   ['cardList[0].infoList']: questionArr,
      //   loading: false,
      // })
      this.setData({
        ['cardList[0].infoList']: singleChoiceArr,
        ['cardList[1].infoList']: judgeArr,
        ['cardList[2].infoList']: multipleChoiceArr,
        ['cardList[3].infoList']: completionArr,
        ['cardList[3].infoList']: shortArr,
      })
      const cardList = this.data.cardList
      for (let index = 0; index < cardList.length; index++) {
        const item = cardList[index];
        for (let cindex = 0; cindex < item.infoList.length; cindex++) {
          const citem = item.infoList[cindex]
          citem.number = cindex + 1
          questionArr.push(citem)
        }
    }
    this.setData({
      ['cardList[0].infoList']: singleChoiceArr,
      ['cardList[1].infoList']: judgeArr,
      ['cardList[2].infoList']: multipleChoiceArr,
      ['cardList[3].infoList']: completionArr,
      ['cardList[3].infoList']: shortArr,
    })
    const cardList = this.data.cardList
    for (let index = 0; index < cardList.length; index++) {
      const item = cardList[index];
      for (let cindex = 0; cindex < item.infoList.length; cindex++) {
        const citem = item.infoList[cindex]
        citem.number = cindex + 1
        questionArr.push(citem)
      }
      this.setData({
        questionDataList: questionArr,
        cardList: cardList,
        loading: false
      })
    }
    this.setData({
      questionDataList: questionArr,
      cardList: cardList,
      loading: false
    })
  },
  // 我的错题模式下获取错题id列表
packageBookService/pages/bookServices/examination/questionList/index.wxml
@@ -346,7 +346,7 @@
            >{{item.userAnswer}}</view
          >
        </view>
        <view class="short-answer-mr">
        <view class="short-answer-mr" style="margin-bottom: 50rpx">
          <text
            class="short-answer-fz;"
            style="color:{{isNight ? '#fff' : '#000'}};font-size:{{sliderValue || 28}}rpx;"
packageBookService/pages/bookServices/list/index.js
@@ -262,6 +262,15 @@
      },
    };
    app.MG.store.getStoreChannelList(query).then((res) => {
      if (!res.datas.length) {
        this.setData({
          disabledSecondList: true
        })
      } else {
        this.setData({
          disabledSecondList: false
        })
      }
      for (let index = 0; index < res.datas.length; index++) {
        const item = res.datas[index];
        options.push({
@@ -375,7 +384,6 @@
        BaseType: 'DateTime'
      }
    } else if (this.data.sortList.value == 'time-desc') {
      debugger
      sort = {
        PublicationDate: 'Desc',
        BaseType: 'DateTime'
@@ -438,16 +446,6 @@
        this.setData({
          noData: true,
        })
        if (!this.data.pathList.length) {
          // 未选择二级分类,且无图书
          this.setData({
            disabledSecondList: true
          })
        } else {
          this.setData({
            disabledSecondList: false
          })
        }
      }
      if (this.data.triggered) {
        this.setData({
@@ -465,6 +463,7 @@
      `${this.data.assortCheck.code}\\${e.detail.value}` :
      this.data.assortCheck.code;
    console.log(this.data.path);
    this.setData({
      pathList: [],
      stairCode: e.detail.value,
@@ -472,17 +471,15 @@
      path: path,
      'stairList.value': e.detail.value,
    });
    this.getBookList(path);
    this.getSecondList(path);
    if (e.detail.value == '') {
      this.setData({
        disabledSecondList: true
      })
      });
    } else {
      this.setData({
        disabledSecondList: false
      })
      this.getSecondList(path);
    }
    this.getBookList(path);
    console.log(this.data.disabledSecondList);
  },
  // 二级分类切换
packageBookService/pages/bookServices/list/index.wxml
@@ -32,7 +32,8 @@
            bindchange="onChangeStair"
          />
          <t-dropdown-item
            disabled="{{disabledSecondList}}"
            wx:if="{{disabledSecondList === false}}"
            disabled="{{false}}"
            label="二级"
            bind:open="openDropdown"
            bind:close="closeDropdown"