<template>
	<view class="hour">
		<view v-for="(item,index ) in list" :key="index" class="hour-item">
			<view class="hour-item-title">
				<view class="hour-item-title-left">
					<view class="hour-item-title-left-text">
						{{item.title}}
					</view>
					<view class="hour-item-title-left-schedule">
						3 / 7 课时
					</view>
				</view>
				<view @click="open(item)" class="hour-item-title-right">
					<uni-icons v-if="item.show" color="#999" type="bottom" size="18"></uni-icons>
					<uni-icons v-else color="#999" type="top" size="18"></uni-icons>

				</view>
			</view>
			<uni-transition ref="ani" custom-class="transition" :mode-class="modeClass" :show="item.show">
				<view v-for="(item1,index1) in item.fileList" :key="index1" class="hour-data">
					<view class="hour-data-left">
						<view class="hour-data-left-index">
							{{index1 + 1}}.
						</view>
						<view class="">
							{{item1.title}}
						</view>
					</view>
					<view class="hour-data-right">
						<view :key="index2" :style="`background-color:${index2 == 2 ? '#05CCA1':''} ;`" v-for="(item2,index2) in [1,3,4,5,6,7]"
							class="hour-data-right-item">

						</view>
					</view>
				</view>
			</uni-transition>
		</view>
	</view>
</template>

<script>
	export default {
		name: "hourlist",
		props: {
			list: {
				type: Array,
				default: () => []
			}
		},
		data() {
			return {
				modeClass: ''
			};
		},
		methods: {
			open(item) {
				item.show = !item.show
				this.modeClass = ['fade', 'zoom-in']
				this.$emit('update:list', this.list)
			}
		}

	}
</script>

<style lang="scss" scoped>
	.hour {
		width: 100%;
		font-family: 'PingFang';
	}

	.hour-item {
		padding: 24rpx;
		background-color: #fff;
		border-radius: 5.33px;
		box-shadow: 0px 0px 8px 0px rgba(147, 147, 147, 0.20);
		margin-bottom: 32rpx;

		.hour-data {
			height: 66rpx;
			border-bottom: 1px solid #f2f2f2;
			display: flex;
			align-items: center;
			font-size: 24rpx;
			display: flex;
			justify-content: space-between;

			.hour-data-right {
				display: flex;
				align-items: center;

				.hour-data-right-item {
					width: 16rpx;
					height: 16rpx;
					margin-right: 10rpx;
					border-radius: 8rpx;
					background-color: #dedede;
				}
			}

			.hour-data-left {
				display: flex;

				.hour-data-left-index {
					margin-right: 12rpx;
				}
			}
		}

		.hour-item-title {
			width: 100%;
			padding-bottom: 24rpx;
			border-bottom: 1px solid #f2f2f2;
			display: flex;
			justify-content: space-between;

			.hour-item-title-left {
				display: flex;

				.hour-item-title-left-text {
					font-size: 28rpx;
					font-weight: 700;
					color: #333;
					margin-right: 32rpx;
				}

				.hour-item-title-left-schedule {
					background: #e4fff9;
					color: #05cca1;
					padding: 0 24rpx;
					height: 46rpx;
					line-height: 46rpx;
					border-radius: 23rpx;
				}
			}


		}
	}
</style>