<template>
	<view class="container">
		<view class="top">
			<text class="title">
			  <text class="title-brown-group">
			    <text class="title-stroke">健康生活方式</text>
			    <text class="title-fill">健康生活方式</text>
			  </text>
			  <text class="title-normal">大讲堂</text>
			</text>
			<image class="top-bg" src="https://cos.his.cdwjyyh.com/fs/20250807/52f5aa7d5c5448e3a64efed9e6a77c85.png"></image>
			<view class="txt">
				<view>让健康回归生活化,</view>
				<view>以健康的生活方式,</view>
				<view>改善健康困扰，重拾晚年幸福!</view>
			</view>
		</view>
		<view class="container-body">
			<image class="bg" src="https://cos.his.cdwjyyh.com/fs/20250807/876f5e84355241d8911180159d5f8ad5.png"></image>
			<view class="title-wrap">
			  <text class="title-stroke">健康大讲堂</text>
			  <text class="title-fill">健康大讲堂</text>
			</view>
			<view class="card-box" v-for="(item,index) in cardList" :key="index" @click="goLearn(item.courseId)">
				<view class="bar">
					<image src="https://cos.his.cdwjyyh.com/fs/20250807/a5db6bc9d11d49eca182a0086297b54b.png" mode="widthFix"></image>
					<view class="tit">{{item.courseName}}</view>
				</view>
				<view class="img-box">
					<view class="img">
						<image :src="item.imgUrl || 'https://cos.his.cdwjyyh.com/fs/20250807/1eebee6c3bff4fd68d1d3dde090bdf89.png'" mode="widthFix"></image>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {getAppletCourse} from '@/api/course.js'
	export default {
		data() {
			return {
				type:null,
				cardList: [],
				classListb:[]
			}
		},
		onLoad(option) {
			this.getCourseList()
		},
		methods: {
			getCourseList() {
				getAppletCourse().then(res => {
					if (res.code == 200) {
						this.cardList = res.data
					} else {
						uni.hideLoading();
						uni.showToast({
							title: res.msg,
							icon: 'none'
						});
					}
				})

			},
			goLearn(id) {
				uni.navigateTo({
					url: '/pages_course/learn?courseId='+id
				})
			},
		}
	}
</script>
<style>
	page{
		background-color: #f6e5db;
	}
</style>
<style lang="scss" scoped>
	.container {
		.top {
			position: relative;
			z-index: 1;
			font-size: 78rpx;
			font-weight: 900;
			text-align: center;
			padding: 34rpx 0;
			.title {
			  	background: linear-gradient(to right, #333032, #5f3b32);
			  	-webkit-background-clip: text;
			  	background-clip: text;
			  	-webkit-text-fill-color: transparent;
			  	position: relative;
			  	z-index: 2;
			}
			
			/* 2. 双层渐变描边组合 */
			.title-brown-group {
			  position: relative;
			  display: inline-block;
			  line-height: 1;
			}
			
			.title-stroke {
			  position: absolute;
			  top: 0;
			  left: 0;
			  z-index: 1;
			  color: #fff;
			  -webkit-text-stroke: 4rpx #fff;
			  text-shadow: 2rpx 2rpx 4rpx rgba(183, 94, 52, 0.5);
			}
			
			.title-fill {
			  position: relative;
			  z-index: 2;
			  color: transparent;
			  background: linear-gradient(to bottom, #c47243, #b0592a);
			  -webkit-background-clip: text;
			  background-clip: text;
			  -webkit-text-fill-color: transparent;
			}

			.top-bg {
				position: absolute;
				top: 0;
				left: 0;
				width: 100%;
				z-index: 0;
			}

			.txt {
				font-style: italic;
				text-align: left;
				color: #fff;
				font-size: 36rpx;
				font-weight: 500;
				position: absolute;
				left: 8%;
				top: 172rpx;
				text-shadow:
					0 0 1rpx #b0663c,
					1rpx 1rpx 10rpx rgba(183, 0, 3, 0.3);
			}
		}

		.container-body {
			margin-top: 250rpx;
			min-height: calc(100vh - 250rpx);
			padding: 50rpx 24rpx;
			display: flex;
			flex-direction: column;
			align-items: center;
			position: relative;
			z-index: 1;

			.bg {
				position: absolute;
				top: 0;
				left: 0;
				width: 100%;
				height: 100%;
				object-fit: cover;
				z-index: -1;
			}

			.title-wrap{
			  position: relative;
			  display: inline-block;
			  font-size: 70rpx;
			  font-weight: 900;
			  line-height: 1;          /* 防止上下空隙 */
			}
			
			/* 下层：白描边 + 投影 */
			.title-stroke{
			  position: absolute;
			  top: 0;
			  left: 0;
			  z-index: 1;
			  color: #fff;                           /* 描边色 */
			  -webkit-text-stroke: 2rpx #fff;
			  text-shadow: 2rpx 2rpx 4rpx rgba(183,94,52,.5);
			}
			
			/* 上层：干净渐变填充 */
			.title-fill{
			  position: relative;
			  z-index: 2;
			  color: transparent;
			  background: linear-gradient(to bottom, #c47243, #b0592a);
			  -webkit-background-clip: text;
			  background-clip: text;
			  -webkit-text-fill-color: transparent;
			}

			.card-box {
				width: 100%;
				margin-top: 30rpx;

				.bar {
					position: relative;

					image {
						position: absolute;
						width: 100%;
						height: 100%;
						z-index: -1;
					}

					.tit {
						text-align: center;
						line-height: 90rpx;
						color: #fff;
						font-weight: 500;
						font-size: 36rpx;
					}
				}

				.img-box {
					margin-top: -8rpx;
					padding: 24rpx;
					background-color: #fff;
					border-radius: 0 0 20rpx 20rpx;

					.img {

						max-height: 380rpx;
						overflow: hidden;
						border-radius: 20rpx;

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

			}
		}

	}
</style>