@indfnd/utils 0.1.18 → 0.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/ind-utils.es.js +93 -1
- package/dist/ind-utils.umd.cjs +9 -9
- package/global.d.ts +1 -0
- package/package.json +1 -1
- package/src/api/platform/base64.js +122 -0
- package/src/api/platform/user.ts +2 -1
- package/src/utils/request/interceptors.ts +5 -0
- package/types/api/platform/base64.d.ts +7 -0
- package/types/api/platform/base64.d.ts.map +1 -0
- package/types/api/platform/user.d.ts.map +1 -1
- package/types/utils/request/interceptors.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [0.1.20](http://git.inspur.com/imp-ec/ind-front/ind-utils/compare/v0.1.19...v0.1.20) (2025-01-06)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* 登录逻辑修改 ([c5df0d1](http://git.inspur.com/imp-ec/ind-front/ind-utils/commit/c5df0d10739b35d9e515ad435d687fc9d1ae8b16))
|
|
11
|
+
* 山东待办 ([6bf8fa2](http://git.inspur.com/imp-ec/ind-front/ind-utils/commit/6bf8fa2725124a3cd0243c91ffdbb785af940806))
|
|
12
|
+
* 增加base64 ([61b40cd](http://git.inspur.com/imp-ec/ind-front/ind-utils/commit/61b40cd8f02885f64c4e4a3d1575242224e1e103))
|
|
13
|
+
|
|
14
|
+
### [0.1.19](http://git.inspur.com/imp-ec/ind-front/ind-utils/compare/v0.1.18...v0.1.19) (2025-01-06)
|
|
15
|
+
|
|
5
16
|
### [0.1.18](http://git.inspur.com/imp-ec/ind-front/ind-utils/compare/v0.1.17...v0.1.18) (2024-12-07)
|
|
6
17
|
|
|
7
18
|
|
package/dist/ind-utils.es.js
CHANGED
|
@@ -3310,6 +3310,7 @@ function requestInterceptors(config2) {
|
|
|
3310
3310
|
return config2;
|
|
3311
3311
|
}
|
|
3312
3312
|
function responseInterceptors(response) {
|
|
3313
|
+
var _a;
|
|
3313
3314
|
let data = response.data;
|
|
3314
3315
|
const contentType = getContentType(response.headers);
|
|
3315
3316
|
if (contentType !== CONTENT_TYPE.json) {
|
|
@@ -3321,6 +3322,11 @@ function responseInterceptors(response) {
|
|
|
3321
3322
|
const code = data.code;
|
|
3322
3323
|
switch (code) {
|
|
3323
3324
|
case SUCCESS_CODE: {
|
|
3325
|
+
if (sessionStorage.getItem("isFromIM") == "1" && ((_a = data == null ? void 0 : data.extInfo) == null ? void 0 : _a.handleTask)) {
|
|
3326
|
+
if (typeof window.native != "undefined") {
|
|
3327
|
+
window.native.goHome();
|
|
3328
|
+
}
|
|
3329
|
+
}
|
|
3324
3330
|
return data;
|
|
3325
3331
|
}
|
|
3326
3332
|
case NO_SESSION_CODE: {
|
|
@@ -11135,12 +11141,98 @@ function getPreviewUrlApi(fileId) {
|
|
|
11135
11141
|
axiosConfig
|
|
11136
11142
|
);
|
|
11137
11143
|
}
|
|
11144
|
+
let Base64 = {
|
|
11145
|
+
Base64Chars: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@*-",
|
|
11146
|
+
encode: function(s) {
|
|
11147
|
+
if (!s || s.length == 0)
|
|
11148
|
+
return s;
|
|
11149
|
+
var d = "";
|
|
11150
|
+
var b = this.ucs2_utf8(s);
|
|
11151
|
+
var b0, b1, b2, b3;
|
|
11152
|
+
var len = b.length;
|
|
11153
|
+
var i = 0;
|
|
11154
|
+
while (i < len) {
|
|
11155
|
+
var tmp = b[i++];
|
|
11156
|
+
b0 = (tmp & 252) >> 2;
|
|
11157
|
+
b1 = (tmp & 3) << 4;
|
|
11158
|
+
if (i < len) {
|
|
11159
|
+
tmp = b[i++];
|
|
11160
|
+
b1 |= (tmp & 240) >> 4;
|
|
11161
|
+
b2 = (tmp & 15) << 2;
|
|
11162
|
+
if (i < len) {
|
|
11163
|
+
tmp = b[i++];
|
|
11164
|
+
b2 |= (tmp & 192) >> 6;
|
|
11165
|
+
b3 = tmp & 63;
|
|
11166
|
+
} else {
|
|
11167
|
+
b3 = 64;
|
|
11168
|
+
}
|
|
11169
|
+
} else {
|
|
11170
|
+
b2 = b3 = 64;
|
|
11171
|
+
}
|
|
11172
|
+
d += this.Base64Chars.charAt(b0);
|
|
11173
|
+
d += this.Base64Chars.charAt(b1);
|
|
11174
|
+
d += this.Base64Chars.charAt(b2);
|
|
11175
|
+
d += this.Base64Chars.charAt(b3);
|
|
11176
|
+
}
|
|
11177
|
+
return d;
|
|
11178
|
+
},
|
|
11179
|
+
ucs2_utf8: function(s) {
|
|
11180
|
+
if (!s)
|
|
11181
|
+
return null;
|
|
11182
|
+
var d = new Array();
|
|
11183
|
+
if (s == "")
|
|
11184
|
+
return d;
|
|
11185
|
+
var c = 0, i = 0, j = 0;
|
|
11186
|
+
var len = s.length;
|
|
11187
|
+
while (i < len) {
|
|
11188
|
+
c = s.charCodeAt(i++);
|
|
11189
|
+
if (c <= 127) {
|
|
11190
|
+
d[j++] = c;
|
|
11191
|
+
} else if (c >= 128 && c <= 2047) {
|
|
11192
|
+
d[j++] = c >> 6 & 31 | 192;
|
|
11193
|
+
d[j++] = c & 63 | 128;
|
|
11194
|
+
} else {
|
|
11195
|
+
d[j++] = c >> 12 | 224;
|
|
11196
|
+
d[j++] = c >> 6 & 63 | 128;
|
|
11197
|
+
d[j++] = c & 63 | 128;
|
|
11198
|
+
}
|
|
11199
|
+
}
|
|
11200
|
+
return d;
|
|
11201
|
+
},
|
|
11202
|
+
utf8_ucs2: function(s) {
|
|
11203
|
+
if (!s)
|
|
11204
|
+
return null;
|
|
11205
|
+
var len = s.length;
|
|
11206
|
+
if (len == 0)
|
|
11207
|
+
return "";
|
|
11208
|
+
var d = "";
|
|
11209
|
+
var c = 0, i = 0, tmp = 0;
|
|
11210
|
+
while (i < len) {
|
|
11211
|
+
c = s[i++];
|
|
11212
|
+
if ((c & 224) == 224) {
|
|
11213
|
+
tmp = (c & 15) << 12;
|
|
11214
|
+
c = s[i++];
|
|
11215
|
+
tmp |= (c & 63) << 6;
|
|
11216
|
+
c = s[i++];
|
|
11217
|
+
tmp |= c & 63;
|
|
11218
|
+
} else if ((c & 192) == 192) {
|
|
11219
|
+
tmp = (c & 31) << 6;
|
|
11220
|
+
c = s[i++];
|
|
11221
|
+
tmp |= c & 63;
|
|
11222
|
+
} else {
|
|
11223
|
+
tmp = c;
|
|
11224
|
+
}
|
|
11225
|
+
d += String.fromCharCode(tmp);
|
|
11226
|
+
}
|
|
11227
|
+
return d;
|
|
11228
|
+
}
|
|
11229
|
+
};
|
|
11138
11230
|
const CONTEXT$2 = config.authServerContext;
|
|
11139
11231
|
function loginApi({ userName, password, validCodeId, validCodeInput }) {
|
|
11140
11232
|
let publicKey = `MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDD2iolFHi+6bUh+V6JPr2gFJQsC0QNsq2EwI0MAPlI5AaizBHRVMjX1H73ptuDSiT3QZh4kk74w+eDLyYj4JXo1SvvDw5w378SLhUIDzH0zrlt3oleT3kiPQxC17yM3Os/wrtHO7IC+KGo9qrg+LJFyR/fYYHcyH9i+JAejBEnJQIDAQAB`;
|
|
11141
11233
|
let nodeRSA = new window.NodeRSA(publicKey, "pkcs8-public");
|
|
11142
11234
|
let rsaPaswword = nodeRSA.encrypt(password, "base64");
|
|
11143
|
-
let upw =
|
|
11235
|
+
let upw = Base64.encode(rsaPaswword);
|
|
11144
11236
|
const data = { usn: userName, upw, validCodeId, validCodeInput };
|
|
11145
11237
|
return instance.formPost(CONTEXT$2 + "/sso/auth/login", data);
|
|
11146
11238
|
}
|