<template>
	<view class="app">
		<image class="topimage" :src="baseurl + list.trainingItemPosterUrl" mode=""></image>
		<view class="title">
			{{list.trainingItemTitle}}
		</view>
		<!-- <view class="time">
			有效期：2023.12.31
		</view> -->
		<view class="border"></view>
		<u-tabs :list="tablist" :is-scroll="false" :current="tabcurrent" @change="change" font-size='34' bar-height='3'>
		</u-tabs>
		<view class="detail" v-if="tabcurrent==0">
			{{list.trainingItemDetails}}
		</view>
		<view class="directory" v-if="tabcurrent==1">
			<view class="item" v-for="(item,index) in list.trainingItemDirectoryList" :key="index">
				<view class="text">
					<span class='DirectoryName'>{{item.itemDirectoryName}}</span>
					<span class='texttitle'>{{item.itemDirectoryTitle}}</span>
				</view>
				<view class="Introduce">
					{{item.itemDirectoryIntroduce}}
				</view>
				<view class="play" :style="list.trainingOrderStatus?'background-color: #3D7DCA;color:#fff':''">
					开始播放
				</view>
			</view>
		</view>
		<view class="bottom" v-if="!list.trainingOrderStatus">
			<view class="price">
				￥{{list.trainingItemPrice}}
			</view>
			<view class="buy">
				购买
			</view>
		</view>
	</view>
</template>

<script>
	import baseurl from '@/api/baseurl.js'
	export default {
		data() {
			return {
				baseurl: undefined,
				list: {},
				tablist: [{
					name: '详情'
				}, {
					name: '目录'
				}],
				tabcurrent: 0
			};
		},
		methods: {
			//点击tabs
			change(index) {
				this.tabcurrent = index;
			}
		},
		onLoad(options) {
			this.baseurl = baseurl
			this.list = JSON.parse(options.list)
		},
	}
</script>

<style lang="scss">
	.app {
		width: 96%;
		padding: 0;
		margin: 15rpx auto;
		color: #666666;
		background-color: #fff;

		.directory {
			padding-bottom: 420rpx;

			.item {
				position: relative;
				width: 96%;
				margin: 0 auto;
				padding-bottom: 35rpx;
				border-bottom: 1rpx solid #E6E6E6;
				color: #888787;

				.play {
					font-size: 24rpx;
					width: 141rpx;
					height: 52rpx;
					background: #E6E6E6;
					border-radius: 5rpx;
					line-height: 52rpx;
					text-align: center;
					position: absolute;
					right: 30rpx;
					top: 50%;
					transform: translateY(-50%);
				}

				.Introduce {
					width: 300rpx;
					font-size: 26rpx;
					line-height: 36rpx;
					margin: 18rpx 0 0 176rpx;
					overflow: hidden;
					text-overflow: ellipsis;
					white-space: nowrap;
				}

				.text {
					margin-top: 40rpx;

					.DirectoryName {
						display: inline-block;
						width: 176rpx;
						font-size: 28rpx;
						font-weight: 400;
						overflow: hidden;
						text-overflow: ellipsis;
						white-space: nowrap;
					}

					.texttitle {
						display: inline-block;
						width: 300rpx;
						font-size: 32rpx;
						font-weight: 400;
						color: #666666;
						overflow: hidden;
						text-overflow: ellipsis;
						white-space: nowrap;
					}
				}
			}
		}

		.bottom {
			width: 100%;
			height: 160rpx;
			background: #FFFFFF;
			box-shadow: 0rpx 1rpx 21rpx 0rpx rgba(204, 204, 204, 0.75);
			position: fixed;
			bottom: 0;

			.buy {
				width: 140rpx;
				height: 60rpx;
				background: #4271B9;
				border-radius: 5rpx;
				color: #fff;
				text-align: center;
				line-height: 60rpx;
				position: absolute;
				right: 60rpx;
				top: 50%;
				transform: translateY(-50%);
			}

			.price {
				font-size: 42rpx;
				font-weight: 500;
				color: #EA706A;
				line-height: 120rpx;
				position: absolute;
				left: 44rpx;
				top: 50%;
				transform: translateY(-50%);
			}
		}

		.detail {
			width: 90%;
			margin: 40rpx auto 0;
			font-size: 32rpx;
			padding-bottom: 420rpx;
		}

		::v-deep .u-tabs {
			width: 50% !important;
		}

		.border {
			width: 94%;
			margin: 40rpx auto;
			border-bottom: 1rpx solid #E6E6E6;
		}

		.time {
			font-size: 30rpx;
			margin: 21rpx 0 0 20rpx;
		}

		.title {
			font-size: 38rpx;
			font-weight: 500;
			color: #000000;
			line-height: 36rpx;
			margin: 36rpx 0 0 20rpx;
		}

		.topimage {
			display: block;
			width: 100%;
			height: 407rpx;
			border-radius: 5rpx;
		}
	}
</style>
