<template>
	<view class="container">
		<u-navbar leftIconColor="#fff" titleStyle="color:#fff;fontSize:36rpx;" :autoBack="true" bgColor="#2C6FF3"
			:placeholder="true" title="接口日志"></u-navbar>
		<scroll-view scroll-y="true" scroll-with-animation="true" lower-threshold="100">
			<view class="log-item" v-for="(item,index) in logs" :key="index">
				<view class="logs">
					<view class="name">请求时间</view>
					<view class="val">{{item.time}}</view>
				</view>
				<view class="logs">
					<view class="name">请求路径</view>
					<view class="val">{{item.url}}</view>
				</view>
				<view class="logs">
					<view class="name">请求参数</view>
					<view class="val">{{item.params}}</view>
				</view>
				<view class="logs">
					<view class="name">返回结果</view>
					<view class="val">{{item.res}}</view>
				</view>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				logs: []
			}
		},
		onLoad(o) {
			if (uni.getStorageSync('logs')) {
				this.logs = JSON.parse(uni.getStorageSync('logs'))
			}
		},
		methods: {

		},
	}
</script>

<style scoped lang="scss">
	.container {
		padding: 24rpx;
		line-height: 50rpx;

		.text {
			color: #2C6FF3;
		}

		.log-item {
			width: 702rpx;
			margin-bottom: 50rpx;

			.logs {
				overflow: hidden;
				width: 100%;
			}

			.name {
				float: left;
				margin-right: 24rpx;
				width: 20%;
				color: gray;
			}

			.val {
				float: left;
				word-wrap: break-word;
				word-break: break-all;
				width: 76%;
			}
		}
	}
</style>