| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- import { createApp } from "vue";
- import ElementPlus from "element-plus";
- import "element-plus/dist/index.css";
- import App from "./App.vue";
- import router from "./router";
- import store from "./store";
- import md5 from "md5";
- import "./styles/index.css";
- import Uploader from "./components/Uploader.vue";
- import Certs from "./components/Certs.vue";
- const app = createApp(App);
- app.component("Certs", Certs);
- app.component("Uploader", Uploader);
- router.beforeEach(async (to, from, next) => {
- let userId = localStorage.userId;
- if (userId) {
- store.commit("changeLogin", true);
- if (0 === to.matched.length) {
- next("/voyage/voyageList");
- } else if (to.path == "/login" || to.path == "/") {
- next("/voyage/voyageList");
- } else {
- next();
- }
- } else {
- store.commit("changeLogin", false);
- if (to.path == "/login") {
- next();
- } else {
- next("/login");
- }
- }
- });
- router.afterEach((to, from) => {
- let { title } = to.meta;
- document.title = title;
- store.commit("setCurrentMenuItem", to.path);
- store.commit("changefirstTitle", title);
- });
- app.config.globalProperties.check = () => {
- console.log("check");
- };
- app.use(router).use(ElementPlus).use(store).mount("#app");
|