vue2-client 1.8.0-9 → 1.8.1-1
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/.eslintrc.js +2 -0
- package/jest.setup.js +7 -7
- package/package.json +4 -1
- package/src/base-client/components/common/AMisRender/index.vue +207 -0
- package/src/base-client/components/common/CreateQuery/CreateQuery.vue +12 -3
- package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +2 -1
- package/src/config/default/setting.config.js +1 -1
- package/src/pages/AMisDemo/AMisDemo.vue +166 -0
- package/src/pages/CreateQueryPage.vue +1 -0
- package/src/router/async/router.map.js +2 -0
- package/src/utils/routerUtil.js +1 -1
- package/vue.config.js +8 -0
package/.eslintrc.js
CHANGED
|
@@ -37,6 +37,8 @@ module.exports = {
|
|
|
37
37
|
'vue/no-parsing-error': 0,
|
|
38
38
|
'vue/name-property-casing': 0,
|
|
39
39
|
'vue/multi-word-component-names': 0,
|
|
40
|
+
'vue/require-valid-default-prop': 0,
|
|
41
|
+
'no-template-curly-in-string': 0,
|
|
40
42
|
'vue/no-mutating-props': 0,
|
|
41
43
|
'no-tabs': 0,
|
|
42
44
|
'multiline-ternary': 0,
|
package/jest.setup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
global.matchMedia = global.matchMedia || function () {
|
|
2
|
-
return {
|
|
3
|
-
matches: false,
|
|
4
|
-
addListener: function () {},
|
|
5
|
-
removeListener: function () {}
|
|
6
|
-
}
|
|
7
|
-
}
|
|
1
|
+
global.matchMedia = global.matchMedia || function () {
|
|
2
|
+
return {
|
|
3
|
+
matches: false,
|
|
4
|
+
addListener: function () {},
|
|
5
|
+
removeListener: function () {}
|
|
6
|
+
}
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue2-client",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.1-1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"@antv/data-set": "^0.11.8",
|
|
18
18
|
"@antv/g2plot": "^2.4.29",
|
|
19
19
|
"@vue/babel-preset-jsx": "^1.4.0",
|
|
20
|
+
"amis": "^3.4.3",
|
|
20
21
|
"animate.css": "^4.1.1",
|
|
21
22
|
"ant-design-vue": "^1.7.8",
|
|
22
23
|
"axios": "^0.27.2",
|
|
@@ -36,6 +37,7 @@
|
|
|
36
37
|
"lodash.get": "^4.4.2",
|
|
37
38
|
"mockjs": "^1.1.0",
|
|
38
39
|
"nprogress": "^0.2.0",
|
|
40
|
+
"qs": "^6.11.2",
|
|
39
41
|
"regenerator-runtime": "^0.14.0",
|
|
40
42
|
"videojs-contrib-hls": "^5.15.0",
|
|
41
43
|
"viser-vue": "^2.4.8",
|
|
@@ -62,6 +64,7 @@
|
|
|
62
64
|
"babel-plugin-transform-remove-console": "^6.9.4",
|
|
63
65
|
"compression-webpack-plugin": "^10.0.0",
|
|
64
66
|
"css-minimizer-webpack-plugin": "^5.0.1",
|
|
67
|
+
"copy-webpack-plugin": "^11.0.0",
|
|
65
68
|
"deepmerge": "^4.3.1",
|
|
66
69
|
"eslint": "^8.51.0",
|
|
67
70
|
"eslint-plugin-vue": "^9.17.0",
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
<template><div>Loading...</div></template>
|
|
2
|
+
|
|
3
|
+
<script>
|
|
4
|
+
// import "amis/sdk/sdk.js";
|
|
5
|
+
// import "amis/sdk/sdk.css";
|
|
6
|
+
// import "amis/sdk/iconfont.css";
|
|
7
|
+
|
|
8
|
+
// 可以不引用, 如果你不想要任何辅助类样式的话 (比如 `m-t-xs` 这种)
|
|
9
|
+
// https://aisuda.bce.baidu.com/amis/zh-CN/style/index
|
|
10
|
+
import 'amis/sdk/helper.css'
|
|
11
|
+
import qs from 'qs'
|
|
12
|
+
|
|
13
|
+
function loadScript (src, callback) {
|
|
14
|
+
const script = document.createElement('script')
|
|
15
|
+
script.setAttribute('type', 'text/javascript')
|
|
16
|
+
script.setAttribute('src', src)
|
|
17
|
+
script.onload = () => callback()
|
|
18
|
+
script.onerror = () => callback(new Error(`Failed to load ${src}`))
|
|
19
|
+
document.body.appendChild(script)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function loadStyles (styles) {
|
|
23
|
+
for (const path of styles) {
|
|
24
|
+
const style = document.createElement('link')
|
|
25
|
+
style.setAttribute('rel', 'stylesheet')
|
|
26
|
+
style.setAttribute('type', 'text/css')
|
|
27
|
+
style.setAttribute('href', path)
|
|
28
|
+
document.head.appendChild(style)
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function loadSDK () {
|
|
33
|
+
return new Promise((resolve, reject) => {
|
|
34
|
+
if (window.amisRequire) {
|
|
35
|
+
resolve()
|
|
36
|
+
return
|
|
37
|
+
}
|
|
38
|
+
loadStyles([
|
|
39
|
+
'/amis/sdk/antd.css',
|
|
40
|
+
'/amis/sdk/helper.css',
|
|
41
|
+
'/amis/sdk/iconfont.css',
|
|
42
|
+
])
|
|
43
|
+
loadScript('/amis/sdk/sdk.js', (err) => {
|
|
44
|
+
if (err) {
|
|
45
|
+
reject(err)
|
|
46
|
+
return
|
|
47
|
+
}
|
|
48
|
+
resolve()
|
|
49
|
+
})
|
|
50
|
+
})
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export default {
|
|
54
|
+
name: 'AMISRenderer',
|
|
55
|
+
components: {},
|
|
56
|
+
props: {
|
|
57
|
+
schema: {
|
|
58
|
+
type: Object,
|
|
59
|
+
default: {
|
|
60
|
+
type: 'page',
|
|
61
|
+
body: 'Hello World!',
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
locals: {
|
|
65
|
+
type: Object,
|
|
66
|
+
default: () => ({}),
|
|
67
|
+
},
|
|
68
|
+
props: {
|
|
69
|
+
type: Object,
|
|
70
|
+
default: () => ({}),
|
|
71
|
+
},
|
|
72
|
+
env: {
|
|
73
|
+
type: Object,
|
|
74
|
+
default: () => ({
|
|
75
|
+
theme: 'antd'
|
|
76
|
+
}),
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
data () {
|
|
80
|
+
const router = this.$router
|
|
81
|
+
return {
|
|
82
|
+
// 这里面的数据所有 amis 页面都可以获取到
|
|
83
|
+
// 可以用来放一下公共数据,比如用户信息等
|
|
84
|
+
// 不要放受控数据,受控数据应该通过 data 下发
|
|
85
|
+
context: {
|
|
86
|
+
siteName: 'AMIS DEMO',
|
|
87
|
+
},
|
|
88
|
+
get location () {
|
|
89
|
+
const current = router.history.current
|
|
90
|
+
return {
|
|
91
|
+
pathname: current.path,
|
|
92
|
+
hash: current.hash,
|
|
93
|
+
query: current.query,
|
|
94
|
+
search: `?${qs.stringify(current.query)}`,
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
loading: false,
|
|
98
|
+
amisInstance: null,
|
|
99
|
+
unmounted: false,
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
watch: {
|
|
104
|
+
locals: function () {
|
|
105
|
+
this.updateProps()
|
|
106
|
+
},
|
|
107
|
+
props: function () {
|
|
108
|
+
this.updateProps()
|
|
109
|
+
},
|
|
110
|
+
$route: function () {
|
|
111
|
+
this.updateProps()
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
async mounted () {
|
|
115
|
+
try {
|
|
116
|
+
this.loading = true
|
|
117
|
+
await loadSDK()
|
|
118
|
+
} finally {
|
|
119
|
+
this.loading = false
|
|
120
|
+
}
|
|
121
|
+
if (this.unmounted) {
|
|
122
|
+
return
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const scoped = window.amisRequire('amis/embed')
|
|
126
|
+
const { normalizeLink } = window.amisRequire('amis')
|
|
127
|
+
const router = this.$router
|
|
128
|
+
const instance = scoped.embed(
|
|
129
|
+
this.$el,
|
|
130
|
+
this.schema,
|
|
131
|
+
{
|
|
132
|
+
data: {
|
|
133
|
+
...this.locals,
|
|
134
|
+
},
|
|
135
|
+
context: this.context,
|
|
136
|
+
location: this.location,
|
|
137
|
+
|
|
138
|
+
// todo 下发 location 对象
|
|
139
|
+
...this.props,
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
// 覆盖 amis env
|
|
143
|
+
// 参考 https://aisuda.bce.baidu.com/amis/zh-CN/docs/start/getting-started#sdk
|
|
144
|
+
jumpTo: (to, action) => {
|
|
145
|
+
if (to === 'goBack') {
|
|
146
|
+
return router.go(-1)
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
to = normalizeLink(to, this.location)
|
|
150
|
+
|
|
151
|
+
if (action?.actionType === 'url') {
|
|
152
|
+
action.blank === false ? router.push(to) : window.open(to)
|
|
153
|
+
return
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// 主要是支持 nav 中的跳转
|
|
157
|
+
if (action && to && action.target) {
|
|
158
|
+
window.open(to, action.target)
|
|
159
|
+
return
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
if (/^https?:\/\//.test(to)) {
|
|
163
|
+
window.location.replace(to)
|
|
164
|
+
} else {
|
|
165
|
+
router.push(to)
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
|
|
169
|
+
updateLocation: (location, replace) => {
|
|
170
|
+
if (location === 'goBack') {
|
|
171
|
+
return router.go(-1)
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
location = normalizeLink(location, this.location)
|
|
175
|
+
replace ? router.replace(location) : router.replace(location)
|
|
176
|
+
},
|
|
177
|
+
|
|
178
|
+
...this.env,
|
|
179
|
+
},
|
|
180
|
+
() => {
|
|
181
|
+
this.$emit('ready', {
|
|
182
|
+
instance,
|
|
183
|
+
})
|
|
184
|
+
}
|
|
185
|
+
)
|
|
186
|
+
|
|
187
|
+
this.amisInstance = instance
|
|
188
|
+
},
|
|
189
|
+
|
|
190
|
+
methods: {
|
|
191
|
+
updateProps () {
|
|
192
|
+
this.amisInstance?.updateProps({
|
|
193
|
+
data: {
|
|
194
|
+
...this.locals,
|
|
195
|
+
},
|
|
196
|
+
context: this.context,
|
|
197
|
+
...this.props,
|
|
198
|
+
})
|
|
199
|
+
},
|
|
200
|
+
},
|
|
201
|
+
|
|
202
|
+
destroyed () {
|
|
203
|
+
this.unmounted = true
|
|
204
|
+
this.amisInstance?.unmount()
|
|
205
|
+
},
|
|
206
|
+
}
|
|
207
|
+
</script>
|
|
@@ -343,6 +343,10 @@ export default {
|
|
|
343
343
|
toEditJson: {
|
|
344
344
|
type: Object,
|
|
345
345
|
default: () => {}
|
|
346
|
+
},
|
|
347
|
+
saveExportJson: {
|
|
348
|
+
type: Boolean,
|
|
349
|
+
default: false
|
|
346
350
|
}
|
|
347
351
|
},
|
|
348
352
|
watch: {
|
|
@@ -484,6 +488,7 @@ export default {
|
|
|
484
488
|
this.result = {}
|
|
485
489
|
},
|
|
486
490
|
onClose () {
|
|
491
|
+
this.$emit('close')
|
|
487
492
|
this.$emit('update:visible', false)
|
|
488
493
|
},
|
|
489
494
|
onModelClose () {
|
|
@@ -502,7 +507,7 @@ export default {
|
|
|
502
507
|
},
|
|
503
508
|
itemHandle (item, type) {
|
|
504
509
|
this.itemMap[item.key] = item
|
|
505
|
-
if (type === '新增') {
|
|
510
|
+
if (this.type === '新增') {
|
|
506
511
|
this.form.column.push(item)
|
|
507
512
|
} else {
|
|
508
513
|
this.$set(this.form.column, this.selectIndex, item)
|
|
@@ -518,6 +523,7 @@ export default {
|
|
|
518
523
|
this.$refs.queryItem.addColumnItemExecute()
|
|
519
524
|
},
|
|
520
525
|
editColumnItem (key, index) {
|
|
526
|
+
this.type = '修改'
|
|
521
527
|
if (this.itemMap[key]) {
|
|
522
528
|
this.$refs.queryItem.editColumnItemExecute(this.itemMap[key])
|
|
523
529
|
this.selectIndex = index
|
|
@@ -608,8 +614,11 @@ export default {
|
|
|
608
614
|
this.$refs.businessCreateForm.validate(valid => {
|
|
609
615
|
if (valid) {
|
|
610
616
|
this.viewHandle(() => {
|
|
611
|
-
|
|
612
|
-
|
|
617
|
+
if (this.saveExportJson) {
|
|
618
|
+
this.exportJson()
|
|
619
|
+
} else {
|
|
620
|
+
this.$emit('saveQueryParams', this.result)
|
|
621
|
+
}
|
|
613
622
|
})
|
|
614
623
|
}
|
|
615
624
|
})
|
|
@@ -653,6 +653,7 @@ export default {
|
|
|
653
653
|
rule: {
|
|
654
654
|
required: 'false'
|
|
655
655
|
},
|
|
656
|
+
column: [],
|
|
656
657
|
selectKey: undefined,
|
|
657
658
|
queryType: '=',
|
|
658
659
|
formType: 'input',
|
|
@@ -953,7 +954,7 @@ export default {
|
|
|
953
954
|
},
|
|
954
955
|
itemHandleItem (item, type) {
|
|
955
956
|
this.itemMap[item.key] = item
|
|
956
|
-
if (type === '新增') {
|
|
957
|
+
if (this.type === '新增') {
|
|
957
958
|
this.item.column.push(item)
|
|
958
959
|
} else {
|
|
959
960
|
this.$set(this.item.column, this.selectIndex, item)
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<amis-renderer :schema="schema" :locals="locals" />
|
|
3
|
+
</template>
|
|
4
|
+
<script>
|
|
5
|
+
import AMISRenderer from '@vue2-client/base-client/components/common/AMisRender'
|
|
6
|
+
|
|
7
|
+
const schema = {
|
|
8
|
+
title: '${siteName}:这是 AMIS 表格页面示例',
|
|
9
|
+
remark: '嘿,不保证数据准确性',
|
|
10
|
+
type: 'page',
|
|
11
|
+
body: {
|
|
12
|
+
type: 'crud',
|
|
13
|
+
draggable: true,
|
|
14
|
+
api: 'https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/mock2/sample',
|
|
15
|
+
keepItemSelectionOnPageChange: true,
|
|
16
|
+
autoGenerateFilter: true,
|
|
17
|
+
bulkActions: [
|
|
18
|
+
{
|
|
19
|
+
type: 'button',
|
|
20
|
+
label: '批量删除',
|
|
21
|
+
actionType: 'ajax',
|
|
22
|
+
api: 'delete:https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/mock2/sample/${ids|raw}',
|
|
23
|
+
confirmText: '确定要批量删除?',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
type: 'button',
|
|
27
|
+
label: '批量修改',
|
|
28
|
+
actionType: 'dialog',
|
|
29
|
+
dialog: {
|
|
30
|
+
title: '批量编辑',
|
|
31
|
+
name: 'sample-bulk-edit',
|
|
32
|
+
body: {
|
|
33
|
+
type: 'form',
|
|
34
|
+
api: 'https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/mock2/sample/bulkUpdate2',
|
|
35
|
+
body: [
|
|
36
|
+
{
|
|
37
|
+
type: 'hidden',
|
|
38
|
+
name: 'ids',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
type: 'input-text',
|
|
42
|
+
name: 'engine',
|
|
43
|
+
label: 'Engine',
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
quickSaveApi:
|
|
51
|
+
'https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/mock2/sample/bulkUpdate',
|
|
52
|
+
quickSaveItemApi:
|
|
53
|
+
'https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/mock2/sample/$id',
|
|
54
|
+
headerToolbar: [
|
|
55
|
+
'bulkActions',
|
|
56
|
+
{
|
|
57
|
+
type: 'button',
|
|
58
|
+
label: '重置测试数据',
|
|
59
|
+
actionType: 'ajax',
|
|
60
|
+
size: 'sm',
|
|
61
|
+
api: 'https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/mock2/sample/reset',
|
|
62
|
+
},
|
|
63
|
+
'export-excel',
|
|
64
|
+
{
|
|
65
|
+
type: 'tpl',
|
|
66
|
+
tpl: '一共有 ${count} 行数据。',
|
|
67
|
+
className: 'v-middle',
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
type: 'columns-toggler',
|
|
71
|
+
align: 'right',
|
|
72
|
+
draggable: true,
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
type: 'drag-toggler',
|
|
76
|
+
align: 'right',
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
footerToolbar: ['statistics', 'switch-per-page', 'pagination'],
|
|
80
|
+
columns: [
|
|
81
|
+
{
|
|
82
|
+
name: 'id',
|
|
83
|
+
label: 'ID',
|
|
84
|
+
width: 20,
|
|
85
|
+
sortable: true,
|
|
86
|
+
type: 'text',
|
|
87
|
+
searchable: {
|
|
88
|
+
type: 'input-text',
|
|
89
|
+
name: 'id',
|
|
90
|
+
label: '主键',
|
|
91
|
+
placeholder: '输入id',
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
name: 'browser',
|
|
96
|
+
label: 'Browser',
|
|
97
|
+
searchable: {
|
|
98
|
+
type: 'select',
|
|
99
|
+
name: 'browser',
|
|
100
|
+
label: '浏览器',
|
|
101
|
+
placeholder: '选择浏览器',
|
|
102
|
+
options: [
|
|
103
|
+
{
|
|
104
|
+
label: 'Internet Explorer ',
|
|
105
|
+
value: 'ie',
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
label: 'AOL browser',
|
|
109
|
+
value: 'aol',
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
label: 'Firefox',
|
|
113
|
+
value: 'firefox',
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
name: 'platform',
|
|
120
|
+
label: '平台',
|
|
121
|
+
popOver: {
|
|
122
|
+
trigger: 'hover',
|
|
123
|
+
body: {
|
|
124
|
+
type: 'tpl',
|
|
125
|
+
tpl: '就是为了演示有个叫 popOver 的功能',
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
sortable: true,
|
|
129
|
+
type: 'text',
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
name: 'grade',
|
|
133
|
+
label: 'CSS 等级',
|
|
134
|
+
type: 'select',
|
|
135
|
+
options: ['A', 'B', 'C', 'D', 'X'],
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
type: 'operation',
|
|
139
|
+
label: '操作',
|
|
140
|
+
width: 100,
|
|
141
|
+
buttons: [
|
|
142
|
+
{
|
|
143
|
+
type: 'button',
|
|
144
|
+
actionType: 'ajax',
|
|
145
|
+
label: '删除',
|
|
146
|
+
confirmText: '您确认要删除?',
|
|
147
|
+
api: 'delete:https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/mock2/sample/$id',
|
|
148
|
+
},
|
|
149
|
+
],
|
|
150
|
+
},
|
|
151
|
+
],
|
|
152
|
+
},
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export default {
|
|
156
|
+
name: 'AMisDemo',
|
|
157
|
+
components: {
|
|
158
|
+
'amis-renderer': AMISRenderer,
|
|
159
|
+
},
|
|
160
|
+
computed: {},
|
|
161
|
+
data: () => ({
|
|
162
|
+
schema: schema,
|
|
163
|
+
locals: {},
|
|
164
|
+
}),
|
|
165
|
+
}
|
|
166
|
+
</script>
|
|
@@ -33,6 +33,8 @@ routerResource.submitTicket = () => import('@vue2-client/pages/system/ticket')
|
|
|
33
33
|
routerResource.settings = () => import('@vue2-client/pages/system/settings')
|
|
34
34
|
// 查询配置生成工具
|
|
35
35
|
routerResource.createQuery = () => import('@vue2-client/pages/CreateQueryPage')
|
|
36
|
+
// AMIS示例页面
|
|
37
|
+
routerResource.amisDemo = () => import('@vue2-client/pages/AMisDemo/AMisDemo.vue')
|
|
36
38
|
|
|
37
39
|
// 基础路由组件注册
|
|
38
40
|
const routerMap = {
|
package/src/utils/routerUtil.js
CHANGED
package/vue.config.js
CHANGED
|
@@ -5,6 +5,7 @@ const { getThemeColors, modifyVars } = require('./src/utils/themeUtil')
|
|
|
5
5
|
const { resolveCss } = require('./src/utils/theme-color-replacer-extend')
|
|
6
6
|
const CompressionWebpackPlugin = require('compression-webpack-plugin')
|
|
7
7
|
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin')
|
|
8
|
+
const CopyPlugin = require('copy-webpack-plugin')
|
|
8
9
|
|
|
9
10
|
const productionGzipExtensions = ['js', 'css']
|
|
10
11
|
const isProd = process.env.NODE_ENV === 'production'
|
|
@@ -72,6 +73,13 @@ module.exports = {
|
|
|
72
73
|
resourceRegExp: /^\.\/locale$/,
|
|
73
74
|
contextRegExp: /moment$/
|
|
74
75
|
}))
|
|
76
|
+
|
|
77
|
+
config.plugins.push(
|
|
78
|
+
new CopyPlugin({
|
|
79
|
+
patterns: [{ from: 'node_modules/amis/sdk', to: 'amis/sdk' }],
|
|
80
|
+
})
|
|
81
|
+
)
|
|
82
|
+
|
|
75
83
|
// 生产环境下将资源压缩成gzip格式
|
|
76
84
|
if (isProd) {
|
|
77
85
|
// add `CompressionWebpack` plugin to webpack plugins
|