<template>
	<view class="container">
		<view class="u-status-bar"></view>
		<view class="list-wrap">
			<view class="title-wrap">
				<view class="title">最近观看</view>
				<navigator class="more" url="/pages/watching_history/watching_history?type=3">更多</navigator>
			</view>
			<view class="list">
				<view class="item">
					<view class="cover">
						<image class="img" src="https://img0.baidu.com/it/u=966333451,3199467079&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=714" mode="aspectFill"></image>
						<view class="num">第三集</view>
					</view>
					<view class="intro-wrap">
						<view class="name">我在八十年代当后妈</view>
						<view class="t">言情</view>
					</view>
				</view>
				<view class="item">
					<view class="cover">
						<image class="img" src="https://img0.baidu.com/it/u=966333451,3199467079&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=714" mode="aspectFill"></image>
						<view class="num">第三集</view>
					</view>
					<view class="intro-wrap">
						<view class="name">我在八十年代当后妈</view>
						<view class="t">言情</view>
					</view>
				</view>
				<view class="item">
					<view class="cover">
						<image class="img" src="https://img0.baidu.com/it/u=966333451,3199467079&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=714" mode="aspectFill"></image>
						<view class="num">第三集</view>
					</view>
					<view class="intro-wrap">
						<view class="name">我在八十年代当后妈</view>
						<view class="t">言情</view>
					</view>
				</view>
				<view class="item">
					<view class="cover">
						<image class="img" src="https://img0.baidu.com/it/u=966333451,3199467079&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=714" mode="aspectFill"></image>
						<view class="num">第三集</view>
					</view>
					<view class="intro-wrap">
						<view class="name">我在八十年代当后妈</view>
						<view class="t">言情</view>
					</view>
				</view>
				<view class="item">
					<view class="cover">
						<image class="img" src="https://img0.baidu.com/it/u=966333451,3199467079&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=714" mode="aspectFill"></image>
						<view class="num">第三集</view>
					</view>
					<view class="intro-wrap">
						<view class="name">我在八十年代当后妈</view>
						<view class="t">言情</view>
					</view>
				</view>
			</view>
		</view>
		<view class="list-wrap">
			<view class="title-wrap">
				<view class="title">我的追剧</view>
				<navigator class="more" url="/pages/watching_history/watching_history?type=1">更多</navigator>
			</view>
			<view class="list">
				<view class="item">
					<div class="item-content">
						<view class="cover">
							<image class="img" src="https://img0.baidu.com/it/u=966333451,3199467079&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=714" mode="aspectFill"></image>
							<view class="num">第三集</view>
						</view>
						<view class="intro-wrap">
							<view class="name">我在八十年代当后妈</view>
							<view class="t">言情</view>
						</view>
					</div>
				</view>
			</view>
		</view>
	</view>
</template>

<script setup>
import { reactive } from 'vue';
import { selectByUserId } from '@/api/me/me.js';
import { onLoad, onPullDownRefresh, onReachBottom } from '@dcloudio/uni-app';

async function selectByUserIdAjax() {
	try {
		const res1 = await selectByUserId({ page: 1, limit: 6, classify: 3 });
		const res2 = await selectByUserId({ page: 1, limit: 6, classify: 6 });
		console.log(res1);
		console.log(res2);
	} catch (error) {
		console.log(error);
	}
}

const data = reactive({
	list1: [], // 最近观看
	list2: [] // 我的追剧
});

// 滚动到底部
onReachBottom(() => {});

// 监听下拉结束
onPullDownRefresh(() => {
	selectByUserIdAjax();
});

// 页面初始化
onLoad(() => {
	selectByUserIdAjax();
});
</script>

<style lang="scss">
page {
	background: #f5f7ff;
}
</style>
<style scoped lang="scss">
.container {
	color: #333;
	font-size: 28upx;
}
.list-wrap {
	margin-bottom: 40upx;
	.title-wrap {
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 28upx;
		.title {
			font-weight: bold;
			font-size: 32upx;
		}
		.more {
			color: #999;
		}
	}
	.list {
		display: grid;
		grid-template-columns: repeat(3, 1fr);
		grid-template-rows: repeat(auto, 1fr);
		grid-column-gap: 28upx;
		grid-row-gap: 28upx;
		padding: 0 28upx;
		.item {
			width: 100%;
			overflow: hidden;
			background-color: #fff;
			border-radius: 20upx;
			.cover {
				height: 200upx;
				position: relative;
				.img {
					width: 100%;
					height: 100%;
				}
				.num {
					padding: 4upx 16upx;
					border-radius: 8upx;
					background: rgba(0, 0, 0, 0.3);
					backdrop-filter: blur(5px);
					position: absolute;
					right: 8upx;
					bottom: 8upx;
					color: #fff;
					font-size: 24upx;
				}
			}
			.intro-wrap {
				padding: 20upx;
				.name {
					width: 180upx;
					overflow: hidden;
					text-overflow: ellipsis;
					white-space: nowrap;
					line-height: 32upx;
					font-weight: bold;
				}
				.t {
					color: #999;
					font-size: 24upx;
					margin-top: 8upx;
				}
			}
		}
	}
}
</style>
