@lovrabet/cli 1.2.3 → 1.2.5-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/README.md +33 -17
  2. package/lib/add-page/input-page-router.js +1 -1
  3. package/lib/add-page/main.js +1 -1
  4. package/lib/add-page/select-page-template.js +1 -1
  5. package/lib/api/api-doc-ui.js +1 -1
  6. package/lib/api/api-doc.js +1 -1
  7. package/lib/api/api-pull-ui.js +1 -1
  8. package/lib/api/fetch-model-list.js +1 -1
  9. package/lib/api/generate-api-file.js +1 -1
  10. package/lib/api/main.js +1 -1
  11. package/lib/api/pull-silent.js +1 -1
  12. package/lib/app-menu/app-menu-sync-ui.js +1 -1
  13. package/lib/app-menu/create-menu.js +1 -1
  14. package/lib/app-menu/get-local-pages.js +1 -1
  15. package/lib/app-menu/get-online-menu-list.js +1 -1
  16. package/lib/app-menu/use-get-online-menu-list.js +1 -1
  17. package/lib/app-menu/utils.js +1 -1
  18. package/lib/app-menu/valid-url.js +1 -1
  19. package/lib/app-menu-update-cdn/current-content.js +1 -1
  20. package/lib/app-menu-update-cdn/input-cdn-asset.js +1 -1
  21. package/lib/app-menu-update-cdn/main.js +1 -1
  22. package/lib/app-menu-update-cdn/update-menu-cdn-url.js +1 -1
  23. package/lib/auth/auth-server-ui.js +1 -1
  24. package/lib/auth/auth-server.js +1 -1
  25. package/lib/auth/constant.js +1 -1
  26. package/lib/auth/get-cookie.js +1 -1
  27. package/lib/auth/is-session-valid.js +1 -1
  28. package/lib/auth/logout.js +1 -1
  29. package/lib/cli.js +1 -1
  30. package/lib/cmd/build-watch.js +1 -1
  31. package/lib/cmd/build.js +1 -1
  32. package/lib/cmd/logs.js +1 -1
  33. package/lib/cmd/preview.js +1 -1
  34. package/lib/cmd/start.js +1 -1
  35. package/lib/config/config-help.js +1 -1
  36. package/lib/config/main.js +1 -1
  37. package/lib/constant/domain.js +1 -1
  38. package/lib/constant/env.js +1 -1
  39. package/lib/create-app/enhanced-guided-create.js +1 -1
  40. package/lib/create-app/format-elapsed.js +1 -1
  41. package/lib/create-app/main.js +1 -1
  42. package/lib/create-app/task-finished.js +1 -1
  43. package/lib/create-app/task-loading.js +1 -1
  44. package/lib/create-app/task-running.js +1 -1
  45. package/lib/create-app/task-time.js +1 -1
  46. package/lib/create-app/use-copy-project-template.js +1 -1
  47. package/lib/create-app/use-format-code.js +1 -1
  48. package/lib/create-app/use-install-dependencies.js +1 -1
  49. package/lib/help.js +1 -1
  50. package/lib/init/main.js +1 -1
  51. package/lib/mcp/claude.js +1 -0
  52. package/lib/mcp/cursor.js +1 -1
  53. package/lib/mcp/main.js +1 -1
  54. package/lib/skills/main.js +1 -0
  55. package/lib/utils/check-sdk-version.js +1 -1
  56. package/lib/utils/config.js +1 -1
  57. package/lib/utils/copy-directory.js +1 -1
  58. package/lib/utils/http-client.js +1 -1
  59. package/lib/utils/logger.js +1 -1
  60. package/lib/utils/router-updater.js +1 -1
  61. package/lib/utils/sleep.js +1 -1
  62. package/lib/utils/template-replacer.js +1 -1
  63. package/package.json +1 -1
  64. package/templates/projects/sub-app-react-demo/index.html +22 -34
  65. package/templates/projects/sub-app-react-demo/public/logo.svg +1 -0
  66. package/templates/projects/sub-app-react-demo/src/api/api.ts +1 -1
  67. package/templates/projects/sub-app-react-demo/src/api/client.ts +1 -1
  68. package/templates/projects/sub-app-react-demo/src/layouts/MainLayout.tsx +44 -71
  69. package/templates/projects/sub-app-react-demo/src/pages/index.tsx +387 -927
  70. package/templates/projects/sub-app-react-demo/src/pages/sdk-demo/index.tsx +1 -1
  71. package/templates/projects/sub-app-react-demo/src/pages/workbench/index.module.css +293 -0
  72. package/templates/projects/sub-app-react-demo/src/pages/workbench/index.tsx +100 -414
  73. package/templates/projects/sub-app-react-demo/src/style.css +21 -15
  74. package/templates/projects/sub-app-react-demo/vite.config.ts +18 -13
  75. package/templates/rules/lovrabet_rules.mdc.tpl +636 -43
  76. package/templates/skills/.claude/skills/lovrabet/SKILL.md +257 -0
  77. package/templates/skills/.cursor/commands/lovrabet.md +247 -0
  78. package/templates/skills/.cursorrules +109 -0
  79. package/templates/skills/.shared/README.md +45 -0
  80. package/templates/skills/.shared/guides/01-filter-query/guide.md +300 -0
  81. package/templates/skills/.shared/guides/02-mcp-sql-workflow/guide.md +272 -0
  82. package/templates/skills/.shared/guides/03-antd-style/guide.md +227 -0
  83. package/templates/skills/.shared/guides/04-troubleshooting/guide.md +426 -0
  84. package/templates/skills/.shared/guides/05-api-integration/guide.md +327 -0
  85. package/templates/skills/.shared/guides/06-menu-management/guide.md +305 -0
  86. package/templates/skills/.windsurf/workflows/lovrabet.md +256 -0
  87. package/templates/projects/sub-app-react-demo/.vscode/extensions.json +0 -3
  88. package/templates/projects/sub-app-react-demo/.vscode/settings.json +0 -57
  89. package/templates/projects/sub-app-react-demo/src/pages/intro/index.tsx +0 -560
@@ -1,982 +1,442 @@
1
+ /**
2
+ * Title: Rabetbase 开发指南
3
+ */
1
4
  import React from "react";
