| | |
| | | <template> |
| | | <div class="layoutBox"> |
| | | <Header class="header"></Header> |
| | | <div class="layoutBoxClass"> |
| | | <div class="layoutContentBox clear"> |
| | | <div class="classContentBox clear"> |
| | | <div class="leftList fl"> |
| | |
| | | > |
| | | <span |
| | | :style="{ |
| | | fill: activeIndex == index ? '#fff' : '#000' |
| | | fill: activeIndex == index ? '#fff' : '#000', |
| | | }" |
| | | v-html="item.icon" |
| | | > |
| | |
| | | <script setup lang="ts"> |
| | | import { ref, watch, provide, onMounted, inject } from 'vue' |
| | | import { useRoute, useRouter, onBeforeRouteUpdate } from 'vue-router' |
| | | import Header from './components/headerPage.vue' |
| | | import { menu } from './config' |
| | | import { getPublicImage } from '@/assets/js/middleGround/tool.js' |
| | | import defaultImg from '@/assets/images/default-book-img.png' |
| | | |
| | | const router: any = useRouter() |
| | |
| | | path.value = to.path |
| | | }) |
| | | |
| | | onMounted(() => { |
| | | // 获取教材详情 |
| | | const getBookDetail = async (id: string) => { |
| | | const query = { |
| | | path: '*', |
| | | queryType: '*', |
| | | productId: id, |
| | | coverSize: { |
| | | height: 300, |
| | | width: 210, |
| | | }, |
| | | fields: { |
| | | author: [], |
| | | isbn: [], |
| | | }, |
| | | } |
| | | const res = await MG.store.getProductDetail(query) |
| | | return res.datas ?? null |
| | | } |
| | | |
| | | onMounted(async () => { |
| | | classInfo.value = JSON.parse(route.query.classInfo) |
| | | classIcon.value = classInfo.value.icon ? getPublicImage(classInfo.value.icon, 200) : defaultImg |
| | | const detail = await getBookDetail(classInfo.value.bookId) |
| | | classIcon.value = detail.icon ?? defaultImg |
| | | menu.forEach((item) => { |
| | | if ('/' + item.path === path.value) { |
| | | label.value = item.label |
| | | } |
| | | }) |
| | | const userCache: any = localStorage.getItem('jesk-userInfo') |
| | | const userCache: any = localStorage.getItem(config.userInfoKey) |
| | | const userInfo = JSON.parse(userCache) |
| | | userData.value = userInfo |
| | | if (!userInfo) { |
| | | router.push({ |
| | | path: '/' |
| | | path: '/', |
| | | }) |
| | | return false |
| | | } |
| | | if (userInfo.role != 'Teacher') { |
| | | const data: any = menu.filter( |
| | | (item: any) => item.path != 'studentManage' && item.path != 'jobAnalysis' |
| | | (item: any) => item.path != 'studentManage' && item.path != 'jobAnalysis', |
| | | ) |
| | | listMenu.value = data |
| | | } else { |
| | |
| | | |
| | | const goRouter = (item: any, index: number) => { |
| | | activeIndex.value = index |
| | | if (!localStorage.getItem('jsek-token') || localStorage.getItem('jsek-token') == null) { |
| | | if (!localStorage.getItem(config.tokenKey) || localStorage.getItem(config.tokenKey) == null) { |
| | | router.push({ |
| | | path: '/home', |
| | | query: { |
| | | showLogin: '1' |
| | | } |
| | | showLogin: '1', |
| | | }, |
| | | }) |
| | | } else { |
| | | label.value = item.label |
| | |
| | | router.push({ |
| | | path: userData.value.role != 'Teacher' ? '/studentJob' : '/jobManage', |
| | | query: { |
| | | classInfo: JSON.stringify(classInfo.value) |
| | | } |
| | | classInfo: JSON.stringify(classInfo.value), |
| | | }, |
| | | }) |
| | | } else { |
| | | router.push({ |
| | | path: item.path, |
| | | query: { |
| | | classInfo: JSON.stringify(classInfo.value) |
| | | } |
| | | classInfo: JSON.stringify(classInfo.value), |
| | | }, |
| | | }) |
| | | } |
| | | } |
| | |
| | | </script> |
| | | |
| | | <style lang="less" scoped> |
| | | .layoutBox { |
| | | .layoutBoxClass { |
| | | width: 100%; |
| | | height: 100vh; |
| | | display: flex; |
| | | flex-direction: column; |
| | | background-color: #fff; |
| | | .mainbg { |
| | | background: #019e58; |
| | | color: #fff; |
| | | } |
| | | .layoutContentBox { |
| | | flex: 1; |
| | | height: auto; |
| | | } |
| | | .main { |
| | | color: #019e58; |
| | | } |
| | | .classContentBox { |
| | | padding: 10px 40px; |
| | |
| | | margin-bottom: 10px; |
| | | display: flex; |
| | | .iconBox { |
| | | width: 90px; |
| | | width: 100px; |
| | | height: 120px; |
| | | img { |
| | | width: 100%; |
| | |
| | | .main { |
| | | font-size: 16px; |
| | | line-height: 20px; |
| | | color: #019e58; |
| | | } |
| | | .job { |
| | | // padding:10px; |
| | |
| | | } |
| | | |
| | | .activeItem { |
| | | background: linear-gradient(90deg, #019e58 0%, #144941 100%); |
| | | background-size: 100% 100%; |
| | | color: #fff; |
| | | svg { |
| | | fill: #fff; |
| | | } |
| | | } |
| | | } |
| | | } |