<template>
	<view class="chat-room">
		
		<view class="chat-list">
			<view class="chat-item" v-for="(item,index) in list" :key="index">
				<view class="chat-msg">
					{{item.msg}}
				</view>
				<view class="head">
					我
				</view>
			</view>
		</view>
		
		<view class="tool-box">
			<view class="input-box">
				<input class="input" type="text" confirm-type="send" @confirm="send" placeholder="请输入" v-model="value" />
				<image class="btn" src="../../static/emoji.png" mode=""></image>
				<image class="btn" src="../../static/add.png" mode="" @click="this.show = !this.show"></image>
			</view>
			<view class="box" v-if="show">
				<view class="item">
					<image class="icon" src="../../static/picture.png" mode=""></image>
					<view class="label">
						照片
					</view>
				</view>
				<view class="item">
					<image class="icon" src="../../static/camera.png" mode=""></image>
					<view class="label">
						拍照
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				show: false,
				value:'',
				list:[
					{
						type:'me',
						msg:'你好，为什么我的加油时不能使用'
					}
				]
			}
		},
		methods: {
			send() {
				console.log(this.value);
				this.list.push(
					{
						type:'me',
						msg:this.value
					}
				)
				this.value = ''
			}
		},
	}
</script>

<style lang="scss" scoped>
	.chat-room {
		background: #F9F9F9;
		min-height: 100vh;
		padding: 0 30rpx 120rpx;
		
		.chat-list{
			display: flex;
			flex-direction: column;
			.chat-item{
				display: flex;
				align-items: center;
					align-self: flex-end;
					margin-bottom: 35rpx;
				.chat-msg{
					padding: 20rpx 40rpx;
					font-size: 28rpx;
					line-height: 38rpx;
					background: $uni-color-primary;
					border-radius: 40rpx 40rpx 0rpx 40rpx;
					color: #fff;
					margin: 0 30rpx;
					max-width: 460rpx;
					word-break: break-all;
				}
				.head{
					width: 92rpx;
					height: 92rpx;
					text-align: center;
					line-height: 92rpx;
					border-radius: 50%;
					background-color: #568FFF;
					color: #fff;
				}
			}
		}
		
		
		.tool-box{
			padding: 0 30rpx;
			position: fixed;
			bottom: 0%;
			left: 0;
			width: 750rpx;
			box-sizing: border-box;
				background: #fff;
			.input-box {
				display: flex;
				align-items: center;
				padding: 8rpx 0;
				.input {
					height: 80rpx;
					line-height: 80rpx;
					border-radius: 40rpx;
					background: #F9F9F9;
					padding-left: 30rpx;
					flex: 1;
				}

				.btn {
					width: 48rpx;
					height: 48rpx;
					margin: 0 10rpx;
				}
			}
			
			.box{
				display: flex;
				.item{
					display: flex;
					flex-direction: column;
					align-items: center;
					padding: 25rpx;
					.icon{
						width: 48rpx;
						height: 48rpx;
					}
					.label{
						font-size: 24rpx;
						color: #707070;
						margin-top: 10rpx;
					}
				}
			}
		}
	}
</style>