GoWindGoWind
首页
框架
GoWind Toolkit
  • 开源项目

    • GoWind Admin(后台管理)
    • GoWind CMS(内容管理)
    • GoWind UBA(行为分析)
    • GoWind Shop(电商)
    • GoWind Kanban(协作看板)
    • GoWind Ledger(家庭记账)
    • GoWind ShortPlay(短剧社区)
    • GoWind Ops(运维平台)
    • RushWind(Rust 生态)
  • Open Core(社区开源 · 企业版增强)

    • GoWind OA(协同办公)
    • GoWind ERP(业财一体)
    • GoWind WMS(多货主仓储)
  • 商业产品

    • GoWind IM(即时通讯)
    • GoWind CRM(B2B 销售管理)
    • GoWind Trade(外贸全流程管理)
    • GoWind IoT(物联网)
    • GoWind Edu(AI 教育)
    • GoWind MES(制造执行)
    • GoWind CDC(数据管道)
    • GoWind SDP(零信任网关)
    • GoWind Quant(量化研究)
    • GoWind Trade Radar(外贸选品雷达)
    • GoWind Game Radar(游戏立项雷达)
  • 简体中文
  • English
GitHub
首页
框架
GoWind Toolkit
  • 开源项目

    • GoWind Admin(后台管理)
    • GoWind CMS(内容管理)
    • GoWind UBA(行为分析)
    • GoWind Shop(电商)
    • GoWind Kanban(协作看板)
    • GoWind Ledger(家庭记账)
    • GoWind ShortPlay(短剧社区)
    • GoWind Ops(运维平台)
    • RushWind(Rust 生态)
  • Open Core(社区开源 · 企业版增强)

    • GoWind OA(协同办公)
    • GoWind ERP(业财一体)
    • GoWind WMS(多货主仓储)
  • 商业产品

    • GoWind IM(即时通讯)
    • GoWind CRM(B2B 销售管理)
    • GoWind Trade(外贸全流程管理)
    • GoWind IoT(物联网)
    • GoWind Edu(AI 教育)
    • GoWind MES(制造执行)
    • GoWind CDC(数据管道)
    • GoWind SDP(零信任网关)
    • GoWind Quant(量化研究)
    • GoWind Trade Radar(外贸选品雷达)
    • GoWind Game Radar(游戏立项雷达)
  • 简体中文
  • English
GitHub
  • 介绍

    • GoWind CMS 产品介绍
    • GoWind CMS 安装指南
  • 后端文档

    • CMS 后端架构总览
    • CMS 后端模块总览
    • CMS Protobuf API 定义
    • CMS 配置与部署指南
    • 后端扩展机制指南
  • 前端文档

    • CMS 前端架构
    • CMS 前端模块总览
  • 入门教程

    • 新增内容类型全栈实战教程
    • 多端 API 客户端代码生成教程
  • 核心教程

    • 内容多语言翻译实战教程
    • 内容发布工作流实战教程
    • 区块编辑器实战教程
    • Headless API 对接多端实战教程
    • 前台应用开发实战教程
  • 进阶教程

    • 多站点管理实战教程
    • 媒体资源管理实战教程
    • 评论系统实战教程
    • 事件总线架构实战教程
    • Lua 脚本扩展实战教程
  • 高阶教程

    • 权限系统实战教程
    • 双端登录安全实战教程
    • 加密与安全工具实战教程
    • 全文搜索实战教程
    • 任务调度实战教程
    • 实时消息推送实战教程
    • 性能监控实战教程
    • 字典管理系统实战教程
  • 综合教程

    • 全栈集成实战教程
    • 三服务部署实战教程

CMS 前端架构

GoWind CMS 前端由 1 个管理后台 + 4 套前台应用 组成。管理后台基于 Vue Vben Admin,与 GoWind Admin 共享技术基座;四套前台使用不同技术栈对接同一个 Headless App API,实现真正的"一次后端、多端覆盖"。

一、前端全景

二、管理后台

技术栈

技术版本说明
Vue 33.xComposition API
Vben Admin最新企业级中后台框架
Ant Design Vue4.xUI 组件库
Vue Query最新服务端状态管理
Pinia2.x客户端状态管理
Vite5.x构建工具
TypeScript5.x类型安全

目录结构

frontend/admin/
├── apps/
│   └── admin/                  # CMS 管理后台应用
│       ├── src/
│       │   ├── api/            # API 层
│       │   │   ├── client.ts   # ApiClient 单例
│       │   │   ├── index.ts    # 统一导出
│       │   │   ├── composables/ # Vue Query hooks
│       │   │   └── generated/  # Protobuf 自动生成代码
│       │   ├── views/          # 页面视图
│       │   │   ├── content/    # 内容管理(帖子/分类/标签/页面)
│       │   │   ├── site/       # 站点管理
│       │   │   ├── media/      # 媒体资源
│       │   │   ├── system/     # 系统管理(用户/角色/权限/字典)
│       │   │   └── ...         # 其他模块
│       │   ├── router/         # 路由配置
│       │   ├── store/          # Pinia 状态管理
│       │   └── locales/        # 国际化
│       └── ...
├── packages/                   # Monorepo 共享包
│   ├── @core/                  # 核心工具
│   ├── effects/                # 公共效果
│   ├── preferences/            # 偏好设置
│   └── types/                  # 类型定义
├── pnpm-workspace.yaml
└── turbo.json

