vue2-client 1.8.8 → 1.8.10

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/CHANGELOG.md CHANGED
@@ -1,6 +1,12 @@
1
1
  # Change Log
2
2
  > 所有关于本项目的变化都在该文档里。
3
3
 
4
+ **1.8.10 -2023-11-07 @江超**
5
+ - XStepView接入琉璃配置中心
6
+
7
+ **1.8.9 -2023-10-27 @江超**
8
+ - 完成webpack5的切换
9
+
4
10
  **1.7.20 -2023-10-11 @江超**
5
11
  - 跳转首页问题修改
6
12
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue2-client",
3
- "version": "1.8.8",
3
+ "version": "1.8.10",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
package/src/App.vue CHANGED
@@ -46,7 +46,7 @@ export default {
46
46
  const closeMessage = this.$message.loading(`您选择了主题模式 ${val}, 正在切换...`)
47
47
  themeUtil.changeThemeColor(this.theme.color, val).then(closeMessage)
48
48
  } else {
49
- this.$message.info('为保证构建性能,关闭开发环境下的主题模式切换')
49
+ console.info('为保证构建性能,关闭开发环境下的主题模式切换')
50
50
  }
51
51
  }
52
52
  },
@@ -57,7 +57,7 @@ export default {
57
57
  const closeMessage = this.$message.loading(`您选择了主题色 ${val}, 正在切换...`)
58
58
  themeUtil.changeThemeColor(val, this.theme.mode).then(closeMessage)
59
59
  } else {
60
- this.$message.info('为保证构建性能,关闭开发环境下的主题色切换')
60
+ console.info('为保证构建性能,关闭开发环境下的主题色切换')
61
61
  }
62
62
  }
63
63
  },
