<template>
	<view class="feed">
		<view class="item" v-for="(a,i) in list" :key="i" @click="toPage(a)">
			<view class="fl">
				<view class="title">{{a.content}}</view>
				<view class="desc">{{a.createTime}}</view>
			</view>
			<view class="fr">
				<image src="@/static/icon-arrow.png"></image>
			</view>
		</view>
		<view class="empty" v-if="isShow">
			<image src="@/static/empty.png"></image>
			<view class="txt">暂无数据</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [],
				isShow: false
			};
		},
		onLoad() {
			this.getList();
		},
		methods: {
			toPage(a) {
				uni.setStorageSync("pcontent",a);
				uni.navigateTo({
					url: "/pages/users/feedback/detail"
				})
			},
			async getList() {
				const {code,data} = await this.$api.feedbackList({
					userId: uni.getStorageSync("userInfo").id
				})
				if(code == 200){
					this.isShow = data.length == 0?true:false;
					this.list = data;
				}
			}
		},
	}
</script>

<style scoped lang="scss">
.feed{
	padding: 0 25rpx 25rpx;
	overflow: hidden;
	.empty{
		padding: 150rpx 0;
		text-align: center;
		font-weight: 500;
		font-size: 28rpx;
		color: #222222;
		image{
			display: block;
			width: 460rpx;
			height: 400rpx;
			margin: 0 auto;
		}
	}
	.item{
		height: 150rpx;
		background: #FFFFFF;
		border-radius: 20rpx;
		padding: 30rpx;
		box-sizing: border-box;
		display: flex;
		align-items: center;
		justify-content: space-between;
		margin-top: 20rpx;
		.fl{
			flex: 1;
			max-width: 600rpx;
			.title{
				font-weight: 500;
				font-size: 30rpx;
				color: #333333;
				text-overflow: ellipsis;
				white-space: nowrap;
				overflow: hidden;
			}
			.desc{
				font-weight: 500;
				font-size: 24rpx;
				color: #999999;
				margin-top: 10rpx;
			}
		}
		.fr{
			image{
				width: 40rpx;
				height: 40rpx;
			}
		}
	}
}
</style>
