|  | @@ -23,7 +23,7 @@ import qs from 'query-string'
 | 
	
		
			
				|  |  |  import MusicScore from './component/musicScore'
 | 
	
		
			
				|  |  |  // import iconDian from './image/icon-dian.svg'
 | 
	
		
			
				|  |  |  // import iconPoint from './image/icon-point.svg'
 | 
	
		
			
				|  |  | -import { iconUp, iconDown, iconPen, iconTouping, iconMenu, iconCourseType, iconSearch } from './image/icons.json'
 | 
	
		
			
				|  |  | +import { iconUp, iconDown, iconTouping, iconMenu, iconCourseType, iconSearch } from './image/icons.json'
 | 
	
		
			
				|  |  |  import Points from './component/points'
 | 
	
		
			
				|  |  |  import { browser } from '@/helpers/utils'
 | 
	
		
			
				|  |  |  import { Vue3Lottie } from 'vue3-lottie'
 | 
	
	
		
			
				|  | @@ -34,8 +34,8 @@ import PlayRecordTime from './playRecordTime'
 | 
	
		
			
				|  |  |  import { handleCheckVip } from '../hook/useFee'
 | 
	
		
			
				|  |  |  import OGuide from '@/components/o-guide'
 | 
	
		
			
				|  |  |  import Tool, { ToolItem, ToolType } from './component/tool'
 | 
	
		
			
				|  |  | -import Pen from './component/tools/pen'
 | 
	
		
			
				|  |  | -import VideoItem from './component/video-item'
 | 
	
		
			
				|  |  | +// import Pen from './component/tools/pen'
 | 
	
		
			
				|  |  | +// import VideoItem from './component/video-item'
 | 
	
		
			
				|  |  |  import deepClone from '@/helpers/deep-clone'
 | 
	
		
			
				|  |  |  import VideoPlay from './component/video-play'
 | 
	
		
			
				|  |  |  import CoursewareType from './component/courseware-type'
 | 
	
	
		
			
				|  | @@ -48,6 +48,7 @@ export default defineComponent({
 | 
	
		
			
				|  |  |    name: 'CoursewarePlay',
 | 
	
		
			
				|  |  |    setup() {
 | 
	
		
			
				|  |  |      const pageVisibility = usePageVisibility()
 | 
	
		
			
				|  |  | +    const browserInfo = browser()
 | 
	
		
			
				|  |  |      const { isOnline } = useNetwork()
 | 
	
		
			
				|  |  |      /** 页面显示和隐藏 */
 | 
	
		
			
				|  |  |      watch(
 | 
	
	
		
			
				|  | @@ -76,17 +77,17 @@ export default defineComponent({
 | 
	
		
			
				|  |  |      const parentContainer = reactive({
 | 
	
		
			
				|  |  |        width: '100vw'
 | 
	
		
			
				|  |  |      })
 | 
	
		
			
				|  |  | -    const setContainer = () => {
 | 
	
		
			
				|  |  | -      const min = Math.min(screen.width, screen.height)
 | 
	
		
			
				|  |  | -      const max = Math.max(screen.width, screen.height)
 | 
	
		
			
				|  |  | -      const width = min * (16 / 9)
 | 
	
		
			
				|  |  | -      if (width > max) {
 | 
	
		
			
				|  |  | -        parentContainer.width = '100vw'
 | 
	
		
			
				|  |  | -        return
 | 
	
		
			
				|  |  | -      } else {
 | 
	
		
			
				|  |  | -        parentContainer.width = width + 'px'
 | 
	
		
			
				|  |  | -      }
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | +    // const setContainer = () => {
 | 
	
		
			
				|  |  | +    //   const min = Math.min(screen.width, screen.height)
 | 
	
		
			
				|  |  | +    //   const max = Math.max(screen.width, screen.height)
 | 
	
		
			
				|  |  | +    //   const width = min * (16 / 9)
 | 
	
		
			
				|  |  | +    //   if (width > max) {
 | 
	
		
			
				|  |  | +    //     parentContainer.width = '100vw'
 | 
	
		
			
				|  |  | +    //     return
 | 
	
		
			
				|  |  | +    //   } else {
 | 
	
		
			
				|  |  | +    //     parentContainer.width = width + 'px'
 | 
	
		
			
				|  |  | +    //   }
 | 
	
		
			
				|  |  | +    // }
 | 
	
		
			
				|  |  |      const handleInit = (type = 0) => {
 | 
	
		
			
				|  |  |        //设置容器16:9
 | 
	
		
			
				|  |  |        // setContainer()
 | 
	
	
		
			
				|  | @@ -202,17 +203,17 @@ export default defineComponent({
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |      const getTempList = async (materialList: any, name: any) => {
 | 
	
		
			
				|  |  |        const list: any = []
 | 
	
		
			
				|  |  | -      const browserInfo = browser()
 | 
	
		
			
				|  |  | +      // const browserInfo = browser()
 | 
	
		
			
				|  |  |        for (let j = 0; j < materialList.length; j++) {
 | 
	
		
			
				|  |  |          const material = materialList[j]
 | 
	
		
			
				|  |  |          //请求本地缓存
 | 
	
		
			
				|  |  | -        if (browserInfo.isApp && ['VIDEO', 'IMG'].includes(material.type)) {
 | 
	
		
			
				|  |  | -          const localData = await getCacheFilePath(material)
 | 
	
		
			
				|  |  | -          if (localData?.content?.localPath) {
 | 
	
		
			
				|  |  | -            material.url = material.content
 | 
	
		
			
				|  |  | -            material.content = localData.content.localPath
 | 
	
		
			
				|  |  | -          }
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | +        // if (browserInfo.isApp && ['VIDEO', 'IMG'].includes(material.type)) {
 | 
	
		
			
				|  |  | +        //   const localData = await getCacheFilePath(material)
 | 
	
		
			
				|  |  | +        //   if (localData?.content?.localPath) {
 | 
	
		
			
				|  |  | +        //     material.url = material.content
 | 
	
		
			
				|  |  | +        //     material.content = localData.content.localPath
 | 
	
		
			
				|  |  | +        //   }
 | 
	
		
			
				|  |  | +        // }
 | 
	
		
			
				|  |  |          const videoData = data.lookVideoDataList.find(
 | 
	
		
			
				|  |  |            (i: any) => i.materialId === material.materialId
 | 
	
		
			
				|  |  |          )
 | 
	
	
		
			
				|  | @@ -284,6 +285,7 @@ export default defineComponent({
 | 
	
		
			
				|  |  |        popupData.itemName = item.name
 | 
	
		
			
				|  |  |        nextTick(() => {
 | 
	
		
			
				|  |  |          data.itemList = list
 | 
	
		
			
				|  |  | +        getCurrentItemCatch(popupData.activeIndex) // 获取当前元素的缓存
 | 
	
		
			
				|  |  |          checkedAnimation(popupData.activeIndex)
 | 
	
		
			
				|  |  |          postMessage({
 | 
	
		
			
				|  |  |            api: 'courseLoading',
 | 
	
	
		
			
				|  | @@ -301,6 +303,21 @@ export default defineComponent({
 | 
	
		
			
				|  |  |          }, 500)
 | 
	
		
			
				|  |  |        })
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /** 获取当前元素的缓存 */
 | 
	
		
			
				|  |  | +    const getCurrentItemCatch = async (index: number) => {
 | 
	
		
			
				|  |  | +      const item = data.itemList[index]
 | 
	
		
			
				|  |  | +      if (browserInfo.isApp && ['VIDEO', 'IMG'].includes(item.typeCode) && !item.isReadCatch) {
 | 
	
		
			
				|  |  | +        const localData: any = await getCacheFilePath(item)
 | 
	
		
			
				|  |  | +        item.isReadCatch = true
 | 
	
		
			
				|  |  | +        if (localData?.content?.localPath) {
 | 
	
		
			
				|  |  | +          item.url = item.content
 | 
	
		
			
				|  |  | +          item.content = localData.content.localPath
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        console.log('加载了缓存')
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      const getDetail = async (id?: any) => {
 | 
	
		
			
				|  |  |        try {
 | 
	
		
			
				|  |  |          const res: any = await request.get(
 | 
	
	
		
			
				|  | @@ -526,6 +543,7 @@ export default defineComponent({
 | 
	
		
			
				|  |  |          
 | 
	
		
			
				|  |  |          nextTick(() => {
 | 
	
		
			
				|  |  |            data.itemList = allList;
 | 
	
		
			
				|  |  | +          getCurrentItemCatch(popupData.activeIndex) // 获取当前元素的缓存
 | 
	
		
			
				|  |  |            checkedAnimation(popupData.activeIndex);
 | 
	
		
			
				|  |  |            postMessage({
 | 
	
		
			
				|  |  |              api: 'courseLoading',
 | 
	
	
		
			
				|  | @@ -939,6 +957,7 @@ export default defineComponent({
 | 
	
		
			
				|  |  |        checkedAnimation(popupData.activeIndex, index)
 | 
	
		
			
				|  |  |        nextTick(() => {
 | 
	
		
			
				|  |  |          popupData.activeIndex = index
 | 
	
		
			
				|  |  | +        getCurrentItemCatch(index) // 获取当前元素的缓存
 | 
	
		
			
				|  |  |          acitveTimer.value = setTimeout(
 | 
	
		
			
				|  |  |            () => {
 | 
	
		
			
				|  |  |              popupData.playIndex = index
 | 
	
	
		
			
				|  | @@ -1644,8 +1663,7 @@ export default defineComponent({
 | 
	
		
			
				|  |  |                if(data.currentId === item.id) {
 | 
	
		
			
				|  |  |                  return
 | 
	
		
			
				|  |  |                }
 | 
	
		
			
				|  |  | -              
 | 
	
		
			
				|  |  | -              // 
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |                const n = await getDetail(item.id);
 | 
	
		
			
				|  |  |                const s = await getRefLevel(item.id);
 | 
	
		
			
				|  |  |                if(n && s) {
 | 
	
	
		
			
				|  | @@ -1653,6 +1671,7 @@ export default defineComponent({
 | 
	
		
			
				|  |  |                  isCurrentCoursewareMenu.value = item.id === route.query.id ? true : false
 | 
	
		
			
				|  |  |                  popupData.coursewareOpen = false;
 | 
	
		
			
				|  |  |                  popupData.activeIndex = 0;
 | 
	
		
			
				|  |  | +                getCurrentItemCatch(popupData.activeIndex) // 获取当前元素的缓存
 | 
	
		
			
				|  |  |                  nextTick(() => {
 | 
	
		
			
				|  |  |                    popupData.open = true
 | 
	
		
			
				|  |  |                  })
 |