闫增涛
2024-07-01 d0940596d5f35ef96a5818ee315f86454c3d0ab1
src/views/examination/index.vue
@@ -663,11 +663,6 @@
}
// 获取收藏夹
const getCollectDataList = async () => {
  if (!examination.collectList.length) {
    examination.loading = false
    examination.noData = true
    return false
  }
  // 开始请求
  let oldData = null
  let oldList = []
@@ -897,9 +892,7 @@
  for (let index = 0; index < jsonCollectList.length; index++) {
    const item = jsonCollectList[index]
    if (item.type && item.type == 'material') {
      examination.cardList.push(item)
    } else if (item.questionType == 'singleChoice') {
  if (item.questionType == 'singleChoice') {
      examination.cardList[0].infoList.push(item)
    } else if (item.questionType == 'judge') {
      examination.cardList[1].infoList.push(item)
@@ -909,6 +902,8 @@
      examination.cardList[3].infoList.push(item)
    } else if (item.questionType == 'shortAnswer') {
      examination.cardList[4].infoList.push(item)
    } else if (item.type && item.type == 'material') {
      examination.cardList[examination.cardList.length] = item
    }
  }
  examination.cardList = examination.cardList.filter((item) => item.infoList.length > 0)
@@ -935,6 +930,7 @@
        examination.cardList = (await getErrorDataList()) as any
        await getJsonError()
      } else {
        examination.noData = true
        examination.loading = false
        ElMessageBox.confirm('错题集暂无数据!', '提示', {
          confirmButtonText: '确定',
@@ -953,12 +949,6 @@
}
// 获取错题集
const getErrorDataList = async () => {
  if (!examination.errorList.length) {
    examination.loading = false
    examination.noData = true
    return false
  }
  // 开始请求
  let oldData = null
  let oldList:any = []
  let cardList = [
@@ -1187,9 +1177,7 @@
  for (let index = 0; index < jsonCollectList.length; index++) {
    const item = jsonCollectList[index]
    if (item.type && item.type == 'material') {
      examination.cardList.push(item)
    } else if (item.questionType == 'singleChoice') {
    if (item.questionType == 'singleChoice') {
      examination.cardList[0].infoList.push(item)
    } else if (item.questionType == 'judge') {
      examination.cardList[1].infoList.push(item)
@@ -1199,6 +1187,8 @@
      examination.cardList[3].infoList.push(item)
    } else if (item.questionType == 'shortAnswer') {
      examination.cardList[4].infoList.push(item)
    } else if (item.type && item.type == 'material') {
      examination.cardList[examination.cardList.length] = item
    }
  }
  examination.cardList = examination.cardList.filter((item) => item.infoList.length > 0)
@@ -1426,7 +1416,7 @@
      ]
    })
    .then((res:any) => {
      console.log('错题已保存', examination.allError)
      console.log('错题已清空')
    })
}
defineExpose({ handleExaminationDialog })