39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
import { createApp } from "vue";
|
|
import { createPinia } from "pinia";
|
|
import ElementPlus from "element-plus";
|
|
import zhCn from "element-plus/es/locale/lang/zh-cn";
|
|
import dayjs from "dayjs";
|
|
import "dayjs/locale/zh-cn";
|
|
import "element-plus/dist/index.css";
|
|
import "./styles/main.css";
|
|
import "./styles/unified-page.css";
|
|
|
|
import App from "./App.vue";
|
|
import router from "./router";
|
|
import { getToken } from "./utils/auth";
|
|
import { useStudyStore } from "./store/study";
|
|
import { shouldRequireDesktopServerUrl } from "./runtime/desktopServerConfig";
|
|
|
|
const bootstrap = async () => {
|
|
const app = createApp(App);
|
|
const pinia = createPinia();
|
|
app.use(pinia);
|
|
dayjs.locale("zh-cn");
|
|
app.use(ElementPlus, { locale: zhCn });
|
|
|
|
// 初始化项目上下文
|
|
const studyStore = useStudyStore();
|
|
studyStore.loadCurrentStudy();
|
|
if (getToken() && !shouldRequireDesktopServerUrl()) {
|
|
await studyStore.rehydrateStudyForLastUser();
|
|
await studyStore.loadCurrentStudyPermissions().catch(() => {});
|
|
}
|
|
|
|
app.use(router);
|
|
await router.isReady();
|
|
|
|
app.mount("#app");
|
|
};
|
|
|
|
bootstrap();
|