{"version":3,"file":"emigrated.b51d73c2.mjs","sources":["../../../../pages/paper/emigrated.vue"],"sourcesContent":["<template>\n  <NuxtLayout>\n    <div class=\"app_container emigrated_content\">\n      <div v-if=\"map.info.id\" class=\"emigrated_info\">\n        <div class=\"emigrated_header\">\n          <div class=\"emigrated_info_content\">\n          <div class=\"emigrated_nav\">\n            <el-breadcrumb :separator-icon=\"ArrowRight\">\n              <el-breadcrumb-item :to=\"{ path: '/' }\"><span class=\"emigrated_nav_title\">首页</span></el-breadcrumb-item>\n              <el-breadcrumb-item><span class=\"emigrated_nav_title pointer\" @click=\"handleBack\">试卷中心</span>\n              </el-breadcrumb-item>\n              <el-breadcrumb-item>\n                <div class=\"emigrated_nav_title tx-ov\">{{ map.info.practiceName }}</div>\n              </el-breadcrumb-item>\n            </el-breadcrumb>\n          </div>\n            <div class=\"emigrated_header_box\">\n              <div class=\"header_box_left\">\n                <div class=\"practice_name\">{{ map.info.practiceName }}</div>\n                <div class=\"box_msg_list\">\n                  <div class=\"box_msg_item\">关卡数：共{{map.info.practiceTitleInfoList.length}}关</div>\n                  <div class=\"box_msg_item\">每关卡限时：{{map.info.levelLimit}}分钟</div><br>\n                  <div class=\"box_msg_item\">闯关成功标准：{{map.info.passPercentage}}%正确率</div>\n                  <div class=\"box_msg_item\">每关卡复活机会：{{map.info.resurgenceNum === -1?'不限':'共'+map.info.resurgenceNum+'次'}}</div>\n                  <div class=\"box_msg_item\">排行说明：闯关次数最多，用时最短排在最前面</div>\n                </div>\n              </div>\n              <div class=\"header_box_right\">\n                <el-button v-if=\"map.info.userPracticeStatus === 1\" type=\"primary\" @click=\"handleLearn(map.info.practiceTitleInfoList[0], 0)\">开始闯关</el-button>\n                <el-button v-if=\"map.info.userPracticeStatus === 2\" type=\"success\" @click=\"handleLearn('')\">继续闯关</el-button>\n                <el-button v-if=\"map.info.userPracticeStatus === 3\" disabled>闯关完成</el-button>\n                <el-button type=\"text\" class=\"mgt10\" @click=\"handleOpenRank()\"><img class=\"mgr6\" src=\"@/assets/paper/rank.svg\"/>排行榜</el-button>\n              </div>\n            </div>\n            <div class=\"table_list\">\n              <div class=\"table_item\" @click=\"handleLearn(item, index)\" v-for=\"(item,index) in map.info.practiceTitleInfoList\" :key=\"index\">\n                <div class=\"table_item_top\" :class=\"getClass(map.info.practiceTitleInfoList,index,item)\"></div>\n                <div class=\"table_item_title\">{{item.titleName}}</div>\n                <div class=\"table_item_msg\">{{item.passUserCount}}人已闯关成功</div>\n              </div>\n            </div>\n          </div>\n        </div>\n      </div>\n      <emigrated-rank :practice-id=\"map.practiceId\" v-model=\"ctrl.rankCtr\" @close=\"ctrl.rankCtr = false\"></emigrated-rank>\n    </div>\n  </NuxtLayout>\n</template>\n\n<script setup>\nimport {ArrowRight} from '@element-plus/icons-vue'\nimport {onMounted, reactive} from \"vue\";\nimport {useUserStore} from \"../../stores/user\";\nimport {getStore, setStore} from \"../../utils/storage\";\nimport {practiceAuthView, practiceView} from \"../../api/paper\";\nimport EmigratedRank from '../../components/exam/emigratedRank.vue'\nimport {ElMessage} from 'element-plus'\nimport cookie from \"@/utils/cookies\";\n\nconst router = useRouter()\nconst route = useRoute()\nconst store = useUserStore()\nconst map = reactive({\n  info:{},\n  categoryId:'',\n  practiceType:4,\n  practiceId:'',\n  categoryName:''\n})\nconst ctrl = reactive({\n  rankCtr: false\n})\nconst getClass = (list,index,item) => {\n  let cls = []\n  if(item.practiceStatus === 1){\n    cls.push('success')\n  }else if(list[index] !== 1 && index === 0 || (list[index - 1] && list[index - 1].practiceStatus === 1)){\n    cls.push('go')\n  } else if(item.practiceStatus === 2 && index !== 0 || (item.practiceStatus === 2 && list[index - 1] && list[index - 1].practiceStatus !== 2)){\n    cls.push('lock')\n  }\n  return cls\n}\nconst token = computed(()=>store.token)\nconst handleClose = () => {\n  ctrl.rankCtr = false\n}\nconst handleOpenRank = () => {\n  ctrl.rankCtr = true\n}\nconst handleBack = () => {\n  router.go(-1)\n}\nconst handleLearn = (data, index) => {\n  if(token.value){\n    if(!data){\n      data = null\n      map.info.practiceTitleInfoList.forEach((el,i)=>{\n        if(el.practiceStatus === 1){\n          if(!data && map.info.practiceTitleInfoList[i+1]){\n            data = map.info.practiceTitleInfoList[i+1]\n            index = i + 1\n          }\n        }\n      })\n      if(!data){\n        data = map.info.practiceTitleInfoList[0]\n        index = 0\n      }\n    }\n    const statuArr = getClass(map.info.practiceTitleInfoList, index, data)\n    if(statuArr[statuArr.length - 1] === 'lock') {\n      return false\n    }\n    if(map.info.resurgenceNum > -1 && data.resurgenceNum === 0 && data.practiceStatus > 1) { //practiceStatus用户练习状态：1已做，2未做\n      ElMessage.error(data.titleName + '已无复活机会！')\n      return false\n    }\n   setStore('practiceTitleInfoList',map.info.practiceTitleInfoList)\n    setStore('practiceInfo', data)\n    router.push({\n      path: '/practice/daily',\n      query: {\n        practiceType: map.practiceType,\n        courseId: map.practiceId,\n        titleId:data.id,\n        titleName:data.titleName,\n      }\n    })\n  }else{\n    router.push({\n      path: '/login',\n      query: {\n        redirect: encodeURIComponent(route.fullPath)\n      }\n    })\n  }\n}\nlet cookieData = cookie.getShop()\n\nconst getInfo = () => {\nif(token.value){\n  practiceAuthView({id:map.practiceId}).then(res=>{\n    map.info = res\n    useHead({\n      title: map.info.practiceName + '-' + cookieData.shopName\n    });\n  })\n}else{\n  router.push({\n    path: '/login',\n    query: {\n      redirect: encodeURIComponent(route.fullPath)\n    }\n  })\n}\n}\nonMounted(()=>{\n  map.categoryId = route.query.categoryId\n  map.categoryName = decodeURIComponent(route.query.categoryName)\n  map.practiceType = +route.query.practiceType\n  map.practiceId = route.query.practiceId\n  getInfo()\n})\n</script>\n\n<style scoped lang=\"scss\">\n.emigrated_info{}\n.emigrated_info_content{\n  padding: 20px calc((100vw - 1200px) / 2);\n}\n.emigrated_nav {\n  margin-bottom: 20px;\n}\n\n.emigrated_nav_title {\n  color: #999999;\n  font-weight: 400;\n  max-width: 115px;\n}\n.emigrated_header_box{\n  margin-bottom: 20px;\n  padding: 30px;\n  background-color: #FFFFFF;\n  display: flex;\n  justify-content: space-between;\n  align-items: center;\n  .practice_name{\n    font-family: 'Microsoft YaHei';\n    font-style: normal;\n    font-weight: 400;\n    font-size: 22px;\n    line-height: 29px;\n    color: #333333;\n    margin-bottom: 34px;\n  }\n  .box_msg_list{\n    display: flex;\n    align-items: center;\n    flex-direction: row;\n    flex-wrap: wrap;\n  }\n  .box_msg_item{\n    font-style: normal;\n    font-weight: 400;\n    font-size: 14px;\n    color: #666666;\n    margin-right: 50px;\n    margin-bottom: 24px;\n  }\n  .header_box_right{\n    padding:0 53px;\n    display: flex;\n    place-items: center;\n    flex-direction: column;\n  }\n  .header_box_right .el-button{\n    width: 154px;\n    height: 42px;\n    border-radius: 5px;\n  }\n}\n.table_list{\n  padding: 42px 30px;\n  background-color: #FFFFFF;\n  display: flex;\n  flex-direction: row;\n  flex-wrap: wrap;\n  .table_item{\n    display: flex;\n    align-items: center;\n    flex-direction: column;\n    margin-bottom: 32px;\n    cursor: pointer;\n  }\n  .table_item:has(.lock){\n    cursor: none;\n  }\n  .table_item+.table_item{\n    margin-left: 60px;\n  }\n  .table_item:nth-child(7n+1){\n    margin-left: 0;\n  }\n  .table_item_top{\n    width: 100px;\n    height: 100px;\n    background-image: url(\"~/assets/paper/emigrated_bg.png\");\n    background-size: contain;\n    position: relative;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n  }\n  .lock {\n    cursor: not-allowed;\n  }\n  .table_item_top.lock:before{\n    content: '';\n    position: absolute;\n    width: 44px;\n    height: 44px;\n    background-image: url(\"~/assets/paper/lock.png\");\n    background-size: 100% 100%;\n  }\n  .table_item_top.go:before{\n    content: '';\n    position: absolute;\n    width: 44px;\n    height: 44px;\n    background-image: url(\"~/assets/paper/go.png\");\n    background-size: 100% 100%;\n  }\n  .table_item_top.success:before{\n    content: '';\n    position: absolute;\n    width: 100px;\n    height: 100px;\n    left: 0;\n    top: 0;\n    background: #FFFFFF;\n    opacity: 0.7;\n    z-index: 1;\n  }\n  .table_item_top.success:after{\n    content: '';\n    position: absolute;\n    width: 44px;\n    height: 44px;\n    background-image: url(\"../../assets/paper/success.png\");\n    background-size: 100% 100%;\n    z-index: 2;\n  }\n  .table_item_title{\n    margin-top: 16px;\n    font-style: normal;\n    font-weight: 400;\n    font-size: 16px;\n    color: #333333;\n  }\n  .table_item_msg{\n    font-style: normal;\n    font-weight: 400;\n    font-size: 14px;\n    color: #999999;\n    margin-top: 4px;\n  }\n}\n</style>\n"],"names":["router","useRouter","route","useRoute","store","useUserStore","map","reactive","info","categoryId","practiceType","practiceId","categoryName","ctrl","rankCtr","getClass","list","index","item","cls","practiceStatus","push","token","computed","handleBack","go","handleLearn","data","value","practiceTitleInfoList","forEach","el","i","statuArr","length","resurgenceNum","ElMessage","error","titleName","setStore","path","query","courseId","titleId","id","redirect","encodeURIComponent","fullPath","cookieData","cookie","getShop","onMounted","decodeURIComponent","practiceAuthView","then","res","useHead","title","practiceName","shopName"],"mappings":"isCA2DA,MAAAA,EAAAC,IACAC,EAAAC,IACAC,EAAAC,IACAC,EAAAC,EAAA,CACAC,KAAA,CAAA,EACAC,WAAA,GACAC,aAAA,EACAC,WAAA,GACAC,aAAA,KAEAC,EAAAN,EAAA,CACAO,SAAA,IAEAC,GAAA,CAAAC,EAAAC,EAAAC,KACA,IAAAC,EAAA,GAQA,OAPA,IAAAD,EAAAE,eACAD,EAAAE,KAAA,WACA,IAAAL,EAAAC,IAAA,IAAAA,GAAAD,EAAAC,EAAA,IAAA,IAAAD,EAAAC,EAAA,GAAAG,eACAD,EAAAE,KAAA,OACA,IAAAH,EAAAE,gBAAA,IAAAH,GAAA,IAAAC,EAAAE,gBAAAJ,EAAAC,EAAA,IAAA,IAAAD,EAAAC,EAAA,GAAAG,iBACAD,EAAAE,KAAA,QAEAF,CAAA,EAEAG,GAAAC,GAAA,IAAAnB,EAAAkB,QAOAE,GAAA,KACAxB,EAAAyB,IAAA,EAAA,EAEAC,GAAA,CAAAC,EAAAV,KACA,GAAAK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