|
@@ -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>
|
|
|
)}
|