diff --git a/.env.production b/.env.production
index 78976f3..46e631f 100644
--- a/.env.production
+++ b/.env.production
@@ -2,4 +2,4 @@
VITE_APP_ENV=production
# 生产环境 API
-VITE_API_BASE_URL=https://your-production-domain.com
\ No newline at end of file
+VITE_API_BASE_URL=https://dbqb.nfdxy.net/activityApi
\ No newline at end of file
diff --git a/pages/landingDetail.html b/pages/landingDetail.html
new file mode 100644
index 0000000..4aa656d
--- /dev/null
+++ b/pages/landingDetail.html
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+ landingDetail
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/landingList.html b/pages/landingList.html
new file mode 100644
index 0000000..6b17615
--- /dev/null
+++ b/pages/landingList.html
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+ landingList
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/landingManagement.html b/pages/landingManagement.html
new file mode 100644
index 0000000..dc3a05e
--- /dev/null
+++ b/pages/landingManagement.html
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+ landingManagement
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main.js b/src/main.js
index 70d979e..66ca089 100644
--- a/src/main.js
+++ b/src/main.js
@@ -1,15 +1,87 @@
+// src/main.js
import { createApp } from 'vue'
-import App from './App.vue'
-import router from './router'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
-const app = createApp(App)
+// 获取当前页面名称
+function getCurrentPage() {
+ const path = window.location.pathname
+ console.log('Current path:', path)
-app.use(router)
-app.use(ElementPlus, {
- locale: zhCn
-})
+ let page = 'landingList' // 默认页面
-app.mount('#app')
+ if (path.includes('/pages/')) {
+ page = path.split('/pages/').pop().replace('.html', '')
+ } else if (path.endsWith('.html')) {
+ page = path.split('/').pop().replace('.html', '')
+ }
+
+ console.log('Detected page:', page)
+ return page
+}
+
+// 动态加载对应的 Vue 组件
+async function bootstrap() {
+ const pageName = getCurrentPage()
+ console.log('Loading page:', pageName)
+
+ try {
+ // 动态导入所有 admin 目录下的 Vue 文件
+ const modules = import.meta.glob('./views/admin/*.vue')
+ const modulePath = `./views/admin/${pageName}.vue`
+
+ console.log('Looking for module:', modulePath)
+ console.log('Available modules:', Object.keys(modules))
+
+ if (modules[modulePath]) {
+ const module = await modules[modulePath]()
+ console.log('Module loaded successfully')
+
+ // 创建并挂载应用
+ const app = createApp(module.default)
+ app.use(ElementPlus, {
+ locale: zhCn
+ })
+ app.mount('#app')
+
+ console.log('App mounted successfully')
+ } else {
+ console.error(`Page ${pageName} not found`)
+
+ // 显示错误页面
+ const app = createApp({
+ template: `
+
+
页面未找到
+
页面 ${pageName} 不存在
+
可用页面: ${Object.keys(modules).map(m => m.replace('./views/admin/', '').replace('.vue', '')).join(', ')}
+
+ `
+ })
+ app.use(ElementPlus, { locale: zhCn })
+ app.mount('#app')
+ }
+ } catch (error) {
+ console.error('Failed to load page:', error)
+
+ // 显示错误信息
+ const app = createApp({
+ template: `
+
+
页面加载失败
+
错误: ${error.message}
+
请检查控制台获取详细信息
+
+ `
+ })
+ app.mount('#app')
+ }
+}
+
+// 启动应用
+if (document.readyState === 'loading') {
+ document.addEventListener('DOMContentLoaded', bootstrap)
+} else {
+ bootstrap()
+}
\ No newline at end of file
diff --git a/vite.config.js b/vite.config.js
index 4217010..2835e12 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -1,18 +1,60 @@
-import { fileURLToPath, URL } from 'node:url'
-
+// vite.config.js
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
-import vueDevTools from 'vite-plugin-vue-devtools'
+import { resolve } from 'path'
+import { readdirSync, existsSync, mkdirSync, writeFileSync } from 'fs'
+
+function setupMultiPage() {
+ const pagesDir = './pages'
+ const viewsDir = './src/views/admin'
+
+ if (!existsSync(pagesDir)) {
+ mkdirSync(pagesDir)
+ }
+
+ const vueFiles = readdirSync(viewsDir).filter(file => file.endsWith('.vue'))
+ const input = {}
+
+ vueFiles.forEach(file => {
+ const pageName = file.replace('.vue', '')
+ const htmlPath = `${pagesDir}/${pageName}.html`
+
+ const htmlContent = `
+
+
+
+
+
+ ${pageName}
+
+
+
+
+
+`
+
+ writeFileSync(htmlPath, htmlContent)
+ input[pageName] = resolve(__dirname, htmlPath)
+ })
+
+ return input
+}
-// https://vite.dev/config/
export default defineConfig({
- plugins: [
- vue(),
- vueDevTools(),
- ],
- resolve: {
- alias: {
- '@': fileURLToPath(new URL('./src', import.meta.url))
- },
+ plugins: [vue()],
+ build: {
+ rollupOptions: {
+ input: {
+ // 添加 index.html 作为默认页面
+ index: resolve(__dirname, 'index.html'),
+ ...setupMultiPage()
+ }
+ }
},
-})
+ preview: {
+ port: 4173,
+ host: true,
+ // 设置默认打开的页面
+ open: '/pages/landingList.html'
+ }
+})
\ No newline at end of file