1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
| <!DOCTYPE html>
| <html lang="zh">
| <head>
| <meta charset="UTF-8" />
| <title>amis demo</title>
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
| <meta
| name="viewport"
| content="width=device-width, initial-scale=1, maximum-scale=1"
| />
| <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
| <link rel="stylesheet" href="${ctxPath}/sdk/sdk.css" />
| <link rel="stylesheet" href="${ctxPath}/sdk/helper.css" />
| <link rel="stylesheet" href="${ctxPath}/sdk/iconfont.css" />
| <!-- 这是默认主题所需的,如果是其他主题则不需要 -->
| <!-- 从 1.1.0 开始 sdk.css 将不支持 IE 11,如果要支持 IE11 请引用这个 css,并把前面那个删了 -->
| <!-- <link rel="stylesheet" href="sdk-ie11.css" /> -->
| <!-- 不过 amis 开发团队几乎没测试过 IE 11 下的效果,所以可能有细节功能用不了,如果发现请报 issue -->
| <style>
| html,
| body,
| .app-wrapper {
| position: relative;
| width: 100%;
| height: 100%;
| margin: 0;
| padding: 0;
| }
| </style>
| </head>
| <body>
| <div id="root" class="app-wrapper"></div>
| <script src="${ctxPath}/sdk/sdk.js"></script>
| <script type="text/javascript">
| (function () {
| let amis = amisRequire('amis/embed');
| // 通过替换下面这个配置来生成不同页面
| let amisJSON = {
| "type": "page",
| "title": "",
| "body": [
| {
| "type": "form",
| "id": "u:710cbc62ec24",
| "title": "",
| "body": [
| {
| "type": "form",
| "title": "",
| "body": [
| {
| "type": "tpl",
| "tpl": "                    换课",
| "inline": true,
| "wrapperComponent": "h2",
| "id": "u:194f160daab4"
| },
| {
| "type": "input-text",
| "label": "id",
| "name": "id",
| "id": "u:d038053014ca",
| "mode": "horizontal",
| "size": "md"
| },
| {
| "type": "input-text",
| "label": "ids",
| "name": "ids",
| "id": "u:223b7f2a1a5b",
| "mode": "horizontal",
| "size": "md"
| },
| {
| "label": "换课课程:",
| "type": "select",
| "name": "holiId",
| "id": "u:e205156867e3",
| "multiple": false,
| "mode": "horizontal",
| "source": {
| "url": "/tStudent/gettrans/$id",
| "method": "get",
| "requestAdaptor": "",
| "adaptor": "",
| "messages": {
| }
| },
| "value": "",
| "labelField": "value",
| "valueField": "id",
| "size": "md",
| "searchable": true
| }
| ],
| "api": {
| "url": "/tStudent/ToTrans",
| "method": "post",
| "requestAdaptor": "",
| "adaptor": "",
| "messages": {
| },
| "dataType": "form-data"
| },
| "id": "u:8860df492a12"
| }
| ],
| "actions": [
| ]
| }
| ],
| "id": "u:42603b55fcf2"
| };
| let amisScoped = amis.embed('#root', amisJSON);
|
|
| })();
|
| function test(){
| console.log("测试成功")
| }
|
| var myButton = document.getElementById("ttt");
| myButton.addEventListener("click",test);
| </script>
|
| </body>
| </html>
|
|