<template>
	<view class="infobox">
		<view class="left" v-if="isLogin" @click="$u.route('/pages-mine/pages/setting')">
			<u-avatar size="118" :src="data.avatar"></u-avatar>
			<view class="info">
				<view class="username">{{ data.nickname || '' }}</view>
				<view class="desc">{{ data.mobile}}</view>
			</view>
		</view>
		<view class="left" v-else @click="$u.route('/pages/login/index')">
			<u-avatar size="118"></u-avatar>
			<view class="info">
				<view class="username">登录</view>
				<!-- <view class="desc">点击登录跳转至登录页面</view> -->
			</view>
		</view>
		<!-- <view class="right"><u-icon size="20" name="arrow-right"></u-icon></view> -->
	</view>
</template>

<script>
export default {
	name: 'user-info',
	props: {
		// 数据源
		data: {
			type: Object,
			default: () => {
				return {};
			}
		},
		isLogin: {
			type: Boolean,
			default: false
		}
	},
	data() {
		return {};
	}
};
</script>

<style lang="scss" scoped>
.infobox {
	color: $app-theme-text-white-color;
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 30rpx 48rpx 100rpx;
	position: relative;
	z-index: $app-zIndex-normal;
	background-color: #22ac38;
	// border-radius: 0 0 150rpx 150rpx;
	.left {
		display: flex;
		align-items: center;
		.info {
			margin-left: 24rpx;
			display: flex;
			align-content: space-between;
			flex-wrap: wrap;
			.username {
				font-size: 32rpx;
				width: 100%;
				color: $app-theme-text-white-color;
				margin-bottom: 16rpx;
				font-weight: bold;
			}
			.desc {
				font-size: 24rpx;
				width: 100%;
				color: $app-theme-text-white-color;
				display: -webkit-box;
				overflow: hidden;
				-webkit-line-clamp: 1;
				-webkit-box-orient: vertical;
			}
		}
	}
	.right {
		display: flex;
		align-items: center;
	}
}
</style>
