<template>
	<view class="page">
		<view class="top">
			<view class="wd">
				<image :src="user == '' ? '../../static/ls.jpg' : user.avatarUrl" class="head"></image>
				<view class="xs" @click="navigate('/pages/user/info')">
					<view class="nickName" v-if="user == ''">登录 / 注册</view>
					<view class="nickName" v-else>
						<text>{{ user.nickName }}</text>
					</view>
					<view class="nh">{{ user == '' ? '你还未登陆' : ' 您好，欢迎来到谢通门智慧旅游' }}</view>
					<view class="clear"></view>
				</view>
			</view>
			<view class="icon" @click="navigate('/pages/user/info')" v-if="user != ''">&#xe8b7;</view>
			<image src="../../static/my.png" mode="aspectFill"></image>
		</view>
		<view class="main">
			<view class="list flex">
				<view class="item f" @click="navigate('/pages/order/my')" style="padding-right: 0px;">
					<view style="border-right: 1px solid #f1f1f1;">
						<text class="icon ic" style="background-color: #2196F3;">&#xe705;</text>
						<view class="fon">我的预约</view>
					</view>
				</view>
				<view class="item f" @click="navigate('/pages/shop/list')">
					<text class="icon ic" style="background-color:#9727ec">&#xe616;</text>
					<view class="fon">商家中心</view>
				</view>
			</view>
			<view class="list" style="margin-top: 13px;">
				<view class="item hr" @click="call()">
					<text class="icon ic" style="background-color:#276fec">&#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" class="button">
						<text class="icon ic" style="background-color:#34cf43">&#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:#343f61">&#xe65f;</text>
					<text>关于我们</text>
					<text class="icon arrow">&#xe62d;</text>
				</view>
			</view>
		</view>
		<help ref="help"></help>
	</view>
</template>

<script>
import help from '../../components/help.vue';
export default {
	components: {
		help
	},
	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.$refs.help.init();
		}
	},
	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: 270px;
	color: white;
	overflow: hidden;
	.wd {
		position: absolute;
		top: 80px;
		left: 20px;
		z-index: 11;
		.head {
			width: 75px;
			height: 75px;
			border-radius: 50%;
		}
		.xs {
			margin-left: 90px;
			font-weight: bold;
			margin-top: 10px;
			.nickName {
				width: 100%;
				font-size: 14px;
				margin-top: 20px;
				position: relative;
			}
			.nh {
				font-size: 12px;
				font-weight: normal;
				margin-top: 5px;
			}
		}
	}
	.icon {
		position: absolute;
		right: 14px;
		top: 93px;
		font-size: 25px;
		z-index: 1;
	}
	image {
		width: 100%;
		height: 270px;
		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;
		.fon {
			padding-top: 12px;
		}
		.item {
			padding: 16px;
			background-color: white;
			font-size: 16px;
			color: #222222;
			.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>
