<template>
	<view class="container">
		<view class="top">
			<image class="bg" src="/static/assets/learn-bg.png" mode="widthFix"></image>
			<view class="top-box">
				<view class="title">《健康生活方式指导》</view>
				<view class="txt">
					<image src="/static/assets/learn1.png"></image>
					<text>共5节课</text>
				</view>
			</view>
		</view>
		<view class="container-body">
			<view class="center-box">
				<u-tabs lineColor="#f56c6c" :scrollable="false"
					:activeStyle="{color: '#fd694f',fontWeight: 'bold',fontSize:'34rpx'}"
					:inactiveStyle="{color: '#787878',fontSize:'34rpx'}" :list="tabList" @click="ontabList">
				</u-tabs>
				<view class="progress-box">
					<image src="/static/assets/learn2.png"></image>
					<text class="title">听课进度</text>
					<text class="txt">已学习<text style="color: #f74d3a;">0</text>/5节课</text>
				</view>
				<view class="progress">
					<u-line-progress inactiveColor="#f0f4f7" activeColor="#3c9cff" :percentage="0"
						:showText="false"></u-line-progress>
					<text>0%</text>
				</view>
			</view>

			<!-- <view class="list">
				<view class="img-box">
					<view class="sub">第一课</view>
					<image src="/static/assets/learn-img.png"></image>
				</view>
				<view class="right">
					<view class="title">第一课 如何防控烦人的慢性病</view>
					<view class="bottom">
						<view class="tip">
							<image src="/static/assets/learn3.png" mode="widthFix"></image>
							<text>答题送金币+200</text>
						</view>
						<view class="btn">已学习4%</view>
					</view>
				</view>
			</view> -->

			<view class="list" v-for="(item,index) in learnList" :key="index">
				<view class="img-box">
					<view class="sub">第一课</view>
					<image src="/static/assets/learn-img.png"></image>
				</view>
				<view class="right">
					<view class="title">{{item.title}}</view>
					<view class="bottom">
						<view class="tip">
							<image :src="item.img" mode="widthFix"></image>
							<text>答题送金币+200</text>
						</view>
						<view class="btn" v-if="item.stauts==0">已学习4%</view>
						<view class="btn-red" v-else>去学习</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				tabList: [{
					name: '详情'
				}, {
					name: '课程目录'
				}],
				learnList: [{
					img: '/static/assets/learn3.png',
					title: '第一课 如何防控烦人的慢性病',
					stauts: 0
				},
				{
					img: '/static/assets/learn3.png',
					title: '第一课 如何防控烦人的慢性病',
					stauts: 1
				}]
			}
		},
		computed: {

		},
		onLoad(option) {

		},
		methods: {
			ontabList() {
				// this.stauts = 0
			}
			// goLearn() {
			// 	uni.navigateTo({
			// 		url: '/pages_manage/learn'
			// 	})
			// },
		}
	}
</script>

<style lang="scss" scoped>
	.container {
		padding: 0 0 30rpx;
		background-color: #f0f4f7;

		.top {
			position: relative;

			.bg {
				width: 100%;
			}

			.top-box {
				position: absolute;
				bottom: -90rpx;
				width: 100%;
				padding: 30rpx;
				background: linear-gradient(to bottom,
						rgba(255, 255, 255, 0.5) 0%,
						rgba(255, 255, 255, 0.9) 20%,
						rgba(255, 255, 255, 1) 100%);
				border-radius: 16rpx;

				.title {
					font-size: 34rpx;
				}

				.txt {
					margin-top: 20rpx;
					display: flex;
					align-items: center;

					image {
						width: 36rpx;
						height: 36rpx;
						margin: 0 8rpx;
					}

					text {
						font-size: 28rpx;
						color: #595959;
					}
				}
			}
		}

		.container-body {
			margin-top: 110rpx;
			padding: 0 24rpx;

			.center-box {
				background-color: #ffffff;
				padding: 10rpx 24rpx 50rpx;
				border-radius: 16rpx;

				.progress-box {
					display: flex;
					align-items: center;
					margin: 50rpx 0 30rpx;

					image {
						width: 38rpx;
						height: 38rpx;
					}

					.title {
						margin: 0 10rpx 0 4rpx;
						font-size: 34rpx;
					}

					.txt {
						font-size: 28rpx;
						color: #595959;
					}
				}

				.progress {
					display: flex;
					align-items: center;

					text {
						font-size: 26rpx;
						margin-left: 12rpx;
					}
				}
			}

			.list {
				padding: 20rpx;
				background-color: #ffffff;
				border-radius: 16rpx;
				display: flex;
				justify-content: space-between;
				align-items: center;
				box-sizing: border-box;
				margin-top: 20rpx;

				.img-box {
					width: 240rpx;
					height: 150rpx;
					border-radius: 16rpx;
					overflow: hidden;
					position: relative;

					.sub {
						background-color: rgba(0, 0, 0, 0.8);
						padding: 4rpx 16rpx;
						color: #ffffff;
						position: absolute;
						top: 0;
						left: 0;
						font-size: 24rpx;
						border-radius: 8rpx;
					}

					image {
						width: 100%;
						height: 100%;
					}
				}

				.right {
					height: 150rpx;
					margin-left: 20rpx;
					flex: 1;
					display: flex;
					flex-direction: column;
					justify-content: space-between;

					.title {
						font-size: 30rpx;
						font-weight: 500;
					}

					.bottom {
						display: flex;
						// flex-direction: column;
						justify-content: space-between;
						align-items: center;
						font-size: 26rpx;

						.tip {
							background: linear-gradient(to right, #fcecd0, #ffffff);
							padding: 8rpx 12rpx;
							border-radius: 22rpx;
							color: #f2931d;

							image {
								width: 36rpx;
								height: 36rpx;
								margin-right: 4rpx;
							}

							text {}
						}

						.btn {
							background-color: #fdf0e7;
							padding: 8rpx 16rpx;
							color: #f38600;
							border-radius: 12rpx;
						}
						.btn-red{
							background-color:#ff512f;
							padding: 8rpx 18rpx;
							color: #ffffff;
							border-radius: 12rpx;
						}
					}
				}

			}
		}
	}
</style>