index.ts 1.2 KB

123456789101112131415161718192021222324252627
  1. import { reactive } from "vue"
  2. import router from "@/router"
  3. /** 维护其他系统过来的特殊字段 这里用来记录,以免其他系统传过来的参数混乱 不好维护 */
  4. export type queryParamsType = {
  5. hideFullScreen: boolean
  6. fromType: "PLATFORM" | "TEACHER" | "CLASS"
  7. instrumentId: string
  8. lessonCoursewareKnowledgeId: string
  9. }
  10. const queryParams = reactive<queryParamsType>({
  11. hideFullScreen: false, // 隐藏预览时候的全屏按钮
  12. fromType: "TEACHER", // 用于区分老师端 平台,或者学生端
  13. lessonCoursewareKnowledgeId: "", // 课件id 老师端带过来查相关课件
  14. instrumentId: "" // 传过来的乐器值,用于ppt里面云教练带什么乐器
  15. })
  16. export function initQueryParams() {
  17. const query = router.currentRoute.value.query
  18. queryParams.hideFullScreen = !!query.hideFullScreen
  19. query.fromType && (queryParams.fromType = query.fromType as any)
  20. query.lessonCoursewareKnowledgeId && (queryParams.lessonCoursewareKnowledgeId = query.lessonCoursewareKnowledgeId as any)
  21. query.instrumentId && (queryParams.instrumentId = query.instrumentId as any)
  22. console.log(queryParams, "携带参数")
  23. }
  24. export default queryParams