Quellcode durchsuchen

Merge remote-tracking branch 'origin/dev' into iteration-temp-http

lex-xin vor 10 Monaten
Ursprung
Commit
ba85dfaf0e

+ 12 - 0
src/assets/normalize.css

@@ -39,6 +39,18 @@ p {
    margin: 0;
 }
 
+img {
+   user-select: none;
+   -webkit-user-select: none;
+   -moz-user-select: none;
+   -ms-user-select: none;
+   -webkit-touch-callout: none;
+   -webkit-user-drag: none;
+   -moz-user-drag: none;
+   -ms-user-drag: none;
+   user-drag: none;
+}
+
 /**
  * 1. Correct the line height in all browsers.
  * 2. Prevent adjustments of font size after orientation changes in

BIN
src/img/layout/fullscreen.png


BIN
src/img/layout/fullscreenClose.png


+ 36 - 0
src/libs/fullscreen.ts

@@ -0,0 +1,36 @@
+import screenfull from "screenfull"
+import { ref } from "vue"
+import { ElMessage } from "element-plus"
+
+export const isFullscreen = ref(false)
+/**
+ * 全屏
+ * @isScreenfull 为true的时候,是全屏的时候 不关闭
+ * @isErr 为false 不提示
+ */
+export const handleFullscreen = (isScreenfull = false, isErr = true) => {
+   if (!screenfull.isEnabled) {
+      isErr &&
+         ElMessage({
+            message: "当前浏览器不支持全屏!",
+            type: "warning"
+         })
+      return
+   }
+   if (isFullscreen.value && isScreenfull) {
+      return
+   }
+   screenfull.toggle()
+}
+
+screenfull.on("change", () => {
+   isFullscreen.value = screenfull.isFullscreen
+})
+
+// 禁用f11
+document.addEventListener("keydown", function (event) {
+   if (event.key === "F11") {
+      event.preventDefault()
+      handleFullscreen()
+   }
+})

+ 7 - 0
src/router/index.ts

