<template>
	<view class="container">
		<image class="cbg" :src="base.imgHost('common_bg.png')"></image>
		<view class="wrap">
			<view v-if="list.length>0">
				<view class="item" v-for="item in list">
					<view class="item-date">{{item.date}}</view>
					<view class="item-period">{{item.period}}</view>
					<view class="item-img">
						<image :src="base.imgHost('mycourse-c1.png')" style="width:22rpx;height:22rpx"></image>
						<text>{{item.theme}}</text>
					</view>
					<view class="item-img">
						<image :src="base.imgHost('mycourse-c2.png')" style="width:20rpx;height:23rpx"></image>
						<text>{{item.teacher?item.teacher.name:''}}</text>
					</view>
					<view class="item-img">
						<image :src="base.imgHost('mycourse-c3.png')" style="width:19rpx;height:27rpx"></image>
						<text>{{item.address}}</text>
					</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;
				&-date{
					font-size: 32rpx;
					color:#b08c6c;
					margin-bottom:30rpx
				}
				&-period{
					color:#333333;
					margin-left:20rpx;
					margin-bottom:20rpx
				}
				&-img{
					color:#666666;
					display: flex;
					align-items: center;
					margin-left:20rpx;
					margin-bottom:20rpx;
					image{
						margin-right:10rpx;
					}
				}
			}
			.nodata {
				height: 100vh;
			}
		}
	}
</style>