<template>
	<view class="book-V-3-content">
		<view class="title-content">
			<view class="title-content__title" >{{templateData.name}}</view>
			<view class="title-content__look-more" @click="clickLookMore">
				<!-- <image class="image" src="../../../static/imgs/bookstore/img_look_more.png" mode="aspectFit"></image> -->
			</view>
		</view>
		<view class="book-content">
			<view class="book-content__box" v-for="(item,index) in templateData.list" :key="index"
			@click="clickBook(item,index)">
			    <view class="book-content__box__book-cover">
			    	<image class="image" :src="item.book_cover" mode="aspectFill"></image>
			    </view>
				<view class="book-content__box__book-info">
					<view class="book-content__box__book-info__name">
						{{item.book_name}}
					</view>
					<view class="book-content__box__book-info__info1">
						<view class="book-content__box__book-info__info1__author">
							{{item.author_name}}  著 | {{util.convertUnit(item.book_read_num)}}人读过
						</view>
						<view class="book-content__box__book-info__info1__status">
							<image class="image" v-if="item.book_is_action==1"  src="../../../static/imgs/public/img_status_bg_2.png" mode="aspectFit"></image>
							<image class="image" v-else src="../../../static/imgs/public/img_status_bg_3.png" mode="aspectFit"></image>
							<view class="book-content__box__book-info__info1__status__name">
								{{item.book_is_action==1?"完结":"连载"}}
							</view>
						</view>
					</view>
					<view class="book-content__box__book-info__brief">
					    {{item.book_brief}}
					</view>
					<view class="book-content__box__book-info__info2">
						<view class="book-content__box__book-info__info2__chapter-count">
							{{item.chapter_count}}章
						</view>
						<view class="book-content__box__book-info__info2__update-time">
							{{util.convertTimeString(item.chapter_time_time)}}更新
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script setup lang="ts">
    import { book_item_data } from '../../../data/data';
    import { tools } from '../../../framework/tools';
    import { util } from '../../../framework/util';
	
	const props = defineProps({
		templateData: Object,
	})
	const emits = defineEmits(['clickBook'])
	
	function clickLookMore() {
		// console.log(props.templateData)
		// tools.gotoSeeMore(props.templateData.id)
	}
	
	function clickBook(data:book_item_data) {
		emits('clickBook',data)
	}
</script>

<style lang="scss">
	.book-V-3-content{
		display: flex;
		flex-direction: column;
		margin: 0px 20rpx;
		margin-bottom: 30rpx;
		padding: 20rpx 0;
		border-radius: 20rpx;
		box-shadow: 0 0 5px 1px rgba(0, 0, 0, 0.1);
		background-color: #ffffff;
		
		.title-content {
			display: flex;
			flex-direction: row;
			justify-content: space-between;
			align-items: center;
			margin: 20rpx 0;
			margin-left: 30rpx;
			
			&__title {
				font-size: 20px;
				font-weight: 500;
			}
			&__look-more{
				display: flex;
				flex-shrink: 0;
				width: 128px;
				height: 48px;
				align-items: center;
				// background-color: green;
				.image{
					width: 100%;
					height: 100%;
				}
			}
		}
		
		.book-content{
			display: flex;
			flex-direction: column;
			margin-top: 10rpx;
			// background-color: red;
			
			&__box{
				display: flex;
				flex-direction: row;
			    margin-bottom: 30rpx;
				padding: 0 20rpx;
				// background-color: green;
				&__book-cover{
					width: 194rpx;
					height: 259rpx;
					flex-shrink: 0; //设置flex元素所有比例.默认是1,为0的时候不进行缩放
					.image {
						width: 100%;
						height: 100%;
					}
				}
				&__book-info{
					display: flex;
					flex-direction: column;
					margin-left: 20rpx;
					width: 100%;					
					// background-color: red;
					&__name{
						margin-top: 10rpx;
						display: -webkit-box;
						align-items: center;
						-webkit-line-clamp: 1;
						-webkit-box-orient: vertical;
						overflow: hidden;
						text-overflow: ellipsis;
						font-size: 18px;
					}
					&__info1 {
						display: flex;
						flex-direction: row;
						justify-content: space-between;
						align-items: center;
						margin-top: 15rpx;
						// background-color: red;
						&__author{
							display: -webkit-box;
							-webkit-line-clamp: 1;
							-webkit-box-orient: vertical;
							overflow: hidden;
							text-overflow: ellipsis;
							font-size: 13px;
							color: #6F6F6F;
						}
						&__status{
							flex-shrink: 0; //设置flex元素所有比例.默认是1,为0的时候不进行缩放
							width: 162rpx;
							height: 48rpx;
							position: relative;
							display: flex;
							justify-content: center;
							align-items: center;
							.image {
								width: 100%;
								height: 100%;
							}
							&__name{
								position: absolute;
								font-size: 14px;
								color: #ffffff;
							}
						}
						
					}
					&__brief{
						margin-top: 15rpx;
						display: -webkit-box;
						font-size: 13px;
						color: #6F6F6F;
						-webkit-line-clamp: 2;
						-webkit-box-orient: vertical;
						overflow: hidden;
						text-overflow: ellipsis;
					}
					&__info2{
						margin-top: 15rpx;
						display: flex;
						justify-content: space-between;
						font-size: 13px;
						color: #6F6F6F;
						&__chapter-count {
							
						}
						&__update-time {
							
						}
					}
				}
				
			}
		}
	}
	
</style>