- 添加Docker相关配置文件(.dockerignore, .env.example, .gitignore) - 实现服务端API代理功能,支持文件、模块和服务器API转发 - 创建文章详情页、栏目文章列表页和单页内容展示页面 - 集成Ant Design Vue组件库并实现SSR样式提取功能 - 定义API响应数据结构类型和应用布局组件 - 开发开发者应用中心和文章管理页面 - 实现CMS导航菜单获取和多租户切换功能
93 lines
2.3 KiB
TypeScript
93 lines
2.3 KiB
TypeScript
function getOrigin(url: string) {
|
|
try {
|
|
return new URL(url).origin
|
|
} catch {
|
|
return ''
|
|
}
|
|
}
|
|
|
|
const tenantId = process.env.NUXT_PUBLIC_TENANT_ID || '10584'
|
|
const serverApiBase =
|
|
process.env.NUXT_PUBLIC_SERVER_API_BASE ||
|
|
process.env.NUXT_PUBLIC_SERVER_API ||
|
|
process.env.SERVER_API_URL ||
|
|
process.env.VITE_SERVER_URL ||
|
|
'https://server.websoft.top/api'
|
|
const modulesApiBase =
|
|
process.env.NUXT_PUBLIC_MODULES_API_BASE ||
|
|
process.env.MODULES_API_URL ||
|
|
process.env.NUXT_PUBLIC_CMS_API_BASE ||
|
|
process.env.API_BASE ||
|
|
'https://cms-api.websoft.top/api'
|
|
const fileServerBase =
|
|
process.env.NUXT_PUBLIC_FILE_SERVER_BASE ||
|
|
process.env.FILE_SERVER_BASE ||
|
|
getOrigin(serverApiBase) ||
|
|
'https://server.websoft.top'
|
|
|
|
const WATCH_IGNORED = [
|
|
'**/.git/**',
|
|
'**/node_modules/**',
|
|
'**/.nuxt/**',
|
|
'**/.output/**',
|
|
'**/dist/**',
|
|
'**/coverage/**',
|
|
'**/.cache/**'
|
|
]
|
|
|
|
// https://nuxt.com/docs/api/configuration/nuxt-config
|
|
export default defineNuxtConfig({
|
|
compatibilityDate: '2025-07-15',
|
|
devtools: { enabled: true },
|
|
modules: ['@nuxtjs/tailwindcss', './modules/fix-tailwind-postcss'],
|
|
app: {
|
|
head: {
|
|
titleTemplate: (titleChunk) => (titleChunk ? `${titleChunk} - 桂乐淘` : '桂乐淘'),
|
|
meta: [
|
|
{ charset: 'utf-8' },
|
|
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
|
|
{ name: 'robots', content: 'index,follow' }
|
|
],
|
|
link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }]
|
|
}
|
|
},
|
|
tailwindcss: {
|
|
cssPath: '~/assets/css/tailwind.css',
|
|
configPath: 'tailwind.config.cjs'
|
|
},
|
|
experimental: { appManifest: false },
|
|
runtimeConfig: {
|
|
public: {
|
|
tenantId,
|
|
serverApiBase,
|
|
modulesApiBase,
|
|
fileServerBase,
|
|
templateId:
|
|
process.env.NUXT_PUBLIC_TEMPLATE_ID || tenantId,
|
|
|
|
// Backward-compatible names (existing code may rely on them)
|
|
ServerApi: serverApiBase,
|
|
ApiBase: modulesApiBase,
|
|
TenantId: tenantId
|
|
}
|
|
},
|
|
css: ['ant-design-vue/dist/reset.css', '~/assets/css/tailwind.css'],
|
|
vite: {
|
|
server: {
|
|
watch: {
|
|
ignored: WATCH_IGNORED
|
|
}
|
|
}
|
|
},
|
|
nitro: {
|
|
watchOptions: {
|
|
ignored: WATCH_IGNORED
|
|
}
|
|
},
|
|
watchers: {
|
|
chokidar: {
|
|
ignored: WATCH_IGNORED
|
|
}
|
|
}
|
|
})
|