@appthen/cli 1.2.11 → 1.2.12

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 (59) hide show
  1. package/bin/main.js +47 -0
  2. package/dist/index.js +6165 -14980
  3. package/package.json +8 -1
  4. package/tests/test-app/.appthen/shadow-space-100001-test-app-e99876b1.json +1197 -741
  5. package/tests/test-app/.appthen/space-config.json +2 -2
  6. package/tests/test-app/src/components/MessageCenter.tsx +506 -0
  7. package/tests/test-app/src/pages/CustomerManagement.tsx +535 -0
  8. package/tests/test-app/src/pages/CyberpunkDashboard.tsx +348 -0
  9. package/tests/test-app/src/pages/CyberpunkProductManagement.tsx +637 -0
  10. package/tests/test-app/src/pages/CyberpunkUserList.tsx +316 -0
  11. package/tests/test-app/src/pages/DashboardV2.tsx +334 -0
  12. package/tests/test-app/src/pages/DataReport.tsx +298 -0
  13. package/tests/test-app/src/pages/DataStatistics.tsx +317 -0
  14. package/tests/test-app/src/pages/DepartmentManagement.tsx +503 -0
  15. package/tests/test-app/src/pages/FileExplorer.tsx +441 -0
  16. package/tests/test-app/src/pages/OrderDetail.tsx +393 -0
  17. package/tests/test-app/src/pages/ProductManagement.tsx +521 -0
  18. package/tests/test-app/src/pages/ProjectTimeline.tsx +395 -0
  19. package/tests/test-app/src/pages/RoleManagement.tsx +523 -0
  20. package/tests/test-app/src/pages/StaticCyberpunkDashboard.tsx +462 -0
  21. package/tests/test-app/src/pages/StaticCyberpunkUserList.tsx +567 -0
  22. package/tests/test-app/src/pages/StudentWeaknessList.tsx +547 -0
  23. package/tests/test-app/src/pages/SystemSettings.tsx +422 -0
  24. package/tests/test-app/src/pages/TaskManagement.tsx +467 -0
  25. package/tests/test-app/src/pages/TicketManagement.tsx +402 -0
  26. package/tests/test-app/src/pages/UserProfile.tsx +404 -0
  27. package/tests/test-app/src/pages/WorkflowDesigner.tsx +434 -0
  28. package/tests/test-app/src/pages/admin/dashboard.tsx +591 -0
  29. package/tests/test-app/src/pages/article-list.tsx +222 -0
  30. package/tests/test-app/src/pages/babyProductRecommendationPage.tsx +168 -0
  31. package/tests/test-app/src/pages/category-list.tsx +179 -0
  32. package/tests/test-app/src/pages/comment-list.tsx +194 -0
  33. package/tests/test-app/src/pages/cyberpunk/cyberpunkCRMPage.tsx +1299 -0
  34. package/tests/test-app/src/pages/data-analytics.tsx +1872 -0
  35. package/tests/test-app/src/pages/data-overview.tsx +600 -0
  36. package/tests/test-app/src/pages/demo-error-page.tsx +119 -0
  37. package/tests/test-app/src/pages/department-list.tsx +183 -0
  38. package/tests/test-app/src/pages/goods-list.tsx +233 -0
  39. package/tests/test-app/src/pages/housekeeping/adminDashboardPage.tsx +880 -0
  40. package/tests/test-app/src/pages/mobile_terminal/uiHandsOnPractice.tsx +1 -1
  41. package/tests/test-app/src/pages/notice-list.tsx +217 -0
  42. package/tests/test-app/src/pages/order-detail.tsx +330 -0
  43. package/tests/test-app/src/pages/order-list.tsx +195 -0
  44. package/tests/test-app/src/pages/order-management.tsx +563 -0
  45. package/tests/test-app/src/pages/page/OrderList.tsx +230 -0
  46. package/tests/test-app/src/pages/role-list.tsx +184 -0
  47. package/tests/test-app/src/pages/simple/simplePage.tsx +92 -0
  48. package/tests/test-app/src/pages/simple-page.tsx +43 -0
  49. package/tests/test-app/src/pages/test-destructure.tsx +44 -0
  50. package/tests/test-app/src/pages/test-error-page.tsx +75 -0
  51. package/tests/test-app/src/pages/test-page-with-errors.tsx +51 -0
  52. package/tests/test-app/src/pages/test-page.tsx +101 -0
  53. package/tests/test-app/src/pages/test-render.tsx +52 -0
  54. package/tests/test-app/src/pages/test-return-type.tsx +41 -0
  55. package/tests/test-app/src/pages/test-type-assertion.tsx +37 -0
  56. package/tests/test-app/src/pages/ui/styleSelectorPage.tsx +1554 -0
  57. package/tests/test-app/src/pages/user-list.tsx +212 -0
  58. package/tests/test-app/src/pages/wrong-page.tsx +50 -0
  59. package/tests/test-app/.appthen/shadow-space-unknown-user-test-app-e99876b1.json +0 -1060