@@ -82,256 +82,19 @@ export default {
82
82
  props: {
83
83
  params: {
84
84
  type: Object,
85
- default: () => {
86
- return { meternumber: '4923217' }
87
- }
85
+ required: true
88
86
  },
89
- // panelStyle: {
90
- // type: Object,
91
- // default: () => {
92
- // return {
93
- // flex: 19
94
- // }
95
- // }
96
- // },
97
- // stepStyle: {
98
- // type: Object,
99
- // default: () => {
100
- // return {
101
- // flex: 5,
102
- // type: 'default',
103
- // progressDot: 'false',
104
- // direction: 'horizontal',
105
- // labelPlacement: 'horizontal',
106
- // size: 'default',
107
- // }
108
- // }
109
- // }
87
+ configContent: {
88
+ type: Object,
89
+ required: true
90
+ }
110
91
  },
111
92
  data () {
112
93
  return {
113
94
  current: -1,
114
95
  initial: 0,
115
96
  status: 'wait',
116
- iconType: 'loading',
117
- configContent: {
118
- step: {
119
- style: {
120
- flex: 5,
121
- type: 'default',
122
- progressDot: 'false',
123
- direction: 'vertical',
124
- labelPlacement: 'horizontal',
125
- size: 'default',
126
- },
127
- steps: [
128
- {
129
- name: '开始检测',
130
- title: '开始检测',
131
- subTitle: '对设备状态进行确认',
132
- description: '第一步',
133
- disabled: false,
134
- content: {
135
- card: {
136
- type: 'text',
137
- value: '正在对档案状态进行查看'
138
- }
139
- },
140
- run: {
141
- name: 'deviceCheckMeterInfo',
142
- params: {
143
- data: {
144
- meternumber: this.params.meternumber
145
- }
146
- }
147
- }
148
- },
149
- {
150
- name: '设备重置',
151
- title: '设备重置',
152
- subTitle: '对设备进行重置',
153
- description: '第二步',
154
- disabled: false,
155
- content: {
156
- card: {
157
- type: 'form',
158
- value: [
159
- {
160
- addOrEdit: 'all',
161
- name: '表号',
162
- rule: {
163
- type: 'number',
164
- required: 'true'
165
- },
166
- isOnlyAddOrEdit: false,
167
- model: 't_meternumber',
168
- type: 'input'
169
- },
170
- {
171
- addOrEdit: 'all',
172
- name: '识别码',
173
- rule: {
174
- type: 'number',
175
- required: 'true'
176
- },
177
- isOnlyAddOrEdit: false,
178
- model: 't_imei',
179
- type: 'input'
180
- }
181
- ]
182
- }
183
- },
184
- run: {
185
- name: 'deviceChangeMeterInfo',
186
- }
187
- },
188
- {
189
- name: '开户记录检查',
190
- title: '开户记录检查',
191
- subTitle: '对开户记录进行检查',
192
- description: '第三步',
193
- disabled: false,
194
- content: {
195
- card: {
196
- type: 'text',
197
- value: '正在等待系统生成开户指令'
198
- }
199
- },
200
- before: {
201
- name: 'logic@deviceCheckOpenAccount',
202
- params: {
203
- data: {
204
- meternumber: this.params.meternumber
205
- }
206
- }
207
- }
208
- },
209
- {
210
- name: '充值补气记录检查',
211
- title: '充值补气记录检查',
212
- subTitle: '对开户充值补气记录进行检查',
213
- description: '第四步',
214
- disabled: false,
215
- content: {
216
- card: {
217
- type: 'table',
218
- queryParamsName: 'crud_metercheck_instruct',
219
- queryFrom: {
220
- t_f_meternumber: this.params.meternumber
221
- },
222
- value: [
223
- {
224
- slots: {
225
- customRender: 't_id'
226
- },
227
- sorter: true,
228
- scopedSlots: {
229
- customRender: 't_id'
230
- },
231
- slotType: 'ellipsis',
232
- dataIndex: 't_id',
233
- width: 164,
234
- title: '指令id',
235
- slotValue: 16
236
- },
237
- {
238
- slots: {
239
- customRender: 't_f_meternumber'
240
- },
241
- sorter: true,
242
- scopedSlots: {
243
- customRender: 't_f_meternumber'
244
- },
245
- slotType: 'ellipsis',
246
- dataIndex: 't_f_meternumber',
247
- width: 164,
248
- title: '表号',
249
- slotValue: 16
250
- },
251
- {
252
- slots: {
253
- customRender: 't_f_alias'
254
- },
255
- sorter: true,
256
- scopedSlots: {
257
- customRender: 't_f_alias'
258
- },
259
- slotType: 'ellipsis',
260
- dataIndex: 't_f_alias',
261
- width: 164,
262
- title: '表具别名',
263
- slotValue: 16
264
- },
265
- {
266
- slots: {
267
- customRender: 't_f_instruct_type'
268
- },
269
- sorter: true,
270
- scopedSlots: {
271
- customRender: 't_f_instruct_type'
272
- },
273
- slotType: 'ellipsis',
274
- dataIndex: 't_f_instruct_type',
275
- width: 164,
276
- title: '指令类型',
277
- slotValue: 16
278
- },
279
- {
280
- slots: {
281
- customRender: 't_f_instruct_state'
282
- },
283
- sorter: true,
284
- scopedSlots: {
285
- customRender: 't_f_instruct_state'
286
- },
287
- slotType: 'ellipsis',
288
- dataIndex: 't_f_instruct_state',
289
- width: 164,
290
- title: '通信状态',
291
- slotValue: 16
292
- },
293
- {
294
- slots: {
295
- customRender: 't_f_receive_state'
296
- },
297
- sorter: true,
298
- scopedSlots: {
299
- customRender: 't_f_receive_state'
300
- },
301
- slotType: 'ellipsis',
302
- dataIndex: 't_f_receive_state',
303
- width: 164,
304
- title: '通信结果',
305
- slotValue: 16
306
- },
307
- {
308
- slots: {
309
- customRender: 'action'
310
- },
311
- sorter: false,
312
- scopedSlots: {
313
- customRender: 'action'
314
- },
315
- slotType: 'action',
316
- dataIndex: 'action',
317
- title: '操作',
318
- slotValue: '重新通信'
319
- }
320
- ]
321
- }
322
- },
323
- run: {
324
- name: 'xxx'
325
- }
326
- }
327
- ]
328
- },
329
- panel: {
330
- style: {
331
- flex: 19
332
- }
333
- }
334
- },
97
+ iconType: 'loading'
335
98
  }
336
99
  },
337
100
  watch: {
@@ -415,12 +178,12 @@ export default {
415
178
 
416
179
  },
417
180
  methods: {
418
- init (parms) {
181
+ init (params) {
419
182
  const {
420
183
  style,
421
184
  panel,
422
185
  steps
423
- } = parms
186
+ } = params
424
187
  if (style) {
425
188
  this.stepStyle = style
426
189
  }
@@ -18,6 +18,7 @@ import CreateQuery from './common/CreateQuery'
18
18
  import CreateSimpleFormQuery from './common/CreateSimpleFormQuery'
19
19
  import PersonSetting from './common/PersonSetting'
20
20
  import XFormTable from './common/XFormTable'
21
+ import XStepView from './common/XStepView'
21
22
  import Tree from './common/Tree'
22
23
 
23
24
  export default {
@@ -41,5 +42,6 @@ export default {
41
42
  CreateSimpleFormQuery,
42
43
  XFormTable,
43
44
  PersonSetting,
44
- Tree
45
+ Tree,
46
+ XStepView
45
47
  }
@@ -1,12 +0,0 @@
1
- {
2
- "printWidth": 80,
3
- "tabWidth": 2,
4
- "useTabs": false,
5
- "singleQuote": true,
6
- "semi": true,
7
- "trailingComma": "none",
8
- "bracketSpacing": false,
9
- "quoteProps": "consistent",
10
- "arrowParens": "avoid",
11
- "jsxBracketSameLine": false
12
- }
@@ -1,201 +0,0 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS
177
-
178
- APPENDIX: How to apply the Apache License to your work.
179
-
180
- To apply the Apache License to your work, attach the following
181
- boilerplate notice, with the fields enclosed by brackets "[]"
182
- replaced with your own identifying information. (Don't include
183
- the brackets!) The text should be enclosed in the appropriate
184
- comment syntax for the file format. We also recommend that a
185
- file or class name and description of purpose be included on the
186
- same "printed page" as the copyright notice for easier
187
- identification within third-party archives.
188
-
189
- Copyright [yyyy] [name of copyright owner]
190
-
191
- Licensed under the Apache License, Version 2.0 (the "License");
192
- you may not use this file except in compliance with the License.
193
- You may obtain a copy of the License at
194
-
195
- http://www.apache.org/licenses/LICENSE-2.0
196
-
197
- Unless required by applicable law or agreed to in writing, software
198
- distributed under the License is distributed on an "AS IS" BASIS,
199
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
- See the License for the specific language governing permissions and
201
- limitations under the License.
@@ -1,16 +0,0 @@
1
- # amis React 初始项目
2
-
3
- ## 使用方法
4
-
5
- ```
6
- npm i
7
- npm run server
8
- ```
9
-
10
- 要等几十秒
11
-
12
- ## vite
13
-
14
- ```
15
- npm run vite
16
- ```
@@ -1,13 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <link rel="icon" href="/favicon.ico" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- <title>Vite App</title>
8
- </head>
9
- <body>
10
- <div id="root"></div>
11
- <script type="module" src="/src/index.tsx"></script>
12
- </body>
13
- </html>
@@ -1,63 +0,0 @@
1
- {
2
- "name": "amis-react-starter",
3
- "version": "0.1.0",
4
- "private": true,
5
- "dependencies": {
6
- "@fortawesome/fontawesome-free": "^6.1.1",
7
- "@types/jest": "^27.0.3",
8
- "@types/node": "^16.11.11",
9
- "@types/react-dom": "^17.0.14",
10
- "amis": "^3.4.3",
11
- "amis-ui": "^3.4.3",
12
- "axios": "^0.26.1",
13
- "copy-to-clipboard": "^3.3.1",
14
- "react": "^17.0.2",
15
- "react-dom": "^17.0.2",
16
- "typescript": "^4.4.3"
17
- },
18
- "scripts": {
19
- "start": "node server.js",
20
- "build": "webpack",
21
- "server": "node server.js",
22
- "vite": "vite",
23
- "vite-build": "vite build"
24
- },
25
- "eslintConfig": {
26
- "extends": [
27
- "react-app",
28
- "react-app/jest"
29
- ]
30
- },
31
- "browserslist": {
32
- "production": [
33
- ">0.2%",
34
- "not dead",
35
- "not op_mini all"
36
- ],
37
- "development": [
38
- "last 1 chrome version",
39
- "last 1 firefox version",
40
- "last 1 safari version"
41
- ]
42
- },
43
- "devDependencies": {
44
- "@vitejs/plugin-react": "^1.1.0",
45
- "@vue/compiler-sfc": "^3.0.4",
46
- "clean-webpack-plugin": "^4.0.0",
47
- "css-loader": "^6.5.1",
48
- "express": "^4.17.1",
49
- "file-loader": "^6.2.0",
50
- "fork-ts-checker-webpack-plugin": "^7.2.1",
51
- "html-webpack-plugin": "^5.5.0",
52
- "monaco-editor-webpack-plugin": "^6.0.0",
53
- "prettier": "^2.2.1",
54
- "style-loader": "^3.3.1",
55
- "ts-loader": "^9.2.6",
56
- "url-loader": "^4.1.1",
57
- "vite": "^2.6.14",
58
- "webpack": "^5.46.0",
59
- "webpack-cli": "^4.7.2",
60
- "webpack-dev-middleware": "^5.2.2",
61
- "webpack-dev-server": "^4.6.0"
62
- }
63
- }
@@ -1,23 +0,0 @@
1
- const express = require('express');
2
- const webpack = require('webpack');
3
- const webpackDevMiddleware = require('webpack-dev-middleware');
4
-
5
- const app = express();
6
- const config = require('./webpack.config.js');
7
- const compiler = webpack(config);
8
- app.use(
9
- webpackDevMiddleware(compiler, {
10
- publicPath: config.output.publicPath,
11
- })
12
- );
13
-
14
- app.post('/api/form', (req, res) => {
15
- res.json({
16
- status: 0,
17
- msg: 'success'
18
- })
19
- })
20
-
21
- app.listen(3000, function () {
22
- console.log('Example app listening on port 3000!\n');
23
- });
@@ -1,25 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8" />
5
- <link rel="icon" href="/favicon.ico" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1" />
7
- <meta name="description" content="Web site created using create-snowpack-app" />
8
- <title>Snowpack App</title>
9
- </head>
10
- <body>
11
- <div id="root"></div>
12
- <noscript>You need to enable JavaScript to run this app.</noscript>
13
- <script type="module" src="/_dist_/index.js"></script>
14
- <!--
15
- This HTML file is a template.
16
- If you open it directly in the browser, you will see an empty page.
17
-
18
- You can add webfonts, meta tags, or analytics to this file.
19
- The build step will place the bundled scripts into the <body> tag.
20
-
21
- To begin the development, run `npm start` or `yarn start`.
22
- To create a production bundle, use `npm run build` or `yarn build`.
23
- -->
24
- </body>
25
- </html>
@@ -1,30 +0,0 @@
1
- /** @type {import("snowpack").SnowpackUserConfig } */
2
- module.exports = {
3
- mount: {
4
- snowpack: '/',
5
- src: '/_dist_'
6
- },
7
- plugins: [
8
- '@snowpack/plugin-react-refresh',
9
- '@snowpack/plugin-dotenv',
10
- '@snowpack/plugin-typescript'
11
- ],
12
- install: [
13
- /* ... */
14
- ],
15
- installOptions: {
16
- /* ... */
17
- },
18
- devOptions: {
19
- /* ... */
20
- },
21
- buildOptions: {
22
- /* ... */
23
- },
24
- proxy: {
25
- /* ... */
26
- },
27
- alias: {
28
- /* ... */
29
- }
30
- };
@@ -1,79 +0,0 @@
1
- import React from "react";
2
- import { render as renderAmis } from "amis-core";
3
- import axios from "axios";
4
- import copy from "copy-to-clipboard";
5
- import { toast } from "amis-ui";
6
- import { Schema } from "amis";
7
-
8
- class AMISComponent extends React.Component {
9
- schema: {}
10
- constructor(props:any) {
11
- super(props);
12
- this.schema = props || {}; // 传入的Amis配置
13
- console.log('props',props)
14
- }
15
-
16
- // 在组件内部定义的fetcher函数
17
- // @ts-ignore
18
- fetcher = ({ url, method, data, responseType, config, headers }): any => {
19
- // ...(fetcher的代码,与你的代码相同)
20
- config = config || {};
21
- config.withCredentials = true;
22
- responseType && (config.responseType = responseType);
23
-
24
- if (config.cancelExecutor) {
25
- config.cancelToken = new (axios as any).CancelToken(
26
- config.cancelExecutor
27
- );
28
- }
29
-
30
- config.headers = headers || {};
31
-
32
- if (method !== 'post' && method !== 'put' && method !== 'patch') {
33
- if (data) {
34
- config.params = data;
35
- }
36
- return (axios as any)[method](url, config);
37
- } else if (data && data instanceof FormData) {
38
- config.headers = config.headers || {};
39
- config.headers['Content-Type'] = 'multipart/form-data';
40
- } else if (
41
- data &&
42
- typeof data !== 'string' &&
43
- !(data instanceof Blob) &&
44
- !(data instanceof ArrayBuffer)
45
- ) {
46
- data = JSON.stringify(data);
47
- config.headers = config.headers || {};
48
- config.headers['Content-Type'] = 'application/json';
49
- }
50
-
51
- return (axios as any)[method](url, data, config);
52
- };
53
-
54
- // 在组件内部定义的isCancel函数
55
- isCancel = (value: any) => {
56
- return axios.isCancel(value);
57
- };
58
-
59
- // 在组件内部定义的copy函数
60
- copyToClipboard = (content: string) => {
61
- copy(content);
62
- toast.success('内容已复制到粘贴板');
63
- };
64
-
65
- // 渲染函数
66
- render() {
67
-
68
- const amisEnv = {
69
- fetcher: this.fetcher,
70
- isCancel: this.isCancel,
71
- copy: this.copyToClipboard,
72
- };
73
- console.log('this.schema',this.schema)
74
- // @ts-ignore
75
- return renderAmis(this.schema, {}, amisEnv);
76
- }
77
- }
78
-
79
- export default AMISComponent;
@@ -1,154 +0,0 @@
1
- import React from 'react';
2
-
3
- import '@fortawesome/fontawesome-free/css/all.css';
4
- import '@fortawesome/fontawesome-free/css/v4-shims.css';
5
-
6
- import 'amis/lib/themes/cxd.css';
7
- import 'amis/lib/helper.css';
8
- import 'amis/sdk/iconfont.css';
9
-
10
- import axios from 'axios';
11
- import copy from 'copy-to-clipboard';
12
-
13
- import {render as renderAmis, ToastComponent, AlertComponent} from 'amis';
14
- import {alert, confirm, toast} from 'amis-ui';
15
-
16
- // amis 环境配置
17
- const env = {
18
- // 下面三个接口必须实现
19
- fetcher: ({
20
- url, // 接口地址
21
- method, // 请求方法 get、post、put、delete
22
- data, // 请求数据
23
- responseType,
24
- config, // 其他配置
25
- headers // 请求头
26
- }: any) => {
27
- config = config || {};
28
- config.withCredentials = true;
29
- responseType && (config.responseType = responseType);
30
-
31
- if (config.cancelExecutor) {
32
- config.cancelToken = new (axios as any).CancelToken(
33
- config.cancelExecutor
34
- );
35
- }
36
-
37
- config.headers = headers || {};
38
-
39
- if (method !== 'post' && method !== 'put' && method !== 'patch') {
40
- if (data) {
41
- config.params = data;
42
- }
43
- return (axios as any)[method](url, config);
44
- } else if (data && data instanceof FormData) {
45
- config.headers = config.headers || {};
46
- config.headers['Content-Type'] = 'multipart/form-data';
47
- } else if (
48
- data &&
49
- typeof data !== 'string' &&
50
- !(data instanceof Blob) &&
51
- !(data instanceof ArrayBuffer)
52
- ) {
53
- data = JSON.stringify(data);
54
- config.headers = config.headers || {};
55
- config.headers['Content-Type'] = 'application/json';
56
- }
57
-
58
- return (axios as any)[method](url, data, config);
59
- },
60
- isCancel: (value: any) => (axios as any).isCancel(value),
61
- copy: (content: string) => {
62
- copy(content);
63
- toast.success('内容已复制到粘贴板');
64
- }
65
-
66
- // 后面这些接口可以不用实现
67
-
68
- // 默认是地址跳转
69
- // jumpTo: (
70
- // location: string /*目标地址*/,
71
- // action: any /* action对象*/
72
- // ) => {
73
- // // 用来实现页面跳转, actionType:link、url 都会进来。
74
- // },
75
-
76
- // updateLocation: (
77
- // location: string /*目标地址*/,
78
- // replace: boolean /*是replace,还是push?*/
79
- // ) => {
80
- // // 地址替换,跟 jumpTo 类似
81
- // },
82
-
83
- // isCurrentUrl: (
84
- // url: string /*url地址*/,
85
- // ) => {
86
- // // 用来判断是否目标地址当前地址
87
- // },
88
-
89
- // notify: (
90
- // type: 'error' | 'success' /**/,
91
- // msg: string /*提示内容*/
92
- // ) => {
93
- // toast[type]
94
- // ? toast[type](msg, type === 'error' ? '系统错误' : '系统消息')
95
- // : console.warn('[Notify]', type, msg);
96
- // },
97
- // alert,
98
- // confirm,
99
- };
100
-
101
- class AMISComponent extends React.Component<any, any> {
102
- render() {
103
- return renderAmis(
104
- // 这里是 amis 的 Json 配置。
105
- {
106
- type: 'page',
107
- body: {
108
- type: 'form',
109
- api: '/api/form',
110
- body: [
111
- {
112
- type: 'input-text',
113
- name: 'name',
114
- label: '姓名'
115
- },
116
- {
117
- name: 'email',
118
- type: 'input-email',
119
- label: '邮箱'
120
- },
121
- {
122
- name: 'color',
123
- type: 'input-color',
124
- label: 'color'
125
- },
126
- {
127
- type: 'editor',
128
- name: 'editor',
129
- label: '编辑器'
130
- }
131
- ]
132
- }
133
- },
134
- {
135
- // props...
136
- },
137
- env
138
- );
139
- }
140
- }
141
-
142
- class APP extends React.Component<any, any> {
143
- render() {
144
- return (
145
- <>
146
- <ToastComponent key="toast" position={'top-right'} />
147
- <AlertComponent key="alert" />
148
- <AMISComponent />
149
- </>
150
- );
151
- }
152
- }
153
-
154
- export default APP;
@@ -1,13 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1" />
6
- <meta name="theme-color" content="#000000" />
7
- <title>amis starter</title>
8
- </head>
9
- <body>
10
- <noscript>You need to enable JavaScript to run this app.</noscript>
11
- <div id="root"></div>
12
- </body>
13
- </html>
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- import ReactDOM from 'react-dom';
3
- import APP from './App';
4
- import AMISComponent from './AMISComponent'
5
-
6
- export {APP}
7
- export {AMISComponent}
@@ -1,74 +0,0 @@
1
-
2
- /// <reference types="react" />
3
- /// <reference types="react-dom" />
4
-
5
- declare namespace NodeJS {
6
- interface Process{
7
- env: ProcessEnv
8
- }
9
- interface ProcessEnv {
10
- /**
11
- * By default, there are two modes in Vite:
12
- *
13
- * * `development` is used by vite and vite serve
14
- * * `production` is used by vite build
15
- *
16
- * You can overwrite the default mode used for a command by passing the --mode option flag.
17
- *
18
- */
19
- readonly NODE_ENV: 'development' | 'production'
20
- }
21
- }
22
-
23
- declare var process: NodeJS.Process
24
-
25
- declare module '*.gif' {
26
- const src: string
27
- export default src
28
- }
29
-
30
- declare module '*.jpg' {
31
- const src: string
32
- export default src
33
- }
34
-
35
- declare module '*.jpeg' {
36
- const src: string
37
- export default src
38
- }
39
-
40
- declare module '*.png' {
41
- const src: string
42
- export default src
43
- }
44
-
45
- declare module '*.webp' {
46
- const src: string
47
- export default src
48
- }
49
-
50
- declare module '*.svg' {
51
- import * as React from 'react'
52
-
53
- export const ReactComponent: React.FunctionComponent<React.SVGProps<
54
- SVGSVGElement
55
- > & { title?: string }>
56
-
57
- const src: string;
58
- export default src
59
- }
60
-
61
- declare module '*.module.css' {
62
- const classes: { readonly [key: string]: string }
63
- export default classes
64
- }
65
-
66
- declare module '*.module.scss' {
67
- const classes: { readonly [key: string]: string }
68
- export default classes
69
- }
70
-
71
- declare module '*.module.sass' {
72
- const classes: { readonly [key: string]: string }
73
- export default classes
74
- }
@@ -1,19 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "es6",
4
- "lib": ["dom", "dom.iterable", "esnext"],
5
- "allowJs": true,
6
- "skipLibCheck": true,
7
- "esModuleInterop": true,
8
- "allowSyntheticDefaultImports": true,
9
- "strict": true,
10
- "forceConsistentCasingInFileNames": true,
11
- "noFallthroughCasesInSwitch": true,
12
- "module": "esnext",
13
- "moduleResolution": "node",
14
- "resolveJsonModule": true,
15
- "isolatedModules": true,
16
- "jsx": "react"
17
- },
18
- "include": ["src"]
19
- }
@@ -1,7 +0,0 @@
1
- import {defineConfig} from 'vite';
2
- import react from '@vitejs/plugin-react';
3
-
4
- // https://vitejs.dev/config/
5
- export default defineConfig({
6
- plugins: [react()]
7
- });
@@ -1,76 +0,0 @@
1
- const path = require('path');
2
- const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
3
- const HtmlWebpackPlugin = require('html-webpack-plugin');
4
- const {CleanWebpackPlugin} = require('clean-webpack-plugin');
5
- const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
6
-
7
- module.exports = {
8
- mode: 'development',
9
- entry: {
10
- index: [
11
- './src/index.tsx',
12
- ],
13
- },
14
- output: {
15
- path: path.resolve(__dirname, 'dist'),
16
- filename: 'MyReactApp.js',
17
- library: 'MyReactApp', // 被其他项目 引用时的名字
18
- libraryTarget: 'umd',
19
- umdNamedDefine: true
20
- },
21
- module: {
22
- rules: [
23
- {
24
- test: /\.tsx?$/,
25
- use: [
26
- {
27
- loader: 'ts-loader',
28
- options: {
29
- transpileOnly: true
30
- }
31
- }
32
- ],
33
- exclude: /node_modules/
34
- },
35
- {
36
- test: /\.woff2?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
37
- use: 'url-loader?limit=10000'
38
- },
39
- {
40
- test: /\.(ttf|eot|svg)(\?[\s\S]+)?$/,
41
- use: 'file-loader'
42
- },
43
- {
44
- test: /\.css$/,
45
- use: ['style-loader', 'css-loader']
46
- },
47
- {
48
- test: /\.ttf$/,
49
- use: ['file-loader']
50
- }
51
- ]
52
- },
53
- plugins: [
54
- new CleanWebpackPlugin({cleanStaleWebpackAssets: false}),
55
- new HtmlWebpackPlugin({
56
- template: 'src/index.html'
57
- }),
58
- new MonacoWebpackPlugin(),
59
- new ForkTsCheckerWebpackPlugin()
60
- ],
61
- resolve: {
62
- extensions: ['.tsx', '.ts', '.js', '.html'],
63
- modules: [path.resolve(__dirname, 'src'), 'node_modules'],
64
- },
65
- devtool: 'inline-source-map',
66
- devServer: {
67
- contentBase: path.join(__dirname, 'dist'),
68
- publicPath: path.join(__dirname, 'dist'),
69
- compress: true,
70
- port: 9000,
71
- hot: true,
72
- proxy: {
73
- '/api': 'http://localhost:3000'
74
- }
75
- }
76
- };