vue2-client 1.3.8 → 1.3.9
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 +1 -1
- package/package.json +1 -1
- package/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox.vue +3 -3
- package/src/base-client/components/common/CustomColumnsDrawer/index.md +46 -46
- package/src/base-client/components/common/JSONToTree/jsontotree.vue +275 -275
- package/src/base-client/components/system/LogDetailsView/LogDetailsView.vue +376 -372
- package/src/base-client/components/ticket/TicketDetailsView/TicketDetailsView.vue +13 -12
- package/src/base-client/components/ticket/TicketDetailsView/index.md +29 -29
- package/src/base-client/components/ticket/TicketDetailsView/part/TicketDetailsFlow.vue +260 -260
- package/src/base-client/components/ticket/TicketSubmitSuccessView/index.md +29 -29
- package/src/base-client/plugins/AppData.js +4 -6
- package/src/base-client/plugins/GetLoginInfoService.js +252 -252
- package/src/base-client/plugins/PagedList.js +3 -3
- package/src/base-client/plugins/i18n-extend.js +32 -32
- package/src/components/Ellipsis/index.md +38 -38
- package/src/components/NumberInfo/index.md +43 -43
- package/src/components/STable/README.md +341 -341
- package/src/components/Trend/index.md +45 -45
- package/src/components/checkbox/ColorCheckbox.vue +157 -157
- package/src/components/checkbox/ImgCheckbox.vue +163 -163
- package/src/components/exception/ExceptionPage.vue +70 -70
- package/src/components/form/FormRow.vue +52 -52
- package/src/components/menu/SideMenu.vue +62 -62
- package/src/components/menu/menu.js +273 -273
- package/src/components/setting/Setting.vue +235 -235
- package/src/components/table/advance/ActionColumns.vue +158 -158
- package/src/components/table/advance/SearchArea.vue +355 -355
- package/src/components/tool/AStepItem.vue +60 -60
- package/src/components/tool/AvatarList.vue +68 -69
- package/src/components/tool/Drawer.vue +142 -142
- package/src/components/transition/PageToggleTransition.vue +97 -97
- package/src/config/replacer/resolve.config.js +67 -67
- package/src/layouts/AdminLayout.vue +174 -174
- package/src/layouts/header/AdminHeader.vue +3 -3
- package/src/layouts/header/HeaderSearch.vue +67 -67
- package/src/layouts/header/InstitutionDetail.vue +181 -0
- package/src/layouts/tabs/TabsHead.vue +190 -190
- package/src/layouts/tabs/TabsView.vue +379 -379
- package/src/mock/goods/index.js +108 -108
- package/src/pages/report/ReportTable.js +124 -125
- package/src/theme/default/nprogress.less +76 -76
- package/src/utils/colors.js +103 -103
- package/src/utils/excel/Blob.js +53 -54
- package/src/utils/excel/Export2Excel.js +4 -4
- package/src/utils/formatter.js +68 -68
- package/src/utils/i18n.js +1 -1
- package/src/utils/routerUtil.js +3 -3
- package/src/utils/theme-color-replacer-extend.js +3 -3
- package/src/utils/themeUtil.js +100 -102
- package/src/utils/util.js +2 -2
package/src/utils/colors.js
CHANGED
|
@@ -1,103 +1,103 @@
|
|
|
1
|
-
const varyColor = require('webpack-theme-color-replacer/client/varyColor')
|
|
2
|
-
const { generate } = require('@ant-design/colors')
|
|
3
|
-
const { ADMIN, ANTD } = require('../config/default')
|
|
4
|
-
const Config = require('../config')
|
|
5
|
-
|
|
6
|
-
const themeMode = ADMIN.theme.mode
|
|
7
|
-
|
|
8
|
-
// 获取 ant design 色系
|
|
9
|
-
function getAntdColors (color, mode) {
|
|
10
|
-
const options = mode && (mode
|
|
11
|
-
return generate(color, options)
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
// 获取功能性颜色
|
|
15
|
-
function getFunctionalColors (mode) {
|
|
16
|
-
const options = mode && (mode
|
|
17
|
-
let { success, warning, error } = ANTD.primary
|
|
18
|
-
const { success: s1, warning: w1, error: e1 } = Config.theme
|
|
19
|
-
success = success && s1
|
|
20
|
-
warning = success && w1
|
|
21
|
-
error = success && e1
|
|
22
|
-
const successColors = generate(success, options)
|
|
23
|
-
const warningColors = generate(warning, options)
|
|
24
|
-
const errorColors = generate(error, options)
|
|
25
|
-
return {
|
|
26
|
-
success: successColors,
|
|
27
|
-
warning: warningColors,
|
|
28
|
-
error: errorColors
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// 获取菜单色系
|
|
33
|
-
function getMenuColors (color, mode) {
|
|
34
|
-
if (mode
|
|
35
|
-
return ANTD.primary.night.menuColors
|
|
36
|
-
} else if (color
|
|
37
|
-
return ANTD.primary.dark.menuColors
|
|
38
|
-
} else {
|
|
39
|
-
return [varyColor.darken(color, 0.93), varyColor.darken(color, 0.83), varyColor.darken(color, 0.73)]
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// 获取主题模式切换色系
|
|
44
|
-
function getThemeToggleColors (color, mode) {
|
|
45
|
-
// 主色系
|
|
46
|
-
const mainColors = getAntdColors(color, mode)
|
|
47
|
-
const primary = mainColors[5]
|
|
48
|
-
// 辅助色系,因为 antd 目前没针对夜间模式设计,所以增加辅助色系以保证夜间模式的正常切换
|
|
49
|
-
const subColors = getAntdColors(primary, themeMode.LIGHT)
|
|
50
|
-
// 菜单色系
|
|
51
|
-
const menuColors = getMenuColors(color, mode)
|
|
52
|
-
// 内容色系(包含背景色、文字颜色等)
|
|
53
|
-
const themeCfg = ANTD.theme[mode]
|
|
54
|
-
let contentColors = Object.keys(themeCfg)
|
|
55
|
-
.map(key => themeCfg[key])
|
|
56
|
-
.map(color => isHex(color) ? color : toNum3(color).join(','))
|
|
57
|
-
// 内容色去重
|
|
58
|
-
contentColors = [...new Set(contentColors)]
|
|
59
|
-
// rgb 格式的主题色
|
|
60
|
-
const rgbColors = [toNum3(primary).join(',')]
|
|
61
|
-
const functionalColors = getFunctionalColors(mode)
|
|
62
|
-
return { primary, mainColors, subColors, menuColors, contentColors, rgbColors, functionalColors }
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function toNum3 (color) {
|
|
66
|
-
if (isHex(color)) {
|
|
67
|
-
return varyColor.toNum3(color)
|
|
68
|
-
}
|
|
69
|
-
let colorStr = ''
|
|
70
|
-
if (isRgb(color)) {
|
|
71
|
-
colorStr = color.slice(5, color.length)
|
|
72
|
-
} else if (isRgba(color)) {
|
|
73
|
-
colorStr = color.slice(6, color.lastIndexOf(','))
|
|
74
|
-
}
|
|
75
|
-
const rgb = colorStr.split(',')
|
|
76
|
-
const r = parseInt(rgb[0])
|
|
77
|
-
const g = parseInt(rgb[1])
|
|
78
|
-
const b = parseInt(rgb[2])
|
|
79
|
-
return [r, g, b]
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function isHex (color) {
|
|
83
|
-
return color.length >= 4 && color[0]
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
function isRgb (color) {
|
|
87
|
-
return color.length >= 10 && color.slice(0, 3)
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
function isRgba (color) {
|
|
91
|
-
return color.length >= 13 && color.slice(0, 4)
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
module.exports = {
|
|
95
|
-
isHex,
|
|
96
|
-
isRgb,
|
|
97
|
-
isRgba,
|
|
98
|
-
toNum3,
|
|
99
|
-
getAntdColors,
|
|
100
|
-
getMenuColors,
|
|
101
|
-
getThemeToggleColors,
|
|
102
|
-
getFunctionalColors
|
|
103
|
-
}
|
|
1
|
+
const varyColor = require('webpack-theme-color-replacer/client/varyColor')
|
|
2
|
+
const { generate } = require('@ant-design/colors')
|
|
3
|
+
const { ADMIN, ANTD } = require('../config/default')
|
|
4
|
+
const Config = require('../config')
|
|
5
|
+
|
|
6
|
+
const themeMode = ADMIN.theme.mode
|
|
7
|
+
|
|
8
|
+
// 获取 ant design 色系
|
|
9
|
+
function getAntdColors (color, mode) {
|
|
10
|
+
const options = mode && (mode === themeMode.NIGHT) ? { theme: 'dark' } : undefined
|
|
11
|
+
return generate(color, options)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// 获取功能性颜色
|
|
15
|
+
function getFunctionalColors (mode) {
|
|
16
|
+
const options = mode && (mode === themeMode.NIGHT) ? { theme: 'dark' } : undefined
|
|
17
|
+
let { success, warning, error } = ANTD.primary
|
|
18
|
+
const { success: s1, warning: w1, error: e1 } = Config.theme
|
|
19
|
+
success = success && s1
|
|
20
|
+
warning = success && w1
|
|
21
|
+
error = success && e1
|
|
22
|
+
const successColors = generate(success, options)
|
|
23
|
+
const warningColors = generate(warning, options)
|
|
24
|
+
const errorColors = generate(error, options)
|
|
25
|
+
return {
|
|
26
|
+
success: successColors,
|
|
27
|
+
warning: warningColors,
|
|
28
|
+
error: errorColors
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// 获取菜单色系
|
|
33
|
+
function getMenuColors (color, mode) {
|
|
34
|
+
if (mode === themeMode.NIGHT) {
|
|
35
|
+
return ANTD.primary.night.menuColors
|
|
36
|
+
} else if (color === ANTD.primary.color) {
|
|
37
|
+
return ANTD.primary.dark.menuColors
|
|
38
|
+
} else {
|
|
39
|
+
return [varyColor.darken(color, 0.93), varyColor.darken(color, 0.83), varyColor.darken(color, 0.73)]
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// 获取主题模式切换色系
|
|
44
|
+
function getThemeToggleColors (color, mode) {
|
|
45
|
+
// 主色系
|
|
46
|
+
const mainColors = getAntdColors(color, mode)
|
|
47
|
+
const primary = mainColors[5]
|
|
48
|
+
// 辅助色系,因为 antd 目前没针对夜间模式设计,所以增加辅助色系以保证夜间模式的正常切换
|
|
49
|
+
const subColors = getAntdColors(primary, themeMode.LIGHT)
|
|
50
|
+
// 菜单色系
|
|
51
|
+
const menuColors = getMenuColors(color, mode)
|
|
52
|
+
// 内容色系(包含背景色、文字颜色等)
|
|
53
|
+
const themeCfg = ANTD.theme[mode]
|
|
54
|
+
let contentColors = Object.keys(themeCfg)
|
|
55
|
+
.map(key => themeCfg[key])
|
|
56
|
+
.map(color => isHex(color) ? color : toNum3(color).join(','))
|
|
57
|
+
// 内容色去重
|
|
58
|
+
contentColors = [...new Set(contentColors)]
|
|
59
|
+
// rgb 格式的主题色
|
|
60
|
+
const rgbColors = [toNum3(primary).join(',')]
|
|
61
|
+
const functionalColors = getFunctionalColors(mode)
|
|
62
|
+
return { primary, mainColors, subColors, menuColors, contentColors, rgbColors, functionalColors }
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function toNum3 (color) {
|
|
66
|
+
if (isHex(color)) {
|
|
67
|
+
return varyColor.toNum3(color)
|
|
68
|
+
}
|
|
69
|
+
let colorStr = ''
|
|
70
|
+
if (isRgb(color)) {
|
|
71
|
+
colorStr = color.slice(5, color.length)
|
|
72
|
+
} else if (isRgba(color)) {
|
|
73
|
+
colorStr = color.slice(6, color.lastIndexOf(','))
|
|
74
|
+
}
|
|
75
|
+
const rgb = colorStr.split(',')
|
|
76
|
+
const r = parseInt(rgb[0])
|
|
77
|
+
const g = parseInt(rgb[1])
|
|
78
|
+
const b = parseInt(rgb[2])
|
|
79
|
+
return [r, g, b]
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function isHex (color) {
|
|
83
|
+
return color.length >= 4 && color[0] === '#'
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function isRgb (color) {
|
|
87
|
+
return color.length >= 10 && color.slice(0, 3) === 'rgb'
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function isRgba (color) {
|
|
91
|
+
return color.length >= 13 && color.slice(0, 4) === 'rgba'
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
module.exports = {
|
|
95
|
+
isHex,
|
|
96
|
+
isRgb,
|
|
97
|
+
isRgba,
|
|
98
|
+
toNum3,
|
|
99
|
+
getAntdColors,
|
|
100
|
+
getMenuColors,
|
|
101
|
+
getThemeToggleColors,
|
|
102
|
+
getFunctionalColors
|
|
103
|
+
}
|
package/src/utils/excel/Blob.js
CHANGED
|
@@ -31,41 +31,40 @@
|
|
|
31
31
|
// Internally we use a BlobBuilder implementation to base Blob off of
|
|
32
32
|
// in order to support older browsers that only have BlobBuilder
|
|
33
33
|
const BlobBuilder = view.BlobBuilder || view.WebKitBlobBuilder || view.MozBlobBuilder || (function (view) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
, atob = view.atob
|
|
34
|
+
const get_class = function (object) {
|
|
35
|
+
return Object.prototype.toString.call(object).match(/^\[object\s(.*)\]$/)[1];
|
|
36
|
+
}
|
|
37
|
+
, FakeBlobBuilder = function BlobBuilder() {
|
|
38
|
+
this.data = [];
|
|
39
|
+
}
|
|
40
|
+
, FakeBlob = function Blob(data, type, encoding) {
|
|
41
|
+
this.data = data;
|
|
42
|
+
this.size = data.length;
|
|
43
|
+
this.type = type;
|
|
44
|
+
this.encoding = encoding;
|
|
45
|
+
}
|
|
46
|
+
, FBB_proto = FakeBlobBuilder.prototype
|
|
47
|
+
, FB_proto = FakeBlob.prototype
|
|
48
|
+
, FileReaderSync = view.FileReaderSync
|
|
49
|
+
, FileException = function (type) {
|
|
50
|
+
this.code = this[this.name = type];
|
|
51
|
+
}
|
|
52
|
+
, file_ex_codes = (
|
|
53
|
+
"NOT_FOUND_ERR SECURITY_ERR ABORT_ERR NOT_READABLE_ERR ENCODING_ERR "
|
|
54
|
+
+ "NO_MODIFICATION_ALLOWED_ERR INVALID_STATE_ERR SYNTAX_ERR"
|
|
55
|
+
).split(" ")
|
|
56
|
+
;let file_ex_code = file_ex_codes.length
|
|
57
|
+
;const real_URL = view.URL || view.webkitURL || view
|
|
58
|
+
, real_create_object_URL = real_URL.createObjectURL
|
|
59
|
+
, real_revoke_object_URL = real_URL.revokeObjectURL
|
|
60
|
+
;let URL = real_URL
|
|
61
|
+
;const btoa = view.btoa
|
|
62
|
+
, atob = view.atob
|
|
64
63
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
, ArrayBuffer = view.ArrayBuffer
|
|
65
|
+
, Uint8Array = view.Uint8Array
|
|
66
|
+
;
|
|
67
|
+
FakeBlob.fake = FB_proto.fake = true;
|
|
69
68
|
while (file_ex_code--) {
|
|
70
69
|
FileException.prototype[file_ex_codes[file_ex_code]] = file_ex_code + 1;
|
|
71
70
|
}
|
|
@@ -73,11 +72,10 @@
|
|
|
73
72
|
URL = view.URL = {};
|
|
74
73
|
}
|
|
75
74
|
URL.createObjectURL = function (blob) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
if (type === null) {
|
|
75
|
+
let type = blob.type
|
|
76
|
+
, data_URI_header
|
|
77
|
+
;
|
|
78
|
+
if (type === null) {
|
|
81
79
|
type = "application/octet-stream";
|
|
82
80
|
}
|
|
83
81
|
if (blob instanceof FakeBlob) {
|
|
@@ -102,16 +100,15 @@
|
|
|
102
100
|
}
|
|
103
101
|
};
|
|
104
102
|
FBB_proto.append = function (data/*, endings*/) {
|
|
105
|
-
|
|
106
|
-
|
|
103
|
+
const bb = this.data;
|
|
104
|
+
// decode data to a binary string
|
|
107
105
|
if (Uint8Array && (data instanceof ArrayBuffer || data instanceof Uint8Array)) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
for (; i < buf_len; i++) {
|
|
106
|
+
let str = ""
|
|
107
|
+
;const buf = new Uint8Array(data)
|
|
108
|
+
;let i = 0
|
|
109
|
+
;const buf_len = buf.length
|
|
110
|
+
;
|
|
111
|
+
for (; i < buf_len; i++) {
|
|
115
112
|
str += String.fromCharCode(buf[i]);
|
|
116
113
|
}
|
|
117
114
|
bb.push(str);
|
|
@@ -149,8 +146,8 @@
|
|
|
149
146
|
return "[object BlobBuilder]";
|
|
150
147
|
};
|
|
151
148
|
FB_proto.slice = function (start, end, type) {
|
|
152
|
-
|
|
153
|
-
|
|
149
|
+
const args = arguments.length;
|
|
150
|
+
if (args < 3) {
|
|
154
151
|
type = null;
|
|
155
152
|
}
|
|
156
153
|
return new FakeBlob(
|
|
@@ -169,10 +166,12 @@
|
|
|
169
166
|
}(view));
|
|
170
167
|
|
|
171
168
|
view.Blob = function Blob(blobParts, options) {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
169
|
+
const type = options ? (options.type || "") : "";
|
|
170
|
+
const builder = new BlobBuilder();
|
|
171
|
+
if (blobParts) {
|
|
172
|
+
let i = 0;
|
|
173
|
+
const len = blobParts.length;
|
|
174
|
+
for (; i < len; i++) {
|
|
176
175
|
builder.append(blobParts[i]);
|
|
177
176
|
}
|
|
178
177
|
}
|
|
@@ -16,7 +16,7 @@ function generateArray(table) {
|
|
|
16
16
|
let colspan = cell.getAttribute('colspan');
|
|
17
17
|
let rowspan = cell.getAttribute('rowspan');
|
|
18
18
|
let cellValue = cell.innerText;
|
|
19
|
-
if (cellValue !== "" && cellValue
|
|
19
|
+
if (cellValue !== "" && cellValue === +cellValue) cellValue = +cellValue;
|
|
20
20
|
|
|
21
21
|
//Skip ranges
|
|
22
22
|
ranges.forEach(function (range) {
|
|
@@ -52,8 +52,8 @@ function datenum(v, date1904) {
|
|
|
52
52
|
function sheet_from_array_of_arrays(data, opts) {
|
|
53
53
|
const ws = {};
|
|
54
54
|
const range = {s: {c: 10000000, r: 10000000}, e: {c: 0, r: 0}};
|
|
55
|
-
for (let R = 0; R
|
|
56
|
-
for (let C = 0; C
|
|
55
|
+
for (let R = 0; R !== data.length; ++R) {
|
|
56
|
+
for (let C = 0; C !== data[R].length; ++C) {
|
|
57
57
|
if (range.s.r > R) range.s.r = R;
|
|
58
58
|
if (range.s.c > C) range.s.c = C;
|
|
59
59
|
if (range.e.r < R) range.e.r = R;
|
|
@@ -86,7 +86,7 @@ function Workbook() {
|
|
|
86
86
|
function s2ab(s) {
|
|
87
87
|
const buf = new ArrayBuffer(s.length);
|
|
88
88
|
const view = new Uint8Array(buf);
|
|
89
|
-
for (let i = 0; i
|
|
89
|
+
for (let i = 0; i !== s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF;
|
|
90
90
|
return buf;
|
|
91
91
|
}
|
|
92
92
|
|
package/src/utils/formatter.js
CHANGED
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 把对象按照 js配置文件的格式进行格式化
|
|
3
|
-
* @param obj 格式化的对象
|
|
4
|
-
* @param dep 层级,此项无需传值
|
|
5
|
-
* @returns {string}
|
|
6
|
-
*/
|
|
7
|
-
function formatConfig (obj, dep) {
|
|
8
|
-
dep = dep || 1
|
|
9
|
-
const LN = '\n'; const TAB = ' '
|
|
10
|
-
let indent = ''
|
|
11
|
-
for (let i = 0; i < dep; i++) {
|
|
12
|
-
indent += TAB
|
|
13
|
-
}
|
|
14
|
-
let isArray = false; let arrayLastIsObj = false
|
|
15
|
-
let str = ''; let prefix = '{'; let subfix = '}'
|
|
16
|
-
if (Array.isArray(obj)) {
|
|
17
|
-
isArray = true
|
|
18
|
-
prefix = '['
|
|
19
|
-
subfix = ']'
|
|
20
|
-
str = obj.map((item, index) => {
|
|
21
|
-
let format = ''
|
|
22
|
-
if (typeof item == 'function') {
|
|
23
|
-
//
|
|
24
|
-
} else if (typeof item == 'object') {
|
|
25
|
-
arrayLastIsObj = true
|
|
26
|
-
format = `${LN}${indent}${formatConfig(item, dep + 1)},`
|
|
27
|
-
} else if ((typeof item == 'number' && !isNaN(item)) || typeof item == 'boolean') {
|
|
28
|
-
format = `${item},`
|
|
29
|
-
} else if (typeof item == 'string') {
|
|
30
|
-
format = `'${item}',`
|
|
31
|
-
}
|
|
32
|
-
if (index
|
|
33
|
-
format = format.substring(0, format.length - 1)
|
|
34
|
-
} else {
|
|
35
|
-
arrayLastIsObj = false
|
|
36
|
-
}
|
|
37
|
-
return format
|
|
38
|
-
}).join('')
|
|
39
|
-
} else if (typeof obj != 'function' && typeof obj == 'object') {
|
|
40
|
-
str = Object.keys(obj).map((key, index, keys) => {
|
|
41
|
-
const val = obj[key]
|
|
42
|
-
let format = ''
|
|
43
|
-
if (typeof val == 'function') {
|
|
44
|
-
//
|
|
45
|
-
} else if (typeof val == 'object') {
|
|
46
|
-
format = `${LN}${indent}${key}: ${formatConfig(val, dep + 1)},`
|
|
47
|
-
} else if ((typeof val == 'number' && !isNaN(val)) || typeof val == 'boolean') {
|
|
48
|
-
format = `${LN}${indent}${key}: ${val},`
|
|
49
|
-
} else if (typeof val == 'string') {
|
|
50
|
-
format = `${LN}${indent}${key}: '${val}',`
|
|
51
|
-
}
|
|
52
|
-
if (index
|
|
53
|
-
format = format.substring(0, format.length - 1)
|
|
54
|
-
}
|
|
55
|
-
return format
|
|
56
|
-
}).join('')
|
|
57
|
-
}
|
|
58
|
-
const len = TAB.length
|
|
59
|
-
if (indent.length >= len) {
|
|
60
|
-
indent = indent.substring(0, indent.length - len)
|
|
61
|
-
}
|
|
62
|
-
if (!isArray || arrayLastIsObj) {
|
|
63
|
-
subfix = LN + indent + subfix
|
|
64
|
-
}
|
|
65
|
-
return `${prefix}${str}${subfix}`
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
module.exports = { formatConfig }
|
|
1
|
+
/**
|
|
2
|
+
* 把对象按照 js配置文件的格式进行格式化
|
|
3
|
+
* @param obj 格式化的对象
|
|
4
|
+
* @param dep 层级,此项无需传值
|
|
5
|
+
* @returns {string}
|
|
6
|
+
*/
|
|
7
|
+
function formatConfig (obj, dep) {
|
|
8
|
+
dep = dep || 1
|
|
9
|
+
const LN = '\n'; const TAB = ' '
|
|
10
|
+
let indent = ''
|
|
11
|
+
for (let i = 0; i < dep; i++) {
|
|
12
|
+
indent += TAB
|
|
13
|
+
}
|
|
14
|
+
let isArray = false; let arrayLastIsObj = false
|
|
15
|
+
let str = ''; let prefix = '{'; let subfix = '}'
|
|
16
|
+
if (Array.isArray(obj)) {
|
|
17
|
+
isArray = true
|
|
18
|
+
prefix = '['
|
|
19
|
+
subfix = ']'
|
|
20
|
+
str = obj.map((item, index) => {
|
|
21
|
+
let format = ''
|
|
22
|
+
if (typeof item == 'function') {
|
|
23
|
+
//
|
|
24
|
+
} else if (typeof item == 'object') {
|
|
25
|
+
arrayLastIsObj = true
|
|
26
|
+
format = `${LN}${indent}${formatConfig(item, dep + 1)},`
|
|
27
|
+
} else if ((typeof item == 'number' && !isNaN(item)) || typeof item == 'boolean') {
|
|
28
|
+
format = `${item},`
|
|
29
|
+
} else if (typeof item == 'string') {
|
|
30
|
+
format = `'${item}',`
|
|
31
|
+
}
|
|
32
|
+
if (index === obj.length - 1) {
|
|
33
|
+
format = format.substring(0, format.length - 1)
|
|
34
|
+
} else {
|
|
35
|
+
arrayLastIsObj = false
|
|
36
|
+
}
|
|
37
|
+
return format
|
|
38
|
+
}).join('')
|
|
39
|
+
} else if (typeof obj != 'function' && typeof obj == 'object') {
|
|
40
|
+
str = Object.keys(obj).map((key, index, keys) => {
|
|
41
|
+
const val = obj[key]
|
|
42
|
+
let format = ''
|
|
43
|
+
if (typeof val == 'function') {
|
|
44
|
+
//
|
|
45
|
+
} else if (typeof val == 'object') {
|
|
46
|
+
format = `${LN}${indent}${key}: ${formatConfig(val, dep + 1)},`
|
|
47
|
+
} else if ((typeof val == 'number' && !isNaN(val)) || typeof val == 'boolean') {
|
|
48
|
+
format = `${LN}${indent}${key}: ${val},`
|
|
49
|
+
} else if (typeof val == 'string') {
|
|
50
|
+
format = `${LN}${indent}${key}: '${val}',`
|
|
51
|
+
}
|
|
52
|
+
if (index === keys.length - 1) {
|
|
53
|
+
format = format.substring(0, format.length - 1)
|
|
54
|
+
}
|
|
55
|
+
return format
|
|
56
|
+
}).join('')
|
|
57
|
+
}
|
|
58
|
+
const len = TAB.length
|
|
59
|
+
if (indent.length >= len) {
|
|
60
|
+
indent = indent.substring(0, indent.length - len)
|
|
61
|
+
}
|
|
62
|
+
if (!isArray || arrayLastIsObj) {
|
|
63
|
+
subfix = LN + indent + subfix
|
|
64
|
+
}
|
|
65
|
+
return `${prefix}${str}${subfix}`
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
module.exports = { formatConfig }
|
package/src/utils/i18n.js
CHANGED
|
@@ -30,7 +30,7 @@ function initI18n (locale, fallback) {
|
|
|
30
30
|
function generateI18n (lang, routes, valueKey) {
|
|
31
31
|
routes.forEach(route => {
|
|
32
32
|
const keys = getI18nKey(route.fullPath).split('.')
|
|
33
|
-
const value = valueKey === 'path' ? route[valueKey].split('/').filter(item => !item.startsWith(':') && item
|
|
33
|
+
const value = valueKey === 'path' ? route[valueKey].split('/').filter(item => !item.startsWith(':') && item !== '').join('.') : route[valueKey]
|
|
34
34
|
lang.assignProps(keys, value)
|
|
35
35
|
if (route.children) {
|
|
36
36
|
generateI18n(lang, route.children, valueKey)
|
package/src/utils/routerUtil.js
CHANGED
|
@@ -60,7 +60,7 @@ function parseRoutes (routesConfig, routerMap) {
|
|
|
60
60
|
routeCfg = { path: (router && router.path) || item, router: item }
|
|
61
61
|
} else if (typeof item === 'object') {
|
|
62
62
|
// 当没有设置路由对象名或者设置的是blank路由对象时, 给空界面, path为名称
|
|
63
|
-
if (!item.router || item.router
|
|
63
|
+
if (!item.router || item.router === 'blank') {
|
|
64
64
|
router = routerMap['blank']
|
|
65
65
|
item.path = item.name
|
|
66
66
|
} else {
|
|
@@ -145,7 +145,7 @@ function loadRoutes (routesConfig) {
|
|
|
145
145
|
const { router, store, i18n } = appOptions
|
|
146
146
|
|
|
147
147
|
// 刷新页面时,有些全局状态丢失,在此处从本地缓存拿出来赋值
|
|
148
|
-
if (JSON.stringify(Vue.$login.f)
|
|
148
|
+
if (JSON.stringify(Vue.$login.f) === '{}') {
|
|
149
149
|
const login = store.getters['account/login']
|
|
150
150
|
Object.assign(Vue.$login, login)
|
|
151
151
|
}
|
|
@@ -287,7 +287,7 @@ function formatAuthority (routes, pAuthorities = []) {
|
|
|
287
287
|
* @returns {*}
|
|
288
288
|
*/
|
|
289
289
|
function getI18nKey (path) {
|
|
290
|
-
const keys = path.split('/').filter(item => !item.startsWith(':') && item
|
|
290
|
+
const keys = path.split('/').filter(item => !item.startsWith(':') && item !== '')
|
|
291
291
|
keys.push('name')
|
|
292
292
|
return keys.join('.')
|
|
293
293
|
}
|
|
@@ -4,7 +4,7 @@ function resolveCss (output, srcArr) {
|
|
|
4
4
|
const regExps = []
|
|
5
5
|
// 提取 resolve 配置中所有的正则配置
|
|
6
6
|
Object.keys(cssResolve).forEach(key => {
|
|
7
|
-
let isRegExp
|
|
7
|
+
let isRegExp
|
|
8
8
|
let reg = {}
|
|
9
9
|
try {
|
|
10
10
|
reg = eval(key)
|
|
@@ -26,7 +26,7 @@ function resolveCss (output, srcArr) {
|
|
|
26
26
|
// 转换为 css 对象
|
|
27
27
|
const cssObj = parseCssObj(text)
|
|
28
28
|
// 根据selector匹配配置,匹配成功,则按配置处理 css
|
|
29
|
-
if (cssResolve[cssObj.selector]
|
|
29
|
+
if (cssResolve[cssObj.selector] !== undefined) {
|
|
30
30
|
const cfg = cssResolve[cssObj.selector]
|
|
31
31
|
if (cfg) {
|
|
32
32
|
outArr.push(cfg.resolve(text, cssObj))
|
|
@@ -43,7 +43,7 @@ function resolveCss (output, srcArr) {
|
|
|
43
43
|
// 未匹配到正则,则设置 cssText 为默认的 css(即不处理)
|
|
44
44
|
cssText = text
|
|
45
45
|
}
|
|
46
|
-
if (cssText
|
|
46
|
+
if (cssText !== '') {
|
|
47
47
|
outArr.push(cssText)
|
|
48
48
|
}
|
|
49
49
|
}
|