<template>
	<view class="container">
		<view class="user">
			<u-icon name="../../static/image/icon-demo-1126.png" size="100rpx" style="margin-right:20rpx" />
			<view class="user-name">
				<view class="userName">
					{{userName}}
				</view>
				<view class="">
					登录时间：{{lastLoginTime}}
				</view>
			</view>
		</view>
		<view class="list">
			<!-- <uni-list>
				<uni-list-item title="角色信息" thumb="../../static/image/qxgl.png" thumb-size="medium" link
					to="/pages/user/auth-level/index">
				</uni-list-item>
				<uni-list-item title="修改密码" thumb="../../static/image/klsz.png" thumb-size="medium" link
					to="/pages/user/edit-password/index">
				</uni-list-item>
				<uni-list-item title="系统信息" to="/pages/user/system-info/index" thumb="../../static/image/xtgl.png"
					thumb-size="medium" link>
				</uni-list-item>
			</uni-list> -->
			<u-cell-group>
				<u-cell size="large" title="角色信息" :isLink="true" icon="../../static/image/qxgl.png" 
				url="/pages/user/auth-level/index"></u-cell>
				<u-cell size="large" title="修改密码" :isLink="true" icon="../../static/image/klsz.png"
				url="/pages/user/edit-password/index"></u-cell>
				<u-cell size="large" title="系统信息" :isLink="true" icon="../../static/image/xtgl.png"
				url="/pages/user/system-info/index"></u-cell>
			</u-cell-group>
		</view>
		<view class="btn">
			<u-button type="primary" text="退出登录" @click="show=true" size="large"></u-button>
		</view>
		<view>
			<u-modal :show="show" content='确定退出登录吗？' showCancelButton @confirm="loginOut" @cancel="show=false"
				width="270">
			</u-modal>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				//模态框
				show: false,
			};
		},
		computed: {
			userName() {
				return this.$store.getters.userName
			},
			lastLoginTime() {
				return this.$store.getters.lastLoginTime
			}
		},
		methods: {
			//退出登录
			loginOut() {
				this.$store.dispatch('user/logout').then(res => {
					if (res.data.code === 200) {
						uni.redirectTo({
							url: "/pages/login/index"
						})
					}
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.container {
		background: #EEEDF2;
	}

	.user {
		display: flex;
		align-items: center;
		padding: 60rpx 40rpx;
		margin-bottom: 20rpx;
		background: #ffffff;
	}

	.user-name {
		font-weight: bold;

		.userName {
			font-size: 28rpx
		}
	}

	.list {}

	.btn {
		position: absolute;
		bottom: 100rpx;
		left: 0;
		right: 0;
		padding: 0 80rpx;
	}

	::v-deep .uni-list-item__container {
		padding: 40rpx 60rpx;
	}

	::v-deep .uni-list-item__content-title {
		font-size: 28rpx;
	}

	::v-deep .uniui-arrowright {
		color: #000000 !important;
		font-size: 28rpx !important;
	}

	::v-deep .u-modal__content__text {
		text-align: center;
	}
</style>