@lambo-design/shared 1.0.0-beta.7 → 1.0.0-beta.70

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 (54) hide show
  1. package/config/config.js +2 -1
  2. package/config/themes/atrovirens/atrovirens.css +252 -0
  3. package/config/themes/atrovirens/atrovirens.css.map +1 -0
  4. package/config/themes/{gold/default.less → atrovirens/atrovirens.less} +89 -74
  5. package/config/themes/atrovirens/var.less +331 -0
  6. package/config/themes/default/default.css +252 -241
  7. package/config/themes/default/default.css.map +1 -0
  8. package/config/themes/default/default.less +89 -74
  9. package/config/themes/default/var.less +25 -4
  10. package/config/themes/eap/eap.css +252 -0
  11. package/config/themes/eap/eap.css.map +1 -0
  12. package/config/themes/{lime/default.less → eap/eap.less} +89 -74
  13. package/config/themes/eap/var.less +332 -0
  14. package/config/themes/gold/{default.css → gold.css} +252 -241
  15. package/config/themes/gold/gold.css.map +1 -0
  16. package/config/themes/gold/gold.less +334 -0
  17. package/config/themes/gold/var.less +23 -4
  18. package/config/themes/index.js +10 -2
  19. package/config/themes/lime/{default.css → lime.css} +252 -241
  20. package/config/themes/lime/lime.css.map +1 -0
  21. package/config/themes/lime/lime.less +334 -0
  22. package/config/themes/lime/var.less +22 -4
  23. package/config/themes/orange/orange.css +252 -0
  24. package/config/themes/orange/orange.css.map +1 -0
  25. package/config/themes/orange/orange.less +334 -0
  26. package/config/themes/orange/var.less +332 -0
  27. package/config/themes/red/red.css +252 -0
  28. package/config/themes/red/red.css.map +1 -0
  29. package/config/themes/red/red.less +334 -0
  30. package/config/themes/red/var.less +331 -0
  31. package/config/themes/theme-atrovirens.js +262 -0
  32. package/config/themes/theme-default.js +17 -7
  33. package/config/themes/theme-eap.js +262 -0
  34. package/config/themes/theme-gold.js +18 -8
  35. package/config/themes/theme-lime.js +18 -8
  36. package/config/themes/theme-orange.js +264 -0
  37. package/config/themes/theme-red.js +263 -0
  38. package/directives/index.js +23 -0
  39. package/directives/module/draggable.js +56 -0
  40. package/directives/module/permission.js +49 -0
  41. package/index.js +3 -1
  42. package/package.json +22 -20
  43. package/plugin/index.js +12 -0
  44. package/plugin/module/date-format.js +30 -0
  45. package/plugin/module/loading.js +26 -0
  46. package/plugin/module/warn-handler.js +11 -0
  47. package/utils/ajax/interceptors.js +13 -6
  48. package/utils/assist.js +48 -9
  49. package/utils/base64.js +126 -0
  50. package/utils/date.js +0 -27
  51. package/utils/excel.js +122 -21
  52. package/utils/menu/index.js +24 -2
  53. package/utils/platform.js +44 -10
  54. package/utils/vxetable/index.js +15 -4
