<template>
	<view class="page">
		<view class="top">
			<view class="wd">
				<view class="qw"><image :src="user == '' ? '../../static/ls.jpg' : user.avatarUrl" class="head"></image></view>
				<view class="xs" @click="navigate('/pages/user/info')">
					<view v-if="user == ''">登录 / 注册</view>
					<view class="nickName" v-else>{{ user.nickName }}</view>
					<view class="nh">你好，欢迎来到智慧旅游</view>
				</view>
			</view>
			<image src="../../static/bj.jpg" mode="aspectFill"></image>
		</view>
		<view class="main">
			<view class="flex menu">
				<view class="f">
					<view class="icon" style="background-color: #607D8B">&#xe636;</view>
					<view class="title">我的预约</view>
				</view>
				<view class="f">
					<view class="icon" style="background-color: #e23e33;">&#xe610;</view>
					<view class="title">我的投诉</view>
				</view>
				<view class="f">
					<view class="icon" style="background-color: #2cc937;">&#xe656;</view>
					<view class="title">我的评论</view>
				</view>
				<view class="f">
					<view class="icon" style="background-color: #2196F3;">&#xe623;</view>
					<view class="title">我的旅途</view>
				</view>
			</view>
			<view class="list">
				<view class="item hr" @click="navigate('/pages/user/info')">
					<text class="icon ic">&#xe626;</text>
					<text>个人资料</text>
					<text class="icon arrow">&#xe65a;</text>
				</view>
				<view class="item" @click="navigate('/pages/other/about')">
					<text class="icon ic">&#xe65f;</text>
					<text>关于我们</text>
					<text class="icon arrow">&#xe65a;</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			user: this.$getUser()
		};
	},
	onShow() {
		this.user = this.$getUser();
	},
	methods: {
		navigate(url) {
			if (this.$hasLogin()) {
				uni.navigateTo({ url: url });
			} else {
				uni.navigateTo({ url: '/pages/user/login' });
			}
		}
	}
};
</script>

<style lang="scss">
.top {
	position: relative;
	height: 300px;
	color: white;
	.wd {
		position: absolute;
		top: 70px;
		left: 20px;
		z-index: 111111;
		.head {
			width: 75px;
			height: 75px;
			border-radius: 50%;
		}
		.xs {
			margin-left: 90px;
			width: 100%;
			font-weight: bold;
			margin-top: 10px;
			.nickName {
				margin-top: 20px;
			}
			.nh {
				font-size: 12px;
				font-weight: normal;
				margin-top: 5px;
			}
		}
	}
	image {
		width: 100%;
		height: 300px;
		position: absolute;
	}
}
.main {
	padding: 15px 15px 50px 15px;
	width: 100%;
	margin-top: -50px;
	overflow: hidden;
	position: absolute;
	.menu {
		background-color: white;
		border-radius: 10px;
		padding: 15px;
		width: 100%;
		box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
		.icon {
			font-size: 30px;
			background-color: red;
			width: 38px;
			height: 38px;
			border-radius: 5px;
			margin: 0 auto;
			color: white;
			padding: 3px;
		}
		.title {
			padding-top: 4px;
			font-size: 13px;
		}
	}
	.list {
		margin-top: 10px;
		box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
		border-radius: 5px;
		.item {
			padding: 15px;
			.ic {
				font-size: 20px;
				padding-right: 10px;
			}
			.arrow {
				margin-top: 6px;
				font-size: 20px;
			}
		}
	}
}
</style>
