<template>
	<div>
		<div class="content">
			<JwChat :taleList="list" scrollType="norell" :config="config" @enter="bindEnter" v-model="inputMsg" :toolConfig="tool">
			</JwChat>
			<div @click="up">上传</div>
			<singleUpload :limit="1" tip="支持扩展名：.rar .zip .doc .docx .pdf .jpg..." @input="getfile"></singleUpload>
		</div>

	</div>
</template>

<script>
	import {
		autodeploy
	} from '@api/common/list'
	import imgupload from '@components/Upload/imgUpload.vue'
	import upload from '@components/Upload/newUpload.vue'
	import singleUpload from '@components/Upload/Upload.vue'
	export default {
		components: {
			upload,
			imgupload,
			singleUpload
		},
		data() {
			return {
				inputMsg: '',
				config: {
					historyConfig: {
						tip: '查看更多'
					}
				},
				list: [{
						"date": "2020/04/25 21:19:07",
						"text": {
							"text": "起床不"
						},
						"mine": false,
						"name": "留恋人间不羡仙",
						"img": ""
					},
					{
						"date": "2020/04/25 21:19:07",
						"text": {
							"text": "11"
						},
						"mine": false,
						"name": "只盼流星不盼雨",
						"img": ""
					},
					{
						"date": "2020/04/25 21:19:07",
						"text": {
							"text": "111"
						},
						"mine": false,
						"name": "只盼流星不盼雨",
						"img": ""
					},
					{
						"date": "2020/04/16 21:19:07",
						"text": {
							"text": "222"
						},
						"mine": true,
						"name": "JwChat",
						"img": ""
					},
				],
				tool: {
					show: [''],
					callback: this.toolEvent,
					showEmoji: true,
				},
			}
		},
		methods: {
			bindEnter() {
				const msg = this.inputMsg
				if (!msg) return;
				const msgObj = {
					"date": "2020/05/20 23:19:07",
					"text": {
						"text": msg
					},
					"mine": true,
					"name": "JwChat",
					"img": ""
				}
				this.list.push(msgObj)
			},
			toolEvent(type) {
				console.log('tools', type)
			},
			getfile(val) {
				console.log(val)
			},

			async up() {
				try {
					const {
						data,
						code
					} = await autodeploy()
				} catch (e) {
					console.log(e)
				}
			}
		}

	}
</script>

<style scoped>
