<template>
	<view class="container">
		<view class="list_top" v-for="(item,index) in list" :key="index" @click="goDetails(item)">
			<view class="img_">
				<image :src="item.icon" mode=""></image>
			</view>
			<view class="right_">
				<view class="right_top">{{item.title}}</view>
			</view>
		</view>

		<view class="k_"></view>
	<!-- 	<tabbar :msg='msg'></tabbar> -->
	</view>
</template>

<script>
		import request from '../../utils/request'
	import tabbar from '../../components/tabbar/tabbar.vue'
	export default {
		data() {
			return {
				msg: "2",
				list:[
          {title:'Translator',
            icon:'../../static/chatImg/fy.png',
            token:'Bearer app-EcJaT2EkUjHNJsax9SwESQuK',
            detail:'',
            conversation:'Translator'},
					{title:'Trip Advisor',
					icon:'../../static/chatImg/lxgw.png',
					token:'Bearer app-4Wqu03XTw297LtEsTXhotOuP',
					detail:'',
					conversation:'Trip'},
					{title:'Budget Planner',
					icon:'../../static/chatImg/ysjh.png',
					token:'Bearer app-wNZ3qcMRhNUj0K9FrH8ERPwF',
					detail:'',
					conversation:'Budget'},
					{title:'Ai Search',
					icon:'../../static/chatImg/znss.png',
					token:'Bearer app-4Wqu03XTw297LtEsTXhotOuP',
					detail:'',
					conversation:'Ai'},

				],
				userInfo:{}
			}
		},
		onLoad() {

		},
		components: {
			tabbar
		},
		methods:{

			async goDetails(item){
					let res = await request({
						url: 'system/user/getUserBaseInfo',
						method: 'get',
					})
					if (res.code == 200) {
						let toData = {...item,userId:res.data.userId,userAvatar:res.data.avatar}
						let data = JSON.stringify(toData)
						uni.navigateTo({
							url:'/pages/Chat/newChat?data='+data
						})

					}
			},
			async goNewChat(item){
				let res = await request({
					url: 'system/user/getUserBaseInfo',
					method: 'get',
				})
				if (res.code == 200) {
					let toData = {...item,userId:res.data.userId,userAvatar:res.data.avatar}
					let data = JSON.stringify(toData)
					uni.navigateTo({
						url:'/pages/Chat/newChat/index?data='+data
					})

				}
			}

		}
	}
</script>

<style scoped lang="scss">
	.list_top{
		width: 100%;
		box-sizing: border-box;
		padding: 10px;
		display: flex;
		align-items: center;
		margin: 10px 0px;
		border-bottom: 1px solid #d4d4d4;
	}
	.img_{
		width: 100rpx;
		height: 100rpx;
		border-radius: 50%;
		overflow: hidden;
		margin-right: 10px;
		image{
			width: 100%;
			height: 100%;
		}
	}
	.k_{
		width: 100%;
		height: 120px;
	}
	.right_{
		width: 80%;

	}
	.right_top{
		font-weight: bold;
		font-size: 16px;
		color: #242E42;
		margin-bottom: 10px;
	}
	.right_buttom{
		ont-weight: 500;
		font-size: 14px;
		color: #999999;
		 overflow:hidden;
		  white-space: nowrap;
		  text-overflow: ellipsis;
		  -o-text-overflow:ellipsis;
	}
</style>
