@indfnd/utils 0.1.17 → 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 +19 -0
- package/dist/ind-utils.es.js +94 -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/config/base.config.ts +2 -0
- 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/config/base.config.d.ts +1 -0
- package/types/config/base.config.d.ts.map +1 -1
- package/types/config/index.d.ts +2 -0
- package/types/config/index.d.ts.map +1 -1
- package/types/utils/request/interceptors.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,25 @@
|
|
|
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
|
+
|
|
16
|
+
### [0.1.18](http://git.inspur.com/imp-ec/ind-front/ind-utils/compare/v0.1.17...v0.1.18) (2024-12-07)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Features
|
|
20
|
+
|
|
21
|
+
* 附件预览 ([6686d4c](http://git.inspur.com/imp-ec/ind-front/ind-utils/commit/6686d4ccf1a8862d7fcf874b0a96a1e836d2b813))
|
|
22
|
+
* 添加imaServerContext配置 ([1535263](http://git.inspur.com/imp-ec/ind-front/ind-utils/commit/1535263cb6f5f06f88dce190d5fa31b93c77da5b))
|
|
23
|
+
|
|
5
24
|
### [0.1.17](http://git.inspur.com/imp-ec/ind-front/ind-utils/compare/v0.1.16...v0.1.17) (2024-09-02)
|
|
6
25
|
|
|
7
26
|
### [0.1.16](http://git.inspur.com/imp-ec/ind-front/ind-utils/compare/v0.1.15...v0.1.16) (2024-08-01)
|
package/dist/ind-utils.es.js
CHANGED
|
@@ -3243,6 +3243,7 @@ var baseConfig = {
|
|
|
3243
3243
|
ismSqServerContext: "/ind-ism-sq-server",
|
|
3244
3244
|
ilmServerContext: "/ind-ilm-server",
|
|
3245
3245
|
imgServerContext: "/ind-img-server",
|
|
3246
|
+
imaServerContext: "/imarket-act-manage-server",
|
|
3246
3247
|
ucExtServerContext: "/ind-uc-ext-server",
|
|
3247
3248
|
kkfilepreviewContext: "/kkfilepreview",
|
|
3248
3249
|
errorMessage: "\u7CFB\u7EDF\u5F00\u5C0F\u5DEE\u4E86\uFF0C\u8BF7\u7A0D\u540E\u5C1D\u8BD5",
|
|
@@ -3309,6 +3310,7 @@ function requestInterceptors(config2) {
|
|
|
3309
3310
|
return config2;
|
|
3310
3311
|
}
|
|
3311
3312
|
function responseInterceptors(response) {
|
|
3313
|
+
var _a;
|
|
3312
3314
|
let data = response.data;
|
|
3313
3315
|
const contentType = getContentType(response.headers);
|
|
3314
3316
|
if (contentType !== CONTENT_TYPE.json) {
|
|
@@ -3320,6 +3322,11 @@ function responseInterceptors(response) {
|
|
|
3320
3322
|
const code = data.code;
|
|
3321
3323
|
switch (code) {
|
|
3322
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
|
+
}
|
|
3323
3330
|
return data;
|
|
3324
3331
|
}
|
|
3325
3332
|
case NO_SESSION_CODE: {
|
|
@@ -11134,12 +11141,98 @@ function getPreviewUrlApi(fileId) {
|
|
|
11134
11141
|
axiosConfig
|
|
11135
11142
|
);
|
|
11136
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
|
+
};
|
|
11137
11230
|
const CONTEXT$2 = config.authServerContext;
|
|
11138
11231
|
function loginApi({ userName, password, validCodeId, validCodeInput }) {
|
|
11139
11232
|
let publicKey = `MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDD2iolFHi+6bUh+V6JPr2gFJQsC0QNsq2EwI0MAPlI5AaizBHRVMjX1H73ptuDSiT3QZh4kk74w+eDLyYj4JXo1SvvDw5w378SLhUIDzH0zrlt3oleT3kiPQxC17yM3Os/wrtHO7IC+KGo9qrg+LJFyR/fYYHcyH9i+JAejBEnJQIDAQAB`;
|
|
11140
11233
|
let nodeRSA = new window.NodeRSA(publicKey, "pkcs8-public");
|
|
11141
11234
|
let rsaPaswword = nodeRSA.encrypt(password, "base64");
|
|
11142
|
-
let upw =
|
|
11235
|
+
let upw = Base64.encode(rsaPaswword);
|
|
11143
11236
|
const data = { usn: userName, upw, validCodeId, validCodeInput };
|
|
11144
11237
|
return instance.formPost(CONTEXT$2 + "/sso/auth/login", data);
|
|
11145
11238
|
}
|