QYF-GitLab1
20 小时以前 cf7e71c6d0fb64eeb6b5deac540da843b4bb465c
src/views/classManage/index.vue
@@ -1,6 +1,5 @@
<template>
  <div class="layoutBox">
    <Header class="header"></Header>
  <div class="layoutBoxClass">
    <div class="layoutContentBox clear">
      <div class="classContentBox clear">
        <div class="leftList fl">
@@ -29,7 +28,7 @@
            >
              <span
                :style="{
                  fill: activeIndex == index ? '#fff' : '#000'
                  fill: activeIndex == index ? '#fff' : '#000',
                }"
                v-html="item.icon"
              >
@@ -52,9 +51,7 @@
<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()
@@ -92,26 +89,46 @@
  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 {
@@ -128,12 +145,12 @@
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
@@ -142,15 +159,15 @@
      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),
        },
      })
    }
  }
@@ -162,15 +179,21 @@
</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;
@@ -197,7 +220,7 @@
        margin-bottom: 10px;
        display: flex;
        .iconBox {
          width: 90px;
          width: 100px;
          height: 120px;
          img {
            width: 100%;
@@ -211,6 +234,7 @@
          .main {
            font-size: 16px;
            line-height: 20px;
            color: #019e58;
          }
          .job {
            // padding:10px;
@@ -250,7 +274,12 @@
        }
        .activeItem {
          background: linear-gradient(90deg, #019e58 0%, #144941 100%);
          background-size: 100% 100%;
          color: #fff;
          svg {
            fill: #fff;
          }
        }
      }
    }