diff --git a/.env.development b/.env.development index 6dcc9f8..d4e241c 100644 --- a/.env.development +++ b/.env.development @@ -15,16 +15,13 @@ NUXT_PUBLIC_TEMPLATE_ID=template-07 NUXT_PUBLIC_FORCE_TEMPLATE_ID= # ---------- 后端接口 ---------- -# 本地后端(hjc-java)默认端口 9200。 -# 若要联调远程环境,把下面两行注释掉即可,nuxt.config.ts 会自动回落到生产地址 +# 本地后端(hjc-java)默认端口 9200,内容/租户解析/模板解析全部走它。 +# 若要联调远程环境,把下面三行注释掉即可,nuxt.config.ts 会自动回落到生产地址 NUXT_PUBLIC_MODULES_API_BASE=http://127.0.0.1:9200/api -# 本地后端同时提供图片/文件时打开(默认走 https://server.websoft.top) +NUXT_PUBLIC_APP_API_BASE=http://127.0.0.1:9200 +# 本地后端同时提供图片/文件时打开(默认走 https://file.wsdns.cn) # NUXT_PUBLIC_FILE_SERVER_BASE=http://127.0.0.1:9200 -# 其余接口本地开发直接走远程(一般无需修改) -NUXT_PUBLIC_SERVER_API_BASE=https://server.websoft.top/api -NUXT_PUBLIC_APP_API_BASE=https://websopy-api.websoft.top - # ---------- 站点 / 多租户域名 ---------- NUXT_PUBLIC_BASE_DOMAIN=shoplnk.cn NUXT_PUBLIC_BASE_DOMAINS=shoplnk.cn,sitelink.cn,wsdns.cn diff --git a/.env.example b/.env.example index 010fe66..38c4f1e 100644 --- a/.env.example +++ b/.env.example @@ -25,11 +25,9 @@ NUXT_PUBLIC_FORCE_TEMPLATE_ID= # ---------- 后端接口地址 ---------- # 内容/CMS 接口。生产为 https://hjc-api.websoft.top/api NUXT_PUBLIC_MODULES_API_BASE= -# 主服务接口。生产为 https://server.websoft.top/api -NUXT_PUBLIC_SERVER_API_BASE= -# 应用/用户接口。生产为 https://websopy-api.websoft.top +# 租户/模板解析接口。生产为 https://hjc-api.websoft.top(无 /api 后缀) NUXT_PUBLIC_APP_API_BASE= -# 图片/文件服务器。留空则从 SERVER_API_BASE 自动推导 +# 图片/文件服务器。留空则从 APP_API_BASE 自动推导 NUXT_PUBLIC_FILE_SERVER_BASE= # ---------- 多租户域名 ---------- diff --git a/.env.production b/.env.production index de25f0d..98b29fa 100644 --- a/.env.production +++ b/.env.production @@ -6,12 +6,11 @@ # ============================================================ # ---------- 接口(生产必须指向线上) ---------- -# 内容/CMS 接口统一使用 hjc-api 域名(原 cms-api.websoft.top 的 /api/* 已返回 404) +# 单一后端:内容/CMS、租户解析、模板解析全部走 hjc-api NUXT_PUBLIC_MODULES_API_BASE=https://hjc-api.websoft.top/api -NUXT_PUBLIC_SERVER_API_BASE=https://server.websoft.top/api -NUXT_PUBLIC_APP_API_BASE=https://websopy-api.websoft.top -# 图片/文件服务器。留空则由 nuxt.config.ts 从 SERVER_API_BASE 推导出 -# https://server.websoft.top,无需手写 +NUXT_PUBLIC_APP_API_BASE=https://hjc-api.websoft.top +# 图片/文件服务器。留空则由 nuxt.config.ts 从 APP_API_BASE 推导出 +# https://hjc-api.websoft.top,无需手写 NUXT_PUBLIC_FILE_SERVER_BASE= # ---------- 站点 / 多租户域名 ---------- diff --git a/README.md b/README.md index 54a8466..4d4974f 100644 --- a/README.md +++ b/README.md @@ -101,18 +101,16 @@ NUXT_PUBLIC_TENANT_ID= NUXT_PUBLIC_APP_ID=website NUXT_PUBLIC_TEMPLATE_ID= -# 接口地址 -NUXT_PUBLIC_SERVER_API_BASE=https://server.websoft.top/api +# 接口地址(单一后端:内容/CMS、租户解析、模板解析全部走 hjc-api) NUXT_PUBLIC_MODULES_API_BASE=https://hjc-api.websoft.top/api -NUXT_PUBLIC_APP_API_BASE=https://websopy-api.websoft.top +NUXT_PUBLIC_APP_API_BASE=https://hjc-api.websoft.top # 多租户域名 NUXT_PUBLIC_BASE_DOMAINS=shoplnk.cn,sitelink.cn,wsdns.cn ``` -> ℹ️ `nuxt.config.ts` 内置的 `NUXT_PUBLIC_MODULES_API_BASE` 默认值已统一为 -> `https://hjc-api.websoft.top/api`(原 `cms-api.websoft.top` 域名 `/api/*` 已返回 404, -> 故全面切换到 `hjc-api`)。`.env.production` 中也显式指定同一地址。 +> ℹ️ `nuxt.config.ts` 内置的接口默认值已统一为 `https://hjc-api.websoft.top`(单后端)。 +> `.env.production` 中也显式指定同一地址。 > 若将来再次更换域名,请同步修改 `nuxt.config.ts`、`.env.production` 与 `.env.example`。 ## 接口说明 diff --git a/nuxt.config.ts b/nuxt.config.ts index 5bcc77f..73e9e74 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -23,19 +23,16 @@ const forceTemplateId = process.env.NUXT_PUBLIC_FORCE_TEMPLATE_ID || '' // 站点名称覆盖:设置后优先于后端 AppProduct / CMS 返回值(多用于本地调试或强制品牌名) const siteName = process.env.NUXT_PUBLIC_SITE_NAME || '' -const serverApiBase = - process.env.NUXT_PUBLIC_SERVER_API_BASE || - 'https://server.websoft.top/api' const modulesApiBase = process.env.NUXT_PUBLIC_MODULES_API_BASE || 'https://hjc-api.websoft.top/api' const appApiBase = process.env.NUXT_PUBLIC_APP_API_BASE || - 'https://websopy-api.websoft.top' + 'https://hjc-api.websoft.top' const fileServerBase = process.env.NUXT_PUBLIC_FILE_SERVER_BASE || - getOrigin(serverApiBase) || - 'https://server.websoft.top' + getOrigin(appApiBase) || + 'https://hjc-api.websoft.top' const baseDomain = process.env.NUXT_PUBLIC_BASE_DOMAIN || 'shoplnk.cn' // 多主域清单:子域名租户解析支持的主域(逗号分隔)。 @@ -79,11 +76,11 @@ export default defineNuxtConfig({ ], link: [ { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }, - // 提前与内容/接口源站建立连接,降低首字节与图片加载延迟 - { rel: 'preconnect', href: 'https://server.websoft.top', crossorigin: '' }, + // 提前与接口/图片源站建立连接,降低首字节与图片加载延迟 { rel: 'preconnect', href: 'https://hjc-api.websoft.top', crossorigin: '' }, - { rel: 'dns-prefetch', href: 'https://server.websoft.top' }, { rel: 'dns-prefetch', href: 'https://hjc-api.websoft.top' }, + { rel: 'preconnect', href: 'https://file.wsdns.cn', crossorigin: '' }, + { rel: 'dns-prefetch', href: 'https://file.wsdns.cn' }, // 思源黑体(Noto Sans SC,SIL 开源许可,版权无忧)网页字体,全站统一字体 { rel: 'preconnect', href: 'https://fonts.googleapis.cn' }, { rel: 'preconnect', href: 'https://fonts.gstatic.cn', crossorigin: '' }, @@ -120,7 +117,6 @@ export default defineNuxtConfig({ templateId, forceTemplateId, siteName, - serverApiBase, modulesApiBase, appApiBase, fileServerBase,