5
+ import { Typography, Card, Row, Col, Button, Tabs, Alert, Space, Tag } from "antd";
2
6
  import {
3
- Typography,
4
- Card,
5
- Row,
6
- Col,
7
- Space,
8
- Tag,
9
- Divider,
10
- Button,
11
- Steps,
12
- Alert,
13
- } from "antd";
14
- import {
15
- RocketOutlined,
16
- ToolOutlined,
17
- ApiOutlined,
18
- CloudServerOutlined,
19
- RobotOutlined,
20
- ThunderboltOutlined,
21
- FileTextOutlined,
22
- LinkOutlined,
23
- CheckCircleOutlined,
24
- PlayCircleOutlined,
25
7
  CodeOutlined,
26
- SettingOutlined,
27
- SyncOutlined,
28
- BuildOutlined,
29
- BulbOutlined,
8
+ RobotOutlined,
9
+ ToolOutlined,
10
+ BookOutlined,
11
+ ArrowRightOutlined,
12
+ CopyOutlined,
13
+ CheckOutlined,
14
+ RocketOutlined,
15
+ ExclamationCircleOutlined,
30
16
  } from "@ant-design/icons";
31
17
 
32
18
  const { Title, Paragraph, Text } = Typography;
33
19
 
34
- function HomePage() {
20
+ // 可复制的代码块
21
+ function CopyableCode({ code, label }: { code: string; label: string }) {
22
+ const [copied, setCopied] = React.useState(false);
23
+
24
+ const handleCopy = async () => {
25
+ await navigator.clipboard.writeText(code);
26
+ setCopied(true);
27
+ setTimeout(() => setCopied(false), 2000);
28
+ };
29
+
35
30
  return (
36
- <div style={{ padding: "24px", maxWidth: "1400px", margin: "0 auto" }}>
37
- {/* 欢迎横幅 */}
38
- <Card
31
+ <div style={{ marginBottom: 12 }}>
32
+ <div
39
33
  style={{
40
- background: "linear-gradient(135deg, #667eea 0%, #764ba2 100%)",
41
- border: "none",
34
+ display: "flex",
35
+ justifyContent: "space-between",
36
+ alignItems: "center",
37
+ marginBottom: 8,
42
38
  }}
43
39
  >
44
- <Row align="middle" gutter={24}>
45
- <Col xs={24} md={16}>
46
- <Title level={1} style={{ color: "#fff", margin: 0 }}>
47
- <RocketOutlined /> 欢迎使用 Lovrabet BaaS 开发体系
48
- </Title>
49
- <Paragraph
50
- style={{
51
- color: "#fff",
52
- fontSize: 16,
53
- marginTop: 16,
54
- marginBottom: 0,
55
- }}
56
- >
57
- 完整的工具链让您快速构建企业级应用:
58
- <Text strong style={{ color: "#fff" }}>
59
- CLI 脚手架
60
- </Text>{" "}
61
- +{" "}
62
- <Text strong style={{ color: "#fff" }}>
63
- SDK 数据访问
64
- </Text>{" "}
65
- +{" "}
66
- <Text strong style={{ color: "#fff" }}>
67
- MCP AI 辅助
68
- </Text>
69
- </Paragraph>
70
- </Col>
71
- <Col xs={24} md={8} style={{ textAlign: "right" }}>
72
- <Space>
73
- <Button
74
- type="primary"
75
- size="large"
76
- icon={<PlayCircleOutlined />}
77
- href="https://open.lovrabet.com/docs/lovrabet-cli/quickstart"
78
- target="_blank"
79
- style={{
80
- background: "#fff",
81
- color: "#667eea",
82
- border: "none",
83
- }}
84
- >
85
- 快速开始
86
- </Button>
87
- <Button
88
- size="large"
89
- icon={<FileTextOutlined />}
90
- href="https://open.lovrabet.com"
91
- target="_blank"
92
- style={{
93
- background: "rgba(255,255,255,0.2)",
94
- color: "#fff",
95
- border: "1px solid rgba(255,255,255,0.3)",
96
- }}
97
- >
98
- 查看文档
99
- </Button>
100
- </Space>
101
- </Col>
102
- </Row>
103
- </Card>
104
-
105
- <Space
106
- direction="vertical"
107
- size="large"
108
- style={{ width: "100%", marginTop: 24 }}
40
+ <Text type="secondary">{label}</Text>
41
+ <Button
42
+ type="primary"
43
+ size="small"
44
+ icon={copied ? <CheckOutlined /> : <CopyOutlined />}
45
+ onClick={handleCopy}
46
+ >
47
+ {copied ? "已复制" : "复制"}
48
+ </Button>
49
+ </div>
50
+ <pre
51
+ style={{
52
+ background: "#1e1e1e",
53
+ borderRadius: 8,
54
+ padding: "16px 20px",
55
+ margin: 0,
56
+ fontFamily: "'JetBrains Mono', 'Monaco', monospace",
57
+ fontSize: 13,
58
+ lineHeight: 1.6,
59
+ color: "#e4e4e7",
60
+ overflowX: "auto",
61
+ }}
109
62
  >
110
- {/* 为什么需要二次开发 */}
111
- <Card>
112
- <Title level={2} style={{ marginBottom: 24 }}>
113
- <BulbOutlined style={{ color: "#1890ff" }} /> 为什么需要二次开发?
114
- </Title>
115
- <Alert
116
- message="AI + 人类:各展所长的协作模式"
117
- description={
118
- <Paragraph style={{ marginBottom: 0 }}>
119
- <Text strong>我们的设计理念</Text>:Lovrabet
120
- 不是要替代人类开发者,而是成为你的得力助手。 AI 处理 80%
121
- 的标准功能,你专注 20% 的核心价值。
122
- </Paragraph>
123
- }
124
- type="info"
125
- showIcon
126
- style={{ marginBottom: 24 }}
127
- />
63
+ <code>{code}</code>
64
+ </pre>
65
+ </div>
66
+ );
67
+ }
128
68
 
129
- <Title level={3} style={{ marginBottom: 16 }}>
130
- 🔴 暂时(截止 2025-11-30)无法通过 AI 实现,需要二次开发的场景
131
- </Title>
132
- <Paragraph style={{ fontSize: 15, color: "#666", marginBottom: 24 }}>
133
- 以下场景是 Lovrabet AI 当前无法覆盖的,必须通过扩展开发来实现:
134
- </Paragraph>
69
+ // api.ts 提取 appCode
70
+ function getAppCodeFromApi(content: string): string | null {
71
+ const match =
72
+ content.match(/LOVRABET_APP_CODE\s*=\s*["']([^"']+)["']/) ||
73
+ content.match(/appCode:\s*["']([^"']+)["']/);
74
+ return match ? match[1] : null;
75
+ }
135
76
 
136
- <Row gutter={[16, 16]}>
137
- {/* 场景一:复杂业务逻辑 */}
138
- <Col xs={24} md={12}>
139
- <Card
140
- size="small"
141
- style={{
142
- background: "#fefefe",
143
- border: "2px solid #999999",
144
- height: "100%",
145
- }}
146
- hoverable
147
- >
148
- <Title level={4} style={{ marginTop: 0, color: "#fa8c16" }}>
149
- <CodeOutlined /> 场景一:复杂业务逻辑
150
- </Title>
151
- <Paragraph style={{ fontSize: 14, lineHeight: 1.8 }}>
152
- <Text strong>典型需求:</Text>
153
- </Paragraph>
154
- <ul
155
- style={{
156
- fontSize: 13,
157
- lineHeight: 2,
158
- color: "#666",
159
- paddingLeft: 20,
160
- marginBottom: 16,
161
- }}
162
- >
163
- <li>
164
- <Text strong>批量数据操作</Text> -
165
- 批量修改多条记录,每条记录需要不同的业务规则校验
166
- </li>
167
- <li>
168
- <Text strong>复杂数据校验</Text> -
169
- 写入数据表之前需要执行复杂的业务逻辑校验(如跨表验证、条件判断等)
170
- </li>
171
- <li>
172
- <Text strong>特殊算法处理</Text> -
173
- 字段值需要特殊算法处理,例如加盐的 MD5
174
- 加密、自定义哈希算法等
175
- </li>
176
- <li>
177
- <Text strong>数据转换</Text> -
178
- 写入前需要复杂的数据格式转换、计算、关联处理
179
- </li>
180
- </ul>
181
- <Alert
182
- message="计划支持"
183
- description={
184
- <div>
185
- <Text>
186
- Lovrabet 体系计划在 <Text strong>2025 年 12月</Text>
187
- 通过边缘函数支持
188
- </Text>
189
- <div style={{ marginTop: 8 }}>
190
- <Text type="secondary" style={{ fontSize: 12 }}>
191
- 在此之前,需要通过扩展开发来实现复杂业务逻辑。
192
- </Text>
193
- </div>
194
- </div>
195
- }
196
- type="warning"
197
- showIcon
198
- style={{ marginTop: 8 }}
199
- />
200
- </Card>
201
- </Col>
77
+ function HomePage() {
78
+ const [appCode, setAppCode] = React.useState<string | null>(null);
79
+ const [loading, setLoading] = React.useState(true);
202
80
 
203
- {/* 场景二:个性化页面设计 */}
204
- <Col xs={24} md={12}>
205
- <Card
206
- size="small"
207
- style={{
208
- background: "#f0f9ff",
209
- border: "2px solid #91d5ff",
210
- height: "100%",
211
- }}
212
- hoverable
213
- >
214
- <Title level={4} style={{ marginTop: 0, color: "#1890ff" }}>
215
- <CloudServerOutlined /> 场景二:个性化页面设计
216
- </Title>
217
- <Paragraph style={{ fontSize: 14, lineHeight: 1.8 }}>
218
- <Text strong>典型需求:</Text>
219
- </Paragraph>
220
- <ul
221
- style={{
222
- fontSize: 13,
223
- lineHeight: 2,
224
- color: "#666",
225
- paddingLeft: 20,
226
- marginBottom: 16,
227
- }}
228
- >
229
- <li>
230
- <Text strong>数据大屏</Text> -
231
- 全屏数据可视化大屏,包含实时图表、动画效果、自定义布局
232
- </li>
233
- <li>
234
- <Text strong>定制化 UI</Text> -
235
- 特殊的交互设计,如拖拽式看板、可视化网络图、3D 展示等
236
- </li>
237
- <li>
238
- <Text strong>专业组件</Text> - 需要集成专业 UI 库(如
239
- ECharts、G6、Three.js 等)
240
- </li>
241
- <li>
242
- <Text strong>品牌定制</Text> -
243
- 完全符合企业品牌风格的页面设计
244
- </li>
245
- </ul>
246
- <Alert
247
- message="计划支持"
248
- description={
249
- <div>
250
- <Text>
251
- Lovrabet 体系计划在 <Text strong>2025 年 12月</Text>到
252
- <Text strong>2026 年 Q1</Text> 陆续升级支持
253
- </Text>
254
- <div style={{ marginTop: 8 }}>
255
- <Text type="secondary" style={{ fontSize: 12 }}>
256
- 在此之前,需要通过扩展开发来实现个性化页面设计。
257
- </Text>
258
- </div>
259
- </div>
260
- }
261
- type="warning"
262
- showIcon
263
- style={{ marginTop: 8 }}
264
- />
265
- </Card>
266
- </Col>
81
+ React.useEffect(() => {
82
+ const loadAppCode = async () => {
83
+ try {
84
+ const modules = import.meta.glob("/src/api/*.ts", {
85
+ query: "?raw",
86
+ import: "default",
87
+ });
88
+ const apiPath = "/src/api/api.ts";
267
89
 
268
- {/* 场景三:H5、小程序 */}
269
- <Col xs={24} md={12}>
270
- <Card
271
- size="small"
272
- style={{
273
- background: "#f6ffed",
274
- border: "2px solid #b7eb8f",
275
- height: "100%",
276
- }}
277
- hoverable
278
- >
279
- <Title level={4} style={{ marginTop: 0, color: "#52c41a" }}>
280
- <ThunderboltOutlined /> 场景三:H5、小程序
281
- </Title>
282
- <Paragraph style={{ fontSize: 14, lineHeight: 1.8 }}>
283
- <Text strong>当前限制:</Text>
284
- </Paragraph>
285
- <ul
286
- style={{
287
- fontSize: 13,
288
- lineHeight: 2,
289
- color: "#666",
290
- paddingLeft: 20,
291
- marginBottom: 16,
292
- }}
293
- >
294
- <li>
295
- <Text strong>workbench、大屏等页面</Text>{" "}
296
- B端管理后台的workbench工作台首页之类
297
- </li>
298
- <li>
299
- <Text strong>H5 应用</Text> - 移动端 H5
300
- 页面,需要响应式设计和移动端优化
301
- </li>
302
- <li>
303
- <Text strong>微信小程序</Text> -
304
- 微信小程序开发,需要符合小程序规范
305
- </li>
306
- <li>
307
- <Text strong>其他小程序</Text> - 支付宝、抖音等平台小程序
308
- </li>
309
- <li>
310
- <Text strong>原生 App</Text> - React Native、Flutter
311
- 等跨平台应用
312
- </li>
313
- </ul>
314
- <Alert
315
- message="计划支持"
316
- description={
317
- <div>
318
- <div>
319
- <Text>
320
- workbench体系计划在 <Text strong>2025 年 12月</Text>{" "}
321
- 支持
322
- </Text>
323
- <br />
324
- <Text>
325
- H5、小程序体系计划在 <Text strong>2026 年 Q2</Text>{" "}
326
- 支持 H5 和小程序开发。
327
- </Text>
328
- </div>
329
- <div style={{ marginTop: 8 }}>
330
- <Text type="secondary" style={{ fontSize: 12 }}>
331
- 在此之前,需要通过扩展开发来实现移动端应用。
332
- </Text>
333
- </div>
334
- </div>
335
- }
336
- type="warning"
337
- showIcon
338
- style={{ marginTop: 8 }}
339
- />
340
- </Card>
341
- </Col>
90
+ if (apiPath in modules) {
91
+ const content = await modules[apiPath]();
92
+ const code = getAppCodeFromApi(content as string);
93
+ setAppCode(code);
94
+ }
95
+ } catch (err) {
96
+ console.error("加载 api.ts 失败:", err);
97
+ } finally {
98
+ setLoading(false);
99
+ }
100
+ };
342
101
 
343
- {/* 场景四:其他扩展场景 */}
344
- <Col xs={24} md={12}>
345
- <Card
346
- size="small"
347
- style={{
348
- background: "#f9f0ff",
349
- border: "2px solid #d3adf7",
350
- height: "100%",
351
- }}
352
- hoverable
353
- >
354
- <Title level={4} style={{ marginTop: 0, color: "#722ed1" }}>
355
- <ToolOutlined /> 场景四:其他扩展需求
356
- </Title>
357
- <Paragraph style={{ fontSize: 14, lineHeight: 1.8 }}>
358
- <Text strong>其他常见场景:</Text>
359
- </Paragraph>
360
- <ul
361
- style={{
362
- fontSize: 13,
363
- lineHeight: 2,
364
- color: "#666",
365
- paddingLeft: 20,
366
- marginBottom: 0,
367
- }}
368
- >
369
- <li>
370
- <Text strong>第三方系统集成</Text> -
371
- 与企业现有系统例如用友、金蝶、SAP等系统深度集成
372
- </li>
373
- <li>
374
- <Text strong>行业专属算法</Text> -
375
- 接入自研的风控模型、诊断流程等专业算法
376
- </li>
377
- <li>
378
- <Text strong>复杂审批流程</Text> -
379
- 多级审批、条件路由、会签等复杂工作流
380
- </li>
381
- </ul>
382
- <Alert
383
- message="计划支持"
384
- description={
385
- <div>
386
- <Text>
387
- Lovrabet 体系计划在 <Text strong>2025 年 Q1</Text>
388
- 陆续支持工作流引擎、审批引擎等复杂业务逻辑。
389
- </Text>
390
- <div style={{ marginTop: 8 }}>
391
- <Text type="secondary" style={{ fontSize: 12 }}>
392
- 在此之前,需要通过扩展开发来实现其他扩展需求。
393
- </Text>
394
- </div>
395
- </div>
396
- }
397
- type="warning"
398
- showIcon
399
- style={{ marginTop: 8 }}
400
- />
401
- </Card>
402
- </Col>
403
- </Row>
404
- </Card>
102
+ loadAppCode();
103
+ }, []);
405
104
 
406
- {/* 核心工具链 */}
407
- <Card>
408
- <Title level={2} style={{ marginBottom: 24 }}>
409
- <ToolOutlined style={{ color: "#1890ff" }} /> 三大核心工具
410
- </Title>
411
- <Row gutter={[16, 16]}>
412
- {/* CLI */}
413
- <Col xs={24} md={8}>
414
- <Card
415
- size="small"
416
- style={{ height: "100%", border: "2px solid #e6f7ff" }}
417
- hoverable
418
- >
419
- <Space
420
- direction="vertical"
421
- size="middle"
422
- style={{ width: "100%" }}
423
- >
424
- <div>
425
- <ThunderboltOutlined
426
- style={{
427
- fontSize: 32,
428
- color: "#1890ff",
429
- marginBottom: 8,
430
- }}
431
- />
432
- <Title level={4} style={{ margin: "8px 0" }}>
433
- Lovrabet CLI
434
- </Title>
435
- <Text type="secondary">
436
- 脚手架工具,一键创建项目、生成 API 配置、同步菜单
437
- </Text>
438
- </div>
439
- <Space wrap>
440
- <Tag color="blue">项目创建</Tag>
441
- <Tag color="green">API 生成</Tag>
442
- <Tag color="orange">菜单同步</Tag>
443
- </Space>
444
- <div>
445
- <Text strong>核心命令:</Text>
446
- <div
447
- style={{
448
- marginTop: 8,
449
- fontFamily: "monospace",
450
- fontSize: 12,
451
- background: "#f5f5f5",
452
- padding: 8,
453
- borderRadius: 4,
454
- }}
455
- >
456
- <div>lovrabet create</div>
457
- <div>lovrabet api pull</div>
458
- <div>lovrabet menu sync</div>
459
- </div>
460
- </div>
461
- <Button
462
- type="link"
463
- icon={<LinkOutlined />}
464
- href="https://open.lovrabet.com/docs/lovrabet-cli"
465
- target="_blank"
466
- style={{ padding: 0 }}
467
- >
468
- 查看 CLI 文档 →
469
- </Button>
470
- </Space>
471
- </Card>
472
- </Col>
105
+ // 检查是否已配置
106
+ const isNotSet = appCode === "NOT-SET" || appCode === null;
107
+ const displayAppCode = isNotSet ? "your-app-code" : appCode;
473
108
 
474
- {/* SDK */}
475
- <Col xs={24} md={8}>
476
- <Card
477
- size="small"
478
- style={{ height: "100%", border: "2px solid #f6ffed" }}
479
- hoverable
480
- >
481
- <Space
482
- direction="vertical"
483
- size="middle"
484
- style={{ width: "100%" }}
485
- >
486
- <div>
487
- <ApiOutlined
488
- style={{
489
- fontSize: 32,
490
- color: "#52c41a",
491
- marginBottom: 8,
492
- }}
493
- />
494
- <Title level={4} style={{ margin: "8px 0" }}>
495
- Lovrabet SDK
496
- </Title>
497
- <Text type="secondary">
498
- 数据访问层,提供类型安全的 CRUD 操作和复杂查询
499
- </Text>
500
- </div>
501
- <Space wrap>
502
- <Tag color="green">TypeScript</Tag>
503
- <Tag color="cyan">三种认证</Tag>
504
- <Tag color="purple">复杂查询</Tag>
505
- </Space>
506
- <div>
507
- <Text strong>核心特性:</Text>
508
- <div
509
- style={{
510
- marginTop: 8,
511
- fontFamily: "monospace",
512
- fontSize: 12,
513
- background: "#f5f5f5",
514
- padding: 8,
515
- borderRadius: 4,
516
- }}
517
- >
518
- <div>• 类型安全</div>
519
- <div>• 环境自适应</div>
520
- <div>• 复杂过滤查询</div>
521
- </div>
522
- </div>
523
- <Button
524
- type="link"
525
- icon={<LinkOutlined />}
526
- href="https://open.lovrabet.com/docs/category/lovrabet-node-sdk"
527
- target="_blank"
528
- style={{ padding: 0 }}
529
- >
530
- 查看 SDK 文档 →
531
- </Button>
532
- </Space>
533
- </Card>
534
- </Col>
109
+ const mcpConfig = `{
110
+ "mcpServers": {
111
+ "lovrabet-dataset": {
112
+ "command": "npx",
113
+ "args": ["-y", "@lovrabet/dataset-mcp-server"],
114
+ "env": {
115
+ "LOVRABET_APP_CODE": "${displayAppCode}"
116
+ }
117
+ }
118
+ }
119
+ }`;
535
120
 
536
- {/* MCP */}
537
- <Col xs={24} md={8}>
538
- <Card
539
- size="small"
540
- style={{ height: "100%", border: "2px solid #fff2e8" }}
541
- hoverable
542
- >
543
- <Space
544
- direction="vertical"
545
- size="middle"
546
- style={{ width: "100%" }}
547
- >
548
- <div>
549
- <RobotOutlined
550
- style={{
551
- fontSize: 32,
552
- color: "#fa8c16",
553
- marginBottom: 8,
554
- }}
555
- />
556
- <Title level={4} style={{ margin: "8px 0" }}>
557
- MCP Server
558
- </Title>
559
- <Text type="secondary">
560
- AI 辅助开发,让 AI 理解你的业务数据结构,自动生成代码
561
- </Text>
562
- </div>
563
- <Space wrap>
564
- <Tag color="orange">AI 辅助</Tag>
565
- <Tag color="red">智能生成</Tag>
566
- <Tag color="magenta">效率提升</Tag>
567
- </Space>
568
- <div>
569
- <Text strong>核心价值:</Text>
570
- <div
571
- style={{
572
- marginTop: 8,
573
- fontFamily: "monospace",
574
- fontSize: 12,
575
- background: "#f5f5f5",
576
- padding: 8,
577
- borderRadius: 4,
578
- }}
579
- >
580
- <div>• 理解业务数据</div>
581
- <div>• 自动生成代码</div>
582
- <div>• 节省 50-80% 时间</div>
583
- </div>
584
- </div>
585
- <Button
586
- type="link"
587
- icon={<LinkOutlined />}
588
- href="https://open.lovrabet.com/docs/mcp/intro"
589
- target="_blank"
590
- style={{ padding: 0 }}
591
- >
592
- 查看 MCP 文档 →
593
- </Button>
594
- </Space>
595
- </Card>
596
- </Col>
597
- </Row>
598
- </Card>
121
+ const cliCode = `# 拉取最新 API 配置
122
+ lovrabet api pull
123
+
124
+ # 微前端子应用同步菜单
125
+ lovrabet menu sync`;
126
+
127
+ const configTabs = [
128
+ {
129
+ key: "mcp",
130
+ label: (
131
+ <span>
132
+ <RobotOutlined /> MCP 配置
133
+ </span>
134
+ ),
135
+ children: (
136
+ <div>
137
+ <Paragraph>claude code 配置:</Paragraph>
138
+ <Paragraph style={{ fontSize: 12, color: "#666" }}>
139
+ 配置文件路径:
140
+ <br />
141
+ macOS: ~/Library/Application
142
+ Support/Claude/claude_desktop_config.json
143
+ <br />
144
+ Windows: %APPDATA%/Claude/claude_desktop_config.json
145
+ </Paragraph>
146
+ <CopyableCode code={mcpConfig} label="claude_desktop_config.json" />
599
147
 
600
- {/* 开发流程指引 */}
601
- <Card>
602
- <Title level={2} style={{ marginBottom: 24 }}>
603
- <CodeOutlined style={{ color: "#1890ff" }} /> 5 分钟快速上手
604
- </Title>
605
- <Steps
606
- direction="vertical"
607
- size="small"
608
- items={[
609
- {
610
- title: "安装 CLI 并创建项目",
611
- description: (
612
- <div>
613
- <div
614
- style={{
615
- fontFamily: "monospace",
616
- background: "#f5f5f5",
617
- padding: "8px 12px",
618
- borderRadius: 4,
619
- marginBottom: 8,
620
- }}
621
- >
622
- npm install -g @lovrabet/cli
623
- <br />
624
- lovrabet create my-app
625
- </div>
626
- <Text type="secondary">
627
- CLI 会自动生成项目结构、安装依赖、配置路由
628
- </Text>
629
- </div>
630
- ),
631
- icon: <CheckCircleOutlined style={{ color: "#52c41a" }} />,
632
- },
633
- {
634
- title: "拉取 API 配置",
635
- description: (
636
- <div>
637
- <div
638
- style={{
639
- fontFamily: "monospace",
640
- background: "#f5f5f5",
641
- padding: "8px 12px",
642
- borderRadius: 4,
643
- marginBottom: 8,
644
- }}
645
- >
646
- cd my-app
647
- <br />
648
- lovrabet api pull --appcode your-app-code
649
- </div>
650
- <Text type="secondary">
651
- 自动扫描数据集,生成 SDK 配置文件和 TypeScript 类型
652
- </Text>
653
- </div>
654
- ),
655
- icon: <SyncOutlined style={{ color: "#1890ff" }} />,
656
- },
657
- {
658
- title: "配置 MCP(推荐)",
659
- description: (
660
- <div>
661
- <div
662
- style={{
663
- fontFamily: "monospace",
664
- background: "#f5f5f5",
665
- padding: "8px 12px",
666
- borderRadius: 4,
667
- marginBottom: 8,
668
- }}
669
- >
670
- {`{
148
+ <Paragraph style={{ marginTop: 16 }}>Cursor 配置:</Paragraph>
149
+ <Paragraph style={{ fontSize: 12, color: "#666" }}>
150
+ 设置 MCP 添加服务器
151
+ </Paragraph>
152
+ <CopyableCode
153
+ code={`// Cursor MCP 配置
154
+ {
671
155
  "mcpServers": {
672
156
  "lovrabet-dataset": {
673
157
  "command": "npx",
674
158
  "args": ["-y", "@lovrabet/dataset-mcp-server"],
675
159
  "env": {
676
- "DEFAULT_APP_CODE": "your-app-code"
160
+ "LOVRABET_APP_CODE": "${displayAppCode}"
677
161
  }
678
162
  }
679
163
  }
680
164
  }`}
681
- </div>
682
- <Text type="secondary">
683
- 配置后,AI 工具(Claude、Cursor)就能理解你的业务数据
684
- </Text>
685
- </div>
686
- ),
687
- icon: <SettingOutlined style={{ color: "#fa8c16" }} />,
688
- },
689
- {
690
- title: "开始开发",
691
- description: (
692
- <div>
693
- <div
694
- style={{
695
- fontFamily: "monospace",
696
- background: "#f5f5f5",
697
- padding: "8px 12px",
698
- borderRadius: 4,
699
- marginBottom: 8,
700
- }}
701
- >
702
- lovrabet start
703
- <br /># 或使用 AI 生成代码
704
- </div>
705
- <Text type="secondary">
706
- 启动开发服务器,使用 SDK 进行数据操作,或让 AI
707
- 帮你生成代码
708
- </Text>
709
- </div>
710
- ),
711
- icon: <PlayCircleOutlined style={{ color: "#722ed1" }} />,
712
- },
713
- {
714
- title: "同步菜单并部署",
715
- description: (
716
- <div>
717
- <div
718
- style={{
719
- fontFamily: "monospace",
720
- background: "#f5f5f5",
721
- padding: "8px 12px",
722
- borderRadius: 4,
723
- marginBottom: 8,
724
- }}
725
- >
726
- lovrabet menu sync
727
- <br />
728
- lovrabet build
729
- </div>
730
- <Text type="secondary">
731
- 一键同步菜单到主系统,构建生产版本并部署
732
- </Text>
733
- </div>
734
- ),
735
- icon: <BuildOutlined style={{ color: "#eb2f96" }} />,
736
- },
737
- ]}
165
+ label="Cursor MCP 配置"
166
+ />
167
+
168
+ <Paragraph style={{ marginTop: 16 }}>
169
+ Claude Code (VS Code 扩展):
170
+ </Paragraph>
171
+ <CopyableCode
172
+ code={`claude mcp add lovrabet-dataset npx @lovrabet/dataset-mcp-server@latest -e LOVRABET_APP_CODE=${displayAppCode}`}
173
+ label="Claude Code 终端命令"
738
174
  />
739
175
 
740
- {/* 视频教程 */}
741
- <div style={{ marginTop: 32 }}>
742
- <Title level={4} style={{ marginBottom: 16 }}>
743
- 视频教程
176
+ <Button
177
+ type="link"
178
+ href="https://open.lovrabet.com/docs/mcp/intro"
179
+ target="_blank"
180
+ >
181
+ 查看完整文档 <ArrowRightOutlined />
182
+ </Button>
183
+ </div>
184
+ ),
185
+ },
186
+ {
187
+ key: "cli",
188
+ label: (
189
+ <span>
190
+ <ToolOutlined /> CLI 命令
191
+ </span>
192
+ ),
193
+ children: (
194
+ <div>
195
+ <Paragraph>常用 CLI 命令:</Paragraph>
196
+ <CopyableCode code={cliCode} label="终端命令" />
197
+ <Button
198
+ type="link"
199
+ href="https://open.lovrabet.com/docs/lovrabet-cli/quickstart"
200
+ target="_blank"
201
+ >
202
+ 查看完整文档 <ArrowRightOutlined />
203
+ </Button>
204
+ </div>
205
+ ),
206
+ },
207
+ ];
208
+
209
+ const docLinks = [
210
+ {
211
+ title: "入门指南",
212
+ icon: <RocketOutlined />,
213
+ links: [
214
+ {
215
+ label: "5 分钟上手指引",
216
+ url: "https://open.lovrabet.com/docs/guides/step-guide",
217
+ },
218
+ {
219
+ label: "开发者工具全景",
220
+ url: "https://open.lovrabet.com/docs/guides/toolchain",
221
+ },
222
+ { label: "常见问题", url: "https://open.lovrabet.com/docs/guides/faq" },
223
+ ],
224
+ },
225
+ {
226
+ title: "开发文档",
227
+ icon: <BookOutlined />,
228
+ links: [
229
+ {
230
+ label: "TypeScript SDK",
231
+ url: "https://open.lovrabet.com/docs/lovrabet-sdk/intro",
232
+ },
233
+ {
234
+ label: "Java SDK",
235
+ url: "https://open.lovrabet.com/docs/java-opensdk/quickstart",
236
+ },
237
+ {
238
+ label: "OpenAPI",
239
+ url: "https://open.lovrabet.com/docs/openapi/intro",
240
+ },
241
+ { label: "MCP", url: "https://open.lovrabet.com/docs/mcp/intro" },
242
+ {
243
+ label: "Backend Function",
244
+ url: "https://open.lovrabet.com/docs/guides/best-practices",
245
+ },
246
+ ],
247
+ },
248
+ ];
249
+
250
+ return (
251
+ <div style={{ maxWidth: "1200px", margin: "0 auto", padding: "24px" }}>
252
+ {/* 标题区 */}
253
+ <div style={{ marginBottom: 32 }}>
254
+ <div
255
+ style={{
256
+ display: "flex",
257
+ justifyContent: "space-between",
258
+ alignItems: "flex-start",
259
+ flexWrap: "wrap",
260
+ gap: 16,
261
+ }}
262
+ >
263
+ <div>
264
+ <Title level={2} style={{ margin: 0 }}>
265
+ Rabetbase 开发指南
744
266
  </Title>
745
- <div
746
- style={{
747
- position: "relative",
748
- width: "100%",
749
- paddingBottom: "56.25%", // 16:9 宽高比
750
- height: 0,
751
- overflow: "hidden",
752
- borderRadius: 8,
753
- background: "#000",
754
- }}
755
- >
756
- <iframe
757
- src="//player.bilibili.com/player.html?isOutside=true&aid=115291971391698&bvid=BV1rBn2zvE8W&cid=32740478316&p=1"
758
- scrolling="no"
759
- frameBorder="0"
760
- allowFullScreen={true}
761
- style={{
762
- position: "absolute",
763
- top: 0,
764
- left: 0,
765
- width: "100%",
766
- height: "100%",
767
- border: "none",
768
- }}
769
- />
770
- </div>
267
+ <Paragraph style={{ color: "#666", marginTop: 8, marginBottom: 0 }}>
268
+ 基于 Lovrabet 平台的后端即服务(BaaS)
269
+ </Paragraph>
771
270
  </div>
772
- </Card>
773
-
774
- {/* 典型使用场景 */}
775
- <Card>
776
- <Title level={2} style={{ marginBottom: 24 }}>
777
- <CloudServerOutlined style={{ color: "#1890ff" }} /> 典型使用场景
778
- </Title>
779
- <Row gutter={[16, 16]}>
780
- <Col xs={24} md={12}>
781
- <Card
782
- size="small"
783
- style={{ background: "#f6ffed", border: "1px solid #b7eb8f" }}
271
+ <Space size="middle">
272
+ <a
273
+ href="https://open.lovrabet.com"
274
+ target="_blank"
275
+ rel="noopener noreferrer"
276
+ >
277
+ Rabetbase官网
278
+ </a>
279
+ <a
280
+ href="https://open.lovrabet.com/docs/changelog"
281
+ target="_blank"
282
+ rel="noopener noreferrer"
283
+ >
284
+ 更新日志
285
+ </a>
286
+ {!isNotSet && appCode && (
287
+ <a
288
+ href={`https://app.lovrabet.com/app/${appCode}/data/intro/`}
289
+ target="_blank"
290
+ rel="noopener noreferrer"
784
291
  >
785
- <Title level={4} style={{ marginTop: 0 }}>
786
- <CheckCircleOutlined style={{ color: "#52c41a" }} />{" "}
787
- 快速原型开发
788
- </Title>
789
- <Paragraph>
790
- 使用 CLI 一键创建项目,自动生成 API 配置,5
791
- 分钟内搭建完整的应用框架。 适合快速验证业务想法、构建 MVP
792
- 产品。
793
- </Paragraph>
794
- <Text code>lovrabet create → lovrabet api pull → 开始开发</Text>
795
- </Card>
796
- </Col>
797
- <Col xs={24} md={12}>
798
- <Card
292
+ 应用配置后台
293
+ </a>
294
+ )}
295
+ </Space>
296
+ </div>
297
+ </div>
298
+
299
+ {/* Rabetbase 介绍卡片 */}
300
+ <Card style={{ marginBottom: 24 }}>
301
+ <Row gutter={[24, 16]} align="middle">
302
+ <Col xs={24} lg={16}>
303
+ <Title level={3} style={{ marginBottom: 12 }}>
304
+ 什么是 Rabetbase?
305
+ </Title>
306
+ <Paragraph style={{ fontSize: 15, marginBottom: 16, color: "#595959" }}>
307
+ <strong>Rabetbase 是 Lovrabet 面向技术岗位的开发者平台。</strong>
308
+ <br />
309
+ Lovrabet 工作台让业务人员用 AI 生成管理系统,但有些个性化需求(如小程序、ERP 对接、复杂业务逻辑)需要开发者介入。
310
+ Rabetbase 把 Lovrabet 平台的数据能力开放出来,让开发者专注于写业务逻辑。
311
+ </Paragraph>
312
+ <Space wrap>
313
+ <Button
799
314
  size="small"
800
- style={{ background: "#e6f7ff", border: "1px solid #91d5ff" }}
315
+ href="https://open.lovrabet.com/docs/category/openapi"
316
+ target="_blank"
801
317
  >
802
- <Title level={4} style={{ marginTop: 0 }}>
803
- <CheckCircleOutlined style={{ color: "#1890ff" }} /> AI
804
- 辅助开发
805
- </Title>
806
- <Paragraph>
807
- 配置 MCP 后,直接告诉 AI 你的需求,AI
808
- 理解数据结构后自动生成准确的代码。
809
- 复杂查询、数据关联、完整组件,一句话搞定。
810
- </Paragraph>
811
- <Text code>配置 MCP → 对话生成代码 → 一次通过</Text>
812
- </Card>
813
- </Col>
814
- <Col xs={24} md={12}>
815
- <Card
318
+ OpenAPI
319
+ </Button>
320
+ <Button
816
321
  size="small"
817
- style={{ background: "#fff2e8", border: "1px solid #ffd591" }}
322
+ href="https://open.lovrabet.com/docs/category/lovrabet-node-sdk"
323
+ target="_blank"
818
324
  >
819
- <Title level={4} style={{ marginTop: 0 }}>
820
- <CheckCircleOutlined style={{ color: "#fa8c16" }} />{" "}
821
- 微前端扩展
822
- </Title>
823
- <Paragraph>
824
- 作为子应用独立开发,使用 <Text code>lovrabet menu sync</Text>{" "}
825
- 一键同步到主系统。 保持代码独立,享受微前端架构的所有优势。
826
- </Paragraph>
827
- <Text code>独立开发 → menu sync → 无缝集成</Text>
828
- </Card>
829
- </Col>
830
- <Col xs={24} md={12}>
831
- <Card
325
+ TypeScript SDK
326
+ </Button>
327
+ <Button
832
328
  size="small"
833
- style={{ background: "#f9f0ff", border: "1px solid #d3adf7" }}
329
+ href="https://open.lovrabet.com/docs/category/java-opensdk"
330
+ target="_blank"
834
331
  >
835
- <Title level={4} style={{ marginTop: 0 }}>
836
- <CheckCircleOutlined style={{ color: "#722ed1" }} />{" "}
837
- 企业级应用
838
- </Title>
839
- <Paragraph>
840
- SDK 提供三种认证模式,支持服务端和浏览器环境。
841
- 完整的类型定义、复杂查询、SQL API,满足企业级应用的所有需求。
842
- </Paragraph>
843
- <Text code>多环境支持 → 类型安全 → 生产就绪</Text>
844
- </Card>
845
- </Col>
846
- </Row>
847
- </Card>
848
-
849
- {/* 工具链优势对比 */}
850
- <Card>
851
- <Title level={2} style={{ marginBottom: 24 }}>
852
- <ThunderboltOutlined style={{ color: "#1890ff" }} /> 工具链优势
853
- </Title>
854
- <Alert
855
- message="完整的开发工具链,让开发效率提升 80%+"
856
- description={
857
- <div>
858
- <Row gutter={[16, 16]} style={{ marginTop: 16 }}>
859
- <Col xs={24} sm={12} md={6}>
860
- <div style={{ textAlign: "center" }}>
861
- <Title level={2} style={{ color: "#52c41a", margin: 0 }}>
862
- 96%
863
- </Title>
864
- <Text type="secondary">项目初始化效率提升</Text>
865
- </div>
866
- </Col>
867
- <Col xs={24} sm={12} md={6}>
868
- <div style={{ textAlign: "center" }}>
869
- <Title level={2} style={{ color: "#1890ff", margin: 0 }}>
870
- 95%
871
- </Title>
872
- <Text type="secondary">API 集成效率提升</Text>
873
- </div>
874
- </Col>
875
- <Col xs={24} sm={12} md={6}>
876
- <div style={{ textAlign: "center" }}>
877
- <Title level={2} style={{ color: "#fa8c16", margin: 0 }}>
878
- 75%
879
- </Title>
880
- <Text type="secondary">CRUD 开发效率提升</Text>
881
- </div>
882
- </Col>
883
- <Col xs={24} sm={12} md={6}>
884
- <div style={{ textAlign: "center" }}>
885
- <Title level={2} style={{ color: "#eb2f96", margin: 0 }}>
886
- 98%
887
- </Title>
888
- <Text type="secondary">菜单配置效率提升</Text>
889
- </div>
890
- </Col>
891
- </Row>
892
- </div>
893
- }
894
- type="success"
895
- showIcon
896
- style={{ marginBottom: 16 }}
897
- />
898
- <Row gutter={[16, 16]}>
899
- <Col xs={24} md={12}>
900
- <Card
332
+ Java SDK
333
+ </Button>
334
+ <Button
901
335
  size="small"
902
- style={{ background: "#fffbe6", border: "1px solid #ffe58f" }}
336
+ href="https://open.lovrabet.com/docs/mcp/intro"
337
+ target="_blank"
903
338
  >
904
- <Title level={5} style={{ marginTop: 0 }}>
905
- ❌ 没有工具链
906
- </Title>
907
- <ul style={{ color: "#666", paddingLeft: 20 }}>
908
- <li>从零搭建项目,配置路由、构建工具</li>
909
- <li>查文档,手写 HTTP 请求代码</li>
910
- <li>AI 不理解业务,生成的代码不可用</li>
911
- <li>手动配置菜单,容易遗漏</li>
912
- <li>需要自己搭建开发服务器</li>
913
- </ul>
914
- </Card>
915
- </Col>
916
- <Col xs={24} md={12}>
917
- <Card
339
+ MCP
340
+ </Button>
341
+ <Button
918
342
  size="small"
919
- style={{ background: "#f6ffed", border: "1px solid #b7eb8f" }}
343
+ href="https://open.lovrabet.com/docs/lovrabet-cli/"
344
+ target="_blank"
920
345
  >
921
- <Title level={5} style={{ marginTop: 0 }}>
922
- ✅ 有完整工具链
923
- </Title>
924
- <ul style={{ color: "#666", paddingLeft: 20 }}>
925
- <li>
926
- <Text code>lovrabet create</Text> 一键创建项目
927
- </li>
928
- <li>
929
- <Text code>lovrabet api pull</Text> 自动生成 API 配置
930
- </li>
931
- <li>MCP 让 AI 深度理解数据结构</li>
932
- <li>
933
- <Text code>lovrabet menu sync</Text> 一键同步菜单
934
- </li>
935
- <li>
936
- <Text code>lovrabet start</Text> 热更新开发服务器
937
- </li>
938
- </ul>
939
- </Card>
940
- </Col>
941
- </Row>
942
- </Card>
943
-
944
- {/* 快速链接和资源 */}
346
+ CLI 工具
347
+ </Button>
348
+ </Space>
349
+ </Col>
350
+ <Col xs={24} lg={8}>
351
+ <div
352
+ style={{
353
+ background: "#f5f5f5",
354
+ borderRadius: 8,
355
+ padding: 20,
356
+ }}
357
+ >
358
+ <Text style={{ fontSize: 14, display: "block", marginBottom: 12 }}>
359
+ <strong>核心价值:</strong>
360
+ </Text>
361
+ <ul style={{ color: "#595959", margin: 0, paddingLeft: 20, fontSize: 14 }}>
362
+ <li style={{ marginBottom: 8 }}>AI 自动理解业务模型</li>
363
+ <li style={{ marginBottom: 8 }}>现成的 API 和 SDK</li>
364
+ <li style={{ marginBottom: 8 }}>开发效率提升 2~5 倍</li>
365
+ <li>你只需要专注写业务逻辑</li>
366
+ </ul>
367
+ </div>
368
+ </Col>
369
+ </Row>
370
+ </Card>
945
371
 
946
- {/* 提示信息 */}
372
+ {/* 未配置提示 */}
373
+ {isNotSet && !loading && (
947
374
  <Alert
948
- message="💡 提示"
375
+ type="warning"
376
+ icon={<ExclamationCircleOutlined />}
377
+ message="项目尚未配置 AppCode"
949
378
  description={
950
- <div>
951
- <Text>
952
- 本项目是使用 Lovrabet CLI 创建的演示项目,展示了完整的 BaaS
953
- 开发体系。 所有代码示例都经过实际测试,可以直接参考使用。
954
- </Text>
955
- <div style={{ marginTop: 12 }}>
956
- <Space>
957
- <Button
958
- type="primary"
959
- size="small"
960
- href="https://open.lovrabet.com/docs/lovrabet-cli/quickstart"
961
- target="_blank"
962
- >
963
- 开始使用 CLI
964
- </Button>
379
+ <div style={{ marginTop: 8 }}>
380
+ <Paragraph style={{ marginBottom: 8 }}>
381
+ 请先执行以下命令初始化项目(替换{" "}
382
+ <code>&lt;your-app-code&gt;</code> 为你的应用代码):
383
+ </Paragraph>
384
+ <CopyableCode
385
+ code={`# 1. 设置 AppCode
386
+ lovrabet config set app <your-app-code>
387
+
388
+ # 2. 拉取 API 配置
389
+ lovrabet api pull`}
390
+ label="初始化命令"
391
+ />
392
+ <Paragraph style={{ marginBottom: 0 }}>
393
+ 执行完成后刷新页面即可。
394
+ </Paragraph>
395
+ </div>
396
+ }
397
+ style={{ marginBottom: 24 }}
398
+ />
399
+ )}
400
+
401
+ {/* 配置代码 */}
402
+ <Card style={{ marginBottom: 24 }}>
403
+ <Tabs items={configTabs} />
404
+ </Card>
405
+
406
+ {/* 文档链接 */}
407
+ <Row gutter={16}>
408
+ {docLinks.map((section) => (
409
+ <Col xs={24} md={12} key={section.title}>
410
+ <Card style={{ height: "100%" }}>
411
+ <div
412
+ style={{
413
+ display: "flex",
414
+ alignItems: "center",
415
+ gap: 8,
416
+ marginBottom: 16,
417
+ }}
418
+ >
419
+ {section.icon}
420
+ <Title level={4} style={{ margin: 0 }}>
421
+ {section.title}
422
+ </Title>
423
+ </div>
424
+ {section.links.map((link) => (
425
+ <div key={link.label}>
965
426
  <Button
966
- size="small"
967
- href="https://open.lovrabet.com"
427
+ type="link"
428
+ href={link.url}
968
429
  target="_blank"
430
+ style={{ padding: "8px 0" }}
969
431
  >
970
- 查看完整文档
432
+ {link.label} <ArrowRightOutlined />
971
433
  </Button>
972
- </Space>
973
- </div>
974
- </div>
975
- }
976
- type="info"
977
- showIcon
978
- />
979
- </Space>
434
+ </div>
435
+ ))}
436
+ </Card>
437
+ </Col>
438
+ ))}
439
+ </Row>
980
440
  </div>
981
441
  );
982
442
  }