<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>
						<text>{{ user.nickName }}</text>
						<view class="icon">&#xe8b7;</view>
					</view>
					<view class="nh">{{ user == '' ? '你还未登陆' : ' 你好，欢迎来到智慧旅游' }}</view>
				</view>
			</view>
			<image src="../../static/bj.jpg" mode="aspectFill"></image>
		</view>
		<view class="main">
			<view class="list">
				<view class="item hr" @click="navigate('/pages/order/my')">
					<text class="icon ic" style="background-color: #2196F3;">&#xe705;</text>
					<text>我的预约</text>
					<text class="icon arrow">&#xe62d;</text>
				</view>
				<view class="item hr" @click="navigate('/pages/shop/list')">
					<text class="icon ic" style="background-color:#607D8B">&#xe616;</text>
					<text>商家中心</text>
					<text class="icon arrow">&#xe62d;</text>
				</view>
			</view>
			<view class="list" style="margin-top: 13px;">
				<view class="item hr" @click="call()">
					<text class="icon ic" style="background-color:#366092">&#xe634;</text>
					<text>求助电话</text>
					<text class="icon arrow">&#xe62d;</text>
				</view>
				<view class="item hr" @click="navigate('/pages/other/feedback')">
					<text class="icon ic" style="background-color:#FF554B">&#xe610;</text>
					<text>投诉建议</text>
					<text class="icon arrow">&#xe62d;</text>
				</view>
				<view class="item hr">
					<button open-type="share" hover-class='none'>
						<text class="icon ic" style="background-color:#18B566">&#xe607;</text>
						<text>分享朋友</text>
						<text class="icon arrow">&#xe62d;</text>
					</button>
				</view>
				<view class="item" @click="navigate('/pages/other/about')">
					<text class="icon ic" style="background-color:#606266">&#xe65f;</text>
					<text>关于我们</text>
					<text class="icon arrow">&#xe62d;</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' });
			}
		},
		//拨打求助电话
		call() {
			this.$http.call(this.aboutUs);
		}
	},
	onShareAppMessage: function(res) {
		return {
			title: '谢通门智慧旅游',
			path: '/pages/index/index2',
			imageUrl: '../../static/fx.jpg',

			success: res => {},
			fail: res => {}
		};
	}
};
</script>

<style lang="scss">
.top {
	position: relative;
	height: 300px;
	color: white;
	.wd {
		position: absolute;
		top: 80px;
		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;
			}
			.icon {
				float: right;
				font-size: 25px;
				margin-right: -17px;
			}
		}
	}
	image {
		width: 100%;
		height: 300px;
		position: absolute;
	}
}
.main {
	padding: 15px 15px 50px 15px;
	width: 100%;
	overflow: hidden;
	position: absolute;
	margin-top: -100px;
	.list {
		box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
		width: 100%;
		background-color: white;
		border-radius: 5px;
		overflow: hidden;
		.item {
			padding: 16px;
			background-color: white;
			font-size: 16px;
			.ic {
				font-size: 20px;
				background-color: red;
				text-align: center;
				padding: 5px;
				border-radius: 5px;
				margin-right: 9px;
				color: white;
			}
			.arrow {
				font-size: 20px;
			}
		}
	}
}
button {
	text-align: left;
	background-color: white;
	color: #2e2e2e !important;
	font-size: 16px;
	padding-left: 0px;
	padding-right: 2px;
	line-height: 20px;
	overflow: initial;
	&:hover {
		background-color: white;
		outline:none;
	}
}
</style>
