<template>
	<view class="fullHeight">
		<headers :showBack="true">
			<view class="headerName">
				课程学习
			</view>
		</headers>
		
		<video :src="url_config+'image/'+courseDetail.eduVideo" controls class="videoBox"></video>
		<view class="courseTitle">
			{{courseDetail.eduCourseName}}
		</view>
		<view class="desc">
			课程类型：{{educateTypeList[courseDetail.eduType-1]}}
		</view>
		<view class="desc">
			试卷总分：{{courseDetail.totalScore}}
		</view>
		<view class="desc">
			及格分数：{{courseDetail.passScore}}
		</view>
		<view class="desc">
			创建时间：{{courseDetail.addTime}}
		</view>
		<button type="primary" class="btn submitBtn big" @click="gotoTest" v-if="courseDetail.questionList.length>0">开始考试</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				courseDetail:{
					eduAddr: "",
					eduClasshour: "",
					eduContent: "",
					eduCourseName: "",
					eduPhoto: "",
					eduTeacher: "",
					eduTime: "",
					eduType: 1,
					eduVideo: "",
					passScore: "",
					projectSn: "",
					questionList: [],
					totalScore: "",
					addTime: ""
				},
				educateTypeList: ['入场三级教育','定期安全教育','安全技术交底','VR安全教育'],
				eduId:'',
				workerId:''
			}
		},
		onLoad(options) {
			this.eduId=options.eduId
			this.workerId=options.workerId
			this.getDetailData()
		},
		methods: {
			gotoTest(){
				uni.navigateTo({
					url:'./test?eduId='+this.eduId+'&workerId='+this.workerId
				})
			},
			//获取课程详细数据
			getDetailData(){
				var that = this
				this.sendRequest({
					url: "xmgl/safeEducationQuestion/selectSafeEducationQuestionInfo",
					data: {eduId:this.eduId},
					method: "post",
					success(res) {
						that.courseDetail=res.result.safeEducation
					}
				})
			}
		}
	}
</script>

<style scoped>
.videoBox{
	width: 100%;
	height: 300px;
	margin: 10px 0;
}
.courseTitle{
	padding: 0 15px;
}
.desc{
	font-size: 12px;
	opacity: 0.6;
	padding: 5px 0 0 15px;
}
.submitBtn{
	/* margin: 15px 20px; */
	position: fixed;
	bottom: 20px;
	left: 20px;
	width: calc(100% - 40px);
}
</style>
