更新:2026-09-05 16:11

RuleApiVisible 配置中心部署(静态产物并入 RuleApiPro)

配置中心(Nuxt4 + Element Plus)的正确部署形态ssr:false + nitro.preset:'static' 构建为纯静态站点,产物复制进 RuleApiPro/src/main/resources/static/,随后端 jar 一起打包部署——无需独立 Node/nginx 服务。

1. 构建(纯静态)

cd RuleApiVisible
npm install
npm run build        # Nitro static 预设 → 产出 .output/public/(纯静态 HTML)

关键配置(nuxt.config.js):

ssr: false,                     // 关闭 SSR,纯客户端渲染
nitro: { preset: 'static' },    // 静态站点预设:构建出可直接静态托管的文件
app: { head: { ... } },
runtimeConfig: { public: { baseUrl: '/' } }   // API 走同源根(见 §3)

2. 并入 RuleApiPro(关键步骤)

将构建产物(.output/public/ 内容)复制到 RuleApiPro/src/main/resources/static/

# RuleApiVisible 构建产物目录
cd RuleApiVisible
ls .output/public                    # 应有 index.html / apiSystem/... / _nuxt/...

# 复制到 RuleApiPro 静态资源根(先清旧产物,保留自定义覆盖)
cd RuleApiPro/src/main/resources/static
# (可选)备份:cp -r . static.bak

复制后 RuleApiPro 的 static/ 结构(示例,实际约 90 个页面):

RuleApiPro/src/main/resources/static/
├── index.html                    # 配置中心入口
├── 200.html / 404.html
├── _nuxt/…                       # 前端静态资源(打包产物)
└── apiSystem/
    ├── home/index.html           # 配置中心首页
    ├── config/…                  # 系统配置(mysql/redis/key/email/cache/cr/setUp/sfety)
    ├── pay/…                     # 支付配置(setUp/alipay/wxpay/epay/paypal/applePay/package)
    ├── user/…                    # 用户管理(users/vip/banuser/…)
    ├── shop/…  soft/…  gpt/…  minigame/…  forum/…  space/…  chat/…
    ├── upload/…                  # 文件存储(setUp/cos/oss/qiniu/ftp/s3/files)
    ├── wechat/…                  # 微信(config/push/template/log)
    └── statistics/…              # 统计与系统监控

Spring Boot 将 classpath:/static/ 作为默认静态资源目录:jar 内 BOOT-INF/classes/static/apiSystem/... 通过 http://域名/apiSystem/... 直接访问。

3. 与 RuleApi 联动

  • runtimeConfig.public.baseUrl = '/':配置中心 API 请求指向同源根(如 https://api.ruletree.club/apiSystem/... 页面请求 /install/.../system/...),经 nginx 统一反代到后端 127.0.0.1:8081
  • 若配置中心部署在独立域名:把 baseUrl 改成后端绝对地址(如 https://api.ruletree.club/)后重新构建。
  • 登录/管理 KEY:即后端 application.propertieswebinfo.key;登录后 token 存 localStorage api_token

4. 完整配置项地图(基于 RuleApiVisible 真实页面)

以下为配置中心可管理的全部配置域,对应 RuleApiVisible/pages/apiSystem/**

4.1 系统级(config/)

页面 配置项
config/setUp 站点基础(站点名/描述/关键字/baseUrl 等)
config/mysql 数据库配置查看/测试(setupMysql)
config/redis Redis 配置与测试(setupRedis)
config/email SMTP 邮箱(setupEmail)
config/key WebKey / 管理访问 KEY(setupWebKey)
config/cache 缓存清理(cleanRedis/clearCache)
config/cr 轮播/呈现相关配置
config/sfety 安全/风控(banIP、ruletreeDBan、authorizeType 等)

4.2 业务模块

页面 主要配置
内容 content/setUp content/list content/comments content/metas content/violation 文章开关、分类、评论审核、违规词
商城 shop/setUp shop/list shop/shoptype shop/store shop/comments 商城开关、商品/类型/店铺、评价、支付链路
软件库 soft/category soft/list soft/comment soft/contribute 分类、软件管理(APK 上传解析)、评论/投稿审核
论坛 other/forumSection other/forumPost other/forumComment 版块、帖子、回帖管理
动态/空间 other/space 动态管理
聊天 other/chatGroupType other/chatroom other/groupAudit other/groupConfig 群类型、聊天室、群审核与配置
AI/GPT gpt/source gpt/category gpt/apps gpt/chat gpt/ai 渠道、分类、应用、会话记录
小游戏 minigame/list minigame/prize minigame/record minigame/setUp 活动、奖品、发放记录、基础配置
广告 other/ads 广告位与投放

4.3 支付与财务

页面 配置项
pay/setUp 支付整体开关(scancodePay/WxPay/EPay 等入口)
pay/alipay pay/wxpay pay/epay pay/paypal pay/applePay 各通道商户参数
pay/package 充值套餐(VIP/资产套餐)
finance/list finance/recharge finance/withdraw finance/tokenpay finance/giftvip 财务流水、充值、提现、卡密、赠送 VIP

4.4 用户与内容管理

页面 配置项
user/users user/banuser user/clean user/vip user/giftvip user/exp 用户列表/封禁/清理/VIP/经验
user/setUp user/sms user/identify user/report user/selfdelete user/endexception user/honor user/invitation user/senduser 注册设置、短信、实名、举报、注销、例外、荣誉、邀请、站内信
view/carousel view/navigation view/components 首页轮播、导航、组件配置
app/list applets/weixin applets/qq 客户端版本、微信/QQ 小程序配置
authorize/setup 授权验证(域名/授权码)

4.5 微信与推送/存储

页面 配置项
wechat/config wechat/push wechat/template wechat/log 公众号 AppID/Secret、群发、模板、日志
push/setUp push/emailtemplate 推送开关、邮件模板
upload/setUp upload/cos upload/oss upload/qiniu upload/ftp upload/s3 upload/files 文件存储通道(本机/COS/OSS/七牛/FTP/S3)

4.6 统计与监控

页面 配置项
statistics/index 平台统计(今日/趋势/历史)
statistics/monitor 系统监控(JVM/Server/MySQL/Redis/请求统计)

5. 重新构建并同步 jar

# 1) 重新构建配置中心静态产物
cd RuleApiVisible
npm install
npm run build

# 2) 同步到 RuleApiPro 静态目录
rm -rf RuleApiPro/src/main/resources/static/apiSystem
cp -r .output/public/* RuleApiPro/src/main/resources/static/

# 3) 重新打包 RuleApiPro
cd RuleApiPro
mvn clean package -DskipTests

「刷新数据表」(home 页 / install/proInstall)负责数据库表结构升级,与前端静态产物无关——两者独立更新。

6. 访问入口

  • 配置中心首页:https://你的域名/apiSystem/home(或 https://你的域名/ 若 index 指向)。
  • 各配置页路径与 static/apiSystem/** 一一对应(如 .../apiSystem/pay/setUp)。

7. 常见问题

现象 排查
配置中心打不开 jar 未含 static 产物(重新构建并入);或 nginx 未把 /apiSystem/ 交给后端
页面接口 404 baseUrl='/' 时后端须在根路径反代;独立域名时改 baseUrl 重建
配置不生效 保存后部分配置依赖 Redis 缓存:到 config/cache 清理缓存
新页面缺失 重新 npm run build 并同步 static 后重打包 jar