From cabc1ce19c57a7c7388502952eaaafd558363145 Mon Sep 17 00:00:00 2001 From: 杨磊 <505174330@qq.com> Date: 星期五, 22 八月 2025 18:18:51 +0800 Subject: [PATCH] 数字教材相关 --- src/main.js | 94 ++++++++++++++--------------------------------- 1 files changed, 28 insertions(+), 66 deletions(-) diff --git a/src/main.js b/src/main.js index 8069249..d8c10a0 100644 --- a/src/main.js +++ b/src/main.js @@ -1,71 +1,33 @@ -import Vue from "vue"; -import App from "./App.vue"; -import router from "./router"; -import store from "./store"; +import './assets/main.css' -// 鑷畾涔夐厤缃� +import { createApp } from 'vue' +import { createPinia } from 'pinia' -import "@/assets/iconfont/iconfont.css"; -import config from "@/assets/js/config"; -Vue.prototype.config = config; +import App from './App.vue' +// 瀹屾暣寮曞叆 Element Plus +import ElementPlus from 'element-plus' +import 'element-plus/dist/index.css' +import * as ElementPlusIconsVue from '@element-plus/icons-vue' +import router from './router' +import MG from '@/assets/js/middleGround/WebMiddleGroundApi.js' +import toolClass from '@/assets/js/toolClass.js' +import config from '@/assets/js/config.js' +import zhCn from 'element-plus/dist/locale/zh-cn.mjs' -// axios -import service from "@/plugin/axios"; -Vue.prototype.request = service; +const app = createApp(App) -import { - setNewView -} from "@/assets/js/userAction" -Vue.prototype.setNewView = setNewView; -// ElementUI -import ElementUI from "element-ui"; -import "@/assets/theme/index.css"; -Vue.use(ElementUI); +app.provide('config', config) +app.provide('MG', MG) +app.provide('toolClass', toolClass) -import { - tokenKey -} from "@/assets/js/config"; -//宸ュ叿绫� -import tool from "@/assets/js/toolClass"; -Vue.prototype.tool = tool; - -// 璺敱鍒ゆ柇鐧诲綍 鏍规嵁璺敱閰嶇疆鏂囦欢鐨勫弬鏁� -router.beforeEach((to, from, next) => { - if (to.matched.some((record) => record.meta.authentication)) { - // 鍒ゆ柇璇ヨ矾鐢辨槸鍚﹂渶瑕佺櫥褰曟潈闄� - if (tool.getCookie(tokenKey)) { - // 鍒ゆ柇褰撳墠鐨則oken鏄惁瀛樺湪 锛� 鐧诲綍瀛樺叆鐨則oken - if (to.path === "/login") { - tool.delCookie(tokenKey); - // removeToken(); - window.location.reload(); - } else { - next(); - } - } else { - next({ - path: "/login", - query: { - redirect: to.fullPath - }, // 灏嗚烦杞殑璺敱path浣滀负鍙傛暟锛岀櫥褰曟垚鍔熷悗璺宠浆鍒拌璺敱 - }); - } - } else { - next(); - } -}); -// 璇锋眰澶勭悊 -import MG from "@/assets/js/middleGround/WebMiddleGroundApi"; -Vue.prototype.MG = MG; - -// 鏃堕棿澶勭悊 -import moment from "moment"; -Vue.prototype.moment = moment; - -Vue.config.productionTip = false; - -new Vue({ - router, - store, - render: (h) => h(App), -}).$mount("#app"); \ No newline at end of file +// 娉ㄥ唽鎵�鏈夊浘鏍� +for (const [key, component] of Object.entries(ElementPlusIconsVue)) { + app.component(key, component) +} +app.use(ElementPlus) +app.use(createPinia()) +app.use(router) +app.use(ElementPlus, { + locale: zhCn, +}) +app.mount('#app') -- Gitblit v1.9.1