2025-12-13 14:13:31 +08:00
|
|
|
import { createApp } from 'vue'
|
|
|
|
|
import { createPinia } from 'pinia'
|
|
|
|
|
import ElementPlus from 'element-plus'
|
|
|
|
|
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
|
|
|
|
|
import 'element-plus/dist/index.css'
|
|
|
|
|
|
2025-12-13 18:44:28 +08:00
|
|
|
import './assets/css/common.scss'
|
|
|
|
|
|
2025-12-13 14:13:31 +08:00
|
|
|
import App from './App.vue'
|
|
|
|
|
import router from './router/'
|
|
|
|
|
import { AES_SECRET_KEY } from './config'
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
import { initAesEncrypt } from 'shared/utils'
|
|
|
|
|
|
|
|
|
|
// 异步初始化应用
|
|
|
|
|
async function initApp() {
|
|
|
|
|
// 1. 初始化 AES 加密工具
|
|
|
|
|
try {
|
|
|
|
|
await initAesEncrypt(AES_SECRET_KEY)
|
|
|
|
|
console.log('✅ AES 加密工具初始化成功')
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error('❌ AES 加密工具初始化失败:', error)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 2. 创建 Vue 应用
|
|
|
|
|
const app = createApp(App)
|
|
|
|
|
|
|
|
|
|
// 3. 注册 Pinia
|
|
|
|
|
const pinia = createPinia()
|
|
|
|
|
app.use(pinia)
|
|
|
|
|
|
|
|
|
|
// 4. 注册 Element Plus
|
|
|
|
|
app.use(ElementPlus)
|
|
|
|
|
|
|
|
|
|
// 5. 注册所有 Element Plus 图标
|
|
|
|
|
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
|
|
|
|
app.component(key, component)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 6. 注册路由
|
|
|
|
|
app.use(router)
|
|
|
|
|
|
|
|
|
|
// 7. 挂载应用
|
|
|
|
|
app.mount('#app')
|
|
|
|
|
|
|
|
|
|
console.log('✅ Workcase 应用启动成功')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 启动应用
|
|
|
|
|
initApp()
|