@appthen/cli 1.2.10 → 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.
- package/.gitignore +1 -0
- package/bin/main.js +92 -0
- package/dist/index.js +7014 -14988
- package/package.json +8 -1
- package/tests/test-app/.appthen/shadow-space-100001-test-app-e99876b1.json +1862 -0
- package/tests/test-app/.appthen/space-config.json +8 -0
- package/tests/test-app/docs/AI-Workflow.flow +112 -0
- package/tests/test-app/docs/Logic-1.flow +16 -0
- package/tests/test-app/docs/Logic.flow +16 -0
- package/tests/test-app/docs/Project-Blueprint-1.flow +119 -0
- package/tests/test-app/docs/Project-Blueprint.flow +119 -0
- package/tests/test-app/docs/README.md +3 -0
- package/tests/test-app/docs/claude.md +194 -0
- package/tests/test-app/docs/page_requirement_analysis.md +149 -0
- package/tests/test-app/docs//345/267/245/345/215/225/347/256/241/347/220/206/347/263/273/347/273/237/350/257/246/347/273/206/350/256/276/350/256/241.md +377 -0
- package/tests/test-app/src/apis/AddTodoPost.api.ts +42 -0
- package/tests/test-app/src/apis/DeleteTodoPost.api.ts +32 -0
- package/tests/test-app/src/apis/GetListPost.api.ts +38 -0
- package/tests/test-app/src/apis/TicketAttachmentUploadPost.api.ts +42 -0
- package/tests/test-app/src/apis/UpdateTodoPost.api.ts +46 -0
- package/tests/test-app/src/app.css +15 -0
- package/tests/test-app/src/cloud_functions/ticket|attachment|upload.node.ts +86 -0
- package/tests/test-app/src/cloud_functions/ticket|comment|add.node.ts +65 -0
- package/tests/test-app/src/cloud_functions/types|entity|Ticket.node.ts +88 -0
- package/tests/test-app/src/cloud_functions/types|entity|TicketAttachment.node.ts +70 -0
- package/tests/test-app/src/cloud_functions/types|entity|TicketCategory.node.ts +56 -0
- package/tests/test-app/src/cloud_functions/types|entity|TicketComment.node.ts +62 -0
- package/tests/test-app/src/cloud_functions/types|entity|TicketHistory.node.ts +74 -0
- package/tests/test-app/src/cloud_functions/types|entity|TicketPriority.node.ts +68 -0
- package/tests/test-app/src/cloud_functions/types|entity|TicketStatus.node.ts +63 -0
- package/tests/test-app/src/cloud_functions/types|models|CreateTicketParams.node.ts +20 -0
- package/tests/test-app/src/cloud_functions/types|models|TicketListParams.node.ts +30 -0
- package/tests/test-app/src/cloud_functions/types|models|UpdateTicketParams.node.ts +22 -0
- package/tests/test-app/src/components/Button.js +11 -0
- package/tests/test-app/src/components/MessageCenter.tsx +506 -0
- package/tests/test-app/src/components/MouduleDemoNzp.tsx +40 -0
- package/tests/test-app/src/components/Timeline.tsx +145 -0
- package/tests/test-app/src/index.ts +2 -0
- package/tests/test-app/src/modules/work_order_module/apis/TicketCommentAddPost.api.ts +48 -0
- package/tests/test-app/src/modules/work_order_module/apis/TicketCreatePost.api.ts +52 -0
- package/tests/test-app/src/modules/work_order_module/apis/TicketDeleteDelete.api.ts +39 -0
- package/tests/test-app/src/modules/work_order_module/apis/TicketDetailGet.api.ts +39 -0
- package/tests/test-app/src/modules/work_order_module/apis/TicketListGet.api.ts +61 -0
- package/tests/test-app/src/modules/work_order_module/apis/TicketUpdatePut.api.ts +57 -0
- package/tests/test-app/src/modules/work_order_module/apis/TrainDoorFaultListGet.ts +76 -0
- package/tests/test-app/src/modules/work_order_module/apis/TrainDoorListGet.ts +76 -0
- package/tests/test-app/src/modules/work_order_module/apis/TrainDoorOperationRecordsGet.ts +284 -0
- package/tests/test-app/src/modules/work_order_module/apis/TrainDoorStatisticsGet.ts +96 -0
- package/tests/test-app/src/modules/work_order_module/cloud_function/category|list.node.ts +40 -0
- package/tests/test-app/src/modules/work_order_module/cloud_function/priority|list.node.ts +26 -0
- package/tests/test-app/src/modules/work_order_module/cloud_function/status|list.node.ts +26 -0
- package/tests/test-app/src/modules/work_order_module/cloud_function/ticket|create.node.ts +54 -0
- package/tests/test-app/src/modules/work_order_module/cloud_function/ticket|delete.node.ts +55 -0
- package/tests/test-app/src/modules/work_order_module/cloud_function/ticket|detail.node.ts +65 -0
- package/tests/test-app/src/modules/work_order_module/cloud_function/ticket|list.node.ts +85 -0
- package/tests/test-app/src/modules/work_order_module/cloud_function/ticket|update.node.ts +73 -0
- package/tests/test-app/src/modules/work_order_module/data_model/Ticket.m.ts +85 -0
- package/tests/test-app/src/modules/work_order_module/data_model/TicketCategory.m.ts +53 -0
- package/tests/test-app/src/modules/work_order_module/data_model/TicketStatus.m.ts +60 -0
- package/tests/test-app/src/modules/work_order_module//345/267/245/345/215/225/347/263/273/347/273/237/344/272/247/345/223/201/350/256/276/350/256/241/346/226/207/346/241/243.md +301 -0
- package/tests/test-app/src/modules/work_order_module//345/267/245/345/215/225/347/263/273/347/273/237/345/274/200/345/217/221/344/273/273/345/212/241/345/210/206/345/267/245/346/226/207/346/241/243.md +345 -0
- package/tests/test-app/src/pages/CustomerManagement.tsx +535 -0
- package/tests/test-app/src/pages/CyberpunkDashboard.tsx +348 -0
- package/tests/test-app/src/pages/CyberpunkProductManagement.tsx +637 -0
- package/tests/test-app/src/pages/CyberpunkUserList.tsx +316 -0
- package/tests/test-app/src/pages/DashboardV2.tsx +334 -0
- package/tests/test-app/src/pages/DataReport.tsx +298 -0
- package/tests/test-app/src/pages/DataStatistics.tsx +317 -0
- package/tests/test-app/src/pages/DepartmentManagement.tsx +503 -0
- package/tests/test-app/src/pages/FileExplorer.tsx +441 -0
- package/tests/test-app/src/pages/OrderDetail.tsx +393 -0
- package/tests/test-app/src/pages/ProductManagement.tsx +521 -0
- package/tests/test-app/src/pages/ProjectTimeline.tsx +395 -0
- package/tests/test-app/src/pages/RoleManagement.tsx +523 -0
- package/tests/test-app/src/pages/SLAManagement.tsx +668 -0
- package/tests/test-app/src/pages/StaticCyberpunkDashboard.tsx +462 -0
- package/tests/test-app/src/pages/StaticCyberpunkUserList.tsx +567 -0
- package/tests/test-app/src/pages/StudentWeaknessList.tsx +547 -0
- package/tests/test-app/src/pages/SystemSettings.tsx +422 -0
- package/tests/test-app/src/pages/TaskManagement.tsx +467 -0
- package/tests/test-app/src/pages/TicketCreate.tsx +27 -0
- package/tests/test-app/src/pages/TicketDetail.tsx +27 -0
- package/tests/test-app/src/pages/TicketList.tsx +27 -0
- package/tests/test-app/src/pages/TicketManagement.tsx +402 -0
- package/tests/test-app/src/pages/TicketManagementPage.tsx +1238 -0
- package/tests/test-app/src/pages/UserProfile.tsx +404 -0
- package/tests/test-app/src/pages/VisualAIIDEUpgrade.tsx +245 -0
- package/tests/test-app/src/pages/WorkflowDesigner.tsx +434 -0
- package/tests/test-app/src/pages/admin/dashboard.tsx +591 -0
- package/tests/test-app/src/pages/appthen_guide/ComponentTreeUnderstanding.tsx +26 -0
- package/tests/test-app/src/pages/appthen_guide/DataBindingLearning.tsx +26 -0
- package/tests/test-app/src/pages/article-list.tsx +222 -0
- package/tests/test-app/src/pages/babyProductRecommendationPage.tsx +168 -0
- package/tests/test-app/src/pages/back-end/adminRootLayout.tsx +155 -0
- package/tests/test-app/src/pages/back-end/adminRootLayout10.tsx +157 -0
- package/tests/test-app/src/pages/back-end/adminRootLayout2.tsx +156 -0
- package/tests/test-app/src/pages/back-end/adminRootLayout3.tsx +156 -0
- package/tests/test-app/src/pages/back-end/adminRootLayout4.tsx +157 -0
- package/tests/test-app/src/pages/back-end/adminRootLayout5.tsx +157 -0
- package/tests/test-app/src/pages/back-end/adminRootLayout6.tsx +157 -0
- package/tests/test-app/src/pages/back-end/adminRootLayout7.tsx +157 -0
- package/tests/test-app/src/pages/back-end/adminRootLayout8.tsx +157 -0
- package/tests/test-app/src/pages/back-end/adminRootLayout9.tsx +157 -0
- package/tests/test-app/src/pages/back-end/backgroundManagementSystem.css +5 -0
- package/tests/test-app/src/pages/back-end/backgroundManagementSystem.tsx +1745 -0
- package/tests/test-app/src/pages/category-list.tsx +179 -0
- package/tests/test-app/src/pages/comment-list.tsx +194 -0
- package/tests/test-app/src/pages/component/WorkOrderCard.tsx +140 -0
- package/tests/test-app/src/pages/cover.tsx +42 -0
- package/tests/test-app/src/pages/cyberpunk/cyberpunkCRMPage.tsx +1299 -0
- package/tests/test-app/src/pages/data-analytics.tsx +1872 -0
- package/tests/test-app/src/pages/data-overview.tsx +600 -0
- package/tests/test-app/src/pages/data_dashboard/blueBrightGreenTechnologyWind.css +181 -0
- package/tests/test-app/src/pages/data_dashboard/blueBrightGreenTechnologyWind.tsx +225 -0
- package/tests/test-app/src/pages/data_dashboard/blueLargeScreen.css +181 -0
- package/tests/test-app/src/pages/data_dashboard/blueLargeScreen.tsx +138 -0
- package/tests/test-app/src/pages/data_dashboard/component_library/BlueBrightGreenBorder.tsx +47 -0
- package/tests/test-app/src/pages/data_dashboard/component_library/FullScreenContainer.tsx +133 -0
- package/tests/test-app/src/pages/demo-error-page.tsx +119 -0
- package/tests/test-app/src/pages/department-list.tsx +183 -0
- package/tests/test-app/src/pages/description_of_mock_interface.md +32 -0
- package/tests/test-app/src/pages/digitalLargeScreen.css +181 -0
- package/tests/test-app/src/pages/digitalLargeScreen.tsx +1417 -0
- package/tests/test-app/src/pages/goods-list.tsx +233 -0
- package/tests/test-app/src/pages/housekeeping/adminDashboardPage.tsx +880 -0
- package/tests/test-app/src/pages/mobile_terminal/PersonalCenter.css +3 -0
- package/tests/test-app/src/pages/mobile_terminal/PersonalCenter.tsx +362 -0
- package/tests/test-app/src/pages/mobile_terminal/WorkOrderHomepage.tsx +337 -0
- package/tests/test-app/src/pages/mobile_terminal/newWorkOrder.tsx +224 -0
- package/tests/test-app/src/pages/mobile_terminal/tabbar.tsx +67 -0
- package/tests/test-app/src/pages/mobile_terminal/uiHandsOnPractice.tsx +638 -0
- package/tests/test-app/src/pages/mobile_terminal/workOrderDetails.tsx +346 -0
- package/tests/test-app/src/pages/mobile_terminal/workOrderPage.tsx +345 -0
- package/tests/test-app/src/pages/notice-list.tsx +217 -0
- package/tests/test-app/src/pages/order-detail.tsx +330 -0
- package/tests/test-app/src/pages/order-list.tsx +195 -0
- package/tests/test-app/src/pages/order-management.tsx +563 -0
- package/tests/test-app/src/pages/page/OrderList.tsx +230 -0
- package/tests/test-app/src/pages/role-list.tsx +184 -0
- package/tests/test-app/src/pages/simple/simplePage.tsx +92 -0
- package/tests/test-app/src/pages/simple-page.tsx +43 -0
- package/tests/test-app/src/pages/test-destructure.tsx +44 -0
- package/tests/test-app/src/pages/test-error-page.tsx +75 -0
- package/tests/test-app/src/pages/test-page-with-errors.tsx +51 -0
- package/tests/test-app/src/pages/test-page.tsx +101 -0
- package/tests/test-app/src/pages/test-render.tsx +52 -0
- package/tests/test-app/src/pages/test-return-type.tsx +41 -0
- package/tests/test-app/src/pages/test-type-assertion.tsx +37 -0
- package/tests/test-app/src/pages/testPage.css +3 -0
- package/tests/test-app/src/pages/testPage.tsx +158 -0
- package/tests/test-app/src/pages/ui/styleSelectorPage.tsx +1554 -0
- package/tests/test-app/src/pages/user-list.tsx +212 -0
- package/tests/test-app/src/pages/web_version/website.css +205 -0
- package/tests/test-app/src/pages/web_version/website.tsx +1066 -0
- package/tests/test-app/src/pages/wrong-page.tsx +50 -0
- package/tests/test-app/src/pages//345/276/205/345/212/236.apidoc.json +336 -0
- package/tests/test-app/src/project.json +1120 -0
- package/tests/test-app/src/store/global.store.ts +10 -0
- package/tests/test-app/src/types/CreateTicketParams.m.ts +20 -0
- package/tests/test-app/src/types/SLAPolicy.ts +50 -0
- package/tests/test-app/src/types/Ticket.ts +68 -0
- package/tests/test-app/src/types/TicketAttachment.m.ts +67 -0
- package/tests/test-app/src/types/TicketComment.m.ts +59 -0
- package/tests/test-app/src/types/TicketEvaluation.ts +44 -0
- package/tests/test-app/src/types/TicketHistory.m.ts +71 -0
- package/tests/test-app/src/types/TicketListParams.m.ts +30 -0
- package/tests/test-app/src/types/TicketPriority.m.ts +65 -0
- package/tests/test-app/src/types/TicketRecord.ts +47 -0
- package/tests/test-app/src/types/TrainDoor.ts +284 -0
- package/tests/test-app/src/types/UpdateTicketParams.m.ts +22 -0
- package/tests/test-app/src/utils/__afterRequest.util.ts +3 -0
- package/tests/test-app/src/utils/__beforeRequest.util.ts +10 -0
- package/tests/test-app/src/utils/testGlobalAction.util.ts +7 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 测试页面 - 包含错误的示例
|
|
3
|
+
* @type Page
|
|
4
|
+
* @screen 1920w
|
|
5
|
+
* @frames web
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class IProps {
|
|
12
|
+
title?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/*
|
|
16
|
+
* 数据与接口请求定义
|
|
17
|
+
*/
|
|
18
|
+
class IState {
|
|
19
|
+
users?: string[];
|
|
20
|
+
loading?: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
class Document extends React.Component<IProps, IState> {
|
|
24
|
+
state = { users: [], loading: false };
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* 已修复:移除方法参数类型注解
|
|
28
|
+
*/
|
|
29
|
+
handleClick(event) {
|
|
30
|
+
console.log('Clicked', event);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* 已修复:移除方法返回类型注解
|
|
35
|
+
*/
|
|
36
|
+
getUserCount() {
|
|
37
|
+
return this.state.users?.length || 0;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
render() {
|
|
41
|
+
return (
|
|
42
|
+
<Page className="p-[24px]">
|
|
43
|
+
<h1>{this.props.title}</h1>
|
|
44
|
+
<p>用户数量:{0}</p>
|
|
45
|
+
<button onClick={() => this.handleClick()}>点击我</button>
|
|
46
|
+
</Page>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export default Document;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 测试页面 - 演示TSX规范错误和修复
|
|
3
|
+
* @type Page
|
|
4
|
+
* @route /test
|
|
5
|
+
* @screen 1920w
|
|
6
|
+
* @frames web
|
|
7
|
+
*/
|
|
8
|
+
import React from 'react';
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class IProps {
|
|
13
|
+
title?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/*
|
|
17
|
+
* 数据与接口请求定义
|
|
18
|
+
*/
|
|
19
|
+
class IState {
|
|
20
|
+
users?: {
|
|
21
|
+
/* @example 1 */id?: number,
|
|
22
|
+
/* @example 张三 */name?: string,
|
|
23
|
+
/* @example zhangsan@example.com */email?: string,
|
|
24
|
+
}[];
|
|
25
|
+
loading?: boolean;
|
|
26
|
+
selectedUser?: any;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
class Document extends React.Component<IProps, IState> {
|
|
30
|
+
state = {
|
|
31
|
+
users: [
|
|
32
|
+
{ id: 1, name: '张三', email: 'zhangsan@example.com' },
|
|
33
|
+
{ id: 2, name: '李四', email: 'lisi@example.com' },
|
|
34
|
+
],
|
|
35
|
+
loading: false,
|
|
36
|
+
selectedUser: null,
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
handleSelectUser(user) {
|
|
40
|
+
this.setState({
|
|
41
|
+
selectedUser: user,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
isUserActive() {
|
|
46
|
+
return this.state.selectedUser?.active || false;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
handleLoadData(page, size) {
|
|
50
|
+
return new Promise(resolve => {
|
|
51
|
+
this.setState({
|
|
52
|
+
loading: true,
|
|
53
|
+
});
|
|
54
|
+
setTimeout(() => {
|
|
55
|
+
this.setState({
|
|
56
|
+
loading: false,
|
|
57
|
+
});
|
|
58
|
+
resolve();
|
|
59
|
+
}, 1000);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
render() {
|
|
64
|
+
return (
|
|
65
|
+
<Page className="p-[24px]">
|
|
66
|
+
<h1>{this.props.title}</h1>
|
|
67
|
+
{!!this.state.selectedUser && (
|
|
68
|
+
<p>已选择用户:{this.state.selectedUser?.name}</p>
|
|
69
|
+
)}
|
|
70
|
+
<Button type="primary" onClick={() => this.handleLoadData(1, 10)}>
|
|
71
|
+
加载数据
|
|
72
|
+
</Button>
|
|
73
|
+
<Table
|
|
74
|
+
columns={[
|
|
75
|
+
{ title: '姓名', dataIndex: 'name', key: 'name' },
|
|
76
|
+
{
|
|
77
|
+
title: '邮箱',
|
|
78
|
+
dataIndex: 'email',
|
|
79
|
+
render: text => <Text>{text}</Text>,
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
title: '操作',
|
|
83
|
+
render: record => (
|
|
84
|
+
<Button
|
|
85
|
+
size="small"
|
|
86
|
+
onClick={() => this.handleSelectUser(record)}
|
|
87
|
+
>
|
|
88
|
+
选择
|
|
89
|
+
</Button>
|
|
90
|
+
),
|
|
91
|
+
},
|
|
92
|
+
]}
|
|
93
|
+
dataSource={this.state.users}
|
|
94
|
+
loading={this.state.loading}
|
|
95
|
+
/>
|
|
96
|
+
</Page>
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export default Document;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 测试render方法
|
|
3
|
+
* @type Page
|
|
4
|
+
* @route /test-render
|
|
5
|
+
* @screen 1920w
|
|
6
|
+
* @frames web
|
|
7
|
+
*/
|
|
8
|
+
import React from 'react';
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class IProps {}
|
|
13
|
+
|
|
14
|
+
/*
|
|
15
|
+
* 数据与接口请求定义
|
|
16
|
+
*/
|
|
17
|
+
class IState {
|
|
18
|
+
count?: number;
|
|
19
|
+
loading?: boolean;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
class Document extends React.Component<IProps, IState> {
|
|
23
|
+
state = { count: 0, loading: false };
|
|
24
|
+
|
|
25
|
+
handleClick() {
|
|
26
|
+
this.setState({
|
|
27
|
+
count: this.state.count + 1,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
render() {
|
|
32
|
+
// ❌ 违反规范:render() 中有变量声明
|
|
33
|
+
const count = this.state.count;
|
|
34
|
+
|
|
35
|
+
// ❌ 违反规范:render() 中有逻辑语句
|
|
36
|
+
// ❌ 违反规范:render() 中有逻辑语句
|
|
37
|
+
// ❌ 违反规范:render() 中有逻辑语句
|
|
38
|
+
// ❌ 违反规范:render() 中有逻辑语句
|
|
39
|
+
if (this.state.loading) {
|
|
40
|
+
return <div>加载中...</div>;
|
|
41
|
+
}
|
|
42
|
+
return (
|
|
43
|
+
<Page className="p-[24px]">
|
|
44
|
+
<h1>测试 render 方法</h1>
|
|
45
|
+
<p>计数:{count}</p>
|
|
46
|
+
<Button onClick={() => this.handleClick()}>点击</Button>
|
|
47
|
+
</Page>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export default Document;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 测试返回类型
|
|
3
|
+
* @type Page
|
|
4
|
+
* @route /test-return-type
|
|
5
|
+
* @screen 1920w
|
|
6
|
+
* @frames web
|
|
7
|
+
*/
|
|
8
|
+
import React from 'react';
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class IProps {}
|
|
13
|
+
|
|
14
|
+
/*
|
|
15
|
+
* 数据与接口请求定义
|
|
16
|
+
*/
|
|
17
|
+
class IState {
|
|
18
|
+
count?: number;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
class Document extends React.Component<IProps, IState> {
|
|
22
|
+
state = { count: 0 };
|
|
23
|
+
|
|
24
|
+
handleClick() {
|
|
25
|
+
this.setState({
|
|
26
|
+
count: this.state.count + 1,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
render() {
|
|
31
|
+
return (
|
|
32
|
+
<Page className="p-[24px]">
|
|
33
|
+
<h1>测试返回类型</h1>
|
|
34
|
+
<p>计数:{this.state.count}</p>
|
|
35
|
+
<Button onClick={() => this.handleClick()}>点击</Button>
|
|
36
|
+
</Page>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export default Document;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 测试类型断言
|
|
3
|
+
* @type Page
|
|
4
|
+
* @route /test-type-assertion
|
|
5
|
+
* @screen 1920w
|
|
6
|
+
* @frames web
|
|
7
|
+
*/
|
|
8
|
+
import React from 'react';
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class IProps {}
|
|
13
|
+
|
|
14
|
+
/*
|
|
15
|
+
* 数据与接口请求定义
|
|
16
|
+
*/
|
|
17
|
+
class IState {
|
|
18
|
+
user?: any;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class Document extends React.Component<IProps, IState> {
|
|
23
|
+
state = {"user": null}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
handleClick() {
|
|
27
|
+
// ❌ 违反规范:使用类型断言 as any
|
|
28
|
+
const data = this.state.user as any;
|
|
29
|
+
console.log(data.name);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
render() {
|
|
33
|
+
return (<Page className="p-[24px]"><h1>测试类型断言</h1><Button onClick={() => this.handleClick()}>点击</Button></Page>);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export default Document;
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 测试页面
|
|
3
|
+
* @type Page
|
|
4
|
+
* @screen 1400w
|
|
5
|
+
* @frames web
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { Page, Text, View } from '@appthen/react';
|
|
9
|
+
import { Button } from '@appthen/antd';
|
|
10
|
+
import './testPage.css';
|
|
11
|
+
|
|
12
|
+
class IProps {}
|
|
13
|
+
|
|
14
|
+
/*
|
|
15
|
+
* 数据与接口请求定义
|
|
16
|
+
*/
|
|
17
|
+
class IState {
|
|
18
|
+
text: string;
|
|
19
|
+
form: {
|
|
20
|
+
/* @example 1 */aaa?: string
|
|
21
|
+
};
|
|
22
|
+
arr: {
|
|
23
|
+
/* @example 1 */a?: string,
|
|
24
|
+
/* @example 2 */b?: string,
|
|
25
|
+
/* @example 3 */c?: string,
|
|
26
|
+
}[];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
class Document extends React.Component<IProps, IState> {
|
|
30
|
+
state = {
|
|
31
|
+
text: '# Fuckyou\n ## test \n asij**diaj**sidj',
|
|
32
|
+
form: { aaa: '1' },
|
|
33
|
+
arr: [
|
|
34
|
+
{ a: '1', b: '2', c: '3' },
|
|
35
|
+
{ a: '1', b: '2', c: '3' },
|
|
36
|
+
],
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* refresh
|
|
41
|
+
*/
|
|
42
|
+
refresh() {
|
|
43
|
+
this.forceUpdate();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* 页面加载后执行
|
|
48
|
+
*/
|
|
49
|
+
componentDidMount() {
|
|
50
|
+
console.log('did Mount');
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
returnTitle(text1) {
|
|
54
|
+
return this.renderHeader(text1);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
renderHeader(text) {
|
|
58
|
+
const text2 = text + 'fuchhhk';
|
|
59
|
+
const node2 = (
|
|
60
|
+
<View
|
|
61
|
+
style={{
|
|
62
|
+
width: '50px',
|
|
63
|
+
height: '50px',
|
|
64
|
+
backgroundColor: 'red',
|
|
65
|
+
}}
|
|
66
|
+
>
|
|
67
|
+
{this.state.arr.map((item, index) => {
|
|
68
|
+
const { a, b } = item;
|
|
69
|
+
const str = a + b;
|
|
70
|
+
return <View children={str}></View>;
|
|
71
|
+
})}
|
|
72
|
+
</View>
|
|
73
|
+
);
|
|
74
|
+
const node = (
|
|
75
|
+
<View
|
|
76
|
+
style={{
|
|
77
|
+
width: '100px',
|
|
78
|
+
height: '100px',
|
|
79
|
+
backgroundColor: 'green',
|
|
80
|
+
}}
|
|
81
|
+
>
|
|
82
|
+
{node2}
|
|
83
|
+
</View>
|
|
84
|
+
);
|
|
85
|
+
return node;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
render() {
|
|
89
|
+
const form = this.state.form;
|
|
90
|
+
return (
|
|
91
|
+
<Page>
|
|
92
|
+
<Button
|
|
93
|
+
type="primary"
|
|
94
|
+
htmlType="button"
|
|
95
|
+
size="middle"
|
|
96
|
+
shape="default"
|
|
97
|
+
block={false}
|
|
98
|
+
danger={false}
|
|
99
|
+
ghost={false}
|
|
100
|
+
disabled={false}
|
|
101
|
+
onClick={event => {
|
|
102
|
+
this.refresh();
|
|
103
|
+
}}
|
|
104
|
+
>
|
|
105
|
+
主按钮123456
|
|
106
|
+
</Button>
|
|
107
|
+
<View>
|
|
108
|
+
<Text className="text-sm text-[#333]">文本</Text>
|
|
109
|
+
<View>
|
|
110
|
+
<Text>{this.returnTitle('returnTitle1113331')}</Text>
|
|
111
|
+
</View>
|
|
112
|
+
<View className="bg-[#5d40ed]">
|
|
113
|
+
{this.state.arr.map((item, index) => {
|
|
114
|
+
const { b } = item;
|
|
115
|
+
const { text } = this.state;
|
|
116
|
+
const test = 'fuck_' + text;
|
|
117
|
+
const node = (
|
|
118
|
+
<View
|
|
119
|
+
testProp={1}
|
|
120
|
+
style={{
|
|
121
|
+
width: '50px',
|
|
122
|
+
height: '50px',
|
|
123
|
+
backgroundColor: 'red',
|
|
124
|
+
}}
|
|
125
|
+
>
|
|
126
|
+
{test}
|
|
127
|
+
</View>
|
|
128
|
+
);
|
|
129
|
+
return (
|
|
130
|
+
<View className="flex flex-row">
|
|
131
|
+
<View className="flex-1 flex flex-col justify-center items-center">
|
|
132
|
+
<View>
|
|
133
|
+
<Text>{node}</Text>
|
|
134
|
+
</View>
|
|
135
|
+
<Text className="text-sm text-[#ffffff]">{test}</Text>
|
|
136
|
+
</View>
|
|
137
|
+
<View className="flex-1 h-[76px] flex justify-center items-center">
|
|
138
|
+
<Text className="text-lg text-[#ffffff]">
|
|
139
|
+
{form?.aaa +
|
|
140
|
+
'fuck' +
|
|
141
|
+
this.state.text +
|
|
142
|
+
'---' +
|
|
143
|
+
b +
|
|
144
|
+
'----' +
|
|
145
|
+
index}
|
|
146
|
+
</Text>
|
|
147
|
+
</View>
|
|
148
|
+
</View>
|
|
149
|
+
);
|
|
150
|
+
})}
|
|
151
|
+
</View>
|
|
152
|
+
</View>
|
|
153
|
+
</Page>
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export default Document;
|