{"version":3,"file":"index.4a5a2adc.mjs","sources":["../../../../pages/exam/index.vue"],"sourcesContent":["<template>\n  <NuxtLayout>\n    <div class=\"app_container w\">\n      <!-- 轮播广告 -->\n      <div class=\"adv\">\n\n      </div>\n      <!-- 分类 -->\n      <div class=\"category_list\" v-if=\"opts.categoryList.length\">\n        <div class=\"first_category\" v-for=\"(first, index) in opts.categoryList\" :key=\"index\">\n          <div class=\"title\">\n            <div class=\"first_category_name\">{{ first.categoryName }}</div>\n            <el-divider class=\"divider\"></el-divider>\n          </div>\n          <div class=\"second_category\">\n            <div v-for=\"(second, sIndex) in first.childrenList\" :key=\"sIndex\" class=\"category_name\" @click=\"toPaperList(second)\">{{ second.categoryName }}</div>\n          </div>\n        </div>\n      </div>\n    </div>\n  </NuxtLayout>\n\n</template>\n\n <script setup>\nimport { useUserStore } from \"../../stores/user\";\nimport { categoryLists } from \"../../api/system\";\nimport { computed, onMounted, watch } from \"vue\";\nimport cookie from \"@/utils/cookies\";\n\nconst route = useRoute();\nconst router = useRouter();\nlet cookieData = cookie.getShop()\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 store = useUserStore();\nconst opts = reactive({\n  errorNum: 0,\n  categoryList: [],\n});\nconst ctrl = reactive({\n  loading: false,\n});\n\nconst { data, pending, error } = await useAsyncData(\n  \"paperIndex\",\n  () => {\n    return new Promise(async (resolve) => {\n      Promise.allSettled([\n        categoryLists({}),\n      ]).then(\n        ([\n          categoryList,\n        ]) => {\n          let data = {};\n          if (categoryList.status === \"fulfilled\") {\n            data.categoryList = categoryList.value;\n          } else {\n            data.categoryList = [];\n          }\n          resolve(data);\n        }\n      );\n    });\n  },\n  { initialCache: false }\n);\nif (!pending.value && data.value) {\n  const d = data.value;\n  opts.categoryList = d.categoryList;\n  console.log(opts.categoryList)\n}\n\nconst toPaperList = (data) => {\n  router.push({\n    path: '/exam/list',\n    query: {\n      categoryId: data.id\n    }\n  })\n}\n\nonUnmounted(() => {\n});\n</script>\n\n<style lang=\"scss\" scoped>\n  .first_category .title {\n    display: flex;\n    align-items: center;\n    margin: 50px 0 24px;\n    .first_category_name {\n      font-size: 24px;\n      margin-right: 30px;\n      flex: 1 0 auto;\n    }\n    .divider {\n      margin: 0;\n    }\n  }\n  .second_category {\n    font-size: 16px;\n    margin-bottom: 20px;\n    display: flex;\n    flex-wrap: wrap;\n    .category_name {\n      height: 52px;\n      padding: 0 20px;\n      margin-right: 20px;\n      margin-bottom: 10px;\n      border: 1px solid transparent;\n      display: flex;\n      align-items: center;\n      box-sizing: border-box;\n      background: #fff;\n      border-radius: 26px;\n      box-shadow: 0 0 3px #eee;\n      color: #666;\n      cursor: pointer;\n      &:hover {\n        color: #3D7FFF;\n        border: 1px solid #3D7FFF;\n      }\n    }\n  }\n</style>\n"],"names":["useRoute","router","useRouter","cookieData","cookie","getShop","useHead","title","computed","shopName","meta","hid","name","content","useUserStore","opts","reactive","errorNum","categoryList","loading","data","pending","error","Promise","async","resolve","allSettled","categoryLists","then","status","value","initialCache","d","onUnmounted","push","path","query","categoryId","id"],"mappings":"seA8BAA,IACA,MAAAC,EAAAC,IACA,IAAAC,EAAAC,EAAAC,UACAC,EAAA,CACAC,MAAAC,GAAA,IAAA,QAAAL,EAAAM,aACAC,KAAA,CACA,CACAC,IAAA,WACAC,KAAA,WACAC,QAAA,QAEA,CACAF,IAAA,cACAC,KAAA,cACAC,QAAA,WAIAC,IACA,MAAAC,EAAAC,EAAA,CACAC,SAAA,EACAC,aAAA,KAEAF,EAAA,CACAG,SAAA,IAGA,MAAAC,KAAAA,EAAAC,QAAAA,EAAAC,MAAAA,mBACA,cACA,IACA,IAAAC,SAAAC,MAAAC,IACAF,QAAAG,WAAA,CACAC,EAAA,CAAA,KACAC,MACA,EACAV,MAEA,IAAAE,EAAA,CAAA,EACA,cAAAF,EAAAW,OACAT,EAAAF,aAAAA,EAAAY,MAEAV,EAAAF,aAAA,GAEAO,EAAAL,EAAA,GAEA,KAGA,CAAAW,cAAA,GACA,kCACA,IAAAV,EAAAS,OAAAV,EAAAU,MAAA,CACA,MAAAE,EAAAZ,EAAAU,MACAf,EAAAG,aAAAc,EAAAd,YAEA,QAWAe,GAAA,+YATAb,SACAnB,EAAAiC,KAAA,CACAC,KAAA,aACAC,MAAA,CACAC,WAAAjB,EAAAkB,MAJA,IAAAlB"}