<template>
	<view>
		<uni-popup ref="popupRef" :animation="true" :is-mask-click="false"
			mask-background-color="rgba(255, 255, 255, 0.1);" type="bottom">
			<view class="xuexi-dagang-page">
				<view class="dagang-title">
					<text>{{danyuanInfo.danyuanIntro}}</text>
					<icon @click="goUpPage"></icon>
				</view>
				<view class="xuexi-dagang-body">
					<!-- 您将学会 -->
					<view class="dagang-xh-box">
						<view class="xh-title">您将学会</view>
						<view class="xh-content-box">
							<view class="text-row" v-for="(item,index) in danyuanInfo.xuehui" :key="index">
								<icon></icon>
								<view class="text-content">{{item}}</view>
							</view>
						</view>
					</view>
					<!-- 学习大纲 -->
					<view class="dagang-content-box">
						<view class="dagang-content-title">学习大纲</view>
						<view class="dagang-item-list">
							<view class="dagang-content-item" v-for="(item,index) in danyuanInfo.dagangList"
								:key="index">
								<!-- 封面 -->
								<!-- <img :src="item.cover" /> -->
								<view>
									<view class="content-title">{{item.jieName}}</view>
									<view class="content-title">{{item.jieIntro}}</view>
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	import {
		nextTick,
		ref
	} from 'vue';
	import {
		onLoad,
		onReady
	} from '@dcloudio/uni-app';
	import {
		getVideoAuth,
		getVideoAuthYk,
		videoWancheng
	} from "@/api/shipin.js"
	import {
		toast,
		convertTimeToSeconds
	} from "@/utils/common";
	import cacheManager from "@/utils/cacheManager.js";
	import * as httpApi from "@/api/chanpinZiRanPinDu.js";
	export default {
		data() {
			return {
				danyuanId: null,
				danyuanInfo: {
					danyuanId: '',
					dagangList: [],
					danyuanIntro: '',
					number: '',
					video: '',
					xuehui: [],
				},

				pageData: null, //上个页面获取的视频参数（视频id）
				playAuth: "", //播放凭证
				progressMarkers: [],
				hideFlag: 'show',
				videoId: "", //阿里云视频id
				seekTime: '',
				shipinTitle: '',
			}
		},
		onLoad(options) {
			this.init(options)
		},
		onHide() {
			this.hideFlag = 'hide'
		},
		onUnload() {
			this.hideFlag = 'hide'
		},
		methods: {
			goUpPage() {
				this.$refs.popupRef.close();
				this.$emit('close')
			},
			// 打开弹窗
			handleShow(danyuanId) {
				this.danyuanId = danyuanId;
				this.getDataInfo()
			},
			handleClose() {
				this.$refs.popupRef.close();
			},
			getDataInfo() {
				httpApi.getPinduChanpinDanyuanInfo({
					danyuanId: this.danyuanId
				}).then(res => {
					// 重新赋值
					Object.assign(this.danyuanInfo, res.data)
					this.$refs.popupRef.open();
				})
			},
			init(options) {
				this.danyuanId = options.danyuanId;
				this.getDataInfo()
			},
		},
	}
</script>
