<template>
	<view class="user-setting">
		<nav-bar title="设置" @init="onInitNavbar"></nav-bar>
		<van-cell-group>
			<van-cell title="个人信息" is-link @click="navigateTo('/pages/user/info')">
			</van-cell>
			<van-cell class="user-logout" title="退出登录" is-link @click="onLogout">
			</van-cell>
		</van-cell-group>
	</view>
</template>

<script>
	import NavBar from '@/components/layout/nav-bar'
	import UScrollView from '@/components/common/u-scroll-view'
	import VanCellGroup from '@/wxcomponents/vant/cell-group/index'
	import VanCell from '@/wxcomponents/vant/cell/index'
	
	export default {
		options: {
			styleIsolation: 'shared'
		},
		components: {
			NavBar,
			UScrollView,
			VanCellGroup,
			VanCell
		},
		computed: {
		},
		data() {
			return {}
		},
		created() {
			this.checkAuth('/pages/user/setting')
		},
		onShow() {}, 
		methods: {
			onLogout() {
				// this.$store.dispatch('logout').then(() => {
				// 	uni.navigateTo({
				// 		url: '/pages/user/login'
				// 	})
				// })
				this.$store.dispatch('logout').then(() => {
					this.redirectTo('/pages/user/login')
				})
			}
		}
	}
</script>

<style lang="scss">
	.user-setting{
		.user-logout{
			.van-cell__title{
				@include display-flex-center;
			}
			.van-icon{
				display: none;
			}
		}
	}
</style>