<template>
	<view class="complaints">
		<scroll-view scroll-y @scrolltolower="reachBottom">
			<view class="complaints-box" v-for="item in feedbackList" :key="item.fb_id">
				<view class="suggestions">
					<view class="text">{{ item.fb_content }}</view>
					<view class="image">
						<image v-for="(url, index) in item.fb_images" :key="index" :src="url"></image>
					</view>
				</view>
				<view class="reply" v-if="item.is_reply">
					<view class="reply-title">后台回复：</view>
					<view class="reply-content u-line-4">{{ item.reply_content }}</view>
				</view>
				<view class="date">
					<image src="../static/mine/26.png"></image>
					<view>{{ item.fb_time }}</view>
				</view>
			</view>
			<u-empty text="暂无意见" mode="list" color="#000000" icon-size="90" margin-top="300" v-if="!feedbackList.length"></u-empty>
		</scroll-view>
	</view>
</template>
<script>
export default {
	data() {
		return {
			feedbackList: [],
			page: 1, // 默认1
		}
	},
	onNavigationBarButtonTap() {
		uni.navigateTo({
			url: '/pageE/more/WriteComments'
		});
	},
	onShow() {
		this.getFeedbackList();
	},
	methods: {
		getFeedbackList() {
			this.$u.api.getFeedbackList({ page: this.page }).then(res => {
				if(res.errCode == 0) {
					this.feedbackList = res.data.feedbackList;
				}
			})
		},
	},
}
</script>
<style lang="scss" scoped>
.complaints {
	min-height: calc(100vh - var(--window-top));
	background-color: #ECECEC;
	padding-top: 1rpx;
	.complaints-box {
		padding: 30rpx;
		background-color: #ffffff;
		margin-bottom: 20rpx;
		.suggestions {
			.text {
				font-size: 26rpx;
				color: rgba(51,51,51,1);
				margin-bottom: 25rpx;
				line-height: 36rpx;
			}
			.image {
				display: flex;
				flex-wrap: wrap;
				> image {
					width: 210rpx;
					height: 210rpx;
					flex-shrink: 0;
					border-radius: 10rpx;
					margin-bottom: 10rpx;
					&:not(:nth-child(3n)) {
						margin-right: 30rpx;
					}
				}
			}
		}
		.reply {
			width: 690rpx;
			height: 224rpx;
			background: rgba(240,238,238,1);
			border-radius: 10rpx;
			padding: 20rpx;
			font-size: 24rpx;
			color: rgba(102,102,102,1);
			margin: 20rpx 0;
			.reply-title {
				margin-bottom: 16rpx;
			}
			.reply-content {
				line-height: 36rpx;
			}
		}
		.date {
			display: flex;
			align-items: center;
			> image {
				width: 28rpx;
				height: 28rpx;
				margin-right: 12rpx;
				flex-shrink: 0;
			}
			> view {
				font-size: 24rpx;
				color: rgba(153,153,153,1);
			}
		}
	}
}
</style>