|
@@ -1,5 +1,5 @@
|
|
import { Icon, Swipe, SwipeItem, Tab, Tabs } from 'vant'
|
|
import { Icon, Swipe, SwipeItem, Tab, Tabs } from 'vant'
|
|
-import { defineComponent, onMounted, reactive, nextTick } 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'
|
|
import Plyr from 'plyr'
|
|
import Plyr from 'plyr'
|
|
@@ -7,10 +7,44 @@ 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 } from 'vue-router'
|
|
|
|
+import { postMessage } from '@/helpers/native-message'
|
|
|
|
+import OHeader from '@/components/o-header'
|
|
|
|
|
|
export default defineComponent({
|
|
export default defineComponent({
|
|
name: 'CoursewarePlay',
|
|
name: 'CoursewarePlay',
|
|
setup() {
|
|
setup() {
|
|
|
|
+ const navBarHeight = ref(0)
|
|
|
|
+ const handleInit = () => {
|
|
|
|
+ postMessage({
|
|
|
|
+ api: 'setRequestedOrientation',
|
|
|
|
+ content: {
|
|
|
|
+ orientation: 0
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ postMessage({
|
|
|
|
+ api: 'setBarStatus',
|
|
|
|
+ content: {
|
|
|
|
+ status: 1
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ const sTitleHeight = sessionStorage.getItem('titleHeight')
|
|
|
|
+ if (sTitleHeight) {
|
|
|
|
+ navBarHeight.value = Number(sTitleHeight)
|
|
|
|
+ } else {
|
|
|
|
+ postMessage({ api: 'getNavHeight' }, (res) => {
|
|
|
|
+ const { content } = res as any
|
|
|
|
+ console.log("🚀 ~ content", content)
|
|
|
|
+ const dpi = content.dpi || 2
|
|
|
|
+ if (content.titleHeight) {
|
|
|
|
+ // 导航栏的高度
|
|
|
|
+ const titleHeight = content.titleHeight / dpi
|
|
|
|
+ sessionStorage.setItem('titleHeight', String(titleHeight))
|
|
|
|
+ navBarHeight.value = titleHeight
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ handleInit()
|
|
const route = useRoute()
|
|
const route = useRoute()
|
|
const data = reactive({
|
|
const data = reactive({
|
|
detail: null,
|
|
detail: null,
|
|
@@ -46,11 +80,27 @@ export default defineComponent({
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
getDetail()
|
|
getDetail()
|
|
})
|
|
})
|
|
|
|
+ // 返回
|
|
const goback = () => {
|
|
const goback = () => {
|
|
history.go(-1)
|
|
history.go(-1)
|
|
}
|
|
}
|
|
|
|
+ onUnmounted(() => {
|
|
|
|
+ postMessage({
|
|
|
|
+ api: 'setRequestedOrientation',
|
|
|
|
+ content: {
|
|
|
|
+ orientation: 1
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ postMessage({
|
|
|
|
+ api: 'setBarStatus',
|
|
|
|
+ content: {
|
|
|
|
+ status: 0
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ })
|
|
return () => (
|
|
return () => (
|
|
<div class={styles.coursewarePlay}>
|
|
<div class={styles.coursewarePlay}>
|
|
|
|
+ <OHeader />
|
|
<div class={styles.backBtn} onClick={() => goback()}>
|
|
<div class={styles.backBtn} onClick={() => goback()}>
|
|
<Icon name={iconBack} />
|
|
<Icon name={iconBack} />
|
|
返回
|
|
返回
|