|
@@ -24,7 +24,7 @@ import styles from './index.module.less'
|
|
import 'plyr/dist/plyr.css'
|
|
import 'plyr/dist/plyr.css'
|
|
import request from '@/helpers/request'
|
|
import request from '@/helpers/request'
|
|
import { state } from '@/state'
|
|
import { state } from '@/state'
|
|
-import { useRoute } from 'vue-router'
|
|
|
|
|
|
+import { useRoute, useRouter } from 'vue-router'
|
|
import { listenerMessage, postMessage, promisefiyPostMessage } from '@/helpers/native-message'
|
|
import { listenerMessage, postMessage, promisefiyPostMessage } from '@/helpers/native-message'
|
|
import MusicScore from './component/musicScore'
|
|
import MusicScore from './component/musicScore'
|
|
import iconMenu from './image/icon-menu.svg'
|
|
import iconMenu from './image/icon-menu.svg'
|
|
@@ -106,6 +106,7 @@ export default defineComponent({
|
|
})
|
|
})
|
|
|
|
|
|
const route = useRoute()
|
|
const route = useRoute()
|
|
|
|
+ const router = useRouter()
|
|
const headeRef = ref()
|
|
const headeRef = ref()
|
|
const data = reactive({
|
|
const data = reactive({
|
|
detail: null,
|
|
detail: null,
|
|
@@ -192,7 +193,8 @@ export default defineComponent({
|
|
iframeRef: null,
|
|
iframeRef: null,
|
|
tabName: item.name,
|
|
tabName: item.name,
|
|
isLast: j === itemLength, // 当前知识点
|
|
isLast: j === itemLength, // 当前知识点
|
|
- autoPlay: false //加载完成是否自动播放
|
|
|
|
|
|
+ autoPlay: false, //加载完成是否自动播放
|
|
|
|
+ display: false,
|
|
})
|
|
})
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -212,6 +214,7 @@ export default defineComponent({
|
|
popupData.activeIndex = popupData.firstIndex
|
|
popupData.activeIndex = popupData.firstIndex
|
|
item.autoPlay = true
|
|
item.autoPlay = true
|
|
item.muted = true
|
|
item.muted = true
|
|
|
|
+ item.display = true
|
|
}
|
|
}
|
|
// console.log('🚀 ~ list', list)
|
|
// console.log('🚀 ~ list', list)
|
|
data.itemList = list
|
|
data.itemList = list
|
|
@@ -258,6 +261,9 @@ export default defineComponent({
|
|
})
|
|
})
|
|
// 返回
|
|
// 返回
|
|
const goback = () => {
|
|
const goback = () => {
|
|
|
|
+ if (route.query.source == 'my-course'){
|
|
|
|
+ router.back()
|
|
|
|
+ }
|
|
postMessage({ api: 'goBack' })
|
|
postMessage({ api: 'goBack' })
|
|
}
|
|
}
|
|
|
|
|
|
@@ -271,11 +277,6 @@ export default defineComponent({
|
|
itemActive: '',
|
|
itemActive: '',
|
|
itemName: ''
|
|
itemName: ''
|
|
})
|
|
})
|
|
- // 设置当前的激活状态
|
|
|
|
- const setActiveData = (val: any, oldVal: any) => {
|
|
|
|
- handleStop()
|
|
|
|
- }
|
|
|
|
- watch(() => popupData.activeIndex, setActiveData)
|
|
|
|
|
|
|
|
/**停止所有的播放 */
|
|
/**停止所有的播放 */
|
|
const handleStop = () => {
|
|
const handleStop = () => {
|
|
@@ -297,6 +298,7 @@ export default defineComponent({
|
|
// 停止曲谱的播放
|
|
// 停止曲谱的播放
|
|
if (item.type === 'SONG') {
|
|
if (item.type === 'SONG') {
|
|
item.iframeRef?.contentWindow?.postMessage({ api: 'setPlayState' }, '*')
|
|
item.iframeRef?.contentWindow?.postMessage({ api: 'setPlayState' }, '*')
|
|
|
|
+ item.display = false
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -304,7 +306,6 @@ export default defineComponent({
|
|
const toggleMaterial = () => {
|
|
const toggleMaterial = () => {
|
|
const index = data.itemList.findIndex((n: any) => n.id == popupData.itemActive)
|
|
const index = data.itemList.findIndex((n: any) => n.id == popupData.itemActive)
|
|
if (index > -1) {
|
|
if (index > -1) {
|
|
- popupData.activeIndex = index
|
|
|
|
swipeRef.value?.swipeTo(index, {
|
|
swipeRef.value?.swipeTo(index, {
|
|
immediate: true
|
|
immediate: true
|
|
})
|
|
})
|
|
@@ -323,6 +324,7 @@ export default defineComponent({
|
|
console.log('轮播切换')
|
|
console.log('轮播切换')
|
|
popupData.activeIndex = val
|
|
popupData.activeIndex = val
|
|
const item = data.itemList[val]
|
|
const item = data.itemList[val]
|
|
|
|
+ handleStop()
|
|
if (item) {
|
|
if (item) {
|
|
popupData.tabActive = item.knowledgePointId
|
|
popupData.tabActive = item.knowledgePointId
|
|
popupData.itemActive = item.id
|
|
popupData.itemActive = item.id
|
|
@@ -330,6 +332,7 @@ export default defineComponent({
|
|
popupData.tabName = item.tabName
|
|
popupData.tabName = item.tabName
|
|
if (item.type == 'SONG') {
|
|
if (item.type == 'SONG') {
|
|
activeData.model = true
|
|
activeData.model = true
|
|
|
|
+ item.display = true
|
|
}
|
|
}
|
|
if (item.type === 'VIDEO') {
|
|
if (item.type === 'VIDEO') {
|
|
// console.log("🚀 ~ item", item)
|
|
// console.log("🚀 ~ item", item)
|
|
@@ -344,6 +347,7 @@ export default defineComponent({
|
|
})
|
|
})
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|
|
// 上一个知识点, 下一个知识点
|
|
// 上一个知识点, 下一个知识点
|
|
const handlePreAndNext = (type: string) => {
|
|
const handlePreAndNext = (type: string) => {
|
|
@@ -596,7 +600,7 @@ export default defineComponent({
|
|
|
|
|
|
<Transition name="top">
|
|
<Transition name="top">
|
|
{activeData.model && (
|
|
{activeData.model && (
|
|
- <div class={styles.headerContainer} ref={headeRef}>
|
|
|
|
|
|
+ <div id="coursePlayHeader" class={styles.headerContainer} ref={headeRef}>
|
|
<div class={styles.backBtn} onClick={() => goback()}>
|
|
<div class={styles.backBtn} onClick={() => goback()}>
|
|
<Icon name={iconBack} />
|
|
<Icon name={iconBack} />
|
|
返回
|
|
返回
|