|
@@ -1,4 +1,4 @@
|
|
-import { Icon, Swipe, SwipeItem, Tab, Tabs } from 'vant'
|
|
|
|
|
|
+import { Icon, Popup, Swipe, SwipeItem, Tab, Tabs } from 'vant'
|
|
import { defineComponent, onMounted, reactive, nextTick, onUnmounted, ref } from 'vue'
|
|
import { defineComponent, onMounted, reactive, nextTick, onUnmounted, ref } from 'vue'
|
|
import iconBack from './image/back.svg'
|
|
import iconBack from './image/back.svg'
|
|
import styles from './index.module.less'
|
|
import styles from './index.module.less'
|
|
@@ -10,10 +10,13 @@ import { useRoute } from 'vue-router'
|
|
import { postMessage } from '@/helpers/native-message'
|
|
import { postMessage } from '@/helpers/native-message'
|
|
import OHeader from '@/components/o-header'
|
|
import OHeader from '@/components/o-header'
|
|
import MusicScore from './component/musicScore'
|
|
import MusicScore from './component/musicScore'
|
|
|
|
+import iconMenu from './image/icon-menu.svg'
|
|
|
|
+import Points from './component/points'
|
|
|
|
|
|
export default defineComponent({
|
|
export default defineComponent({
|
|
name: 'CoursewarePlay',
|
|
name: 'CoursewarePlay',
|
|
setup() {
|
|
setup() {
|
|
|
|
+ const isTouch = ref(false)
|
|
const handleInit = () => {
|
|
const handleInit = () => {
|
|
postMessage({
|
|
postMessage({
|
|
api: 'setRequestedOrientation',
|
|
api: 'setRequestedOrientation',
|
|
@@ -34,9 +37,20 @@ export default defineComponent({
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
|
|
- window.addEventListener('message', (val: any) => {
|
|
|
|
- console.log(val)
|
|
|
|
- })
|
|
|
|
|
|
+ // window.addEventListener('message', (res: any) => {
|
|
|
|
+ // // console.log(res)
|
|
|
|
+ // if (res?.data?.api) {
|
|
|
|
+ // const { api } = res.data
|
|
|
|
+ // if (api === 'touchstart') {
|
|
|
|
+ // isTouch.value = true
|
|
|
|
+ // console.log('🚀 ~ 父页面touchstart')
|
|
|
|
+ // }
|
|
|
|
+ // if (api === 'touchend') {
|
|
|
|
+ // isTouch.value = false
|
|
|
|
+ // console.log('🚀 ~ 父页面touchend')
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ // })
|
|
}
|
|
}
|
|
|
|
|
|
const route = useRoute()
|
|
const route = useRoute()
|
|
@@ -54,7 +68,10 @@ export default defineComponent({
|
|
data.detail = res.data
|
|
data.detail = res.data
|
|
}
|
|
}
|
|
if (Array.isArray(res?.data?.knowledgePointList)) {
|
|
if (Array.isArray(res?.data?.knowledgePointList)) {
|
|
- data.knowledgePointList = res.data.knowledgePointList
|
|
|
|
|
|
+ data.knowledgePointList = res.data.knowledgePointList.map((n: any) => {
|
|
|
|
+ n.index = 0
|
|
|
|
+ return n
|
|
|
|
+ })
|
|
}
|
|
}
|
|
console.log('数据加载完成')
|
|
console.log('数据加载完成')
|
|
} catch (error) {}
|
|
} catch (error) {}
|
|
@@ -80,6 +97,10 @@ export default defineComponent({
|
|
const goback = () => {
|
|
const goback = () => {
|
|
history.go(-1)
|
|
history.go(-1)
|
|
}
|
|
}
|
|
|
|
+ // 所有的切换
|
|
|
|
+ const handleChange = () => {
|
|
|
|
+ console.log('切换了')
|
|
|
|
+ }
|
|
onUnmounted(() => {
|
|
onUnmounted(() => {
|
|
postMessage({
|
|
postMessage({
|
|
api: 'setRequestedOrientation',
|
|
api: 'setRequestedOrientation',
|
|
@@ -100,6 +121,13 @@ export default defineComponent({
|
|
}
|
|
}
|
|
})
|
|
})
|
|
})
|
|
})
|
|
|
|
+
|
|
|
|
+ const popupData = reactive({
|
|
|
|
+ open: false,
|
|
|
|
+ active: '',
|
|
|
|
+ knowledgeId: '',
|
|
|
|
+ materialId: ''
|
|
|
|
+ })
|
|
return () => (
|
|
return () => (
|
|
<div class={styles.coursewarePlay}>
|
|
<div class={styles.coursewarePlay}>
|
|
<div class={styles.headerContainer}>
|
|
<div class={styles.headerContainer}>
|
|
@@ -108,7 +136,16 @@ export default defineComponent({
|
|
返回
|
|
返回
|
|
</div>
|
|
</div>
|
|
<div class={styles.menu}>
|
|
<div class={styles.menu}>
|
|
- <Tabs v-model:active={data.active} ellipsis={false}>
|
|
|
|
|
|
+ <Tabs
|
|
|
|
+ v-model:active={data.active}
|
|
|
|
+ ellipsis={false}
|
|
|
|
+ onChange={() => {
|
|
|
|
+ const knowledge = data.knowledgePointList.find((_: any) => _.id === data.active)
|
|
|
|
+ popupData.active = `${data.active}-${knowledge?.materialList?.[knowledge.index]?.id}`
|
|
|
|
+ console.log("🚀 ~ popupData.active", popupData.active)
|
|
|
|
+ handleChange()
|
|
|
|
+ }}
|
|
|
|
+ >
|
|
{{
|
|
{{
|
|
default: () => {
|
|
default: () => {
|
|
return data.knowledgePointList.map((n: any) => {
|
|
return data.knowledgePointList.map((n: any) => {
|
|
@@ -124,34 +161,56 @@ export default defineComponent({
|
|
{data.knowledgePointList.map((item: any) => {
|
|
{data.knowledgePointList.map((item: any) => {
|
|
return (
|
|
return (
|
|
<Tab name={item.id}>
|
|
<Tab name={item.id}>
|
|
- <Swipe style={{ height: '100vh' }} vertical lazyRender={false}>
|
|
|
|
- {Array.isArray(item?.materialList) &&
|
|
|
|
- item.materialList.map((m: any) => {
|
|
|
|
- return (
|
|
|
|
- <SwipeItem>
|
|
|
|
- {m.type === 'VIDEO' ? (
|
|
|
|
- <div class={styles.videoItem}>
|
|
|
|
- <video class="player" controls>
|
|
|
|
- <source src={m.content} type="video/mp4" />
|
|
|
|
- </video>
|
|
|
|
- </div>
|
|
|
|
- ) : m.type === 'IMG' ? (
|
|
|
|
- <div class={styles.imgItem}>
|
|
|
|
- <img src={m.content} />
|
|
|
|
- </div>
|
|
|
|
- ) : (
|
|
|
|
- <div class={styles.songItem}>
|
|
|
|
- <MusicScore music={m} />
|
|
|
|
- </div>
|
|
|
|
- )}
|
|
|
|
- </SwipeItem>
|
|
|
|
- )
|
|
|
|
- })}
|
|
|
|
- </Swipe>
|
|
|
|
|
|
+ <Swipe
|
|
|
|
+ style={{ height: '100vh' }}
|
|
|
|
+ loop={false}
|
|
|
|
+ vertical
|
|
|
|
+ lazyRender={false}
|
|
|
|
+ onChange={(val: any) => {
|
|
|
|
+ item.index = val
|
|
|
|
+ popupData.active = `${item.id}-${item?.materialList?.[item.index]?.id}`
|
|
|
|
+ console.log("🚀 ~ popupData.active", popupData.active)
|
|
|
|
+ handleChange()
|
|
|
|
+ }}
|
|
|
|
+ >
|
|
|
|
+ {Array.isArray(item?.materialList) &&
|
|
|
|
+ item.materialList.map((m: any) => {
|
|
|
|
+ if (popupData.active === ''){
|
|
|
|
+ popupData.active = `${item.id}-${m.id}`
|
|
|
|
+ console.log("🚀 ~ popupData", popupData)
|
|
|
|
+ }
|
|
|
|
+ return (
|
|
|
|
+ <SwipeItem>
|
|
|
|
+ {m.type === 'VIDEO' ? (
|
|
|
|
+ <div class={styles.videoItem}>
|
|
|
|
+ <video class="player" controls>
|
|
|
|
+ <source src={m.content} type="video/mp4" />
|
|
|
|
+ </video>
|
|
|
|
+ </div>
|
|
|
|
+ ) : m.type === 'IMG' ? (
|
|
|
|
+ <div class={styles.imgItem}>
|
|
|
|
+ <img src={m.content} />
|
|
|
|
+ </div>
|
|
|
|
+ ) : (
|
|
|
|
+ <div class={styles.songItem}>
|
|
|
|
+ <MusicScore music={m} />
|
|
|
|
+ </div>
|
|
|
|
+ )}
|
|
|
|
+ </SwipeItem>
|
|
|
|
+ )
|
|
|
|
+ })}
|
|
|
|
+ </Swipe>
|
|
</Tab>
|
|
</Tab>
|
|
)
|
|
)
|
|
})}
|
|
})}
|
|
</Tabs>
|
|
</Tabs>
|
|
|
|
+ <div class={styles.fullBtn} onClick={() => (popupData.open = true)}>
|
|
|
|
+ <img src={iconMenu} />
|
|
|
|
+ <span>列表</span>
|
|
|
|
+ </div>
|
|
|
|
+ <Popup class={styles.popup} overlayClass={styles.overlayClass} position="left" v-model:show={popupData.open}>
|
|
|
|
+ <Points data={data.knowledgePointList} active={popupData.active} />
|
|
|
|
+ </Popup>
|
|
</div>
|
|
</div>
|
|
)
|
|
)
|
|
}
|
|
}
|