@infly/libs 2.0.26 → 2.0.36
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/bin/cli.js +1 -0
- package/build/build-dist/index.js +64 -32
- package/build/webpack5/remove-legacy-assets-plugin.js +84 -0
- package/build/webpack5/webpack.base.js +218 -19
- package/index.js +10 -0
- package/module/Permission.js +101 -42
- package/module/REST.js +62 -15
- package/module/Router.js +15 -0
- package/module/Uts.js +299 -288
- package/package.json +6 -5
- package/script/git-automation/index.js +165 -18
- package/script/index.js +8 -8
- package/script/webhook/webhook.js +5 -4
- package/store/modules/user.js +94 -9
- package/tools/file-export.js +20 -1
- package/tools/file-process.js +3 -0
- package/dataInit/commonTypeMap.js +0 -31
- package/dataInit/marketingActivitiesMap.js +0 -214
- package/dataInit/orderMap.js +0 -13
- package/dataInit/personalMap.js +0 -19
- package/dataInit/settlementMap.js +0 -17
package/module/Uts.js
CHANGED
|
@@ -17,45 +17,45 @@ let $state = {
|
|
|
17
17
|
preParams: {},
|
|
18
18
|
preState: {},
|
|
19
19
|
state: {},
|
|
20
|
-
setPreName: function(value) {
|
|
20
|
+
setPreName: function (value) {
|
|
21
21
|
this.preName = value;
|
|
22
22
|
},
|
|
23
|
-
getPreName: function() {
|
|
23
|
+
getPreName: function () {
|
|
24
24
|
return this.preName;
|
|
25
25
|
},
|
|
26
|
-
setPreParams: function(value) {
|
|
26
|
+
setPreParams: function (value) {
|
|
27
27
|
this.preParams = value;
|
|
28
28
|
},
|
|
29
|
-
getPreParams: function() {
|
|
29
|
+
getPreParams: function () {
|
|
30
30
|
return this.preParams;
|
|
31
31
|
},
|
|
32
|
-
setStateName: function(value) {
|
|
32
|
+
setStateName: function (value) {
|
|
33
33
|
this.setPreName(this.name);
|
|
34
34
|
this.name = value;
|
|
35
35
|
},
|
|
36
|
-
setParams: function(value) {
|
|
36
|
+
setParams: function (value) {
|
|
37
37
|
this.setPreParams(this.params);
|
|
38
38
|
this.params = value;
|
|
39
39
|
},
|
|
40
|
-
getStateName: function() {
|
|
40
|
+
getStateName: function () {
|
|
41
41
|
return this.name;
|
|
42
42
|
},
|
|
43
|
-
getParams: function() {
|
|
43
|
+
getParams: function () {
|
|
44
44
|
return this.params;
|
|
45
45
|
},
|
|
46
|
-
setState: function(value) {
|
|
46
|
+
setState: function (value) {
|
|
47
47
|
this.State = value;
|
|
48
48
|
},
|
|
49
|
-
getState: function() {
|
|
49
|
+
getState: function () {
|
|
50
50
|
return this.State;
|
|
51
51
|
},
|
|
52
|
-
setSearch: function(value) {
|
|
52
|
+
setSearch: function (value) {
|
|
53
53
|
this.search = value;
|
|
54
54
|
},
|
|
55
|
-
go: function(options) {
|
|
55
|
+
go: function (options) {
|
|
56
56
|
global.Uts.$stateGo(options);
|
|
57
57
|
},
|
|
58
|
-
to: function(path) {
|
|
58
|
+
to: function (path) {
|
|
59
59
|
global.Uts.$stateTo(path);
|
|
60
60
|
}
|
|
61
61
|
};
|
|
@@ -79,7 +79,7 @@ let Uts = {
|
|
|
79
79
|
* Uts.ce('请检查配置');
|
|
80
80
|
*/
|
|
81
81
|
ce(text) {
|
|
82
|
-
global.console.error && global.console.error(text);
|
|
82
|
+
global.console && global.console.error && global.console.error(text);
|
|
83
83
|
},
|
|
84
84
|
/**
|
|
85
85
|
* set class 动态设置类名
|
|
@@ -382,7 +382,7 @@ let Uts = {
|
|
|
382
382
|
if (Uts.isFunction(cb)) {
|
|
383
383
|
// for (let key in obj) {
|
|
384
384
|
let keys = Uts.getObjectKeys(obj);
|
|
385
|
-
Uts.each(keys, function(key, index, run) {
|
|
385
|
+
Uts.each(keys, function (key, index, run) {
|
|
386
386
|
let shouldStop = cb(obj[key], key, run);
|
|
387
387
|
if (shouldStop) {
|
|
388
388
|
Uts.pauseEach = true;
|
|
@@ -559,7 +559,7 @@ Uts.generateArray(5,true)
|
|
|
559
559
|
return arr;
|
|
560
560
|
} else {
|
|
561
561
|
let newArr = [];
|
|
562
|
-
Uts.each(arr, function(item, index) {
|
|
562
|
+
Uts.each(arr, function (item, index) {
|
|
563
563
|
newArr.push(index);
|
|
564
564
|
});
|
|
565
565
|
return newArr;
|
|
@@ -754,7 +754,7 @@ Uts.mergeArrayWithoutDuplicate([1,2,3,4,5,6],[9,3,3,2,1])
|
|
|
754
754
|
let notDuplicateObj = {};
|
|
755
755
|
let concatArray = Uts.concat(rawArr, valueArray);
|
|
756
756
|
let resultArray = [];
|
|
757
|
-
Uts.each(concatArray, function(item, index) {
|
|
757
|
+
Uts.each(concatArray, function (item, index) {
|
|
758
758
|
let notDuplicateKey = item;
|
|
759
759
|
if (Uts.isPureObject(item)) {
|
|
760
760
|
notDuplicateKey = item[key];
|
|
@@ -783,7 +783,7 @@ console.log(arr1);
|
|
|
783
783
|
Array.prototype.unshift.apply(rawArr, valueArray);
|
|
784
784
|
}
|
|
785
785
|
},
|
|
786
|
-
overrideCookieName: function(cookieName, isSet) {
|
|
786
|
+
overrideCookieName: function (cookieName, isSet) {
|
|
787
787
|
return cookieName;
|
|
788
788
|
let currentProject = Uts.getCurrentProject();
|
|
789
789
|
let exceptProject = { omsLoginToken: true, SPAccrosToken: true, examLoginToken: true };
|
|
@@ -905,7 +905,7 @@ console.log(arr1);
|
|
|
905
905
|
options.expires = -1;
|
|
906
906
|
Uts.setCookie(cname, cvalue, options);
|
|
907
907
|
},
|
|
908
|
-
isUI6Page: function(stateName) {
|
|
908
|
+
isUI6Page: function (stateName) {
|
|
909
909
|
let currentProject = Uts.getCurrentProject();
|
|
910
910
|
let hadUpdateUI6Project = ["pm", "srm", "ui"];
|
|
911
911
|
if (Uts.contain(hadUpdateUI6Project, currentProject)) {
|
|
@@ -922,11 +922,11 @@ console.log(arr1);
|
|
|
922
922
|
return false;
|
|
923
923
|
},
|
|
924
924
|
|
|
925
|
-
copyCleanFormData: function(formData, options = {}) {
|
|
925
|
+
copyCleanFormData: function (formData, options = {}) {
|
|
926
926
|
const { filterMark = true } = options;
|
|
927
927
|
let cleanFormData = {};
|
|
928
928
|
let markPropList = ["$$valid", "$$status"];
|
|
929
|
-
Uts.objEach(formData, function(value, key) {
|
|
929
|
+
Uts.objEach(formData, function (value, key) {
|
|
930
930
|
if (filterMark && Uts.contain(markPropList, Uts.safeRegString(key))) {
|
|
931
931
|
return;
|
|
932
932
|
}
|
|
@@ -937,8 +937,8 @@ console.log(arr1);
|
|
|
937
937
|
});
|
|
938
938
|
return cleanFormData;
|
|
939
939
|
},
|
|
940
|
-
callLogout: function(callback) {
|
|
941
|
-
callback = callback || function() {};
|
|
940
|
+
callLogout: function (callback) {
|
|
941
|
+
callback = callback || function () {};
|
|
942
942
|
let ignoreProjectList = [
|
|
943
943
|
/*"oms", "sp"*/
|
|
944
944
|
];
|
|
@@ -1008,7 +1008,7 @@ console.log(arr1);
|
|
|
1008
1008
|
|
|
1009
1009
|
let secondDomain = Uts.copyObj(cookieDomain);
|
|
1010
1010
|
secondDomain.domain = location.host;
|
|
1011
|
-
Object.keys(cookiesMap).forEach(key => {
|
|
1011
|
+
Object.keys(cookiesMap).forEach((key) => {
|
|
1012
1012
|
if (!Uts.contain(Uts.keeyCookieWhenLogOut, key) && !Uts.contain(options.keyCookie, key)) {
|
|
1013
1013
|
_self.setCookie(key, "", cookieDomain);
|
|
1014
1014
|
_self.setCookie(key, "", secondDomain);
|
|
@@ -1025,7 +1025,7 @@ console.log(arr1);
|
|
|
1025
1025
|
if (keepStore) {
|
|
1026
1026
|
Uts.rebackStoreList();
|
|
1027
1027
|
if (Uts.isObject(keepStore)) {
|
|
1028
|
-
Uts.objEach(keepStore, function(item, index) {
|
|
1028
|
+
Uts.objEach(keepStore, function (item, index) {
|
|
1029
1029
|
sessionStorage.setItem(index, keepStore[index]);
|
|
1030
1030
|
});
|
|
1031
1031
|
}
|
|
@@ -1048,7 +1048,7 @@ console.log(arr1);
|
|
|
1048
1048
|
Uts.getTodayCache('userInfo')
|
|
1049
1049
|
{name: 'zhangsan'}
|
|
1050
1050
|
*/
|
|
1051
|
-
getTodayCache: function(storageKey) {
|
|
1051
|
+
getTodayCache: function (storageKey) {
|
|
1052
1052
|
let cacheValue = storage.get(Uts.EVERYDAYCACHE);
|
|
1053
1053
|
if (cacheValue) {
|
|
1054
1054
|
return cacheValue[storageKey];
|
|
@@ -1063,7 +1063,7 @@ Uts.getTodayCache('userInfo')
|
|
|
1063
1063
|
* @example
|
|
1064
1064
|
* Uts.setTodayCache('userInfo',{name:'zhangsan'})
|
|
1065
1065
|
*/
|
|
1066
|
-
setTodayCache: function(storageKey, valueToSet = true) {
|
|
1066
|
+
setTodayCache: function (storageKey, valueToSet = true) {
|
|
1067
1067
|
let limitTime = new Date().addDay(1).ZenFormat("Y-m-d") + " 00:00:00";
|
|
1068
1068
|
let cacheValue = storage.get(Uts.EVERYDAYCACHE) || {};
|
|
1069
1069
|
cacheValue[storageKey] = valueToSet;
|
|
@@ -1090,7 +1090,7 @@ Uts.getTodayCache('userInfo')
|
|
|
1090
1090
|
},
|
|
1091
1091
|
|
|
1092
1092
|
//返回能否自动登录
|
|
1093
|
-
getAutoLoginInfo: function(_loginSite) {
|
|
1093
|
+
getAutoLoginInfo: function (_loginSite) {
|
|
1094
1094
|
let loginSite = _loginSite || $state.params.loginSite || "www";
|
|
1095
1095
|
let autoLoginInfo = Uts.storage.get("autoLoginInfo") || { www: {}, oms: {}, hms: {} };
|
|
1096
1096
|
if (Uts.getCookie("autoLoginInfo") && JSON.parse(Uts.getCookie("autoLoginInfo"))) {
|
|
@@ -1113,7 +1113,7 @@ Uts.getTodayCache('userInfo')
|
|
|
1113
1113
|
}
|
|
1114
1114
|
if (Uts.autoKeepSessionWhenLogOut && Uts.autoKeepSessionWhenLogOut.length > 0) {
|
|
1115
1115
|
let resultObj = {};
|
|
1116
|
-
Uts.each(Uts.autoKeepSessionWhenLogOut, function(item, index) {
|
|
1116
|
+
Uts.each(Uts.autoKeepSessionWhenLogOut, function (item, index) {
|
|
1117
1117
|
resultObj[item] = sessionStorage.getItem(item);
|
|
1118
1118
|
});
|
|
1119
1119
|
result = resultObj;
|
|
@@ -1124,7 +1124,7 @@ Uts.getTodayCache('userInfo')
|
|
|
1124
1124
|
saveTempStoreList(list) {
|
|
1125
1125
|
let tempMaps = {};
|
|
1126
1126
|
list &&
|
|
1127
|
-
list.map(item => {
|
|
1127
|
+
list.map((item) => {
|
|
1128
1128
|
// let val = Uts.storage.get(item);
|
|
1129
1129
|
let val = localStorage[item];
|
|
1130
1130
|
try {
|
|
@@ -1139,7 +1139,7 @@ Uts.getTodayCache('userInfo')
|
|
|
1139
1139
|
let tempMaps = Uts.tempMaps;
|
|
1140
1140
|
let keys = Object.keys(tempMaps);
|
|
1141
1141
|
keys &&
|
|
1142
|
-
keys.map(key => {
|
|
1142
|
+
keys.map((key) => {
|
|
1143
1143
|
let value = tempMaps[key];
|
|
1144
1144
|
let expires = 0;
|
|
1145
1145
|
if (Uts.isPureObject(value)) {
|
|
@@ -1164,7 +1164,7 @@ Uts.getTodayCache('userInfo')
|
|
|
1164
1164
|
* Uts.highlightKeyWord("<span class='test'>广州锐竞信息科技有限责任公司</span>",['广州','锐竞', '广州锐竞']);
|
|
1165
1165
|
"<span class='zen_red'><span class='zen_red'><span class='test'>广州<span class='zen_red'></span>锐竞</span></span>信息科技有限责任公司</span>"
|
|
1166
1166
|
*/
|
|
1167
|
-
highlightKeyWord: function(str = "", keywordList = [], config = {}) {
|
|
1167
|
+
highlightKeyWord: function (str = "", keywordList = [], config = {}) {
|
|
1168
1168
|
const { tag = "span", className = "zen_red", onMatch } = config;
|
|
1169
1169
|
// let startWord = "#####";
|
|
1170
1170
|
let startWord = "<" + tag + " class='" + className + "'>";
|
|
@@ -1180,12 +1180,12 @@ Uts.getTodayCache('userInfo')
|
|
|
1180
1180
|
keywordList = [keywordList];
|
|
1181
1181
|
}
|
|
1182
1182
|
if (Uts.isArray(keywordList)) {
|
|
1183
|
-
Uts.each(keywordList, function(keyword, index) {
|
|
1183
|
+
Uts.each(keywordList, function (keyword, index) {
|
|
1184
1184
|
if (Uts.notEmptyString(keyword)) {
|
|
1185
1185
|
// let regStr = keyword.replace(/(.)/g, "([#$]{5,6}){0,}$1([#$]{5,6}){0,}");
|
|
1186
1186
|
let regStr = keyword.replace(/(.)/g, "(" + startWordReg + "){0,}$1(" + endWordReg + "){0,}");
|
|
1187
1187
|
let reg = new RegExp(regStr, "g");
|
|
1188
|
-
computeStr = computeStr.replace(reg, function(partMatch, fullMatch) {
|
|
1188
|
+
computeStr = computeStr.replace(reg, function (partMatch, fullMatch) {
|
|
1189
1189
|
if (Uts.isFunction(onMatch)) {
|
|
1190
1190
|
return onMatch(partMatch, startWord, endWord);
|
|
1191
1191
|
} else {
|
|
@@ -1210,7 +1210,7 @@ Uts.getTodayCache('userInfo')
|
|
|
1210
1210
|
* Uts.formatDate(new Date(),'Y-m-d H:i:s')
|
|
1211
1211
|
'2022-07-19 11:34:15'
|
|
1212
1212
|
*/
|
|
1213
|
-
formatDate: function(date, format) {
|
|
1213
|
+
formatDate: function (date, format) {
|
|
1214
1214
|
if (!date) {
|
|
1215
1215
|
return false;
|
|
1216
1216
|
}
|
|
@@ -1250,7 +1250,7 @@ Uts.getTodayCache('userInfo')
|
|
|
1250
1250
|
return encodeURIComponent(s);
|
|
1251
1251
|
},
|
|
1252
1252
|
|
|
1253
|
-
cookiesMap: function() {
|
|
1253
|
+
cookiesMap: function () {
|
|
1254
1254
|
var cookies = document.cookie ? document.cookie.split("; ") : [];
|
|
1255
1255
|
var result = {};
|
|
1256
1256
|
for (var i = 0, l = cookies.length; i < l; i++) {
|
|
@@ -1295,10 +1295,11 @@ Uts.getEnv()
|
|
|
1295
1295
|
getEnv(string) {
|
|
1296
1296
|
let config = {};
|
|
1297
1297
|
let host = string || location.host;
|
|
1298
|
-
const projectConfig =
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1298
|
+
const projectConfig =
|
|
1299
|
+
{
|
|
1300
|
+
[process.env.VUE_APP_PROJECT_NAME]: { reqModule: "admin" },
|
|
1301
|
+
["postal-benefits-platform-level"]: { reqModule: "management" }
|
|
1302
|
+
}[process.env.VUE_APP_PROJECT_NAME] || {};
|
|
1302
1303
|
|
|
1303
1304
|
config.rootDomain = (host.match(Uts.FINDDOMAINEXP) && host.match(Uts.FINDDOMAINEXP)[0]) || null;
|
|
1304
1305
|
config.env = "";
|
|
@@ -1409,11 +1410,11 @@ Uts.findObjByCondition(arr1,{a:1,f:3});
|
|
|
1409
1410
|
let _self = this;
|
|
1410
1411
|
let result = [];
|
|
1411
1412
|
let keys = Object.getOwnPropertyNames(cond);
|
|
1412
|
-
_self.each(arr, function(item, index) {
|
|
1413
|
+
_self.each(arr, function (item, index) {
|
|
1413
1414
|
let isMatch = true;
|
|
1414
1415
|
let matchIndex;
|
|
1415
1416
|
if (!isStrictMode || (isStrictMode && Object.getOwnPropertyNames(item).length == keys.length)) {
|
|
1416
|
-
_self.each(keys, function(keysItem, keysIndex) {
|
|
1417
|
+
_self.each(keys, function (keysItem, keysIndex) {
|
|
1417
1418
|
if (!Uts.isPureObject(item) || item[keysItem] != cond[keysItem]) {
|
|
1418
1419
|
isMatch = false;
|
|
1419
1420
|
}
|
|
@@ -1471,7 +1472,7 @@ Uts.filterObjByCondition(arr1,{a:1,f:3});
|
|
|
1471
1472
|
*/
|
|
1472
1473
|
filterObjByCondition(arr, cond, isStrictMode) {
|
|
1473
1474
|
let findResult = Uts.findObjByCondition(arr, cond, isStrictMode);
|
|
1474
|
-
return findResult;
|
|
1475
|
+
return findResult || [];
|
|
1475
1476
|
},
|
|
1476
1477
|
|
|
1477
1478
|
/**
|
|
@@ -1512,9 +1513,9 @@ Uts.filterObjByRegexpCondition([{a:1},{a:2},{a:3},{b:2}],{a:"1",b:2},null,true)
|
|
|
1512
1513
|
let result = [];
|
|
1513
1514
|
let keys = Uts.getObjectKeys(cond);
|
|
1514
1515
|
if (Uts.notEmptyArray(arr)) {
|
|
1515
|
-
Uts.each(arr, function(item, index) {
|
|
1516
|
+
Uts.each(arr, function (item, index) {
|
|
1516
1517
|
let isMatch = isSingleMode ? false : true; //如果是单条件匹配模式,则初始化默认为不match;否则默认为match
|
|
1517
|
-
Uts.each(keys, function(keyItem, keyIndex, run) {
|
|
1518
|
+
Uts.each(keys, function (keyItem, keyIndex, run) {
|
|
1518
1519
|
let condValue = cond[keyItem];
|
|
1519
1520
|
let itemValue = item[keyItem];
|
|
1520
1521
|
if (isIgnoreCase) {
|
|
@@ -1598,7 +1599,7 @@ false
|
|
|
1598
1599
|
if (Uts.isObject(rawObject) && Uts.isObject(compareObject)) {
|
|
1599
1600
|
let rawKeys = Uts.getObjectKeys(rawObject);
|
|
1600
1601
|
if (rawKeys.length == Uts.getObjectKeys(compareObject).length) {
|
|
1601
|
-
Uts.each(rawKeys, function(item, index) {
|
|
1602
|
+
Uts.each(rawKeys, function (item, index) {
|
|
1602
1603
|
let rawItem = rawObject[item];
|
|
1603
1604
|
let compareItem = compareObject[item];
|
|
1604
1605
|
if (Uts.isObject(rawItem) && Uts.isObject(compareItem)) {
|
|
@@ -1665,12 +1666,12 @@ console.log(o1)
|
|
|
1665
1666
|
}
|
|
1666
1667
|
if (isOverride) {
|
|
1667
1668
|
let propertyList = Uts.getObjectKeys(object);
|
|
1668
|
-
Uts.each(propertyList, function(item, index) {
|
|
1669
|
+
Uts.each(propertyList, function (item, index) {
|
|
1669
1670
|
delete object[item];
|
|
1670
1671
|
});
|
|
1671
1672
|
}
|
|
1672
1673
|
let newPropertyList = Uts.getObjectKeys(valueObject);
|
|
1673
|
-
Uts.each(newPropertyList, function(item, index) {
|
|
1674
|
+
Uts.each(newPropertyList, function (item, index) {
|
|
1674
1675
|
object[item] = valueObject[item];
|
|
1675
1676
|
});
|
|
1676
1677
|
},
|
|
@@ -1685,7 +1686,7 @@ console.log(o1)
|
|
|
1685
1686
|
if (!source || typeof source !== "object") return target;
|
|
1686
1687
|
if (!target || typeof target !== "object") return source;
|
|
1687
1688
|
|
|
1688
|
-
Object.keys(source).forEach(key => {
|
|
1689
|
+
Object.keys(source).forEach((key) => {
|
|
1689
1690
|
const sourceValue = source[key];
|
|
1690
1691
|
const targetValue = target[key];
|
|
1691
1692
|
|
|
@@ -1781,7 +1782,7 @@ Uts.float(23,1)
|
|
|
1781
1782
|
function addZero(floatValue, currentLength, desLength) {
|
|
1782
1783
|
let lengthArr = new Array(desLength - currentLength);
|
|
1783
1784
|
let valueArr = [];
|
|
1784
|
-
Uts.each(lengthArr, function(item, index) {
|
|
1785
|
+
Uts.each(lengthArr, function (item, index) {
|
|
1785
1786
|
valueArr.push(0);
|
|
1786
1787
|
});
|
|
1787
1788
|
let toAddZero = valueArr.join("");
|
|
@@ -1840,10 +1841,7 @@ Uts.getNumberValueByUnit(928212,"千")
|
|
|
1840
1841
|
let unitConfig = ["分", "角", "元", "拾", "佰", "千", "万", "十万", "百万", "千万", "亿", "十亿", "百亿", "千亿"];
|
|
1841
1842
|
let unitIndexAtConfig = Uts.index(unitConfig, unit);
|
|
1842
1843
|
if (unitIndexAtConfig > -1) {
|
|
1843
|
-
let floatFormatValueRevertArray = floatFormatValue
|
|
1844
|
-
.replace(".", "")
|
|
1845
|
-
.split("")
|
|
1846
|
-
.reverse();
|
|
1844
|
+
let floatFormatValueRevertArray = floatFormatValue.replace(".", "").split("").reverse();
|
|
1847
1845
|
return floatFormatValueRevertArray[unitIndexAtConfig];
|
|
1848
1846
|
}
|
|
1849
1847
|
}
|
|
@@ -1941,7 +1939,7 @@ Uts.TR(false,'a',"b")
|
|
|
1941
1939
|
//例如某个状态下,只有某个单位采用这个文案,其他单位不是
|
|
1942
1940
|
//Uts.textConfig(data.order.status, Uts.getAutoMatchFromConfig({ key: "status", value: "text", list: Uts.orderStatusMaps }), "order")
|
|
1943
1941
|
*/
|
|
1944
|
-
textConfig: function(status, matchObj = {}, type, customText = Uts.textConfigObject) {
|
|
1942
|
+
textConfig: function (status, matchObj = {}, type, customText = Uts.textConfigObject) {
|
|
1945
1943
|
let orgCode = Uts.getCookie("orgCode");
|
|
1946
1944
|
if (!Uts.isPureObject(customText)) {
|
|
1947
1945
|
// ZenUI.error("请先配置Uts.textConfigObject");
|
|
@@ -1966,7 +1964,7 @@ Uts.TR(false,'a',"b")
|
|
|
1966
1964
|
* @example
|
|
1967
1965
|
autoMatch(5,{"1":待提交,"2":"待审批","3":"预订中","5":"交易已完成"});
|
|
1968
1966
|
*/
|
|
1969
|
-
autoMatch: function(text, obj, config = {}) {
|
|
1967
|
+
autoMatch: function (text, obj, config = {}) {
|
|
1970
1968
|
let {
|
|
1971
1969
|
key = "status",
|
|
1972
1970
|
value = "text",
|
|
@@ -2000,7 +1998,7 @@ Uts.TR(false,'a',"b")
|
|
|
2000
1998
|
}
|
|
2001
1999
|
if (Uts.notEmptyArray(text) && parseArray) {
|
|
2002
2000
|
let resultStrArray = [];
|
|
2003
|
-
Uts.each(text, function(singleText, singleTextIndex) {
|
|
2001
|
+
Uts.each(text, function (singleText, singleTextIndex) {
|
|
2004
2002
|
resultStrArray.push(obj[singleText]);
|
|
2005
2003
|
});
|
|
2006
2004
|
return resultStrArray.join(sperateSymbol);
|
|
@@ -2021,7 +2019,7 @@ Uts.TR(false,'a',"b")
|
|
|
2021
2019
|
//例如某个状态下,只有某个单位启用这个功能
|
|
2022
2020
|
//Uts.checkConfig('showFoundCard','ZHONG_SHAN_DA_XUE')
|
|
2023
2021
|
*/
|
|
2024
|
-
checkConfig: function(configName, orgCode, fullConfig = Uts.customConfig) {
|
|
2022
|
+
checkConfig: function (configName, orgCode, fullConfig = Uts.customConfig) {
|
|
2025
2023
|
let currentOrgCode = orgCode || Uts.getCookie("orgCode");
|
|
2026
2024
|
/*
|
|
2027
2025
|
配置列表(按业务区域分):
|
|
@@ -2050,7 +2048,7 @@ false
|
|
|
2050
2048
|
*/
|
|
2051
2049
|
checkCondition(conditionArrayList, type = "or") {
|
|
2052
2050
|
let isMatch = type == "or" ? false : true;
|
|
2053
|
-
Uts.each(conditionArrayList, function(result, index, run) {
|
|
2051
|
+
Uts.each(conditionArrayList, function (result, index, run) {
|
|
2054
2052
|
if (type == "or" && result) {
|
|
2055
2053
|
isMatch = true;
|
|
2056
2054
|
run.stop = true;
|
|
@@ -2146,7 +2144,7 @@ true
|
|
|
2146
2144
|
valueConfig.isNot = true;
|
|
2147
2145
|
}
|
|
2148
2146
|
let firstKey = "";
|
|
2149
|
-
key = key.replace(/([^\.]+\.)/, function(matchStr, fullStr) {
|
|
2147
|
+
key = key.replace(/([^\.]+\.)/, function (matchStr, fullStr) {
|
|
2150
2148
|
firstKey = matchStr.replace(/!|\./g, "");
|
|
2151
2149
|
return "";
|
|
2152
2150
|
});
|
|
@@ -2281,7 +2279,7 @@ true
|
|
|
2281
2279
|
return execConfig.matchResult;
|
|
2282
2280
|
}
|
|
2283
2281
|
if (Uts.notEmptyArray(configList)) {
|
|
2284
|
-
Uts.each(configList, function(configItem, configItemIndex, run) {
|
|
2282
|
+
Uts.each(configList, function (configItem, configItemIndex, run) {
|
|
2285
2283
|
// deepIndex stop for pre level
|
|
2286
2284
|
if (execConfig._stop) {
|
|
2287
2285
|
run.stop = true;
|
|
@@ -2290,7 +2288,7 @@ true
|
|
|
2290
2288
|
let singleThread = { matchAllExceptAndOne: true };
|
|
2291
2289
|
|
|
2292
2290
|
// 单个条件满足即为true,如果有andOne属性,同级属性满足后,递归判断满足一项即可
|
|
2293
|
-
Uts.objEach(configItem, function(perConfigValue, perConfigKey, perConfigRun) {
|
|
2291
|
+
Uts.objEach(configItem, function (perConfigValue, perConfigKey, perConfigRun) {
|
|
2294
2292
|
if (perConfigKey != "andOne") {
|
|
2295
2293
|
let currentConditionValue = Uts.getValueByExpression(perConfigKey, options);
|
|
2296
2294
|
if (!compareValueForType(perConfigValue, currentConditionValue)) {
|
|
@@ -2383,16 +2381,16 @@ Uts.useConfigExpression(
|
|
|
2383
2381
|
//返回结果
|
|
2384
2382
|
//{title: '文案2'}
|
|
2385
2383
|
*/
|
|
2386
|
-
useConfigExpression: function(configObject, options) {
|
|
2384
|
+
useConfigExpression: function (configObject, options) {
|
|
2387
2385
|
let resultObject = {};
|
|
2388
2386
|
if (Uts.isPureObject(configObject)) {
|
|
2389
|
-
Uts.objEach(configObject, function(value, key) {
|
|
2387
|
+
Uts.objEach(configObject, function (value, key) {
|
|
2390
2388
|
let matchAnyOne = true;
|
|
2391
2389
|
if (Uts.notEmptyArray(value)) {
|
|
2392
2390
|
let execResult = Uts.checkValueByExpression(value, matchAnyOne, options);
|
|
2393
2391
|
resultObject[key] = execResult;
|
|
2394
2392
|
} else if (Uts.isPureObject(value)) {
|
|
2395
|
-
Uts.objEach(value, function(itemValue, itemKey, run) {
|
|
2393
|
+
Uts.objEach(value, function (itemValue, itemKey, run) {
|
|
2396
2394
|
let childExecResult = Uts.checkValueByExpression(itemValue, matchAnyOne, options);
|
|
2397
2395
|
if (childExecResult) {
|
|
2398
2396
|
resultObject[key] = itemKey;
|
|
@@ -2440,7 +2438,7 @@ Filter.formatDate(1695555940859,'Y-m-d H:i:s')
|
|
|
2440
2438
|
i: 60 * second,
|
|
2441
2439
|
s: second
|
|
2442
2440
|
};
|
|
2443
|
-
str = str.replace(/(\d+)(\w)/g, function(a, b, c) {
|
|
2441
|
+
str = str.replace(/(\d+)(\w)/g, function (a, b, c) {
|
|
2444
2442
|
// console.log(a,b,c)
|
|
2445
2443
|
if (timeConfig[c]) {
|
|
2446
2444
|
return Number(b) * timeConfig[c] + "_";
|
|
@@ -2451,7 +2449,7 @@ Filter.formatDate(1695555940859,'Y-m-d H:i:s')
|
|
|
2451
2449
|
str = str.replace(/_$/, "");
|
|
2452
2450
|
let countArr = str.split("_");
|
|
2453
2451
|
let totalSecond = 0;
|
|
2454
|
-
Uts.each(countArr, function(item, index) {
|
|
2452
|
+
Uts.each(countArr, function (item, index) {
|
|
2455
2453
|
totalSecond += Number(item);
|
|
2456
2454
|
});
|
|
2457
2455
|
return parseInt(totalSecond + currentTime);
|
|
@@ -2497,7 +2495,7 @@ Filter.formatDate(1695555940859,'Y-m-d H:i:s')
|
|
|
2497
2495
|
let resultObj = { value: "" };
|
|
2498
2496
|
let defaultArr = ["天", "小时", "分", "秒"];
|
|
2499
2497
|
let cacheTimestamp = millisecond;
|
|
2500
|
-
Uts.each(defaultArr, function(str, index) {
|
|
2498
|
+
Uts.each(defaultArr, function (str, index) {
|
|
2501
2499
|
if (Uts.contain(arr, str)) {
|
|
2502
2500
|
let computeResult = cacheTimestamp.div(timeConfig[str]);
|
|
2503
2501
|
resultObj[str] = String(parseInt(computeResult));
|
|
@@ -2530,7 +2528,7 @@ Filter.formatDate(1695555940859,'Y-m-d H:i:s')
|
|
|
2530
2528
|
storage.get('WWWUseName')
|
|
2531
2529
|
'zhangsan'
|
|
2532
2530
|
*/
|
|
2533
|
-
get: function(name) {
|
|
2531
|
+
get: function (name) {
|
|
2534
2532
|
let value = localStorage.getItem(name);
|
|
2535
2533
|
try {
|
|
2536
2534
|
value = Uts.toJSON(value);
|
|
@@ -2556,7 +2554,7 @@ storage.get('WWWUseName')
|
|
|
2556
2554
|
* storage.set('key','some value');
|
|
2557
2555
|
* storage.set('key','some value','1h');
|
|
2558
2556
|
*/
|
|
2559
|
-
set: function(name, value, expires = 0) {
|
|
2557
|
+
set: function (name, value, expires = 0) {
|
|
2560
2558
|
if (Uts.isDefined(value)) {
|
|
2561
2559
|
if (Uts.isDefined(expires) && expires !== 0) {
|
|
2562
2560
|
value = {
|
|
@@ -2579,11 +2577,11 @@ storage.get('WWWUseName')
|
|
|
2579
2577
|
* @example
|
|
2580
2578
|
* storage.remove('testCache');
|
|
2581
2579
|
*/
|
|
2582
|
-
remove: function(name) {
|
|
2580
|
+
remove: function (name) {
|
|
2583
2581
|
localStorage.removeItem(name);
|
|
2584
2582
|
},
|
|
2585
2583
|
|
|
2586
|
-
clear: function(name) {
|
|
2584
|
+
clear: function (name) {
|
|
2587
2585
|
localStorage.clear();
|
|
2588
2586
|
},
|
|
2589
2587
|
/**
|
|
@@ -2611,7 +2609,7 @@ storage.get('WWWUseName')
|
|
|
2611
2609
|
* @example
|
|
2612
2610
|
* storage.setProjectCache('user')
|
|
2613
2611
|
*/
|
|
2614
|
-
setProjectCache: function(name, value) {
|
|
2612
|
+
setProjectCache: function (name, value) {
|
|
2615
2613
|
if (Uts.notEmptyString(name)) {
|
|
2616
2614
|
let fullName = storage.getProjectCacheName(name);
|
|
2617
2615
|
storage.set(fullName, value);
|
|
@@ -2627,7 +2625,7 @@ storage.get('WWWUseName')
|
|
|
2627
2625
|
storage.getProjectCache('user')
|
|
2628
2626
|
123
|
|
2629
2627
|
*/
|
|
2630
|
-
getProjectCache: function(name) {
|
|
2628
|
+
getProjectCache: function (name) {
|
|
2631
2629
|
if (Uts.notEmptyString(name)) {
|
|
2632
2630
|
let fullName = storage.getProjectCacheName(name);
|
|
2633
2631
|
|
|
@@ -2648,7 +2646,7 @@ storage.getProjectCache('user')
|
|
|
2648
2646
|
* @example
|
|
2649
2647
|
* ssStorage.get('refreshToken');
|
|
2650
2648
|
*/
|
|
2651
|
-
get: function(name) {
|
|
2649
|
+
get: function (name) {
|
|
2652
2650
|
let value = sessionStorage.getItem(name);
|
|
2653
2651
|
try {
|
|
2654
2652
|
value = Uts.toJSON(value);
|
|
@@ -2666,7 +2664,7 @@ storage.getProjectCache('user')
|
|
|
2666
2664
|
* ssStorage.set('key','some value');
|
|
2667
2665
|
* ssStorage.set('key','some value','1h');
|
|
2668
2666
|
*/
|
|
2669
|
-
set: function(name, value) {
|
|
2667
|
+
set: function (name, value) {
|
|
2670
2668
|
if (Uts.isDefined(value)) {
|
|
2671
2669
|
if (Uts.isObject(value)) {
|
|
2672
2670
|
value = Uts.toStr(value);
|
|
@@ -2683,10 +2681,10 @@ storage.getProjectCache('user')
|
|
|
2683
2681
|
* @example
|
|
2684
2682
|
* ssStorage.remove('testCache');
|
|
2685
2683
|
*/
|
|
2686
|
-
remove: function(name) {
|
|
2684
|
+
remove: function (name) {
|
|
2687
2685
|
sessionStorage.removeItem(name);
|
|
2688
2686
|
},
|
|
2689
|
-
clear: function() {
|
|
2687
|
+
clear: function () {
|
|
2690
2688
|
sessionStorage.clear();
|
|
2691
2689
|
}
|
|
2692
2690
|
},
|
|
@@ -2721,10 +2719,10 @@ storage.getProjectCache('user')
|
|
|
2721
2719
|
(n[srcProp] = t),
|
|
2722
2720
|
(n.anysc = !0),
|
|
2723
2721
|
null == n.onload
|
|
2724
|
-
? (n.onload = function() {
|
|
2722
|
+
? (n.onload = function () {
|
|
2725
2723
|
"function" == typeof e && e(n);
|
|
2726
2724
|
})
|
|
2727
|
-
: (n.onreadystatechange = function() {
|
|
2725
|
+
: (n.onreadystatechange = function () {
|
|
2728
2726
|
("loaded" != n.readyState && "complete" != n.readyState) || ("function" == typeof e && e(n));
|
|
2729
2727
|
}),
|
|
2730
2728
|
Uts.addDom("append", document.getElementsByTagName("body")[0], n);
|
|
@@ -2814,7 +2812,7 @@ storage.getProjectCache('user')
|
|
|
2814
2812
|
let iframe = Uts.createDom("iframe");
|
|
2815
2813
|
iframe.src = url;
|
|
2816
2814
|
iframe.style = "display:none;height:1px;width:1px";
|
|
2817
|
-
iframe.onload = function(e) {
|
|
2815
|
+
iframe.onload = function (e) {
|
|
2818
2816
|
typeof callBack == "function" ? callBack(e) : "";
|
|
2819
2817
|
shouldRemove && Uts.removeDom(iframe);
|
|
2820
2818
|
};
|
|
@@ -2908,7 +2906,7 @@ storage.getProjectCache('user')
|
|
|
2908
2906
|
}
|
|
2909
2907
|
let classNameList = className.split(" ");
|
|
2910
2908
|
let matchResult = true;
|
|
2911
|
-
Uts.each(classNameList, function(currentClassName, index) {
|
|
2909
|
+
Uts.each(classNameList, function (currentClassName, index) {
|
|
2912
2910
|
if (!new RegExp(" " + className + " ").test(" " + elem.className + " ")) {
|
|
2913
2911
|
matchResult = false;
|
|
2914
2912
|
}
|
|
@@ -2919,17 +2917,17 @@ storage.getProjectCache('user')
|
|
|
2919
2917
|
开启/关闭:Uts.cacheAPIData('all')//'all'/true/false/100
|
|
2920
2918
|
清除:Uts.clearCacheAPIData()
|
|
2921
2919
|
*/
|
|
2922
|
-
cacheAPIData: function(type, text, options) {
|
|
2920
|
+
cacheAPIData: function (type, text, options) {
|
|
2923
2921
|
// if (type) {
|
|
2924
2922
|
// CacheRequest.startRecordRequest(type, text, options);
|
|
2925
2923
|
// } else {
|
|
2926
2924
|
// CacheRequest.stopRecordRequest(type, text, options);
|
|
2927
2925
|
// }
|
|
2928
2926
|
},
|
|
2929
|
-
clearCacheAPIData: function() {
|
|
2927
|
+
clearCacheAPIData: function () {
|
|
2930
2928
|
// CacheRequest.cleanRequestCache();
|
|
2931
2929
|
},
|
|
2932
|
-
getCacheApiData: function(name) {
|
|
2930
|
+
getCacheApiData: function (name) {
|
|
2933
2931
|
// return CacheRequest.getCache(name);
|
|
2934
2932
|
},
|
|
2935
2933
|
/**
|
|
@@ -3152,7 +3150,7 @@ storage.getProjectCache('user')
|
|
|
3152
3150
|
allTagEXP: /<[^>]+>/gim,
|
|
3153
3151
|
TAGNAMEEXP: /<([^\s>]+)(\s|>)+/,
|
|
3154
3152
|
FINDDOMAINEXP: /[^\.]+\.[^\.]+$/,
|
|
3155
|
-
TAGVALUEEXP: function(tagName) {
|
|
3153
|
+
TAGVALUEEXP: function (tagName) {
|
|
3156
3154
|
return new RegExp("^<" + tagName + "[^>]{0,}>|</" + tagName + ">$", "g");
|
|
3157
3155
|
},
|
|
3158
3156
|
/**
|
|
@@ -3170,7 +3168,7 @@ storage.getProjectCache('user')
|
|
|
3170
3168
|
return false;
|
|
3171
3169
|
}
|
|
3172
3170
|
let classNameList = className.split(" ");
|
|
3173
|
-
Uts.each(classNameList, function(currentClassName, index) {
|
|
3171
|
+
Uts.each(classNameList, function (currentClassName, index) {
|
|
3174
3172
|
if (!Uts.hasClass(elem, currentClassName)) {
|
|
3175
3173
|
elem.className += (!elem.className ? "" : " ") + currentClassName;
|
|
3176
3174
|
}
|
|
@@ -3190,10 +3188,7 @@ storage.getProjectCache('user')
|
|
|
3190
3188
|
return false;
|
|
3191
3189
|
}
|
|
3192
3190
|
if (Uts.hasClass(elem, className, true)) {
|
|
3193
|
-
let matchStr = className
|
|
3194
|
-
.split(" ")
|
|
3195
|
-
.join("\\b|\\b")
|
|
3196
|
-
.replace(/ {2,}/g, " ");
|
|
3191
|
+
let matchStr = className.split(" ").join("\\b|\\b").replace(/ {2,}/g, " ");
|
|
3197
3192
|
let regExp = new RegExp(" " + matchStr + " ", "g");
|
|
3198
3193
|
let toCheckClass = " " + elem.className + " ";
|
|
3199
3194
|
elem.className = toCheckClass
|
|
@@ -3246,7 +3241,7 @@ Uts.notEmptyObject({})
|
|
|
3246
3241
|
return false;
|
|
3247
3242
|
}
|
|
3248
3243
|
let valueList = paramsObj[stateName].split(",");
|
|
3249
|
-
let newValueList = valueList.filter(function(data) {
|
|
3244
|
+
let newValueList = valueList.filter(function (data) {
|
|
3250
3245
|
return data != value;
|
|
3251
3246
|
});
|
|
3252
3247
|
let STREXP = new RegExp("([\\?&])" + stateName + "=[^&]*");
|
|
@@ -3305,7 +3300,7 @@ Uts.notEmptyObject({})
|
|
|
3305
3300
|
var str = "";
|
|
3306
3301
|
var currentHash = location.hash;
|
|
3307
3302
|
var newHash = "";
|
|
3308
|
-
Uts.each(stateList, function(item, index) {
|
|
3303
|
+
Uts.each(stateList, function (item, index) {
|
|
3309
3304
|
//var USEREGEXP=/&?__modalList=([^&]*)|&?__testList=([^&]*)|&?__modalList$|&?__testList/g
|
|
3310
3305
|
str += (index > 0 ? "|" : "") + "&?" + item + "=([^&]*)|&?" + item + "$";
|
|
3311
3306
|
});
|
|
@@ -3351,7 +3346,7 @@ Uts.notEmptyObject({})
|
|
|
3351
3346
|
history.replaceState(null, null, newUrl);
|
|
3352
3347
|
},
|
|
3353
3348
|
removeHashSiteList: ["bio"],
|
|
3354
|
-
checkShouldRemoveHash: function() {
|
|
3349
|
+
checkShouldRemoveHash: function () {
|
|
3355
3350
|
if (Uts.isDefined(Uts.currentSiteShouldRemoveHash)) {
|
|
3356
3351
|
return Uts.currentSiteShouldRemoveHash;
|
|
3357
3352
|
} else {
|
|
@@ -3360,12 +3355,12 @@ Uts.notEmptyObject({})
|
|
|
3360
3355
|
return Uts.currentSiteShouldRemoveHash;
|
|
3361
3356
|
}
|
|
3362
3357
|
},
|
|
3363
|
-
initHashCache: function() {
|
|
3358
|
+
initHashCache: function () {
|
|
3364
3359
|
Uts.cachePathname = location.pathname;
|
|
3365
3360
|
Uts.cacheUrlBeforeHash = Uts.getPartStringBySymbolIndex(location.href, "#", 0, 1);
|
|
3366
3361
|
Uts.cacheUrlBeforeHash = Uts.cacheUrlBeforeHash.replace(/index.html$/, "");
|
|
3367
3362
|
},
|
|
3368
|
-
dispatchHashChange: function() {
|
|
3363
|
+
dispatchHashChange: function () {
|
|
3369
3364
|
// window.dispatchEvent(new HashChangeEvent("hashchange"));
|
|
3370
3365
|
if (typeof HashChangeEvent !== "undefined") {
|
|
3371
3366
|
window.dispatchEvent(new HashChangeEvent("hashchange"));
|
|
@@ -3385,7 +3380,7 @@ Uts.notEmptyObject({})
|
|
|
3385
3380
|
ieEvent.initEvent("hashchange", true, true);
|
|
3386
3381
|
window.dispatchEvent(ieEvent);
|
|
3387
3382
|
},
|
|
3388
|
-
routeByCacheHash: function(hashUrl) {
|
|
3383
|
+
routeByCacheHash: function (hashUrl) {
|
|
3389
3384
|
if (!Uts.startWith(hashUrl, "/")) {
|
|
3390
3385
|
hashUrl = "/" + hashUrl;
|
|
3391
3386
|
}
|
|
@@ -3396,7 +3391,7 @@ Uts.notEmptyObject({})
|
|
|
3396
3391
|
Uts.dispatchHashChange();
|
|
3397
3392
|
// Uts.href(Uts.cacheUrlBeforeHash + "#" + hashUrl, undefined, "notPrefetchParams");
|
|
3398
3393
|
},
|
|
3399
|
-
onPopStateChange: function(event) {
|
|
3394
|
+
onPopStateChange: function (event) {
|
|
3400
3395
|
// let newLink = Uts.cacheUrlBeforeHash + Uts.lastCacheHash;
|
|
3401
3396
|
// Uts.repleaceState(null, null, newLink);
|
|
3402
3397
|
// console.log("onPopStateChange", newLink);
|
|
@@ -3407,7 +3402,7 @@ Uts.notEmptyObject({})
|
|
|
3407
3402
|
// Uts.dispatchHashChange();
|
|
3408
3403
|
// Uts.fireListen({ type: "locationChange", action: {} });
|
|
3409
3404
|
},
|
|
3410
|
-
checkAndRemoveHash: function() {
|
|
3405
|
+
checkAndRemoveHash: function () {
|
|
3411
3406
|
if (!Uts.isDevMode() && Uts.checkShouldRemoveHash()) {
|
|
3412
3407
|
let hashWithoutStartSymbol = location.hash.replace("#/", "");
|
|
3413
3408
|
let newLink = Uts.cacheUrlBeforeHash + hashWithoutStartSymbol;
|
|
@@ -3663,7 +3658,7 @@ console.log(obj);
|
|
|
3663
3658
|
if (Uts.isObject(object)) {
|
|
3664
3659
|
let valueNameList = Uts.getObjectKeys(config);
|
|
3665
3660
|
if (Uts.notEmptyArray(valueNameList)) {
|
|
3666
|
-
Uts.each(valueNameList, function(item, index) {
|
|
3661
|
+
Uts.each(valueNameList, function (item, index) {
|
|
3667
3662
|
if (Uts.isFunction(callback)) {
|
|
3668
3663
|
callback(item, index, object, config);
|
|
3669
3664
|
} else {
|
|
@@ -3698,7 +3693,7 @@ console.log(obj);
|
|
|
3698
3693
|
initUA() {
|
|
3699
3694
|
var bodyEle = document.getElementsByTagName("body")[0];
|
|
3700
3695
|
var browser = {
|
|
3701
|
-
versions: (function() {
|
|
3696
|
+
versions: (function () {
|
|
3702
3697
|
var u = navigator.userAgent,
|
|
3703
3698
|
app = navigator.appVersion;
|
|
3704
3699
|
return {
|
|
@@ -3726,12 +3721,13 @@ console.log(obj);
|
|
|
3726
3721
|
}
|
|
3727
3722
|
}
|
|
3728
3723
|
},
|
|
3729
|
-
isTablet: function(type) {
|
|
3724
|
+
isTablet: function (type) {
|
|
3730
3725
|
// let isIPad = navigator.maxTouchPoints && navigator.maxTouchPoints > 2 && /MacIntel/.test(navigator.platform);
|
|
3731
3726
|
const userAgent = navigator.userAgent.toLowerCase();
|
|
3732
|
-
const isTablet =
|
|
3733
|
-
|
|
3734
|
-
|
|
3727
|
+
const isTablet =
|
|
3728
|
+
/(ipad|tablet|(android(?!.*mobile))|(windows(?!.*phone)(.*touch))|kindle|playbook|silk|(puffin(?!.*(IP|AP|WP))))/.test(
|
|
3729
|
+
userAgent
|
|
3730
|
+
);
|
|
3735
3731
|
if (isTablet) {
|
|
3736
3732
|
return isTablet;
|
|
3737
3733
|
} else {
|
|
@@ -3753,7 +3749,7 @@ console.log(obj);
|
|
|
3753
3749
|
* //切换为手机显示模式
|
|
3754
3750
|
Uts.toggleMobileViewport()
|
|
3755
3751
|
*/
|
|
3756
|
-
toggleMobileViewport: function(newViewportValue) {
|
|
3752
|
+
toggleMobileViewport: function (newViewportValue) {
|
|
3757
3753
|
let defaultMobileViewport =
|
|
3758
3754
|
"width=device-width,user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0";
|
|
3759
3755
|
newViewportValue = newViewportValue || defaultMobileViewport;
|
|
@@ -3994,7 +3990,7 @@ false
|
|
|
3994
3990
|
Uts.isError(new Error())
|
|
3995
3991
|
true
|
|
3996
3992
|
*/
|
|
3997
|
-
isError: function(obj) {
|
|
3993
|
+
isError: function (obj) {
|
|
3998
3994
|
return obj && obj instanceof Error;
|
|
3999
3995
|
},
|
|
4000
3996
|
/**
|
|
@@ -4098,11 +4094,11 @@ console.log(o1);
|
|
|
4098
4094
|
return url;
|
|
4099
4095
|
}
|
|
4100
4096
|
},
|
|
4101
|
-
autoMatchField: function(configObject = {}, rawObject) {
|
|
4097
|
+
autoMatchField: function (configObject = {}, rawObject) {
|
|
4102
4098
|
let newObejct;
|
|
4103
4099
|
function setValueByKey(keyString, valueConfigString) {}
|
|
4104
4100
|
|
|
4105
|
-
Uts.objEach(configObject, function(configValue, configKey) {
|
|
4101
|
+
Uts.objEach(configObject, function (configValue, configKey) {
|
|
4106
4102
|
//"orderDetail.productList[].productDetail.goodList[].productId"
|
|
4107
4103
|
//"applyOrderDetail.product[].detail.goodsList[].productSns"
|
|
4108
4104
|
|
|
@@ -4110,7 +4106,7 @@ console.log(o1);
|
|
|
4110
4106
|
let readPathSplitByArray = configValue.split("[]");
|
|
4111
4107
|
//['orderDetail.productList', '.productDetail.goodList', '.productId']
|
|
4112
4108
|
//['applyOrderDetail.product', '.detail.goodsList', '.productSns']
|
|
4113
|
-
Uts.each(writePathSplitByArray, function(perPathKey, perPathIndex) {});
|
|
4109
|
+
Uts.each(writePathSplitByArray, function (perPathKey, perPathIndex) {});
|
|
4114
4110
|
});
|
|
4115
4111
|
},
|
|
4116
4112
|
/**
|
|
@@ -4217,7 +4213,7 @@ Uts.findIndex(arr1,null,customValidate)
|
|
|
4217
4213
|
findIndex(source, obj, validate) {
|
|
4218
4214
|
let index = -1;
|
|
4219
4215
|
if (Uts.isArray(source) && Uts.isObject(obj)) {
|
|
4220
|
-
Uts.each(source, function(item, itemIndex) {
|
|
4216
|
+
Uts.each(source, function (item, itemIndex) {
|
|
4221
4217
|
if (item == obj || (Uts.isFunction(validate) && validate(item, itemIndex))) {
|
|
4222
4218
|
Uts.pauseEach = true;
|
|
4223
4219
|
index = itemIndex;
|
|
@@ -4252,7 +4248,7 @@ Uts.index(['a','b','c'],'b')
|
|
|
4252
4248
|
return source.search(REGEXP);
|
|
4253
4249
|
} else if (Uts.isArray(source)) {
|
|
4254
4250
|
let matchPS = -1;
|
|
4255
|
-
Uts.each(source, function(value2, index) {
|
|
4251
|
+
Uts.each(source, function (value2, index) {
|
|
4256
4252
|
if (isContainMode) {
|
|
4257
4253
|
if (REGEXP.test(value2)) {
|
|
4258
4254
|
matchPS = index;
|
|
@@ -4303,7 +4299,7 @@ true
|
|
|
4303
4299
|
return REGEXP.test(source);
|
|
4304
4300
|
} else if (Uts.isArray(source)) {
|
|
4305
4301
|
let isMatch = false;
|
|
4306
|
-
Uts.each(source, function(value2, index) {
|
|
4302
|
+
Uts.each(source, function (value2, index) {
|
|
4307
4303
|
if (isIgnoreCase) {
|
|
4308
4304
|
value2 = Uts.toLowerCase(value2);
|
|
4309
4305
|
}
|
|
@@ -4340,7 +4336,7 @@ true
|
|
|
4340
4336
|
fetchObjectArrayToStringArray(source, fieldName, acceptRepeat) {
|
|
4341
4337
|
let newArray = [];
|
|
4342
4338
|
if (source && Uts.isArray(source)) {
|
|
4343
|
-
Uts.each(source, function(item, index) {
|
|
4339
|
+
Uts.each(source, function (item, index) {
|
|
4344
4340
|
if (item) {
|
|
4345
4341
|
if (!Uts.contain(newArray, item[fieldName]) || acceptRepeat) {
|
|
4346
4342
|
newArray.push(item[fieldName]);
|
|
@@ -4365,7 +4361,7 @@ Uts.fetchStringArrayToObject(['a','b','c'],'0')
|
|
|
4365
4361
|
fetchStringArrayToObject(source, defaultValue = true) {
|
|
4366
4362
|
let obj = {};
|
|
4367
4363
|
if (source && Uts.isArray(source)) {
|
|
4368
|
-
Uts.each(source, function(text, index) {
|
|
4364
|
+
Uts.each(source, function (text, index) {
|
|
4369
4365
|
if (Uts.notEmptyString(text) || Uts.isNumber(text)) {
|
|
4370
4366
|
obj[text] = defaultValue;
|
|
4371
4367
|
}
|
|
@@ -4409,7 +4405,7 @@ console.log(arr1)
|
|
|
4409
4405
|
]
|
|
4410
4406
|
*/
|
|
4411
4407
|
arrayUpdateEachValue(list, config = { key: "selected", value: true }, callBackExecForEach) {
|
|
4412
|
-
Uts.each(list, function(item, index) {
|
|
4408
|
+
Uts.each(list, function (item, index) {
|
|
4413
4409
|
let willChangeValue = config.value;
|
|
4414
4410
|
if (Uts.isFunction(callBackExecForEach)) {
|
|
4415
4411
|
willChangeValue = callBackExecForEach(item, index, config);
|
|
@@ -4479,7 +4475,7 @@ Uts.countTotalFromArray(arr3,'count');
|
|
|
4479
4475
|
countTotalFromArray(array, fieldName) {
|
|
4480
4476
|
if (Uts.isArray(array)) {
|
|
4481
4477
|
let totalAmount = 0;
|
|
4482
|
-
Uts.each(array, function(value, index) {
|
|
4478
|
+
Uts.each(array, function (value, index) {
|
|
4483
4479
|
if (value) {
|
|
4484
4480
|
let toAddValue;
|
|
4485
4481
|
if (Uts.isPureObject(value) && Uts.isString(fieldName)) {
|
|
@@ -4511,7 +4507,7 @@ Uts.countTotalFromArray(arr3,'count');
|
|
|
4511
4507
|
Uts.getSameBetweenArray(list);
|
|
4512
4508
|
[4, 7]
|
|
4513
4509
|
*/
|
|
4514
|
-
getSameBetweenArray: function(checkArryList, propName) {
|
|
4510
|
+
getSameBetweenArray: function (checkArryList, propName) {
|
|
4515
4511
|
let resultArray = [];
|
|
4516
4512
|
let midCacheObject = {};
|
|
4517
4513
|
let matchLength = checkArryList.length;
|
|
@@ -4522,8 +4518,8 @@ Uts.getSameBetweenArray(list);
|
|
|
4522
4518
|
midCacheObject[keyValue] = 1;
|
|
4523
4519
|
}
|
|
4524
4520
|
}
|
|
4525
|
-
Uts.each(checkArryList, function(arr, arrIndex) {
|
|
4526
|
-
Uts.each(arr, function(item, index) {
|
|
4521
|
+
Uts.each(checkArryList, function (arr, arrIndex) {
|
|
4522
|
+
Uts.each(arr, function (item, index) {
|
|
4527
4523
|
let checkValue = item;
|
|
4528
4524
|
if (Uts.isPureObject(item)) {
|
|
4529
4525
|
checkValue = item[propName];
|
|
@@ -4605,8 +4601,8 @@ Uts.getSameBetweenArray(list);
|
|
|
4605
4601
|
* Uts.sum([1,2,3,4,5,6])
|
|
4606
4602
|
21
|
|
4607
4603
|
*/
|
|
4608
|
-
sum: function(array) {
|
|
4609
|
-
return array.reduce(function(prev, curr, idx, arr) {
|
|
4604
|
+
sum: function (array) {
|
|
4605
|
+
return array.reduce(function (prev, curr, idx, arr) {
|
|
4610
4606
|
return prev + curr;
|
|
4611
4607
|
});
|
|
4612
4608
|
},
|
|
@@ -4620,7 +4616,7 @@ Uts.getSameBetweenArray(list);
|
|
|
4620
4616
|
Uts.pluck([{name:'pm1'},{name:'pm2'}],"name");
|
|
4621
4617
|
['pm1', 'pm2']
|
|
4622
4618
|
*/
|
|
4623
|
-
pluck: function(array, param, acceptRepeat) {
|
|
4619
|
+
pluck: function (array, param, acceptRepeat) {
|
|
4624
4620
|
return Uts.fetchObjectArrayToStringArray(array, param, acceptRepeat);
|
|
4625
4621
|
},
|
|
4626
4622
|
/**
|
|
@@ -4634,7 +4630,7 @@ Uts.getSameBetweenArray(list);
|
|
|
4634
4630
|
* Uts.pluckMap([{name:"zhangsan",age:18},{name:"lisi",age:20},{name:"wangwu",age:24}],'name','age')
|
|
4635
4631
|
{zhangsan: 18, lisi: 20, wangwu: 24}
|
|
4636
4632
|
*/
|
|
4637
|
-
pluckMap: function(array, keyParam, valueParam) {
|
|
4633
|
+
pluckMap: function (array, keyParam, valueParam) {
|
|
4638
4634
|
let arrayMap = {};
|
|
4639
4635
|
if (Uts.notEmptyArray(array)) {
|
|
4640
4636
|
Uts.each(array, (item, index) => {
|
|
@@ -4653,7 +4649,7 @@ Uts.getSameBetweenArray(list);
|
|
|
4653
4649
|
hookAjaxUrl(type, url, synType, other) {
|
|
4654
4650
|
return url;
|
|
4655
4651
|
},
|
|
4656
|
-
_afterHookAjaxUrl: function(type, url, synType, other) {
|
|
4652
|
+
_afterHookAjaxUrl: function (type, url, synType, other) {
|
|
4657
4653
|
// return MigrateTools.migrateRequestUrl(url);
|
|
4658
4654
|
},
|
|
4659
4655
|
setNewApiConfig(config, apiUrlStartLength = -2) {
|
|
@@ -4679,9 +4675,9 @@ Uts.getSameBetweenArray(list);
|
|
|
4679
4675
|
return false;
|
|
4680
4676
|
},
|
|
4681
4677
|
|
|
4682
|
-
fetchTokenNameConfig: function() {
|
|
4678
|
+
fetchTokenNameConfig: function () {
|
|
4683
4679
|
Uts.tokenNameConfigFetch = {};
|
|
4684
|
-
Uts.objEach(Uts.tokenNameConfig, function(value, key) {
|
|
4680
|
+
Uts.objEach(Uts.tokenNameConfig, function (value, key) {
|
|
4685
4681
|
Uts.tokenNameConfigFetch[value] = true;
|
|
4686
4682
|
});
|
|
4687
4683
|
},
|
|
@@ -4700,7 +4696,7 @@ Uts.getProjectTokenName('hms')
|
|
|
4700
4696
|
Uts.getProjectTokenName('lab')
|
|
4701
4697
|
'labLoginToken'
|
|
4702
4698
|
*/
|
|
4703
|
-
getProjectTokenName: function(projcetName) {
|
|
4699
|
+
getProjectTokenName: function (projcetName) {
|
|
4704
4700
|
projcetName = projcetName || Uts.getCurrentProject();
|
|
4705
4701
|
let tokenNameConfig = Uts.tokenNameConfig;
|
|
4706
4702
|
let defaultWWWToken = tokenNameConfig.www;
|
|
@@ -4719,7 +4715,7 @@ Uts.getTokenForProject()
|
|
|
4719
4715
|
Uts.getTokenForProject()
|
|
4720
4716
|
'YW50Y2Fz.eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJyZWFnZW50...Iiw'
|
|
4721
4717
|
*/
|
|
4722
|
-
getTokenForProject: function() {
|
|
4718
|
+
getTokenForProject: function () {
|
|
4723
4719
|
//default is www
|
|
4724
4720
|
let tokenName = Uts.getProjectTokenName();
|
|
4725
4721
|
if (tokenName) {
|
|
@@ -4727,9 +4723,9 @@ Uts.getTokenForProject()
|
|
|
4727
4723
|
}
|
|
4728
4724
|
},
|
|
4729
4725
|
|
|
4730
|
-
setGlobalToken: function() {},
|
|
4726
|
+
setGlobalToken: function () {},
|
|
4731
4727
|
|
|
4732
|
-
getGlobalToken: function() {},
|
|
4728
|
+
getGlobalToken: function () {},
|
|
4733
4729
|
/**
|
|
4734
4730
|
* 统一处理已登录用户在某个项目的403无权限场景跳转
|
|
4735
4731
|
* @module route
|
|
@@ -4741,7 +4737,7 @@ Uts.getTokenForProject()
|
|
|
4741
4737
|
* //通常用于该项目的REST.hookWhenGetResponse内,自动统一处理无权限跳转
|
|
4742
4738
|
* Uts.loginFor403(res,false,url);
|
|
4743
4739
|
*/
|
|
4744
|
-
loginFor403: function(data = {}, isError, url) {
|
|
4740
|
+
loginFor403: function (data = {}, isError, url) {
|
|
4745
4741
|
if (isError) {
|
|
4746
4742
|
return;
|
|
4747
4743
|
}
|
|
@@ -4758,7 +4754,7 @@ Uts.getTokenForProject()
|
|
|
4758
4754
|
Uts.goLogin ||
|
|
4759
4755
|
Uts.login ||
|
|
4760
4756
|
Uts.toLogin ||
|
|
4761
|
-
function() {
|
|
4757
|
+
function () {
|
|
4762
4758
|
let backUrl = Uts.encode(location.href);
|
|
4763
4759
|
let domainName = Uts.currentSecondDomain;
|
|
4764
4760
|
Uts.routeToDomain(
|
|
@@ -4770,14 +4766,14 @@ Uts.getTokenForProject()
|
|
|
4770
4766
|
}
|
|
4771
4767
|
},
|
|
4772
4768
|
|
|
4773
|
-
setBtkHeaderForProject: function(ajaxReq, methodName = "setRequestHeader") {
|
|
4769
|
+
setBtkHeaderForProject: function (ajaxReq, methodName = "setRequestHeader") {
|
|
4774
4770
|
let cacheBtkObj = storage.getProjectCache("btk") || {};
|
|
4775
4771
|
let projectToken = Uts.getTokenForProject();
|
|
4776
4772
|
if (cacheBtkObj.btk && cacheBtkObj.token == projectToken) {
|
|
4777
4773
|
ajaxReq[methodName]("btk", cacheBtkObj.btk);
|
|
4778
4774
|
}
|
|
4779
4775
|
},
|
|
4780
|
-
setGlobalHeader: function(ajaxReq, methodName = "setRequestHeader") {
|
|
4776
|
+
setGlobalHeader: function (ajaxReq, methodName = "setRequestHeader") {
|
|
4781
4777
|
if (Uts.currentEnv == "gray" || Uts.currentEnv == "publish") {
|
|
4782
4778
|
// http://www.gray.rjmart.cn?gray_version=dengxuqian2310301800
|
|
4783
4779
|
let grayVersion = Uts.getGrayInfo();
|
|
@@ -4787,14 +4783,14 @@ Uts.getTokenForProject()
|
|
|
4787
4783
|
}
|
|
4788
4784
|
},
|
|
4789
4785
|
|
|
4790
|
-
getGrayInfo: function() {
|
|
4786
|
+
getGrayInfo: function () {
|
|
4791
4787
|
return Uts.getCookie("gray_version");
|
|
4792
4788
|
},
|
|
4793
|
-
setGrayInfo: function(value) {
|
|
4789
|
+
setGrayInfo: function (value) {
|
|
4794
4790
|
return Uts.setCookie("gray_version", value);
|
|
4795
4791
|
},
|
|
4796
4792
|
|
|
4797
|
-
initGrayConfig: function() {
|
|
4793
|
+
initGrayConfig: function () {
|
|
4798
4794
|
let searchParams = Uts.getParamsFormSearch(location.search);
|
|
4799
4795
|
if ((Uts.currentEnv == "gray" || Uts.currentEnv == "publish") && searchParams.gray_version) {
|
|
4800
4796
|
Uts.setGrayInfo(searchParams.gray_version);
|
|
@@ -4803,10 +4799,10 @@ Uts.getTokenForProject()
|
|
|
4803
4799
|
|
|
4804
4800
|
overrideAjax() {
|
|
4805
4801
|
let _xmlhttp = XMLHttpRequest;
|
|
4806
|
-
XMLHttpRequest = function() {
|
|
4802
|
+
XMLHttpRequest = function () {
|
|
4807
4803
|
let ajax = new _xmlhttp();
|
|
4808
4804
|
ajax._send = ajax.send;
|
|
4809
|
-
ajax.send = function(data) {
|
|
4805
|
+
ajax.send = function (data) {
|
|
4810
4806
|
// console.log(data);
|
|
4811
4807
|
Uts.setGlobalHeader(this);
|
|
4812
4808
|
if (Uts.isLogin()) {
|
|
@@ -4837,7 +4833,7 @@ Uts.getTokenForProject()
|
|
|
4837
4833
|
ajax._send(data);
|
|
4838
4834
|
};
|
|
4839
4835
|
ajax._open = ajax.open;
|
|
4840
|
-
ajax.open = function(type, url, synType, other) {
|
|
4836
|
+
ajax.open = function (type, url, synType, other) {
|
|
4841
4837
|
// console.log(type, url, synType, other);
|
|
4842
4838
|
url = Uts.hookAjaxUrl(type, url, synType, other, ajax);
|
|
4843
4839
|
url = Uts._afterHookAjaxUrl(type, url, synType, other, ajax);
|
|
@@ -4847,8 +4843,8 @@ Uts.getTokenForProject()
|
|
|
4847
4843
|
this.url = url;
|
|
4848
4844
|
ajax._open(type, url, synType, other);
|
|
4849
4845
|
} else {
|
|
4850
|
-
ajax.setRequestHeader = function(name, value) {};
|
|
4851
|
-
ajax.send = function(data) {};
|
|
4846
|
+
ajax.setRequestHeader = function (name, value) {};
|
|
4847
|
+
ajax.send = function (data) {};
|
|
4852
4848
|
// ZenUI.HL();
|
|
4853
4849
|
}
|
|
4854
4850
|
};
|
|
@@ -4921,7 +4917,7 @@ Uts.sort(testArr,options);
|
|
|
4921
4917
|
orderFlag1 = 1;
|
|
4922
4918
|
orderFlag2 = -1;
|
|
4923
4919
|
}
|
|
4924
|
-
rawArray.sort(function(a, b) {
|
|
4920
|
+
rawArray.sort(function (a, b) {
|
|
4925
4921
|
if (Uts.isFunction(customCallback)) {
|
|
4926
4922
|
return customCallback(a[options.pty], b[options.pty], a, b);
|
|
4927
4923
|
}
|
|
@@ -5035,39 +5031,39 @@ Uts.reorderByArrayIndex(arr3,1,5);
|
|
|
5035
5031
|
}
|
|
5036
5032
|
return c;
|
|
5037
5033
|
},
|
|
5038
|
-
cacheStore: (function() {
|
|
5034
|
+
cacheStore: (function () {
|
|
5039
5035
|
let innerCache = {};
|
|
5040
5036
|
let maxCacheSize;
|
|
5041
5037
|
return {
|
|
5042
|
-
getStoreCache: function(key) {
|
|
5038
|
+
getStoreCache: function (key) {
|
|
5043
5039
|
return innerCache[key];
|
|
5044
5040
|
},
|
|
5045
5041
|
/*will not update value when had value*/
|
|
5046
|
-
setStoreCache: function(key, value) {
|
|
5042
|
+
setStoreCache: function (key, value) {
|
|
5047
5043
|
if (Uts.isUndefined(innerCache[key])) {
|
|
5048
5044
|
innerCache[key] = value;
|
|
5049
5045
|
}
|
|
5050
5046
|
},
|
|
5051
|
-
updateStoreState: function(key, value) {
|
|
5047
|
+
updateStoreState: function (key, value) {
|
|
5052
5048
|
innerCache[key] = value;
|
|
5053
5049
|
},
|
|
5054
|
-
deleteCache: function(key) {
|
|
5050
|
+
deleteCache: function (key) {
|
|
5055
5051
|
if (innerCache[key]) {
|
|
5056
5052
|
delete innerCache[key];
|
|
5057
5053
|
}
|
|
5058
5054
|
}
|
|
5059
5055
|
};
|
|
5060
5056
|
})(),
|
|
5061
|
-
getCache: function(key) {
|
|
5057
|
+
getCache: function (key) {
|
|
5062
5058
|
return Uts.cacheStore.getStoreCache(key);
|
|
5063
5059
|
},
|
|
5064
|
-
checkCache: function(key, value) {
|
|
5060
|
+
checkCache: function (key, value) {
|
|
5065
5061
|
Uts.cacheStore.setStoreCache(key, value);
|
|
5066
5062
|
},
|
|
5067
|
-
updateCache: function(key, value) {
|
|
5063
|
+
updateCache: function (key, value) {
|
|
5068
5064
|
Uts.cacheStore.updateStoreState(key, value);
|
|
5069
5065
|
},
|
|
5070
|
-
deleteCache: function(key) {
|
|
5066
|
+
deleteCache: function (key) {
|
|
5071
5067
|
Uts.cacheStore.deleteCache(key);
|
|
5072
5068
|
},
|
|
5073
5069
|
/**
|
|
@@ -5364,7 +5360,7 @@ false
|
|
|
5364
5360
|
* Uts.generatePathForTree(treeData,'children','path')
|
|
5365
5361
|
*/
|
|
5366
5362
|
generatePathForTree(treeData, childProp = "children", pathFieldName = "__path", parentItem) {
|
|
5367
|
-
Uts.each(treeData, function(item, index) {
|
|
5363
|
+
Uts.each(treeData, function (item, index) {
|
|
5368
5364
|
Uts.generatePathByParent(item, index, parentItem, pathFieldName);
|
|
5369
5365
|
if (Uts.notEmptyArray(item[childProp])) {
|
|
5370
5366
|
Uts.generatePathForTree(item[childProp], childProp, pathFieldName, item);
|
|
@@ -5486,10 +5482,10 @@ false
|
|
|
5486
5482
|
let childLength = new Array(
|
|
5487
5483
|
Uts.random(config.currentLenth == 1 ? 1 : config.minArrayLength, config.maxArrayLength)
|
|
5488
5484
|
);
|
|
5489
|
-
Uts.each(childLength, function(item, index) {
|
|
5485
|
+
Uts.each(childLength, function (item, index) {
|
|
5490
5486
|
let newItem = {};
|
|
5491
5487
|
generatePath(newItem, index, config.parent);
|
|
5492
|
-
Uts.each(config.childFieldList, function(childFieldListItem, childFieldListIndex) {
|
|
5488
|
+
Uts.each(config.childFieldList, function (childFieldListItem, childFieldListIndex) {
|
|
5493
5489
|
newItem[childFieldListItem] = childFieldListItem + newItem[config.pathFieldName].join("_");
|
|
5494
5490
|
});
|
|
5495
5491
|
newItem[config.childFieldName] = [];
|
|
@@ -5510,7 +5506,7 @@ false
|
|
|
5510
5506
|
});
|
|
5511
5507
|
return dataArray;
|
|
5512
5508
|
},
|
|
5513
|
-
watchObject: function(obj, options = { log: true }) {
|
|
5509
|
+
watchObject: function (obj, options = { log: true }) {
|
|
5514
5510
|
const { get, set, log, watchName = "watchObject" } = options;
|
|
5515
5511
|
function innerGet(passObj, propsName, rec) {
|
|
5516
5512
|
if (log) {
|
|
@@ -5578,7 +5574,7 @@ false
|
|
|
5578
5574
|
};
|
|
5579
5575
|
console.log(Uts.diffObject(o1, o2));
|
|
5580
5576
|
*/
|
|
5581
|
-
diffObject: function(oldObj, newObj) {
|
|
5577
|
+
diffObject: function (oldObj, newObj) {
|
|
5582
5578
|
let diffResult = [];
|
|
5583
5579
|
function addDiffResult(options = {}, obj, visitKey, parentObj, config) {
|
|
5584
5580
|
// console.log(obj);
|
|
@@ -5906,7 +5902,7 @@ Uts.loopTree(treeData,'childrens',function(item,index,globalConfig){
|
|
|
5906
5902
|
if (eachConfig.stop || globalConfig.stopAll) {
|
|
5907
5903
|
return true;
|
|
5908
5904
|
}
|
|
5909
|
-
Uts.each(arr, function(item, index) {
|
|
5905
|
+
Uts.each(arr, function (item, index) {
|
|
5910
5906
|
if (globalConfig.generatePath) {
|
|
5911
5907
|
Uts.generatePathByParent(item, index, eachConfig.parent, globalConfig.pathFieldName);
|
|
5912
5908
|
}
|
|
@@ -6009,7 +6005,7 @@ Uts.getParentByPath(item,treeData,{ pathFieldName: "__path", treeChildProp: "chi
|
|
|
6009
6005
|
let parentList = [];
|
|
6010
6006
|
if (path.length > 1) {
|
|
6011
6007
|
let obj = {};
|
|
6012
|
-
Uts.each(path, function(pathValue, pathIndex) {
|
|
6008
|
+
Uts.each(path, function (pathValue, pathIndex) {
|
|
6013
6009
|
if (pathIndex === 0) {
|
|
6014
6010
|
obj = lists[pathValue];
|
|
6015
6011
|
parentList.push(obj);
|
|
@@ -6053,7 +6049,7 @@ Uts.getParentByPath(item,treeData,{ pathFieldName: "__path", treeChildProp: "chi
|
|
|
6053
6049
|
cb && cb();
|
|
6054
6050
|
},
|
|
6055
6051
|
|
|
6056
|
-
selectText: function(dom, start = 0, end) {
|
|
6052
|
+
selectText: function (dom, start = 0, end) {
|
|
6057
6053
|
if (!end) {
|
|
6058
6054
|
if (dom.value) {
|
|
6059
6055
|
end = dom.value.length;
|
|
@@ -6198,7 +6194,7 @@ Uts.getParentByPath(item,treeData,{ pathFieldName: "__path", treeChildProp: "chi
|
|
|
6198
6194
|
return checkSingleCode(value);
|
|
6199
6195
|
} else if (Uts.notEmptyArray(value)) {
|
|
6200
6196
|
let isMatch = false;
|
|
6201
|
-
Uts.each(value, function(singleValue, index, run) {
|
|
6197
|
+
Uts.each(value, function (singleValue, index, run) {
|
|
6202
6198
|
if (checkSingleCode(singleValue)) {
|
|
6203
6199
|
isMatch = true;
|
|
6204
6200
|
run.stop = true;
|
|
@@ -6219,8 +6215,8 @@ Uts.getParentByPath(item,treeData,{ pathFieldName: "__path", treeChildProp: "chi
|
|
|
6219
6215
|
* @param {Function} callback
|
|
6220
6216
|
* @return {null}
|
|
6221
6217
|
*/
|
|
6222
|
-
regHook: function(env, callback) {
|
|
6223
|
-
(function(currentObj) {
|
|
6218
|
+
regHook: function (env, callback) {
|
|
6219
|
+
(function (currentObj) {
|
|
6224
6220
|
callback && callback(currentObj);
|
|
6225
6221
|
})(env);
|
|
6226
6222
|
},
|
|
@@ -6236,7 +6232,7 @@ Uts.getParentByPath(item,treeData,{ pathFieldName: "__path", treeChildProp: "chi
|
|
|
6236
6232
|
* @example
|
|
6237
6233
|
* Uts.href('https://www.baidu.com');
|
|
6238
6234
|
*/
|
|
6239
|
-
href: function(url, type, notAutoFixedParams) {
|
|
6235
|
+
href: function (url, type, notAutoFixedParams) {
|
|
6240
6236
|
if (Uts.getCookie("breakOnLeave")) {
|
|
6241
6237
|
eval("debugger");
|
|
6242
6238
|
}
|
|
@@ -6276,12 +6272,12 @@ Uts.getParentByPath(item,treeData,{ pathFieldName: "__path", treeChildProp: "chi
|
|
|
6276
6272
|
* Uts.noHref();
|
|
6277
6273
|
'javascript:void(0)'
|
|
6278
6274
|
*/
|
|
6279
|
-
noHref: function() {
|
|
6275
|
+
noHref: function () {
|
|
6280
6276
|
return "javascript:void(0)";
|
|
6281
6277
|
},
|
|
6282
|
-
fireListen: function(options) {},
|
|
6278
|
+
fireListen: function (options) {},
|
|
6283
6279
|
|
|
6284
|
-
getCurrentProject: function() {
|
|
6280
|
+
getCurrentProject: function () {
|
|
6285
6281
|
return "www";
|
|
6286
6282
|
},
|
|
6287
6283
|
/**
|
|
@@ -6296,7 +6292,7 @@ Uts.getParentByPath(item,treeData,{ pathFieldName: "__path", treeChildProp: "chi
|
|
|
6296
6292
|
* @example
|
|
6297
6293
|
* Uts.setPM(permissions);
|
|
6298
6294
|
*/
|
|
6299
|
-
setPM: function(permissions, _orgId, _token, projectName) {
|
|
6295
|
+
setPM: function (permissions, _orgId, _token, projectName) {
|
|
6300
6296
|
let currentProjcet = projectName || Uts.getCurrentProject(); //www/pm/hms
|
|
6301
6297
|
let currentConfig = Uts.permissionsConfig[currentProjcet];
|
|
6302
6298
|
if (!currentConfig) {
|
|
@@ -6314,6 +6310,7 @@ Uts.getParentByPath(item,treeData,{ pathFieldName: "__path", treeChildProp: "chi
|
|
|
6314
6310
|
Uts.storage.set(PMCacheName, PMCache);
|
|
6315
6311
|
}
|
|
6316
6312
|
},
|
|
6313
|
+
permissionsConfig: {},
|
|
6317
6314
|
/**
|
|
6318
6315
|
* 读取某个项目级权限(已自动隔离不同项目权限,多账号切换自动失效,退出重登录自动失效),
|
|
6319
6316
|
* @module cookieStorage
|
|
@@ -6322,11 +6319,14 @@ Uts.getParentByPath(item,treeData,{ pathFieldName: "__path", treeChildProp: "chi
|
|
|
6322
6319
|
* @example
|
|
6323
6320
|
* Uts.getPM(’CREATE_ORDER‘);
|
|
6324
6321
|
*/
|
|
6325
|
-
getPM: function(name) {
|
|
6322
|
+
getPM: function (name, settings) {
|
|
6323
|
+
if (settings) {
|
|
6324
|
+
return Uts.getPMBySettings(name, settings);
|
|
6325
|
+
}
|
|
6326
6326
|
let currentProjcet = Uts.getCurrentProject(); //www/pm/hms
|
|
6327
6327
|
let currentConfig = Uts.permissionsConfig[currentProjcet];
|
|
6328
6328
|
if (!currentConfig) {
|
|
6329
|
-
Uts.ce("配置不存在,请检查");
|
|
6329
|
+
// Uts.ce("配置不存在,请检查");
|
|
6330
6330
|
return false;
|
|
6331
6331
|
} else {
|
|
6332
6332
|
let PMCacheName = currentConfig.cacheName;
|
|
@@ -6345,6 +6345,33 @@ Uts.getParentByPath(item,treeData,{ pathFieldName: "__path", treeChildProp: "chi
|
|
|
6345
6345
|
}
|
|
6346
6346
|
return false;
|
|
6347
6347
|
},
|
|
6348
|
+
/**
|
|
6349
|
+
* 根据自定义配置读取权限
|
|
6350
|
+
* @param {string} code 权限码
|
|
6351
|
+
* @param {object} settings 配置项
|
|
6352
|
+
* @returns
|
|
6353
|
+
*/
|
|
6354
|
+
getPMBySettings: function (code, settings) {
|
|
6355
|
+
const { permissionsCodeKey } = settings || {};
|
|
6356
|
+
const permissionCodes = Uts.storage.get(permissionsCodeKey) || [];
|
|
6357
|
+
|
|
6358
|
+
return Uts.contain(permissionCodes, code);
|
|
6359
|
+
},
|
|
6360
|
+
/**
|
|
6361
|
+
* 过滤路由权限
|
|
6362
|
+
* @param {object} route 路由对象
|
|
6363
|
+
* @returns
|
|
6364
|
+
*/
|
|
6365
|
+
filterPM: function (route) {
|
|
6366
|
+
const hasPerm = (route) => {
|
|
6367
|
+
const { meta } = route || {};
|
|
6368
|
+
const { permission } = meta || {};
|
|
6369
|
+
return !permission || Uts.getPM(permission);
|
|
6370
|
+
};
|
|
6371
|
+
|
|
6372
|
+
if (route.children) route.children = route.children.filter(hasPerm);
|
|
6373
|
+
return hasPerm(route);
|
|
6374
|
+
},
|
|
6348
6375
|
/**
|
|
6349
6376
|
* routeToDomain 项目/站点间跳转,自动处理不同环境/项目内跳转
|
|
6350
6377
|
* @module route
|
|
@@ -6358,7 +6385,7 @@ Uts.routeToDomain("bio", `/tool?id=9238923`);
|
|
|
6358
6385
|
//新串口打开
|
|
6359
6386
|
Uts.routeToDomain("bio", `/tool?id=9238923`, "_blank")
|
|
6360
6387
|
*/
|
|
6361
|
-
routeToDomain: function(site, url, type) {},
|
|
6388
|
+
routeToDomain: function (site, url, type) {},
|
|
6362
6389
|
|
|
6363
6390
|
/**
|
|
6364
6391
|
* 用于从url查询格式的文本参数中(如a=b&c=d&d=e)返回对象形式的参数,返回{a:b,c:d,d:e}
|
|
@@ -6374,7 +6401,7 @@ Uts.getParamsFormSearch('?name=zhangsan&age=18&department=purchase')
|
|
|
6374
6401
|
{name: 'zhangsan', age: '18', department: 'purchase'}
|
|
6375
6402
|
*
|
|
6376
6403
|
*/
|
|
6377
|
-
getParamsFormSearch: function(search) {
|
|
6404
|
+
getParamsFormSearch: function (search) {
|
|
6378
6405
|
var urlDataObj = {};
|
|
6379
6406
|
// dd = location.search;
|
|
6380
6407
|
if (!search) {
|
|
@@ -6400,7 +6427,7 @@ Uts.getParamsFormSearch('?name=zhangsan&age=18&department=purchase')
|
|
|
6400
6427
|
* Uts.reorderString('这段文本需要倒过来')
|
|
6401
6428
|
'来过倒要需本文段这'
|
|
6402
6429
|
*/
|
|
6403
|
-
reorderString: function(str) {
|
|
6430
|
+
reorderString: function (str) {
|
|
6404
6431
|
if (Uts.isString(str)) {
|
|
6405
6432
|
let newValue = str.split("");
|
|
6406
6433
|
newValue.reverse();
|
|
@@ -6421,7 +6448,7 @@ Uts.getParamsFormSearch('?name=zhangsan&age=18&department=purchase')
|
|
|
6421
6448
|
Uts.exchangeMoneyByUnit(100000000,'亿')
|
|
6422
6449
|
'1.00亿'
|
|
6423
6450
|
*/
|
|
6424
|
-
exchangeMoneyByUnit: function(value, unit = "万", floatCount = 2) {
|
|
6451
|
+
exchangeMoneyByUnit: function (value, unit = "万", floatCount = 2) {
|
|
6425
6452
|
let oneHundred = 100;
|
|
6426
6453
|
const unitValueConfig = {
|
|
6427
6454
|
千: 10 * oneHundred,
|
|
@@ -6447,7 +6474,7 @@ Uts.exchangeMoneyByUnit(100000000,'亿')
|
|
|
6447
6474
|
* @param {number} length 要加密的长度
|
|
6448
6475
|
* @return {string} 返回加密后的字符串结果
|
|
6449
6476
|
*/
|
|
6450
|
-
encryptString: function(str, startIndex, length) {
|
|
6477
|
+
encryptString: function (str, startIndex, length) {
|
|
6451
6478
|
//加密的长度不能超过整个文案的长度,也不能超过开始位置到结束的长度
|
|
6452
6479
|
if (str && startIndex + length < str.length) {
|
|
6453
6480
|
let startStr = str.substring(0, startIndex),
|
|
@@ -6477,7 +6504,7 @@ Uts.filterMoney(938.6,2)
|
|
|
6477
6504
|
Uts.filterMoney(123222123, 6);
|
|
6478
6505
|
'123,222,123.000000'
|
|
6479
6506
|
*/
|
|
6480
|
-
filterMoney: function(value, size = 2) {
|
|
6507
|
+
filterMoney: function (value, size = 2) {
|
|
6481
6508
|
if (Uts.isNumber(value) || !Uts.isString(value)) {
|
|
6482
6509
|
value = String(value);
|
|
6483
6510
|
}
|
|
@@ -6524,7 +6551,7 @@ Uts.filterMoney(123222123, 6);
|
|
|
6524
6551
|
* @param {type} String 是否需要小数点
|
|
6525
6552
|
* @todo Uts.formatMoney
|
|
6526
6553
|
*/
|
|
6527
|
-
formatMoney: function(s, type) {
|
|
6554
|
+
formatMoney: function (s, type) {
|
|
6528
6555
|
if (/[^0-9\.]/.test(s)) return "0.00";
|
|
6529
6556
|
if (s == null || s == "null" || s == "") return "0.00";
|
|
6530
6557
|
s = s.toString().replace(/^(\d*)$/, "$1.");
|
|
@@ -6552,10 +6579,13 @@ Uts.filterMoney(123222123, 6);
|
|
|
6552
6579
|
Uts.digitUppercase(293235223)
|
|
6553
6580
|
'贰亿玖仟叁佰贰拾叁万伍仟贰佰贰拾叁元整'
|
|
6554
6581
|
*/
|
|
6555
|
-
digitUppercase: function(n) {
|
|
6582
|
+
digitUppercase: function (n) {
|
|
6556
6583
|
const fraction = ["角", "分"];
|
|
6557
6584
|
const digit = ["零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"];
|
|
6558
|
-
const unit = [
|
|
6585
|
+
const unit = [
|
|
6586
|
+
["元", "万", "亿"],
|
|
6587
|
+
["", "拾", "佰", "仟"]
|
|
6588
|
+
];
|
|
6559
6589
|
let num = Math.abs(n);
|
|
6560
6590
|
let s = "";
|
|
6561
6591
|
fraction.forEach((item, index) => {
|
|
@@ -6591,18 +6621,18 @@ Uts.digitUppercase(293235223)
|
|
|
6591
6621
|
});
|
|
6592
6622
|
{1: '审批中', 2: '发货中'}
|
|
6593
6623
|
*/
|
|
6594
|
-
getAutoMatchFromConfig: function(config) {
|
|
6624
|
+
getAutoMatchFromConfig: function (config) {
|
|
6595
6625
|
const { key, value, list } = config;
|
|
6596
6626
|
|
|
6597
6627
|
let matchConfig = {};
|
|
6598
|
-
Uts.each(list, function(item, index) {
|
|
6628
|
+
Uts.each(list, function (item, index) {
|
|
6599
6629
|
matchConfig[item[key]] = item[value];
|
|
6600
6630
|
});
|
|
6601
6631
|
|
|
6602
6632
|
return matchConfig;
|
|
6603
6633
|
},
|
|
6604
6634
|
|
|
6605
|
-
getLocalResource: function(rawResourceUrl) {
|
|
6635
|
+
getLocalResource: function (rawResourceUrl) {
|
|
6606
6636
|
if (Uts.currentEnv == "external") {
|
|
6607
6637
|
let localhost = Uts.getOrigin();
|
|
6608
6638
|
return rawResourceUrl.replace(/.+(\.cn|\.com)/, localhost);
|
|
@@ -6611,13 +6641,13 @@ Uts.digitUppercase(293235223)
|
|
|
6611
6641
|
}
|
|
6612
6642
|
},
|
|
6613
6643
|
|
|
6614
|
-
checkWithPathname: function() {
|
|
6644
|
+
checkWithPathname: function () {
|
|
6615
6645
|
let host = location.host;
|
|
6616
6646
|
const withPathNameHostList = ["gzas.guizhou.gov.cn"];
|
|
6617
6647
|
return Uts.contain(withPathNameHostList, host);
|
|
6618
6648
|
},
|
|
6619
6649
|
|
|
6620
|
-
changeDomainWhenExternal: function(url) {
|
|
6650
|
+
changeDomainWhenExternal: function (url) {
|
|
6621
6651
|
/*
|
|
6622
6652
|
*
|
|
6623
6653
|
* http://rjmart.tmmu.edu.cn/gateway/XX/XXX
|
|
@@ -6630,7 +6660,7 @@ Uts.digitUppercase(293235223)
|
|
|
6630
6660
|
if (env == "external") {
|
|
6631
6661
|
let urlWithoutDomain = Uts.getPartStringBySymbolIndex(url, "/", "3");
|
|
6632
6662
|
let currentDomain = Uts.getOrigin();
|
|
6633
|
-
url = url.replace(/.{0,}\/\/(gateway|api)\..+/g, function(fullStr, partStr) {
|
|
6663
|
+
url = url.replace(/.{0,}\/\/(gateway|api)\..+/g, function (fullStr, partStr) {
|
|
6634
6664
|
let prePartStrSymbol = "/";
|
|
6635
6665
|
if (Uts.checkWithPathname()) {
|
|
6636
6666
|
prePartStrSymbol = location.pathname;
|
|
@@ -6663,7 +6693,7 @@ Uts.digitUppercase(293235223)
|
|
|
6663
6693
|
Uts.getGatewayDomain('/store/user/register')
|
|
6664
6694
|
'https://gateway.test.rj-info.com/store/user/register'
|
|
6665
6695
|
*/
|
|
6666
|
-
getGatewayDomain: function(url) {
|
|
6696
|
+
getGatewayDomain: function (url) {
|
|
6667
6697
|
let newUrl = "";
|
|
6668
6698
|
let domain = location.host;
|
|
6669
6699
|
let env = Uts.getEnv().env;
|
|
@@ -6704,7 +6734,7 @@ Uts.splitMoney(239238.23,0)
|
|
|
6704
6734
|
let moneyArr = moneyStr.split(".");
|
|
6705
6735
|
return moneyArr[intOrFloat] || 0;
|
|
6706
6736
|
},
|
|
6707
|
-
changeSecondDomain: function(url, secondDomain = "api") {
|
|
6737
|
+
changeSecondDomain: function (url, secondDomain = "api") {
|
|
6708
6738
|
let newUrl = "";
|
|
6709
6739
|
let domain = location.host;
|
|
6710
6740
|
newUrl =
|
|
@@ -6724,7 +6754,7 @@ Uts.splitMoney(239238.23,0)
|
|
|
6724
6754
|
* Uts.changeSecondDomainInUrl('scholar','https://www.test.rj-info.com/#/userInfo')
|
|
6725
6755
|
'https://scholar.test.rj-info.com/#/userInfo'
|
|
6726
6756
|
*/
|
|
6727
|
-
changeSecondDomainInUrl: function(secondDomain, url) {
|
|
6757
|
+
changeSecondDomainInUrl: function (secondDomain, url) {
|
|
6728
6758
|
if (!Uts.notEmptyString(url)) {
|
|
6729
6759
|
url = location.href;
|
|
6730
6760
|
}
|
|
@@ -6745,7 +6775,7 @@ false
|
|
|
6745
6775
|
Uts.checkSecondDomain('www',true)
|
|
6746
6776
|
true
|
|
6747
6777
|
*/
|
|
6748
|
-
checkSecondDomain: function(secondDomain, isStrictMode) {
|
|
6778
|
+
checkSecondDomain: function (secondDomain, isStrictMode) {
|
|
6749
6779
|
let currentHost = location.host;
|
|
6750
6780
|
let subfix = Uts.TR(isStrictMode, "\\.", "");
|
|
6751
6781
|
return Uts.startWith(currentHost, secondDomain + subfix);
|
|
@@ -6764,7 +6794,7 @@ Uts.getSecondDomain('https://www.baidu.com')
|
|
|
6764
6794
|
Uts.getSecondDomain('http://www.baidu.com')
|
|
6765
6795
|
'www'
|
|
6766
6796
|
*/
|
|
6767
|
-
getSecondDomain: function(url) {
|
|
6797
|
+
getSecondDomain: function (url) {
|
|
6768
6798
|
let currentHost = url || location.host;
|
|
6769
6799
|
let matchResult = currentHost.match(/[\w-]+(?=\.)/) || [""];
|
|
6770
6800
|
return matchResult[0];
|
|
@@ -6773,7 +6803,7 @@ Uts.getSecondDomain('http://www.baidu.com')
|
|
|
6773
6803
|
* 获取当前页面的URL参数
|
|
6774
6804
|
* @module processString
|
|
6775
6805
|
*/
|
|
6776
|
-
getUrlParam: function(name) {
|
|
6806
|
+
getUrlParam: function (name) {
|
|
6777
6807
|
const url = window.location.href;
|
|
6778
6808
|
const params = new URLSearchParams(url.split("?")[1]);
|
|
6779
6809
|
return params.get(name);
|
|
@@ -6782,24 +6812,24 @@ Uts.getSecondDomain('http://www.baidu.com')
|
|
|
6782
6812
|
* 删除当前页面的URL参数
|
|
6783
6813
|
* @module processString
|
|
6784
6814
|
*/
|
|
6785
|
-
removeParamByRegex: function(name) {
|
|
6815
|
+
removeParamByRegex: function (name) {
|
|
6786
6816
|
const cleanUrl = window.location.href
|
|
6787
6817
|
.replace(new RegExp(`[?&]${name}=[^&]+`), "")
|
|
6788
6818
|
.replace(/^([^?]+)\?$/, "$1")
|
|
6789
6819
|
.replace(/&$/, "");
|
|
6790
6820
|
history.replaceState(null, "", cleanUrl);
|
|
6791
6821
|
},
|
|
6792
|
-
setListToMap: function(pmList, propName) {
|
|
6822
|
+
setListToMap: function (pmList, propName) {
|
|
6793
6823
|
var pmObj = {};
|
|
6794
6824
|
if (Uts.notEmptyArray(pmList)) {
|
|
6795
|
-
Uts.each(pmList, function(item, index) {
|
|
6825
|
+
Uts.each(pmList, function (item, index) {
|
|
6796
6826
|
pmObj[item[propName]] = true;
|
|
6797
6827
|
});
|
|
6798
6828
|
}
|
|
6799
6829
|
return pmObj;
|
|
6800
6830
|
},
|
|
6801
6831
|
//限制只能输入整数价格
|
|
6802
|
-
isIntPrice: function(price) {
|
|
6832
|
+
isIntPrice: function (price) {
|
|
6803
6833
|
let priceTmp = price;
|
|
6804
6834
|
if (priceTmp.length == 1) {
|
|
6805
6835
|
priceTmp = priceTmp.replace(/[^1-9]/g, "");
|
|
@@ -6808,7 +6838,7 @@ Uts.getSecondDomain('http://www.baidu.com')
|
|
|
6808
6838
|
}
|
|
6809
6839
|
return priceTmp;
|
|
6810
6840
|
},
|
|
6811
|
-
updateLastOperationTime: function(url) {
|
|
6841
|
+
updateLastOperationTime: function (url) {
|
|
6812
6842
|
const ignoreUrls = [
|
|
6813
6843
|
Uts.getGatewayDomain("/base/letter/sys/www/list"),
|
|
6814
6844
|
Uts.getGatewayDomain("/base/letter/sys/supp/list"),
|
|
@@ -6823,7 +6853,7 @@ Uts.getSecondDomain('http://www.baidu.com')
|
|
|
6823
6853
|
}
|
|
6824
6854
|
},
|
|
6825
6855
|
|
|
6826
|
-
checkLogOut: function(logOutCB) {
|
|
6856
|
+
checkLogOut: function (logOutCB) {
|
|
6827
6857
|
//定时检查当前账号是否超过30min未进行接口操作
|
|
6828
6858
|
let timerId = setInterval(() => {
|
|
6829
6859
|
let _self = this,
|
|
@@ -6841,7 +6871,7 @@ Uts.getSecondDomain('http://www.baidu.com')
|
|
|
6841
6871
|
}
|
|
6842
6872
|
}, 60000); // todo 60000
|
|
6843
6873
|
},
|
|
6844
|
-
getAutoLoginProject: function(_loginSite) {
|
|
6874
|
+
getAutoLoginProject: function (_loginSite) {
|
|
6845
6875
|
let loginSite = _loginSite;
|
|
6846
6876
|
let autoLoginInfo = Uts.storage.get("autoLoginInfo") || { www: {}, oms: {}, hms: {} };
|
|
6847
6877
|
if (Uts.getCookie("autoLoginInfo") && JSON.parse(Uts.getCookie("autoLoginInfo"))) {
|
|
@@ -6857,7 +6887,7 @@ Uts.getSecondDomain('http://www.baidu.com')
|
|
|
6857
6887
|
}
|
|
6858
6888
|
return loginSite;
|
|
6859
6889
|
},
|
|
6860
|
-
showAutoLogoutTips: function(logoutCB) {
|
|
6890
|
+
showAutoLogoutTips: function (logoutCB) {
|
|
6861
6891
|
//当勾选了自动登录时,先弹窗提示,再判断自动登出
|
|
6862
6892
|
const _currentProject = Uts.getCurrentProject();
|
|
6863
6893
|
// ZenUI.deleteComfirm({
|
|
@@ -6893,7 +6923,7 @@ Uts.getSecondDomain('http://www.baidu.com')
|
|
|
6893
6923
|
// closeByBackDrop: false,
|
|
6894
6924
|
// });
|
|
6895
6925
|
},
|
|
6896
|
-
autoLogOut: function() {
|
|
6926
|
+
autoLogOut: function () {
|
|
6897
6927
|
//各系统自动退出方法
|
|
6898
6928
|
const logoutMap = {
|
|
6899
6929
|
www: "Login?action=logout&type=auto",
|
|
@@ -6926,9 +6956,9 @@ Uts.getSecondDomain('http://www.baidu.com')
|
|
|
6926
6956
|
logoutCB();
|
|
6927
6957
|
}
|
|
6928
6958
|
},
|
|
6929
|
-
blobToDataURI: function(blob, callback) {
|
|
6959
|
+
blobToDataURI: function (blob, callback) {
|
|
6930
6960
|
let reader = new FileReader();
|
|
6931
|
-
reader.onload = function(e) {
|
|
6961
|
+
reader.onload = function (e) {
|
|
6932
6962
|
callback(e.target.result);
|
|
6933
6963
|
};
|
|
6934
6964
|
reader.readAsDataURL(blob);
|
|
@@ -6945,7 +6975,7 @@ Uts.getSecondDomain('http://www.baidu.com')
|
|
|
6945
6975
|
//现网返回
|
|
6946
6976
|
{baseUrl: 'https://m.rjmart.cn'}
|
|
6947
6977
|
*/
|
|
6948
|
-
getWapDomain: function() {
|
|
6978
|
+
getWapDomain: function () {
|
|
6949
6979
|
let domain = window.location.origin;
|
|
6950
6980
|
if (!window.location.origin) {
|
|
6951
6981
|
domain =
|
|
@@ -6961,7 +6991,7 @@ Uts.getSecondDomain('http://www.baidu.com')
|
|
|
6961
6991
|
},
|
|
6962
6992
|
//Uts.formatNumUnit(109700,10000,1,'w') -> 10.9w
|
|
6963
6993
|
//Uts.formatNumUnit(1234,10000,1,'w') -> 1234
|
|
6964
|
-
formatNumUnit: function(num, dividend = 10000, limit = 2, text = "w") {
|
|
6994
|
+
formatNumUnit: function (num, dividend = 10000, limit = 2, text = "w") {
|
|
6965
6995
|
if (isNaN(num) == true) {
|
|
6966
6996
|
return num;
|
|
6967
6997
|
}
|
|
@@ -6990,7 +7020,7 @@ Uts.getSecondDomain('http://www.baidu.com')
|
|
|
6990
7020
|
}
|
|
6991
7021
|
},
|
|
6992
7022
|
//判断手机是全屏还是有物理home键
|
|
6993
|
-
hasPhysicalHomeKey: function() {
|
|
7023
|
+
hasPhysicalHomeKey: function () {
|
|
6994
7024
|
if (window.devicePixelRatio == 3 && screen.width >= 375 && screen.height >= 750) {
|
|
6995
7025
|
return false;
|
|
6996
7026
|
}
|
|
@@ -7110,64 +7140,14 @@ Uts.getSecondDomain('http://www.baidu.com')
|
|
|
7110
7140
|
const prefix = cleaned.replace(/^\+?86/, "").substr(0, 3);
|
|
7111
7141
|
const validPrefixes = [
|
|
7112
7142
|
// 中国移动
|
|
7113
|
-
134,
|
|
7114
|
-
|
|
7115
|
-
136,
|
|
7116
|
-
137,
|
|
7117
|
-
138,
|
|
7118
|
-
139,
|
|
7119
|
-
144,
|
|
7120
|
-
147,
|
|
7121
|
-
148,
|
|
7122
|
-
150,
|
|
7123
|
-
151,
|
|
7124
|
-
152,
|
|
7125
|
-
157,
|
|
7126
|
-
158,
|
|
7127
|
-
159,
|
|
7128
|
-
172,
|
|
7129
|
-
178,
|
|
7130
|
-
182,
|
|
7131
|
-
183,
|
|
7132
|
-
184,
|
|
7133
|
-
187,
|
|
7134
|
-
188,
|
|
7135
|
-
195,
|
|
7136
|
-
197,
|
|
7137
|
-
198,
|
|
7143
|
+
134, 135, 136, 137, 138, 139, 144, 147, 148, 150, 151, 152, 157, 158, 159, 172, 178, 182, 183, 184, 187, 188, 195,
|
|
7144
|
+
197, 198,
|
|
7138
7145
|
// 中国联通
|
|
7139
|
-
130,
|
|
7140
|
-
131,
|
|
7141
|
-
132,
|
|
7142
|
-
140,
|
|
7143
|
-
145,
|
|
7144
|
-
146,
|
|
7145
|
-
155,
|
|
7146
|
-
156,
|
|
7147
|
-
166,
|
|
7148
|
-
175,
|
|
7149
|
-
176,
|
|
7150
|
-
185,
|
|
7151
|
-
186,
|
|
7146
|
+
130, 131, 132, 140, 145, 146, 155, 156, 166, 175, 176, 185, 186,
|
|
7152
7147
|
// 中国电信
|
|
7153
|
-
133,
|
|
7154
|
-
149,
|
|
7155
|
-
153,
|
|
7156
|
-
162,
|
|
7157
|
-
173,
|
|
7158
|
-
177,
|
|
7159
|
-
180,
|
|
7160
|
-
181,
|
|
7161
|
-
189,
|
|
7162
|
-
190,
|
|
7163
|
-
191,
|
|
7164
|
-
193,
|
|
7165
|
-
199,
|
|
7148
|
+
133, 149, 153, 162, 173, 177, 180, 181, 189, 190, 191, 193, 199,
|
|
7166
7149
|
// 虚拟运营商
|
|
7167
|
-
165,
|
|
7168
|
-
167,
|
|
7169
|
-
170,
|
|
7170
|
-
171
|
|
7150
|
+
165, 167, 170, 171
|
|
7171
7151
|
];
|
|
7172
7152
|
|
|
7173
7153
|
return validPrefixes.includes(Number(prefix));
|
|
@@ -7177,36 +7157,45 @@ Uts.getSecondDomain('http://www.baidu.com')
|
|
|
7177
7157
|
* @param {Object|Array} obj - 要过滤的对象或数组
|
|
7178
7158
|
* @returns {Object|Array} - 过滤后的新对象或数组
|
|
7179
7159
|
*/
|
|
7180
|
-
filterCommaFields(obj) {
|
|
7181
|
-
// 处理 null 或 undefined
|
|
7182
|
-
if (obj == null) {
|
|
7183
|
-
return obj;
|
|
7184
|
-
}
|
|
7185
|
-
|
|
7186
|
-
// 处理数组
|
|
7187
|
-
if (Uts.isArray(obj)) {
|
|
7188
|
-
return obj.map(item => this.filterCommaFields(item));
|
|
7189
|
-
}
|
|
7190
|
-
|
|
7160
|
+
filterCommaFields(obj, replaceOrigin = true) {
|
|
7191
7161
|
// 处理对象
|
|
7192
|
-
if (
|
|
7193
|
-
|
|
7194
|
-
|
|
7195
|
-
|
|
7196
|
-
|
|
7197
|
-
|
|
7198
|
-
|
|
7199
|
-
|
|
7200
|
-
|
|
7201
|
-
|
|
7202
|
-
|
|
7162
|
+
if (Uts.notEmptyObject(obj)) {
|
|
7163
|
+
let result = {};
|
|
7164
|
+
|
|
7165
|
+
if (replaceOrigin) {
|
|
7166
|
+
result = obj;
|
|
7167
|
+
// 直接删除包含逗号的键
|
|
7168
|
+
for (const key in obj) {
|
|
7169
|
+
if (obj.hasOwnProperty(key)) {
|
|
7170
|
+
if (key.includes(",")) {
|
|
7171
|
+
delete obj[key];
|
|
7172
|
+
} else {
|
|
7173
|
+
const value = obj[key];
|
|
7174
|
+
// 递归处理嵌套对象或数组
|
|
7175
|
+
if (typeof value === "object" && value !== null) {
|
|
7176
|
+
obj[key] = this.filterCommaFields(value);
|
|
7177
|
+
}
|
|
7178
|
+
}
|
|
7203
7179
|
}
|
|
7180
|
+
}
|
|
7181
|
+
} else {
|
|
7182
|
+
// 创建新对象
|
|
7183
|
+
for (const key in obj) {
|
|
7184
|
+
if (obj.hasOwnProperty(key)) {
|
|
7185
|
+
const value = obj[key];
|
|
7186
|
+
|
|
7187
|
+
// 检查键名是否包含逗号
|
|
7188
|
+
if (key.includes(",")) {
|
|
7189
|
+
// 跳过包含逗号的键
|
|
7190
|
+
continue;
|
|
7191
|
+
}
|
|
7204
7192
|
|
|
7205
|
-
|
|
7206
|
-
|
|
7207
|
-
|
|
7208
|
-
|
|
7209
|
-
|
|
7193
|
+
// 递归处理嵌套对象或数组
|
|
7194
|
+
if (typeof value === "object" && value !== null) {
|
|
7195
|
+
result[key] = this.filterCommaFields(value);
|
|
7196
|
+
} else {
|
|
7197
|
+
result[key] = value;
|
|
7198
|
+
}
|
|
7210
7199
|
}
|
|
7211
7200
|
}
|
|
7212
7201
|
}
|
|
@@ -7216,6 +7205,28 @@ Uts.getSecondDomain('http://www.baidu.com')
|
|
|
7216
7205
|
|
|
7217
7206
|
// 其他类型直接返回
|
|
7218
7207
|
return obj;
|
|
7208
|
+
},
|
|
7209
|
+
// 设置网页favicon
|
|
7210
|
+
setFavicon(url) {
|
|
7211
|
+
let link = document.querySelector("link[rel~='icon']");
|
|
7212
|
+
if (!link) {
|
|
7213
|
+
link = document.createElement("link");
|
|
7214
|
+
link.rel = "icon";
|
|
7215
|
+
document.head.appendChild(link);
|
|
7216
|
+
}
|
|
7217
|
+
link.href = url;
|
|
7218
|
+
},
|
|
7219
|
+
/**
|
|
7220
|
+
* 通过路径获取对象的嵌套值
|
|
7221
|
+
* @param {Object} obj - 目标对象
|
|
7222
|
+
* @param {string} path - 嵌套路径,使用点号分隔(例如:"a.b.c")
|
|
7223
|
+
* @returns {*} - 返回嵌套值,如果路径不存在则返回undefined
|
|
7224
|
+
*/
|
|
7225
|
+
getNestedValue(obj, path) {
|
|
7226
|
+
if (!path || typeof path !== "string") return path;
|
|
7227
|
+
return path.split(".").reduce(function (acc, part) {
|
|
7228
|
+
return acc ? acc[part] : undefined;
|
|
7229
|
+
}, obj);
|
|
7219
7230
|
}
|
|
7220
7231
|
};
|
|
7221
7232
|
|