<template>
	<view>
		<view class="no-login" v-if="!token">
			<view class="avatar"><image src="../../static/no-login.png"></image></view>
			<view class="context">您好，请授权登录</view>
		</view>
		<view class="login" v-else>
			<view class="avatar"><image :src="userinfo.avatarUrl ? userinfo.avatarUrl : userinfo.avatar"></image></view>
			<view class="info">
				<view class="name">{{userinfo.nickName}}</view>
				<view class="phone">
					<view><image src="../../static/ucenter/icon2.png"></image></view>
					<view>{{userinfo.mobile || userinfo.telephone}}</view>
				</view>
			</view>
			<view class="join">
				<image src="../../static/ucenter/icon1.png"></image>
				<view class="days">已加入156天</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name:"top-box",
		props:['token','userinfo'],
	}
</script>

<style lang="scss" scoped>
	.no-login{
		margin-top: 15rpx;
		display: flex;
		.avatar image{
			width: 70rpx;
			height: 70rpx;
			margin: 0 20rpx;
		}
		.context{
			color: #58be6b;
			font-size: 32rpx;
			font-weight: bold;
			line-height: 70rpx;
		}
	}
	.login{
		margin-top: 15rpx;
		display: flex;
		.avatar image{
			width: 110rpx;
			height: 110rpx;
			margin: 0 30rpx;
			border-radius: 50%;
		}
		.info{
			display: flex;
			flex-direction: column;
			height: 100rpx;
			justify-content: space-around;
			padding-top: 10rpx;
			margin-left: 5rpx;
			.name{
				color: #1d2129;
				font-size: 36rpx;
				font-weight: bold;
			}
			.phone{
				display: flex;
				font-size: 24rpx;
				color: #86909c;
				line-height: 36rpx;
				image{
					width: 36rpx;
					height: 36rpx;
				}
			}
		}
		.join{
			display: flex;
			padding-top: 15rpx;
			margin-left: 20rpx;
			position: relative;
			image{
				width: 42rpx;
				height: 48rpx;
				position: absolute;
			}
			.days{
				background-color: #f5f5f5;
				height: 44rpx;
				padding: 0 20rpx;
				margin-left: 20rpx;
				margin-top: 5rpx;
				border-top-right-radius:20rpx;
				border-bottom-right-radius:20rpx;
				font-size: 24rpx;
				color: #86909c;
				line-height: 44rpx;
			}
		}
	}
</style>