Skip to content

插件目录结构

以 cs_mall 插件为例

Java 后端目录结构

text
niucloud-addon/
├── cs_mall/
│   ├── pom.xml                                             # Maven配置文件
│   └── src/
│       └── main/
│           ├── java/                                       # Java源代码目录
│           │   └── com/
│           │       └── niu/
│           │           └── cs_mall/
│           │               ├── WebApplication.java        # 插件入口类
│           │               ├── config/                    # 配置类
│           │               ├── controller/                # 控制器层
│           │                    ├── adminapi/                 # 后台管理API
│           │                    └── api/                      # 前端用户API
│           │               ├── entity/                    # 实体类
│           │               ├── enums/                     # 枚举类
│           │               ├── event/                     # 事件定义
│           │               ├── job/                        # 定时任务
│           │               ├── listener/                   # 事件监听器
│           │               ├── mapper/                     # 数据访问层
│           │               └── service/                    # 业务逻辑层
│           └── resources/     # 资源文件目录
│               ├── info.json                 # 插件元数据配置
│               └── cs_mall/
│                   ├── config/               # 配置文件
│                   ├── i18n/                 # 国际化资源
│                   └── loader/               # 加载器配置

web 前端目录结构

text
web/addon/cs_mall/
├── api/                        # API 接口定义
│   └── hello_world.ts          # 示例 API 接口
├── lang/                       # 国际化资源
│   └── zh-cn/
│       ├── hello_world.index.json  # 页面国际化配置
│       └── pages.json          # 页面路由国际化配置
└── pages/                      # 页面组件
    ├── hello_world/            # 示例页面
    │   └── index.vue           # 页面组件
    └── routes.ts               # 页面路由配置

uni-app 前端目录结构

text
uni-app/src/addon/cs_mall/
├── api/                        # API 接口定义
│   └── hello_world.ts          # 示例 API 接口
├── locale/                     # 国际化资源
│   ├── en.json                 # 英文国际化配置
│   ├── zh-Hans/                # 中文国际化配置
│   │   └── pages.hello_world.index.json  # 页面国际化配置
│   └── zh-Hans.json            # 中文基础国际化配置
└── pages/                      # 页面组件
    └── hello_world/            # 示例页面
        └── index.vue           # 页面组件

admin 前端目录结构

text
admin/src/addon/cs_mall/
├── api/                        # API 接口定义
│   └── hello_world.ts          # 示例 API 接口
├── lang/                       # 国际化资源
│   └── zh-cn/
│       └── hello_world.index.json  # 页面国际化配置
└── views/                      # 页面组件
    └── hello_world/            # 示例页面
        └── index.vue           # 页面组件

webroot 目录结构

text
webroot/addon/cs_mall/  
├── admin/                      # 管理后台资源
│   ├── api/                    # API 接口定义
│   │   └── hello_world.ts      # 示例 API 接口
│   ├── lang/                   # 国际化资源
│   │   └── zh-cn/              # 中文国际化
│   └── views/                  # 页面组件
│       └── hello_world/        # 示例页面
├── info.json                   # 插件元数据配置
├── java/                       # Java 编译后文件
│   ├── pom.xml                 # Maven 项目配置
│   └── src/main/               # 源代码
├── menu/                       # 菜单配置
│   ├── admin.json              # 后台菜单配置
│   └── site.json               # 前端菜单配置
├── package/                    # 打包相关
│   └── uni-app-pages.txt       # 移动端页面配置
├── resource/                   # 静态资源
│   ├── cover.png               # 插件封面图
│   └── icon.png                # 插件图标
├── sql/                        # 数据库脚本
│   ├── install.sql             # 安装脚本
│   └── uninstall.sql           # 卸载脚本
├── uni-app/                    # 移动端资源
│   ├── api/                    # API 接口定义
│   │   └── hello_world.ts      # 示例 API 接口
│   ├── locale/                 # 国际化资源
│   │   ├── en.json             # 英文国际化
│   │   ├── zh-Hans/            # 中文国际化
│   │   └── zh-Hans.json        # 中文基础国际化
│   └── pages/                  # 页面组件
│       └── hello_world/        # 示例页面
└── web/                        # Web 前端资源
    ├── info.json               # 插件配置文件
    ├── api/                    # API 接口定义
    │   └── hello_world.ts      # 示例 API 接口
    ├── lang/                   # 国际化资源
    │   └── zh-cn/              # 中文国际化
    └── pages/                  # 页面组件
        ├── hello_world/        # 示例页面
        └── routes.ts           # 路由配置

基于 MIT 协议发布