vue2-client 1.2.50 → 1.2.51
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 +134 -130
- package/package.json +2 -1
- package/src/base-client/all.js +61 -61
- package/src/base-client/components/common/AmapMarker/AmapPointRendering.vue +13 -11
- package/src/base-client/components/common/AmapMarker/index.js +3 -3
- package/src/base-client/components/common/ScrollList/SrcollList.vue +113 -113
- package/src/base-client/components/common/ScrollList/index.js +3 -3
- package/src/base-client/components/common/XAddForm/XAddForm.vue +339 -339
- package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +316 -316
- package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsException.vue +57 -57
- package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsRead.vue +131 -131
- package/src/base-client/components/ticket/TicketSubmitSuccessView/TicketSubmitSuccessView.vue +532 -532
- package/src/router/async/config.async.js +26 -26
- package/src/router/index.js +27 -27
- package/src/theme/default/style.less +47 -47
- package/src/utils/map-utils.js +2 -1
- package/vue.config.js +143 -143
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import routerMap from './router.map'
|
|
2
|
-
import { parseRoutes } from '@vue2-client/utils/routerUtil'
|
|
3
|
-
|
|
4
|
-
// 异步路由配置
|
|
5
|
-
const routesConfig = [
|
|
6
|
-
'login',
|
|
7
|
-
'submitTicket',
|
|
8
|
-
'root',
|
|
9
|
-
{
|
|
10
|
-
router: 'exp404',
|
|
11
|
-
path: '*',
|
|
12
|
-
name: '404'
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
router: 'exp403',
|
|
16
|
-
path: '/403',
|
|
17
|
-
name: '403'
|
|
18
|
-
}
|
|
19
|
-
]
|
|
20
|
-
|
|
21
|
-
const options = {
|
|
22
|
-
mode: 'history',
|
|
23
|
-
routes: parseRoutes(routesConfig, routerMap)
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export default options
|
|
1
|
+
import routerMap from './router.map'
|
|
2
|
+
import { parseRoutes } from '@vue2-client/utils/routerUtil'
|
|
3
|
+
|
|
4
|
+
// 异步路由配置
|
|
5
|
+
const routesConfig = [
|
|
6
|
+
'login',
|
|
7
|
+
'submitTicket',
|
|
8
|
+
'root',
|
|
9
|
+
{
|
|
10
|
+
router: 'exp404',
|
|
11
|
+
path: '*',
|
|
12
|
+
name: '404'
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
router: 'exp403',
|
|
16
|
+
path: '/403',
|
|
17
|
+
name: '403'
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
const options = {
|
|
22
|
+
mode: 'history',
|
|
23
|
+
routes: parseRoutes(routesConfig, routerMap)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default options
|
package/src/router/index.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { formatRoutes } from '@vue2-client/utils/routerUtil'
|
|
2
|
-
|
|
3
|
-
// 不需要登录拦截的路由配置
|
|
4
|
-
const loginIgnore = {
|
|
5
|
-
names: ['404', '403'], // 根据路由名称匹配
|
|
6
|
-
paths: ['/login', '/submitTicket'], // 根据路由fullPath匹配
|
|
7
|
-
/**
|
|
8
|
-
* 判断路由是否包含在该配置中
|
|
9
|
-
* @param route vue-router 的 route 对象
|
|
10
|
-
* @returns {boolean}
|
|
11
|
-
*/
|
|
12
|
-
includes (route) {
|
|
13
|
-
return this.names.includes(route.name) || this.paths.includes(route.path)
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* 初始化路由实例
|
|
19
|
-
* @param isAsync 是否异步路由模式
|
|
20
|
-
* @returns {RouterOptions}
|
|
21
|
-
*/
|
|
22
|
-
function initRouter (isAsync) {
|
|
23
|
-
const options = require('./async/config.async').default
|
|
24
|
-
formatRoutes(options.routes)
|
|
25
|
-
return options
|
|
26
|
-
}
|
|
27
|
-
export { loginIgnore, initRouter }
|
|
1
|
+
import { formatRoutes } from '@vue2-client/utils/routerUtil'
|
|
2
|
+
|
|
3
|
+
// 不需要登录拦截的路由配置
|
|
4
|
+
const loginIgnore = {
|
|
5
|
+
names: ['404', '403'], // 根据路由名称匹配
|
|
6
|
+
paths: ['/login', '/submitTicket'], // 根据路由fullPath匹配
|
|
7
|
+
/**
|
|
8
|
+
* 判断路由是否包含在该配置中
|
|
9
|
+
* @param route vue-router 的 route 对象
|
|
10
|
+
* @returns {boolean}
|
|
11
|
+
*/
|
|
12
|
+
includes (route) {
|
|
13
|
+
return this.names.includes(route.name) || this.paths.includes(route.path)
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* 初始化路由实例
|
|
19
|
+
* @param isAsync 是否异步路由模式
|
|
20
|
+
* @returns {RouterOptions}
|
|
21
|
+
*/
|
|
22
|
+
function initRouter (isAsync) {
|
|
23
|
+
const options = require('./async/config.async').default
|
|
24
|
+
formatRoutes(options.routes)
|
|
25
|
+
return options
|
|
26
|
+
}
|
|
27
|
+
export { loginIgnore, initRouter }
|
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
.week-mode{
|
|
2
|
-
overflow: hidden;
|
|
3
|
-
filter: invert(80%);
|
|
4
|
-
}
|
|
5
|
-
.beauty-scroll{
|
|
6
|
-
scrollbar-color: @primary-color @primary-2;
|
|
7
|
-
scrollbar-width: thin;
|
|
8
|
-
-ms-overflow-style:none;
|
|
9
|
-
position: relative;
|
|
10
|
-
&::-webkit-scrollbar{
|
|
11
|
-
width: 3px;
|
|
12
|
-
height: 1px;
|
|
13
|
-
}
|
|
14
|
-
&::-webkit-scrollbar-thumb {
|
|
15
|
-
border-radius: 3px;
|
|
16
|
-
background: @primary-color;
|
|
17
|
-
}
|
|
18
|
-
&::-webkit-scrollbar-track {
|
|
19
|
-
-webkit-box-shadow: inset 0 0 1px rgba(0,0,0,0);
|
|
20
|
-
border-radius: 3px;
|
|
21
|
-
background: @primary-3;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
.split-right{
|
|
25
|
-
&:not(:last-child) {
|
|
26
|
-
border-right: 1px solid rgba(98, 98, 98, 0.2);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
.disabled{
|
|
30
|
-
cursor: not-allowed;
|
|
31
|
-
color: @disabled-color;
|
|
32
|
-
pointer-events: none;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
::-webkit-scrollbar{
|
|
36
|
-
width: 5px;
|
|
37
|
-
height: 5px;
|
|
38
|
-
}
|
|
39
|
-
::-webkit-scrollbar-thumb {
|
|
40
|
-
border-radius: 3px;
|
|
41
|
-
background: @primary-3;
|
|
42
|
-
}
|
|
43
|
-
::-webkit-scrollbar-track {
|
|
44
|
-
-webkit-box-shadow: inset 0 0 1px rgba(0,0,0,0);
|
|
45
|
-
border-radius: 3px;
|
|
46
|
-
background: @primary-1;
|
|
47
|
-
}
|
|
1
|
+
.week-mode{
|
|
2
|
+
overflow: hidden;
|
|
3
|
+
filter: invert(80%);
|
|
4
|
+
}
|
|
5
|
+
.beauty-scroll{
|
|
6
|
+
scrollbar-color: @primary-color @primary-2;
|
|
7
|
+
scrollbar-width: thin;
|
|
8
|
+
-ms-overflow-style:none;
|
|
9
|
+
position: relative;
|
|
10
|
+
&::-webkit-scrollbar{
|
|
11
|
+
width: 3px;
|
|
12
|
+
height: 1px;
|
|
13
|
+
}
|
|
14
|
+
&::-webkit-scrollbar-thumb {
|
|
15
|
+
border-radius: 3px;
|
|
16
|
+
background: @primary-color;
|
|
17
|
+
}
|
|
18
|
+
&::-webkit-scrollbar-track {
|
|
19
|
+
-webkit-box-shadow: inset 0 0 1px rgba(0,0,0,0);
|
|
20
|
+
border-radius: 3px;
|
|
21
|
+
background: @primary-3;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
.split-right{
|
|
25
|
+
&:not(:last-child) {
|
|
26
|
+
border-right: 1px solid rgba(98, 98, 98, 0.2);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
.disabled{
|
|
30
|
+
cursor: not-allowed;
|
|
31
|
+
color: @disabled-color;
|
|
32
|
+
pointer-events: none;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
::-webkit-scrollbar{
|
|
36
|
+
width: 5px;
|
|
37
|
+
height: 5px;
|
|
38
|
+
}
|
|
39
|
+
::-webkit-scrollbar-thumb {
|
|
40
|
+
border-radius: 3px;
|
|
41
|
+
background: @primary-3;
|
|
42
|
+
}
|
|
43
|
+
::-webkit-scrollbar-track {
|
|
44
|
+
-webkit-box-shadow: inset 0 0 1px rgba(0,0,0,0);
|
|
45
|
+
border-radius: 3px;
|
|
46
|
+
background: @primary-1;
|
|
47
|
+
}
|
package/src/utils/map-utils.js
CHANGED
|
@@ -12,7 +12,8 @@ async function GetGDMap () {
|
|
|
12
12
|
}
|
|
13
13
|
async function GetLocation (address) {
|
|
14
14
|
return new Promise(async (resolve, reject) => {
|
|
15
|
-
|
|
15
|
+
const aMap = GetGDMap()
|
|
16
|
+
new (aMap).Geocoder({
|
|
16
17
|
radius: 500 // 范围,默认:500
|
|
17
18
|
}).getLocation(address, function (status, result) {
|
|
18
19
|
console.log(result)
|
package/vue.config.js
CHANGED
|
@@ -1,143 +1,143 @@
|
|
|
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
|
-
|
|
8
|
-
const productionGzipExtensions = ['js', 'css']
|
|
9
|
-
const isProd = process.env.NODE_ENV === 'production'
|
|
10
|
-
|
|
11
|
-
// const assetsCDN = {
|
|
12
|
-
// // webpack build externals
|
|
13
|
-
// externals: {
|
|
14
|
-
// vue: 'Vue',
|
|
15
|
-
// 'vue-router': 'VueRouter',
|
|
16
|
-
// vuex: 'Vuex',
|
|
17
|
-
// axios: 'axios',
|
|
18
|
-
// nprogress: 'NProgress',
|
|
19
|
-
// clipboard: 'ClipboardJS',
|
|
20
|
-
// '@antv/data-set': 'DataSet',
|
|
21
|
-
// 'js-cookie': 'Cookies'
|
|
22
|
-
// },
|
|
23
|
-
// css: [
|
|
24
|
-
// ],
|
|
25
|
-
// js: [
|
|
26
|
-
// '//cdn.jsdelivr.net/npm/vue@2.6.11/dist/vue.min.js',
|
|
27
|
-
// '//cdn.jsdelivr.net/npm/vue-router@3.3.4/dist/vue-router.min.js',
|
|
28
|
-
// '//cdn.jsdelivr.net/npm/vuex@3.4.0/dist/vuex.min.js',
|
|
29
|
-
// '//cdn.jsdelivr.net/npm/axios@0.19.2/dist/axios.min.js',
|
|
30
|
-
// '//cdn.jsdelivr.net/npm/nprogress@0.2.0/nprogress.min.js',
|
|
31
|
-
// '//cdn.jsdelivr.net/npm/clipboard@2.0.6/dist/clipboard.min.js',
|
|
32
|
-
// '//cdn.jsdelivr.net/npm/@antv/data-set@0.11.4/build/data-set.min.js',
|
|
33
|
-
// '//cdn.jsdelivr.net/npm/js-cookie@2.2.1/src/js.cookie.min.js'
|
|
34
|
-
// ]
|
|
35
|
-
// }
|
|
36
|
-
|
|
37
|
-
const server = 'http://121.36.106.17:8400'
|
|
38
|
-
// const local = 'http://localhost:8445/webmeter'
|
|
39
|
-
const local = 'http://123.60.214.109:8405/webmeter'
|
|
40
|
-
|
|
41
|
-
module.exports = {
|
|
42
|
-
devServer: {
|
|
43
|
-
// development server port 8000
|
|
44
|
-
port: 8001,
|
|
45
|
-
// If you want to turn on the proxy, please remove the mockjs /src/main.jsL11
|
|
46
|
-
proxy: {
|
|
47
|
-
'/rs': {
|
|
48
|
-
target: server,
|
|
49
|
-
ws: false,
|
|
50
|
-
changeOrigin: true
|
|
51
|
-
},
|
|
52
|
-
'/image': {
|
|
53
|
-
target: server,
|
|
54
|
-
ws: false,
|
|
55
|
-
changeOrigin: true
|
|
56
|
-
},
|
|
57
|
-
'/webapps': {
|
|
58
|
-
target: server,
|
|
59
|
-
ws: false,
|
|
60
|
-
changeOrigin: true
|
|
61
|
-
},
|
|
62
|
-
'/webmeterapi': {
|
|
63
|
-
pathRewrite: { '^/webmeterapi': '/rs/logic' },
|
|
64
|
-
target: local,
|
|
65
|
-
changeOrigin: true
|
|
66
|
-
},
|
|
67
|
-
'/webmeteruploadapi': {
|
|
68
|
-
pathRewrite: { '^/webmeteruploadapi': '/rs/file' },
|
|
69
|
-
target: local,
|
|
70
|
-
changeOrigin: true
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
pluginOptions: {
|
|
75
|
-
'style-resources-loader': {
|
|
76
|
-
preProcessor: 'less',
|
|
77
|
-
patterns: [path.resolve(__dirname, './src/theme/theme.less')]
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
configureWebpack: config => {
|
|
81
|
-
config.entry.app = ['babel-polyfill', 'whatwg-fetch', './src/main.js']
|
|
82
|
-
config.performance = {
|
|
83
|
-
hints: false
|
|
84
|
-
}
|
|
85
|
-
config.plugins.push(
|
|
86
|
-
new ThemeColorReplacer({
|
|
87
|
-
fileName: 'css/theme-colors-[contenthash:8].css',
|
|
88
|
-
matchColors: getThemeColors(),
|
|
89
|
-
injectCss: true,
|
|
90
|
-
resolveCss
|
|
91
|
-
})
|
|
92
|
-
)
|
|
93
|
-
// Ignore all locale files of moment.js
|
|
94
|
-
config.plugins.push(new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/))
|
|
95
|
-
// 生产环境下将资源压缩成gzip格式
|
|
96
|
-
if (isProd) {
|
|
97
|
-
// add `CompressionWebpack` plugin to webpack plugins
|
|
98
|
-
config.plugins.push(new CompressionWebpackPlugin({
|
|
99
|
-
algorithm: 'gzip',
|
|
100
|
-
test: new RegExp('\\.(' + productionGzipExtensions.join('|') + ')$'),
|
|
101
|
-
threshold: 10240,
|
|
102
|
-
minRatio: 0.8
|
|
103
|
-
}))
|
|
104
|
-
}
|
|
105
|
-
// if prod, add externals
|
|
106
|
-
// if (isProd) {
|
|
107
|
-
// config.externals = assetsCDN.externals
|
|
108
|
-
// }
|
|
109
|
-
},
|
|
110
|
-
chainWebpack: config => {
|
|
111
|
-
// 生产环境下关闭css压缩的 colormin 项,因为此项优化与主题色替换功能冲突
|
|
112
|
-
if (isProd) {
|
|
113
|
-
config.plugin('optimize-css')
|
|
114
|
-
.tap(args => {
|
|
115
|
-
args[0].cssnanoOptions.preset[1].colormin = false
|
|
116
|
-
return args
|
|
117
|
-
})
|
|
118
|
-
}
|
|
119
|
-
// 生产环境下使用CDN
|
|
120
|
-
// if (isProd) {
|
|
121
|
-
// config.plugin('html')
|
|
122
|
-
// .tap(args => {
|
|
123
|
-
// args[0].cdn = assetsCDN
|
|
124
|
-
// return args
|
|
125
|
-
// })
|
|
126
|
-
// }
|
|
127
|
-
config.resolve.alias.set('@vue2-client', path.resolve(__dirname, 'src'))
|
|
128
|
-
},
|
|
129
|
-
css: {
|
|
130
|
-
loaderOptions: {
|
|
131
|
-
less: {
|
|
132
|
-
lessOptions: {
|
|
133
|
-
modifyVars: modifyVars(),
|
|
134
|
-
javascriptEnabled: true
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
},
|
|
139
|
-
publicPath: process.env.VUE_APP_PUBLIC_PATH,
|
|
140
|
-
outputDir: 'dist',
|
|
141
|
-
assetsDir: 'static',
|
|
142
|
-
productionSourceMap: false
|
|
143
|
-
}
|
|
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
|
+
|
|
8
|
+
const productionGzipExtensions = ['js', 'css']
|
|
9
|
+
const isProd = process.env.NODE_ENV === 'production'
|
|
10
|
+
|
|
11
|
+
// const assetsCDN = {
|
|
12
|
+
// // webpack build externals
|
|
13
|
+
// externals: {
|
|
14
|
+
// vue: 'Vue',
|
|
15
|
+
// 'vue-router': 'VueRouter',
|
|
16
|
+
// vuex: 'Vuex',
|
|
17
|
+
// axios: 'axios',
|
|
18
|
+
// nprogress: 'NProgress',
|
|
19
|
+
// clipboard: 'ClipboardJS',
|
|
20
|
+
// '@antv/data-set': 'DataSet',
|
|
21
|
+
// 'js-cookie': 'Cookies'
|
|
22
|
+
// },
|
|
23
|
+
// css: [
|
|
24
|
+
// ],
|
|
25
|
+
// js: [
|
|
26
|
+
// '//cdn.jsdelivr.net/npm/vue@2.6.11/dist/vue.min.js',
|
|
27
|
+
// '//cdn.jsdelivr.net/npm/vue-router@3.3.4/dist/vue-router.min.js',
|
|
28
|
+
// '//cdn.jsdelivr.net/npm/vuex@3.4.0/dist/vuex.min.js',
|
|
29
|
+
// '//cdn.jsdelivr.net/npm/axios@0.19.2/dist/axios.min.js',
|
|
30
|
+
// '//cdn.jsdelivr.net/npm/nprogress@0.2.0/nprogress.min.js',
|
|
31
|
+
// '//cdn.jsdelivr.net/npm/clipboard@2.0.6/dist/clipboard.min.js',
|
|
32
|
+
// '//cdn.jsdelivr.net/npm/@antv/data-set@0.11.4/build/data-set.min.js',
|
|
33
|
+
// '//cdn.jsdelivr.net/npm/js-cookie@2.2.1/src/js.cookie.min.js'
|
|
34
|
+
// ]
|
|
35
|
+
// }
|
|
36
|
+
|
|
37
|
+
const server = 'http://121.36.106.17:8400'
|
|
38
|
+
// const local = 'http://localhost:8445/webmeter'
|
|
39
|
+
const local = 'http://123.60.214.109:8405/webmeter'
|
|
40
|
+
|
|
41
|
+
module.exports = {
|
|
42
|
+
devServer: {
|
|
43
|
+
// development server port 8000
|
|
44
|
+
port: 8001,
|
|
45
|
+
// If you want to turn on the proxy, please remove the mockjs /src/main.jsL11
|
|
46
|
+
proxy: {
|
|
47
|
+
'/rs': {
|
|
48
|
+
target: server,
|
|
49
|
+
ws: false,
|
|
50
|
+
changeOrigin: true
|
|
51
|
+
},
|
|
52
|
+
'/image': {
|
|
53
|
+
target: server,
|
|
54
|
+
ws: false,
|
|
55
|
+
changeOrigin: true
|
|
56
|
+
},
|
|
57
|
+
'/webapps': {
|
|
58
|
+
target: server,
|
|
59
|
+
ws: false,
|
|
60
|
+
changeOrigin: true
|
|
61
|
+
},
|
|
62
|
+
'/webmeterapi': {
|
|
63
|
+
pathRewrite: { '^/webmeterapi': '/rs/logic' },
|
|
64
|
+
target: local,
|
|
65
|
+
changeOrigin: true
|
|
66
|
+
},
|
|
67
|
+
'/webmeteruploadapi': {
|
|
68
|
+
pathRewrite: { '^/webmeteruploadapi': '/rs/file' },
|
|
69
|
+
target: local,
|
|
70
|
+
changeOrigin: true
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
pluginOptions: {
|
|
75
|
+
'style-resources-loader': {
|
|
76
|
+
preProcessor: 'less',
|
|
77
|
+
patterns: [path.resolve(__dirname, './src/theme/theme.less')]
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
configureWebpack: config => {
|
|
81
|
+
config.entry.app = ['babel-polyfill', 'whatwg-fetch', './src/main.js']
|
|
82
|
+
config.performance = {
|
|
83
|
+
hints: false
|
|
84
|
+
}
|
|
85
|
+
config.plugins.push(
|
|
86
|
+
new ThemeColorReplacer({
|
|
87
|
+
fileName: 'css/theme-colors-[contenthash:8].css',
|
|
88
|
+
matchColors: getThemeColors(),
|
|
89
|
+
injectCss: true,
|
|
90
|
+
resolveCss
|
|
91
|
+
})
|
|
92
|
+
)
|
|
93
|
+
// Ignore all locale files of moment.js
|
|
94
|
+
config.plugins.push(new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/))
|
|
95
|
+
// 生产环境下将资源压缩成gzip格式
|
|
96
|
+
if (isProd) {
|
|
97
|
+
// add `CompressionWebpack` plugin to webpack plugins
|
|
98
|
+
config.plugins.push(new CompressionWebpackPlugin({
|
|
99
|
+
algorithm: 'gzip',
|
|
100
|
+
test: new RegExp('\\.(' + productionGzipExtensions.join('|') + ')$'),
|
|
101
|
+
threshold: 10240,
|
|
102
|
+
minRatio: 0.8
|
|
103
|
+
}))
|
|
104
|
+
}
|
|
105
|
+
// if prod, add externals
|
|
106
|
+
// if (isProd) {
|
|
107
|
+
// config.externals = assetsCDN.externals
|
|
108
|
+
// }
|
|
109
|
+
},
|
|
110
|
+
chainWebpack: config => {
|
|
111
|
+
// 生产环境下关闭css压缩的 colormin 项,因为此项优化与主题色替换功能冲突
|
|
112
|
+
if (isProd) {
|
|
113
|
+
config.plugin('optimize-css')
|
|
114
|
+
.tap(args => {
|
|
115
|
+
args[0].cssnanoOptions.preset[1].colormin = false
|
|
116
|
+
return args
|
|
117
|
+
})
|
|
118
|
+
}
|
|
119
|
+
// 生产环境下使用CDN
|
|
120
|
+
// if (isProd) {
|
|
121
|
+
// config.plugin('html')
|
|
122
|
+
// .tap(args => {
|
|
123
|
+
// args[0].cdn = assetsCDN
|
|
124
|
+
// return args
|
|
125
|
+
// })
|
|
126
|
+
// }
|
|
127
|
+
config.resolve.alias.set('@vue2-client', path.resolve(__dirname, 'src'))
|
|
128
|
+
},
|
|
129
|
+
css: {
|
|
130
|
+
loaderOptions: {
|
|
131
|
+
less: {
|
|
132
|
+
lessOptions: {
|
|
133
|
+
modifyVars: modifyVars(),
|
|
134
|
+
javascriptEnabled: true
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
publicPath: process.env.VUE_APP_PUBLIC_PATH,
|
|
140
|
+
outputDir: 'dist',
|
|
141
|
+
assetsDir: 'static',
|
|
142
|
+
productionSourceMap: false
|
|
143
|
+
}
|