<template>
	<view class="announcement">
		<view @click="itemClick(item,index)" v-for="(item,index) in  list " :key="index" class="announcement-item">
			<view class="announcement-item-title">

				<view class="announcement-item-title-left">
					{{item.title}}
				</view>

				<view :style="`color:${item.is_read  ? '#05CCA1':'#FDAB45'};`" class="announcement-item-title-right">
					<view v-if="!item.is_read" class="announcement-item-title-right-color">

					</view>
					<uni-icons v-else type="checkmarkempty" color="#05CCA1" size="16"></uni-icons>
					{{item.is_read ? '已读' :'未读'}}
				</view>
			</view>
			<view class="announcement-item-content">
				{{item.content}}
			</view>
			<view class="announcement-item-date">
				发布时间 {{item.created_at}}
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "Announcement",
		props: {
			list: {
				type: Array,
				default: () => []
			}
		},
		data() {
			return {

			};
		},
		methods: {
			itemClick(item) {
				this.$emit('itemClick', item)
			}
		}
	}
</script>

<style lang="scss" scoped>
	.announcement-item-title-left {
		 width: 500rpx;
	}
	.announcement {
		width: 100%;
		box-sizing: border-box;
	}

	.announcement-item {
		width: 100%;
		box-sizing: border-box;
		padding: 32rpx;
		background-color: #fff;
		border-radius: 5.33px;
		box-shadow: 0px 0px 6.67px 0px rgba(147, 147, 147, 0.20);
		margin-bottom: 32rpx;

		.announcement-item-content {
			padding: 24rpx 0;
			color: #666;
		}

		.announcement-item-date {
			color: #999;
			font-size: 24rpx;
		}

		.announcement-item-title {
			display: flex;
			justify-content: space-between;
			align-items: center;
			padding-bottom: 24rpx;
			border-bottom: 1px solid #f2f2f2;

			.announcement-item-title-right {
				display: flex;
				align-items: center;

				.announcement-item-title-right-color {
					width: 16rpx;
					height: 16rpx;
					border-radius: 50%;
					margin-right: 10rpx;
					background-color: #FDAB45;
				}
			}
		}
	}
</style>