2025-12-13 14:13:31 +08:00
|
|
|
|
import { createApp } from 'vue'
|
|
|
|
|
|
import { createPinia } from 'pinia'
|
|
|
|
|
|
import ElementPlus from 'element-plus'
|
|
|
|
|
|
import 'element-plus/dist/index.css'
|
|
|
|
|
|
|
2025-12-13 18:44:28 +08:00
|
|
|
|
import './assets/css/common.scss'
|
|
|
|
|
|
|
2026-01-08 14:01:27 +08:00
|
|
|
|
// 注意:shared 的样式现在通过 index.html 中的 <link> 标签加载
|
|
|
|
|
|
// 不再需要在这里导入:import 'shared/styles'
|
2026-01-08 13:20:40 +08:00
|
|
|
|
|
2025-12-13 14:13:31 +08:00
|
|
|
|
import App from './App.vue'
|
|
|
|
|
|
import router from './router/'
|
2025-12-20 15:14:44 +08:00
|
|
|
|
import { AES_SECRET_KEY } from './config/index'
|
2025-12-13 14:13:31 +08:00
|
|
|
|
|
2025-12-17 15:32:58 +08:00
|
|
|
|
// 导入需要的 Lucide 图标(用于动态组件)
|
|
|
|
|
|
import {
|
|
|
|
|
|
MessageCircle,
|
|
|
|
|
|
LayoutGrid,
|
|
|
|
|
|
Workflow,
|
|
|
|
|
|
FileText,
|
|
|
|
|
|
Headphones,
|
|
|
|
|
|
BarChart3,
|
|
|
|
|
|
Users,
|
|
|
|
|
|
User,
|
|
|
|
|
|
Settings,
|
|
|
|
|
|
Home,
|
|
|
|
|
|
Ticket,
|
|
|
|
|
|
Bot,
|
|
|
|
|
|
ScrollText,
|
|
|
|
|
|
Monitor,
|
|
|
|
|
|
Server,
|
|
|
|
|
|
ChevronDown,
|
|
|
|
|
|
ChevronRight,
|
|
|
|
|
|
ChevronLeft,
|
|
|
|
|
|
PanelLeftClose,
|
|
|
|
|
|
PanelLeftOpen,
|
|
|
|
|
|
RefreshCw,
|
|
|
|
|
|
Loader,
|
|
|
|
|
|
LogOut,
|
|
|
|
|
|
Plus,
|
|
|
|
|
|
Trash2,
|
|
|
|
|
|
Clock,
|
|
|
|
|
|
Search,
|
|
|
|
|
|
AlertTriangle,
|
|
|
|
|
|
Wrench,
|
|
|
|
|
|
Paperclip,
|
|
|
|
|
|
Send,
|
|
|
|
|
|
History,
|
|
|
|
|
|
X,
|
|
|
|
|
|
Menu
|
|
|
|
|
|
} from 'lucide-vue-next'
|
|
|
|
|
|
|
|
|
|
|
|
// Lucide 图标映射(用于全局注册)
|
|
|
|
|
|
const lucideIcons = {
|
|
|
|
|
|
MessageCircle,
|
|
|
|
|
|
LayoutGrid,
|
|
|
|
|
|
Workflow,
|
|
|
|
|
|
FileText,
|
|
|
|
|
|
Headphones,
|
|
|
|
|
|
BarChart3,
|
|
|
|
|
|
Users,
|
|
|
|
|
|
User,
|
|
|
|
|
|
Settings,
|
|
|
|
|
|
Home,
|
|
|
|
|
|
Ticket,
|
|
|
|
|
|
Bot,
|
|
|
|
|
|
ScrollText,
|
|
|
|
|
|
Monitor,
|
|
|
|
|
|
Server,
|
|
|
|
|
|
ChevronDown,
|
|
|
|
|
|
ChevronRight,
|
|
|
|
|
|
ChevronLeft,
|
|
|
|
|
|
PanelLeftClose,
|
|
|
|
|
|
PanelLeftOpen,
|
|
|
|
|
|
RefreshCw,
|
|
|
|
|
|
Loader,
|
|
|
|
|
|
LogOut,
|
|
|
|
|
|
Plus,
|
|
|
|
|
|
Trash2,
|
|
|
|
|
|
Clock,
|
|
|
|
|
|
Search,
|
|
|
|
|
|
AlertTriangle,
|
|
|
|
|
|
Wrench,
|
|
|
|
|
|
Paperclip,
|
|
|
|
|
|
Send,
|
|
|
|
|
|
History,
|
|
|
|
|
|
X,
|
|
|
|
|
|
Menu
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-12-13 14:13:31 +08:00
|
|
|
|
// 异步初始化应用
|
|
|
|
|
|
async function initApp() {
|
2026-01-07 15:30:29 +08:00
|
|
|
|
// 1. 创建 Vue 应用
|
2025-12-13 14:13:31 +08:00
|
|
|
|
const app = createApp(App)
|
|
|
|
|
|
|
2026-01-07 15:30:29 +08:00
|
|
|
|
// 2. 注册 Pinia
|
2025-12-13 14:13:31 +08:00
|
|
|
|
const pinia = createPinia()
|
|
|
|
|
|
app.use(pinia)
|
|
|
|
|
|
|
2026-01-07 15:30:29 +08:00
|
|
|
|
// 3. 注册 Element Plus
|
2025-12-13 14:13:31 +08:00
|
|
|
|
app.use(ElementPlus)
|
|
|
|
|
|
|
2026-01-07 15:30:29 +08:00
|
|
|
|
// 4. 注册 Lucide 图标(用于动态组件)
|
2025-12-17 15:32:58 +08:00
|
|
|
|
for (const [name, component] of Object.entries(lucideIcons)) {
|
|
|
|
|
|
app.component(name, component)
|
2025-12-13 14:13:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-07 15:30:29 +08:00
|
|
|
|
// 5. 注册路由
|
2025-12-13 14:13:31 +08:00
|
|
|
|
app.use(router)
|
|
|
|
|
|
|
2026-01-07 15:30:29 +08:00
|
|
|
|
// 6. 立即挂载应用(不等待 AES 初始化)
|
2025-12-13 14:13:31 +08:00
|
|
|
|
app.mount('#app')
|
|
|
|
|
|
|
|
|
|
|
|
console.log('✅ Workcase 应用启动成功')
|
2026-01-07 15:30:29 +08:00
|
|
|
|
|
|
|
|
|
|
// 7. 后台初始化 AES 加密工具(不阻塞渲染)
|
|
|
|
|
|
try {
|
|
|
|
|
|
const { initAesEncrypt } = await import('shared/utils')
|
|
|
|
|
|
await initAesEncrypt(AES_SECRET_KEY)
|
|
|
|
|
|
console.log('✅ AES 加密工具初始化成功')
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
console.error('❌ AES 加密工具初始化失败:', error)
|
|
|
|
|
|
}
|
2025-12-13 14:13:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 启动应用
|
2026-01-07 15:30:29 +08:00
|
|
|
|
console.log('🚀 开始初始化 Workcase 应用...')
|
|
|
|
|
|
initApp().catch(error => {
|
|
|
|
|
|
console.error('❌ 应用初始化失败:', error)
|
|
|
|
|
|
})
|