<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">{{ user == '' ? '你还未登陆' : ' 你好，欢迎来到智慧旅游' }}</view>
				</view>
			</view>
			<image :src="ip + aboutUs.showPictures[1]" mode="aspectFill" v-if="aboutUs.showPictures.length>1"></image>
			<image src="../../static/bj.jpg" mode="aspectFill" v-else></image>
		</view>
		<view class="sjia" @click="navigate('/pages/shop/list')" v-if="user != ''"><text>商家中心</text></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>
				</view>
				<view class="item" @click="navigate('/pages/other/about')">
					<text class="icon ic">&#xe65f;</text>
					<text>关于我们</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			ip: this.$http.urls.ip,
			user: this.$getUser(),
			aboutUs:{showPictures:[]}
		};
	},
	onLoad() {
		this.aboutUs=uni.getStorageSync('aboutUs');
	},
	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: 11;
		.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;
			}
		}
	}
}
.sjia {
	position: fixed;
	top: 13%;
	right: 0px;
	width: 90px;
	background: red;
	z-index: 111;
	padding: 5px 10px 5px 10px;
	color: white;
	font-size: 15px;
	text-align: center;
	border-radius: 10px 0px 0px 10px;
	box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.3);
	opacity: 0.7;
	.icon {
		font-size: 25px;
		padding-bottom: 3px;
	}
}
</style>