@@ -0,0 +1,263 @@
1
+ export default {
2
+ key: "read",
3
+ title: "发财红",
4
+ primaryColor: "#ff3457",
5
+ //自定义主题相关颜色覆盖
6
+ vars: `
7
+ --primary-color: #ff3457;
8
+ --primary-color-tint-20: #ff5d79;
9
+ --primary-color-tint-90: #ffebee;
10
+ --primary-color-tint-80: #ffd6dd;
11
+ --primary-color-tint-5: #ff3e5f;
12
+ --primary-color-tint-95-fade-50: rgba(255, 245, 247, 0.5);
13
+ --primary-color-fade-20: rgba(255, 52, 87, 0.2);
14
+ --primary-color-shade-5: #f23153;
15
+ --info-color: #2db7f5;
16
+ --info-color-tint-20: #57c5f7;
17
+ --info-color-tint-90: #eaf8fe;
18
+ --info-color-tint-80: #d5f1fd;
19
+ --info-color-tint-5: #38bbf6;
20
+ --info-color-tint-95-fade-50: rgba(245, 251, 254, 0.5);
21
+ --info-color-fade-20: rgba(45, 183, 245, 0.2);
22
+ --info-color-shade-5: #2baee9;
23
+ --success-color: #19be6b;
24
+ --success-color-tint-20: #47cb89;
25
+ --success-color-tint-90: #e8f9f0;
26
+ --success-color-tint-80: #d1f2e1;
27
+ --success-color-tint-5: #25c172;
28
+ --success-color-tint-95-fade-50: rgba(244, 252, 248, 0.5);
29
+ --success-color-fade-20: rgba(25, 190, 107, 0.2);
30
+ --success-color-shade-5: #18b566;
31
+ --processing-color: #ff3457;
32
+ --warning-color: #ff9900;
33
+ --warning-color-tint-20: #ffad33;
34
+ --warning-color-tint-90: #fff5e6;
35
+ --warning-color-tint-5: #ff9e0d;
36
+ --warning-color-tint-80: #ffebcc;
37
+ --warning-color-tint-95-fade-50: rgba(255, 250, 242, 0.5);
38
+ --warning-color-fade-20: rgba(255, 153, 0, 0.2);
39
+ --warning-color-shade-5: #f29100;
40
+ --error-color: #ed4014;
41
+ --error-color-tint-20: #f16643;
42
+ --error-color-tint-90: #fdece8;
43
+ --error-color-tint-5: #ee4a20;
44
+ --error-color-tint-80: #fbd9d0;
45
+ --error-color-tint-95-fade-50: rgba(254, 245, 243, 0.5);
46
+ --error-color-fade-20: rgba(237, 64, 20, 0.2);
47
+ --error-color-shade-5: #e13d13;
48
+ --normal-color: rgba(255, 245, 247, 0);
49
+ --link-color: #ff3457;
50
+ --link-hover-color: #ff5d79;
51
+ --link-active-color: #f23153;
52
+ --selected-color: rgba(255, 52, 87, 0.9);
53
+ --selected-color-shade-10: rgba(225, 46, 77, 0.91);
54
+ --tooltip-color: #fff;
55
+ --subsidiary-color: #808695;
56
+ --rate-star-color: #f5a623;
57
+ --rate-star-color-tint-20: #f7b84f;
58
+ --white: #fff;
59
+ --black: #000;
60
+ --body-background: #fff;
61
+ --component-background: #fff;
62
+ --font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
63
+ --code-family: Consolas, Menlo, Courier, monospace;
64
+ --title-color: #17233d;
65
+ --text-color: #515a6e;
66
+ --text-color-secondary: rgba(0, 0, 0, 0.45);
67
+ --heading-color: rgba(0, 0, 0, 0.85);
68
+ --heading-color-dark: #ffffff;
69
+ --font-size-base: 14px;
70
+ --font-size-small: 12px;
71
+ --font-size-large: 16px;
72
+ --line-height-base: 1.5;
73
+ --line-height-computed: 21px;
74
+ --border-radius-base: 6px;
75
+ --border-radius-small: 4px;
76
+ --cursor-disabled: not-allowed;
77
+ --padding-lg: 24px;
78
+ --padding-md: 16px;
79
+ --padding-sm: 12px;
80
+ --padding-xs: 8px;
81
+ --border-color-base: #dcdee2;
82
+ --border-color-split: #e8eaec;
83
+ --border-width-base: 1px;
84
+ --border-style-base: solid;
85
+ --background-color-base: #f7f7f7;
86
+ --background-color-select-hover: #f3f3f3;
87
+ --tooltip-bg: rgba(70, 76, 91, 0.9);
88
+ --head-bg: #f9fafc;
89
+ --table-thead-bg: #f8f8f9;
90
+ --table-td-stripe-bg: #f8f8f9;
91
+ --table-td-hover-bg: #ebf7ff;
92
+ --table-td-highlight-bg: #ebf7ff;
93
+ --menu-dark-title: #333333;
94
+ --menu-dark-active-bg: #363e4f;
95
+ --menu-dark-subsidiary-color: rgba(255, 255, 255, 0.7);
96
+ --menu-dark-group-title-color: rgba(255, 255, 255, 0.36);
97
+ --date-picker-cell-hover-bg: rgba(255, 52, 87, 0.3);
98
+ --shadow-color: rgba(0, 0, 0, 0.2);
99
+ --shadow-base: 0 1px 6px rgba(0, 0, 0, 0.2);
100
+ --shadow-card: 0 1px 1px 0 rgba(0, 0, 0, 0.1);
101
+ --shadow-up: 0 -1px 6px rgba(0, 0, 0, 0.2);
102
+ --shadow-down: 0 1px 6px rgba(0, 0, 0, 0.2);
103
+ --shadow-left: -1px 0 6px rgba(0, 0, 0, 0.2);
104
+ --shadow-right: 1px 0 6px rgba(0, 0, 0, 0.2);
105
+ --btn-height-base: 32px;
106
+ --btn-height-large: 40px;
107
+ --btn-height-small: 24px;
108
+ --btn-padding-base: 0 15px;
109
+ --btn-padding-large: 0 15px;
110
+ --btn-padding-small: 0 7px;
111
+ --btn-font-weight: normal;
112
+ --btn-padding-base-icon: 5px 15px 6px;
113
+ --btn-padding-large-icon: 6px 15px 6px 15px;
114
+ --btn-padding-small-icon: 1px 7px 2px;
115
+ --btn-font-size: 14px;
116
+ --btn-font-size-large: 16px;
117
+ --btn-font-size-small: 14px;
118
+ --btn-border-radius: 4px;
119
+ --btn-border-radius-small: 3px;
120
+ --btn-group-border: #f23153;
121
+ --btn-disable-color: #c5c8ce;
122
+ --btn-disable-bg: #f7f7f7;
123
+ --btn-disable-border: #dcdee2;
124
+ --btn-default-color: #515a6e;
125
+ --btn-default-color-tint-20: #747b8b;
126
+ --btn-default-color-shade-5: #4d5669;
127
+ --btn-default-bg: #fff;
128
+ --btn-default-bg-tint-20: #ffffff;
129
+ --btn-default-bg-shade-5: #f2f2f2;
130
+ --btn-default-border: #dcdee2;
131
+ --btn-default-border-tint-20: #e3e5e8;
132
+ --btn-default-border-shade-5: #d1d3d7;
133
+ --btn-primary-color: #fff;
134
+ --btn-primary-color-tint-20: #ffffff;
135
+ --btn-primary-color-tint-5: #ffffff;
136
+ --btn-primary-color-shade-5: #f2f2f2;
137
+ --btn-primary-bg: #ff3457;
138
+ --btn-primary-bg-tint-20: #ff5d79;
139
+ --btn-primary-bg-tint-5: #ff3e5f;
140
+ --btn-primary-bg-shade-5: #f23153;
141
+ --btn-ghost-color: #515a6e;
142
+ --btn-ghost-color-tint-20: #747b8b;
143
+ --btn-ghost-color-shade-5: #4d5669;
144
+ --btn-ghost-bg: #fff;
145
+ --btn-ghost-bg-tint-20: #ffffff;
146
+ --btn-ghost-bg-shade-5: #f2f2f2;
147
+ --btn-ghost-border: #dcdee2;
148
+ --btn-ghost-border-tint-20: #e3e5e8;
149
+ --btn-ghost-border-shade-5: #d1d3d7;
150
+ --btn-circle-size: 32px;
151
+ --btn-circle-size-large: 40px;
152
+ --btn-circle-size-small: 24px;
153
+ --btn-square-size: 32px;
154
+ --btn-square-size-large: 40px;
155
+ --btn-square-size-small: 24px;
156
+ --grid-columns: 24;
157
+ --grid-gutter-width: 0;
158
+ --layout-body-background: #f5f7f9;
159
+ --layout-header-background: #333333;
160
+ --layout-header-height: 64px;
161
+ --layout-header-padding: 0 50px;
162
+ --layout-footer-padding: 24px 50px;
163
+ --layout-footer-background: #f5f7f9;
164
+ --layout-sider-background: #333333;
165
+ --layout-sider-background-tint-10: #474747;
166
+ --layout-trigger-height: 48px;
167
+ --layout-trigger-color: #fff;
168
+ --layout-zero-trigger-width: 36px;
169
+ --layout-zero-trigger-height: 42px;
170
+ --legend-color: #999;
171
+ --input-height-base: 32px;
172
+ --input-height-large: 40px;
173
+ --input-height-small: 24px;
174
+ --input-padding-horizontal: 7px;
175
+ --input-padding-vertical-base: 4px;
176
+ --input-padding-vertical-small: 1px;
177
+ --input-padding-vertical-large: 6px;
178
+ --input-placeholder-color: #c5c8ce;
179
+ --input-color: #515a6e;
180
+ --input-border-color: #dcdee2;
181
+ --input-border-color-tint-20: #e3e5e8;
182
+ --input-bg: #fff;
183
+ --input-group-bg: #f8f8f9;
184
+ --input-hover-border-color: #ff3457;
185
+ --input-hover-border-color-tint-20: #ff5d79;
186
+ --input-hover-border-color-fade-20: rgba(255, 52, 87, 0.2);
187
+ --input-focus-border-color: #ff3457;
188
+ --input-disabled-bg: #f3f3f3;
189
+ --tag-font-size: 12px;
190
+ --screen-xs: 480px;
191
+ --screen-xs-min: 480px;
192
+ --screen-xs-max: 479px;
193
+ --screen-sm: 576px;
194
+ --screen-sm-min: 576px;
195
+ --screen-sm-max: 575px;
196
+ --screen-md: 768px;
197
+ --screen-md-min: 768px;
198
+ --screen-md-max: 767px;
199
+ --screen-lg: 992px;
200
+ --screen-lg-min: 992px;
201
+ --screen-lg-max: 991px;
202
+ --screen-xl: 1200px;
203
+ --screen-xl-min: 1200px;
204
+ --screen-xl-max: 1199px;
205
+ --screen-xxl: 1600px;
206
+ --screen-xxl-min: 1600px;
207
+ --screen-xxl-max: 1599px;
208
+ --zindex-spin: 8;
209
+ --zindex-affix: 10;
210
+ --zindex-back-top: 10;
211
+ --zindex-select: 900;
212
+ --zindex-modal: 1000;
213
+ --zindex-drawer: 1000;
214
+ --zindex-message: 1010;
215
+ --zindex-notification: 1010;
216
+ --zindex-tooltip: 1060;
217
+ --zindex-transfer: 1060;
218
+ --zindex-loading-bar: 2000;
219
+ --zindex-spin-fullscreen: 2010;
220
+ --animation-time: 0.3s;
221
+ --animation-time-quick: 0.15s;
222
+ --transition-time: 0.2s;
223
+ --ease-in-out: ease-in-out;
224
+ --slider-color: #ff5d79;
225
+ --slider-height: 4px;
226
+ --slider-margin: 16px 0;
227
+ --slider-button-wrap-size: 18px;
228
+ --slider-button-wrap-offset: -5px;
229
+ --slider-disabled-color: #ccc;
230
+ --avatar-size-base: 32px;
231
+ --avatar-size-lg: 40px;
232
+ --avatar-size-sm: 24px;
233
+ --avatar-font-size-base: 18px;
234
+ --avatar-font-size-lg: 24px;
235
+ --avatar-font-size-sm: 14px;
236
+ --avatar-bg: #ccc;
237
+ --avatar-color: #fff;
238
+ --avatar-border-radius: 4px;
239
+ --anchor-border-width: 2px;
240
+ --list-header-background: transparent;
241
+ --list-footer-background: transparent;
242
+ --list-empty-text-padding: 16px;
243
+ --list-item-padding: 12px 0;
244
+ --list-item-meta-margin-bottom: 16px;
245
+ --list-item-meta-avatar-margin-right: 16px;
246
+ --list-item-meta-title-margin-bottom: 12px;
247
+ --table-border-style-base: solid;
248
+ --table-header-color: #515a6e;
249
+ --table-header-font-weight: bold;
250
+ --table-cell-height: 48px;
251
+ --table-header-text-align: center;
252
+ --table-data-text-align: left;
253
+ --select-dropdown-max-height: 400px;
254
+ --tab-card-bg: #f8f8f9;
255
+ --form-item-label-font-weight: normal;
256
+ `,
257
+ style: `
258
+ html {
259
+ padding:0;
260
+ margin:0;
261
+ }
262
+ `
263
+ };
@@ -0,0 +1,23 @@
1
+ const importDirective = Vue => {
2
+ const requireDirective = require.context(
3
+ // 其组件目录的相对路径
4
+ './module',
5
+ // 是否查询其子目录
6
+ false,
7
+ // 匹配基础组件文件名的正则表达式
8
+ /[a-zA-Z]\w+\.(vue|js)$/
9
+ )
10
+ requireDirective.keys().forEach(fileName => {
11
+ // 获取组件配置
12
+ const directiveConfig = requireDirective(fileName)
13
+
14
+ // 获取组件的 PascalCase 命名
15
+ const directiveName = fileName
16
+ .split('/')
17
+ .pop()
18
+ .replace(/\.\w+$/, '')
19
+ Vue.directive(directiveName.toLowerCase(), directiveConfig.default || directiveConfig);
20
+ });
21
+ }
22
+
23
+ export default importDirective
@@ -0,0 +1,56 @@
1
+ import {on} from '../../utils/dom'
2
+ /**
3
+ * 拖拽指令 v-draggable="options"
4
+ * options = {
5
+ * trigger: /这里传入作为拖拽触发器的CSS选择器/,
6
+ * body: /这里传入需要移动容器的CSS选择器/,
7
+ * recover: /拖动结束之后是否恢复到原来的位置/
8
+ * }
9
+ */
10
+ export default {
11
+ inserted: (el, binding, vnode) => {
12
+ let triggerDom = document.querySelector(binding.value.trigger)
13
+ triggerDom.style.cursor = 'move'
14
+ let bodyDom = document.querySelector(binding.value.body)
15
+ let pageX = 0
16
+ let pageY = 0
17
+ let transformX = 0
18
+ let transformY = 0
19
+ let canMove = false
20
+ const handleMousedown = e => {
21
+ let transform = /\(.*\)/.exec(bodyDom.style.transform)
22
+ if (transform) {
23
+ transform = transform[0].slice(1, transform[0].length - 1)
24
+ let splitxy = transform.split('px, ')
25
+ transformX = parseFloat(splitxy[0])
26
+ transformY = parseFloat(splitxy[1].split('px')[0])
27
+ }
28
+ pageX = e.pageX
29
+ pageY = e.pageY
30
+ canMove = true
31
+ }
32
+ const handleMousemove = e => {
33
+ let xOffset = e.pageX - pageX + transformX
34
+ let yOffset = e.pageY - pageY + transformY
35
+ /*if (e.pageX <= 0) {
36
+ xOffset = pageX
37
+ }*/
38
+ if (e.pageY <= 0) {
39
+ yOffset = transformY - pageY
40
+ }
41
+
42
+ if (canMove) bodyDom.style.transform = `translate(${xOffset}px, ${yOffset}px)`
43
+ }
44
+ const handleMouseup = e => {
45
+ canMove = false
46
+ }
47
+ on(triggerDom, 'mousedown', handleMousedown)
48
+ on(document, 'mousemove', handleMousemove)
49
+ on(document, 'mouseup', handleMouseup)
50
+ },
51
+ update: (el, binding, vnode) => {
52
+ if (!binding.value.recover) return
53
+ let bodyDom = document.querySelector(binding.value.body)
54
+ bodyDom.style.transform = ''
55
+ }
56
+ }
@@ -0,0 +1,49 @@
1
+ import config from "../../config/config";
2
+
3
+ const checkPermission = function (el, binding) {
4
+ el.style.display = "none"
5
+ const value = binding.value
6
+ const permissionInStore = sessionStorage.getItem(config.routerBase + "-permission");
7
+ if (permissionInStore) {
8
+ const permissionObj = JSON.parse(permissionInStore);
9
+ //判断是否以'/'为开头结尾
10
+ if (/(^\/.*\/$)/.test(value)) {
11
+ //去掉开头结尾的'/'
12
+ let regexStr = value.replace(/(^\/)|(\/$)/g,"");
13
+
14
+ regExCheck(el, permissionObj, regexStr)
15
+ } else {
16
+ normalCheck(el, permissionObj, value)
17
+ }
18
+ }
19
+ };
20
+
21
+ const regExCheck = function (el, permissionObj, value) {
22
+ let regex = new RegExp(value,"i");
23
+ for (const item of permissionObj) {
24
+ if (item.permissionValue) {
25
+ if(regex.test(item.permissionValue)){
26
+ console.log(item.permissionValue)
27
+ el.style.display = '';
28
+ }
29
+ }
30
+ }
31
+ }
32
+
33
+ const normalCheck = function (el, permissionObj, value) {
34
+ let permission = {};
35
+ for (const item of permissionObj) {
36
+ if (item.permissionValue) {
37
+ permission[item.permissionValue] = true;
38
+ }
39
+ }
40
+ const have = permission[value]
41
+ if (have || value === "all") {
42
+ el.style.display = '';
43
+ }
44
+ }
45
+
46
+ export default {
47
+ bind: checkPermission,
48
+ update: checkPermission
49
+ }
package/index.js CHANGED
@@ -1,3 +1,5 @@
1
1
  import * as config from "./config";
