<template>
	<el-config-provider :locale="locale2" :size="config.size" :zIndex="config.zIndex" :button="config.button">
		<router-view></router-view>
	</el-config-provider>
</template>

<script setup>
import {useI18n} from 'vue-i18n'
import {computed, ref} from 'vue'
import tools from "@/utils/tools"
import colorTool from '@/utils/color'

const {locale, messages} = useI18n()


const config = ref({
	size: 'default',
	zIndex: 2000,
	button: {
		autoInsertSpace: false
	}
})

//设置主题颜色
const app_color = tools.data.get('APP_COLOR') || "#409EFF"

const locale2 = computed(() => {
	return messages.value[locale.value]
})

console.log('%c PI %c 里派提供技术支持 www.leapy.cn', 'background:#4caf50;color:#fff;border-radius:3px;', '')
if (app_color) {
	document.documentElement.style.setProperty('--el-color-primary', app_color);
	for (let i = 1; i <= 9; i++) {
		document.documentElement.style.setProperty(`--el-color-primary-light-${i}`, colorTool.lighten(app_color, i / 10));
	}
	for (let i = 1; i <= 9; i++) {
		document.documentElement.style.setProperty(`--el-color-primary-dark-${i}`, colorTool.darken(app_color, i / 10));
	}
}
</script>

<style lang="scss">
@use '@/style/style.scss';
</style>
