<template>
	<view class="container">
		<view class="list-box">
			<view class="list-item-box" v-for="item in list" :key="item.id">
				<view class="header-box">
					<view class="icon-box">
						<cover-image class="icon" :src="`/static/chat-icon/${item.type}.png`"></cover-image>
					</view>
					<view class="title-box">
						{{item.title}}
					</view>
				</view>
				<view class="main-box">
					{{item.content}}
				</view>
			</view>
		</view>
	</view>
</template>

<script setup>
	import { ref } from 'vue'
	import { onLoad } from '@dcloudio/uni-app'
	
	const chatId = ref()
	const chatTitle = ref('')
	
	const list = ref([
		{
			id: '1',
			title: '课程提醒',
			content: '尊敬的用户,您预约2023年8月16日《广州市存量房网……》直播课堂已经开始,请及时观看!',
			type: 'jiaoyu',
			time: '8/16',
		},
		{
			id: '2',
			title: '课程提醒',
			content: '尊敬的用户,您预约2023年8月16日《xxxx》直播课堂已经开始,请及时观看!',
			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 20rpx;
		
		.list-box {
			padding: 0 20rpx;
			.list-item-box {
				padding: 20rpx;
				background-color: $uni-text-color-inverse;
				margin-bottom: 30rpx;
				border-radius: $uni-card-border-radius;
				.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>