<template>
	<view class="container">
		<u-cell-group><u-cell title="用户名" :value="userName"></u-cell></u-cell-group>

		<view class="btn-box" @click="loginOut"><u-button type="primary">退出</u-button></view>
		<tabbar :currentTab="3"></tabbar>
	</view>
</template>

<script>
import api from "@/common/api.js";
import { log } from "@/utils/base.js";
import tabbar from "@/components/tabbar";
export default {
	components: {
		tabbar,
	},
	data() {
		return {
			userName: "",
		};
	},
	mounted() {
		this.userName = this.$store.state.userInfo.name;
	},
	methods: {
		loginOut() {
			uni.showModal({
				title: "确定要退出吗?",
				content: " ",
				success: res => {
					if (res.confirm) {
						this.confirmLoginOut();
					}
				},
			});
		},
		confirmLoginOut() {
			this.$store.commit("logout");
			uni.reLaunch({
				url: "/pages/login/login",
			});
		},
	},
};
</script>

<style lang="scss">
.container {
	padding: 20px;
	font-size: 14px;
	line-height: 24px;
}
.btn-box {
	padding: 50px 30px 10px;
}
/deep/ .u-cell {
	&__title {
		font-weight: 600;
	}
	&__value {
		color: $uni-color-primary;
	}
}
</style>
