<template>
	<div id="app">
		<router-view></router-view>
	</div>
</template>

<script setup>
import { ref, onMounted } from "vue";
import { useRouter } from "vue-router";
import { getPersonType } from "@/api/common/index";


const router = useRouter();

import useTagsViewStore from '@/stores/tagsView.js'

const tagsViewStore = useTagsViewStore()


// 在路由全局守卫中处理
router.beforeEach((to, from, next) => {
  // 路由允许添加标签（排除掉隐藏的布局页如 /404, /login 等）
  if (to.path.indexOf('dataLibrary') > -1 ) {
    tagsViewStore.addView({
      path: to.path,
      name: to.name, // 对应组件的 name，用于缓存
      meta: { ...to.meta },
      active: true
    })
  }
  next()
})

const personTypeList = ref([]);

// 获取人物类别
const handleGetPersonType = async () => {
	try {
		const res = await getPersonType();
		console.log("res", res);
		if (res.code === 200) {
			personTypeList.value = res.data;
		} else {
			personTypeList.value = [];
		}
		window.sessionStorage.setItem("personTypeList", JSON.stringify(personTypeList.value));
	} catch (error) {}
};

onMounted(() => {
	handleGetPersonType();
});
</script>

<style>
/* 全局样式重置 */
* {
	box-sizing: border-box;
}

html,
body {
	margin: 0;
	padding: 0;
	width: 100%;
	height: 100%;
}

body {
	font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
}

.el-popover {
	width: 100%;
	font-family: "Microsoft YaHei";
	color: rgba(95, 101, 108, 1);
	font-style: Regular;
	font-size: 16px;
	font-weight: 400;
	line-height: 30px;
	letter-spacing: 0px;
	text-align: justify;
}

.el-popper[data-popper-placement^="top"] > .el-popper__arrow:before {
	display: none;
}

/* #region 公共样式类名 */
/* 单行文本溢出隐藏显示省略号 */
.one-line-ellipsis {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
/* 多行文本两端对齐 最后一行正常显示 */
.text-align-justify {
  text-align: justify;
  text-align-last: left;
  -webkit-text-align-last: left;
}
/* 可点击文本 鼠标悬浮样式 */
#app .text-click-hover:hover {
	text-decoration: underline;
	color: var(--color-primary-100);
	cursor: pointer;
}
/* #endregion 公共样式类名 */
</style>

<style lang="scss" scoped>
#app {
	font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
}

:deep(.el-input__wrapper) {
	height: 100%;
	box-shadow: none;
	border-radius: 10px;
	background: transparent;
}

:deep(.el-input__wrapper:hover) {
	box-shadow: none !important;
}

:deep(.el-input__wrapper.is-focus) {
	box-shadow: none !important;
}

</style>
