<template>
	<view class="video">
		<view class="item" v-for="(a,i) in list" :key="i">
			<view class="name">{{a.name}}</view>
			<view class="ul" v-for="(b,idx) in a.children" :key="idx">
				<view class="a">
					<view class="title">{{b.name}}</view>
					<view class="btn" v-if="b.children.length == 0" @click="toVideo(b.id)">查看</view>
				</view>
				<view class="b">
					<view class="li" v-for="(c,idx1) in b.children" :key="idx1">
						<view class="title">{{c.name}}</view>
						<view class="btn" @click="toVideo(c.id)">购买</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: []
			};
		},
		onLoad(o) {
			this.getList();
		},
		methods: {
			//获取列表
			async getList() {
				uni.showLoading({
					title: "加载中"
				})
				const { code, data, msg } = await this.$api.categoryTreeList({
					category_id: this.category_id
				})
				if (code == 200) {
					uni.hideLoading()
					this.list = data;
				} else {
					uni.hideLoading()
					uni.showToast({
						icon: "none",
						title: msg
					})
				}
			}
		}
	}
</script>


<style lang="scss" scoped>
.video{
	width: 100%;
	min-height: calc(100vh - 44px);
	background-color: #f6f6f6;
	padding: 0 25rpx 25rpx;
	overflow: hidden;
	box-sizing: border-box;
	.item{
		padding: 20rpx;
		overflow: hidden;
		border-radius: 20rpx;
		margin-top: 20rpx;
		background-color: #fff;
		position: relative;
		.name{
			font-size: 34rpx;
			font-weight: bold;
		}
		.a{
			font-size: 30rpx;
			color: #222222;
			line-height: 60rpx;
			padding-bottom: 20rpx;
			border-bottom: 1px solid #f6f6f6;
			display: flex;
			align-items: center;
			justify-content: space-between;
			margin-top: 20rpx;
			.title{
				width: 500rpx;
				white-space: nowrap;
				text-overflow: ellipsis;
				overflow: hidden;
				font-size: 28rpx;
				font-weight: 400;
				color: #222222;
			}
			.btn{
				width: 90rpx;
				line-height: 40rpx;
				border: 1px solid #188EFC;
				border-radius: 40rpx;
				text-align: center;
				font-size: 24rpx;
				color: #188EFC;
			}
		}
		.b{
			padding: 10rpx 0 0;
			overflow: hidden;
			.li{
				padding: 10rpx 0;
				overflow: hidden;
				display: flex;
				align-items: center;
				justify-content: space-between;
				.title{
					width: 500rpx;
					white-space: nowrap;
					text-overflow: ellipsis;
					overflow: hidden;
					font-size: 28rpx;
					font-weight: 400;
					color: #222222;
				}
				.btn{
					width: 90rpx;
					line-height: 40rpx;
					border: 1px solid #188EFC;
					border-radius: 40rpx;
					text-align: center;
					font-size: 24rpx;
					color: #188EFC;
				}
			}
		}
		
	}
}
</style>
