mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-10-04 01:10:36 +00:00
1、解决在线用户强制退出功能 2、初始化系统配置,应用全局 3、预留功能:将把vuex改用pinia(下次上线)
This commit is contained in:
+34
-4
@@ -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");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user