<template>
	<view class="my-index">
		<image class="my-header-image" :src="bgImage" mode="aspectFill"></image>
		<view class="user-info-box" @click="goPage('/pages/login/login')">
			<image class="avatar-image" :src="user.portrait" mode="aspectFill"></image>
			<view class="user-info-right">{{!user.userId ? '登录/注册':user.userName}}</view>
		</view>
		<view class="user-activity-menu">
			<view class="menu-item">
				<view class="left">
					<uni-icons class="menu-icon" type="home" size="24"></uni-icons>
					<view class="menu-name">我的房源</view>
				</view>
				<uni-icons type="right" size="20" color="#717171"></uni-icons>
			</view>
			<view class="menu-item">
				<view class="left">
					<uni-icons class="menu-icon" type="wallet" size="24"></uni-icons>
					<view class="menu-name">缴费管理</view>
				</view>
				<uni-icons type="right" size="20" color="#717171"></uni-icons>
			</view>
			<view class="menu-item">
				<view class="left">
					<uni-icons class="menu-icon" type="calendar" size="24"></uni-icons>
					<view class="menu-name">发票管理</view>
				</view>
				<uni-icons type="right" size="20" color="#717171"></uni-icons>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				bgImage: require('@/static/image/my/banner.png'),
				user: {
					portrait: 'https://file-node.oss-cn-shanghai.aliyuncs.com/youji/3156449b8a1a4874981b2a76d5947721'
				}
			};
		},
		onShow() {
			if (this.$store.getters.user.userId) this.user = this.$store.getters.user;
		},
		methods: {
			/* 跳转页面 */
			goPage(page) {
				uni.navigateTo({
					url: page
				})
			}
		}
	}
</script>

<style lang="scss">
	.my-index {
		position: relative;

		.my-header-image {
			width: 100%;
			height: 320rpx;
		}

		.user-info-box {
			background: #ffffff;
			padding: 30rpx;
			position: absolute;
			border-radius: 20rpx;
			display: flex;
			align-items: center;
			top: 250rpx;
			left: 30rpx;
			right: 30rpx;

			.avatar-image {
				width: 100rpx;
				height: 100rpx;
				border-radius: 10rpx;
			}

			.user-info-right {
				margin-left: 20rpx;
				font-size: 32rpx;
				font-weight: 500;
			}
		}

		.user-activity-menu {
			margin: 30rpx;
			margin-top: 120rpx;
			border-radius: 20rpx;
			background: #fff;

			.menu-item {
				display: flex;
				align-items: center;
				justify-content: space-between;
				height: 96rpx;
				padding: 0 30rpx;

				.left {
					display: flex;
					align-items: center;

					.menu-name {
						margin-left: 20rpx;
						color: $uni-base-color;
					}

					.menu-icon {
						/* #ifdef H5 */
						color: $uni-base-color !important;

						/* #endif */
						/* #ifdef MP-WEIXIN */
						text {
							color: $uni-base-color !important;
						}

						/* #endif */
					}
				}
			}
		}
	}
</style>