@@ -56,6 +56,13 @@ router.beforeEach((to, from, next) => {
             })
       }
    } else {
+      // 如果有token,并且是登录页 直接返回首页
+      if (hasToken && to.path === "/login") {
+         next({
+            path: "/"
+         })
+         return
+      }
       if (authWhiteList.includes(to.path) || isRegWhite(regWhiteList, to.path)) {
          next()
       } else {

+ 10 - 4
src/views/cloudTextbooks/chooseDialog.vue

@@ -60,11 +60,17 @@ function close() {
 }
 
 function handlePaly(id: string) {
-   const url = router.resolve({
+   // const url = router.resolve({
+   //    name: "coursewarePlay",
+   //    params: { id }
+   // }).href
+   // window.open(url, "_blank")
+   router.push({
       name: "coursewarePlay",
-      params: { id }
-   }).href
-   window.open(url, "_blank")
+      params: {
+         id
+      }
+   })
 }
 </script>
 

+ 6 - 2
src/views/coursewarePlay/components/courseCollapse/courseCollapse.vue

@@ -21,7 +21,7 @@
             <template v-if="item.materialList">
                <div
                   class="courseList"
-                  :class="{ isActive: activeCollapse?.id === i.id }"
+                  :class="{ isActive: activeCollapse?.id === i.id && activeCollapse?.knowledgePointId === i.knowledgePointId }"
                   v-for="i in item.materialList"
                   :key="i.id"
                   @click="handleClick(i)"
@@ -33,7 +33,10 @@
                      </div>
                   </div>
                   <div class="iconArrow">
-                     <img v-if="activeCollapse?.id === i.id" src="@/img/coursewarePlay/icon-load.gif" />
+                     <img
+                        v-if="activeCollapse?.id === i.id && activeCollapse?.knowledgePointId === i.knowledgePointId"
+                        src="@/img/coursewarePlay/icon-load.gif"
+                     />
                   </div>
                </div>
             </template>
@@ -52,6 +55,7 @@ type materialListType = {
    type: string
    typeCode?: string
    name: string
+   knowledgePointId: string
 }
 type courseListType = {
    id: string

+ 19 - 11
src/views/coursewarePlay/coursewarePlay.vue

@@ -123,7 +123,7 @@ import { getLessonCourseDetail_gym, getLessonCoursewareDetail_gyt, getLessonCour
 import { checkWebCourse_gyt } from "@/api/coursewarePlay.api"
 import { httpAjaxErrMsg, httpAjaxLoadingErrMsg } from "@/plugin/httpAjax"
 import userStore from "@/store/modules/user"
-import { useRoute } from "vue-router"
+import { useRoute, useRouter } from "vue-router"
 import { shallowRef, ref, computed, onUnmounted, onMounted, watch, nextTick } from "vue"
 import { ElMessageBox } from "element-plus"
 import courseCollapse from "./components/courseCollapse"
@@ -133,8 +133,10 @@ import useDialogConfirm from "@/hooks/useDialogConfirm"
 import { getRecentCourseSchedule_gym } from "@/api/homePage.api"
 import { getToken } from "@/libs/auth"
 import { URL_TEACH_GYT, URL_TEACH_GYM, URL_TEACH_KLX } from "@/config"
+import { handleFullscreen } from "@/libs/fullscreen"
 
 const route = useRoute()
+const router = useRouter()
 const userStoreHook = userStore()
 // 批注
 const penShow = ref(false)
@@ -158,9 +160,11 @@ const songPlaySrc = computed<string>(() => {
    }
    //  GYM,GYT,KLX 区分   云教练
    const urlObj = {
-      GYT: `${URL_TEACH_GYT}?id=${activeCourseware.value?.content}&modelType=practice&modeType=json&Authorization=${getToken()}`,
-      GYM: `${URL_TEACH_GYM}?Authorization=${getToken()}&platform=web&liveConfig=1#/detail/${activeCourseware.value?.content}?isHideBack=true`,
-      KLX: `${URL_TEACH_KLX}??Authorization=${getToken()}&id=${activeCourseware.value?.content}&isHideBack=true&limitModel=practice`
+      GYT: `${URL_TEACH_GYT}?id=${activeCourseware.value?.content}&modelType=practice&modeType=json&Authorization=${getToken()}&isYjt=1`,
+      GYM: `${URL_TEACH_GYM}?Authorization=${getToken()}&platform=web&liveConfig=1#/detail/${
+         activeCourseware.value?.content
+      }?isHideBack=trueis&Yjt=1`,
+      KLX: `${URL_TEACH_KLX}??Authorization=${getToken()}&id=${activeCourseware.value?.content}&isHideBack=true&limitModel=practice&isYjt=1`
    }
    return urlObj[userStoreHook.roles!]
 })
@@ -228,7 +232,7 @@ function handlePointList(pointList: any[]) {
    // 如果url里面有materialId 代表指定资料播放
    if (route.query.materialId) {
       const index = flattenCoursewareListData.findIndex((item: any) => {
-         return route.query.materialId === item.id + ""
+         return route.query.materialId === item.id + "" && route.query.knowledgePointId === item.knowledgePointId + ""
       })
       index > -1 && (activeCoursewareIndex.value = index)
    }
@@ -265,7 +269,7 @@ function handleChangeCourseware(index: -1 | 1) {
 }
 function handleCourseClick(value: any) {
    activeCoursewareIndex.value = flattenCoursewareList.value.findIndex((item: any) => {
-      return value.id === item.id
+      return value.id === item.id && value.knowledgePointId === item.knowledgePointId
    })
 }
 /* 播放器相关 */
@@ -292,6 +296,9 @@ function handlePlayVideo({ src, name }: { src: string; name: string }) {
    })
    showController()
 }
+
+// 全屏显示
+handleFullscreen(true, false)
 /* 按键事件相关 */
 onMounted(() => {
    document.addEventListener("keydown", handleKeydown)
@@ -345,8 +352,9 @@ function hideController() {
 }
 /* 结束课程 */
 function handleGoBack() {
-   window.open("about:blank", "_self")
-   window.close()
+   // window.open("about:blank", "_self")
+   // window.close()
+   router.go(-1)
 }
 function handleCoursewareEnd() {
    if (route.query.modeId) {
@@ -398,9 +406,9 @@ const activeCoursewareResourceId = computed<string | undefined>(() => {
 function handleGoPracticeBtn(activeCoursewareResourceId: string) {
    //  GYM,GYT,KLX 区分   云教练
    const urlObj = {
-      GYT: `${URL_TEACH_GYT}?id=${activeCoursewareResourceId}&modelType=practice&modeType=json&Authorization=${getToken()}`,
-      GYM: `${URL_TEACH_GYM}?Authorization=${getToken()}&platform=web&liveConfig=1#/detail/${activeCoursewareResourceId}?isHideBack=true`,
-      KLX: `${URL_TEACH_KLX}??Authorization=${getToken()}&id=${activeCoursewareResourceId}&isHideBack=true&limitModel=practice`
+      GYT: `${URL_TEACH_GYT}?id=${activeCoursewareResourceId}&modelType=practice&modeType=json&Authorization=${getToken()}&isYjt=1`,
+      GYM: `${URL_TEACH_GYM}?Authorization=${getToken()}&platform=web&liveConfig=1#/detail/${activeCoursewareResourceId}?isYjt=1`,
+      KLX: `${URL_TEACH_KLX}??Authorization=${getToken()}&id=${activeCoursewareResourceId}&limitModel=practice&isYjt=1`
    }
    window.open(urlObj[userStoreHook.roles!], "_blank")
 }

+ 16 - 5
src/views/curriculum/curriculumDetail.vue

@@ -192,14 +192,25 @@ function handleSetUpCourseware(id: string) {
    })
 }
 function handleCourseClick(item: any) {
-   const url = router.resolve({
+   // const url = router.resolve({
+   //    name: "coursewarePlay",
+   //    params: { id: curriculumDetailData.value.id },
+   //    query: {
+   //       materialId: item.id,
+   //       knowledgePointId: item.knowledgePointId
+   //    }
+   // }).href
+   // window.open(url, "_blank")
+   router.push({
       name: "coursewarePlay",
-      params: { id: curriculumDetailData.value.id },
+      params: {
+         id: curriculumDetailData.value.id
+      },
       query: {
-         materialId: item.id
+         materialId: item.id,
+         knowledgePointId: item.knowledgePointId
       }
-   }).href
-   window.open(url, "_blank")
+   })
 }
 </script>
 

+ 13 - 4
src/views/curriculum/hooks/useStartClass.ts

@@ -120,12 +120,21 @@ export function handleStartClass_gyt(id: string) {
 }
 
 function handlePaly(coursewareDetailId: string, coursewareId: string) {
-   const url = router.resolve({
+   // const url = router.resolve({
+   //    name: "coursewarePlay",
+   //    params: { id: coursewareDetailId },
+   //    query: {
+   //       modeId: coursewareId
+   //    }
+   // }).href
+   // window.open(url, "_blank")
+   router.push({
       name: "coursewarePlay",
-      params: { id: coursewareDetailId },
+      params: {
+         id: coursewareDetailId
+      },
       query: {
          modeId: coursewareId
       }
-   }).href
-   window.open(url, "_blank")
+   })
 }

+ 21 - 3
src/viewsframe/layout/layout.vue

@@ -32,6 +32,15 @@
                </div>
             </template>
          </el-dropdown>
+         <img
+            @click="
+               () => {
+                  handleFullscreen()
+               }
+            "
+            class="fullscreen"
+            :src="isFullscreen ? require('@/img/layout/fullscreenClose.png') : require('@/img/layout/fullscreen.png')"
+         />
       </div>
       <RouterView />
    </div>
@@ -39,9 +48,9 @@
 
 <script setup lang="ts">
 import userStore from "@/store/modules/user"
-import { computed } from "vue"
-import { ref } from "vue"
+import { computed, ref } from "vue"
 import { ElMessage } from "element-plus"
+import { isFullscreen, handleFullscreen } from "@/libs/fullscreen"
 
 const userStoreHook = userStore()
 
@@ -73,7 +82,7 @@ function handleLogout() {
       padding-top: 26px;
       padding-right: 54px;
       display: flex;
-      flex-direction: row-reverse;
+      justify-content: flex-end;
       .avatar-con {
          cursor: pointer;
          padding-left: 30px;
@@ -120,6 +129,15 @@ function handleLogout() {
             }
          }
       }
+      .fullscreen {
+         margin-left: 17px;
+         width: 45px;
+         height: 45px;
+         cursor: pointer;
+         &:active {
+            opacity: $opacity-hover;
+         }
+      }
    }
 }
 .dropdown {

+ 1 - 1
yarn.lock

@@ -5960,7 +5960,7 @@ schema-utils@^4.0.0:
 
 screenfull@^6.0.2:
   version "6.0.2"
-  resolved "https://registry.npmjs.org/screenfull/-/screenfull-6.0.2.tgz"
+  resolved "https://registry.npmmirror.com/screenfull/-/screenfull-6.0.2.tgz#3dbe4b8c4f8f49fb8e33caa8f69d0bca730ab238"
   integrity sha512-AQdy8s4WhNvUZ6P8F6PB21tSPIYKniic+Ogx0AacBMjKP1GUHN2E9URxQHtCusiwxudnCKkdy4GrHXPPJSkCCw==
 
 seemly@^0.3.6, seemly@^0.3.8: