<template>
	<div class="view">
		<z-paging ref="paging" v-model="data" @query="queryList">
		<div class="a_msg" v-for="(item,index) in data" :key="index">
			<div class="time">{{item.create_time | filterCount}}</div>
			<div class="card" @click="toDetail(item.content)">
				<div class="title">{{item.title}}</div>
				<div class="content">{{item.desc}}</div>
				<!-- <u-parse class="content" :content="item.content"></u-parse> -->
			</div>
		</div>
		</z-paging>
	</div>
</template>

<script>
	// import timesfm from `../`
	export default {
		data() {
			return {
				data: [],
			}
		},
		onShow() {
			this.$api.sendRequest({
				url:`/api/notice/page`,
				data:{},
				success:res=>{
					// console.log(res,'系统公告');
					this.data=res.data.list
				}
			})
		},
		methods:{
			queryList(pageNo, pageSize) {
				this.$api.sendRequest({
					url:`/api/notice/page`,
					data:{
						page:pageNo,
						page_size: pageSize,
					},
					success:res=>{
						// console.log(res,'系统公告');
						this.$refs.paging.complete(res.data.list);
					}
				})
				
			},
			toDetail(toDetail) {
				// console.log(toDetail);
				setTimeout(()=>{
					uni.$emit('toDetail',toDetail)
				},500)
				uni.navigateTo({
					url:'/page_salesman_index/index/system_msg/sys_msg_detail'
				})
			}
		},
		filters: {
			filterCount(num) {
				let now=new Date(num)
				let n=now.getFullYear()
				let y=now.getMonth()+1
				let r =now.getDate();
				let s=now.getHours()>=10?now.getHours():0+''+now.getHours();
				let f=now.getMinutes()>=10?now.getMinutes():0+''+now.getMinutes();
				let m=now.getSeconds()>=10?now.getSeconds():0+''+now.getSeconds();
				return n+'-'+y+'-'+r+' '+s+'-'+f+'-'+m
			}
		},
	}
</script>

<style lang="scss" scoped>
	.a_msg {
		margin-top: 32rpx;
		.time {
			text-align: center;
			margin-bottom: 24rpx;
		}
		.card{
			max-height: 218rpx;
			background: #FFFFFF;
			border-radius: 16rpx;
			overflow: hidden;
			margin: 36rpx 24rpx;
			box-sizing: border-box;
			padding: 24rpx 32rpx;
			 
			
			.title {
				
				font-size: 32rpx;
				font-family: PingFangSC-Semibold, PingFang SC;
				font-weight: 600;
				color: #222222;
			}
			.content {
				margin-top: 16rpx;
				height: 102rpx;
				font-size: 24rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #999999;
				line-height: 34rpx;
				
				overflow:hidden;
				text-overflow: ellipsis;
				-webkit-line-clamp: 3;
				display: -webkit-box;
				-webkit-box-orient: vertical;
			}
		}
	}
</style>