@appthen/cli 1.2.11 → 1.2.13

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 +6185 -15001
  3. package/package.json +8 -4
  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
@@ -1,5 +1,5 @@
1
1
  /**
2
- * UI上手练习(整页)
2
+ * UI上手练习
3
3
  * @type Page
4
4
  * @screen 1200w
5
5
  * @frames app
@@ -0,0 +1,217 @@
1
+ /**
2
+ * 通知列表
3
+ * 查看和管理所有系统通知
4
+ *
5
+ * @type Page
6
+ * @route /notices
7
+ * @screen 1920w
8
+ * @frames web
9
+ */
10
+ import React from 'react';
11
+
12
+
13
+
14
+ class IProps {}
15
+
16
+ /*
17
+ * 数据与接口请求定义
18
+ */
19
+ class IState {
20
+ notices?: {
21
+ /* @example 1 */id?: number,
22
+ /* @example 系统维护通知 */title?: string,
23
+ /* @example 系统将于12月20日凌晨进行维护 */content?: string,
24
+ /* @example system */type?: string,
25
+ /* @example published */status?: string,
26
+ /* @example 2024-01-15 */createTime?: string,
27
+ }[];
28
+ loading?: boolean;
29
+ searchKeyword?: string;
30
+ }
31
+
32
+ class Document extends React.Component<IProps, IState> {
33
+ state = {
34
+ notices: [
35
+ {
36
+ id: 1,
37
+ title: '系统维护通知',
38
+ content: '系统将于12月20日凌晨进行维护',
39
+ type: 'system',
40
+ status: 'published',
41
+ createTime: '2024-01-15',
42
+ },
43
+ {
44
+ id: 2,
45
+ title: '新功能上线',
46
+ content: '订单管理功能已更新',
47
+ type: 'feature',
48
+ status: 'published',
49
+ createTime: '2024-02-20',
50
+ },
51
+ {
52
+ id: 3,
53
+ title: '优惠活动预告',
54
+ content: '双12活动即将开始',
55
+ type: 'activity',
56
+ status: 'draft',
57
+ createTime: '2024-03-10',
58
+ },
59
+ {
60
+ id: 4,
61
+ title: '安全提醒',
62
+ content: '请及时修改密码',
63
+ type: 'security',
64
+ status: 'published',
65
+ createTime: '2024-04-05',
66
+ },
67
+ {
68
+ id: 5,
69
+ title: '版本更新说明',
70
+ content: 'v2.0版本已发布',
71
+ type: 'system',
72
+ status: 'published',
73
+ createTime: '2024-05-12',
74
+ },
75
+ ],
76
+ loading: false,
77
+ searchKeyword: '',
78
+ };
79
+
80
+ handleSearch(value) {
81
+ this.setState({
82
+ searchKeyword: value,
83
+ });
84
+ }
85
+
86
+ handleAdd() {
87
+ console.log('添加通知');
88
+ }
89
+
90
+ handleEdit(record) {
91
+ console.log('编辑通知', record);
92
+ }
93
+
94
+ handleDelete(record) {
95
+ console.log('删除通知', record);
96
+ }
97
+
98
+ getStatusTag(status) {
99
+ if (status === 'published') {
100
+ return <Tag color="green">已发布</Tag>;
101
+ }
102
+ return <Tag color="orange">草稿</Tag>;
103
+ }
104
+
105
+ getTypeTag(type) {
106
+ const config = {
107
+ system: {
108
+ text: '系统',
109
+ color: 'blue',
110
+ },
111
+ feature: {
112
+ text: '功能',
113
+ color: 'purple',
114
+ },
115
+ activity: {
116
+ text: '活动',
117
+ color: 'orange',
118
+ },
119
+ security: {
120
+ text: '安全',
121
+ color: 'red',
122
+ },
123
+ };
124
+ const configItem = config[type] || {
125
+ text: type,
126
+ color: 'default',
127
+ };
128
+ return <Tag color={configItem.color}>{configItem.text}</Tag>;
129
+ }
130
+
131
+ render() {
132
+ return (
133
+ <Page className="p-[24px] bg-[var(--gray-50)] min-h-screen">
134
+ <View className="mb-[24px]">
135
+ <h1 className="text-2xl font-bold text-[#1f2937]">通知列表</h1>
136
+ <p className="text-[#6b7280] text-sm mt-[4px]">
137
+ 管理系统中的所有系统通知
138
+ </p>
139
+ </View>
140
+ <Card className="mb-[24px]">
141
+ <View className="flex items-center justify-between">
142
+ <Input
143
+ placeholder="搜索通知标题/内容"
144
+ value={this.state.searchKeyword}
145
+ onChange={e => this.handleSearch(e.target.value)}
146
+ prefix="🔍"
147
+ className=""
148
+ />
149
+ <Button type="primary" onClick={() => this.handleAdd()}>
150
+ + 新增通知
151
+ </Button>
152
+ </View>
153
+ </Card>
154
+ <Card>
155
+ <Table
156
+ loading={this.state.loading}
157
+ columns={[
158
+ { title: 'ID', dataIndex: 'id', key: 'id', width: 80 },
159
+ { title: '通知标题', dataIndex: 'title', key: 'title' },
160
+ {
161
+ title: '通知内容',
162
+ dataIndex: 'content',
163
+ key: 'content',
164
+ ellipsis: true,
165
+ },
166
+ {
167
+ title: '类型',
168
+ dataIndex: 'type',
169
+ key: 'type',
170
+ render: function (text) {
171
+ return this.getTypeTag(text);
172
+ },
173
+ },
174
+ {
175
+ title: '状态',
176
+ dataIndex: 'status',
177
+ key: 'status',
178
+ render: function (text) {
179
+ return this.getStatusTag(text);
180
+ },
181
+ },
182
+ { title: '创建时间', dataIndex: 'createTime', key: 'createTime' },
183
+ {
184
+ title: '操作',
185
+ key: 'action',
186
+ render: (text, record) => (
187
+ <Space>
188
+ <Button type="link" onClick={() => this.handleEdit(record)}>
189
+ 编辑
190
+ </Button>
191
+ <Button
192
+ type="link"
193
+ danger={true}
194
+ onClick={() => this.handleDelete(record)}
195
+ >
196
+ 删除
197
+ </Button>
198
+ </Space>
199
+ ),
200
+ },
201
+ ]}
202
+ dataSource={this.state.notices}
203
+ rowKey="id"
204
+ pagination={{
205
+ pageSize: 10,
206
+ showTotal: function (total) {
207
+ return `共 ${total} 条`;
208
+ },
209
+ }}
210
+ />
211
+ </Card>
212
+ </Page>
213
+ );
214
+ }
215
+ }
216
+
217
+ export default Document;
@@ -0,0 +1,330 @@
1
+ /**
2
+ * 订单详情页 - 展示订单的完整信息
3
+ * @type Page
4
+ * @route /order/detail
5
+ * @screen 1200x800 #f5f5f5
6
+ * @frames web, app
7
+ * @clients web, h5, weapp
8
+ */
9
+ import React from 'react';
10
+
11
+
12
+
13
+ class IProps {
14
+ orderId?: string;
15
+ }
16
+
17
+ /*
18
+ * 数据与接口请求定义
19
+ */
20
+ class IState {
21
+ loading?: boolean;
22
+ order?: any;
23
+ showStatusModal?: boolean;
24
+ }
25
+
26
+ class Document extends React.Component<IProps, IState> {
27
+ state = { loading: true, order: null, showStatusModal: false };
28
+
29
+ componentDidMount() {
30
+ this.loadOrderDetail();
31
+ }
32
+
33
+ async loadOrderDetail() {
34
+ try {
35
+ const orderId = this.props.orderId || '123456';
36
+ const mockData = {
37
+ id: 'ORD202412010001',
38
+ orderNo: 'ORD202412010001',
39
+ status: 'completed',
40
+ statusText: '已完成',
41
+ createTime: '2024-12-01 14:30:25',
42
+ payTime: '2024-12-01 14:35:10',
43
+ deliveryTime: '2024-12-02 10:20:00',
44
+ receiverName: '张三',
45
+ receiverPhone: '138****5678',
46
+ receiverAddress: '北京市朝阳区建国路88号SOHO现代城A座12层1201室',
47
+ totalAmount: 2999.0,
48
+ discountAmount: 200.0,
49
+ freightAmount: 10.0,
50
+ realAmount: 2809.0,
51
+ paymentMethod: '微信支付',
52
+ remark: '请在工作日配送',
53
+ items: [
54
+ {
55
+ id: 1,
56
+ productName: '无线蓝牙耳机 Pro',
57
+ productImage: 'https://via.placeholder.com/80x80',
58
+ skuName: '白色 / 降噪版',
59
+ price: 1299.0,
60
+ quantity: 2,
61
+ subtotal: 2598.0,
62
+ },
63
+ {
64
+ id: 2,
65
+ productName: '手机保护壳',
66
+ productImage: 'https://via.placeholder.com/80x80',
67
+ skuName: '透明 / 适用于iPhone 15',
68
+ price: 39.0,
69
+ quantity: 2,
70
+ subtotal: 78.0,
71
+ },
72
+ {
73
+ id: 3,
74
+ productName: '数据线 Type-C',
75
+ productImage: 'https://via.placeholder.com/80x80',
76
+ skuName: '1米 / 白色',
77
+ price: 29.0,
78
+ quantity: 1,
79
+ subtotal: 29.0,
80
+ },
81
+ ],
82
+ timeline: [
83
+ {
84
+ time: '2024-12-02 10:20:00',
85
+ title: '已签收',
86
+ description: '您的订单已签收,感谢您的购买',
87
+ },
88
+ {
89
+ time: '2024-12-01 18:30:00',
90
+ title: '派送中',
91
+ description: '快递员正在为您派送',
92
+ },
93
+ {
94
+ time: '2024-12-01 15:00:00',
95
+ title: '已发货',
96
+ description: '订单已出库,顺丰快递:SF1234567890',
97
+ },
98
+ {
99
+ time: '2024-12-01 14:35:10',
100
+ title: '已付款',
101
+ description: '您已成功支付订单',
102
+ },
103
+ {
104
+ time: '2024-12-01 14:30:25',
105
+ title: '订单创建',
106
+ description: '订单创建成功,等待付款',
107
+ },
108
+ ],
109
+ };
110
+ this.setState({
111
+ order: mockData,
112
+ loading: false,
113
+ });
114
+ } catch (error) {
115
+ this.setState({
116
+ loading: false,
117
+ });
118
+ this.utils.showToast('加载订单详情失败');
119
+ }
120
+ }
121
+
122
+ getStatusColor(status) {
123
+ const colorMap = {
124
+ pending: 'default',
125
+ paid: 'processing',
126
+ shipped: 'warning',
127
+ completed: 'success',
128
+ cancelled: 'error',
129
+ };
130
+ return colorMap[status] || 'default';
131
+ }
132
+
133
+ handleCancelOrder() {
134
+ this.utils.showComponentModal('CancelOrderModal', {
135
+ orderId: this.state.order?.id,
136
+ onSuccess: () => {
137
+ this.utils.showToast('订单已取消');
138
+ this.loadOrderDetail();
139
+ },
140
+ });
141
+ }
142
+
143
+ handlePay() {
144
+ this.utils.showToast('跳转到支付页面');
145
+ }
146
+
147
+ handleConfirmReceipt() {
148
+ this.utils.showComponentModal('ConfirmReceiptModal', {
149
+ orderId: this.state.order?.id,
150
+ onSuccess: () => {
151
+ this.utils.showToast('已确认收货');
152
+ this.loadOrderDetail();
153
+ },
154
+ });
155
+ }
156
+
157
+ handleContactService() {
158
+ this.utils.showComponentModal('CustomerServiceModal');
159
+ }
160
+
161
+ handleBuyAgain() {
162
+ this.utils.showToast('已加入购物车');
163
+ }
164
+
165
+ render() {
166
+ return (
167
+ <Page className="bg-[#f3f4f6] min-h-screen">
168
+ <View className="p-[16px] ml-[auto] mr-[auto]">
169
+ <Card className="mb-[16px] shadow-[0 1px 2px 0 rgb(0 0 0 / 0.05)]">
170
+ <View className="flex items-center justify-between">
171
+ <View className="flex items-center">
172
+ <Tag
173
+ color={this.getStatusColor(this.state.order?.status)}
174
+ className="text-base pl-[16px] pr-[16px] pt-[4px] pb-[4px]"
175
+ >
176
+ <Text>{this.state.order?.statusText}</Text>
177
+ </Tag>
178
+ <Text className="ml-[16px] text-[#4b5563]">
179
+ 订单编号:{this.state.order?.orderNo}
180
+ </Text>
181
+ </View>
182
+ <View className="gap-2 flex">
183
+ <Button type="link" onClick={() => this.handleContactService()}>
184
+ 联系客服
185
+ </Button>
186
+ </View>
187
+ </View>
188
+ </Card>
189
+ <Card
190
+ title="订单进度"
191
+ className="mb-[16px] shadow-[0 1px 2px 0 rgb(0 0 0 / 0.05)]"
192
+ >
193
+ <Steps
194
+ direction="vertical"
195
+ current={0}
196
+ items={(this.state.order?.timeline).map((item, index) => (
197
+ <View>
198
+ <Text>{item.description}</Text>
199
+ <Text className="block text-[#9ca3af] text-sm mt-[4px]">
200
+ {item.time}
201
+ </Text>
202
+ </View>
203
+ ))}
204
+ />
205
+ </Card>
206
+ <Card
207
+ title="买家信息"
208
+ className="mb-[16px] shadow-[0 1px 2px 0 rgb(0 0 0 / 0.05)]"
209
+ >
210
+ <Descriptions column={2}>
211
+ <Descriptions.Item label="收货人">
212
+ <Text>{this.state.order?.receiverName}</Text>
213
+ </Descriptions.Item>
214
+ <Descriptions.Item label="联系电话">
215
+ <Text>{this.state.order?.receiverPhone}</Text>
216
+ </Descriptions.Item>
217
+ <Descriptions.Item label="收货地址" span={2}>
218
+ <Text>{this.state.order?.receiverAddress}</Text>
219
+ </Descriptions.Item>
220
+ </Descriptions>
221
+ </Card>
222
+ <Card
223
+ title="订单货品信息"
224
+ className="mb-[16px] shadow-[0 1px 2px 0 rgb(0 0 0 / 0.05)]"
225
+ >
226
+ {(this.state.order?.items).map((item, index) => (
227
+ <View
228
+ key={item.id || index}
229
+ className="border-b border-gray-100 last:border-0 flex pt-[16px] pb-[16px]"
230
+ >
231
+ <Image
232
+ src={item.productImage}
233
+ className="w-[80px] h-[80px] [objectFit:cover] rounded"
234
+ />
235
+ <View className="flex-1 ml-[16px]">
236
+ <Text className="font-medium text-base">
237
+ {item.productName}
238
+ </Text>
239
+ <Text className="block text-[#6b7280] text-sm mt-[4px]">
240
+ {item.skuName}
241
+ </Text>
242
+ <View className="flex justify-between mt-[8px]">
243
+ <Text className="text-[#ef4444] font-medium">
244
+ ¥{item.price?.toFixed(2)}
245
+ </Text>
246
+ <Text className="text-[#4b5563]">x{item.quantity}</Text>
247
+ </View>
248
+ </View>
249
+ <View className="text-[var(--right)]">
250
+ <Text className="font-medium text-base">
251
+ ¥{item.subtotal?.toFixed(2)}
252
+ </Text>
253
+ </View>
254
+ </View>
255
+ ))}
256
+ <Divider className="mt-[16px] mb-[16px]" />
257
+ <View className="space-y-2">
258
+ <View className="flex justify-between">
259
+ <Text className="text-[#4b5563]">商品总额</Text>
260
+ <Text>¥{this.state.order?.totalAmount?.toFixed(2)}</Text>
261
+ </View>
262
+ <View className="flex justify-between">
263
+ <Text className="text-[#4b5563]">优惠金额</Text>
264
+ <Text className="text-[#ef4444]">
265
+ -¥{this.state.order?.discountAmount?.toFixed(2)}
266
+ </Text>
267
+ </View>
268
+ <View className="flex justify-between">
269
+ <Text className="text-[#4b5563]">运费</Text>
270
+ <Text>¥{this.state.order?.freightAmount?.toFixed(2)}</Text>
271
+ </View>
272
+ <View className="flex justify-between items-center pt-[8px]">
273
+ <Text className="text-base font-medium">实付金额</Text>
274
+ <Text className="text-[#ef4444] text-xl font-bold">
275
+ ¥{this.state.order?.realAmount?.toFixed(2)}
276
+ </Text>
277
+ </View>
278
+ </View>
279
+ </Card>
280
+ <Card
281
+ title="支付信息"
282
+ className="mb-[16px] shadow-[0 1px 2px 0 rgb(0 0 0 / 0.05)]"
283
+ >
284
+ <Descriptions column={2}>
285
+ <Descriptions.Item label="支付方式">
286
+ <Text>{this.state.order?.paymentMethod}</Text>
287
+ </Descriptions.Item>
288
+ <Descriptions.Item label="支付时间">
289
+ <Text>{this.state.order?.payTime}</Text>
290
+ </Descriptions.Item>
291
+ <Descriptions.Item label="下单时间" span={2}>
292
+ <Text>{this.state.order?.createTime}</Text>
293
+ </Descriptions.Item>
294
+ <Descriptions.Item label="订单备注" span={2}>
295
+
296
+ </Descriptions.Item>
297
+ </Descriptions>
298
+ </Card>
299
+ <Card className="shadow-[0 1px 2px 0 rgb(0 0 0 / 0.05)]">
300
+ <View className="gap-3 flex justify-end">
301
+ <Button onClick={() => this.handleBuyAgain()}>再次购买</Button>
302
+ {!!(this.state.order?.status === 'shipped') && (
303
+ <Button
304
+ type="primary"
305
+ onClick={() => this.handleConfirmReceipt()}
306
+ >
307
+ 确认收货
308
+ </Button>
309
+ )}
310
+ {!!(this.state.order?.status === 'completed') && (
311
+ <Button type="default">申请售后</Button>
312
+ )}
313
+ {!!(this.state.order?.status === 'pending') && (
314
+ <Button
315
+ type="primary"
316
+ danger={true}
317
+ onClick={() => this.handleCancelOrder()}
318
+ >
319
+ 取消订单
320
+ </Button>
321
+ )}
322
+ </View>
323
+ </Card>
324
+ </View>
325
+ </Page>
326
+ );
327
+ }
328
+ }
329
+
330
+ export default Document;