import { getLocalThemeConfigStyle } from './../utils/theme'; import { NextLoading } from "@/plugins/enter-loading"; import store from "@/hooks/useStore"; import { setAddRoute } from "./index"; export function initFrontEndControlRoutes() { // 界面 loading 动画开始执行 NextLoading.start(); // 无 token 停止执行下一步 if (!sessionStorage.getItem("token")) return // 触发初始化用户信息 store.dispatch("userInfo/GET_DATA"); store.commit("themeConfig/setThemeConfig"); // 从缓存中获取保存的cssText const themeConfigStyle = getLocalThemeConfigStyle() if (themeConfigStyle) { document.documentElement.style.cssText = themeConfigStyle } // 添加动态路由 setAddRoute(); }