<template>
	<view class="container">
		<view class="row b-b flex">
			<text class="tit">头像</text>
			<image :src="userInfo.avatar"></image>
		</view>
		<view class="row b-b flex">
			<text class="tit">昵称</text>
			<input class="input" v-model="userInfo.nickname" type="text" disabled="true" placeholder-class="placeholder" />
		</view>
		<view class="row b-b flex">
			<text class="tit">ID</text>
			<input class="input" v-model="userInfo.uid" type="text" disabled="true" placeholder-class="placeholder" />
		</view>
		<view class="row b-b flex">
			<text class="tit">用户账号</text>
			<input class="input" v-model="userInfo.account" type="number" disabled="true" placeholder-class="placeholder" />
		</view>
		<view class="submit-box">
			<view class="submit" @click="toLogout">退出登录</view>
		</view>
	</view>
</template>
<script>
import uniList from '@/components/uni-list/uni-list.vue';
import uniListItem from '@/components/uni-list-item/uni-list-item.vue';
import { mapState, mapMutations } from 'vuex';
import { logout } from '@/api/set.js';
export default {
	components: {
		uniList,
		uniListItem
	},
	data() {
		return {
			// nickName:'李淡淡',
			// id:'HFBNXISN',
			// account:'13745262356',
			userInfo:'',
		};
	},
	onLoad() {
		this.userInfo = uni.getStorageSync('userInfo') || '';
	},
	methods: {
		...mapMutations('user',['logout']),
		//退出登录
		toLogout() {
			let obj = this;
			uni.showModal({
				content: '确定要退出登录么',
				success: e => {
					if (e.confirm) {
						logout({}).then(e => {
							obj.logout();
							uni.navigateTo({
								url:'/pages/public/login'
							})
						})
						.catch(e => {
							console.log(e);
						});
					}
				}
			});
		},
	}
};
</script>

<style lang="scss">
page {
	min-height: 100%;
	.container{
		height: 100%;
		
	}
}
.row {
	padding: 42rpx 25rpx;
	font-size: 30rpx;
	color: #333333;
	image{
		width: 80rpx;
		height: 80rpx;
		border-radius: 50%;
	}
	.input {
		text-align: right;
		color: #333333;
	}
}
.submit-box{
		padding: 157rpx 95rpx;
		.submit{
			background-color: #5771DF;
			color: #FFFFFF;
			text-align: center;
			padding:26rpx 0rpx;
			border-radius: 50rpx;
		}
	}
</style>
