@bit-sun/business-component 1.0.15 → 1.1.1
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/dist/index.d.ts +1 -0
- package/dist/index.esm.js +78 -3
- package/dist/index.js +80 -3
- package/dist/utils/CheckOneUser/index.d.ts +2 -0
- package/package.json +1 -1
- package/src/components/DataValidation/index.md +3 -1
- package/src/components/DataValidation/index.tsx +16 -1
- package/src/index.ts +3 -1
- package/src/utils/CheckOneUser/index.md +39 -0
- package/src/utils/CheckOneUser/index.ts +52 -0
package/dist/index.d.ts
CHANGED
package/dist/index.esm.js
CHANGED
|
@@ -3,6 +3,7 @@ import React, { createContext, useContext, useEffect, forwardRef, createElement,
|
|
|
3
3
|
import { message, Menu, Space, Dropdown, Tooltip, Button, Checkbox, Input, Modal } from 'antd';
|
|
4
4
|
import { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd';
|
|
5
5
|
import classNames from 'classnames';
|
|
6
|
+
import _ from 'loadsh';
|
|
6
7
|
import { useDebounceFn } from 'ahooks';
|
|
7
8
|
|
|
8
9
|
function ownKeys(object, enumerableOnly) {
|
|
@@ -195,6 +196,10 @@ function _slicedToArray(arr, i) {
|
|
|
195
196
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
196
197
|
}
|
|
197
198
|
|
|
199
|
+
function _toArray(arr) {
|
|
200
|
+
return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest();
|
|
201
|
+
}
|
|
202
|
+
|
|
198
203
|
function _toConsumableArray(arr) {
|
|
199
204
|
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
200
205
|
}
|
|
@@ -1686,6 +1691,11 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
|
|
|
1686
1691
|
if (typeof cell.v === 'string') {
|
|
1687
1692
|
cell.m = cell.v = cell.m.trim();
|
|
1688
1693
|
}
|
|
1694
|
+
|
|
1695
|
+
if (typeof cell.v === 'number') {
|
|
1696
|
+
cell.v = cell.v.toString();
|
|
1697
|
+
cell.m = cell.v;
|
|
1698
|
+
}
|
|
1689
1699
|
} // console.log(postion);
|
|
1690
1700
|
|
|
1691
1701
|
},
|
|
@@ -1716,6 +1726,13 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
|
|
|
1716
1726
|
defaultRowHeight: 20,
|
|
1717
1727
|
defaultColWidth: 120,
|
|
1718
1728
|
config: {},
|
|
1729
|
+
// celldata:
|
|
1730
|
+
// data && data.length !== 0 ? data : _.flattenDeep(Array.from({ length: 100 }).map((a, b) => Array.from({ length: 100 }).map((c, d) => ({
|
|
1731
|
+
// "r": b,
|
|
1732
|
+
// "c": d,
|
|
1733
|
+
// "v": { "ct": { "fa": "@", "t": "s" }, }
|
|
1734
|
+
// }))))
|
|
1735
|
+
// ,
|
|
1719
1736
|
celldata: data && data.length !== 0 ? data : _.flattenDeep(Array.from({
|
|
1720
1737
|
length: 100
|
|
1721
1738
|
}).map(function (a, b) {
|
|
@@ -1893,7 +1910,9 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
|
|
|
1893
1910
|
updateData = _this$props.updateData,
|
|
1894
1911
|
columns = _this$props.columns;
|
|
1895
1912
|
|
|
1896
|
-
var resultData = _this.getData()
|
|
1913
|
+
var resultData = _this.getData().filter(function (d) {
|
|
1914
|
+
return _.compact(Object.values(d)).length;
|
|
1915
|
+
});
|
|
1897
1916
|
|
|
1898
1917
|
axios.post(validDataUrl, {
|
|
1899
1918
|
columns: columns,
|
|
@@ -2298,14 +2317,70 @@ function ToCDB(str) {
|
|
|
2298
2317
|
return tmp;
|
|
2299
2318
|
}
|
|
2300
2319
|
|
|
2320
|
+
/*
|
|
2321
|
+
* @Description:
|
|
2322
|
+
* @Author: rodchen
|
|
2323
|
+
* @Date: 2022-01-14 14:12:01
|
|
2324
|
+
* @LastEditTime: 2022-01-14 17:17:26
|
|
2325
|
+
* @LastEditors: rodchen
|
|
2326
|
+
*/
|
|
2327
|
+
var index = (function (storageKeyString) {
|
|
2328
|
+
var seconds = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
|
|
2329
|
+
var tipsCallFunction = arguments.length > 2 ? arguments[2] : undefined;
|
|
2330
|
+
if (typeof seconds !== 'number') throw new Error('seconds should be number');
|
|
2331
|
+
var cacheValue = getStorageVale(storageKeyString);
|
|
2332
|
+
|
|
2333
|
+
if (document.hidden !== undefined) {
|
|
2334
|
+
document.addEventListener('visibilitychange', function () {
|
|
2335
|
+
if (!document.hidden) {
|
|
2336
|
+
var currentValue = getStorageVale(storageKeyString);
|
|
2337
|
+
|
|
2338
|
+
if (currentValue !== cacheValue) {
|
|
2339
|
+
if (tipsCallFunction && typeof tipsCallFunction === 'function') {
|
|
2340
|
+
tipsCallFunction();
|
|
2341
|
+
} else {
|
|
2342
|
+
window.alert('检测新用户登录,当前页面会在2s之后刷新!');
|
|
2343
|
+
}
|
|
2344
|
+
|
|
2345
|
+
setTimeout(function () {
|
|
2346
|
+
window.location.reload();
|
|
2347
|
+
}, seconds * 1000);
|
|
2348
|
+
}
|
|
2349
|
+
}
|
|
2350
|
+
});
|
|
2351
|
+
}
|
|
2352
|
+
});
|
|
2353
|
+
|
|
2354
|
+
function getStorageVale(storageKeyString) {
|
|
2355
|
+
var _storageKeyString$spl = storageKeyString.split('.'),
|
|
2356
|
+
_storageKeyString$spl2 = _toArray(_storageKeyString$spl),
|
|
2357
|
+
localstorage = _storageKeyString$spl2[0],
|
|
2358
|
+
restKeyArrays = _storageKeyString$spl2.slice(1);
|
|
2359
|
+
|
|
2360
|
+
var localStorageInfo = window.localStorage.getItem(localstorage);
|
|
2361
|
+
if (!restKeyArrays.length) return localStorageInfo;
|
|
2362
|
+
var returnVal = JSON.parse(localStorageInfo || '{}');
|
|
2363
|
+
|
|
2364
|
+
for (var i = 0; i < restKeyArrays.length; i++) {
|
|
2365
|
+
returnVal = returnVal[restKeyArrays[i]];
|
|
2366
|
+
if (!returnVal) return '';
|
|
2367
|
+
|
|
2368
|
+
if (typeof returnVal === 'string') {
|
|
2369
|
+
return returnVal;
|
|
2370
|
+
}
|
|
2371
|
+
}
|
|
2372
|
+
|
|
2373
|
+
return "";
|
|
2374
|
+
}
|
|
2375
|
+
|
|
2301
2376
|
/*
|
|
2302
2377
|
* @Description:
|
|
2303
2378
|
* @Author: rodchen
|
|
2304
2379
|
* @Date: 2021-11-30 22:59:39
|
|
2305
|
-
* @LastEditTime:
|
|
2380
|
+
* @LastEditTime: 2022-01-14 16:10:27
|
|
2306
2381
|
* @LastEditors: rodchen
|
|
2307
2382
|
*/
|
|
2308
2383
|
var resposne = JSON.parse(localStorage.getItem('userInfo') || '{}');
|
|
2309
2384
|
axios.defaults.headers.common['sso-sessionid'] = (resposne === null || resposne === void 0 ? void 0 : resposne.sessionId) || '';
|
|
2310
2385
|
|
|
2311
|
-
export { DataValidation, QueryMutipleInput };
|
|
2386
|
+
export { index as CheckOneUser, DataValidation, QueryMutipleInput };
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,7 @@ var React = require('react');
|
|
|
7
7
|
var antd = require('antd');
|
|
8
8
|
var reactBeautifulDnd = require('react-beautiful-dnd');
|
|
9
9
|
var classNames = require('classnames');
|
|
10
|
+
var _ = require('loadsh');
|
|
10
11
|
var ahooks = require('ahooks');
|
|
11
12
|
|
|
12
13
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -14,6 +15,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
14
15
|
var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
|
|
15
16
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
16
17
|
var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
|
|
18
|
+
var ___default = /*#__PURE__*/_interopDefaultLegacy(_);
|
|
17
19
|
|
|
18
20
|
function ownKeys(object, enumerableOnly) {
|
|
19
21
|
var keys = Object.keys(object);
|
|
@@ -205,6 +207,10 @@ function _slicedToArray(arr, i) {
|
|
|
205
207
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
206
208
|
}
|
|
207
209
|
|
|
210
|
+
function _toArray(arr) {
|
|
211
|
+
return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest();
|
|
212
|
+
}
|
|
213
|
+
|
|
208
214
|
function _toConsumableArray(arr) {
|
|
209
215
|
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
210
216
|
}
|
|
@@ -1696,6 +1702,11 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
|
|
|
1696
1702
|
if (typeof cell.v === 'string') {
|
|
1697
1703
|
cell.m = cell.v = cell.m.trim();
|
|
1698
1704
|
}
|
|
1705
|
+
|
|
1706
|
+
if (typeof cell.v === 'number') {
|
|
1707
|
+
cell.v = cell.v.toString();
|
|
1708
|
+
cell.m = cell.v;
|
|
1709
|
+
}
|
|
1699
1710
|
} // console.log(postion);
|
|
1700
1711
|
|
|
1701
1712
|
},
|
|
@@ -1726,7 +1737,14 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
|
|
|
1726
1737
|
defaultRowHeight: 20,
|
|
1727
1738
|
defaultColWidth: 120,
|
|
1728
1739
|
config: {},
|
|
1729
|
-
celldata:
|
|
1740
|
+
// celldata:
|
|
1741
|
+
// data && data.length !== 0 ? data : _.flattenDeep(Array.from({ length: 100 }).map((a, b) => Array.from({ length: 100 }).map((c, d) => ({
|
|
1742
|
+
// "r": b,
|
|
1743
|
+
// "c": d,
|
|
1744
|
+
// "v": { "ct": { "fa": "@", "t": "s" }, }
|
|
1745
|
+
// }))))
|
|
1746
|
+
// ,
|
|
1747
|
+
celldata: data && data.length !== 0 ? data : ___default['default'].flattenDeep(Array.from({
|
|
1730
1748
|
length: 100
|
|
1731
1749
|
}).map(function (a, b) {
|
|
1732
1750
|
return Array.from({
|
|
@@ -1903,7 +1921,9 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
|
|
|
1903
1921
|
updateData = _this$props.updateData,
|
|
1904
1922
|
columns = _this$props.columns;
|
|
1905
1923
|
|
|
1906
|
-
var resultData = _this.getData()
|
|
1924
|
+
var resultData = _this.getData().filter(function (d) {
|
|
1925
|
+
return ___default['default'].compact(Object.values(d)).length;
|
|
1926
|
+
});
|
|
1907
1927
|
|
|
1908
1928
|
axios__default['default'].post(validDataUrl, {
|
|
1909
1929
|
columns: columns,
|
|
@@ -2308,15 +2328,72 @@ function ToCDB(str) {
|
|
|
2308
2328
|
return tmp;
|
|
2309
2329
|
}
|
|
2310
2330
|
|
|
2331
|
+
/*
|
|
2332
|
+
* @Description:
|
|
2333
|
+
* @Author: rodchen
|
|
2334
|
+
* @Date: 2022-01-14 14:12:01
|
|
2335
|
+
* @LastEditTime: 2022-01-14 17:17:26
|
|
2336
|
+
* @LastEditors: rodchen
|
|
2337
|
+
*/
|
|
2338
|
+
var index = (function (storageKeyString) {
|
|
2339
|
+
var seconds = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
|
|
2340
|
+
var tipsCallFunction = arguments.length > 2 ? arguments[2] : undefined;
|
|
2341
|
+
if (typeof seconds !== 'number') throw new Error('seconds should be number');
|
|
2342
|
+
var cacheValue = getStorageVale(storageKeyString);
|
|
2343
|
+
|
|
2344
|
+
if (document.hidden !== undefined) {
|
|
2345
|
+
document.addEventListener('visibilitychange', function () {
|
|
2346
|
+
if (!document.hidden) {
|
|
2347
|
+
var currentValue = getStorageVale(storageKeyString);
|
|
2348
|
+
|
|
2349
|
+
if (currentValue !== cacheValue) {
|
|
2350
|
+
if (tipsCallFunction && typeof tipsCallFunction === 'function') {
|
|
2351
|
+
tipsCallFunction();
|
|
2352
|
+
} else {
|
|
2353
|
+
window.alert('检测新用户登录,当前页面会在2s之后刷新!');
|
|
2354
|
+
}
|
|
2355
|
+
|
|
2356
|
+
setTimeout(function () {
|
|
2357
|
+
window.location.reload();
|
|
2358
|
+
}, seconds * 1000);
|
|
2359
|
+
}
|
|
2360
|
+
}
|
|
2361
|
+
});
|
|
2362
|
+
}
|
|
2363
|
+
});
|
|
2364
|
+
|
|
2365
|
+
function getStorageVale(storageKeyString) {
|
|
2366
|
+
var _storageKeyString$spl = storageKeyString.split('.'),
|
|
2367
|
+
_storageKeyString$spl2 = _toArray(_storageKeyString$spl),
|
|
2368
|
+
localstorage = _storageKeyString$spl2[0],
|
|
2369
|
+
restKeyArrays = _storageKeyString$spl2.slice(1);
|
|
2370
|
+
|
|
2371
|
+
var localStorageInfo = window.localStorage.getItem(localstorage);
|
|
2372
|
+
if (!restKeyArrays.length) return localStorageInfo;
|
|
2373
|
+
var returnVal = JSON.parse(localStorageInfo || '{}');
|
|
2374
|
+
|
|
2375
|
+
for (var i = 0; i < restKeyArrays.length; i++) {
|
|
2376
|
+
returnVal = returnVal[restKeyArrays[i]];
|
|
2377
|
+
if (!returnVal) return '';
|
|
2378
|
+
|
|
2379
|
+
if (typeof returnVal === 'string') {
|
|
2380
|
+
return returnVal;
|
|
2381
|
+
}
|
|
2382
|
+
}
|
|
2383
|
+
|
|
2384
|
+
return "";
|
|
2385
|
+
}
|
|
2386
|
+
|
|
2311
2387
|
/*
|
|
2312
2388
|
* @Description:
|
|
2313
2389
|
* @Author: rodchen
|
|
2314
2390
|
* @Date: 2021-11-30 22:59:39
|
|
2315
|
-
* @LastEditTime:
|
|
2391
|
+
* @LastEditTime: 2022-01-14 16:10:27
|
|
2316
2392
|
* @LastEditors: rodchen
|
|
2317
2393
|
*/
|
|
2318
2394
|
var resposne = JSON.parse(localStorage.getItem('userInfo') || '{}');
|
|
2319
2395
|
axios__default['default'].defaults.headers.common['sso-sessionid'] = (resposne === null || resposne === void 0 ? void 0 : resposne.sessionId) || '';
|
|
2320
2396
|
|
|
2397
|
+
exports.CheckOneUser = index;
|
|
2321
2398
|
exports.DataValidation = DataValidation;
|
|
2322
2399
|
exports.QueryMutipleInput = QueryMutipleInput;
|
package/package.json
CHANGED
|
@@ -23,7 +23,9 @@ export default () => {
|
|
|
23
23
|
return (
|
|
24
24
|
<div>
|
|
25
25
|
<DataValidation
|
|
26
|
-
columns={['skuCode', 'quantity', 'price']}
|
|
26
|
+
// columns={['skuCode', 'quantity', 'price']}
|
|
27
|
+
columns={["skuCode", "quantity", "price"]} // 需要哪些列展示,以及展示的顺序
|
|
28
|
+
validDataUrl="http://test.i-baby.net/wms-ops/recordDetailImport/check" // 校验的接口url
|
|
27
29
|
onRef={(ref) => {
|
|
28
30
|
dataValidationRef = ref;
|
|
29
31
|
}}
|
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
} from '@ant-design/icons';
|
|
28
28
|
import axios from 'axios';
|
|
29
29
|
import './index.less';
|
|
30
|
+
import _ from "loadsh"
|
|
30
31
|
|
|
31
32
|
const luckysheet = window.luckysheet;
|
|
32
33
|
|
|
@@ -176,6 +177,10 @@ class DataValidation extends React.Component {
|
|
|
176
177
|
if (typeof cell.v === 'string') {
|
|
177
178
|
cell.m = cell.v = cell.m.trim();
|
|
178
179
|
}
|
|
180
|
+
if (typeof cell.v === 'number') {
|
|
181
|
+
cell.v = cell.v.toString()
|
|
182
|
+
cell.m = cell.v
|
|
183
|
+
}
|
|
179
184
|
}
|
|
180
185
|
// console.log(postion);
|
|
181
186
|
},
|
|
@@ -209,6 +214,13 @@ class DataValidation extends React.Component {
|
|
|
209
214
|
defaultRowHeight: 20, //自定义行高
|
|
210
215
|
defaultColWidth: 120, //自定义列宽
|
|
211
216
|
config: {},
|
|
217
|
+
// celldata:
|
|
218
|
+
// data && data.length !== 0 ? data : _.flattenDeep(Array.from({ length: 100 }).map((a, b) => Array.from({ length: 100 }).map((c, d) => ({
|
|
219
|
+
// "r": b,
|
|
220
|
+
// "c": d,
|
|
221
|
+
// "v": { "ct": { "fa": "@", "t": "s" }, }
|
|
222
|
+
// }))))
|
|
223
|
+
// ,
|
|
212
224
|
celldata:
|
|
213
225
|
data && data.length !== 0 ? data : _.flattenDeep(Array.from({ length: 100 }).map((a, b) => Array.from({ length: 100 }).map((c, d) => ({
|
|
214
226
|
"r": b,
|
|
@@ -342,6 +354,7 @@ class DataValidation extends React.Component {
|
|
|
342
354
|
|
|
343
355
|
getValidateData = () => {
|
|
344
356
|
const { resultData } = this.state;
|
|
357
|
+
|
|
345
358
|
return {
|
|
346
359
|
successData: resultData
|
|
347
360
|
.filter((item) => item.flag)
|
|
@@ -372,7 +385,9 @@ class DataValidation extends React.Component {
|
|
|
372
385
|
|
|
373
386
|
resetData = () => {
|
|
374
387
|
const { validDataUrl, updateData, columns } = this.props;
|
|
375
|
-
const resultData = this.getData()
|
|
388
|
+
const resultData = this.getData().filter(d => {
|
|
389
|
+
return _.compact(Object.values(d)).length
|
|
390
|
+
})
|
|
376
391
|
|
|
377
392
|
axios
|
|
378
393
|
.post(validDataUrl, {
|
package/src/index.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Description:
|
|
3
3
|
* @Author: rodchen
|
|
4
4
|
* @Date: 2021-11-30 22:59:39
|
|
5
|
-
* @LastEditTime:
|
|
5
|
+
* @LastEditTime: 2022-01-14 16:10:27
|
|
6
6
|
* @LastEditors: rodchen
|
|
7
7
|
*/
|
|
8
8
|
|
|
@@ -14,3 +14,5 @@ axios.defaults.headers.common['sso-sessionid'] = resposne?.sessionId || '';
|
|
|
14
14
|
|
|
15
15
|
export { default as DataValidation } from './components/DataValidation';
|
|
16
16
|
export { default as QueryMutipleInput } from './components/QueryMutipleInput';
|
|
17
|
+
export { default as CheckOneUser } from './utils/CheckOneUser';
|
|
18
|
+
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
nav:
|
|
3
|
+
title: '工具方法'
|
|
4
|
+
order: 2
|
|
5
|
+
group:
|
|
6
|
+
title: 方法
|
|
7
|
+
order: 0
|
|
8
|
+
title: 确保单用户登录
|
|
9
|
+
order: 1
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## CheckOneUser
|
|
13
|
+
|
|
14
|
+
Demo:
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
import React, { useRef } from 'react';
|
|
18
|
+
import { message } from 'antd';
|
|
19
|
+
|
|
20
|
+
import { CheckOneUser } from '../../index';
|
|
21
|
+
|
|
22
|
+
CheckOneUser('userInfo.a.information.name', 3, () => {
|
|
23
|
+
message.warning('检测新用户登录,当前页面会在3s之后刷新!');
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
export default () => {
|
|
27
|
+
|
|
28
|
+
const handleOnChange = (value) => {
|
|
29
|
+
console.log(value);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<div>
|
|
34
|
+
</div>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
More skills for writing demo: https://d.umijs.org/guide/demo-principle
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Description:
|
|
3
|
+
* @Author: rodchen
|
|
4
|
+
* @Date: 2022-01-14 14:12:01
|
|
5
|
+
* @LastEditTime: 2022-01-14 17:17:26
|
|
6
|
+
* @LastEditors: rodchen
|
|
7
|
+
*/
|
|
8
|
+
export default (storageKeyString: string, seconds: number = 2, tipsCallFunction?: () =>{}) => {
|
|
9
|
+
if (typeof seconds !== 'number' ) throw new Error('seconds should be number');
|
|
10
|
+
|
|
11
|
+
let cacheValue = getStorageVale(storageKeyString);
|
|
12
|
+
|
|
13
|
+
if (document.hidden !== undefined) {
|
|
14
|
+
document.addEventListener('visibilitychange', () => {
|
|
15
|
+
if (!document.hidden) {
|
|
16
|
+
let currentValue = getStorageVale(storageKeyString);
|
|
17
|
+
if (currentValue !== cacheValue) {
|
|
18
|
+
if (tipsCallFunction && typeof tipsCallFunction === 'function') {
|
|
19
|
+
tipsCallFunction();
|
|
20
|
+
} else {
|
|
21
|
+
window.alert('检测新用户登录,当前页面会在2s之后刷新!');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
setTimeout(() => {
|
|
25
|
+
window.location.reload();
|
|
26
|
+
}, seconds * 1000)
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
})
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function getStorageVale (storageKeyString: string) {
|
|
34
|
+
var [localstorage, ...restKeyArrays] = storageKeyString.split('.');
|
|
35
|
+
let localStorageInfo = window.localStorage.getItem(localstorage)
|
|
36
|
+
|
|
37
|
+
if (!restKeyArrays.length) return localStorageInfo;
|
|
38
|
+
|
|
39
|
+
let returnVal = JSON.parse(localStorageInfo || '{}');
|
|
40
|
+
|
|
41
|
+
for(let i = 0; i < restKeyArrays.length; i++ ) {
|
|
42
|
+
returnVal = returnVal[restKeyArrays[i]]
|
|
43
|
+
|
|
44
|
+
if (!returnVal) return '';
|
|
45
|
+
|
|
46
|
+
if (typeof returnVal === 'string') {
|
|
47
|
+
return returnVal
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return ""
|
|
52
|
+
}
|