@lambo-design/shared 1.0.0-beta.20 → 1.0.0-beta.22

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
@@ -1,22 +1,22 @@
1
- {
2
- "name": "@lambo-design/shared",
3
- "version": "1.0.0-beta.20",
4
- "description": "",
5
- "main": "index.js",
6
- "scripts": {},
7
- "author": "lambo",
8
- "license": "ISC",
9
- "publishConfig": {
10
- "access": "public",
11
- "registry": "https://registry.npmjs.org/"
12
- },
13
- "dependencies": {
14
- "axios": "^0.24.0",
15
- "axios-cache-plugin": "^0.1.0",
16
- "qs": "^6.11.0",
17
- "xlsx": "http://10.110.34.38/package/cdn/xlsx-0.19.1.tgz",
18
- "classnames": "^2.3.1",
19
- "xlsx-style": "^0.8.13",
20
- "moment": "2.29.4"
21
- }
22
- }
1
+ {
2
+ "name": "@lambo-design/shared",
3
+ "version": "1.0.0-beta.22",
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
+ }
@@ -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,84 +1,84 @@
1
- // deepCopy
2
-
3
-
4
- export function deepCopy(data) {
5
- let i;
6
- const t = typeOf(data);
7
- let o;
8
-
9
- if (t === 'array') {
10
- o = [];
11
- } else if (t === 'object') {
12
- o = {};
13
- } else {
14
- return data;
15
- }
16
-
17
- if (t === 'array') {
18
- for (i = 0; i < data.length; i++) {
19
- o.push(deepCopy(data[i]));
20
- }
21
- } else if (t === 'object') {
22
- for (i in data) {
23
- o[i] = deepCopy(data[i]);
24
- }
25
- }
26
- return o;
27
- }
28
-
29
- export function typeOf(obj) {
30
- const toString = Object.prototype.toString;
31
- const map = {
32
- '[object Boolean]': 'boolean',
33
- '[object Number]': 'number',
34
- '[object String]': 'string',
35
- '[object Function]': 'function',
36
- '[object Array]': 'array',
37
- '[object Date]': 'date',
38
- '[object RegExp]': 'regExp',
39
- '[object Undefined]': 'undefined',
40
- '[object Null]': 'null',
41
- '[object Object]': 'object'
42
- };
43
- return map[toString.call(obj)];
44
- }
45
-
46
- export function operateBtn(vm, h, currentRow, operationName, operation, type, permission) {
47
- return h('Button', {
48
- props: {
49
- type: type,
50
- size: "small",
51
- ghost: true,
52
- },
53
- directives: [(permission === '' || permission === null) ? '' : {
54
- name: "permission",
55
- value: permission
56
- }],
57
- style: {
58
- margin: '0 2px'
59
- },
60
- on: {
61
- 'click': () => {
62
- operation(vm, currentRow);
63
- }
64
- }
65
- }, operationName);
66
-
67
- }
68
-
69
- export function operateHref(vm, h, currentRow, operationName, operation) {
70
- return h('a', {
71
- style: {
72
- margin: '0 4px'
73
- },
74
- on: {
75
- 'click': () => {
76
- operation(vm, currentRow);
77
- }
78
- }
79
- }, operationName);
80
- }
81
-
82
- export function isJson(arg) {
83
- return typeof (arg) == "object" && Object.prototype.toString.call(arg).toLowerCase() == "[object object]" && !arg.length
84
- };
1
+ // deepCopy
2
+
3
+
4
+ export function deepCopy(data) {
5
+ let i;
6
+ const t = typeOf(data);
7
+ let o;
8
+
9
+ if (t === 'array') {
10
+ o = [];
11
+ } else if (t === 'object') {
12
+ o = {};
13
+ } else {
14
+ return data;
15
+ }
16
+
17
+ if (t === 'array') {
18
+ for (i = 0; i < data.length; i++) {
19
+ o.push(deepCopy(data[i]));
20
+ }
21
+ } else if (t === 'object') {
22
+ for (i in data) {
23
+ o[i] = deepCopy(data[i]);
24
+ }
25
+ }
26
+ return o;
27
+ }
28
+
29
+ export function typeOf(obj) {
30
+ const toString = Object.prototype.toString;
31
+ const map = {
32
+ '[object Boolean]': 'boolean',
33
+ '[object Number]': 'number',
34
+ '[object String]': 'string',
35
+ '[object Function]': 'function',
36
+ '[object Array]': 'array',
37
+ '[object Date]': 'date',
38
+ '[object RegExp]': 'regExp',
39
+ '[object Undefined]': 'undefined',
40
+ '[object Null]': 'null',
41
+ '[object Object]': 'object'
42
+ };
43
+ return map[toString.call(obj)];
44
+ }
45
+
46
+ export function operateBtn(vm, h, currentRow, operationName, operation, type, permission) {
47
+ return h('Button', {
48
+ props: {
49
+ type: type,
50
+ size: "small",
51
+ ghost: true,
52
+ },
53
+ directives: [(permission === '' || permission === null) ? '' : {
54
+ name: "permission",
55
+ value: permission
56
+ }],
57
+ style: {
58
+ margin: '0 2px'
59
+ },
60
+ on: {
61
+ 'click': () => {
62
+ operation(vm, currentRow);
63
+ }
64
+ }
65
+ }, operationName);
66
+
67
+ }
68
+
69
+ export function operateHref(vm, h, currentRow, operationName, operation) {
70
+ return h('a', {
71
+ style: {
72
+ margin: '0 4px'
73
+ },
74
+ on: {
75
+ 'click': () => {
76
+ operation(vm, currentRow);
77
+ }
78
+ }
79
+ }, operationName);
80
+ }
81
+
82
+ export function isJson(arg) {
83
+ return typeof (arg) == "object" && Object.prototype.toString.call(arg).toLowerCase() == "[object object]" && !arg.length
84
+ };