vue2-client 1.5.13 → 1.5.15

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.
Files changed (112) hide show
  1. package/CHANGELOG.md +513 -504
  2. package/index.js +30 -30
  3. package/package.json +78 -78
  4. package/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox.vue +225 -225
  5. package/src/base-client/components/common/CreateQuery/CreateQuery.vue +667 -667
  6. package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +713 -713
  7. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQuery.vue +457 -457
  8. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQueryItem.vue +508 -508
  9. package/src/base-client/components/common/FormGroupEdit/FormGroupEdit.vue +140 -140
  10. package/src/base-client/components/common/FormGroupQuery/FormGroupQuery.vue +165 -165
  11. package/src/base-client/components/common/JSONToTree/jsontotree.vue +275 -275
  12. package/src/base-client/components/common/XAddForm/XAddForm.vue +316 -316
  13. package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +278 -277
  14. package/src/base-client/components/common/XCard/XCard.vue +64 -64
  15. package/src/base-client/components/common/XForm/XForm.vue +185 -185
  16. package/src/base-client/components/common/XForm/XFormItem.vue +502 -485
  17. package/src/base-client/components/common/XForm/index.md +177 -177
  18. package/src/base-client/components/common/XFormTable/XFormTable.vue +325 -324
  19. package/src/base-client/components/common/XFormTable/index.md +96 -96
  20. package/src/base-client/components/common/XTable/XTable.vue +505 -505
  21. package/src/base-client/components/common/XTreeOne/XTreeOne.vue +109 -109
  22. package/src/base-client/components/system/QueryParamsDetailsView/QueryParamsDetailsView.vue +281 -281
  23. package/src/base-client/components/ticket/TicketDetailsView/TicketDetailsView.vue +807 -807
  24. package/src/base-client/components/ticket/TicketDetailsView/index.md +29 -29
  25. package/src/base-client/components/ticket/TicketDetailsView/part/TicketDetailsFlow.vue +260 -260
  26. package/src/base-client/components/ticket/TicketSubmitSuccessView/TicketSubmitSuccessView.vue +532 -532
  27. package/src/base-client/components/ticket/TicketSubmitSuccessView/index.md +29 -29
  28. package/src/base-client/plugins/AppData.js +70 -70
  29. package/src/base-client/plugins/GetLoginInfoService.js +179 -179
  30. package/src/base-client/plugins/PagedList.js +177 -177
  31. package/src/base-client/plugins/compatible/LoginServiceOA.js +20 -20
  32. package/src/base-client/plugins/i18n-extend.js +32 -32
  33. package/src/components/Ellipsis/Ellipsis.vue +65 -65
  34. package/src/components/Ellipsis/index.md +38 -38
  35. package/src/components/NumberInfo/index.md +43 -43
  36. package/src/components/STable/README.md +341 -341
  37. package/src/components/STable/index.js +318 -318
  38. package/src/components/Trend/index.md +45 -45
  39. package/src/components/checkbox/ColorCheckbox.vue +157 -157
  40. package/src/components/checkbox/ImgCheckbox.vue +163 -163
  41. package/src/components/exception/ExceptionPage.vue +70 -70
  42. package/src/components/form/FormRow.vue +52 -52
  43. package/src/components/index.js +36 -36
  44. package/src/components/menu/SideMenu.vue +62 -62
  45. package/src/components/menu/menu.js +273 -273
  46. package/src/components/page/header/index.less +40 -40
  47. package/src/components/setting/Setting.vue +235 -235
  48. package/src/components/table/StandardTable.vue +141 -141
  49. package/src/components/table/advance/ActionColumns.vue +158 -158
  50. package/src/components/table/advance/SearchArea.vue +355 -355
  51. package/src/components/tool/AStepItem.vue +60 -60
  52. package/src/components/tool/AvatarList.vue +68 -68
  53. package/src/components/tool/Drawer.vue +142 -142
  54. package/src/components/tool/TagSelect.vue +83 -83
  55. package/src/components/transition/PageToggleTransition.vue +97 -97
  56. package/src/config/CreateQueryConfig.js +307 -307
  57. package/src/config/default/admin.config.js +18 -18
  58. package/src/config/default/setting.config.js +44 -44
  59. package/src/config/replacer/resolve.config.js +67 -67
  60. package/src/layouts/AdminLayout.vue +174 -174
  61. package/src/layouts/CommonLayout.vue +42 -42
  62. package/src/layouts/ComponentLayoutOne.vue +47 -47
  63. package/src/layouts/PageLayout.vue +151 -151
  64. package/src/layouts/SinglePageView.vue +111 -111
  65. package/src/layouts/footer/PageFooter.vue +49 -49
  66. package/src/layouts/header/AdminHeader.vue +104 -104
  67. package/src/layouts/header/HeaderAvatar.vue +61 -61
  68. package/src/layouts/header/HeaderNotice.vue +176 -176
  69. package/src/layouts/header/HeaderSearch.vue +67 -67
  70. package/src/layouts/header/InstitutionDetail.vue +181 -181
  71. package/src/layouts/header/index.less +92 -92
  72. package/src/layouts/tabs/TabsHead.vue +190 -190
  73. package/src/layouts/tabs/TabsView.vue +379 -379
  74. package/src/mock/goods/index.js +108 -108
  75. package/src/pages/exception/404.vue +25 -25
  76. package/src/pages/login/Login.vue +363 -363
  77. package/src/pages/report/ReportTable.js +124 -124
  78. package/src/pages/report/ReportTableHome.vue +28 -28
  79. package/src/pages/resourceManage/orgListManage.vue +98 -98
  80. package/src/pages/system/dictionary/index.vue +43 -43
  81. package/src/pages/system/file/index.vue +317 -317
  82. package/src/pages/system/monitor/loginInfor/index.vue +36 -36
  83. package/src/pages/system/monitor/operLog/index.vue +36 -36
  84. package/src/pages/system/queryParams/index.vue +43 -43
  85. package/src/router/async/config.async.js +27 -27
  86. package/src/router/async/router.map.js +68 -68
  87. package/src/router/guards.js +113 -113
  88. package/src/router/index.js +27 -27
  89. package/src/services/api/DictionaryDetailsViewApi.js +6 -6
  90. package/src/services/api/LogDetailsViewApi.js +10 -10
  91. package/src/services/api/QueryParamsDetailsViewApi.js +6 -6
  92. package/src/services/api/TicketDetailsViewApi.js +34 -34
  93. package/src/services/api/cas.js +79 -79
  94. package/src/services/api/commonTempTable.js +10 -10
  95. package/src/services/api/index.js +17 -17
  96. package/src/services/api/logininfor/index.js +6 -6
  97. package/src/services/api/manage.js +8 -8
  98. package/src/services/apiService.js +13 -13
  99. package/src/services/user.js +53 -53
  100. package/src/store/modules/index.js +4 -4
  101. package/src/theme/default/nprogress.less +76 -76
  102. package/src/theme/default/style.less +47 -47
  103. package/src/utils/colors.js +107 -107
  104. package/src/utils/excel/Blob.js +180 -180
  105. package/src/utils/excel/Export2Excel.js +141 -141
  106. package/src/utils/formatter.js +68 -68
  107. package/src/utils/i18n.js +80 -80
  108. package/src/utils/indexedDB.js +145 -145
  109. package/src/utils/theme-color-replacer-extend.js +91 -91
  110. package/src/utils/themeUtil.js +100 -100
  111. package/src/utils/util.js +230 -230
  112. package/vue.config.js +106 -106