2
2
  import * as utils from "./utils";
3
- export { config, utils };
3
+ import importDirective from "./directives"
4
+ import * as Plugin from "./plugin"
5
+ export { config, utils, importDirective, Plugin};
package/package.json CHANGED
@@ -1,20 +1,22 @@
1
- {
2
- "name": "@lambo-design/shared",
3
- "version": "1.0.0-beta.7",
4
- "description": "",
5
- "main": "index.js",
6
- "scripts": {},
7
- "author": "lambo",
8
- "license": "ISC",
9
- "publishConfig": {
10
- "access": "public"
11
- },
12
- "dependencies": {
13
- "axios": "^0.24.0",
14
- "axios-cache-plugin": "^0.1.0",
15
- "qs": "^6.11.0",
16
- "xlsx": "http://10.110.34.38/package/cdn/xlsx-0.19.1.tgz",
17
- "classnames": "^2.3.1",
18
- "xlsx-style": "^0.8.13"
19
- }
20
- }
1
+ {
2
+ "name": "@lambo-design/shared",
3
+ "version": "1.0.0-beta.70",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "author": "lambo",
7
+ "license": "ISC",
8
+ "publishConfig": {
9
+ "access": "public",
10
+ "registry": "https://registry.npmjs.org/"
11
+ },
12
+ "dependencies": {
13
+ "axios": "^0.24.0",
14
+ "axios-cache-plugin": "^0.1.0",
15
+ "qs": "^6.11.0",
16
+ "xlsx": "http://cicd.lambo.top/package/cdn/xlsx-0.19.1.tgz",
17
+ "classnames": "^2.3.1",
18
+ "xlsx-style": "^0.8.13",
19
+ "moment": "2.29.4"
20
+ },
21
+ "scripts": {}
22
+ }
@@ -0,0 +1,12 @@
1
+ import DateFormat from "./module/date-format";
2
+ import Loading from "./module/loading";
3
+ import WarnHandler from "./module/warn-handler";
4
+ export default {
5
+ install : function (Vue, options) {
6
+ DataFormat.install(Vue,options);
7
+ Loading.install(Vue.options);
8
+ WarnHandler.install(Vue.options);
9
+ }
10
+
11
+ }
12
+ export { DateFormat , Loading , WarnHandler}
@@ -0,0 +1,30 @@
1
+ export default {
2
+ /**
3
+ * 对Date的扩展,将 Date 转化为指定格式的String
4
+ * 月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符,
5
+ * 年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字)
6
+ * 例:
7
+ * (new Date()).Format("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423
8
+ * (new Date()).Format("yyyy-M-d h:m:s.S") ==> 2006-7-2 8:9:4.18
9
+ */
10
+ install: function (Vue, options) {
11
+ Date.prototype.Format = function (fmt) {
12
+ let o = {
13
+ "M+": this.getMonth() + 1, //月份
14
+ "d+": this.getDate(), //日
15
+ "H+": this.getHours(), //小时
16
+ "m+": this.getMinutes(), //分
17
+ "s+": this.getSeconds(), //秒
18
+ "q+": Math.floor((this.getMonth() + 3) / 3), //季度
19
+ "S": this.getMilliseconds() //毫秒
20
+ };
21
+ if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
22
+ for (let k in o)
23
+ if (new RegExp("(" + k + ")").test(fmt)) {
24
+ fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)))
25
+ }
26
+ return fmt;
27
+ }
28
+
29
+ }
30
+ }
@@ -0,0 +1,26 @@
1
+ export default {
2
+ install : function (Vue, options) {
3
+ //通用Loading
4
+ Vue.prototype.$ShowLoading = function(text){
5
+ this.$Spin.show({
6
+ render: (h) => {
7
+ return h('div', [
8
+ h('Icon', {
9
+ 'class': 'demo-spin-icon-load',
10
+ props: {
11
+ type: 'ios-loading',
12
+ size: 24
13
+ }
14
+ }),
15
+ h('div', text||'Loading')
16
+ ])
17
+ }
18
+ });
19
+ }
20
+
21
+ Vue.prototype.$CloseLoading = function(){
22
+ this.$Spin.hide();
23
+ }
24
+ }
25
+
26
+ }
@@ -0,0 +1,11 @@
1
+ export default {
2
+ install : function (Vue, options) {
3
+ Vue.config.warnHandler = function (err, vm, info) {
4
+ if (err.toString().indexOf("Component names should conform to valid custom element name in html5 specification")>0){
5
+ console.warn("[Lambo warn]: " + err + info);
6
+ }else{
7
+ console.error("[Vue warn]: " + err + info);
8
+ }
9
+ }
10
+ }
11
+ }
@@ -5,6 +5,7 @@ import Bus from '../bus';
5
5
 
