<template>
	<view class="container">

		<uni-row>
			<uni-col :span="8" :offset="8">
				<view>
					<image :src="avatar" class="round" mode="aspectFill" style="width: 100px; height: 100px;"></image>
				</view>
			</uni-col>
		</uni-row>

		<uni-list>
			<uni-list-item showExtraIcon="true" :extraIcon="{type: 'person-filled'}" title="昵称"
				:rightText="user.nickName" />
			<uni-list-item showExtraIcon="true" :extraIcon="{type: 'staff-filled'}" title="性别"
				:rightText="user.sex == null ? '未知' : (user.sex == 0 ? '女' : '男')" />
			<uni-list-item showExtraIcon="true" :extraIcon="{type: 'calendar-filled'}" title="创建日期"
				:rightText="user.createTime" />
		</uni-list>
	</view>
</template>

<script>
	import {
		getMiniAppUserInfo
	} from "@/api/basics/miniAppUser.js"

	export default {
		data() {
			return {
				user: {},
				avatar: this.$store.state.user.avatar
			}
		},
		onShow() {
			wx.showShareMenu({
				withShareTicket: true,
				menus: ['shareAppMessage', 'shareTimeline']
			});
		},
		onLoad() {
			this.getUser()
		},
		methods: {
			getUser() {
				getMiniAppUserInfo().then(response => {
					this.user = response.data
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #ffffff;
	}

	.cu-avatar {
		border: 2px solid #eaeaea;

		.icon {
			font-size: 40px;
		}
	}
</style>