<template>
	<view class="notice">
		<view class="List" v-for="(item,index) in noticeList" :key="item.index">
			<!-- 头像 -->
			<view class="left">
				<image src="../../static/notice-icon.png" mode=""></image>
			</view>
			<!-- 通知内容 -->
			<view class="right">

				<view class="top">
					<text class="title">系统通知</text>
					<text class="time">{{item.createTime}}</text>
				</view>
				<view class="btm">
					<text class="btmtxt">{{item.content}}</text>
				</view>
			</view>
		</view>

	</view>
</template>

<script>
	
	import {listMsg} from "@/api/msg/index.js";
	
	export default {
		data() {
			return {
				// 通知内容列表
				noticeList: [
				],
			}
		},
		onShow() {
			this.listMsg();
		},
		methods: {
			async listMsg(){
				uni.showLoading({
					mask:true,
					title:"加载中"
				});
				let res = await listMsg();
				uni.hideLoading();
				if(res.code == 200){
					this.noticeList = [...res.rows];
					console.log(this.noticeList);
				}
			}
		}
	}
</script>

<style lang="less" scoped>
	.List {
		display: flex;
		align-items: center;
		width: 100%;
		height: 120rpx;
		border-bottom: 1px solid #EDEDED;

		padding: 80rpx 40rpx;

		// 头像
		.left {
			width: 120rpx;
			height: 120rpx;
			margin-top: 20rpx;
			border-radius: 50%;

			image {
				width: 100rpx;
				height: 100rpx;
			}
		}

		// 通知内容
		.right {
			margin-top: 50rpx;
			width: 550rpx;
			height: 120rpx;
			padding-left: 20rpx;
			

			.top {
				display: flex;
				justify-content: space-between;

				.title {
					font-size: 36rpx;
					font-weight: bold;
					margin-bottom: 10rpx;
				}

				.time {
					color: #888889;
				}

			}

			.btm {
				overflow: hidden;
				text-overflow: ellipsis;
				white-space: nowrap;

				margin-top: 10rpx;
				width: 500rpx;
				height: 80rpx;

				.btmtxt {
					color: #888889;
				}
			}
		}


	}
</style>