├── .gitignore ├── LICENSE ├── package.json ├── README.md ├── templates └── components │ ├── NavBar.vue │ └── ProductCard.vue ├── examples ├── ecommerce-uniapp │ └── uniapp-config.json ├── service-uniapp │ └── uniapp-config.json └── content-uniapp │ └── uniapp-config.json ├── UNIAPP-SPEC.md └── schemas └── uniapp-config.schema.json /.gitignore: -------------------------------------------------------------------------------- 1 | # Dependencies 2 | node_modules/ 3 | /.pnp 4 | .pnp.js 5 | 6 | # Testing 7 | /coverage 8 | 9 | # uni-app 10 | /unpackage 11 | /dist 12 | /.hbuilderx 13 | 14 | # Production 15 | /build 16 | 17 | # Misc 18 | .DS_Store 19 | *.tsbuildinfo 20 | 21 | # Debug 22 | npm-debug.log* 23 | yarn-debug.log* 24 | yarn-error.log* 25 | 26 | # Local env files 27 | .env*.local 28 | .env 29 | 30 | # IDE 31 | .vscode/ 32 | .idea/ 33 | *.swp 34 | *.swo 35 | *~ 36 | 37 | # OS 38 | Thumbs.db 39 | 40 | # Logs 41 | logs 42 | *.log 43 | 44 | # Runtime data 45 | pids 46 | *.pid 47 | *.seed 48 | *.pid.lock 49 | 50 | # Cache 51 | .npm 52 | .eslintcache 53 | .stylelintcache 54 | 55 | # uni-app specific 56 | /src/manifest.json 57 | /src/pages.json -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 VibeTemplate 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "miniprogram-generator", 3 | "version": "1.0.0", 4 | "description": "🚀 AI-powered uni-app miniprogram generator - Transform prompts into production-ready cross-platform applications", 5 | "main": "index.js", 6 | "scripts": { 7 | "validate": "ajv validate -s schemas/uniapp-config.schema.json -d examples/*/uniapp-config.json", 8 | "test": "echo \"Error: no test specified\" && exit 1" 9 | }, 10 | "repository": { 11 | "type": "git", 12 | "url": "git+https://github.com/vibetemplate/miniprogram-generator.git" 13 | }, 14 | "keywords": [ 15 | "uni-app", 16 | "miniprogram", 17 | "vue3", 18 | "typescript", 19 | "cross-platform", 20 | "ai", 21 | "code-generation", 22 | "automation", 23 | "low-code", 24 | "wechat-miniprogram", 25 | "alipay-miniprogram", 26 | "h5", 27 | "app", 28 | "artificial-intelligence", 29 | "web-development", 30 | "developer-tools" 31 | ], 32 | "author": "VibeTemplate", 33 | "license": "MIT", 34 | "bugs": { 35 | "url": "https://github.com/vibetemplate/miniprogram-generator/issues" 36 | }, 37 | "homepage": "https://github.com/vibetemplate/miniprogram-generator#readme", 38 | "devDependencies": { 39 | "ajv-cli": "^5.0.0" 40 | }, 41 | "engines": { 42 | "node": ">=16.0.0" 43 | } 44 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 智能uni-app小程序生成器 🚀 2 | 3 | > 借鉴DXT设计理念,为AI工具提供标准化的uni-app小程序生成模板和规范 4 | 5 | 一个专为Cursor、Claude Code等AI开发工具设计的uni-app小程序生成器库。用户只需复制标准提示词,AI即可自动生成完整的现代化跨平台小程序代码。 6 | 7 | ## ✨ 核心特性 8 | 9 | - 🎯 **标准化提示词** - 一键复制,AI直接理解 10 | - 📋 **结构化配置** - JSON驱动的uni-app小程序定义 11 | - 🎨 **丰富模板** - 电商、服务、内容、工具等类型 12 | - ⚡ **现代技术栈** - uni-app + Vue 3 + TypeScript + Pinia 13 | - 🌐 **跨平台支持** - 微信、支付宝、H5、APP一套代码多端发布 14 | - 🚀 **即用即部署** - 生成即可发布到各大平台 15 | 16 | ## 🚀 快速开始 17 | 18 | ### 1. 复制AI提示词 19 | 20 | 将以下提示词复制到Cursor、Claude Code或其他AI工具中: 21 | 22 | ``` 23 | 我想生成一个现代化的uni-app跨平台小程序。请按照以下步骤操作: 24 | 25 | 1. **仔细阅读规范文档:** 26 | - https://github.com/vibetemplate/miniprogram-generator/blob/main/README.md - uni-app小程序生成器概述和架构模式 27 | - https://github.com/vibetemplate/miniprogram-generator/blob/main/UNIAPP-SPEC.md - 完整的uni-app配置规范和字段定义 28 | - https://github.com/vibetemplate/miniprogram-generator/blob/main/examples - 参考实现,包括电商、服务、内容等示例 29 | 30 | 2. **创建合适的uni-app项目结构:** 31 | - 根据UNIAPP-SPEC.md生成有效的uniapp-config.json配置文件 32 | - 实现现代化的uni-app项目,包含合理的页面和组件结构 33 | - 自动生成pages.json、manifest.json等uni-app配置文件 34 | - 包含跨平台兼容性处理和性能优化 35 | 36 | 3. **遵循最佳开发实践:** 37 | - 使用现代技术栈 (uni-app + Vue 3 + TypeScript + Pinia) 38 | - 组件化开发,页面和组件结构清晰 39 | - 包含适当的错误处理、加载状态和用户交互反馈 40 | - 支持多端适配(微信小程序、支付宝小程序、H5、APP) 41 | - 添加完整的项目配置和发布说明 42 | 43 | 4. **生成生产级代码:** 44 | - 验证所有页面和功能在多端正确实现 45 | - 确保符合各平台开发规范和审核要求 46 | - 包含完整的manifest.json、pages.json等配置文件 47 | - 支持HBuilderX和CLI两种开发方式 48 | 49 | 请生成完整的、可立即发布的uni-app跨平台小程序代码。专注于现代设计、干净的代码和遵循uni-app最佳实践。 50 | ``` 51 | 52 | ### 2. 与AI交互 53 | 54 | AI会自动: 55 | - 📖 读取uni-app开发规范和配置说明 56 | - 🎨 根据您的需求选择合适的模板 57 | - ⚙️ 生成配置文件和项目结构 58 | - 🔧 创建完整的uni-app项目代码 59 | 60 | ### 3. 本地开发 61 | 62 | ```bash 63 | # 通过HBuilderX导入项目 64 | # 或使用CLI开发 65 | npm install -g @dcloudio/uvm 66 | npm install -g @dcloudio/cli 67 | 68 | # 运行到微信小程序 69 | npm run dev:mp-weixin 70 | 71 | # 运行到H5 72 | npm run dev:h5 73 | 74 | # 运行到APP 75 | npm run dev:app 76 | ``` 77 | 78 | ### 4. 发布部署 79 | 80 | ```bash 81 | # 构建微信小程序 82 | npm run build:mp-weixin 83 | 84 | # 构建H5 85 | npm run build:h5 86 | 87 | # 构建APP 88 | npm run build:app 89 | ``` 90 | 91 | ## 📦 支持的小程序类型 92 | 93 | | 类型 | 描述 | 适用场景 | 核心页面 | 跨平台特色 | 94 | |------|------|----------|----------|----------| 95 | | `ecommerce` | 电商购物 | 购物、零售 | 首页、商品、购物车、订单 | 支付适配、地址选择 | 96 | | `service` | 服务预约 | 美容、餐饮、维修 | 首页、服务、预约、个人中心 | 地图定位、时间选择 | 97 | | `content` | 内容资讯 | 新闻、博客、知识 | 首页、文章、分类、搜索 | 富文本展示、分享 | 98 | | `tool` | 工具应用 | 计算器、查询 | 功能页、历史、设置 | 数据存储、导出 | 99 | | `community` | 社区论坛 | 交流、分享 | 首页、发布、动态、消息 | 实时通讯、图片上传 | 100 | 101 | ## 🎨 Vue组件模板库 102 | 103 | ### 基础组件 104 | - `NavBar` - 自定义导航栏(支持状态栏适配) 105 | - `TabBar` - 底部标签栏(多端样式统一) 106 | - `SearchBar` - 搜索组件 107 | - `ProductCard` - 商品卡片 108 | - `UserAvatar` - 用户头像 109 | 110 | ### 业务组件 111 | - `ShoppingCart` - 购物车组件 112 | - `OrderList` - 订单列表 113 | - `CommentList` - 评论列表 114 | - `AddressPicker` - 地址选择器 115 | - `PaymentMethod` - 支付方式选择 116 | 117 | ### 跨平台适配组件 118 | - `PlatformView` - 平台差异化视图 119 | - `SafeArea` - 安全区域适配 120 | - `StatusBar` - 状态栏适配 121 | 122 | ## 📋 配置文件说明 123 | 124 | uni-app小程序通过 `uniapp-config.json` 文件进行配置: 125 | 126 | ```json 127 | { 128 | "spec_version": "1.0", 129 | "project": { 130 | "name": "my-uniapp", 131 | "type": "ecommerce", 132 | "appid": "wx1234567890abcdef", 133 | "title": "我的uni-app小程序", 134 | "description": "跨平台小程序应用" 135 | }, 136 | "platforms": { 137 | "mp-weixin": { "enabled": true }, 138 | "mp-alipay": { "enabled": true }, 139 | "h5": { "enabled": true }, 140 | "app": { "enabled": false } 141 | }, 142 | "pages": [ 143 | { 144 | "path": "pages/index/index", 145 | "name": "首页", 146 | "style": { 147 | "navigationBarTitleText": "首页" 148 | } 149 | } 150 | ], 151 | "features": { 152 | "login": true, 153 | "payment": true, 154 | "location": false 155 | } 156 | } 157 | ``` 158 | 159 | ## 🛠️ 技术栈 160 | 161 | - **开发框架**: uni-app (Vue 3) 162 | - **语言**: TypeScript / JavaScript 163 | - **状态管理**: Pinia 164 | - **UI组件**: uni-ui / uView UI 165 | - **样式**: SCSS / 原子化CSS 166 | - **构建工具**: Vite / HBuilderX 167 | - **跨平台**: 微信小程序、支付宝小程序、H5、APP 168 | 169 | ## 🌐 跨平台特性 170 | 171 | ### 平台适配 172 | - **微信小程序**: 支持最新API和组件 173 | - **支付宝小程序**: 自动适配支付宝规范 174 | - **H5**: 响应式设计,PWA支持 175 | - **APP**: 原生性能,插件扩展 176 | 177 | ### 条件编译 178 | ```javascript 179 | // #ifdef MP-WEIXIN 180 | // 微信小程序特有代码 181 | // #endif 182 | 183 | // #ifdef H5 184 | // H5特有代码 185 | // #endif 186 | 187 | // #ifdef APP-PLUS 188 | // APP特有代码 189 | // #endif 190 | ``` 191 | 192 | ## 📚 学习资源 193 | 194 | - [uni-app官方文档](https://uniapp.dcloud.net.cn/) 195 | - [Vue 3官方文档](https://cn.vuejs.org/) 196 | - [最佳实践指南](./docs/最佳实践.md) 197 | - [配置详细说明](./docs/配置说明.md) 198 | - [跨平台开发指南](./docs/跨平台开发.md) 199 | 200 | ## 🤝 贡献指南 201 | 202 | 欢迎贡献新的模板和组件!请查看 [贡献指南](CONTRIBUTING.md)。 203 | 204 | ## 📄 许可证 205 | 206 | MIT License - 查看 [LICENSE](LICENSE) 文件了解详细信息。 207 | 208 | --- 209 | 210 | 让AI成为您的uni-app跨平台开发伙伴!🚀 -------------------------------------------------------------------------------- /templates/components/NavBar.vue: -------------------------------------------------------------------------------- 1 | 66 | 67 | 220 | 221 | -------------------------------------------------------------------------------- /templates/components/ProductCard.vue: -------------------------------------------------------------------------------- 1 | 90 | 91 | 212 | 213 | -------------------------------------------------------------------------------- /examples/ecommerce-uniapp/uniapp-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "spec_version": "1.0", 3 | "project": { 4 | "name": "fashion-store-uniapp", 5 | "type": "ecommerce", 6 | "appid": "wx1234567890abcdef", 7 | "title": "时尚商城uni-app", 8 | "description": "基于uni-app的跨平台时尚购物应用,一套代码多端运行", 9 | "version": "1.0.0", 10 | "author": "时尚商城团队", 11 | "keywords": ["uni-app", "跨平台", "电商", "时尚", "购物"], 12 | "category": "购物", 13 | "homepage": "https://www.fashionstore.com", 14 | "versionCode": 100 15 | }, 16 | "business": { 17 | "name": "时尚商城", 18 | "logo": { 19 | "light": "/static/images/logo-light.png", 20 | "dark": "/static/images/logo-dark.png" 21 | }, 22 | "slogan": "引领时尚,品质生活,跨平台购物新体验", 23 | "contact": { 24 | "phone": "400-888-9999", 25 | "email": "service@fashionstore.com", 26 | "address": "北京市朝阳区时尚大厦8层", 27 | "wechat": "fashionstore2024", 28 | "website": "https://www.fashionstore.com", 29 | "qq": "800899999" 30 | }, 31 | "service_time": { 32 | "weekdays": "9:00-22:00", 33 | "weekends": "10:00-21:00", 34 | "timezone": "Asia/Shanghai" 35 | } 36 | }, 37 | "platforms": { 38 | "mp-weixin": { 39 | "enabled": true, 40 | "appid": "wx1234567890abcdef", 41 | "setting": { 42 | "urlCheck": false, 43 | "es6": true, 44 | "enhance": true, 45 | "postcss": true, 46 | "minified": true 47 | } 48 | }, 49 | "mp-alipay": { 50 | "enabled": true, 51 | "appid": "alipay_fashion_store", 52 | "setting": { 53 | "minified": true 54 | } 55 | }, 56 | "h5": { 57 | "enabled": true, 58 | "title": "时尚商城 - 跨平台购物体验", 59 | "template": "default", 60 | "router": { 61 | "mode": "history", 62 | "base": "/" 63 | } 64 | }, 65 | "app": { 66 | "enabled": false, 67 | "name": "时尚商城APP", 68 | "appid": "__UNI__FASHION01" 69 | } 70 | }, 71 | "pages": [ 72 | { 73 | "path": "pages/index/index", 74 | "name": "首页", 75 | "type": "home", 76 | "style": { 77 | "navigationBarTitleText": "时尚商城", 78 | "navigationBarBackgroundColor": "#ffffff", 79 | "navigationBarTextStyle": "black", 80 | "backgroundColor": "#f8f8f8", 81 | "enablePullDownRefresh": true, 82 | "onReachBottomDistance": 50 83 | }, 84 | "components": ["banner-swiper", "category-grid", "product-waterfall", "brand-showcase"], 85 | "platforms": ["mp-weixin", "mp-alipay", "h5"], 86 | "data_source": { 87 | "api": "/api/v1/home", 88 | "mock": true, 89 | "cache": true 90 | } 91 | }, 92 | { 93 | "path": "pages/category/index", 94 | "name": "分类", 95 | "type": "list", 96 | "style": { 97 | "navigationBarTitleText": "商品分类", 98 | "enablePullDownRefresh": true 99 | }, 100 | "components": ["category-sidebar", "product-grid", "filter-popup", "sort-tabs"], 101 | "platforms": ["mp-weixin", "mp-alipay", "h5"], 102 | "data_source": { 103 | "api": "/api/v1/category", 104 | "mock": true, 105 | "cache": false 106 | } 107 | }, 108 | { 109 | "path": "pages/product/detail", 110 | "name": "商品详情", 111 | "type": "detail", 112 | "style": { 113 | "navigationBarTitleText": "商品详情" 114 | }, 115 | "components": ["product-gallery", "product-info", "spec-selector", "reviews-list", "recommend-products"], 116 | "platforms": ["mp-weixin", "mp-alipay", "h5"], 117 | "data_source": { 118 | "api": "/api/v1/product/detail", 119 | "mock": true, 120 | "cache": true 121 | } 122 | }, 123 | { 124 | "path": "pages/cart/index", 125 | "name": "购物车", 126 | "type": "list", 127 | "style": { 128 | "navigationBarTitleText": "购物车" 129 | }, 130 | "components": ["cart-item", "settlement-bar", "coupon-selector"], 131 | "platforms": ["mp-weixin", "mp-alipay", "h5"], 132 | "data_source": { 133 | "api": "/api/v1/cart", 134 | "mock": true, 135 | "cache": false 136 | } 137 | }, 138 | { 139 | "path": "pages/order/list", 140 | "name": "订单列表", 141 | "type": "list", 142 | "style": { 143 | "navigationBarTitleText": "我的订单" 144 | }, 145 | "components": ["order-tabs", "order-item", "order-actions"], 146 | "platforms": ["mp-weixin", "mp-alipay", "h5"], 147 | "data_source": { 148 | "api": "/api/v1/orders", 149 | "mock": true, 150 | "cache": false 151 | } 152 | }, 153 | { 154 | "path": "pages/profile/index", 155 | "name": "个人中心", 156 | "type": "profile", 157 | "style": { 158 | "navigationBarTitleText": "个人中心" 159 | }, 160 | "components": ["user-header", "order-shortcuts", "service-grid", "setting-list"], 161 | "platforms": ["mp-weixin", "mp-alipay", "h5"], 162 | "data_source": { 163 | "api": "/api/v1/profile", 164 | "mock": true, 165 | "cache": true 166 | } 167 | } 168 | ], 169 | "tabBar": { 170 | "enabled": true, 171 | "color": "#7A7E83", 172 | "selectedColor": "#ff6b35", 173 | "backgroundColor": "#ffffff", 174 | "borderStyle": "black", 175 | "position": "bottom", 176 | "list": [ 177 | { 178 | "pagePath": "pages/index/index", 179 | "iconPath": "/static/tabbar/home.png", 180 | "selectedIconPath": "/static/tabbar/home-active.png", 181 | "text": "首页" 182 | }, 183 | { 184 | "pagePath": "pages/category/index", 185 | "iconPath": "/static/tabbar/category.png", 186 | "selectedIconPath": "/static/tabbar/category-active.png", 187 | "text": "分类" 188 | }, 189 | { 190 | "pagePath": "pages/cart/index", 191 | "iconPath": "/static/tabbar/cart.png", 192 | "selectedIconPath": "/static/tabbar/cart-active.png", 193 | "text": "购物车" 194 | }, 195 | { 196 | "pagePath": "pages/profile/index", 197 | "iconPath": "/static/tabbar/profile.png", 198 | "selectedIconPath": "/static/tabbar/profile-active.png", 199 | "text": "我的" 200 | } 201 | ] 202 | }, 203 | "components": [ 204 | { 205 | "name": "ProductCard", 206 | "type": "display", 207 | "framework": "vue3", 208 | "props": { 209 | "product": { 210 | "type": "Object", 211 | "required": true, 212 | "properties": { 213 | "id": "number", 214 | "name": "string", 215 | "price": "number", 216 | "originalPrice": "number", 217 | "image": "string", 218 | "rating": "number", 219 | "sales": "number", 220 | "tags": "array" 221 | } 222 | }, 223 | "layout": { 224 | "type": "String", 225 | "default": "vertical", 226 | "enum": ["vertical", "horizontal"] 227 | } 228 | }, 229 | "events": ["click", "add-cart", "add-favorite", "share"], 230 | "slots": ["header", "footer", "badge"], 231 | "style": "modern-card", 232 | "platforms": ["mp-weixin", "mp-alipay", "h5", "app"] 233 | }, 234 | { 235 | "name": "ShoppingCart", 236 | "type": "business", 237 | "framework": "vue3", 238 | "props": { 239 | "items": { 240 | "type": "Array", 241 | "required": true 242 | }, 243 | "total": { 244 | "type": "Number", 245 | "required": true 246 | }, 247 | "discount": { 248 | "type": "Number", 249 | "default": 0 250 | } 251 | }, 252 | "events": ["change-quantity", "remove-item", "select-item", "checkout", "apply-coupon"], 253 | "slots": ["header", "footer", "empty"], 254 | "style": "floating-action", 255 | "platforms": ["mp-weixin", "mp-alipay", "h5", "app"] 256 | } 257 | ], 258 | "features": { 259 | "login": { 260 | "enabled": true, 261 | "providers": { 262 | "mp-weixin": ["wechat"], 263 | "mp-alipay": ["alipay"], 264 | "h5": ["wechat", "phone", "username"], 265 | "app": ["wechat", "phone", "username", "qq"] 266 | }, 267 | "auto_login": true, 268 | "session_timeout": 7200 269 | }, 270 | "payment": { 271 | "enabled": true, 272 | "providers": { 273 | "mp-weixin": ["wechat_pay"], 274 | "mp-alipay": ["alipay_pay"], 275 | "h5": ["wechat_pay", "alipay_pay"], 276 | "app": ["wechat_pay", "alipay_pay", "apple_pay"] 277 | }, 278 | "sandbox": true 279 | }, 280 | "location": { 281 | "enabled": true, 282 | "providers": { 283 | "mp-weixin": "tencent", 284 | "mp-alipay": "amap", 285 | "h5": "web_api", 286 | "app": "native" 287 | }, 288 | "precision": "gcj02", 289 | "cache": true 290 | }, 291 | "share": { 292 | "enabled": true, 293 | "platforms": { 294 | "mp-weixin": { 295 | "to_friends": true, 296 | "to_timeline": false 297 | }, 298 | "mp-alipay": { 299 | "to_friends": true, 300 | "to_timeline": true 301 | }, 302 | "h5": { 303 | "native": false, 304 | "custom": true 305 | } 306 | } 307 | }, 308 | "camera": { 309 | "enabled": true, 310 | "scan_code": true, 311 | "photo": false, 312 | "video": false 313 | }, 314 | "storage": { 315 | "local": true, 316 | "cloud": { 317 | "enabled": false, 318 | "provider": "leancloud" 319 | } 320 | } 321 | }, 322 | "design": { 323 | "theme": "light", 324 | "color_scheme": { 325 | "primary": "#ff6b35", 326 | "secondary": "#fafafa", 327 | "success": "#07c160", 328 | "warning": "#ff9500", 329 | "error": "#ff3b30", 330 | "text": { 331 | "primary": "#000000", 332 | "secondary": "#666666", 333 | "placeholder": "#c0c4cc" 334 | }, 335 | "background": { 336 | "primary": "#ffffff", 337 | "secondary": "#f8f8f8", 338 | "tertiary": "#f0f0f0" 339 | } 340 | }, 341 | "typography": { 342 | "font_family": "PingFangSC-Regular, sans-serif", 343 | "font_sizes": { 344 | "xs": "20rpx", 345 | "sm": "24rpx", 346 | "base": "28rpx", 347 | "lg": "32rpx", 348 | "xl": "36rpx", 349 | "2xl": "40rpx" 350 | } 351 | }, 352 | "spacing": { 353 | "xs": "8rpx", 354 | "sm": "16rpx", 355 | "base": "24rpx", 356 | "lg": "32rpx", 357 | "xl": "48rpx", 358 | "2xl": "64rpx" 359 | }, 360 | "border_radius": { 361 | "sm": "8rpx", 362 | "base": "12rpx", 363 | "lg": "16rpx", 364 | "xl": "24rpx", 365 | "full": "50%" 366 | }, 367 | "responsive": { 368 | "enabled": true, 369 | "breakpoints": { 370 | "xs": "0", 371 | "sm": "576rpx", 372 | "md": "768rpx", 373 | "lg": "992rpx", 374 | "xl": "1200rpx" 375 | } 376 | } 377 | }, 378 | "build": { 379 | "typescript": { 380 | "enabled": true, 381 | "strict": true, 382 | "declaration": false 383 | }, 384 | "scss": { 385 | "enabled": true, 386 | "dart_sass": true 387 | }, 388 | "optimization": { 389 | "minify": true, 390 | "tree_shaking": true, 391 | "code_splitting": true, 392 | "vendor_splitting": true 393 | } 394 | }, 395 | "deployment": { 396 | "environments": { 397 | "development": { 398 | "api_base_url": "https://dev-api.fashionstore.com", 399 | "debug": true, 400 | "mock": true, 401 | "source_map": true 402 | }, 403 | "production": { 404 | "api_base_url": "https://api.fashionstore.com", 405 | "debug": false, 406 | "mock": false, 407 | "source_map": false 408 | } 409 | }, 410 | "platforms": { 411 | "mp-weixin": { 412 | "uploadCommand": "npm run build:mp-weixin", 413 | "outputPath": "dist/build/mp-weixin" 414 | }, 415 | "h5": { 416 | "buildCommand": "npm run build:h5", 417 | "outputPath": "dist/build/h5", 418 | "publicPath": "/" 419 | } 420 | } 421 | } 422 | } -------------------------------------------------------------------------------- /examples/service-uniapp/uniapp-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "spec_version": "1.0", 3 | "project": { 4 | "name": "beauty-salon-uniapp", 5 | "type": "service", 6 | "appid": "wx2345678901bcdefg", 7 | "title": "美丽时光美容院", 8 | "description": "基于uni-app的跨平台美容服务预约应用,支持多端同步预约管理", 9 | "version": "1.0.0", 10 | "author": "美丽时光团队", 11 | "keywords": ["uni-app", "美容", "预约", "服务", "跨平台"], 12 | "category": "生活服务", 13 | "homepage": "https://www.beautysalon.com", 14 | "versionCode": 100 15 | }, 16 | "business": { 17 | "name": "美丽时光美容院", 18 | "logo": { 19 | "light": "/static/images/logo-light.png", 20 | "dark": "/static/images/logo-dark.png" 21 | }, 22 | "slogan": "专业护肤,美丽永恒,跨平台预约更便捷", 23 | "contact": { 24 | "phone": "010-8888-6666", 25 | "email": "info@beautysalon.com", 26 | "address": "北京市朝阳区美丽大厦3层", 27 | "wechat": "beautysalon2024", 28 | "website": "https://www.beautysalon.com", 29 | "qq": "800886666" 30 | }, 31 | "service_time": { 32 | "weekdays": "10:00-21:00", 33 | "weekends": "9:00-22:00", 34 | "timezone": "Asia/Shanghai" 35 | } 36 | }, 37 | "platforms": { 38 | "mp-weixin": { 39 | "enabled": true, 40 | "appid": "wx2345678901bcdefg", 41 | "setting": { 42 | "urlCheck": false, 43 | "es6": true, 44 | "enhance": true, 45 | "postcss": true, 46 | "minified": true 47 | } 48 | }, 49 | "mp-alipay": { 50 | "enabled": true, 51 | "appid": "alipay_beauty_salon", 52 | "setting": { 53 | "minified": true 54 | } 55 | }, 56 | "h5": { 57 | "enabled": true, 58 | "title": "美丽时光 - 专业美容服务", 59 | "template": "default", 60 | "router": { 61 | "mode": "history", 62 | "base": "/" 63 | } 64 | }, 65 | "app": { 66 | "enabled": false, 67 | "name": "美丽时光APP", 68 | "appid": "__UNI__BEAUTY01" 69 | } 70 | }, 71 | "pages": [ 72 | { 73 | "path": "pages/index/index", 74 | "name": "首页", 75 | "type": "home", 76 | "style": { 77 | "navigationBarTitleText": "美丽时光", 78 | "navigationBarBackgroundColor": "#ffc0cb", 79 | "navigationBarTextStyle": "black", 80 | "backgroundColor": "#fff5f5", 81 | "enablePullDownRefresh": true, 82 | "onReachBottomDistance": 50 83 | }, 84 | "components": ["hero-banner", "service-categories", "technician-showcase", "promotion-cards", "store-info"], 85 | "platforms": ["mp-weixin", "mp-alipay", "h5"], 86 | "data_source": { 87 | "api": "/api/v1/home", 88 | "mock": true, 89 | "cache": true 90 | } 91 | }, 92 | { 93 | "path": "pages/services/index", 94 | "name": "服务项目", 95 | "type": "list", 96 | "style": { 97 | "navigationBarTitleText": "服务项目", 98 | "enablePullDownRefresh": true 99 | }, 100 | "components": ["service-categories", "service-list", "price-filter", "duration-filter"], 101 | "platforms": ["mp-weixin", "mp-alipay", "h5"], 102 | "data_source": { 103 | "api": "/api/v1/services", 104 | "mock": true, 105 | "cache": true 106 | } 107 | }, 108 | { 109 | "path": "pages/booking/index", 110 | "name": "在线预约", 111 | "type": "form", 112 | "style": { 113 | "navigationBarTitleText": "在线预约" 114 | }, 115 | "components": ["service-selector", "technician-picker", "date-time-picker", "contact-form", "booking-summary"], 116 | "platforms": ["mp-weixin", "mp-alipay", "h5"], 117 | "data_source": { 118 | "api": "/api/v1/booking", 119 | "mock": true, 120 | "cache": false 121 | } 122 | }, 123 | { 124 | "path": "pages/appointments/index", 125 | "name": "我的预约", 126 | "type": "list", 127 | "style": { 128 | "navigationBarTitleText": "我的预约" 129 | }, 130 | "components": ["appointment-tabs", "appointment-card", "calendar-view", "appointment-actions"], 131 | "platforms": ["mp-weixin", "mp-alipay", "h5"], 132 | "data_source": { 133 | "api": "/api/v1/appointments", 134 | "mock": true, 135 | "cache": false 136 | } 137 | }, 138 | { 139 | "path": "pages/technician/detail", 140 | "name": "技师详情", 141 | "type": "detail", 142 | "style": { 143 | "navigationBarTitleText": "技师详情" 144 | }, 145 | "components": ["technician-profile", "service-list", "schedule-calendar", "review-list", "booking-button"], 146 | "platforms": ["mp-weixin", "mp-alipay", "h5"], 147 | "data_source": { 148 | "api": "/api/v1/technician/detail", 149 | "mock": true, 150 | "cache": true 151 | } 152 | }, 153 | { 154 | "path": "pages/profile/index", 155 | "name": "个人中心", 156 | "type": "profile", 157 | "style": { 158 | "navigationBarTitleText": "个人中心" 159 | }, 160 | "components": ["user-header", "membership-card", "appointment-history", "points-balance", "setting-menu"], 161 | "platforms": ["mp-weixin", "mp-alipay", "h5"], 162 | "data_source": { 163 | "api": "/api/v1/profile", 164 | "mock": true, 165 | "cache": true 166 | } 167 | } 168 | ], 169 | "tabBar": { 170 | "enabled": true, 171 | "color": "#7A7E83", 172 | "selectedColor": "#ff69b4", 173 | "backgroundColor": "#ffffff", 174 | "borderStyle": "black", 175 | "position": "bottom", 176 | "list": [ 177 | { 178 | "pagePath": "pages/index/index", 179 | "iconPath": "/static/tabbar/home.png", 180 | "selectedIconPath": "/static/tabbar/home-active.png", 181 | "text": "首页" 182 | }, 183 | { 184 | "pagePath": "pages/services/index", 185 | "iconPath": "/static/tabbar/services.png", 186 | "selectedIconPath": "/static/tabbar/services-active.png", 187 | "text": "服务" 188 | }, 189 | { 190 | "pagePath": "pages/appointments/index", 191 | "iconPath": "/static/tabbar/appointments.png", 192 | "selectedIconPath": "/static/tabbar/appointments-active.png", 193 | "text": "预约" 194 | }, 195 | { 196 | "pagePath": "pages/profile/index", 197 | "iconPath": "/static/tabbar/profile.png", 198 | "selectedIconPath": "/static/tabbar/profile-active.png", 199 | "text": "我的" 200 | } 201 | ] 202 | }, 203 | "components": [ 204 | { 205 | "name": "ServiceCard", 206 | "type": "display", 207 | "framework": "vue3", 208 | "props": { 209 | "service": { 210 | "type": "Object", 211 | "required": true, 212 | "properties": { 213 | "id": "number", 214 | "name": "string", 215 | "description": "string", 216 | "price": "number", 217 | "duration": "string", 218 | "image": "string", 219 | "rating": "number", 220 | "category": "string" 221 | } 222 | }, 223 | "layout": { 224 | "type": "String", 225 | "default": "card", 226 | "enum": ["card", "list", "grid"] 227 | } 228 | }, 229 | "events": ["click", "book-now", "add-favorite", "share"], 230 | "slots": ["header", "footer", "badge"], 231 | "style": "elegant-card", 232 | "platforms": ["mp-weixin", "mp-alipay", "h5", "app"] 233 | }, 234 | { 235 | "name": "AppointmentScheduler", 236 | "type": "form", 237 | "framework": "vue3", 238 | "props": { 239 | "availableTimes": { 240 | "type": "Array", 241 | "required": true 242 | }, 243 | "selectedService": { 244 | "type": "Object", 245 | "required": true 246 | }, 247 | "selectedTechnician": { 248 | "type": "Object", 249 | "default": null 250 | } 251 | }, 252 | "events": ["time-select", "date-change", "confirm-booking", "cancel"], 253 | "slots": ["header", "footer", "loading"], 254 | "style": "calendar-modern", 255 | "platforms": ["mp-weixin", "mp-alipay", "h5", "app"] 256 | } 257 | ], 258 | "features": { 259 | "login": { 260 | "enabled": true, 261 | "providers": { 262 | "mp-weixin": ["wechat"], 263 | "mp-alipay": ["alipay"], 264 | "h5": ["wechat", "phone"], 265 | "app": ["wechat", "phone", "qq"] 266 | }, 267 | "auto_login": true, 268 | "session_timeout": 7200 269 | }, 270 | "payment": { 271 | "enabled": true, 272 | "providers": { 273 | "mp-weixin": ["wechat_pay"], 274 | "mp-alipay": ["alipay_pay"], 275 | "h5": ["wechat_pay", "alipay_pay"], 276 | "app": ["wechat_pay", "alipay_pay"] 277 | }, 278 | "sandbox": true 279 | }, 280 | "location": { 281 | "enabled": true, 282 | "providers": { 283 | "mp-weixin": "tencent", 284 | "mp-alipay": "amap", 285 | "h5": "web_api", 286 | "app": "native" 287 | }, 288 | "precision": "gcj02", 289 | "cache": true 290 | }, 291 | "share": { 292 | "enabled": true, 293 | "platforms": { 294 | "mp-weixin": { 295 | "to_friends": true, 296 | "to_timeline": false 297 | }, 298 | "mp-alipay": { 299 | "to_friends": true, 300 | "to_timeline": true 301 | }, 302 | "h5": { 303 | "native": false, 304 | "custom": true 305 | } 306 | } 307 | }, 308 | "camera": { 309 | "enabled": false, 310 | "scan_code": false, 311 | "photo": false, 312 | "video": false 313 | }, 314 | "storage": { 315 | "local": true, 316 | "cloud": { 317 | "enabled": false, 318 | "provider": "leancloud" 319 | } 320 | } 321 | }, 322 | "design": { 323 | "theme": "light", 324 | "color_scheme": { 325 | "primary": "#ffc0cb", 326 | "secondary": "#fff5f5", 327 | "success": "#34c759", 328 | "warning": "#ff9500", 329 | "error": "#ff3b30", 330 | "text": { 331 | "primary": "#000000", 332 | "secondary": "#666666", 333 | "placeholder": "#c0c4cc" 334 | }, 335 | "background": { 336 | "primary": "#ffffff", 337 | "secondary": "#fff5f5", 338 | "tertiary": "#ffeef0" 339 | } 340 | }, 341 | "typography": { 342 | "font_family": "PingFangSC-Regular, sans-serif", 343 | "font_sizes": { 344 | "xs": "20rpx", 345 | "sm": "24rpx", 346 | "base": "28rpx", 347 | "lg": "32rpx", 348 | "xl": "36rpx", 349 | "2xl": "40rpx" 350 | } 351 | }, 352 | "spacing": { 353 | "xs": "8rpx", 354 | "sm": "16rpx", 355 | "base": "24rpx", 356 | "lg": "32rpx", 357 | "xl": "48rpx", 358 | "2xl": "64rpx" 359 | }, 360 | "border_radius": { 361 | "sm": "12rpx", 362 | "base": "16rpx", 363 | "lg": "20rpx", 364 | "xl": "28rpx", 365 | "full": "50%" 366 | }, 367 | "responsive": { 368 | "enabled": true, 369 | "breakpoints": { 370 | "xs": "0", 371 | "sm": "576rpx", 372 | "md": "768rpx", 373 | "lg": "992rpx", 374 | "xl": "1200rpx" 375 | } 376 | } 377 | }, 378 | "build": { 379 | "typescript": { 380 | "enabled": true, 381 | "strict": true, 382 | "declaration": false 383 | }, 384 | "scss": { 385 | "enabled": true, 386 | "dart_sass": true 387 | }, 388 | "optimization": { 389 | "minify": true, 390 | "tree_shaking": true, 391 | "code_splitting": true, 392 | "vendor_splitting": true 393 | } 394 | }, 395 | "deployment": { 396 | "environments": { 397 | "development": { 398 | "api_base_url": "https://dev-api.beautysalon.com", 399 | "debug": true, 400 | "mock": true, 401 | "source_map": true 402 | }, 403 | "production": { 404 | "api_base_url": "https://api.beautysalon.com", 405 | "debug": false, 406 | "mock": false, 407 | "source_map": false 408 | } 409 | }, 410 | "platforms": { 411 | "mp-weixin": { 412 | "uploadCommand": "npm run build:mp-weixin", 413 | "outputPath": "dist/build/mp-weixin" 414 | }, 415 | "h5": { 416 | "buildCommand": "npm run build:h5", 417 | "outputPath": "dist/build/h5", 418 | "publicPath": "/" 419 | } 420 | } 421 | } 422 | } -------------------------------------------------------------------------------- /examples/content-uniapp/uniapp-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "spec_version": "1.0", 3 | "project": { 4 | "name": "tech-news-uniapp", 5 | "type": "content", 6 | "appid": "wx3456789012cdefgh", 7 | "title": "科技资讯", 8 | "description": "基于uni-app的跨平台科技资讯应用,聚合全网优质科技内容", 9 | "version": "1.0.0", 10 | "author": "科技资讯团队", 11 | "keywords": ["uni-app", "科技", "资讯", "新闻", "跨平台"], 12 | "category": "新闻资讯", 13 | "homepage": "https://www.technews.com", 14 | "versionCode": 100 15 | }, 16 | "business": { 17 | "name": "科技资讯", 18 | "logo": { 19 | "light": "/static/images/logo-light.png", 20 | "dark": "/static/images/logo-dark.png" 21 | }, 22 | "slogan": "探索科技前沿,分享创新智慧,跨平台阅读体验", 23 | "contact": { 24 | "phone": "400-666-8888", 25 | "email": "contact@technews.com", 26 | "address": "深圳市南山区科技园创新大厦10层", 27 | "wechat": "technews2024", 28 | "website": "https://www.technews.com", 29 | "qq": "800668888" 30 | }, 31 | "service_time": { 32 | "weekdays": "7:00-24:00", 33 | "weekends": "7:00-24:00", 34 | "timezone": "Asia/Shanghai" 35 | } 36 | }, 37 | "platforms": { 38 | "mp-weixin": { 39 | "enabled": true, 40 | "appid": "wx3456789012cdefgh", 41 | "setting": { 42 | "urlCheck": false, 43 | "es6": true, 44 | "enhance": true, 45 | "postcss": true, 46 | "minified": true 47 | } 48 | }, 49 | "mp-alipay": { 50 | "enabled": true, 51 | "appid": "alipay_tech_news", 52 | "setting": { 53 | "minified": true 54 | } 55 | }, 56 | "h5": { 57 | "enabled": true, 58 | "title": "科技资讯 - 探索科技前沿", 59 | "template": "default", 60 | "router": { 61 | "mode": "history", 62 | "base": "/" 63 | } 64 | }, 65 | "app": { 66 | "enabled": true, 67 | "name": "科技资讯APP", 68 | "appid": "__UNI__TECHNEWS" 69 | } 70 | }, 71 | "pages": [ 72 | { 73 | "path": "pages/index/index", 74 | "name": "首页", 75 | "type": "home", 76 | "style": { 77 | "navigationBarTitleText": "科技资讯", 78 | "navigationBarBackgroundColor": "#ffffff", 79 | "navigationBarTextStyle": "black", 80 | "backgroundColor": "#f8f9fa", 81 | "enablePullDownRefresh": true, 82 | "onReachBottomDistance": 50 83 | }, 84 | "components": ["featured-banner", "hot-topics", "article-list", "category-tabs", "recommend-authors"], 85 | "platforms": ["mp-weixin", "mp-alipay", "h5", "app"], 86 | "data_source": { 87 | "api": "/api/v1/home", 88 | "mock": true, 89 | "cache": true 90 | } 91 | }, 92 | { 93 | "path": "pages/category/index", 94 | "name": "分类", 95 | "type": "list", 96 | "style": { 97 | "navigationBarTitleText": "分类浏览", 98 | "enablePullDownRefresh": true 99 | }, 100 | "components": ["category-grid", "article-list", "tag-filter", "sort-options"], 101 | "platforms": ["mp-weixin", "mp-alipay", "h5", "app"], 102 | "data_source": { 103 | "api": "/api/v1/category", 104 | "mock": true, 105 | "cache": true 106 | } 107 | }, 108 | { 109 | "path": "pages/article/detail", 110 | "name": "文章详情", 111 | "type": "detail", 112 | "style": { 113 | "navigationBarTitleText": "文章详情" 114 | }, 115 | "components": ["article-header", "article-content", "comment-section", "related-articles", "share-actions"], 116 | "platforms": ["mp-weixin", "mp-alipay", "h5", "app"], 117 | "data_source": { 118 | "api": "/api/v1/article/detail", 119 | "mock": true, 120 | "cache": true 121 | } 122 | }, 123 | { 124 | "path": "pages/search/index", 125 | "name": "搜索", 126 | "type": "list", 127 | "style": { 128 | "navigationBarTitleText": "搜索" 129 | }, 130 | "components": ["search-bar", "search-history", "hot-keywords", "search-results"], 131 | "platforms": ["mp-weixin", "mp-alipay", "h5", "app"], 132 | "data_source": { 133 | "api": "/api/v1/search", 134 | "mock": true, 135 | "cache": false 136 | } 137 | }, 138 | { 139 | "path": "pages/favorites/index", 140 | "name": "收藏", 141 | "type": "list", 142 | "style": { 143 | "navigationBarTitleText": "我的收藏" 144 | }, 145 | "components": ["favorites-tabs", "article-list", "collection-folders"], 146 | "platforms": ["mp-weixin", "mp-alipay", "h5", "app"], 147 | "data_source": { 148 | "api": "/api/v1/favorites", 149 | "mock": true, 150 | "cache": false 151 | } 152 | }, 153 | { 154 | "path": "pages/profile/index", 155 | "name": "个人中心", 156 | "type": "profile", 157 | "style": { 158 | "navigationBarTitleText": "个人中心" 159 | }, 160 | "components": ["user-header", "reading-stats", "preference-settings", "app-settings"], 161 | "platforms": ["mp-weixin", "mp-alipay", "h5", "app"], 162 | "data_source": { 163 | "api": "/api/v1/profile", 164 | "mock": true, 165 | "cache": true 166 | } 167 | } 168 | ], 169 | "tabBar": { 170 | "enabled": true, 171 | "color": "#7A7E83", 172 | "selectedColor": "#007aff", 173 | "backgroundColor": "#ffffff", 174 | "borderStyle": "black", 175 | "position": "bottom", 176 | "list": [ 177 | { 178 | "pagePath": "pages/index/index", 179 | "iconPath": "/static/tabbar/home.png", 180 | "selectedIconPath": "/static/tabbar/home-active.png", 181 | "text": "首页" 182 | }, 183 | { 184 | "pagePath": "pages/category/index", 185 | "iconPath": "/static/tabbar/category.png", 186 | "selectedIconPath": "/static/tabbar/category-active.png", 187 | "text": "分类" 188 | }, 189 | { 190 | "pagePath": "pages/search/index", 191 | "iconPath": "/static/tabbar/search.png", 192 | "selectedIconPath": "/static/tabbar/search-active.png", 193 | "text": "搜索" 194 | }, 195 | { 196 | "pagePath": "pages/favorites/index", 197 | "iconPath": "/static/tabbar/favorites.png", 198 | "selectedIconPath": "/static/tabbar/favorites-active.png", 199 | "text": "收藏" 200 | }, 201 | { 202 | "pagePath": "pages/profile/index", 203 | "iconPath": "/static/tabbar/profile.png", 204 | "selectedIconPath": "/static/tabbar/profile-active.png", 205 | "text": "我的" 206 | } 207 | ] 208 | }, 209 | "components": [ 210 | { 211 | "name": "ArticleCard", 212 | "type": "display", 213 | "framework": "vue3", 214 | "props": { 215 | "article": { 216 | "type": "Object", 217 | "required": true, 218 | "properties": { 219 | "id": "number", 220 | "title": "string", 221 | "summary": "string", 222 | "author": "string", 223 | "publishTime": "string", 224 | "readCount": "number", 225 | "commentCount": "number", 226 | "coverImage": "string", 227 | "tags": "array" 228 | } 229 | }, 230 | "layout": { 231 | "type": "String", 232 | "default": "card", 233 | "enum": ["card", "list", "minimal"] 234 | } 235 | }, 236 | "events": ["click", "share", "favorite", "comment"], 237 | "slots": ["header", "footer", "tags"], 238 | "style": "content-card", 239 | "platforms": ["mp-weixin", "mp-alipay", "h5", "app"] 240 | }, 241 | { 242 | "name": "RichTextReader", 243 | "type": "display", 244 | "framework": "vue3", 245 | "props": { 246 | "content": { 247 | "type": "String", 248 | "required": true 249 | }, 250 | "theme": { 251 | "type": "String", 252 | "default": "light", 253 | "enum": ["light", "dark", "sepia"] 254 | }, 255 | "fontSize": { 256 | "type": "Number", 257 | "default": 16 258 | } 259 | }, 260 | "events": ["image-click", "link-click", "copy-text"], 261 | "slots": ["loading", "error"], 262 | "style": "reading-mode", 263 | "platforms": ["mp-weixin", "mp-alipay", "h5", "app"] 264 | } 265 | ], 266 | "features": { 267 | "login": { 268 | "enabled": true, 269 | "providers": { 270 | "mp-weixin": ["wechat"], 271 | "mp-alipay": ["alipay"], 272 | "h5": ["wechat", "phone", "username"], 273 | "app": ["wechat", "phone", "username", "qq", "apple"] 274 | }, 275 | "auto_login": true, 276 | "session_timeout": 7200 277 | }, 278 | "payment": { 279 | "enabled": false, 280 | "providers": {}, 281 | "sandbox": true 282 | }, 283 | "location": { 284 | "enabled": false, 285 | "providers": {}, 286 | "precision": "gcj02", 287 | "cache": false 288 | }, 289 | "share": { 290 | "enabled": true, 291 | "platforms": { 292 | "mp-weixin": { 293 | "to_friends": true, 294 | "to_timeline": true 295 | }, 296 | "mp-alipay": { 297 | "to_friends": true, 298 | "to_timeline": true 299 | }, 300 | "h5": { 301 | "native": false, 302 | "custom": true 303 | }, 304 | "app": { 305 | "native": true, 306 | "providers": ["wechat", "qq", "weibo"] 307 | } 308 | } 309 | }, 310 | "camera": { 311 | "enabled": false, 312 | "scan_code": false, 313 | "photo": false, 314 | "video": false 315 | }, 316 | "storage": { 317 | "local": true, 318 | "cloud": { 319 | "enabled": true, 320 | "provider": "leancloud" 321 | } 322 | } 323 | }, 324 | "design": { 325 | "theme": "auto", 326 | "color_scheme": { 327 | "primary": "#007aff", 328 | "secondary": "#5ac8fa", 329 | "success": "#34c759", 330 | "warning": "#ff9500", 331 | "error": "#ff3b30", 332 | "text": { 333 | "primary": "#000000", 334 | "secondary": "#666666", 335 | "placeholder": "#c0c4cc" 336 | }, 337 | "background": { 338 | "primary": "#ffffff", 339 | "secondary": "#f8f9fa", 340 | "tertiary": "#e9ecef" 341 | } 342 | }, 343 | "typography": { 344 | "font_family": "PingFangSC-Regular, sans-serif", 345 | "font_sizes": { 346 | "xs": "20rpx", 347 | "sm": "24rpx", 348 | "base": "28rpx", 349 | "lg": "32rpx", 350 | "xl": "36rpx", 351 | "2xl": "40rpx" 352 | } 353 | }, 354 | "spacing": { 355 | "xs": "8rpx", 356 | "sm": "16rpx", 357 | "base": "24rpx", 358 | "lg": "32rpx", 359 | "xl": "48rpx", 360 | "2xl": "64rpx" 361 | }, 362 | "border_radius": { 363 | "sm": "8rpx", 364 | "base": "12rpx", 365 | "lg": "16rpx", 366 | "xl": "24rpx", 367 | "full": "50%" 368 | }, 369 | "responsive": { 370 | "enabled": true, 371 | "breakpoints": { 372 | "xs": "0", 373 | "sm": "576rpx", 374 | "md": "768rpx", 375 | "lg": "992rpx", 376 | "xl": "1200rpx" 377 | } 378 | } 379 | }, 380 | "build": { 381 | "typescript": { 382 | "enabled": true, 383 | "strict": true, 384 | "declaration": false 385 | }, 386 | "scss": { 387 | "enabled": true, 388 | "dart_sass": true 389 | }, 390 | "optimization": { 391 | "minify": true, 392 | "tree_shaking": true, 393 | "code_splitting": true, 394 | "vendor_splitting": true 395 | } 396 | }, 397 | "deployment": { 398 | "environments": { 399 | "development": { 400 | "api_base_url": "https://dev-api.technews.com", 401 | "debug": true, 402 | "mock": true, 403 | "source_map": true 404 | }, 405 | "production": { 406 | "api_base_url": "https://api.technews.com", 407 | "debug": false, 408 | "mock": false, 409 | "source_map": false 410 | } 411 | }, 412 | "platforms": { 413 | "mp-weixin": { 414 | "uploadCommand": "npm run build:mp-weixin", 415 | "outputPath": "dist/build/mp-weixin" 416 | }, 417 | "h5": { 418 | "buildCommand": "npm run build:h5", 419 | "outputPath": "dist/build/h5", 420 | "publicPath": "/" 421 | }, 422 | "app": { 423 | "buildCommand": "npm run build:app", 424 | "outputPath": "dist/build/app" 425 | } 426 | } 427 | } 428 | } -------------------------------------------------------------------------------- /UNIAPP-SPEC.md: -------------------------------------------------------------------------------- 1 | # uni-app小程序配置规范文档 2 | 3 | 本文档定义了 `uniapp-config.json` 的完整规范,用于自动生成uni-app跨平台小程序项目。 4 | 5 | ## 📋 规范概述 6 | 7 | uni-app小程序生成器使用声明式配置文件 `uniapp-config.json` 来定义跨平台小程序的结构、功能和内容。AI工具基于此配置自动生成完整的uni-app项目代码。 8 | 9 | ## 🏗️ 配置文件结构 10 | 11 | ```json 12 | { 13 | "spec_version": "1.0", 14 | "project": { ... }, 15 | "business": { ... }, 16 | "platforms": { ... }, 17 | "pages": [ ... ], 18 | "tabBar": { ... }, 19 | "components": [ ... ], 20 | "features": { ... }, 21 | "design": { ... }, 22 | "build": { ... }, 23 | "deployment": { ... } 24 | } 25 | ``` 26 | 27 | ## 📱 项目基本信息 (project) 28 | 29 | ### 必需字段 30 | 31 | ```json 32 | { 33 | "project": { 34 | "name": "my-uniapp", 35 | "type": "ecommerce|service|content|tool|community", 36 | "appid": "wx1234567890abcdef", 37 | "title": "我的uni-app小程序", 38 | "description": "跨平台小程序应用描述", 39 | "version": "1.0.0" 40 | } 41 | } 42 | ``` 43 | 44 | ### 可选字段 45 | 46 | ```json 47 | { 48 | "project": { 49 | "author": "开发者名称", 50 | "keywords": ["跨平台", "uni-app", "小程序"], 51 | "category": "工具", 52 | "homepage": "https://example.com", 53 | "versionName": "1.0.0", 54 | "versionCode": 100 55 | } 56 | } 57 | ``` 58 | 59 | ### 项目类型说明 60 | 61 | | 类型 | 说明 | 典型页面 | 跨平台特色 | 62 | |------|------|----------|----------| 63 | | `ecommerce` | 电商购物 | 首页、商品、购物车、订单 | 多端支付、地址管理 | 64 | | `service` | 服务预约 | 首页、服务、预约、个人中心 | 地图定位、日历选择 | 65 | | `content` | 内容资讯 | 首页、文章、分类、搜索 | 富文本、分享功能 | 66 | | `tool` | 工具应用 | 功能页、历史、设置 | 数据同步、导入导出 | 67 | | `community` | 社区论坛 | 首页、发布、动态、消息 | 实时通讯、媒体上传 | 68 | 69 | ## 🏢 业务信息 (business) 70 | 71 | ```json 72 | { 73 | "business": { 74 | "name": "公司/品牌名称", 75 | "logo": { 76 | "light": "/static/logo-light.png", 77 | "dark": "/static/logo-dark.png" 78 | }, 79 | "slogan": "品牌标语", 80 | "contact": { 81 | "phone": "400-123-4567", 82 | "email": "contact@example.com", 83 | "address": "公司地址", 84 | "wechat": "微信号", 85 | "website": "https://example.com", 86 | "qq": "QQ号码" 87 | }, 88 | "service_time": { 89 | "weekdays": "9:00-18:00", 90 | "weekends": "10:00-17:00", 91 | "timezone": "Asia/Shanghai" 92 | } 93 | } 94 | } 95 | ``` 96 | 97 | ## 🌐 平台配置 (platforms) 98 | 99 | ### 支持的平台 100 | 101 | ```json 102 | { 103 | "platforms": { 104 | "mp-weixin": { 105 | "enabled": true, 106 | "appid": "wx1234567890abcdef", 107 | "setting": { 108 | "urlCheck": false, 109 | "es6": true, 110 | "enhance": true, 111 | "postcss": true, 112 | "minified": true 113 | } 114 | }, 115 | "mp-alipay": { 116 | "enabled": true, 117 | "appid": "alipay_app_id", 118 | "setting": { 119 | "minified": true 120 | } 121 | }, 122 | "h5": { 123 | "enabled": true, 124 | "title": "H5应用标题", 125 | "template": "default", 126 | "router": { 127 | "mode": "history", 128 | "base": "/" 129 | } 130 | }, 131 | "app": { 132 | "enabled": false, 133 | "name": "APP应用名称", 134 | "appid": "__UNI__XXXXXX" 135 | } 136 | } 137 | } 138 | ``` 139 | 140 | ### 平台特性对比 141 | 142 | | 功能 | 微信小程序 | 支付宝小程序 | H5 | APP | 143 | |------|------------|--------------|----|----| 144 | | 登录 | 微信授权 | 支付宝授权 | 账号登录 | 多种方式 | 145 | | 支付 | 微信支付 | 支付宝支付 | 在线支付 | 原生支付 | 146 | | 地图 | 腾讯地图 | 高德地图 | Web地图 | 原生地图 | 147 | | 分享 | 原生分享 | 原生分享 | Web分享 | 原生分享 | 148 | 149 | ## 📄 页面配置 (pages) 150 | 151 | ### 页面定义结构 152 | 153 | ```json 154 | { 155 | "pages": [ 156 | { 157 | "path": "pages/index/index", 158 | "name": "首页", 159 | "type": "home|list|detail|form|profile", 160 | "style": { 161 | "navigationBarTitleText": "首页", 162 | "navigationBarBackgroundColor": "#ffffff", 163 | "navigationBarTextStyle": "black", 164 | "backgroundColor": "#f8f8f8", 165 | "enablePullDownRefresh": true, 166 | "onReachBottomDistance": 50, 167 | "backgroundTextStyle": "dark" 168 | }, 169 | "components": ["banner", "product-list", "category-nav"], 170 | "platforms": ["mp-weixin", "mp-alipay", "h5"], 171 | "data_source": { 172 | "api": "/api/home", 173 | "mock": true, 174 | "cache": true 175 | } 176 | } 177 | ] 178 | } 179 | ``` 180 | 181 | ### 页面类型特性 182 | 183 | | 类型 | 用途 | 推荐组件 | 数据需求 | 184 | |------|------|----------|----------| 185 | | `home` | 首页 | banner, navigation, grid | 轮播图、导航、推荐 | 186 | | `list` | 列表页 | search-bar, list-item, load-more | 列表数据、分页 | 187 | | `detail` | 详情页 | image-gallery, tabs, action-bar | 详细信息、操作 | 188 | | `form` | 表单页 | form-item, picker, upload | 表单数据、验证 | 189 | | `profile` | 个人中心 | user-info, cell-group | 用户信息、设置 | 190 | 191 | ## 📱 标签栏配置 (tabBar) 192 | 193 | ```json 194 | { 195 | "tabBar": { 196 | "enabled": true, 197 | "color": "#7A7E83", 198 | "selectedColor": "#3cc51f", 199 | "borderStyle": "black", 200 | "backgroundColor": "#ffffff", 201 | "position": "bottom", 202 | "list": [ 203 | { 204 | "pagePath": "pages/index/index", 205 | "iconPath": "static/tab-home.png", 206 | "selectedIconPath": "static/tab-home-active.png", 207 | "text": "首页" 208 | }, 209 | { 210 | "pagePath": "pages/category/index", 211 | "iconPath": "static/tab-category.png", 212 | "selectedIconPath": "static/tab-category-active.png", 213 | "text": "分类" 214 | } 215 | ] 216 | } 217 | } 218 | ``` 219 | 220 | ## 🧩 组件配置 (components) 221 | 222 | ### Vue组件定义 223 | 224 | ```json 225 | { 226 | "components": [ 227 | { 228 | "name": "ProductCard", 229 | "type": "display", 230 | "framework": "vue3", 231 | "props": { 232 | "product": { 233 | "type": "Object", 234 | "required": true, 235 | "properties": { 236 | "id": "number", 237 | "name": "string", 238 | "price": "number", 239 | "image": "string", 240 | "rating": "number" 241 | } 242 | }, 243 | "size": { 244 | "type": "String", 245 | "default": "medium", 246 | "enum": ["small", "medium", "large"] 247 | } 248 | }, 249 | "events": ["click", "add-cart", "share"], 250 | "slots": ["header", "footer"], 251 | "style": "card", 252 | "platforms": ["mp-weixin", "mp-alipay", "h5", "app"] 253 | } 254 | ] 255 | } 256 | ``` 257 | 258 | ### 组件分类 259 | 260 | - **基础组件**: Button, Input, Image, Text 261 | - **布局组件**: Row, Col, Grid, Flex 262 | - **导航组件**: NavBar, TabBar, Breadcrumb 263 | - **数据展示**: Card, List, Table, Tag 264 | - **数据录入**: Form, Picker, Upload, Switch 265 | - **反馈组件**: Modal, Toast, Loading 266 | - **业务组件**: ProductCard, OrderItem, UserProfile 267 | 268 | ## ⚙️ 功能配置 (features) 269 | 270 | ### 基础功能 271 | 272 | ```json 273 | { 274 | "features": { 275 | "login": { 276 | "enabled": true, 277 | "providers": { 278 | "mp-weixin": ["wechat"], 279 | "mp-alipay": ["alipay"], 280 | "h5": ["username", "phone", "wechat"], 281 | "app": ["username", "phone", "wechat", "qq"] 282 | }, 283 | "auto_login": true, 284 | "session_timeout": 7200 285 | }, 286 | "payment": { 287 | "enabled": true, 288 | "providers": { 289 | "mp-weixin": ["wechat_pay"], 290 | "mp-alipay": ["alipay_pay"], 291 | "h5": ["wechat_pay", "alipay_pay"], 292 | "app": ["wechat_pay", "alipay_pay", "apple_pay"] 293 | }, 294 | "sandbox": true 295 | }, 296 | "location": { 297 | "enabled": true, 298 | "providers": { 299 | "mp-weixin": "tencent", 300 | "mp-alipay": "amap", 301 | "h5": "web_api", 302 | "app": "native" 303 | }, 304 | "precision": "gcj02", 305 | "cache": true 306 | } 307 | } 308 | } 309 | ``` 310 | 311 | ### 跨平台功能适配 312 | 313 | ```json 314 | { 315 | "features": { 316 | "share": { 317 | "enabled": true, 318 | "platforms": { 319 | "mp-weixin": { 320 | "to_friends": true, 321 | "to_timeline": false 322 | }, 323 | "mp-alipay": { 324 | "to_friends": true, 325 | "to_timeline": true 326 | }, 327 | "h5": { 328 | "native": false, 329 | "custom": true 330 | }, 331 | "app": { 332 | "native": true, 333 | "providers": ["wechat", "qq", "weibo"] 334 | } 335 | } 336 | }, 337 | "camera": { 338 | "enabled": true, 339 | "scan_code": true, 340 | "photo": true, 341 | "video": false 342 | }, 343 | "storage": { 344 | "local": true, 345 | "cloud": { 346 | "enabled": false, 347 | "provider": "leancloud|bmob|firebase" 348 | } 349 | } 350 | } 351 | } 352 | ``` 353 | 354 | ## 🎨 设计配置 (design) 355 | 356 | ### 主题和样式 357 | 358 | ```json 359 | { 360 | "design": { 361 | "theme": "light|dark|auto", 362 | "color_scheme": { 363 | "primary": "#007aff", 364 | "secondary": "#5ac8fa", 365 | "success": "#34c759", 366 | "warning": "#ff9500", 367 | "error": "#ff3b30", 368 | "info": "#5856d6", 369 | "text": { 370 | "primary": "#000000", 371 | "secondary": "#999999", 372 | "placeholder": "#c0c4cc" 373 | }, 374 | "background": { 375 | "primary": "#ffffff", 376 | "secondary": "#f7f7f7", 377 | "tertiary": "#efeff4" 378 | } 379 | }, 380 | "typography": { 381 | "font_family": "PingFangSC-Regular, sans-serif", 382 | "font_sizes": { 383 | "xs": "20rpx", 384 | "sm": "24rpx", 385 | "base": "28rpx", 386 | "lg": "32rpx", 387 | "xl": "36rpx", 388 | "2xl": "40rpx" 389 | } 390 | }, 391 | "spacing": { 392 | "xs": "8rpx", 393 | "sm": "16rpx", 394 | "base": "24rpx", 395 | "lg": "32rpx", 396 | "xl": "48rpx", 397 | "2xl": "64rpx" 398 | }, 399 | "border_radius": { 400 | "sm": "8rpx", 401 | "base": "12rpx", 402 | "lg": "16rpx", 403 | "xl": "24rpx", 404 | "full": "50%" 405 | } 406 | } 407 | } 408 | ``` 409 | 410 | ### 响应式设计 411 | 412 | ```json 413 | { 414 | "design": { 415 | "responsive": { 416 | "enabled": true, 417 | "breakpoints": { 418 | "xs": "0", 419 | "sm": "576rpx", 420 | "md": "768rpx", 421 | "lg": "992rpx", 422 | "xl": "1200rpx" 423 | }, 424 | "container": { 425 | "padding": "32rpx", 426 | "max_width": "1200rpx" 427 | } 428 | }, 429 | "layout": { 430 | "grid": { 431 | "columns": 12, 432 | "gutter": "24rpx" 433 | }, 434 | "safe_area": { 435 | "enabled": true, 436 | "top": true, 437 | "bottom": true 438 | } 439 | } 440 | } 441 | } 442 | ``` 443 | 444 | ## 🔧 构建配置 (build) 445 | 446 | ### 编译配置 447 | 448 | ```json 449 | { 450 | "build": { 451 | "typescript": { 452 | "enabled": true, 453 | "strict": true, 454 | "declaration": false 455 | }, 456 | "scss": { 457 | "enabled": true, 458 | "dart_sass": true 459 | }, 460 | "optimization": { 461 | "minify": true, 462 | "tree_shaking": true, 463 | "code_splitting": true, 464 | "vendor_splitting": true 465 | }, 466 | "polyfill": { 467 | "enabled": true, 468 | "targets": "> 1%, last 2 versions" 469 | }, 470 | "assets": { 471 | "inline_limit": 4096, 472 | "compress": true, 473 | "cdn": { 474 | "enabled": false, 475 | "domain": "https://cdn.example.com" 476 | } 477 | } 478 | } 479 | } 480 | ``` 481 | 482 | ### 条件编译 483 | 484 | ```json 485 | { 486 | "build": { 487 | "conditional_compilation": { 488 | "enabled": true, 489 | "variables": { 490 | "MP_WEIXIN": true, 491 | "MP_ALIPAY": true, 492 | "H5": true, 493 | "APP_PLUS": false 494 | } 495 | }, 496 | "plugins": [ 497 | { 498 | "name": "uniapp-plugin-mock", 499 | "enabled": true, 500 | "options": { 501 | "mockPath": "./mock" 502 | } 503 | } 504 | ] 505 | } 506 | } 507 | ``` 508 | 509 | ## 🚀 部署配置 (deployment) 510 | 511 | ### 环境配置 512 | 513 | ```json 514 | { 515 | "deployment": { 516 | "environments": { 517 | "development": { 518 | "api_base_url": "https://dev-api.example.com", 519 | "debug": true, 520 | "mock": true, 521 | "source_map": true 522 | }, 523 | "staging": { 524 | "api_base_url": "https://staging-api.example.com", 525 | "debug": false, 526 | "mock": false, 527 | "source_map": true 528 | }, 529 | "production": { 530 | "api_base_url": "https://api.example.com", 531 | "debug": false, 532 | "mock": false, 533 | "source_map": false 534 | } 535 | }, 536 | "platforms": { 537 | "mp-weixin": { 538 | "uploadCommand": "npm run build:mp-weixin", 539 | "outputPath": "dist/build/mp-weixin" 540 | }, 541 | "h5": { 542 | "buildCommand": "npm run build:h5", 543 | "outputPath": "dist/build/h5", 544 | "publicPath": "/" 545 | }, 546 | "app": { 547 | "buildCommand": "npm run build:app", 548 | "outputPath": "dist/build/app" 549 | } 550 | } 551 | } 552 | } 553 | ``` 554 | 555 | ## 🔍 配置验证 556 | 557 | ### 使用JSON Schema验证 558 | 559 | ```bash 560 | # 安装验证工具 561 | npm install -g ajv-cli 562 | 563 | # 验证配置文件 564 | ajv validate -s schemas/uniapp-config.schema.json -d uniapp-config.json 565 | ``` 566 | 567 | ### 常见配置错误 568 | 569 | 1. **平台AppID错误** 570 | ```json 571 | // ❌ 错误 572 | "appid": "123456" 573 | 574 | // ✅ 正确 575 | "appid": "wx1234567890abcdef" 576 | ``` 577 | 578 | 2. **页面路径格式错误** 579 | ```json 580 | // ❌ 错误 581 | "path": "/pages/index" 582 | 583 | // ✅ 正确 584 | "path": "pages/index/index" 585 | ``` 586 | 587 | 3. **组件平台支持配置错误** 588 | ```json 589 | // ❌ 错误 590 | "platforms": ["weixin", "alipay"] 591 | 592 | // ✅ 正确 593 | "platforms": ["mp-weixin", "mp-alipay"] 594 | ``` 595 | 596 | ## 📊 配置示例 597 | 598 | ### 电商uni-app配置 599 | 600 | ```json 601 | { 602 | "spec_version": "1.0", 603 | "project": { 604 | "name": "fashion-store-uniapp", 605 | "type": "ecommerce", 606 | "appid": "wx1234567890abcdef", 607 | "title": "时尚商城", 608 | "description": "跨平台时尚购物应用", 609 | "version": "1.0.0" 610 | }, 611 | "platforms": { 612 | "mp-weixin": { "enabled": true }, 613 | "mp-alipay": { "enabled": true }, 614 | "h5": { "enabled": true }, 615 | "app": { "enabled": false } 616 | }, 617 | "pages": [ 618 | { 619 | "path": "pages/index/index", 620 | "name": "首页", 621 | "type": "home", 622 | "components": ["banner", "category-grid", "product-list"] 623 | } 624 | ], 625 | "tabBar": { 626 | "enabled": true, 627 | "list": [ 628 | { 629 | "pagePath": "pages/index/index", 630 | "text": "首页", 631 | "iconPath": "static/tab-home.png", 632 | "selectedIconPath": "static/tab-home-active.png" 633 | } 634 | ] 635 | }, 636 | "features": { 637 | "login": { "enabled": true }, 638 | "payment": { "enabled": true }, 639 | "share": { "enabled": true } 640 | } 641 | } 642 | ``` 643 | 644 | ## 🎯 最佳实践 645 | 646 | ### 跨平台开发建议 647 | 648 | 1. **组件设计原则** 649 | - 优先使用uni-app内置组件 650 | - 自定义组件支持多端适配 651 | - 使用条件编译处理平台差异 652 | 653 | 2. **样式规范** 654 | - 使用rpx单位保证响应式 655 | - 避免使用平台特有样式属性 656 | - 统一设计语言和交互规范 657 | 658 | 3. **API调用策略** 659 | - 优先使用uni-app统一API 660 | - 平台特有功能使用条件编译 661 | - 做好降级处理和错误处理 662 | 663 | 4. **性能优化** 664 | - 合理使用分包加载 665 | - 图片资源优化和懒加载 666 | - 减少页面初始渲染时间 667 | 668 | ### 代码组织建议 669 | 670 | ``` 671 | src/ 672 | ├── pages/ # 页面文件 673 | ├── components/ # 组件文件 674 | ├── static/ # 静态资源 675 | ├── store/ # 状态管理 676 | ├── utils/ # 工具函数 677 | ├── api/ # 接口封装 678 | ├── styles/ # 全局样式 679 | ├── uni_modules/ # uni-app插件 680 | ├── App.vue # 应用入口 681 | ├── main.ts # 主入口文件 682 | ├── manifest.json # 应用配置 683 | ├── pages.json # 页面配置 684 | └── uni.scss # 全局样式变量 685 | ``` 686 | 687 | --- 688 | 689 | 更多详细信息请参考 [uni-app官方文档](https://uniapp.dcloud.net.cn/)。 -------------------------------------------------------------------------------- /schemas/uniapp-config.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "title": "uni-app小程序配置", 4 | "description": "用于生成uni-app跨平台小程序的配置文件规范", 5 | "type": "object", 6 | "required": ["spec_version", "project", "platforms", "pages"], 7 | "properties": { 8 | "spec_version": { 9 | "type": "string", 10 | "description": "配置规范版本", 11 | "enum": ["1.0"] 12 | }, 13 | "project": { 14 | "type": "object", 15 | "description": "项目基本信息", 16 | "required": ["name", "type", "appid", "title", "description", "version"], 17 | "properties": { 18 | "name": { 19 | "type": "string", 20 | "description": "项目名称(英文标识符)", 21 | "pattern": "^[a-z0-9-]+$" 22 | }, 23 | "type": { 24 | "type": "string", 25 | "description": "uni-app小程序类型", 26 | "enum": ["ecommerce", "service", "content", "tool", "community"] 27 | }, 28 | "appid": { 29 | "type": "string", 30 | "description": "微信小程序AppID", 31 | "pattern": "^wx[a-f0-9]{16}$" 32 | }, 33 | "title": { 34 | "type": "string", 35 | "description": "小程序标题", 36 | "minLength": 1, 37 | "maxLength": 20 38 | }, 39 | "description": { 40 | "type": "string", 41 | "description": "小程序描述", 42 | "minLength": 1, 43 | "maxLength": 120 44 | }, 45 | "version": { 46 | "type": "string", 47 | "description": "版本号", 48 | "pattern": "^\\d+\\.\\d+\\.\\d+$" 49 | }, 50 | "author": { 51 | "type": "string", 52 | "description": "开发者名称" 53 | }, 54 | "keywords": { 55 | "type": "array", 56 | "description": "关键词", 57 | "items": { 58 | "type": "string" 59 | } 60 | }, 61 | "category": { 62 | "type": "string", 63 | "description": "小程序分类" 64 | }, 65 | "homepage": { 66 | "type": "string", 67 | "description": "项目主页", 68 | "format": "uri" 69 | }, 70 | "versionName": { 71 | "type": "string", 72 | "description": "版本名称" 73 | }, 74 | "versionCode": { 75 | "type": "integer", 76 | "description": "版本号码", 77 | "minimum": 1 78 | } 79 | } 80 | }, 81 | "business": { 82 | "type": "object", 83 | "description": "业务信息", 84 | "properties": { 85 | "name": { 86 | "type": "string", 87 | "description": "公司/品牌名称" 88 | }, 89 | "logo": { 90 | "type": "object", 91 | "description": "Logo配置", 92 | "properties": { 93 | "light": { 94 | "type": "string", 95 | "description": "浅色主题Logo路径" 96 | }, 97 | "dark": { 98 | "type": "string", 99 | "description": "深色主题Logo路径" 100 | } 101 | } 102 | }, 103 | "slogan": { 104 | "type": "string", 105 | "description": "品牌标语" 106 | }, 107 | "contact": { 108 | "type": "object", 109 | "description": "联系信息", 110 | "properties": { 111 | "phone": { 112 | "type": "string", 113 | "description": "联系电话" 114 | }, 115 | "email": { 116 | "type": "string", 117 | "description": "邮箱地址", 118 | "format": "email" 119 | }, 120 | "address": { 121 | "type": "string", 122 | "description": "地址" 123 | }, 124 | "wechat": { 125 | "type": "string", 126 | "description": "微信号" 127 | }, 128 | "website": { 129 | "type": "string", 130 | "description": "官网地址", 131 | "format": "uri" 132 | }, 133 | "qq": { 134 | "type": "string", 135 | "description": "QQ号码" 136 | } 137 | } 138 | }, 139 | "service_time": { 140 | "type": "object", 141 | "description": "服务时间", 142 | "properties": { 143 | "weekdays": { 144 | "type": "string", 145 | "description": "工作日时间" 146 | }, 147 | "weekends": { 148 | "type": "string", 149 | "description": "周末时间" 150 | }, 151 | "timezone": { 152 | "type": "string", 153 | "description": "时区", 154 | "default": "Asia/Shanghai" 155 | } 156 | } 157 | } 158 | } 159 | }, 160 | "platforms": { 161 | "type": "object", 162 | "description": "平台配置", 163 | "required": ["mp-weixin"], 164 | "properties": { 165 | "mp-weixin": { 166 | "type": "object", 167 | "description": "微信小程序配置", 168 | "required": ["enabled"], 169 | "properties": { 170 | "enabled": { 171 | "type": "boolean", 172 | "description": "是否启用微信小程序" 173 | }, 174 | "appid": { 175 | "type": "string", 176 | "description": "微信小程序AppID", 177 | "pattern": "^wx[a-f0-9]{16}$" 178 | }, 179 | "setting": { 180 | "type": "object", 181 | "description": "微信小程序设置", 182 | "properties": { 183 | "urlCheck": { 184 | "type": "boolean", 185 | "description": "是否检查安全域名", 186 | "default": false 187 | }, 188 | "es6": { 189 | "type": "boolean", 190 | "description": "ES6转ES5", 191 | "default": true 192 | }, 193 | "enhance": { 194 | "type": "boolean", 195 | "description": "增强编译", 196 | "default": true 197 | }, 198 | "postcss": { 199 | "type": "boolean", 200 | "description": "PostCSS", 201 | "default": true 202 | }, 203 | "minified": { 204 | "type": "boolean", 205 | "description": "代码压缩", 206 | "default": true 207 | } 208 | } 209 | } 210 | } 211 | }, 212 | "mp-alipay": { 213 | "type": "object", 214 | "description": "支付宝小程序配置", 215 | "properties": { 216 | "enabled": { 217 | "type": "boolean", 218 | "description": "是否启用支付宝小程序", 219 | "default": false 220 | }, 221 | "appid": { 222 | "type": "string", 223 | "description": "支付宝小程序AppID" 224 | }, 225 | "setting": { 226 | "type": "object", 227 | "description": "支付宝小程序设置", 228 | "properties": { 229 | "minified": { 230 | "type": "boolean", 231 | "description": "代码压缩", 232 | "default": true 233 | } 234 | } 235 | } 236 | } 237 | }, 238 | "h5": { 239 | "type": "object", 240 | "description": "H5配置", 241 | "properties": { 242 | "enabled": { 243 | "type": "boolean", 244 | "description": "是否启用H5", 245 | "default": false 246 | }, 247 | "title": { 248 | "type": "string", 249 | "description": "H5应用标题" 250 | }, 251 | "template": { 252 | "type": "string", 253 | "description": "H5模板", 254 | "default": "default" 255 | }, 256 | "router": { 257 | "type": "object", 258 | "description": "路由配置", 259 | "properties": { 260 | "mode": { 261 | "type": "string", 262 | "description": "路由模式", 263 | "enum": ["hash", "history"], 264 | "default": "history" 265 | }, 266 | "base": { 267 | "type": "string", 268 | "description": "基础路径", 269 | "default": "/" 270 | } 271 | } 272 | } 273 | } 274 | }, 275 | "app": { 276 | "type": "object", 277 | "description": "APP配置", 278 | "properties": { 279 | "enabled": { 280 | "type": "boolean", 281 | "description": "是否启用APP", 282 | "default": false 283 | }, 284 | "name": { 285 | "type": "string", 286 | "description": "APP应用名称" 287 | }, 288 | "appid": { 289 | "type": "string", 290 | "description": "APP应用ID", 291 | "pattern": "^__UNI__[A-Z0-9]+$" 292 | } 293 | } 294 | } 295 | } 296 | }, 297 | "pages": { 298 | "type": "array", 299 | "description": "页面配置", 300 | "minItems": 1, 301 | "items": { 302 | "type": "object", 303 | "required": ["path", "name", "type"], 304 | "properties": { 305 | "path": { 306 | "type": "string", 307 | "description": "页面路径", 308 | "pattern": "^pages/[a-zA-Z0-9-_/]+$" 309 | }, 310 | "name": { 311 | "type": "string", 312 | "description": "页面名称" 313 | }, 314 | "type": { 315 | "type": "string", 316 | "description": "页面类型", 317 | "enum": ["home", "list", "detail", "form", "profile"] 318 | }, 319 | "style": { 320 | "type": "object", 321 | "description": "页面样式配置", 322 | "properties": { 323 | "navigationBarTitleText": { 324 | "type": "string", 325 | "description": "导航栏标题" 326 | }, 327 | "navigationBarBackgroundColor": { 328 | "type": "string", 329 | "description": "导航栏背景色", 330 | "pattern": "^#[0-9a-fA-F]{6}$" 331 | }, 332 | "navigationBarTextStyle": { 333 | "type": "string", 334 | "description": "导航栏文字颜色", 335 | "enum": ["black", "white"] 336 | }, 337 | "backgroundColor": { 338 | "type": "string", 339 | "description": "背景色", 340 | "pattern": "^#[0-9a-fA-F]{6}$" 341 | }, 342 | "backgroundTextStyle": { 343 | "type": "string", 344 | "description": "下拉背景字体", 345 | "enum": ["light", "dark"] 346 | }, 347 | "enablePullDownRefresh": { 348 | "type": "boolean", 349 | "description": "是否开启下拉刷新", 350 | "default": false 351 | }, 352 | "onReachBottomDistance": { 353 | "type": "integer", 354 | "description": "页面上拉触底事件触发时距页面底部距离", 355 | "minimum": 0, 356 | "default": 50 357 | } 358 | } 359 | }, 360 | "components": { 361 | "type": "array", 362 | "description": "页面使用的组件", 363 | "items": { 364 | "type": "string" 365 | } 366 | }, 367 | "platforms": { 368 | "type": "array", 369 | "description": "支持的平台", 370 | "items": { 371 | "type": "string", 372 | "enum": ["mp-weixin", "mp-alipay", "h5", "app"] 373 | } 374 | }, 375 | "data_source": { 376 | "type": "object", 377 | "description": "数据源配置", 378 | "properties": { 379 | "api": { 380 | "type": "string", 381 | "description": "API接口" 382 | }, 383 | "mock": { 384 | "type": "boolean", 385 | "description": "是否使用模拟数据", 386 | "default": false 387 | }, 388 | "cache": { 389 | "type": "boolean", 390 | "description": "是否缓存数据", 391 | "default": false 392 | } 393 | } 394 | } 395 | } 396 | } 397 | }, 398 | "tabBar": { 399 | "type": "object", 400 | "description": "底部标签栏配置", 401 | "properties": { 402 | "enabled": { 403 | "type": "boolean", 404 | "description": "是否启用标签栏", 405 | "default": false 406 | }, 407 | "color": { 408 | "type": "string", 409 | "description": "默认颜色", 410 | "pattern": "^#[0-9a-fA-F]{6}$", 411 | "default": "#7A7E83" 412 | }, 413 | "selectedColor": { 414 | "type": "string", 415 | "description": "选中颜色", 416 | "pattern": "^#[0-9a-fA-F]{6}$", 417 | "default": "#3cc51f" 418 | }, 419 | "backgroundColor": { 420 | "type": "string", 421 | "description": "背景色", 422 | "pattern": "^#[0-9a-fA-F]{6}$", 423 | "default": "#ffffff" 424 | }, 425 | "borderStyle": { 426 | "type": "string", 427 | "description": "边框颜色", 428 | "enum": ["black", "white"], 429 | "default": "black" 430 | }, 431 | "position": { 432 | "type": "string", 433 | "description": "位置", 434 | "enum": ["bottom", "top"], 435 | "default": "bottom" 436 | }, 437 | "list": { 438 | "type": "array", 439 | "description": "标签列表", 440 | "minItems": 2, 441 | "maxItems": 5, 442 | "items": { 443 | "type": "object", 444 | "required": ["pagePath", "text"], 445 | "properties": { 446 | "pagePath": { 447 | "type": "string", 448 | "description": "页面路径" 449 | }, 450 | "text": { 451 | "type": "string", 452 | "description": "标签文字" 453 | }, 454 | "iconPath": { 455 | "type": "string", 456 | "description": "图标路径" 457 | }, 458 | "selectedIconPath": { 459 | "type": "string", 460 | "description": "选中图标路径" 461 | } 462 | } 463 | } 464 | } 465 | } 466 | }, 467 | "components": { 468 | "type": "array", 469 | "description": "自定义组件配置", 470 | "items": { 471 | "type": "object", 472 | "required": ["name", "type", "framework"], 473 | "properties": { 474 | "name": { 475 | "type": "string", 476 | "description": "组件名称" 477 | }, 478 | "type": { 479 | "type": "string", 480 | "description": "组件类型", 481 | "enum": ["display", "form", "navigation", "feedback", "business", "layout"] 482 | }, 483 | "framework": { 484 | "type": "string", 485 | "description": "组件框架", 486 | "enum": ["vue3", "vue2"], 487 | "default": "vue3" 488 | }, 489 | "props": { 490 | "type": "object", 491 | "description": "组件属性定义" 492 | }, 493 | "events": { 494 | "type": "array", 495 | "description": "组件事件", 496 | "items": { 497 | "type": "string" 498 | } 499 | }, 500 | "slots": { 501 | "type": "array", 502 | "description": "组件插槽", 503 | "items": { 504 | "type": "string" 505 | } 506 | }, 507 | "style": { 508 | "type": "string", 509 | "description": "组件样式风格" 510 | }, 511 | "platforms": { 512 | "type": "array", 513 | "description": "支持的平台", 514 | "items": { 515 | "type": "string", 516 | "enum": ["mp-weixin", "mp-alipay", "h5", "app"] 517 | } 518 | } 519 | } 520 | } 521 | }, 522 | "features": { 523 | "type": "object", 524 | "description": "功能配置", 525 | "properties": { 526 | "login": { 527 | "type": "object", 528 | "description": "登录功能", 529 | "properties": { 530 | "enabled": { 531 | "type": "boolean", 532 | "description": "是否启用登录", 533 | "default": false 534 | }, 535 | "providers": { 536 | "type": "object", 537 | "description": "各平台登录方式", 538 | "properties": { 539 | "mp-weixin": { 540 | "type": "array", 541 | "items": { 542 | "type": "string", 543 | "enum": ["wechat"] 544 | } 545 | }, 546 | "mp-alipay": { 547 | "type": "array", 548 | "items": { 549 | "type": "string", 550 | "enum": ["alipay"] 551 | } 552 | }, 553 | "h5": { 554 | "type": "array", 555 | "items": { 556 | "type": "string", 557 | "enum": ["username", "phone", "wechat", "qq"] 558 | } 559 | }, 560 | "app": { 561 | "type": "array", 562 | "items": { 563 | "type": "string", 564 | "enum": ["username", "phone", "wechat", "qq", "apple"] 565 | } 566 | } 567 | } 568 | }, 569 | "auto_login": { 570 | "type": "boolean", 571 | "description": "自动登录", 572 | "default": true 573 | }, 574 | "session_timeout": { 575 | "type": "integer", 576 | "description": "会话超时时间(秒)", 577 | "default": 7200 578 | } 579 | } 580 | }, 581 | "payment": { 582 | "type": "object", 583 | "description": "支付功能", 584 | "properties": { 585 | "enabled": { 586 | "type": "boolean", 587 | "description": "是否启用支付", 588 | "default": false 589 | }, 590 | "providers": { 591 | "type": "object", 592 | "description": "各平台支付方式" 593 | }, 594 | "sandbox": { 595 | "type": "boolean", 596 | "description": "沙箱模式", 597 | "default": true 598 | } 599 | } 600 | }, 601 | "location": { 602 | "type": "object", 603 | "description": "定位功能", 604 | "properties": { 605 | "enabled": { 606 | "type": "boolean", 607 | "description": "是否启用定位", 608 | "default": false 609 | }, 610 | "providers": { 611 | "type": "object", 612 | "description": "各平台地图服务" 613 | }, 614 | "precision": { 615 | "type": "string", 616 | "description": "坐标系类型", 617 | "enum": ["wgs84", "gcj02"], 618 | "default": "gcj02" 619 | }, 620 | "cache": { 621 | "type": "boolean", 622 | "description": "是否缓存位置", 623 | "default": true 624 | } 625 | } 626 | }, 627 | "share": { 628 | "type": "object", 629 | "description": "分享功能", 630 | "properties": { 631 | "enabled": { 632 | "type": "boolean", 633 | "description": "是否启用分享", 634 | "default": true 635 | }, 636 | "platforms": { 637 | "type": "object", 638 | "description": "各平台分享配置" 639 | } 640 | } 641 | }, 642 | "camera": { 643 | "type": "object", 644 | "description": "相机功能", 645 | "properties": { 646 | "enabled": { 647 | "type": "boolean", 648 | "description": "是否启用相机", 649 | "default": false 650 | }, 651 | "scan_code": { 652 | "type": "boolean", 653 | "description": "扫码功能", 654 | "default": false 655 | }, 656 | "photo": { 657 | "type": "boolean", 658 | "description": "拍照功能", 659 | "default": false 660 | }, 661 | "video": { 662 | "type": "boolean", 663 | "description": "录像功能", 664 | "default": false 665 | } 666 | } 667 | }, 668 | "storage": { 669 | "type": "object", 670 | "description": "存储功能", 671 | "properties": { 672 | "local": { 673 | "type": "boolean", 674 | "description": "本地存储", 675 | "default": true 676 | }, 677 | "cloud": { 678 | "type": "object", 679 | "description": "云存储", 680 | "properties": { 681 | "enabled": { 682 | "type": "boolean", 683 | "description": "是否启用云存储", 684 | "default": false 685 | }, 686 | "provider": { 687 | "type": "string", 688 | "description": "云存储服务商", 689 | "enum": ["leancloud", "bmob", "firebase"] 690 | } 691 | } 692 | } 693 | } 694 | } 695 | } 696 | }, 697 | "design": { 698 | "type": "object", 699 | "description": "设计配置", 700 | "properties": { 701 | "theme": { 702 | "type": "string", 703 | "description": "主题模式", 704 | "enum": ["light", "dark", "auto"], 705 | "default": "light" 706 | }, 707 | "color_scheme": { 708 | "type": "object", 709 | "description": "颜色方案", 710 | "properties": { 711 | "primary": { 712 | "type": "string", 713 | "description": "主色调", 714 | "pattern": "^#[0-9a-fA-F]{6}$", 715 | "default": "#007aff" 716 | }, 717 | "secondary": { 718 | "type": "string", 719 | "description": "辅助色", 720 | "pattern": "^#[0-9a-fA-F]{6}$", 721 | "default": "#5ac8fa" 722 | }, 723 | "success": { 724 | "type": "string", 725 | "description": "成功色", 726 | "pattern": "^#[0-9a-fA-F]{6}$", 727 | "default": "#34c759" 728 | }, 729 | "warning": { 730 | "type": "string", 731 | "description": "警告色", 732 | "pattern": "^#[0-9a-fA-F]{6}$", 733 | "default": "#ff9500" 734 | }, 735 | "error": { 736 | "type": "string", 737 | "description": "错误色", 738 | "pattern": "^#[0-9a-fA-F]{6}$", 739 | "default": "#ff3b30" 740 | } 741 | } 742 | }, 743 | "typography": { 744 | "type": "object", 745 | "description": "字体配置", 746 | "properties": { 747 | "font_family": { 748 | "type": "string", 749 | "description": "字体族", 750 | "default": "PingFangSC-Regular, sans-serif" 751 | }, 752 | "font_sizes": { 753 | "type": "object", 754 | "description": "字体大小" 755 | } 756 | } 757 | }, 758 | "spacing": { 759 | "type": "object", 760 | "description": "间距配置" 761 | }, 762 | "border_radius": { 763 | "type": "object", 764 | "description": "圆角配置" 765 | }, 766 | "responsive": { 767 | "type": "object", 768 | "description": "响应式配置", 769 | "properties": { 770 | "enabled": { 771 | "type": "boolean", 772 | "description": "是否启用响应式", 773 | "default": true 774 | }, 775 | "breakpoints": { 776 | "type": "object", 777 | "description": "断点配置" 778 | } 779 | } 780 | } 781 | } 782 | }, 783 | "build": { 784 | "type": "object", 785 | "description": "构建配置", 786 | "properties": { 787 | "typescript": { 788 | "type": "object", 789 | "description": "TypeScript配置", 790 | "properties": { 791 | "enabled": { 792 | "type": "boolean", 793 | "description": "是否启用TypeScript", 794 | "default": true 795 | }, 796 | "strict": { 797 | "type": "boolean", 798 | "description": "严格模式", 799 | "default": true 800 | } 801 | } 802 | }, 803 | "scss": { 804 | "type": "object", 805 | "description": "SCSS配置", 806 | "properties": { 807 | "enabled": { 808 | "type": "boolean", 809 | "description": "是否启用SCSS", 810 | "default": true 811 | } 812 | } 813 | }, 814 | "optimization": { 815 | "type": "object", 816 | "description": "优化配置", 817 | "properties": { 818 | "minify": { 819 | "type": "boolean", 820 | "description": "代码压缩", 821 | "default": true 822 | }, 823 | "tree_shaking": { 824 | "type": "boolean", 825 | "description": "Tree Shaking", 826 | "default": true 827 | } 828 | } 829 | } 830 | } 831 | }, 832 | "deployment": { 833 | "type": "object", 834 | "description": "部署配置", 835 | "properties": { 836 | "environments": { 837 | "type": "object", 838 | "description": "环境配置", 839 | "properties": { 840 | "development": { 841 | "type": "object", 842 | "description": "开发环境" 843 | }, 844 | "staging": { 845 | "type": "object", 846 | "description": "测试环境" 847 | }, 848 | "production": { 849 | "type": "object", 850 | "description": "生产环境" 851 | } 852 | } 853 | } 854 | } 855 | } 856 | } 857 | } --------------------------------------------------------------------------------