API 调用模式

管理后台使用与 GoWind Admin 相同的 Vue Query hooks 模式:

// api/composables/post.ts
import { apiClient } from '#/api/client';
import { makeUpdateMask, type PaginationQuery } from '#/transport/rest';

// 列表查询 hook
export function useListPosts(query: PaginationQuery) {
  return useQuery({
    queryKey: ['listPosts', query],
    queryFn: () => apiClient.postService.List(query.toRawParams()),
  });
}

// 创建 mutation
export function useCreatePost() {
  const queryClient = useQueryClient();
  return useMutation({
    mutationFn: (data: Post) => apiClient.postService.Create({ data }),
    onSuccess: () => queryClient.invalidateQueries({ queryKey: ['listPosts'] }),
  });
}

核心功能模块

模块目录说明
帖子管理views/content/post/帖子 CRUD + 翻译编辑 + 区块编辑器
分类管理views/content/category/树形分类 + 翻译
标签管理views/content/tag/标签 CRUD + 翻译
页面管理views/content/page/自定义页面 + 翻译
站点管理views/site/多站点配置
媒体资源views/media/图片/视频/文档管理
系统管理views/system/用户/角色/权限/字典

三、四套前台应用对比

技术栈对比

对比项React (Next.js)Vue (Nuxt.js)TaroFlutter
语言TypeScriptTypeScriptTypeScriptDart
框架Next.jsNuxt.jsTaro 4Flutter
UI 库shadcn/ui—Taro UIMaterial
渲染方式SSR + SSGSSRCSR原生渲染
状态管理Zustand / ContextPiniaTaro 状态BLoC / Cubit
路由App RouterNuxt RouterTaro Routergo_router
API 生成OpenAPI GeneratorOpenAPI GeneratorOpenAPI Generatorswagger_parser + retrofit
国际化next-intl@nuxtjs/i18nTaro i18nflutter_localizations
目标平台PC WebPC Web小程序 + H5Android/iOS/Web/Desktop

适用场景

场景推荐版本原因
企业官网 / 博客React (Next.js)SSR 利于 SEO,生态丰富
快速原型开发Vue (Nuxt.js)开发体验好,约定优于配置
微信小程序Taro一套代码多端运行
原生移动 AppFlutter真正的原生体验,跨平台

四、React 前台详解(Next.js)

目录结构

frontend/app/react/
├── src/
│   ├── app/                    # Next.js App Router
│   │   ├── [locale]/           # 国际化路由(/zh-CN, /en-US)
│   │   │   ├── page.tsx        # 首页
│   │   │   ├── posts/          # 帖子列表 + 详情
│   │   │   ├── categories/     # 分类列表
│   │   │   ├── tags/           # 标签列表
│   │   │   ├── about/          # 关于页
│   │   │   └── settings/       # 设置
│   │   └── layout.tsx          # 根布局
│   ├── components/             # React 组件
│   ├── lib/                    # 工具库
│   │   └── api/                # API 客户端
│   ├── messages/               # 国际化消息文件
│   │   ├── zh-CN.json
│   │   └── en-US.json
│   └── stores/                 # Zustand 状态管理
├── messages/                   # 全局国际化
├── .env.development            # 开发环境变量
├── next.config.ts              # Next.js 配置
└── package.json

环境配置

# .env.development
NEXT_PUBLIC_API_BASE_URL=http://localhost:6700/app/v1
NEXT_PUBLIC_DEFAULT_LOCALE=zh-CN

API 调用示例

// src/lib/api/post.ts
import { apiClient } from './client';

export async function getPosts(locale: string, page = 1, pageSize = 10) {
  const { data } = await apiClient.get('/posts', {
    params: { locale, page, pageSize },
  });
  return data;
}

export async function getPostBySlug(slug: string, locale: string) {
  const { data } = await apiClient.get(`/posts/${slug}`, {
    params: { locale },
  });
  return data;
}

页面组件示例

// src/app/[locale]/posts/[slug]/page.tsx
export default async function PostDetail({
  params: { locale, slug },
}: {
  params: { locale: string; slug: string };
}) {
  const post = await getPostBySlug(slug, locale);

  return (
    <article>
      <h1>{post.title}</h1>
      <div>{post.summary}</div>
      <div dangerouslySetInnerHTML={{ __html: post.content }} />
    </article>
  );
}

