<template>
	<view class="container">
		<view class="list-box">
			<view class="list-item-box" v-for="item in list" :key="item.id" @click="onGuideClick(item)">
				<view class="main-box">
					<view class="icon-box">
						<cover-image class="icon" :src="`/static/notice/22.png`"></cover-image>
					</view>
					<view class="content-box">
						<view class="title">
							{{item.title}}
						</view>
						<view class="text">
							{{item.content}}
						</view>
					</view>
					<view class="other-box">
						<view class="date">
							{{item.time}}
						</view>
					</view>
				</view>
				<view class="line-box"></view>
			</view>
		</view>
	</view>
</template>

<script setup>
	import { ref } from 'vue'
	import { onLoad } from '@dcloudio/uni-app'
	
	const uToast = ref()
	
	const searchInputStyle = {
		backgroundColor: '#E5E5E5'
	}
	const searchForm = ref({
		keyword: ''
	})
	const list = ref([
  {
    "id": "1",
    "title": "申请加入协会指南",
    "content": "想要加入我们的协会吗？请填写申请表并提交至办公室，审核后会通知您结果。",
    "time": "2023-10-01"
  },
  {
    "id": "2",
    "title": "报销流程说明",
    "content": "如需进行费用报销，请准备相关发票，填写报销申请表并交由财务部门审批。",
    "time": "2023-09-15"
  },
  {
    "id": "3",
    "title": "会议室预约流程",
    "content": "欲预约会议室，请访问协会官网填写预约表格，确认后将收到预约确认邮件。",
    "time": "2023-10-05"
  },
  {
    "id": "4",
    "title": "活动报名流程",
    "content": "参加活动需要提前报名，可以通过协会公众号扫码填写报名表，截止日期为活动前两天。",
    "time": "2023-10-10"
  },
  {
    "id": "5",
    "title": "投诉建议提交指引",
    "content": "若有意见或建议，请下载投诉建议表，填写完毕后发送至协会邮箱，我们将及时处理并反馈您的意见。",
    "time": "2023-10-12"
  }
]
)
	function onGuideClick(guide) {
		uni.navigateTo({
			url: `/pages/guide/guideDetail/guideDetail?id=${guide.id}&title=${guide.title}`
		})
	}
</script>

<style lang="scss" scoped>
	.container {
		height: 100vh;
		width: 100vw;
		background-color: $uni-bg-color;
		padding: 0 20rpx;
		
		.search-box {
			margin-bottom: 20rpx;
			::v-deep(.u-search) {
				background-color: #e5e5e5;
				border-radius: 50rpx;
				
				.u-action {
					width: 18%;
					background-color: $uni-color-primary;
					border-radius: 50rpx;
					color: $uni-text-color-inverse;
					margin-right: 8rpx;
					font-size: 28rpx;
					line-height: 50rpx;
					letter-spacing: 3rpx;
					text-align: center;
				}
			}
		}
	
		.list-box {
			padding: 0 20rpx;
			.list-item-box {
				.main-box {
					display: flex;
					justify-content: space-between;
					align-items: center;
					padding: 30rpx 0;
					
					&:active {
						background-color: $uni-bg-color-hover;
					}
					.icon-box {
						width: 15%;
						display: flex;
						justify-content: center;
						align-items: center;
						.icon {
							width: 70rpx;
							height: 70rpx;
						}
					}
					.content-box {
						width: 67%;
						display: flex;
						flex-direction: column;
						justify-content: space-around;
						gap: 10rpx;
						.title {
							height: calc(70% - 5rpx);
							font-size: $uni-title-font-size-2;
							font-weight: bold;
						}
						.text {
							height: calc(30% - 5rpx);
							font-size: $uni-font-size-3;
							color: $uni-text-color-grey;
							@include text-overflow();
						}
					}
					.other-box {
						width: 18%;
						display: flex;
						flex-direction: column;
						justify-content: space-around;
						align-items: center;
						gap: 10rpx;
						.date {
							font-size: $uni-font-size-3;
							color: $uni-text-color-grey;
						}
						.tag {
							font-size: $uni-font-size-3;
							width: 42rpx;
							background-color: $uni-color-error;
							color: $uni-text-color-inverse;
							border-radius: 20rpx;
							text-align: center;
						}
					}
				}
				.line-box {
					height: 1rpx;
					width: 80%;
					background-color: #E5E5E5;
					margin: 0 auto;
				}
			}
		}
	}
		
	
</style>
