<template>
	<view>
		<view class="user">
			<view class="title">
				<view>个人信息</view>
				<text>头像、昵称等个人信息由获取微信授权自动上传</text>
			</view>
			<view class="list">
				<view>
					<text>头像</text>
					<view class="photo"><open-data type="userAvatarUrl"></open-data></view>
				</view>
				<view>
					<text>昵称</text>
					<view><open-data type="userNickName"></open-data></view>
				</view>
				<view>
					<text>手机号</text>
					<view style="color:#478AF6;">{{ phone }}</view>
				</view>
			</view>
		</view>
		<view class="agency">
			<view class="title"><view>代理信息</view></view>
			<view class="list">
				<view>
					<text>我的等级</text>
					<view>{{userInfo.level}}</view>
				</view>
				<view>
					<text>我的上级</text>
					<view>{{userInfo.agent_nickname}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			userInfo: {},
			phone: ''
		};
	},
	onShow() {
		if (uni.getStorageSync('userInfo')) {
			this.userInfo = uni.getStorageSync('userInfo');
			let phone = this.userInfo.phone
			this.phone = phone.replace(phone.substring(3, 7), '****');
		}
	}
};
</script>

<style lang="scss">
.user,
.agency {
	.title {
		margin: 0 0 24rpx 31rpx;
		view {
			font-size: 36rpx;
			color: #333333;
			padding: 36rpx 0 23rpx 0;
			font-weight: bold;
		}
		text {
			color: #999999;
			font-size: 28rpx;
		}
	}
}
.agency {
	.title {
		padding: 36rpx 0 0 0;
	}
}
.list {
	> view {
		width: 100%;
		height: 100rpx;
		background-color: #fff;
		border-bottom: 1rpx solid #f9f9f9;
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 0 30rpx;
		box-sizing: border-box;
		text {
			font-size: 32rpx;
			color: #666666;
		}
		view {
			font-size: 28rpx;
			color: #333333;
		}
	}
	.photo {
		height: 64rpx;
		width: 64rpx;
		border-radius: 50%;
		overflow: hidden;
	}
}
</style>
