vue2-client 1.12.61 → 1.12.63
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/package.json
CHANGED
|
@@ -17,21 +17,35 @@
|
|
|
17
17
|
>
|
|
18
18
|
{{ panel.title }}
|
|
19
19
|
</span>
|
|
20
|
+
<!-- 当有 title2 数据时显示信息项 -->
|
|
21
|
+
<template v-if="panel.title2 && panel.title2.length">
|
|
22
|
+
<span
|
|
23
|
+
v-for="(item, headerIndex) in panel.title2"
|
|
24
|
+
:key="headerIndex"
|
|
25
|
+
class="info-item"
|
|
26
|
+
:style="config.title2Style"
|
|
27
|
+
>
|
|
28
|
+
<span>{{ item.key }}:</span>
|
|
29
|
+
<span>{{ item.value }}</span>
|
|
30
|
+
</span>
|
|
31
|
+
</template>
|
|
32
|
+
<!-- 当有 title3 数据时显示时间项 -->
|
|
20
33
|
<span
|
|
21
|
-
v-
|
|
22
|
-
:key="headerIndex"
|
|
23
|
-
class="info-item"
|
|
24
|
-
:style="config.title2Style"
|
|
25
|
-
>
|
|
26
|
-
<span>{{ item.key }}:</span>
|
|
27
|
-
<span>{{ item.value }}</span>
|
|
28
|
-
</span>
|
|
29
|
-
<span
|
|
34
|
+
v-if="panel.title3"
|
|
30
35
|
class="time-item"
|
|
31
36
|
:style="config.title3Style"
|
|
32
37
|
>
|
|
33
38
|
{{ panel.title3 }}
|
|
34
39
|
</span>
|
|
40
|
+
<!-- 修改搜索框的显示条件 -->
|
|
41
|
+
<a-input-search
|
|
42
|
+
v-if="panel.search"
|
|
43
|
+
v-model="searchText[panelIndex]"
|
|
44
|
+
placeholder="请输入搜索内容"
|
|
45
|
+
class="search-input"
|
|
46
|
+
@search="(value) => onSearch(value, panelIndex)"
|
|
47
|
+
@click.stop
|
|
48
|
+
/>
|
|
35
49
|
</div>
|
|
36
50
|
</template>
|
|
37
51
|
<!-- 根据类型显示不同内容 -->
|
|
@@ -71,6 +85,7 @@ export default {
|
|
|
71
85
|
activeKey: [],
|
|
72
86
|
config: {},
|
|
73
87
|
configName: '',
|
|
88
|
+
searchText: {}
|
|
74
89
|
}
|
|
75
90
|
},
|
|
76
91
|
props: {
|
|
@@ -84,6 +99,8 @@ export default {
|
|
|
84
99
|
}
|
|
85
100
|
},
|
|
86
101
|
created () {
|
|
102
|
+
this.searchTexts = {} // 初始化对象
|
|
103
|
+
|
|
87
104
|
this.getData(this.queryParamsName)
|
|
88
105
|
window.addEventListener('setItem', (e) => {
|
|
89
106
|
console.log('监听到sessionStorage的变化:', e)
|
|
@@ -110,6 +127,7 @@ export default {
|
|
|
110
127
|
this.configName = config
|
|
111
128
|
getConfigByName(config, 'af-his', res => {
|
|
112
129
|
this.config = res
|
|
130
|
+
console.warn(this.config)
|
|
113
131
|
runLogic(res.mainLogic, this.parameter, 'af-his').then(result => {
|
|
114
132
|
this.config.showData = result
|
|
115
133
|
this.activeKey = this.config.showData.map((_, panelIndex) => panelIndex.toString())
|
|
@@ -119,6 +137,9 @@ export default {
|
|
|
119
137
|
handleChange (keys) {
|
|
120
138
|
this.activeKey = keys
|
|
121
139
|
},
|
|
140
|
+
onSearch (value, panelIndex) {
|
|
141
|
+
console.log('搜索内容:', value, '面板索引:', panelIndex)
|
|
142
|
+
},
|
|
122
143
|
},
|
|
123
144
|
watch: {
|
|
124
145
|
queryParamsName: {
|
|
@@ -136,12 +157,15 @@ export default {
|
|
|
136
157
|
display: flex;
|
|
137
158
|
align-items: center;
|
|
138
159
|
gap: 24px;
|
|
160
|
+
white-space: nowrap;
|
|
161
|
+
overflow: hidden;
|
|
139
162
|
}
|
|
140
163
|
|
|
141
164
|
.header-text {
|
|
142
165
|
margin-right: 16px;
|
|
143
166
|
font-size: 16px;
|
|
144
|
-
font-weight: 800;
|
|
167
|
+
font-weight: 800;
|
|
168
|
+
flex-shrink: 0;
|
|
145
169
|
}
|
|
146
170
|
|
|
147
171
|
.info-item {
|
|
@@ -150,11 +174,13 @@ export default {
|
|
|
150
174
|
gap: 4px;
|
|
151
175
|
font-size: 12px;
|
|
152
176
|
color: #888888;
|
|
177
|
+
flex-shrink: 0;
|
|
153
178
|
}
|
|
154
179
|
|
|
155
180
|
.time-item {
|
|
156
181
|
margin-left: auto;
|
|
157
182
|
text-align: right;
|
|
183
|
+
flex-shrink: 0;
|
|
158
184
|
}
|
|
159
185
|
|
|
160
186
|
/* 覆盖 ant-design-vue 的默认样式 */
|
|
@@ -173,4 +199,8 @@ export default {
|
|
|
173
199
|
:deep(.ant-card-body) {
|
|
174
200
|
padding: 8px;
|
|
175
201
|
}
|
|
202
|
+
.search-input {
|
|
203
|
+
margin-left: auto;
|
|
204
|
+
width: 100%;
|
|
205
|
+
}
|
|
176
206
|
</style>
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
<script>
|
|
12
12
|
|
|
13
|
-
import { runLogic } from '
|
|
13
|
+
import { runLogic } from '@vue2-client/services/api/common'
|
|
14
14
|
|
|
15
15
|
export default {
|
|
16
16
|
name: 'XList',
|
|
@@ -30,16 +30,13 @@ export default {
|
|
|
30
30
|
},
|
|
31
31
|
methods: {
|
|
32
32
|
async getData (config) {
|
|
33
|
-
console.warn(config)
|
|
34
33
|
runLogic(config, {}, 'af-his').then(res => {
|
|
35
|
-
console.warn(res)
|
|
36
34
|
this.data = res
|
|
37
35
|
})
|
|
38
36
|
},
|
|
39
37
|
handleClick (index) {
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
this.$emit('listClick', id)
|
|
38
|
+
const row = this.data[index]
|
|
39
|
+
this.$emit('listClick', row)
|
|
43
40
|
}
|
|
44
41
|
}
|
|
45
42
|
}
|
|
@@ -68,6 +65,8 @@ export default {
|
|
|
68
65
|
border: 1px solid #D9D9D9;
|
|
69
66
|
box-sizing: border-box;
|
|
70
67
|
margin-bottom: 16px;
|
|
68
|
+
white-space: nowrap;
|
|
69
|
+
overflow: clip;
|
|
71
70
|
}
|
|
72
71
|
|
|
73
72
|
/* 自定义滚动条样式 */
|
package/vue.config.js
CHANGED
|
@@ -1,214 +1,214 @@
|
|
|
1
|
-
const path = require('path')
|
|
2
|
-
const webpack = require('webpack')
|
|
3
|
-
const ThemeColorReplacer = require('webpack-theme-color-replacer')
|
|
4
|
-
const { getThemeColors, modifyVars } = require('./src/utils/themeUtil')
|
|
5
|
-
const { resolveCss } = require('./src/utils/theme-color-replacer-extend')
|
|
6
|
-
const CompressionWebpackPlugin = require('compression-webpack-plugin')
|
|
7
|
-
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin')
|
|
8
|
-
// const CopyPlugin = require('copy-webpack-plugin')
|
|
9
|
-
|
|
10
|
-
const productionGzipExtensions = ['js', 'css']
|
|
11
|
-
const isProd = process.env.NODE_ENV === 'production'
|
|
12
|
-
|
|
13
|
-
// v4 产品演示
|
|
14
|
-
const v3Server = 'http://aote-office.8866.org:31567'
|
|
15
|
-
// const gateway = 'http://192.168.50.67:31467'
|
|
16
|
-
// const testUpload = 'http://123.60.214.109:8406'
|
|
17
|
-
const OSSServerDev = 'http://192.168.50.67:30351'
|
|
18
|
-
// const revenue = 'http://aote-office.8866.org:31567'
|
|
19
|
-
const revenue = 'http://aote-office.8866.org:31567'
|
|
20
|
-
// const OSSServerProd = 'http://192.168.50.67:31351'
|
|
21
|
-
// const testUploadLocal = 'http://127.0.0.1:9001'
|
|
22
|
-
// v3 铜川
|
|
23
|
-
// const v3Server = 'http://61.134.55.234:8405'
|
|
24
|
-
// const gateway = 'http://61.134.55.234:8456/webmeter'
|
|
25
|
-
// v3 涉县
|
|
26
|
-
// const v3Server = 'http://221.193.244.147:9600'
|
|
27
|
-
// const gateway = 'http://221.193.244.147:9600/webmeter'
|
|
28
|
-
// 本地
|
|
29
|
-
// const local = 'http://localhost:8080'
|
|
30
|
-
|
|
31
|
-
module.exports = {
|
|
32
|
-
devServer: {
|
|
33
|
-
// development server port 8000
|
|
34
|
-
port: 8020,
|
|
35
|
-
// If you want to turn on the proxy, please remove the mockjs /src/main.jsL11
|
|
36
|
-
proxy: {
|
|
37
|
-
// '/apply-image': {
|
|
38
|
-
// target: revenue,
|
|
39
|
-
// },
|
|
40
|
-
'/rs': {
|
|
41
|
-
target: v3Server,
|
|
42
|
-
ws: false,
|
|
43
|
-
changeOrigin: true
|
|
44
|
-
},
|
|
45
|
-
// '/api/af-system/resource': {
|
|
46
|
-
// pathRewrite: { '^/api/af-system': '/' },
|
|
47
|
-
// target: testUpload,
|
|
48
|
-
// changeOrigin: true
|
|
49
|
-
// },
|
|
50
|
-
'/api/af-revenue/logic/openapi/': {
|
|
51
|
-
// pathRewrite: { '^/api/af-revenue/logic/openapi/': '/logic/' },
|
|
52
|
-
target: revenue,
|
|
53
|
-
changeOrigin: true
|
|
54
|
-
},
|
|
55
|
-
'/api/af-scada': {
|
|
56
|
-
target: revenue,
|
|
57
|
-
changeOrigin: true
|
|
58
|
-
},
|
|
59
|
-
'/api/af-revenue': {
|
|
60
|
-
// pathRewrite: { '^/api/af-revenue/': '/' },
|
|
61
|
-
target: revenue,
|
|
62
|
-
changeOrigin: true
|
|
63
|
-
},
|
|
64
|
-
'/api/af-liuli': {
|
|
65
|
-
// pathRewrite: { '^/api/af-liuli/': '/' },
|
|
66
|
-
// target: 'http://127.0.0.1:9014',
|
|
67
|
-
target: revenue,
|
|
68
|
-
changeOrigin: true
|
|
69
|
-
},
|
|
70
|
-
'/api/af-gaslink': {
|
|
71
|
-
// pathRewrite: { '^/api/af-gaslink/': '/' },
|
|
72
|
-
// target: 'http://127.0.0.1:9036',
|
|
73
|
-
target: revenue,
|
|
74
|
-
changeOrigin: true
|
|
75
|
-
},
|
|
76
|
-
'/api': {
|
|
77
|
-
// v3用
|
|
78
|
-
// pathRewrite: { '^/api/af-system/': '/rs/', '^/api/af-iot/': '/rs/' },
|
|
79
|
-
// pathRewrite: { '^/api/': '/' },
|
|
80
|
-
target: revenue,
|
|
81
|
-
changeOrigin: true
|
|
82
|
-
},
|
|
83
|
-
'/devApi': {
|
|
84
|
-
// v3用
|
|
85
|
-
// pathRewrite: { '^/api/af-system/': '/rs/', '^/api/af-iot/': '/rs/' },
|
|
86
|
-
// pathRewrite: { '^/api/': '/' },
|
|
87
|
-
target: revenue,
|
|
88
|
-
changeOrigin: true
|
|
89
|
-
},
|
|
90
|
-
'/resource': {
|
|
91
|
-
// pathRewrite: { '^/resource': '/' },
|
|
92
|
-
target: revenue,
|
|
93
|
-
changeOrigin: true
|
|
94
|
-
},
|
|
95
|
-
'/ai': {
|
|
96
|
-
target: 'http://192.168.50.67:31761',
|
|
97
|
-
pathRewrite: { '^/ai': '/' },
|
|
98
|
-
changeOrigin: true
|
|
99
|
-
},
|
|
100
|
-
'/oss': {
|
|
101
|
-
target: OSSServerDev,
|
|
102
|
-
pathRewrite: { '^/oss': '/' },
|
|
103
|
-
changeOrigin: true
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
client: {
|
|
107
|
-
overlay: false
|
|
108
|
-
}
|
|
109
|
-
},
|
|
110
|
-
pluginOptions: {
|
|
111
|
-
'style-resources-loader': {
|
|
112
|
-
preProcessor: 'less',
|
|
113
|
-
patterns: [path.resolve(__dirname, './src/theme/theme.less')]
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
configureWebpack: config => {
|
|
117
|
-
config.devtool = 'inline-source-map'
|
|
118
|
-
// 忽略.md文件
|
|
119
|
-
config.module.rules.push(
|
|
120
|
-
{
|
|
121
|
-
test: /\.md$/,
|
|
122
|
-
exclude: /node_modules/,
|
|
123
|
-
use: 'ignore-loader'
|
|
124
|
-
}
|
|
125
|
-
)
|
|
126
|
-
config.context = path.resolve(__dirname, './')
|
|
127
|
-
config.resolve = {
|
|
128
|
-
extensions: ['.js', '.vue', '.json'],
|
|
129
|
-
alias: {
|
|
130
|
-
'@vue2-client': path.resolve('src'),
|
|
131
|
-
'@': path.resolve('src'),
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
config.entry.app = ['core-js/stable', 'regenerator-runtime/runtime', 'whatwg-fetch', './src/main.js']
|
|
135
|
-
config.performance = {
|
|
136
|
-
hints: false
|
|
137
|
-
}
|
|
138
|
-
if (isProd) {
|
|
139
|
-
config.plugins.push(
|
|
140
|
-
new ThemeColorReplacer({
|
|
141
|
-
fileName: 'css/theme-colors-[contenthash:8].css',
|
|
142
|
-
matchColors: getThemeColors(),
|
|
143
|
-
injectCss: true,
|
|
144
|
-
resolveCss
|
|
145
|
-
})
|
|
146
|
-
)
|
|
147
|
-
}
|
|
148
|
-
// Ignore all locale files of moment.js
|
|
149
|
-
config.plugins.push(new webpack.IgnorePlugin({
|
|
150
|
-
resourceRegExp: /^\.\/locale$/,
|
|
151
|
-
contextRegExp: /moment$/
|
|
152
|
-
}))
|
|
153
|
-
|
|
154
|
-
config.plugins.push(
|
|
155
|
-
// new CopyPlugin({
|
|
156
|
-
// patterns: [{ from: 'node_modules/amis/sdk', to: 'amis/sdk' }],
|
|
157
|
-
// })
|
|
158
|
-
)
|
|
159
|
-
|
|
160
|
-
// 生产环境下将资源压缩成gzip格式
|
|
161
|
-
if (isProd) {
|
|
162
|
-
// add `CompressionWebpack` plugin to webpack plugins
|
|
163
|
-
config.plugins.push(new CompressionWebpackPlugin({
|
|
164
|
-
algorithm: 'gzip',
|
|
165
|
-
test: new RegExp('\\.(' + productionGzipExtensions.join('|') + ')$'),
|
|
166
|
-
threshold: 10240,
|
|
167
|
-
minRatio: 0.8
|
|
168
|
-
}))
|
|
169
|
-
}
|
|
170
|
-
// if prod, add externals
|
|
171
|
-
// if (isProd) {
|
|
172
|
-
// config.externals = assetsCDN.externals
|
|
173
|
-
// }
|
|
174
|
-
},
|
|
175
|
-
chainWebpack: config => {
|
|
176
|
-
// 生产环境下关闭css压缩的 colormin 项,因为此项优化与主题色替换功能冲突
|
|
177
|
-
if (isProd) {
|
|
178
|
-
config.optimization.minimizer('css').use(CssMinimizerPlugin, [{
|
|
179
|
-
minimizerOptions: {
|
|
180
|
-
preset: [
|
|
181
|
-
'default',
|
|
182
|
-
{
|
|
183
|
-
discardComments: { removeAll: true },
|
|
184
|
-
colormin: false,
|
|
185
|
-
}
|
|
186
|
-
],
|
|
187
|
-
ignoreOrder: true
|
|
188
|
-
}
|
|
189
|
-
}])
|
|
190
|
-
}
|
|
191
|
-
config.resolve.alias.set('@vue2-client', path.resolve(__dirname, 'src'))
|
|
192
|
-
},
|
|
193
|
-
css: {
|
|
194
|
-
extract: !isProd
|
|
195
|
-
? {
|
|
196
|
-
filename: 'css/[name].css',
|
|
197
|
-
chunkFilename: 'css/[name].css',
|
|
198
|
-
}
|
|
199
|
-
: true,
|
|
200
|
-
loaderOptions: {
|
|
201
|
-
less: {
|
|
202
|
-
lessOptions: {
|
|
203
|
-
modifyVars: modifyVars(),
|
|
204
|
-
javascriptEnabled: true
|
|
205
|
-
}
|
|
206
|
-
},
|
|
207
|
-
sass: {}
|
|
208
|
-
}
|
|
209
|
-
},
|
|
210
|
-
publicPath: process.env.VUE_APP_PUBLIC_PATH,
|
|
211
|
-
outputDir: 'dist',
|
|
212
|
-
assetsDir: 'static',
|
|
213
|
-
productionSourceMap: false
|
|
214
|
-
}
|
|
1
|
+
const path = require('path')
|
|
2
|
+
const webpack = require('webpack')
|
|
3
|
+
const ThemeColorReplacer = require('webpack-theme-color-replacer')
|
|
4
|
+
const { getThemeColors, modifyVars } = require('./src/utils/themeUtil')
|
|
5
|
+
const { resolveCss } = require('./src/utils/theme-color-replacer-extend')
|
|
6
|
+
const CompressionWebpackPlugin = require('compression-webpack-plugin')
|
|
7
|
+
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin')
|
|
8
|
+
// const CopyPlugin = require('copy-webpack-plugin')
|
|
9
|
+
|
|
10
|
+
const productionGzipExtensions = ['js', 'css']
|
|
11
|
+
const isProd = process.env.NODE_ENV === 'production'
|
|
12
|
+
|
|
13
|
+
// v4 产品演示
|
|
14
|
+
const v3Server = 'http://aote-office.8866.org:31567'
|
|
15
|
+
// const gateway = 'http://192.168.50.67:31467'
|
|
16
|
+
// const testUpload = 'http://123.60.214.109:8406'
|
|
17
|
+
const OSSServerDev = 'http://192.168.50.67:30351'
|
|
18
|
+
// const revenue = 'http://aote-office.8866.org:31567'
|
|
19
|
+
const revenue = 'http://aote-office.8866.org:31567'
|
|
20
|
+
// const OSSServerProd = 'http://192.168.50.67:31351'
|
|
21
|
+
// const testUploadLocal = 'http://127.0.0.1:9001'
|
|
22
|
+
// v3 铜川
|
|
23
|
+
// const v3Server = 'http://61.134.55.234:8405'
|
|
24
|
+
// const gateway = 'http://61.134.55.234:8456/webmeter'
|
|
25
|
+
// v3 涉县
|
|
26
|
+
// const v3Server = 'http://221.193.244.147:9600'
|
|
27
|
+
// const gateway = 'http://221.193.244.147:9600/webmeter'
|
|
28
|
+
// 本地
|
|
29
|
+
// const local = 'http://localhost:8080'
|
|
30
|
+
|
|
31
|
+
module.exports = {
|
|
32
|
+
devServer: {
|
|
33
|
+
// development server port 8000
|
|
34
|
+
port: 8020,
|
|
35
|
+
// If you want to turn on the proxy, please remove the mockjs /src/main.jsL11
|
|
36
|
+
proxy: {
|
|
37
|
+
// '/apply-image': {
|
|
38
|
+
// target: revenue,
|
|
39
|
+
// },
|
|
40
|
+
'/rs': {
|
|
41
|
+
target: v3Server,
|
|
42
|
+
ws: false,
|
|
43
|
+
changeOrigin: true
|
|
44
|
+
},
|
|
45
|
+
// '/api/af-system/resource': {
|
|
46
|
+
// pathRewrite: { '^/api/af-system': '/' },
|
|
47
|
+
// target: testUpload,
|
|
48
|
+
// changeOrigin: true
|
|
49
|
+
// },
|
|
50
|
+
'/api/af-revenue/logic/openapi/': {
|
|
51
|
+
// pathRewrite: { '^/api/af-revenue/logic/openapi/': '/logic/' },
|
|
52
|
+
target: revenue,
|
|
53
|
+
changeOrigin: true
|
|
54
|
+
},
|
|
55
|
+
'/api/af-scada': {
|
|
56
|
+
target: revenue,
|
|
57
|
+
changeOrigin: true
|
|
58
|
+
},
|
|
59
|
+
'/api/af-revenue': {
|
|
60
|
+
// pathRewrite: { '^/api/af-revenue/': '/' },
|
|
61
|
+
target: revenue,
|
|
62
|
+
changeOrigin: true
|
|
63
|
+
},
|
|
64
|
+
'/api/af-liuli': {
|
|
65
|
+
// pathRewrite: { '^/api/af-liuli/': '/' },
|
|
66
|
+
// target: 'http://127.0.0.1:9014',
|
|
67
|
+
target: revenue,
|
|
68
|
+
changeOrigin: true
|
|
69
|
+
},
|
|
70
|
+
'/api/af-gaslink': {
|
|
71
|
+
// pathRewrite: { '^/api/af-gaslink/': '/' },
|
|
72
|
+
// target: 'http://127.0.0.1:9036',
|
|
73
|
+
target: revenue,
|
|
74
|
+
changeOrigin: true
|
|
75
|
+
},
|
|
76
|
+
'/api': {
|
|
77
|
+
// v3用
|
|
78
|
+
// pathRewrite: { '^/api/af-system/': '/rs/', '^/api/af-iot/': '/rs/' },
|
|
79
|
+
// pathRewrite: { '^/api/': '/' },
|
|
80
|
+
target: revenue,
|
|
81
|
+
changeOrigin: true
|
|
82
|
+
},
|
|
83
|
+
'/devApi': {
|
|
84
|
+
// v3用
|
|
85
|
+
// pathRewrite: { '^/api/af-system/': '/rs/', '^/api/af-iot/': '/rs/' },
|
|
86
|
+
// pathRewrite: { '^/api/': '/' },
|
|
87
|
+
target: revenue,
|
|
88
|
+
changeOrigin: true
|
|
89
|
+
},
|
|
90
|
+
'/resource': {
|
|
91
|
+
// pathRewrite: { '^/resource': '/' },
|
|
92
|
+
target: revenue,
|
|
93
|
+
changeOrigin: true
|
|
94
|
+
},
|
|
95
|
+
'/ai': {
|
|
96
|
+
target: 'http://192.168.50.67:31761',
|
|
97
|
+
pathRewrite: { '^/ai': '/' },
|
|
98
|
+
changeOrigin: true
|
|
99
|
+
},
|
|
100
|
+
'/oss': {
|
|
101
|
+
target: OSSServerDev,
|
|
102
|
+
pathRewrite: { '^/oss': '/' },
|
|
103
|
+
changeOrigin: true
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
client: {
|
|
107
|
+
overlay: false
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
pluginOptions: {
|
|
111
|
+
'style-resources-loader': {
|
|
112
|
+
preProcessor: 'less',
|
|
113
|
+
patterns: [path.resolve(__dirname, './src/theme/theme.less')]
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
configureWebpack: config => {
|
|
117
|
+
config.devtool = 'inline-source-map'
|
|
118
|
+
// 忽略.md文件
|
|
119
|
+
config.module.rules.push(
|
|
120
|
+
{
|
|
121
|
+
test: /\.md$/,
|
|
122
|
+
exclude: /node_modules/,
|
|
123
|
+
use: 'ignore-loader'
|
|
124
|
+
}
|
|
125
|
+
)
|
|
126
|
+
config.context = path.resolve(__dirname, './')
|
|
127
|
+
config.resolve = {
|
|
128
|
+
extensions: ['.js', '.vue', '.json'],
|
|
129
|
+
alias: {
|
|
130
|
+
'@vue2-client': path.resolve('src'),
|
|
131
|
+
'@': path.resolve('src'),
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
config.entry.app = ['core-js/stable', 'regenerator-runtime/runtime', 'whatwg-fetch', './src/main.js']
|
|
135
|
+
config.performance = {
|
|
136
|
+
hints: false
|
|
137
|
+
}
|
|
138
|
+
if (isProd) {
|
|
139
|
+
config.plugins.push(
|
|
140
|
+
new ThemeColorReplacer({
|
|
141
|
+
fileName: 'css/theme-colors-[contenthash:8].css',
|
|
142
|
+
matchColors: getThemeColors(),
|
|
143
|
+
injectCss: true,
|
|
144
|
+
resolveCss
|
|
145
|
+
})
|
|
146
|
+
)
|
|
147
|
+
}
|
|
148
|
+
// Ignore all locale files of moment.js
|
|
149
|
+
config.plugins.push(new webpack.IgnorePlugin({
|
|
150
|
+
resourceRegExp: /^\.\/locale$/,
|
|
151
|
+
contextRegExp: /moment$/
|
|
152
|
+
}))
|
|
153
|
+
|
|
154
|
+
config.plugins.push(
|
|
155
|
+
// new CopyPlugin({
|
|
156
|
+
// patterns: [{ from: 'node_modules/amis/sdk', to: 'amis/sdk' }],
|
|
157
|
+
// })
|
|
158
|
+
)
|
|
159
|
+
|
|
160
|
+
// 生产环境下将资源压缩成gzip格式
|
|
161
|
+
if (isProd) {
|
|
162
|
+
// add `CompressionWebpack` plugin to webpack plugins
|
|
163
|
+
config.plugins.push(new CompressionWebpackPlugin({
|
|
164
|
+
algorithm: 'gzip',
|
|
165
|
+
test: new RegExp('\\.(' + productionGzipExtensions.join('|') + ')$'),
|
|
166
|
+
threshold: 10240,
|
|
167
|
+
minRatio: 0.8
|
|
168
|
+
}))
|
|
169
|
+
}
|
|
170
|
+
// if prod, add externals
|
|
171
|
+
// if (isProd) {
|
|
172
|
+
// config.externals = assetsCDN.externals
|
|
173
|
+
// }
|
|
174
|
+
},
|
|
175
|
+
chainWebpack: config => {
|
|
176
|
+
// 生产环境下关闭css压缩的 colormin 项,因为此项优化与主题色替换功能冲突
|
|
177
|
+
if (isProd) {
|
|
178
|
+
config.optimization.minimizer('css').use(CssMinimizerPlugin, [{
|
|
179
|
+
minimizerOptions: {
|
|
180
|
+
preset: [
|
|
181
|
+
'default',
|
|
182
|
+
{
|
|
183
|
+
discardComments: { removeAll: true },
|
|
184
|
+
colormin: false,
|
|
185
|
+
}
|
|
186
|
+
],
|
|
187
|
+
ignoreOrder: true
|
|
188
|
+
}
|
|
189
|
+
}])
|
|
190
|
+
}
|
|
191
|
+
config.resolve.alias.set('@vue2-client', path.resolve(__dirname, 'src'))
|
|
192
|
+
},
|
|
193
|
+
css: {
|
|
194
|
+
extract: !isProd
|
|
195
|
+
? {
|
|
196
|
+
filename: 'css/[name].css',
|
|
197
|
+
chunkFilename: 'css/[name].css',
|
|
198
|
+
}
|
|
199
|
+
: true,
|
|
200
|
+
loaderOptions: {
|
|
201
|
+
less: {
|
|
202
|
+
lessOptions: {
|
|
203
|
+
modifyVars: modifyVars(),
|
|
204
|
+
javascriptEnabled: true
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
sass: {}
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
publicPath: process.env.VUE_APP_PUBLIC_PATH,
|
|
211
|
+
outputDir: 'dist',
|
|
212
|
+
assetsDir: 'static',
|
|
213
|
+
productionSourceMap: false
|
|
214
|
+
}
|