<template>
	<view>
		<wd-sticky v-if="courseInfo?.url" :offset-top="0.01">
			<zVideo :url="courseInfo?.url" :isSpeed="isSpeed" :showCasting="showCasting" :lockButton="lockButton">
			</zVideo>
		</wd-sticky>
		<view class="li-flex-col li-m-30 li-bg-white">
			<view v-if="courseInfo?.chapter_name" class="li-text-32 li-text-#000000">
				{{courseInfo?.chapter_name}}
			</view>
			<view v-if="courseInfo?.author" class="li-font-400 li-text-24 li-text-#595959 li-mt-10">
				{{courseInfo?.author}}
			</view>
			<view v-if="courseInfo?.content" class="li-mt-30">
				<mp-html :content="courseInfo?.content" />
				<!-- <rich-text :selectable='true' :preview='true' :nodes="courseInfo?.content" @itemclick="goImgDetials"></rich-text> -->
			</view>
		</view>


	</view>
</template>

<script lang="ts" setup>
	import zVideo from '@/components/z-video/z-video.vue';
	import {
		chapterInfo
	} from "@/api/chapter"
	import { ref } from 'vue'
	import {
		onLoad
	} from "@dcloudio/uni-app"

	//是否打开倍速功能
	const isSpeed = ref<boolean>(true)
	//是否显示投屏按钮
	const showCasting = ref<boolean>(true)
	//是否显示锁屏按钮
	const lockButton = ref<boolean>(true)
	const courseInfo = ref<object>({})

	const getChapterInfo = async (id) => {
		var res = await chapterInfo({ chapter_id: id })
		courseInfo.value = res.data
	}


	onLoad((options) => {
		getChapterInfo(options?.id)
	})
</script>

<style lang="scss">

</style>