1、解决在线用户强制退出功能 2、初始化系统配置,应用全局 3、预留功能:将把vuex改用pinia(下次上线)

This commit is contained in:
zhangtao
2025-01-10 08:10:12 +08:00
parent 4e15f2ad3d
commit 8d9a64aed3
13 changed files with 136 additions and 32 deletions
+34 -4
View File
@@ -7,8 +7,38 @@ import VChart from "vue-echarts";
import "echarts";
import './style.css'
import { getInitConfig } from "@/api/system/config"
const app = createApp(App);
app.use(router);
app.use(Antd);
app.component("VChart", VChart);
app.mount("#app");
const initConfig = () => {
return getInitConfig()
.then((response) => {
const { status_code, data } = response.data;
if (status_code === 200) {
const configData = JSON.parse(data);
configData.forEach((item) => {
if (item.fied_key === "login_title") {
document.title = item.fied_value || "fastapi vue admin";
} else if (item.fied_key === "login_logo") {
const favicon = document.querySelector('link[rel="icon"]');
if (favicon) {
favicon.href = item.fied_value || "/logo.png";
}
}
});
}
})
.catch((error) => {
message.error("获取系统配置失败");
console.error(error); // 打印错误信息以便调试
});
};
// 初始化配置并挂载应用
initConfig().then(() => {
app.use(router);
app.use(Antd);
app.component("VChart", VChart);
app.mount("#app");
});