<template>
	<view class="container">
		<view class="chat-box">
			<view class="header-box">
				<view class="icon-box">
					<cover-image class="icon" :src="`/static/images/chat-icon/${chat.type}.png`"></cover-image>
				</view>
				<view class="title-box">
					{{chat.title}}
				</view>
			</view>
			<view class="main-box">
				{{chat.content}}
			</view>
		</view>
	</view>
</template>

<script setup>
	import { ref } from 'vue'
	import { onLoad } from '@dcloudio/uni-app'
	
	const chatId = ref()
	const chatTitle = ref('')
	
	const chat = ref({
		id: '1',
		title: '课程提醒',
		content: '尊敬的用户，您预约2023年8月16日《广州市存量房网……》直播课堂已经开始，请及时观看！',
		type: 'jiaoyu',
		time: '8/16',
	})
	
	onLoad((load) => {
		chatId.value = load.id
		chatTitle.value = load.title
		uni.setNavigationBarTitle({
			title: chatTitle.value
		})
	})
</script>

<style lang="scss" scoped>
	.container {
		height: 100vh;
		width: 100vw;
		background-color: $uni-bg-color;
		padding: 0 40rpx;
		
		.chat-box {
			padding: 20rpx;
			background-color: $uni-text-color-inverse;
			margin-bottom: 30rpx;
			border-radius: $uni-card-border-radius;
			&:active {
				background-color: $uni-bg-color-hover;
			}
			.header-box {
				display: flex;
				align-items: center;
				margin-bottom: 10rpx;
				.icon-box {
					width: 50rpx;
					.icon {
						width: 35rpx;
						height: 35rpx;
					}
				}
				.title-box {
					font-size: $uni-title-font-size-2;
					font-weight: bolder;
				}
			}
			.main-box {
				padding: 10rpx;
				padding-bottom: 0;
				font-size: $uni-font-size-1;
				font-weight: bold;
				line-height: 40rpx;
			}
		}
	}
</style>