五、Flutter 前台详解

Flutter 版本采用了最完善的架构设计,值得所有版本参考。

架构:Feature-First + BLoC

frontend/app/flutter_app/lib/
├── core/                       # 核心层
│   ├── constants/              # 常量
│   ├── network/                # 网络层(dio + retrofit)
│   ├── storage/                # 本地存储(sqflite)
│   ├── router/                 # 路由配置(go_router)
│   ├── theme/                  # 主题(亮色/暗色)
│   └── l10n/                   # 国际化
├── features/                   # 功能模块(Feature-First)
│   ├── home/                   # 首页
│   │   ├── data/               # 数据层(API + Model)
│   │   ├── domain/             # 领域层(Repository + Entity)
│   │   └── presentation/       # 表现层(BLoC + Widget)
│   ├── explore/                # 探索
│   ├── post_detail/            # 文章详情
│   ├── post_list/              # 文章列表
│   ├── category/               # 分类
│   ├── tag/                    # 标签
│   ├── search/                 # 搜索
│   ├── bookmark/               # 书签
│   ├── profile/                # 个人资料
│   └── settings/               # 设置
└── main.dart                   # 应用入口

BLoC 状态管理

// features/post_detail/presentation/bloc/post_detail_bloc.dart
class PostDetailBloc extends Bloc<PostDetailEvent, PostDetailState> {
  final PostRepository repository;

  PostDetailBloc(this.repository) : super(PostDetailInitial()) {
    on<FetchPostDetail>(_onFetchPostDetail);
  }

  Future<void> _onFetchPostDetail(
    FetchPostDetail event,
    Emitter<PostDetailState> emit,
  ) async {
    emit(PostDetailLoading());
    try {
      final post = await repository.getPost(
        id: event.postId,
        locale: event.locale,
      );
      emit(PostDetailLoaded(post));
    } catch (e) {
      emit(PostDetailError(e.toString()));
    }
  }
}

Retrofit API 生成

Flutter 版本通过 swagger_parser 从 OpenAPI 文档自动生成 API 客户端:

// 自动生成的 API 客户端
@RestApi(baseUrl: '/app/v1')
abstract class PostApi {
  factory PostApi(Dio dio, {String baseUrl}) = _PostApi;

  @GET('/posts')
  Future<ListPostResponse> listPosts({
    @Query('locale') String? locale,
    @Query('page') int? page,
    @Query('pageSize') int? pageSize,
  });

  @GET('/posts/{id}')
  Future<Post> getPost(
    @Path('id') int id, {
    @Query('locale') String? locale,
  });
}

六、前台 API 对接

所有四套前台应用都对接同一个 App API,遵循相同的调用约定:

统一 API 调用约定

分页参数

所有列表接口使用统一的分页协议:

GET /app/v1/posts?page=1&pageSize=10&orderBy=createdAt&orderDesc=true&search=关键词

多语言处理

前台通过 locale 参数或 URL 路径指定语言:

方式示例适用场景
Query 参数/posts?locale=zh-CNAPI 调用
URL 路径/zh-CN/posts/hello-worldReact/Vue 前台路由
HeaderAccept-Language: en-USTaro / Flutter

七、国际化架构

管理后台

管理后台使用 Vben Admin 内置的 i18n 系统,支持中文和英文:

src/locales/
├── zh-CN/          # 中文
│   ├── content.json
│   ├── site.json
│   └── system.json
└── en-US/          # 英文
    ├── content.json
    ├── site.json
    └── system.json

前台应用

版本i18n 方案消息文件位置
Reactnext-intlsrc/messages/zh-CN.json, en-US.json
Vue@nuxtjs/i18nlocales/zh-CN.json, en-US.json
TaroTaro i18nsrc/i18n/zh-CN.ts, en-US.ts
Flutterflutter_localizationslib/l10n/app_zh.arb, app_en.arb

八、与 GoWind Admin 前端的复用关系

管理后台前端与 GoWind Admin 高度复用:

共享部分说明
Monorepo 架构同样使用 pnpm workspace + turbo
Vben Admin 框架完全共享
API 层架构Vue Query hooks 模式
系统管理模块用户/角色/权限/字典/菜单等完全复用
主题和国际化共享亮/暗色主题、i18n
CMS 独有部分说明
内容管理模块帖子/分类/标签/页面(Admin 独有)
站点管理模块多站点/导航/站点设置
媒体资源模块图片/视频/文档管理
区块编辑器SectionType 区块化内容构建

九、相关文档

  • CMS 后端架构总览
  • CMS Protobuf API 定义
  • 前台应用开发实战
  • Headless API 对接多端实战
  • GoWind Admin 前端架构 — 管理后台共享基座
Edit this page
最近更新:: 2026/6/21 20:19
Contributors: Bobo
Next
CMS 前端模块总览