<template>
	<view style="padding: 10px;">
		<view class="item">
			<view class="form_group hr">
				<view class="lable l">微信头像</view>
				<view class="gg"><image :src="item.avatarUrl" class="header"></image></view>
			</view>
			<view class="form_group hr">
				<view class="lable">微信昵称</view>
				<view class="gg"><text v-text="item.nickName"></text></view>
			</view>
			<view class="form_group hr">
				<view class="lable">性别</view>
				<view class="gg">
					<text v-if="item.gender==1">男</text>
					<text v-if="item.gender==2">女</text>
				</view>
			</view>
			<view class="form_group hr">
				<view class="lable">地区</view>
				<view class="gg">{{item.province}} {{item.city}}</view>
			</view>
			<view class="form_group hr">
				<view class="lable">注册时间</view>
				<view class="gg"><text v-text="item.registerTime"></text></view>
			</view>
			<button class="btn" @click="exit()">退出登陆</button>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			item: {}
		};
	},
	onLoad() {
		this.item = this.$getUser();
		if (this.item.sex === 0) {
			this.item.sex = '未知';
		}
		if (this.item.sex === 1) {
			this.item.sex = '男';
		}
		if (this.item.sex === 2) {
			this.item.sex = '女';
		}
	},
	methods: {
		exit() {
			uni.showModal({
				title: '提示',
				content: '确定注销登录?',
				success: res => {
					if (res.confirm) {
						uni.removeStorageSync('user');
						uni.navigateBack();
					}
				}
			});
		}
	}
};
</script>

<style>
page {
	background-color: $page;
}
.item {
	background-color: white;
}
.l {
	line-height: 56px;
}
.gg {
	text-align: right;
	color: #868686;
	flex: 1;
}
.header {
	width: 50px;
	height: 50px;
	border-radius: 50%;
}
button {
	margin-top: 30px;
}
</style>
