|
|
|
@ -6,8 +6,9 @@
|
|
|
|
* @FilePath: \vue3\src\layout\components\AppMain.vue
|
|
|
|
* @FilePath: \vue3\src\layout\components\AppMain.vue
|
|
|
|
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
|
|
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
|
|
-->
|
|
|
|
-->
|
|
|
|
<template>
|
|
|
|
<template>
|
|
|
|
<section :class="mainClass">
|
|
|
|
<section :class="mainClass">
|
|
|
|
|
|
|
|
<div v-if="isDemo" class="student-demo-banner">演示模式:{{ demoClassName }}<button @click="exitDemo">退出演示</button></div>
|
|
|
|
<router-view v-slot="{ Component, route }">
|
|
|
|
<router-view v-slot="{ Component, route }">
|
|
|
|
<keep-alive :include="tagsViewStore.cachedViews">
|
|
|
|
<keep-alive :include="tagsViewStore.cachedViews">
|
|
|
|
<component v-if="!route.meta.link" :is="Component" :key="route.path" />
|
|
|
|
<component v-if="!route.meta.link" :is="Component" :key="route.path" />
|
|
|
|
@ -23,12 +24,16 @@ import { dynamicRoutes } from "@/router";
|
|
|
|
import iframeToggle from "./IframeToggle/index";
|
|
|
|
import iframeToggle from "./IframeToggle/index";
|
|
|
|
import useTagsViewStore from "@/store/modules/tagsView";
|
|
|
|
import useTagsViewStore from "@/store/modules/tagsView";
|
|
|
|
import { getUserInfo } from "@/utils/auth";
|
|
|
|
import { getUserInfo } from "@/utils/auth";
|
|
|
|
import useUserStore from "@/store/modules/user";
|
|
|
|
import useUserStore from "@/store/modules/user";
|
|
|
|
|
|
|
|
import { clearStudentDemoSession, getStudentDemoSession, isStudentDemo } from "@/utils/studentDemo";
|
|
|
|
const userStore = useUserStore();
|
|
|
|
const userStore = useUserStore();
|
|
|
|
const tagsViewStore = useTagsViewStore();
|
|
|
|
const tagsViewStore = useTagsViewStore();
|
|
|
|
const route = useRoute();
|
|
|
|
const route = useRoute();
|
|
|
|
const router = useRouter();
|
|
|
|
const router = useRouter();
|
|
|
|
const role = ref(JSON.parse(getUserInfo()).roleId);
|
|
|
|
const role = ref(JSON.parse(getUserInfo()).roleId);
|
|
|
|
|
|
|
|
const isDemo = computed(() => isStudentDemo());
|
|
|
|
|
|
|
|
const demoClassName = computed(() => getStudentDemoSession()?.userInfo?.className || "教学班");
|
|
|
|
|
|
|
|
function exitDemo() { clearStudentDemoSession(); window.location.replace("/student-demo"); }
|
|
|
|
const mainClass = computed(() => {
|
|
|
|
const mainClass = computed(() => {
|
|
|
|
if (Number(role.value) === 4) return "app-main";
|
|
|
|
if (Number(role.value) === 4) return "app-main";
|
|
|
|
if (Number(role.value) === 3) return "teacher-main";
|
|
|
|
if (Number(role.value) === 3) return "teacher-main";
|
|
|
|
@ -81,6 +86,7 @@ function useTimeRecorder() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const { start, end, reset } = useTimeRecorder();
|
|
|
|
const { start, end, reset } = useTimeRecorder();
|
|
|
|
const getCurrentTeachingClassId = async () => {
|
|
|
|
const getCurrentTeachingClassId = async () => {
|
|
|
|
|
|
|
|
if (isDemo.value) return getStudentDemoSession()?.userInfo?.demoTeachingClassId || "";
|
|
|
|
const cachedClassId = proxy.$cache.session.get("currentTeachingClassId");
|
|
|
|
const cachedClassId = proxy.$cache.session.get("currentTeachingClassId");
|
|
|
|
if (cachedClassId) return cachedClassId;
|
|
|
|
if (cachedClassId) return cachedClassId;
|
|
|
|
const res = await indexApi.getCurrentTeachingClass({ userId: userStore.userInfo.userId });
|
|
|
|
const res = await indexApi.getCurrentTeachingClass({ userId: userStore.userInfo.userId });
|
|
|
|
@ -91,6 +97,7 @@ const getCurrentTeachingClassId = async () => {
|
|
|
|
return classId;
|
|
|
|
return classId;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
router.beforeEach(async (to, from, next) => {
|
|
|
|
router.beforeEach(async (to, from, next) => {
|
|
|
|
|
|
|
|
if (isDemo.value) { next(); return; }
|
|
|
|
const disabledTitles = proxy.$cache.session.getJSON("disabledTitles");
|
|
|
|
const disabledTitles = proxy.$cache.session.getJSON("disabledTitles");
|
|
|
|
const routess = Array.isArray(disabledTitles) ? disabledTitles : [];
|
|
|
|
const routess = Array.isArray(disabledTitles) ? disabledTitles : [];
|
|
|
|
// 获取当前和上一个模块
|
|
|
|
// 获取当前和上一个模块
|
|
|
|
@ -149,6 +156,7 @@ router.beforeEach(async (to, from, next) => {
|
|
|
|
background: url("@/assets/images/背景.webp") no-repeat;
|
|
|
|
background: url("@/assets/images/背景.webp") no-repeat;
|
|
|
|
background-size: 100% 100%;
|
|
|
|
background-size: 100% 100%;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.student-demo-banner{position:sticky;top:0;z-index:30;display:flex;justify-content:space-between;padding:8px 18px;color:#fff;background:#b45309}.student-demo-banner button{border:0;border-radius:4px;padding:3px 10px;cursor:pointer}
|
|
|
|
.app-main2 {
|
|
|
|
.app-main2 {
|
|
|
|
min-height: calc(100vh - 50px);
|
|
|
|
min-height: calc(100vh - 50px);
|
|
|
|
width: 100%;
|
|
|
|
width: 100%;
|
|
|
|
|