{"version":3,"file":"result.7f4faf0c.mjs","sources":["../../../../pages/practice/result.vue"],"sourcesContent":["<template>\n  <NuxtLayout>\n    <div :style=\"{minHeight:minHeight}\" class=\"exam_result\">\n      <div class=\"exam_result_box\" v-if=\"map.info.id\">\n        <template v-if=\"map.info.practiceType === 3\">\n          <img v-if=\"map.result.pathFindingType\" alt=\"\" src=\"@/assets/images/exam/icon_success.png\"/>\n          <img v-else alt=\"\" src=\"@/assets/images/exam/icon_wrong.svg\"/>\n          <p class=\"font20 mgb10\">{{ map.result.pathFindingType ? '恭喜你！闯关成功' : '很遗憾！闯关失败' }}</p>\n        </template>\n        <template v-else>\n          <p class=\"font14 mgb10 c_red\">\n            <span class=\"score\">{{\n                typeof map.result.accuracy === 'string' ? map.result.accuracy.replace('%', '') : parseFloat(map.result.accuracy * 100).toFixed(2)\n              }}</span>%答题正确率\n          </p>\n          <p class=\"font20 mgb10\" v-if=\"typeof map.result.accuracy === 'string'\">\n            {{ parseFloat(map.result.accuracy).toFixed(2) > 60 ? '哇哦，你真厉害' : '别灰心~继续努力' }}</p>\n          <p class=\"font20 mgb10\" v-else>\n            {{ parseFloat(map.result.accuracy * 100).toFixed(2) > 60 ? '哇哦，你真厉害' : '别灰心~继续努力' }}</p>\n        </template>\n        <div class=\"box_practice\">\n          <div v-if=\"map.info.practiceType === 3\" class=\"box_counts_item\">\n            <div class=\"box_item_content\">{{\n                typeof map.result.accuracy === 'string' ? map.result.accuracy.replace('%', '') : parseFloat(map.result.accuracy * 100).toFixed(2)\n              }}%\n            </div>\n            <div class=\"box_item_title\">答题正确率</div>\n          </div>\n          <div class=\"box_counts_item\">\n            <div class=\"box_item_content\">\n              {{ formatDuring((map.result.practiceTime || map.result.userPracticeTimeInterval) * 1000) }}\n            </div>\n            <div class=\"box_item_title\">练习用时</div>\n          </div>\n          <div class=\"box_counts_item\">\n            <div class=\"box_item_content\">{{ map.result.correctCount || '0' }}</div>\n            <div class=\"box_item_title\">正确题数</div>\n          </div>\n          <div class=\"box_counts_item\">\n            <div class=\"box_item_content\">{{ map.result.errorCount || '0' }}</div>\n            <div class=\"box_item_title\">错误题数</div>\n          </div>\n        </div>\n        <div class=\"box_btn_list\">\n          <template v-if=\"map.info.practiceType === 3\">\n            <el-button plain @click=\"handleBack\">返回</el-button>\n            <template v-if=\"map.result.pathFindingType\">\n              <el-button plain @click=\"handReplace\">再来一次</el-button>\n              <el-button type=\"primary\" @click=\"handleViewAnalysis\">查看答卷</el-button>\n              <el-button v-if=\"!isLastChild\" type=\"primary\" @click=\"handleNext\">继续闯关</el-button>\n            </template>\n            <template v-else>\n              <el-button :disabled=\"!map.result.isAgainEnter\" type=\"primary\" @click=\"handReplace\">再来一次</el-button>\n            </template>\n          </template>\n          <template v-else>\n            <el-button plain @click=\"handleBack\">返回</el-button>\n            <el-button plain @click=\"handReplace\">再做一次</el-button>\n            <el-button v-if=\"!isLastChild\" plain @click=\"handleNext\">练习下一节</el-button>\n            <el-button type=\"primary\" @click=\"handleViewAnalysis\">查看答卷</el-button>\n          </template>\n        </div>\n      </div>\n      <paper-redo-tip v-model=\"ctrl.redoCtr.visible\" @callback=\"handleCallback\"  @close=\"ctrl.redoCtr.visible = false\"></paper-redo-tip>\n    </div>\n  </NuxtLayout>\n</template>\n\n<script setup>\nimport {getStore, setStore} from \"~/utils/storage\";\nimport {formatDuring} from \"~/utils/index\";\nimport {practiceDataAuthView, practiceDataView, practiceRedo, practiceRemoveTitleRecord} from \"~/api/paper\";\nimport {useLayoutStore} from '@/stores/layout';\nimport {nextTick} from \"vue\";\nimport {ElMessage} from \"element-plus\";\nimport cookie from \"@/utils/cookies\";\nimport {useUserStore} from \"@/stores/user\";\n\nconst store = useUserStore()\nconst {getToken} = store\nconst route = useRoute();\nconst router = useRouter();\nconst layoutStore = useLayoutStore();\nconst footerType = computed(() => layoutStore.footerType);\nconst footerLayoutEunm = ref({\n  1: (66 + 150) + 'px',\n  2: (66 + 180) + 'px',\n  3: (66 + 260) + 'px',\n});\n\nconst minHeight = computed(() => {\n  return `calc(100vh - ${footerLayoutEunm.value[footerType.value]}`\n})\nconst map = reactive({\n  info: {},\n  result: {},\n  titleId: ''\n});\nconst ctrl = reactive({\n  loading: false,\n  redoCtr: {\n    visible: false,\n    data: {},\n    parents: {}\n  }\n});\nlet cookieData = cookie.getShop()\n\nuseHead({\n  title: computed(() => `练习结果-${cookieData.shopName}`),\n  meta: [\n    {\n    hid: 'keywords',\n    name: 'keywords',\n    content: '练习结果'\n    },\n    {\n      hid: 'description',\n      name: 'description',\n      content: '练习结果'\n    }\n  ]\n})\nconst token = computed(() => {\n  return getToken()\n})\nconst {data, pending} = await useAsyncData('practiceResult', () => {\n  return new Promise(async (resolve) => {\n    let method = practiceDataView\n    if(token.value) {\n      method = practiceDataAuthView\n    }\n    Promise.allSettled([\n      method(route.query.id),\n    ]).then(([info]) => {\n      let data = {};\n      if (info.status === 'fulfilled') {\n        data.info = info\n      } else {\n        data.info = {}\n      }\n      resolve(data)\n    })\n  })\n}, {initialCache: false})\nif (!pending.value && data.value) {\n  map.info = data.value.info.value\n  map.result = JSON.parse(getStore('practiceResult'))\n  map.titleId = route.query.titleId || ''\n}\nconst isLastChild = computed(() => {\n  if (map.info.practiceType === 2 || map.info.practiceType === 3) {\n    const list = map.info.practiceTitleInfoList\n    const idx = list.map(i => i.id).indexOf(map.titleId)\n    if (idx === list.length - 1) {\n      return true\n    } else {\n      return false\n    }\n  } else {\n    return true\n  }\n})\nconst handleBack = () => {\n  router.go(-1);\n};\nconst getNextObj = (list, id) => {\n  let obj = {}\n  list.forEach((el, index) => {\n    if (el.id === id && list[index + 1]) {\n      obj = list[index + 1]\n    }\n  })\n  return obj\n}\nconst handleNext = () => {\n  let nextObj = getNextObj(map.info.practiceTitleInfoList, map.titleId)\n  if (!nextObj) {\n    ElMessage.error(map.info.practiceType === 2 ? '暂无下一节' : '暂无下一关')\n    return\n  }\n  const d = {\n    courseId: map.info.id,\n    practiceType: +map.info.practiceType + 1,\n    titleId: nextObj.id,\n    titleName: nextObj.titleName\n  }\n  setStore('practiceInfo', map.info)\n  router.replace({\n    path: '/practice/daily',\n    query: d\n  })\n}\nconst handleViewAnalysis = () => {\n  router.push({\n    path: '/practice/analysis',\n    query: {\n      practiceId: map.info.id,\n      practiceRecordType: +map.info.practiceType + 1,\n      practiceTitleId: map.titleId\n    }\n  })\n}\nconst handleCallback = (bool) => { //章节练习重做提示弹窗回调\n  const {data, parents} = ctrl.redoCtr\n  if (bool) { // 重做\n    //practiceCheckStatus({practiceId:parents.id,practiceType:2,practiceTitleId:data.id}).then(async (res)=> {\n    //  if(res) {\n    setStore('practiceInfo', map.info)\n    practiceRemoveTitleRecord({questionTitleId: data.id})\n    router.replace({\n      path: '/practice/daily',\n      query: {\n        practiceType: 3,\n        courseId: parents.id,\n        titleId: data.id,\n        titleName: data.titleName\n      }\n    })\n    //  }\n    //})\n  } else { //看解析\n    router.push({\n      path: '/practice/analysis',\n      query: {\n        practiceId: parents.id,\n        practiceRecordType: 3,\n        practiceTitleId: data.id\n      }\n    })\n  }\n}\nconst handReplace = async () => {\n  const d = {\n    courseId: map.info.id,\n    practiceType: +map.info.practiceType + 1\n  }\n  if (map.info.practiceType === 2) {\n    const data = map.info.practiceTitleInfoList.find(i => {\n      return i.id === map.titleId\n    })\n    ctrl.redoCtr.data = {...data}\n    ctrl.redoCtr.parents.id = map.info.id\n    ctrl.redoCtr.visible = true\n    return\n  }\n  if (map.info.practiceType === 1) {\n    await practiceRedo({practiceId: map.info.id})\n  }\n  if (map.info.practiceType === 3) {\n    if (map.result.resurgenceNum === 0 && !map.result.pathFindingType) {\n      ElMessage.error('该关卡已无复活机会！')\n      return false\n    }\n    d.titleId = map.result.titleId\n    map.info.practiceTitleInfoList.forEach(i => {\n      if(i.id === d.titleId) {\n        d.titleName = i.titleName\n      }\n    })\n  }\n  router.replace({\n    path: '/practice/daily',\n    query: d\n  })\n}\n</script>\n\n<style lang=\"scss\" scoped>\n.exam_result_box {\n  width: 650px;\n  margin: auto;\n  background: #ffffff;\n  border-radius: 6px;\n  padding: 30px 50px;\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  position: relative;\n\n  img {\n    width: 60px;\n    height: 60px;\n    margin-bottom: 17px;\n  }\n\n  .score {\n    color: #f61818;\n    font-style: normal;\n    font-weight: 400;\n    font-size: 60px;\n  }\n\n  .tip {\n    font-style: normal;\n    font-weight: 400;\n    font-size: 14px;\n    color: #F2994A;\n  }\n}\n\n.status {\n  position: absolute;\n  right: 5px;\n  top: 0;\n}\n\n.pass {\n  color: #58b85c;\n}\n\n.unpass {\n  color: #f61818;\n}\n\n.wait {\n  color: #ff9d00;\n}\n\n.exam_result {\n  width: 100%;\n  height: 100%;\n  background: url(\"~/assets/images/rusult.png\") no-repeat;\n  background-size: cover;\n  display: flex;\n  justify-content: center;\n  align-items: center;\n  padding-top: 20px;\n  padding-bottom: 20px;\n}\n\n.c_red {\n  color: #F61818;\n}\n\n.box_practice {\n  margin-top: 35px;\n  background: rgba(242, 243, 245, 0.5);\n  border-radius: 5px;\n  display: flex;\n  flex-wrap: wrap;\n  width: 422px;\n  padding: 64px 20px;\n}\n\n.box_counts_item {\n  flex: 1;\n  display: flex;\n  flex-direction: column;\n  width: calc((510px - 16px - 16px - 16px) / 4);\n  height: 48px;\n  justify-content: center;\n  align-items: center;\n}\n\n.box_counts_item + .box_counts_item {\n  margin-left: 16px;\n}\n\n.box_counts_item:nth-child(-n+4) {\n  margin-bottom: 20px;\n}\n\n.box_counts_item:nth-child(5) {\n  margin-left: 0;\n}\n\n.box_item_content {\n  font-style: normal;\n  font-weight: 400;\n  font-size: 18px;\n  color: #333333;\n}\n\n.box_item_title {\n  font-style: normal;\n  font-weight: 400;\n  font-size: 14px;\n  color: #999999;\n}\n\n.box_btn_list {\n  margin-top: 20px;\n  width: 422px;\n\n  .el-button {\n    width: 100%;\n    height: 42px;\n    font-size: 14px;\n  }\n\n  .el-button + .el-button {\n    margin-left: 0;\n    margin-top: 15px;\n  }\n}\n</style>\n"],"names":["store","useUserStore","getToken","route","useRoute","router","useRouter","layoutStore","useLayoutStore","footerType","computed","footerLayoutEunm","ref","minHeight","value","map","reactive","info","result","titleId","ctrl","loading","redoCtr","visible","data","parents","cookieData","cookie","getShop","useHead","title","shopName","meta","hid","name","content","token","pending","__temp","__restore","_withAsyncContext","useAsyncData","Promise","async","resolve","method","practiceDataView","practiceDataAuthView","allSettled","query","id","then","status","initialCache","JSON","parse","getStore","isLastChild","practiceType","list","practiceTitleInfoList","i","indexOf","length","handleBack","go","handleNext","nextObj","obj","forEach","el","index","getNextObj","ElMessage","error","d","courseId","titleName","setStore","replace","path","handleViewAnalysis","push","practiceId","practiceRecordType","practiceTitleId","handleCallback","bool","practiceRemoveTitleRecord","questionTitleId","handReplace","find","practiceRedo","resurgenceNum","pathFindingType"],"mappings":"wxCA8EA,MAAAA,EAAAC,KACAC,SAAAA,GAAAF,EACAG,EAAAC,IACAC,EAAAC,IACAC,GAAAC,IACAC,GAAAC,GAAA,IAAAH,GAAAE,aACAE,GAAAC,EAAA,CACA,EAAA,QACA,EAAA,QACA,EAAA,UAGAC,GAAAH,GAAA,IACA,gBAAAC,GAAAG,MAAAL,GAAAK,WAEAC,GAAAC,EAAA,CACAC,KAAA,CAAA,EACAC,OAAA,CAAA,EACAC,QAAA,KAEAC,GAAAJ,EAAA,CACAK,SAAA,EACAC,QAAA,CACAC,SAAA,EACAC,KAAA,CAAA,EACAC,QAAA,CAAA,KAGA,IAAAC,GAAAC,EAAAC,UAEAC,EAAA,CACAC,MAAApB,GAAA,IAAA,QAAAgB,GAAAK,aACAC,KAAA,CACA,CACAC,IAAA,WACAC,KAAA,WACAC,QAAA,QAEA,CACAF,IAAA,cACAC,KAAA,cACAC,QAAA,WAIA,MAAAC,GAAA1B,GAAA,IACAR,OAEAsB,KAAAA,GAAAa,QAAAA,MAA8BC,EAAAC,GAAAC,GAAA,IAAAC,EAAA,kBAAA,IAC9B,IAAAC,SAAAC,MAAAC,IACA,IAAAC,EAA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