<template>
	<view class="content">
		<view class="list">
			<view class="list-item" v-for="(item,index) in list" :key="index">
				<view class="time">{{item.time}}</view>
				<view class=" hflex acenter jbetween">
					<image :src="other_user.avatar" style="margin-right: 12rpx;" mode="aspectFill"
						v-if="item.id == other_user.id"></image>
					<view v-else style="width: 68rpx;"></view>
					<view class="text" :style="item.id == user.id ? 'background: #00B0B0;color: #FFFFFF' : ''">
						{{item.content}}
					</view>
					<image :src="user.avatar" style="margin-left: 12rpx;" mode="aspectFill" v-if="item.id == user.id">
					</image>
					<view v-else style="width: 68rpx;"></view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import $api from '@/static/js/api.js'
	export default {
		data() {
			return {
				user: {},
				other_user: {},
				chat_user_id: '',
				userid: '',
				list: [],
				text: '',
				show_menu: false,
				page: 1,
				last_page: 1
			}
		},
		onLoad(option) {
			this.chat_user_id = option.id
			this.userid = uni.getStorageSync('userid')
			this.getlist()
		},
		onShow() {

		},
		onPullDownRefresh() {

		},
		onReachBottom() {

		},
		methods: {
			getlist() {
				var that = this
				$api.req({
					url: 'chat/detail',
					data: {
						is_page: 0,
						chat_user_id: that.chat_user_id
					}
				}, function(res) {
					that.list = res.data
				})
			}
		}
	}
</script>

<style lang="scss">
	.content::v-deep {
		background: #FFFFFF;
		padding: 20rpx 28rpx;

		.u-nav-right {
			position: relative;

			.menu {
				position: absolute;
				right: 0;
				top: 56rpx;
				width: 188rpx;
				height: 144rpx;
				background: #FFFFFF;
				box-shadow: 0rpx 4rpx 20rpx -4rpx rgba(0, 0, 0, 0.2);
				border-radius: 8rpx;
				box-sizing: border-box;
				padding: 26rpx 24rpx 0;

				.menu-item {
					padding: 0 0 32rpx;

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

					.menu-text {
						padding-left: 12rpx;
						font-size: 24rpx;
						font-family: PingFangSC, PingFang SC;
						font-weight: 400;
						color: #555555;
					}
				}
			}
		}

		.bottom {
			border-top: 1px solid #E5E5E5;
			width: 100%;
			position: fixed;
			bottom: 0;
			left: 0;
			background: #FFFFFF;
			padding: 14rpx 28rpx 76rpx;
			box-sizing: border-box;

			.u-input {
				width: 528rpx !important;
				height: 76rpx;
				box-sizing: border-box;
				background: #F5F5F5;
				border-radius: 40rpx;
				padding: 18rpx 40rpx !important;
			}

			.btn2 {
				opacity: 1 !important;
			}

			.btn {
				margin-left: 20rpx;
				width: 146rpx;
				height: 76rpx;
				background: #00B0B0;
				border-radius: 40rpx;
				opacity: 0.5;
				font-size: 28rpx;
				font-family: PingFangSC, PingFang SC;
				font-weight: 400;
				color: #FFFFFF;
				text-align: center;
				line-height: 76rpx;

			}
		}

		.list {
			.list-item {
				margin: 0 0 44rpx;

				.time {
					width: 100%;
					text-align: center;
					font-size: 26rpx;
					font-family: PingFangSC, PingFang SC;
					font-weight: 400;
					color: #999999;
					padding-bottom: 24rpx;
				}

				image {
					width: 68rpx;
					height: 68rpx;
					border-radius: 50%;
				}

				.text {
					width: 512rpx;
					background: #F5F5F5;
					font-size: 28rpx;
					font-family: SFPro, SFPro;
					font-weight: 400;
					color: #333333;
					padding: 18rpx 28rpx;
					border-radius: 16rpx;
				}
			}
		}
	}
</style>