@@ -0,0 +1,521 @@
1
+ /**
2
+ * 产品管理
3
+ * 管理所有产品信息
4
+ *
5
+ * @type Page
6
+ * @route /products
7
+ * @screen 1920w
8
+ * @frames web
9
+ */
10
+ import React from 'react';
11
+
12
+
13
+
14
+ class IProps {
15
+ categoryId?: number;
16
+ }
17
+
18
+ /*
19
+ * 数据与接口请求定义
20
+ */
21
+ class IState {
22
+ products?: {
23
+ /* @example 1 */id?: number,
24
+ /* @example iPhone 15 Pro */name?: string,
25
+ /* @example 7999 */price?: number,
26
+ /* @example 手机 */category?: string,
27
+ /* @example 50 */stock?: number,
28
+ /* @example available */status?: string,
29
+ /* @example https://via.placeholder.com/100 */image?: string,
30
+ /* @example 2024-01-15 */createTime?: string,
31
+ }[];
32
+ categories?: string[];
33
+ loading?: boolean;
34
+ searchKeyword?: string;
35
+ selectedProduct?: any;
36
+ showAddModal?: boolean;
37
+ showEditModal?: boolean;
38
+ formData?: {
39
+ name?: string,
40
+ price?: number,
41
+ category?: string,
42
+ stock?: number,
43
+ status?: string,
44
+ };
45
+ }
46
+
47
+ class Document extends React.Component<IProps, IState> {
48
+ state = {
49
+ products: [
50
+ {
51
+ id: 1,
52
+ name: 'iPhone 15 Pro',
53
+ price: 7999,
54
+ category: '手机',
55
+ stock: 50,
56
+ status: 'available',
57
+ image: 'https://via.placeholder.com/100',
58
+ createTime: '2024-01-15',
59
+ },
60
+ {
61
+ id: 2,
62
+ name: 'MacBook Pro',
63
+ price: 12999,
64
+ category: '电脑',
65
+ stock: 30,
66
+ status: 'available',
67
+ image: 'https://via.placeholder.com/100',
68
+ createTime: '2024-02-20',
69
+ },
70
+ {
71
+ id: 3,
72
+ name: 'AirPods Pro',
73
+ price: 1999,
74
+ category: '耳机',
75
+ stock: 100,
76
+ status: 'available',
77
+ image: 'https://via.placeholder.com/100',
78
+ createTime: '2024-03-10',
79
+ },
80
+ {
81
+ id: 4,
82
+ name: 'iPad Air',
83
+ price: 4999,
84
+ category: '平板',
85
+ stock: 0,
86
+ status: 'out_of_stock',
87
+ image: 'https://via.placeholder.com/100',
88
+ createTime: '2024-04-05',
89
+ },
90
+ {
91
+ id: 5,
92
+ name: 'Apple Watch',
93
+ price: 2999,
94
+ category: '手表',
95
+ stock: 25,
96
+ status: 'available',
97
+ image: 'https://via.placeholder.com/100',
98
+ createTime: '2024-05-12',
99
+ },
100
+ ],
101
+ categories: ['手机', '电脑', '耳机', '平板', '手表', '配件'],
102
+ loading: false,
103
+ searchKeyword: '',
104
+ selectedProduct: null,
105
+ showAddModal: false,
106
+ showEditModal: false,
107
+ formData: {
108
+ name: '',
109
+ price: 0,
110
+ category: '',
111
+ stock: 0,
112
+ status: 'available',
113
+ },
114
+ };
115
+
116
+ handleSearch(keyword) {
117
+ this.setState({
118
+ searchKeyword: keyword,
119
+ });
120
+ }
121
+
122
+ getProductById(id) {
123
+ return this.state.products.find(product => product.id === id);
124
+ }
125
+
126
+ formatPrice(price) {
127
+ return `¥${price.toFixed(2)}`;
128
+ }
129
+
130
+ getStatusTag(status) {
131
+ if (status === 'available') {
132
+ return <Tag color="green">有货</Tag>;
133
+ } else if (status === 'out_of_stock') {
134
+ return <Tag color="red">缺货</Tag>;
135
+ }
136
+ return <Tag color="orange">预定</Tag>;
137
+ }
138
+
139
+ handleAddProduct() {
140
+ this.setState({
141
+ showAddModal: true,
142
+ formData: {
143
+ name: '',
144
+ price: 0,
145
+ category: '',
146
+ stock: 0,
147
+ status: 'available',
148
+ },
149
+ });
150
+ }
151
+
152
+ async handleSubmit(type) {
153
+ await new Promise(resolve => setTimeout(resolve, 500));
154
+ if (type === 'add') {
155
+ console.log('添加产品:', this.state.formData);
156
+ } else {
157
+ console.log('编辑产品:', this.state.formData);
158
+ }
159
+ this.setState({
160
+ showAddModal: false,
161
+ showEditModal: false,
162
+ });
163
+ }
164
+
165
+ handleEditProduct(product) {
166
+ this.setState({
167
+ selectedProduct: product,
168
+ formData: {
169
+ ...product,
170
+ },
171
+ showEditModal: true,
172
+ });
173
+ }
174
+
175
+ handleDeleteProduct(id) {
176
+ const confirm = window.confirm('确定要删除这个产品吗?');
177
+ if (confirm) {
178
+ console.log('删除产品:', id);
179
+ }
180
+ }
181
+
182
+ render() {
183
+ return (
184
+ <Page className="p-[24px] bg-[var(--gray-50)] min-h-screen">
185
+ <View className="mb-[24px]">
186
+ <Text className="text-2xl font-bold text-[#1f2937]">产品管理</Text>
187
+ <Text className="text-[#6b7280] text-sm mt-[4px]">
188
+ 管理所有产品信息
189
+ </Text>
190
+ </View>
191
+ {!!this.state.loading && <View className="p-[24px]">加载中...</View>}
192
+ <View className="mb-[24px] flex items-center justify-between">
193
+ <View className="gap-4 flex items-center">
194
+ <Input
195
+ placeholder="搜索产品名称/分类"
196
+ value={this.state.searchKeyword}
197
+ onChange={e => this.handleSearch(e.target.value)}
198
+ prefix="🔍"
199
+ className=""
200
+ />
201
+ </View>
202
+ <Button type="primary" onClick={() => this.handleAddProduct()}>
203
+ + 新增产品
204
+ </Button>
205
+ </View>
206
+ <Table
207
+ loading={this.state.loading}
208
+ columns={[
209
+ {
210
+ title: '图片',
211
+ dataIndex: 'image',
212
+ key: 'image',
213
+ render: image => <Image src={image} width={60} height={60} />,
214
+ },
215
+ { title: '产品名称', dataIndex: 'name', key: 'name' },
216
+ {
217
+ title: '价格',
218
+ dataIndex: 'price',
219
+ key: 'price',
220
+ render: price => <Text>{this.formatPrice(price)}</Text>,
221
+ },
222
+ {
223
+ title: '分类',
224
+ dataIndex: 'category',
225
+ key: 'category',
226
+ render: category => (
227
+ <Tag color="blue">
228
+ <Text>{category}</Text>
229
+ </Tag>
230
+ ),
231
+ },
232
+ { title: '库存', dataIndex: 'stock', key: 'stock' },
233
+ {
234
+ title: '状态',
235
+ dataIndex: 'status',
236
+ key: 'status',
237
+ render: function (status) {
238
+ return this.getStatusTag(status);
239
+ },
240
+ },
241
+ { title: '创建时间', dataIndex: 'createTime', key: 'createTime' },
242
+ {
243
+ title: '操作',
244
+ key: 'action',
245
+ render: (text, record) => (
246
+ <Space>
247
+ <Button
248
+ type="link"
249
+ onClick={() => this.handleEditProduct(record)}
250
+ >
251
+ 编辑
252
+ </Button>
253
+ <Button
254
+ type="link"
255
+ danger={true}
256
+ onClick={() => this.handleDeleteProduct(record.id)}
257
+ >
258
+ 删除
259
+ </Button>
260
+ </Space>
261
+ ),
262
+ },
263
+ ]}
264
+ dataSource={this.state.products?.filter(function (product) {
265
+ return (
266
+ product?.name?.includes(this.state.searchKeyword) ||
267
+ product?.category?.includes(this.state.searchKeyword)
268
+ );
269
+ })}
270
+ rowKey="id"
271
+ pagination={{
272
+ pageSize: 10,
273
+ showTotal: function (total) {
274
+ return `共 ${total} 条`;
275
+ },
276
+ }}
277
+ />
278
+ <Modal
279
+ animate="pop"
280
+ visible={this.state.showAddModal}
281
+ renderView={() => (
282
+ <View className="bg-[#ffffff] w-[600px] h-[500px] p-[24px]">
283
+ <Text className="text-xl font-bold mb-[16px]">新增产品</Text>
284
+ <View className="space-y-4">
285
+ <View>
286
+ <Text className="block mb-[8px]">产品名称</Text>
287
+ <Input
288
+ value={this.state.formData.name}
289
+ onChange={e =>
290
+ this.setState({
291
+ formData: {
292
+ ...this.state.formData,
293
+ name: e.target.value,
294
+ },
295
+ })
296
+ }
297
+ placeholder="请输入产品名称"
298
+ />
299
+ </View>
300
+ <View>
301
+ <Text className="block mb-[8px]">价格</Text>
302
+ <Input
303
+ type="number"
304
+ value={this.state.formData.price}
305
+ onChange={e =>
306
+ this.setState({
307
+ formData: {
308
+ ...this.state.formData,
309
+ price: Number(e.target.value),
310
+ },
311
+ })
312
+ }
313
+ placeholder="请输入价格"
314
+ />
315
+ </View>
316
+ <View>
317
+ <Text className="block mb-[8px]">分类</Text>
318
+ <Select
319
+ value={this.state.formData.category}
320
+ onChange={value =>
321
+ this.setState({
322
+ formData: {
323
+ ...this.state.formData,
324
+ category: value,
325
+ },
326
+ })
327
+ }
328
+ placeholder="请选择分类"
329
+ className="w-full"
330
+ >
331
+ {this.state.categories.map((category, index) => (
332
+ <Select.Option key={category} value={category}>
333
+ <Text>{category}</Text>
334
+ </Select.Option>
335
+ ))}
336
+ </Select>
337
+ </View>
338
+ <View>
339
+ <Text className="block mb-[8px]">库存</Text>
340
+ <Input
341
+ type="number"
342
+ value={this.state.formData.stock}
343
+ onChange={e =>
344
+ this.setState({
345
+ formData: {
346
+ ...this.state.formData,
347
+ stock: Number(e.target.value),
348
+ },
349
+ })
350
+ }
351
+ placeholder="请输入库存"
352
+ />
353
+ </View>
354
+ <View>
355
+ <Text className="block mb-[8px]">状态</Text>
356
+ <Select
357
+ value={this.state.formData.status}
358
+ onChange={value =>
359
+ this.setState({
360
+ formData: {
361
+ ...this.state.formData,
362
+ status: value,
363
+ },
364
+ })
365
+ }
366
+ placeholder="请选择状态"
367
+ className="w-full"
368
+ >
369
+ <Select.Option value="available">有货</Select.Option>
370
+ <Select.Option value="out_of_stock">缺货</Select.Option>
371
+ <Select.Option value="preorder">预定</Select.Option>
372
+ </Select>
373
+ </View>
374
+ <View className="gap-2 flex justify-end mt-[24px]">
375
+ <Button
376
+ onClick={() =>
377
+ this.setState({
378
+ showAddModal: false,
379
+ })
380
+ }
381
+ >
382
+ 取消
383
+ </Button>
384
+ <Button
385
+ type="primary"
386
+ onClick={() => this.handleSubmit('add')}
387
+ >
388
+ 确认
389
+ </Button>
390
+ </View>
391
+ </View>
392
+ </View>
393
+ )}
394
+ maskClosable={true}
395
+ />
396
+ <Modal
397
+ animate="pop"
398
+ visible={this.state.showEditModal}
399
+ renderView={() => (
400
+ <View className="bg-[#ffffff] w-[600px] h-[500px] p-[24px]">
401
+ <Text className="text-xl font-bold mb-[16px]">
402
+ 编辑产品:{this.state.selectedProduct?.name}
403
+ </Text>
404
+ <View className="space-y-4">
405
+ <View>
406
+ <Text className="block mb-[8px]">产品名称</Text>
407
+ <Input
408
+ value={this.state.formData.name}
409
+ onChange={e =>
410
+ this.setState({
411
+ formData: {
412
+ ...this.state.formData,
413
+ name: e.target.value,
414
+ },
415
+ })
416
+ }
417
+ placeholder="请输入产品名称"
418
+ />
419
+ </View>
420
+ <View>
421
+ <Text className="block mb-[8px]">价格</Text>
422
+ <Input
423
+ type="number"
424
+ value={this.state.formData.price}
425
+ onChange={e =>
426
+ this.setState({
427
+ formData: {
428
+ ...this.state.formData,
429
+ price: Number(e.target.value),
430
+ },
431
+ })
432
+ }
433
+ placeholder="请输入价格"
434
+ />
435
+ </View>
436
+ <View>
437
+ <Text className="block mb-[8px]">分类</Text>
438
+ <Select
439
+ value={this.state.formData.category}
440
+ onChange={value =>
441
+ this.setState({
442
+ formData: {
443
+ ...this.state.formData,
444
+ category: value,
445
+ },
446
+ })
447
+ }
448
+ placeholder="请选择分类"
449
+ className="w-full"
450
+ >
451
+ {this.state.categories.map((category, index) => (
452
+ <Select.Option key={category} value={category}>
453
+ <Text>{category}</Text>
454
+ </Select.Option>
455
+ ))}
456
+ </Select>
457
+ </View>
458
+ <View>
459
+ <Text className="block mb-[8px]">库存</Text>
460
+ <Input
461
+ type="number"
462
+ value={this.state.formData.stock}
463
+ onChange={e =>
464
+ this.setState({
465
+ formData: {
466
+ ...this.state.formData,
467
+ stock: Number(e.target.value),
468
+ },
469
+ })
470
+ }
471
+ placeholder="请输入库存"
472
+ />
473
+ </View>
474
+ <View>
475
+ <Text className="block mb-[8px]">状态</Text>
476
+ <Select
477
+ value={this.state.formData.status}
478
+ onChange={value =>
479
+ this.setState({
480
+ formData: {
481
+ ...this.state.formData,
482
+ status: value,
483
+ },
484
+ })
485
+ }
486
+ placeholder="请选择状态"
487
+ className="w-full"
488
+ >
489
+ <Select.Option value="available">有货</Select.Option>
490
+ <Select.Option value="out_of_stock">缺货</Select.Option>
491
+ <Select.Option value="preorder">预定</Select.Option>
492
+ </Select>
493
+ </View>
494
+ <View className="gap-2 flex justify-end mt-[24px]">
495
+ <Button
496
+ onClick={() =>
497
+ this.setState({
498
+ showEditModal: false,
499
+ })
500
+ }
501
+ >
502
+ 取消
503
+ </Button>
504
+ <Button
505
+ type="primary"
506
+ onClick={() => this.handleSubmit('edit')}
507
+ >
508
+ 确认
509
+ </Button>
510
+ </View>
511
+ </View>
512
+ </View>
513
+ )}
514
+ maskClosable={true}
515
+ />
516
+ </Page>
517
+ );
518
+ }
519
+ }
520
+
521
+ export default Document;