<template>
	<view class="bookInfo_content">
		<view class="container">
			<view class="container__book-cover">
				<image class="image" :src="book_data.book_cover" mode="aspectFit"></image>
			</view>
			<view class="container__info">
				<view class="container__info__book-name">
					{{ book_data.book_name }}
				</view>
				<view class="container__info__author-name">
					{{ book_data.author_name }}
				</view>
				<view class="container__info__category-name">
					{{book_data.category_name + ' · '}}{{category_string}}
				</view>
				<view class="container__info__bottom-info">
					<view class="container__info__bottom-info__read-number">
						{{util.convertUnit(book_data.book_read_num)}}人在读
					</view>
					<view class="container__info__bottom-info__score">
						<view class="container__info__bottom-info__score__number">
							{{book_data.book_score}}
						</view>
						<view class="container__info__bottom-info__score__unit">分</view>
					</view>
				</view>
			</view>
		</view>
		
	</view>
</template>

<script setup lang="ts">
    import { ref } from 'vue';
    import { util } from '../../framework/util';
	const props = defineProps({
		book_data: Object,
	})
	let category_string = ref('')
	category_string.value = props.book_data.book_is_action==1?`完结`:`连载至${props.book_data.chapter_count}章`
	let rate = ref(props.book_data.book_score/2)
</script>

<style lang="scss">
	.bookInfo_content{
		display: flex;
		flex-direction: column;
		background-color: $uni-theme-color;
		
		.container{
			display: flex;
			flex-direction: row;
			padding: 40rpx 20rpx 30rpx 20rpx;
			
			&__book-cover{
				flex-shrink: 0;
				width: 200rpx;
				height: 250rpx;
				.image{
					width: 100%;
					height: 100%;
				}
			}
			&__info {
				display: flex;
				width: 100%;
				flex-direction: column;
				margin-left: 20rpx;
				// background-color: green;
				
				&__book-name {
					margin-top: 2rpx;
					font-size: 22px;
				}
				&__author-name {
					margin-top: 18rpx;
					font-size: 17px;
					color: #894D4D;
				}
				&__category-name {
					margin-top: 18rpx;
					font-size: 16px;
					color: #323232;
				}
				&__bottom-info{
					margin-top: 13rpx;
					margin-right: 40rpx;
					display: flex;
					flex-direction: row;
					justify-content: space-between;
					align-items: center;
					// background-color: green;
					&__read-number {
						font-size: 16px;
						color: #323232;
					}
					&__score {
						display: flex;
						flex-direction: row;
						&__number {
							font-size: 24px;
							font-weight: 480;
							color: #323232;
						}
						&__unit{
							margin-top: 26rpx;
							margin-left: 5rpx;
							font-size: 11px;
							color: #323232;
						}
					}
				}
			}
		}
		
	}
</style>