<template>
	<view class="container">
		<image class="cbg" src="../../static/common_bg.png"></image>
		<view class="wrap">
			<view v-if="list.length>0">
				<view class="item" v-for="item in list">
					<view>上课时间：{{item.date}} {{item.period}}</view>
					<view>课程主题：{{item.theme}}</view>
					<view>授课老师：{{item.teacher?item.teacher.name:''}}</view>
					<view>授课地点：{{item.address}}</view>
				</view>
			</view>
			<view class="nodata" v-else>
				<u-empty mode="data"></u-empty>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		components: {},
		data() {
			return {
				list: []
			}
		},
		onLoad(options) {
			this.getMyCourseContents(options.id)
		},
		methods: {
			async getMyCourseContents(id) {
				const res = await this.$u.api.courseContent({
					course_id: id,
				})
				this.list = res.list
			},
		}

	}
</script>

<style scoped lang="scss">
	.container {
		padding: 30rpx;
		width: 100%;
		height: 100vh;
		overflow: scroll;
		.cbg {
			position: absolute;
			top: 0;
			left: 0;
			width: 100%;
			height: 100vh;
		}

		.wrap {
			position: relative;
			.item{
				background-color: #fff;
				padding:30rpx;
				margin-bottom: 20rpx;
				border-radius: 20rpx;
			}
			.nodata {
				height: 100vh;
			}
		}
	}
</style>