skyblued 2 yıl önce
ebeveyn
işleme
e90d5282c9

+ 0 - 1
src/teacher/screen-projection/index.tsx

@@ -61,7 +61,6 @@ export default defineComponent({
     return () => (
       <div>
         <OHeader
-          isBack
           rightText="投屏帮助"
           onClickRight={() => {
             console.log('打开投屏')

+ 18 - 6
src/views/courseList/index.tsx

@@ -4,7 +4,7 @@ import { Button, Empty, Grid, GridItem, Icon, showToast } from 'vant'
 import { defineComponent, onMounted, reactive } from 'vue'
 import styles from './index.module.less'
 import { useRoute, useRouter } from 'vue-router'
-import { postMessage } from '@/helpers/native-message'
+import { postMessage,promisefiyPostMessage } from '@/helpers/native-message'
 import iconLook from './image/look.svg'
 import iconCourse from './image/icon-course.png'
 export default defineComponent({
@@ -49,7 +49,9 @@ export default defineComponent({
       getList()
     })
 
-    const handleClick = (item: any) => {
+    const handleClick = async (item: any) => {
+      const isCache = await checkCache(item)
+      if (!isCache) return
       if (route.query.code === 'select') {
         console.log('选择课时')
         setCoursewareDetail(item)
@@ -62,6 +64,19 @@ export default defineComponent({
         }
       })
     }
+    // 检查课时是否有缓存
+    const checkCache = async (item: any) => {
+      const res = await promisefiyPostMessage({
+        api: 'checkCoursewareCache',
+        content: {
+          lessonCoursewareDetailId: item.lessonCoursewareDetailId,
+          finish: true,
+          rate: 0.2
+        }
+      })
+      console.log(res)
+      return false
+    }
     // 绑定课时
     const setCoursewareDetail = async (item: any) => {
       try {
@@ -86,10 +101,7 @@ export default defineComponent({
           {data.list.map((item: any) => {
             return (
               <GridItem>
-                <div
-                  class={styles.gridItem}
-                  onClick={() => handleClick(item)}
-                >
+                <div class={styles.gridItem} onClick={() => handleClick(item)}>
                   <img src={iconCourse} class={styles.cover} />
                   <div class={styles.title}>
                     <div>{item.coursewareDetailName}</div>

+ 22 - 0
src/views/coursewarePlay/image/icon-down.svg

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+    <title>切片</title>
+    <defs>
+        <path d="M12.619886,7.97254617 L12.7071068,8.05025253 L16.2426407,11.5857864 C16.633165,11.9763107 16.633165,12.6094757 16.2426407,13 C15.880011,13.3626297 15.3081656,13.3885318 14.9156479,13.0777064 L14.8284271,13 L12.9994661,11.1713593 L13,19 C13,19.5522847 12.5522847,20 12,20 C11.4477153,20 11,19.5522847 11,19 L10.9994661,11.1703593 L9.17157288,13 C8.80894318,13.3626297 8.23709778,13.3885318 7.84458013,13.0777064 L7.75735931,13 C7.39472961,12.6373703 7.36882749,12.0655249 7.67965295,11.6730073 L7.75735931,11.5857864 L11.2928932,8.05025253 C11.6555229,7.68762283 12.2273683,7.66172071 12.619886,7.97254617 Z M18.363961,5.63603897 C21.8786797,9.15075759 21.8786797,14.8492424 18.363961,18.363961 C17.9734367,18.7544853 17.3402718,18.7544853 16.9497475,18.363961 C16.5592232,17.9734367 16.5592232,17.3402718 16.9497475,16.9497475 C19.6834175,14.2160774 19.6834175,9.78392257 16.9497475,7.05025253 C14.2160774,4.31658249 9.78392257,4.31658249 7.05025253,7.05025253 C4.31658249,9.78392257 4.31658249,14.2160774 7.05025253,16.9497475 C7.44077682,17.3402718 7.44077682,17.9734367 7.05025253,18.363961 C6.65972824,18.7544853 6.02656326,18.7544853 5.63603897,18.363961 C2.12132034,14.8492424 2.12132034,9.15075759 5.63603897,5.63603897 C9.15075759,2.12132034 14.8492424,2.12132034 18.363961,5.63603897 Z" id="path-1"></path>
+        <filter x="-33.3%" y="-35.3%" width="166.7%" height="170.6%" filterUnits="objectBoundingBox" id="filter-2">
+            <feOffset dx="0" dy="0" in="SourceAlpha" result="shadowOffsetOuter1"></feOffset>
+            <feGaussianBlur stdDeviation="2" in="shadowOffsetOuter1" result="shadowBlurOuter1"></feGaussianBlur>
+            <feColorMatrix values="0 0 0 0 0   0 0 0 0 0   0 0 0 0 0  0 0 0 0.15 0" type="matrix" in="shadowBlurOuter1"></feColorMatrix>
+        </filter>
+    </defs>
+    <g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+        <g id="课件播放/全屏(伴学端)" transform="translate(-90.000000, -227.000000)" fill-rule="nonzero">
+            <g id="编组-8备份" transform="translate(82.000000, 68.000000)">
+                <g id="形状结合" transform="translate(20.000000, 171.000000) rotate(-180.000000) translate(-20.000000, -171.000000) translate(8.000000, 159.000000)">
+                    <use fill="black" fill-opacity="1" filter="url(#filter-2)" xlink:href="#path-1"></use>
+                    <use fill="#FFFFFF" xlink:href="#path-1"></use>
+                </g>
+            </g>
+        </g>
+    </g>
+</svg>

+ 22 - 0
src/views/coursewarePlay/image/icon-up.svg

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+    <title>切片</title>
+    <defs>
+        <path d="M12.619886,7.97254617 L12.7071068,8.05025253 L16.2426407,11.5857864 C16.633165,11.9763107 16.633165,12.6094757 16.2426407,13 C15.880011,13.3626297 15.3081656,13.3885318 14.9156479,13.0777064 L14.8284271,13 L12.9994661,11.1713593 L13,19 C13,19.5522847 12.5522847,20 12,20 C11.4477153,20 11,19.5522847 11,19 L10.9994661,11.1703593 L9.17157288,13 C8.80894318,13.3626297 8.23709778,13.3885318 7.84458013,13.0777064 L7.75735931,13 C7.39472961,12.6373703 7.36882749,12.0655249 7.67965295,11.6730073 L7.75735931,11.5857864 L11.2928932,8.05025253 C11.6555229,7.68762283 12.2273683,7.66172071 12.619886,7.97254617 Z M18.363961,5.63603897 C21.8786797,9.15075759 21.8786797,14.8492424 18.363961,18.363961 C17.9734367,18.7544853 17.3402718,18.7544853 16.9497475,18.363961 C16.5592232,17.9734367 16.5592232,17.3402718 16.9497475,16.9497475 C19.6834175,14.2160774 19.6834175,9.78392257 16.9497475,7.05025253 C14.2160774,4.31658249 9.78392257,4.31658249 7.05025253,7.05025253 C4.31658249,9.78392257 4.31658249,14.2160774 7.05025253,16.9497475 C7.44077682,17.3402718 7.44077682,17.9734367 7.05025253,18.363961 C6.65972824,18.7544853 6.02656326,18.7544853 5.63603897,18.363961 C2.12132034,14.8492424 2.12132034,9.15075759 5.63603897,5.63603897 C9.15075759,2.12132034 14.8492424,2.12132034 18.363961,5.63603897 Z" id="path-1"></path>
+        <filter x="-33.3%" y="-35.3%" width="166.7%" height="170.6%" filterUnits="objectBoundingBox" id="filter-2">
+            <feOffset dx="0" dy="0" in="SourceAlpha" result="shadowOffsetOuter1"></feOffset>
+            <feGaussianBlur stdDeviation="2" in="shadowOffsetOuter1" result="shadowBlurOuter1"></feGaussianBlur>
+            <feColorMatrix values="0 0 0 0 0   0 0 0 0 0   0 0 0 0 0  0 0 0 0.15 0" type="matrix" in="shadowBlurOuter1"></feColorMatrix>
+        </filter>
+    </defs>
+    <g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+        <g id="课件播放/全屏(伴学端)" transform="translate(-90.000000, -82.000000)" fill-rule="nonzero">
+            <g id="编组-8备份" transform="translate(82.000000, 68.000000)">
+                <g id="形状结合" transform="translate(8.000000, 14.000000)">
+                    <use fill="black" fill-opacity="1" filter="url(#filter-2)" xlink:href="#path-1"></use>
+                    <use fill="#FFFFFF" xlink:href="#path-1"></use>
+                </g>
+            </g>
+        </g>
+    </g>
+</svg>

+ 46 - 21
src/views/coursewarePlay/index.tsx

@@ -28,7 +28,7 @@ import 'plyr/dist/plyr.css'
 import request from '@/helpers/request'
 import { state } from '@/state'
 import { useRoute } from 'vue-router'
-import { listenerMessage, postMessage } from '@/helpers/native-message'
+import { listenerMessage, postMessage, promisefiyPostMessage } from '@/helpers/native-message'
 import MusicScore from './component/musicScore'
 import iconMenu from './image/icon-menu.svg'
 import iconDian from './image/icon-dian.svg'
@@ -37,8 +37,10 @@ import iconLoop from './image/icon-loop.svg'
 import iconLoopActive from './image/icon-loop-active.svg'
 import iconplay from './image/icon-play.svg'
 import iconpause from './image/icon-pause.svg'
+import iconUp from './image/icon-up.svg'
+import iconDown from './image/icon-down.svg'
 import Points from './component/points'
-import { getSecondRPM } from '@/helpers/utils'
+import { browser, getSecondRPM } from '@/helpers/utils'
 import { useRect } from '@vant/use'
 
 export default defineComponent({
@@ -87,19 +89,46 @@ export default defineComponent({
       timer: null as any,
       item: null as any
     })
-    watch(() => activeData.model, () => {
-      const videoItem = data.itemList.find(n => n.id === popupData.itemActive)
-      // 阴影切换的时候,具体去切换某个视频的控件
-      if (videoItem && videoItem.type === 'VIDEO'){
-        videoItem.playModel = activeData.model
+    watch(
+      () => activeData.model,
+      () => {
+        const videoItem = data.itemList.find((n) => n.id === popupData.itemActive)
+        // 阴影切换的时候,具体去切换某个视频的控件
+        if (videoItem && videoItem.type === 'VIDEO') {
+          videoItem.playModel = activeData.model
+        }
       }
-    })
-    const getItemList = () => {
+    )
+    // 获取缓存路径
+    const getCacheFilePath = async (material: any) => {
+      const res = await promisefiyPostMessage({
+        api: 'getCourseFilePath',
+        content: {
+          url: material.content,
+          localPath: '',
+          materialId: material.id,
+          updateTime: material.updateTime,
+          type: material.type // SONG VIDEO IMAGE
+        }
+      })
+      console.log('缓存路径返回', res)
+      return res
+    }
+    const getItemList = async () => {
       const list: any = []
+      const browserInfo = browser()
       for (let i = 0; i < data.knowledgePointList.length; i++) {
         const item = data.knowledgePointList[i]
         for (let j = 0; j < item.materialList.length; j++) {
           const material = item.materialList[j]
+          if (browserInfo.isApp && material.type === 'VIDEO'){
+            const localData = await getCacheFilePath(material)
+            if (localData?.content?.localPath){
+              material.url = material.content
+              material.content = localData.content.localPath
+              console.log("🚀 ~ material", material)
+            }
+          }
           if (popupData.itemActive === '') {
             popupData.tabName = item.name
             popupData.tabActive = material.knowledgePointId
@@ -126,7 +155,7 @@ export default defineComponent({
           })
         }
       }
-      // console.log('🚀 ~ list', list)
+      console.log('🚀 ~ list', list)
       data.itemList = list
     }
     const getDetail = async () => {
@@ -304,6 +333,8 @@ export default defineComponent({
                     {m.type === 'VIDEO' ? (
                       <>
                         <video
+                          playsinline="false"
+                          webkitPlaysinline="false"
                           preload="auto"
                           class="player"
                           data-vid={m.id}
@@ -311,7 +342,7 @@ export default defineComponent({
                           loop={m.loop}
                           onLoadedmetadata={(e: Event) => {
                             const videoEle = e.target as unknown as HTMLVideoElement
-                            videoEle.currentTime = 0.5
+                            // videoEle.currentTime = 0.5
                             m.currentTime = videoEle.currentTime
                             m.duration = videoEle.duration
                             m.videoEle = videoEle
@@ -462,18 +493,12 @@ export default defineComponent({
           {activeData.model && (
             <div class={styles.leftFixedBtns}>
               <div class={[styles.fullBtn, styles.prePoint]} onClick={() => handlePreAndNext('up')}>
-                <span style={{ textAlign: 'center' }}>
-                  上一
-                  <br />
-                  知识点
-                </span>
+                <img src={iconUp} />
+                <span style={{ textAlign: 'center' }}>上一个</span>
               </div>
               <div class={styles.fullBtn} onClick={() => handlePreAndNext('down')}>
-                <span style={{ textAlign: 'center' }}>
-                  下一
-                  <br />
-                  知识点
-                </span>
+                <span style={{ textAlign: 'center' }}>下一个</span>
+                <img src={iconDown} />
               </div>
             </div>
           )}