<template>
	<home-frame @toPath="toPath">
		<view class="main">
			<view class="one">
				<view class="list" v-for="(item,index) in typeList" :key="index" @tap="typeChange(item,index)">
					<span :style="{background:tActive==index?'var(--rgbfa4)':''}" class="textOver">{{item.name}}</span>
				</view>
			</view>
			<view class="two">
				<view class="two_1">
					推荐
				</view>
				<view class="two_2">
					<view class="list" v-for="(item,index) in recomList" :key="index">
						<image class="image"
							:src="item.img_url&&item.img_url.length>0?item.img_url[0].url:'../../static/error.jpg'"
							mode="">
						</image>
						<span class="name" v-if="item.name">{{item.name}}</span>
					</view>
				</view>
				<view class="two_1">
					全部
				</view>
				<view class="two_2">
					<view class="list" v-for="(item,index) in list" :key="index">
						<image class="image"
							:src="item.img_url&&item.img_url.length>0?item.img_url[0].url:'../../static/error.jpg'"
							mode="">
						</image>
						<span class="name" v-if="item.name">{{item.name}}</span>
					</view>
				</view>
			</view>
		</view>
	</home-frame>
</template>

<script>
	import homeFrame from "../components/home-frame.vue";
	export default {
		components: {
			homeFrame
		},
		data() {
			return {
				typeList: [ // 类型信息
					{
						name: '平台'
					},
					{
						name: '演员'
					}
				],
				tActive: 0,
				recomList: [ //
					{
						name: '推荐信息',
						img_url: [ //
							{
								id: "20230216100918",
								name: "头像.jpg",
								status: "success",
								uid: 1676513358695,
								uri: "/files/projectadmin/imgurl/20230216100918.jpg",
								url: "http://47.93.34.200/files/projectadmin/imgurl/20230216100918.jpg"
							}
						]
					}, {
						name: '推荐信息',
						img_url: [ //
							{
								id: "20230216100918",
								name: "头像.jpg",
								status: "success",
								uid: 1676513358695,
								uri: "/files/projectadmin/imgurl/20230216100918.jpg",
								url: "http://47.93.34.200/files/projectadmin/imgurl/20230216100918.jpg"
							}
						]
					}, {
						name: '推荐信息',
						img_url: [ //
							{
								id: "20230216100918",
								name: "头像.jpg",
								status: "success",
								uid: 1676513358695,
								uri: "/files/projectadmin/imgurl/20230216100918.jpg",
								url: "http://47.93.34.200/files/projectadmin/imgurl/20230216100918.jpg"
							}
						]
					}, {
						name: '推荐信息',
						img_url: [ //
							{
								id: "20230216100918",
								name: "头像.jpg",
								status: "success",
								uid: 1676513358695,
								uri: "/files/projectadmin/imgurl/20230216100918.jpg",
								url: "http://47.93.34.200/files/projectadmin/imgurl/20230216100918.jpg"
							}
						]
					}, {
						name: '推荐信息',
						img_url: [ //
							{
								id: "20230216100918",
								name: "头像.jpg",
								status: "success",
								uid: 1676513358695,
								uri: "/files/projectadmin/imgurl/20230216100918.jpg",
								url: "http://47.93.34.200/files/projectadmin/imgurl/20230216100918.jpg"
							}
						]
					}, {
						name: '推荐信息',
						img_url: [ //
							{
								id: "20230216100918",
								name: "头像.jpg",
								status: "success",
								uid: 1676513358695,
								uri: "/files/projectadmin/imgurl/20230216100918.jpg",
								url: "http://47.93.34.200/files/projectadmin/imgurl/20230216100918.jpg"
							}
						]
					}
				],
				list: [ //
					{
						name: '推荐信息',
						img_url: [ //
							{
								id: "20230216100918",
								name: "头像.jpg",
								status: "success",
								uid: 1676513358695,
								uri: "/files/projectadmin/imgurl/20230216100918.jpg",
								url: "http://47.93.34.200/files/projectadmin/imgurl/20230216100918.jpg"
							}
						]
					},
				],
			};
		},
		onLoad() {

		},
		onShow() {

		},
		methods: {
			// 类型选择
			typeChange(e, index) {
				const that = this;
				that.$set(that, `tActive`, index)
			},
			// 跳转页面
			toPath(e) {
				let url = `/${e.route}`;
				if (e.type == '0') uni.navigateTo({
					url
				})
				else if (e.type == '1') uni.redirectTo({
					url
				})
				else if (e.type == '2') uni.reLaunch({
					url
				})
				else if (e.type == '3') uni.switchTab({
					url
				})
			}
		},
	};
</script>

<style lang="scss">
	.main {
		background-color: var(--rgb111);
		display: flex;
		flex-direction: row;
		width: 96vw;
		height: 92vh;
		padding: 0 2vw;

		.one {
			width: 24vw;
			color: var(--rgbfff);
			margin: 0 10px 0 0;
			background-color: var(--rgb000);
			overflow-y: auto;

			.list {
				span {
					display: inline-block;
					width: 100%;
					height: 40px;
					line-height: 40px;
					text-align: center;
					font-size: 14px;
				}
			}

		}

		.two {
			flex-grow: 1;
			color: var(--rgbfff);
			background-color: var(--rgb000);
			padding: 0 2vw;
			overflow-y: auto;

			.two_1 {
				padding: 1vw 0;
			}

			.two_2 {
				display: flex;
				justify-content: space-between;
				flex-wrap: wrap;
				position: relative;

				.list {
					width: 30%;
					position: relative;
					margin: 0 0 10px 0;

					.image {
						width: 100%;
						height: 70px;
						border-radius: 5px;
					}

					.name {
						position: absolute;
						bottom: 10px;
						width: 100%;
						text-align: center;
						left: 0;
						color: var(--rgb000);
						font-size: 12px;
					}
				}
			}
		}
	}
</style>
