<template>
	<div class="home-container">
		<el-row :gutter="15">
			<el-col :sm="6" class="mb15">
				<div class="home-card-item home-card-first">
					<div class="flex-margin flex">
						<img :src="getUserInfos.photo" />
						<div class="home-card-first-right ml15">
							<div class="flex-margin">
								<div class="home-card-first-right-title">
									{{ currentTime }}，{{ getUserInfos.nickname === '' ? '匿名用户' : getUserInfos.nickname }}！
								</div>
								<div class="home-card-first-right-msg mt5">
									{{ getUserInfos.roleName }}
								</div>
							</div>
						</div>
					</div>
				</div>
			</el-col>
		</el-row>
	</div>
</template>

<script setup lang="ts">
import { onMounted, computed, onActivated } from 'vue';
import {  formatAxis } from '@/utils/formatTime';
import { useUserInfosState } from '@/stores/userInfos';


const userInfos = useUserInfosState();

// 获取用户信息 pinia
const getUserInfos = computed(() => {
	return userInfos.userInfos;
});
// 当前时间提示语
const currentTime = computed(() => {
	return formatAxis(new Date());
});



// 页面加载时
onMounted(() => {

});
// 由于页面缓存原因，keep-alive
onActivated(() => {
});

</script>

<style scoped lang="scss">
.home-container {
	overflow-x: hidden;

	.home-card-item {
		width: 100%;
		height: 103px;
		background: var(--el-text-color-secondary);
		border-radius: 15px;
		transition: all ease 0.3s;

		&:hover {
			box-shadow: 0 2px 12px 0 rgb(0 0 0 / 10%);
			transition: all ease 0.3s;
		}
	}

	.home-card-item-box {
		display: flex;
		align-items: center;
		position: relative;
		overflow: hidden;

		&:hover {
			i {
				right: 0px !important;
				bottom: 0px !important;
				transition: all ease 0.3s;
			}
		}

		i {
			position: absolute;
			right: -10px;
			bottom: -10px;
			font-size: 70px;
			transform: rotate(-30deg);
			transition: all ease 0.3s;
		}

		.home-card-item-flex {
			padding: 0 20px;
			color: var(--color-whites);

			.home-card-item-title,
			.home-card-item-tip {
				font-size: 13px;
			}

			.home-card-item-title-num {
				font-size: 18px;
			}

			.home-card-item-tip-num {
				font-size: 13px;
			}
		}
	}

	.home-card-first {
		background: var(--el-color-white);
		border: 1px solid var(--el-border-color-light, #ebeef5);
		display: flex;
		align-items: center;

		img {
			width: 60px;
			height: 60px;
			border-radius: 100%;
			border: 2px solid var(--color-primary-light-5);
		}

		.home-card-first-right {
			flex: 1;
			display: flex;
			flex-direction: column;

			.home-card-first-right-title {
				color: var(--el-color-black);
			}

			.home-card-first-right-msg {
				font-size: 13px;
				color: var(--el-text-color-secondary);
			}
		}
	}

	.home-monitor {
		height: 240px;

		.flex-warp-item {
			width: 50%;
			height: 100px;
			display: flex;

			.flex-warp-item-box {
				margin: auto;
				height: auto;
				text-align: center;
				color: var(--el-text-color-primary);
			}
		}
	}

	.home-warning-card {
		height: 292px;

		::v-deep(.el-card) {
			height: 100%;
		}
	}

	.home-dynamic {
		height: 200px;

		.home-dynamic-item {
			display: flex;
			width: 100%;
			height: 60px;
			overflow: hidden;

			&:first-of-type {
				.home-dynamic-item-line {
					i {
						color: orange !important;
					}
				}
			}

			.home-dynamic-item-left {
				text-align: right;

				.home-dynamic-item-left-time1 {
				}

				.home-dynamic-item-left-time2 {
					font-size: 13px;
					color: var(--el-text-color-secondary);
				}
			}

			.home-dynamic-item-line {
				height: 60px;
				border-right: 2px dashed var(--el-border-color-light, #ebeef5);
				margin: 0 20px;
				position: relative;

				i {
					color: var(--color-primary);
					font-size: 12px;
					position: absolute;
					top: 1px;
					left: -6px;
					transform: rotate(46deg);
					background: var(--el-color-white);
				}
			}

			.home-dynamic-item-right {
				flex: 1;

				.home-dynamic-item-right-title {
					i {
						margin-right: 5px;
						border: 1px solid var(--el-border-color-light, #ebeef5);
						width: 20px;
						height: 20px;
						border-radius: 100%;
						padding: 3px 2px 2px;
						text-align: center;
						color: var(--color-primary);
					}
				}

				.home-dynamic-item-right-label {
					font-size: 13px;
					color: var(--el-text-color-secondary);
				}
			}
		}
	}
}
</style>