package/src/utils/util.js CHANGED
@@ -1,230 +1,230 @@
1
- import enquireJs from 'enquire.js'
2
-
3
- const timeList = [
4
- {
5
- CN: '早上好',
6
- HK: '早晨啊',
7
- US: 'Good morning'
8
- }, {
9
- CN: '上午好',
10
- HK: '上午好',
11
- US: 'Good morning'
12
- }, {
13
- CN: '中午好',
14
- HK: '中午好',
15
- US: 'Good afternoon'
16
- }, {
17
- CN: '下午好',
18
- HK: '下午好',
19
- US: 'Good afternoon'
20
- }, {
21
- CN: '晚上好',
22
- HK: '晚上好',
23
- US: 'Good evening'
24
- }
25
- ]
26
- /**
27
- * 数组去空值
28
- */
29
- export function arrRemoveEmpty (arr) {
30
- for (let i = 0; i < arr.length; i++) {
31
- if (arr[i] === '' || typeof (arr[i]) == 'undefined') {
32
- arr.splice(i, 1)
33
- i--
34
- }
35
- }
36
- return arr
37
- }
38
-
39
- export function isDef (v) {
40
- return v !== undefined && v !== null
41
- }
42
-
43
- export function formatDate (dateStr, fmt) {
44
- if (dateStr == null) {
45
- return '--'
46
- }
47
- let date
48
- if (dateStr === 'now') {
49
- date = new Date()
50
- } else {
51
- date = new Date(dateStr)
52
- }
53
- const o = {
54
- 'M+': date.getMonth() + 1,
55
- 'd+': date.getDate(),
56
- 'h+': date.getHours(),
57
- 'm+': date.getMinutes(),
58
- 's+': date.getSeconds(),
59
- 'q+': Math.floor((date.getMonth() + 3) / 3),
60
- 'S': date.getMilliseconds()
61
- }
62
- if (!fmt) {
63
- fmt = 'yyyy-MM-dd hh:mm:ss'
64
- }
65
- if (/(y+)/.test(fmt)) {
66
- fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length))
67
- }
68
- for (const k in o) {
69
- if (new RegExp('(' + k + ')').test(fmt)) {
70
- fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
71
- }
72
- }
73
- return fmt
74
- }
75
-
76
- export function uuid () {
77
- return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
78
- const r = Math.random() * 16 | 0
79
- const v = c === 'x' ? r : (r & 0x3 | 0x8)
80
- return v.toString(16)
81
- })
82
- }
83
-
84
- export function timeCompare (date1, date2) {
85
- const date11 = new Date(date1)
86
- const date22 = new Date(date2)
87
- return date11.time > date22.time ? 1 : -1
88
- }
89
-
90
- export function timeFix () {
91
- const time = new Date()
92
- const hour = time.getHours()
93
- return hour < 9
94
- ? timeList[0] : (hour <= 11 ? timeList[1] : (hour <= 13 ? timeList[2] : (hour <= 20 ? timeList[3] : timeList[4])))
95
- }
96
-
97
- /**
98
- * Remove an item from an array.
99
- */
100
- export function remove (arr, item) {
101
- if (arr.length) {
102
- const index = arr.indexOf(item)
103
- if (index > -1) {
104
- return arr.splice(index, 1)
105
- }
106
- }
107
- }
108
-
109
- export function isRegExp (v) {
110
- return _toString.call(v) === '[object RegExp]'
111
- }
112
-
113
- export function enquireScreen (call) {
114
- const handler = {
115
- match: function () {
116
- call && call(true)
117
- },
118
- unmatch: function () {
119
- call && call(false)
120
- }
121
- }
122
- enquireJs.register('only screen and (max-width: 767.99px)', handler)
123
- }
124
-
125
- export function showXml (str) {
126
- let text = str
127
-
128
- // 去掉多余的空格
129
- text = '\n' + text.replace(/(<\w+)(\s.*?>)/g, function ($0, name, props) {
130
- return name + props.replace(/\s+(\w+=)/g, ' $1')
131
- }).replace(/>\s*?</g, '>\n<')
132
-
133
- // 把注释编码
134
- text = text.replace(/\n/g, '\r').replace(/<!--(.+?)-->/g, function ($0, text) {
135
- return '<!--' + escape(text) + '-->'
136
- }).replace(/\r/g, '\n')
137
-
138
- // 调整格式
139
- const rgx = /\n(<(([^?]).+?)(?:\s|\s*?>|\s*?(\/)>)(?:.*?(?:(\/)>|<(\/)\2>))?)/mg
140
- const nodeStack = []
141
- const output = text.replace(rgx, function ($0, all, name, isBegin, isCloseFull1, isCloseFull2, isFull1, isFull2) {
142
- const isClosed = (isCloseFull1 === '/') || (isCloseFull2 === '/') || (isFull1 === '/') || (isFull2 === '/')
143
- let prefix
144
- if (isBegin === '!') {
145
- prefix = getPrefix(nodeStack.length)
146
- } else {
147
- if (isBegin !== '/') {
148
- prefix = getPrefix(nodeStack.length)
149
- if (!isClosed) {
150
- nodeStack.push(name)
151
- }
152
- } else {
153
- nodeStack.pop()
154
- prefix = getPrefix(nodeStack.length)
155
- }
156
- }
157
- return '\n' + prefix + all
158
- })
159
- let outputText = output.substring(1)
160
-
161
- // 把注释还原并解码,调格式
162
- outputText = outputText.replace(/\n/g, '\r').replace(/(\s*)<!--(.+?)-->/g, function ($0, prefix, text) {
163
- if (prefix.charAt(0) === '\r') { prefix = prefix.substring(1) }
164
- text = unescape(text).replace(/\r/g, '\n')
165
- return '\n' + prefix + '<!--' + text.replace(/^\s*/mg, prefix) + '-->'
166
- })
167
- // alert(outputText);
168
-
169
- outputText = outputText.replace(/\s+$/g, '').replace(/\r/g, '\r\n')
170
-
171
- return outputText
172
- }
173
-
174
- function getPrefix (prefixIndex) {
175
- const span = ' '
176
- const output = []
177
- for (let i = 0; i < prefixIndex; ++i) {
178
- output.push(span)
179
- }
180
-
181
- return output.join('')
182
- }
183
-
184
- /**
185
- * 构造树型结构数据
186
- * [label,value,children]
187
- */
188
- export function handleTree (data, id, parentId, children) {
189
- const config = {
190
- id: id || 'id',
191
- parentId: parentId || 'parent_id',
192
- childrenList: children || 'children'
193
- }
194
- const childrenListMap = {}
195
- const nodeIds = {}
196
- const tree = []
197
- for (const d of data) {
198
- const parentId = d[config.parentId]
199
- if (childrenListMap[parentId] == null) {
200
- childrenListMap[parentId] = []
201
- }
202
- nodeIds[d[config.id]] = d
203
- childrenListMap[parentId].push(d)
204
- }
205
- for (const d of data) {
206
- const parentId = d[config.parentId]
207
- if (nodeIds[parentId] == null) {
208
- tree.push(d)
209
- }
210
- }
211
- for (const t of tree) {
212
- adaptToChildrenList(t)
213
- }
214
-
215
- function adaptToChildrenList (o) {
216
- o.label = o.name
217
- o.value = o.name
218
- if (childrenListMap[o[config.id]] !== null) {
219
- o[config.childrenList] = childrenListMap[o[config.id]]
220
- }
221
- if (o[config.childrenList]) {
222
- for (const c of o[config.childrenList]) {
223
- adaptToChildrenList(c)
224
- }
225
- }
226
- }
227
- return tree
228
- }
229
-
230
- const _toString = Object.prototype.toString
1
+ import enquireJs from 'enquire.js'
2
+
3
+ const timeList = [
4
+ {
5
+ CN: '早上好',
6
+ HK: '早晨啊',
7
+ US: 'Good morning'
8
+ }, {
9
+ CN: '上午好',
10
+ HK: '上午好',
11
+ US: 'Good morning'
12
+ }, {
13
+ CN: '中午好',
14
+ HK: '中午好',
15
+ US: 'Good afternoon'
16
+ }, {
17
+ CN: '下午好',
18
+ HK: '下午好',
19
+ US: 'Good afternoon'
20
+ }, {
21
+ CN: '晚上好',
22
+ HK: '晚上好',
23
+ US: 'Good evening'
24
+ }
25
+ ]
26
+ /**
27
+ * 数组去空值
28
+ */
29
+ export function arrRemoveEmpty (arr) {
30
+ for (let i = 0; i < arr.length; i++) {
31
+ if (arr[i] === '' || typeof (arr[i]) == 'undefined') {
32
+ arr.splice(i, 1)
33
+ i--
34
+ }
35
+ }
36
+ return arr
37
+ }
38
+
39
+ export function isDef (v) {
40
+ return v !== undefined && v !== null
41
+ }
42
+
43
+ export function formatDate (dateStr, fmt) {
44
+ if (dateStr == null) {
45
+ return '--'
46
+ }
47
+ let date
48
+ if (dateStr === 'now') {
49
+ date = new Date()
50
+ } else {
51
+ date = new Date(dateStr)
52
+ }
53
+ const o = {
54
+ 'M+': date.getMonth() + 1,
55
+ 'd+': date.getDate(),
56
+ 'h+': date.getHours(),
57
+ 'm+': date.getMinutes(),
58
+ 's+': date.getSeconds(),
59
+ 'q+': Math.floor((date.getMonth() + 3) / 3),
60
+ 'S': date.getMilliseconds()
61
+ }
62
+ if (!fmt) {
63
+ fmt = 'yyyy-MM-dd hh:mm:ss'
64
+ }
65
+ if (/(y+)/.test(fmt)) {
66
+ fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length))
67
+ }
68
+ for (const k in o) {
69
+ if (new RegExp('(' + k + ')').test(fmt)) {
70
+ fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
71
+ }
72
+ }
73
+ return fmt
74
+ }
75
+
76
+ export function uuid () {
77
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
78
+ const r = Math.random() * 16 | 0
79
+ const v = c === 'x' ? r : (r & 0x3 | 0x8)
80
+ return v.toString(16)
81
+ })
82
+ }
83
+
84
+ export function timeCompare (date1, date2) {
85
+ const date11 = new Date(date1)
86
+ const date22 = new Date(date2)
87
+ return date11.time > date22.time ? 1 : -1
88
+ }
89
+
90
+ export function timeFix () {
91
+ const time = new Date()
92
+ const hour = time.getHours()
93
+ return hour < 9
94
+ ? timeList[0] : (hour <= 11 ? timeList[1] : (hour <= 13 ? timeList[2] : (hour <= 20 ? timeList[3] : timeList[4])))
95
+ }
96
+
97
+ /**
98
+ * Remove an item from an array.
99
+ */
100
+ export function remove (arr, item) {
101
+ if (arr.length) {
102
+ const index = arr.indexOf(item)
103
+ if (index > -1) {
104
+ return arr.splice(index, 1)
105
+ }
106
+ }
107
+ }
108
+
109
+ export function isRegExp (v) {
110
+ return _toString.call(v) === '[object RegExp]'
111
+ }
112
+
113
+ export function enquireScreen (call) {
114
+ const handler = {
115
+ match: function () {
116
+ call && call(true)
117
+ },
118
+ unmatch: function () {
119
+ call && call(false)
120
+ }
121
+ }
122
+ enquireJs.register('only screen and (max-width: 767.99px)', handler)
123
+ }
124
+
125
+ export function showXml (str) {
126
+ let text = str
127
+
128
+ // 去掉多余的空格
129
+ text = '\n' + text.replace(/(<\w+)(\s.*?>)/g, function ($0, name, props) {
130
+ return name + props.replace(/\s+(\w+=)/g, ' $1')
131
+ }).replace(/>\s*?</g, '>\n<')
132
+
133
+ // 把注释编码
134
+ text = text.replace(/\n/g, '\r').replace(/<!--(.+?)-->/g, function ($0, text) {
135
+ return '<!--' + escape(text) + '-->'
136
+ }).replace(/\r/g, '\n')
137
+
138
+ // 调整格式
139
+ const rgx = /\n(<(([^?]).+?)(?:\s|\s*?>|\s*?(\/)>)(?:.*?(?:(\/)>|<(\/)\2>))?)/mg
140
+ const nodeStack = []
141
+ const output = text.replace(rgx, function ($0, all, name, isBegin, isCloseFull1, isCloseFull2, isFull1, isFull2) {
142
+ const isClosed = (isCloseFull1 === '/') || (isCloseFull2 === '/') || (isFull1 === '/') || (isFull2 === '/')
143
+ let prefix
144
+ if (isBegin === '!') {
145
+ prefix = getPrefix(nodeStack.length)
146
+ } else {
147
+ if (isBegin !== '/') {
148
+ prefix = getPrefix(nodeStack.length)
149
+ if (!isClosed) {
150
+ nodeStack.push(name)
151
+ }
152
+ } else {
153
+ nodeStack.pop()
154
+ prefix = getPrefix(nodeStack.length)
155
+ }
156
+ }
157
+ return '\n' + prefix + all
158
+ })
159
+ let outputText = output.substring(1)
160
+
161
+ // 把注释还原并解码,调格式
162
+ outputText = outputText.replace(/\n/g, '\r').replace(/(\s*)<!--(.+?)-->/g, function ($0, prefix, text) {
163
+ if (prefix.charAt(0) === '\r') { prefix = prefix.substring(1) }
164
+ text = unescape(text).replace(/\r/g, '\n')
165
+ return '\n' + prefix + '<!--' + text.replace(/^\s*/mg, prefix) + '-->'
166
+ })
167
+ // alert(outputText);
168
+
169
+ outputText = outputText.replace(/\s+$/g, '').replace(/\r/g, '\r\n')
170
+
171
+ return outputText
172
+ }
173
+
174
+ function getPrefix (prefixIndex) {
175
+ const span = ' '
176
+ const output = []
177
+ for (let i = 0; i < prefixIndex; ++i) {
178
+ output.push(span)
179
+ }
180
+
181
+ return output.join('')
182
+ }
183
+
184
+ /**
185
+ * 构造树型结构数据
186
+ * [label,value,children]
187
+ */
188
+ export function handleTree (data, id, parentId, children) {
189
+ const config = {
190
+ id: id || 'id',
191
+ parentId: parentId || 'parent_id',
192
+ childrenList: children || 'children'
193
+ }
194
+ const childrenListMap = {}
195
+ const nodeIds = {}
196
+ const tree = []
197
+ for (const d of data) {
198
+ const parentId = d[config.parentId]
199
+ if (childrenListMap[parentId] == null) {
200
+ childrenListMap[parentId] = []
201
+ }
202
+ nodeIds[d[config.id]] = d
203
+ childrenListMap[parentId].push(d)
204
+ }
205
+ for (const d of data) {
206
+ const parentId = d[config.parentId]
207
+ if (nodeIds[parentId] == null) {
208
+ tree.push(d)
209
+ }
210
+ }
211
+ for (const t of tree) {
212
+ adaptToChildrenList(t)
213
+ }
214
+
215
+ function adaptToChildrenList (o) {
216
+ o.label = o.name
217
+ o.value = o.name
218
+ if (childrenListMap[o[config.id]] !== null) {
219
+ o[config.childrenList] = childrenListMap[o[config.id]]
220
+ }
221
+ if (o[config.childrenList]) {
222
+ for (const c of o[config.childrenList]) {
223
+ adaptToChildrenList(c)
224
+ }
225
+ }
226
+ }
227
+ return tree
228
+ }
229
+
230
+ const _toString = Object.prototype.toString
package/vue.config.js CHANGED
@@ -1,106 +1,106 @@
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 server = 'http://61.134.55.234:8405'
12
- // const local = 'http://localhost:8445/webmeter'
13
- const local = 'http://localhost:8445/webmeter'
14
- // const local = 'http://localhost:8080'
15
-
16
- module.exports = {
17
- devServer: {
18
- // development server port 8000
19
- port: 8001,
20
- // If you want to turn on the proxy, please remove the mockjs /src/main.jsL11
21
- proxy: {
22
- '/rs': {
23
- target: server,
24
- ws: false,
25
- changeOrigin: true
26
- },
27
- '/auth': {
28
- pathRewrite: { '^/auth/': '/rs/auth/' },
29
- target: local,
30
- changeOrigin: true
31
- },
32
- '/api': {
33
- pathRewrite: { '^/api/af-system/': '/rs/' },
34
- // pathRewrite: { '^/api': '/' },
35
- target: local,
36
- changeOrigin: true
37
- },
38
- '/resource': {
39
- pathRewrite: { '^/resource': '/' },
40
- target: 'http://127.0.0.1:4789',
41
- changeOrigin: true
42
- }
43
- }
44
- },
45
- pluginOptions: {
46
- 'style-resources-loader': {
47
- preProcessor: 'less',
48
- patterns: [path.resolve(__dirname, './src/theme/theme.less')]
49
- }
50
- },
51
- configureWebpack: config => {
52
- config.entry.app = ['babel-polyfill', 'whatwg-fetch', './src/main.js']
53
- config.performance = {
54
- hints: false
55
- }
56
- config.plugins.push(
57
- new ThemeColorReplacer({
58
- fileName: 'css/theme-colors-[contenthash:8].css',
59
- matchColors: getThemeColors(),
60
- injectCss: true,
61
- resolveCss
62
- })
63
- )
64
- // Ignore all locale files of moment.js
65
- config.plugins.push(new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/))
66
- // 生产环境下将资源压缩成gzip格式
67
- if (isProd) {
68
- // add `CompressionWebpack` plugin to webpack plugins
69
- config.plugins.push(new CompressionWebpackPlugin({
70
- algorithm: 'gzip',
71
- test: new RegExp('\\.(' + productionGzipExtensions.join('|') + ')$'),
72
- threshold: 10240,
73
- minRatio: 0.8
74
- }))
75
- }
76
- // if prod, add externals
77
- // if (isProd) {
78
- // config.externals = assetsCDN.externals
79
- // }
80
- },
81
- chainWebpack: config => {
82
- // 生产环境下关闭css压缩的 colormin 项,因为此项优化与主题色替换功能冲突
83
- if (isProd) {
84
- config.plugin('optimize-css')
85
- .tap(args => {
86
- args[0].cssnanoOptions.preset[1].colormin = false
87
- return args
88
- })
89
- }
90
- config.resolve.alias.set('@vue2-client', path.resolve(__dirname, 'src'))
91
- },
92
- css: {
93
- loaderOptions: {
94
- less: {
95
- lessOptions: {
96
- modifyVars: modifyVars(),
97
- javascriptEnabled: true
98
- }
99
- }
100
- }
101
- },
102
- publicPath: process.env.VUE_APP_PUBLIC_PATH,
103
- outputDir: 'dist',
104
- assetsDir: 'static',
105
- productionSourceMap: false
106
- }
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 server = 'http://61.134.55.234:8405'
12
+ // const local = 'http://localhost:8445/webmeter'
13
+ const local = 'http://localhost:8445/webmeter'
14
+ // const local = 'http://localhost:8080'
15
+
16
+ module.exports = {
17
+ devServer: {
18
+ // development server port 8000
19
+ port: 8001,
20
+ // If you want to turn on the proxy, please remove the mockjs /src/main.jsL11
21
+ proxy: {
22
+ '/rs': {
23
+ target: server,
24
+ ws: false,
25
+ changeOrigin: true
26
+ },
27
+ '/auth': {
28
+ pathRewrite: { '^/auth/': '/rs/auth/' },
29
+ target: local,
30
+ changeOrigin: true
31
+ },
32
+ '/api': {
33
+ pathRewrite: { '^/api/af-system/': '/rs/' },
34
+ // pathRewrite: { '^/api': '/' },
35
+ target: local,
36
+ changeOrigin: true
37
+ },
38
+ '/resource': {
39
+ pathRewrite: { '^/resource': '/' },
40
+ target: 'http://127.0.0.1:4789',
41
+ changeOrigin: true
42
+ }
43
+ }
44
+ },
45
+ pluginOptions: {
46
+ 'style-resources-loader': {
47
+ preProcessor: 'less',
48
+ patterns: [path.resolve(__dirname, './src/theme/theme.less')]
49
+ }
50
+ },
51
+ configureWebpack: config => {
52
+ config.entry.app = ['babel-polyfill', 'whatwg-fetch', './src/main.js']
53
+ config.performance = {
54
+ hints: false
55
+ }
56
+ config.plugins.push(
57
+ new ThemeColorReplacer({
58
+ fileName: 'css/theme-colors-[contenthash:8].css',
59
+ matchColors: getThemeColors(),
60
+ injectCss: true,
61
+ resolveCss
62
+ })
63
+ )
64
+ // Ignore all locale files of moment.js
65
+ config.plugins.push(new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/))
66
+ // 生产环境下将资源压缩成gzip格式
67
+ if (isProd) {
68
+ // add `CompressionWebpack` plugin to webpack plugins
69
+ config.plugins.push(new CompressionWebpackPlugin({
70
+ algorithm: 'gzip',
71
+ test: new RegExp('\\.(' + productionGzipExtensions.join('|') + ')$'),
72
+ threshold: 10240,
73
+ minRatio: 0.8
74
+ }))
75
+ }
76
+ // if prod, add externals
77
+ // if (isProd) {
78
+ // config.externals = assetsCDN.externals
79
+ // }
80
+ },
81
+ chainWebpack: config => {
82
+ // 生产环境下关闭css压缩的 colormin 项,因为此项优化与主题色替换功能冲突
83
+ if (isProd) {
84
+ config.plugin('optimize-css')
85
+ .tap(args => {
86
+ args[0].cssnanoOptions.preset[1].colormin = false
87
+ return args
88
+ })
89
+ }
90
+ config.resolve.alias.set('@vue2-client', path.resolve(__dirname, 'src'))
91
+ },
92
+ css: {
93
+ loaderOptions: {
94
+ less: {
95
+ lessOptions: {
96
+ modifyVars: modifyVars(),
97
+ javascriptEnabled: true
98
+ }
99
+ }
100
+ }
101
+ },
102
+ publicPath: process.env.VUE_APP_PUBLIC_PATH,
103
+ outputDir: 'dist',
104
+ assetsDir: 'static',
105
+ productionSourceMap: false
106
+ }