6
6
 
7
7
  let timer1, timer2;
8
+ let hasDialog = false;
8
9
 
9
10
  function requestInterceptors(config) {
10
11
  const params = getUrlParams();
@@ -63,12 +64,18 @@ function responseInterceptors(response) {
63
64
  if (data instanceof Object) {
64
65
  const code = data["code"];
65
66
  if (code === 10106) {
66
- clearTimeout(timer1);
67
- timer1 = setTimeout(function () {
68
- if (confirm("会话已失效,是否重新登录")) {
69
- Bus.$emit("needLogin");
70
- }
71
- }, 500)
67
+ if (!hasDialog) {
68
+ clearTimeout(timer1);
69
+ timer1 = setTimeout(function () {
70
+ hasDialog = true;
71
+ if (confirm("会话已失效,是否重新登录")) {
72
+ hasDialog = false;
73
+ Bus.$emit("needLogin");
74
+ } else {
75
+ hasDialog = false;
76
+ }
77
+ }, 500)
78
+ }
72
79
  }
73
80
  }
74
81
  return response;
package/utils/assist.js CHANGED
@@ -1,5 +1,6 @@
1
1
  // deepCopy
2
2
 
3
+
3
4
  export function deepCopy(data) {
4
5
  let i;
5
6
  const t = typeOf(data);
@@ -24,6 +25,23 @@ export function deepCopy(data) {
24
25
  }
25
26
  return o;
26
27
  }
28
+ export function deepMerge(target, ...sources) {
29
+ if (!sources.length) return target;
30
+ const source = sources.shift();
31
+
32
+ if (isObject(target) && isObject(source)) {
33
+ for (const key in source) {
34
+ if (isObject(source[key])) {
35
+ if (!target[key]) Object.assign(target, { [key]: {} });
36
+ deepMerge(target[key], source[key]);
37
+ } else {
38
+ Object.assign(target, { [key]: source[key] });
39
+ }
40
+ }
41
+ }
42
+
43
+ return deepMerge(target, ...sources);
44
+ }
27
45
 
28
46
  export function typeOf(obj) {
29
47
  const toString = Object.prototype.toString;
@@ -43,16 +61,12 @@ export function typeOf(obj) {
43
61
  }
44
62
 
45
63
  export function operateBtn(vm, h, currentRow, operationName, operation, type, permission) {
46
- return h('Button', {
64
+ let renderOption = {
47
65
  props: {
48
66
  type: type,
49
67
  size: "small",
50
68
  ghost: true,
51
69
  },
52
- directives: [{
53
- name: "permission",
54
- value: permission
55
- }],
56
70
  style: {
57
71
  margin: '0 2px'
58
72
  },
@@ -61,19 +75,44 @@ export function operateBtn(vm, h, currentRow, operationName, operation, type, pe
61
75
  operation(vm, currentRow);
62
76
  }
63
77
  }
64
- }, operationName);
78
+ }
79
+ if(permission){
80
+ renderOption['directives'] = [{
81
+ name: "permission",
82
+ value: permission
83
+ }]
84
+ }
85
+
86
+ return h('Button', renderOption, operationName);
87
+
65
88
  }
66
89
 
67
- export function operateHref(vm, h, currentRow, operationName, operation) {
68
- return h('a', {
90
+ export function operateHref(vm, h, currentRow, operationName, operation, type, permission) {
91
+ let renderOption = {
92
+ style: {
93
+ margin: '0 4px'
94
+ },
69
95
  on: {
70
96
  'click': () => {
71
97
  operation(vm, currentRow);
72
98
  }
73
99
  }
74
- }, operationName);
100
+ }
101
+ if(permission){
102
+ renderOption['directives'] = [{
103
+ name: "permission",
104
+ value: permission
105
+ }]
106
+ }
107
+
108
+ return h('a', renderOption, operationName);
75
109
  }
76
110
 
77
111
  export function isJson(arg) {
78
112
  return typeof (arg) == "object" && Object.prototype.toString.call(arg).toLowerCase() == "[object object]" && !arg.length
79
113
  };
114
+
115
+
116
+ export function isObject(item) {
117
+ return (item && typeof item === 'object' && !Array.isArray(item));
118
+ }