egova-admin-jssdk 0.0.10 → 0.0.11
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/README.md +8 -8
- package/dist/service/index.d.ts +16 -0
- package/dist/service/index.js +23 -12
- package/dist/util/signature.js +4 -3
- package/lib/egova-admin-jssdk.mjs +113 -104
- package/package.json +54 -54
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
egova admin jssdk
|
|
2
|
-
|
|
3
|
-
步骤:
|
|
4
|
-
|
|
5
|
-
pnpm install
|
|
6
|
-
|
|
7
|
-
pnpm build
|
|
8
|
-
|
|
1
|
+
egova admin jssdk
|
|
2
|
+
|
|
3
|
+
步骤:
|
|
4
|
+
|
|
5
|
+
pnpm install
|
|
6
|
+
|
|
7
|
+
pnpm build
|
|
8
|
+
|
|
9
9
|
npm publish
|
package/dist/service/index.d.ts
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
import type { HumanParams, UnitParams, CountParams } from "../types";
|
|
2
|
+
import type { AxiosRequestConfig } from "axios";
|
|
3
|
+
/**
|
|
4
|
+
* get请求用户中心的接口数据
|
|
5
|
+
* @param url 接口地址
|
|
6
|
+
* @param config
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
export declare function getUsercenterData(url: string, config?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<any, any>> | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* post请求用户中心的接口数据
|
|
12
|
+
* @param url 接口地址
|
|
13
|
+
* @param params
|
|
14
|
+
* @param config
|
|
15
|
+
* @returns
|
|
16
|
+
*/
|
|
17
|
+
export declare function postUsercenterData(url: string, params?: object, config?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<any, any>> | undefined;
|
|
2
18
|
/**
|
|
3
19
|
* 获取部门人员
|
|
4
20
|
* @param params
|
package/dist/service/index.js
CHANGED
|
@@ -2,7 +2,25 @@ import { adminAxios } from "../util/axios-util";
|
|
|
2
2
|
import { isNil } from "lodash-es";
|
|
3
3
|
import { saltData } from "../util/global";
|
|
4
4
|
import { crypto } from "../util/crypto";
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* get请求用户中心的接口数据
|
|
7
|
+
* @param url 接口地址
|
|
8
|
+
* @param config
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
11
|
+
export function getUsercenterData(url, config) {
|
|
12
|
+
return adminAxios.getAxiosInstance()?.get(url, config);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* post请求用户中心的接口数据
|
|
16
|
+
* @param url 接口地址
|
|
17
|
+
* @param params
|
|
18
|
+
* @param config
|
|
19
|
+
* @returns
|
|
20
|
+
*/
|
|
21
|
+
export function postUsercenterData(url, params, config) {
|
|
22
|
+
return adminAxios.getAxiosInstance()?.post(url, params, config);
|
|
23
|
+
}
|
|
6
24
|
/**
|
|
7
25
|
* 获取部门人员
|
|
8
26
|
* @param params
|
|
@@ -56,10 +74,9 @@ export function getPublicKey() {
|
|
|
56
74
|
*/
|
|
57
75
|
export async function changeUserCryptogram(oldPwd, newPwd) {
|
|
58
76
|
if (!saltData.publicKey) {
|
|
59
|
-
const
|
|
60
|
-
const publicKeyRes = responseData.data;
|
|
77
|
+
const publicKeyRes = await getPublicKey();
|
|
61
78
|
if (publicKeyRes && !publicKeyRes.hasError) {
|
|
62
|
-
|
|
79
|
+
const data = publicKeyRes.result?.data || [];
|
|
63
80
|
if (data && data.length === 2) {
|
|
64
81
|
saltData.type = data[0];
|
|
65
82
|
saltData.publicKey = data[1];
|
|
@@ -69,14 +86,8 @@ export async function changeUserCryptogram(oldPwd, newPwd) {
|
|
|
69
86
|
let oldPwdEncrypt = oldPwd;
|
|
70
87
|
let newPwdEncrypt = newPwd;
|
|
71
88
|
if (saltData.publicKey) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
newPwdEncrypt = await crypto.sm2Encrypt(randomUtil.randomStr(6) + newPwd, saltData.publicKey);
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
oldPwdEncrypt = await crypto.sm2Encrypt(oldPwd, saltData.publicKey);
|
|
78
|
-
newPwdEncrypt = await crypto.sm2Encrypt(newPwd, saltData.publicKey);
|
|
79
|
-
}
|
|
89
|
+
oldPwdEncrypt = await crypto.sm2Encrypt(oldPwd, saltData.publicKey);
|
|
90
|
+
newPwdEncrypt = await crypto.sm2Encrypt(newPwd, saltData.publicKey);
|
|
80
91
|
}
|
|
81
92
|
return adminAxios.getAxiosInstance()?.post("/unity/org/human/changeuserowncryptogram", {
|
|
82
93
|
cryptogram: newPwdEncrypt,
|
package/dist/util/signature.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import CryptoJS from "crypto-js";
|
|
2
2
|
import { isNil, merge } from "lodash-es";
|
|
3
3
|
import qs from "qs";
|
|
4
|
-
import { toRaw } from "vue";
|
|
5
4
|
import { dataTypeOf } from "./data-type-of";
|
|
6
5
|
import randomUtil from "./random-util";
|
|
7
6
|
import { urlUtil } from "./url";
|
|
@@ -195,7 +194,8 @@ export class Signature {
|
|
|
195
194
|
const method = config.method?.toUpperCase();
|
|
196
195
|
const isGet = method === "GET";
|
|
197
196
|
// 获取 data
|
|
198
|
-
const rawData = toRaw(config.data);
|
|
197
|
+
// const rawData = toRaw(config.data);
|
|
198
|
+
const rawData = config.data;
|
|
199
199
|
const isObjectPayload = rawData !== null && typeof rawData === "object"; // 参考 axios 源码
|
|
200
200
|
// 获取 contentType
|
|
201
201
|
const contentType = config.headers?.["Content-Type"]?.toString() || "";
|
|
@@ -216,7 +216,8 @@ export class Signature {
|
|
|
216
216
|
merge(params, urlParams);
|
|
217
217
|
// 1.2 取 config.params 参数
|
|
218
218
|
if (!isNil(config.params)) {
|
|
219
|
-
const raw = toRaw(config.params);
|
|
219
|
+
// const raw = toRaw(config.params);
|
|
220
|
+
const raw = config.params;
|
|
220
221
|
// params 内的参数需要去除 null|undefined|function
|
|
221
222
|
this.removeNilValue(raw);
|
|
222
223
|
config.params = raw;
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var d = (
|
|
4
|
-
import
|
|
5
|
-
import { random as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return r instanceof Element ? "element" : Object.prototype.toString.call(r).replace(/\[object\s(.+)\]/, "$1").toLowerCase();
|
|
1
|
+
var v = Object.defineProperty;
|
|
2
|
+
var B = (n, t, e) => t in n ? v(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
|
|
3
|
+
var d = (n, t, e) => B(n, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import K from "axios";
|
|
5
|
+
import { random as U, merge as u, isNil as m } from "lodash-es";
|
|
6
|
+
import A from "crypto-js";
|
|
7
|
+
import I from "qs";
|
|
8
|
+
import { sm4 as C, sm2 as L } from "sm-crypto";
|
|
9
|
+
/*! egova-admin-jssdk v0.0.11 */
|
|
10
|
+
function f(n) {
|
|
11
|
+
return n instanceof Element ? "element" : Object.prototype.toString.call(n).replace(/\[object\s(.+)\]/, "$1").toLowerCase();
|
|
13
12
|
}
|
|
14
|
-
class
|
|
13
|
+
class V {
|
|
15
14
|
/**
|
|
16
15
|
* 等价于Math.random()
|
|
17
16
|
* @returns
|
|
@@ -24,19 +23,19 @@ class k {
|
|
|
24
23
|
* @param len
|
|
25
24
|
*/
|
|
26
25
|
randomStr(t) {
|
|
27
|
-
const e = Math.ceil(t / 2),
|
|
28
|
-
return window.crypto.getRandomValues(
|
|
26
|
+
const e = Math.ceil(t / 2), r = new Uint8Array(e);
|
|
27
|
+
return window.crypto.getRandomValues(r), Array.from(r).map((i) => i.toString(16).padStart(2, "0")).join("").substr(0, t);
|
|
29
28
|
}
|
|
30
29
|
/**
|
|
31
30
|
* 随机生成len长度的纯数字字符串,比如randomNumberStr(16)得到 "1842442170233672"
|
|
32
31
|
* @param len
|
|
33
32
|
*/
|
|
34
33
|
randomNumberStr(t) {
|
|
35
|
-
const e = Math.ceil(t / 2),
|
|
36
|
-
window.crypto.getRandomValues(
|
|
34
|
+
const e = Math.ceil(t / 2), r = new Uint8Array(e);
|
|
35
|
+
window.crypto.getRandomValues(r);
|
|
37
36
|
let o = "";
|
|
38
37
|
for (let s = 0; s < e; s++)
|
|
39
|
-
o +=
|
|
38
|
+
o += r[s].toString().padStart(2, "0");
|
|
40
39
|
return o.slice(0, t);
|
|
41
40
|
}
|
|
42
41
|
/**
|
|
@@ -44,20 +43,20 @@ class k {
|
|
|
44
43
|
* @param len
|
|
45
44
|
*/
|
|
46
45
|
getRandomPassword(t) {
|
|
47
|
-
const e = "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
|
|
48
|
-
let
|
|
49
|
-
|
|
50
|
-
for (let
|
|
51
|
-
|
|
52
|
-
return
|
|
46
|
+
const e = "ABCDEFGHIJKLMNOPQRSTUVWXYZ", r = "abcdefghijklmnopqrstuvwxyz", o = "0123456789", s = ".~!@#$%^&*)(_+}{|:?><", i = e + r + o + s;
|
|
47
|
+
let a = "";
|
|
48
|
+
a += this.getRandomChar(e), a += this.getRandomChar(r), a += this.getRandomChar(o), a += this.getRandomChar(s);
|
|
49
|
+
for (let c = a.length; c < t; c++)
|
|
50
|
+
a += this.getRandomChar(i);
|
|
51
|
+
return a = a.split("").sort(() => U(!0) - 0.5).join(""), a;
|
|
53
52
|
}
|
|
54
53
|
getRandomChar(t) {
|
|
55
|
-
const e = Math.floor(
|
|
54
|
+
const e = Math.floor(U(!0) * t.length);
|
|
56
55
|
return t[e];
|
|
57
56
|
}
|
|
58
57
|
}
|
|
59
|
-
const
|
|
60
|
-
class
|
|
58
|
+
const N = new V();
|
|
59
|
+
class k {
|
|
61
60
|
/**
|
|
62
61
|
* 清除 url 中重复的斜杠
|
|
63
62
|
* @param url 链接地址
|
|
@@ -68,8 +67,8 @@ class D {
|
|
|
68
67
|
return t.replace(/([^:]|^)\/{2,}/g, "$1/");
|
|
69
68
|
}
|
|
70
69
|
}
|
|
71
|
-
const
|
|
72
|
-
class
|
|
70
|
+
const E = new k();
|
|
71
|
+
class D {
|
|
73
72
|
constructor(t) {
|
|
74
73
|
/**
|
|
75
74
|
* 应用标识
|
|
@@ -86,7 +85,7 @@ class H {
|
|
|
86
85
|
* @returns
|
|
87
86
|
*/
|
|
88
87
|
generateRandomString() {
|
|
89
|
-
return
|
|
88
|
+
return N.randomStr(8);
|
|
90
89
|
}
|
|
91
90
|
/**
|
|
92
91
|
* 生成签名参数
|
|
@@ -113,8 +112,8 @@ class H {
|
|
|
113
112
|
if (f(t) === "object") {
|
|
114
113
|
for (const e in t)
|
|
115
114
|
if (Object.prototype.hasOwnProperty.call(t, e)) {
|
|
116
|
-
const
|
|
117
|
-
o === "object" ? this.removeNilValue(
|
|
115
|
+
const r = t[e], o = f(r);
|
|
116
|
+
o === "object" ? this.removeNilValue(r) : (o === "null" || o === "undefined" || o === "function") && delete t[e];
|
|
118
117
|
}
|
|
119
118
|
}
|
|
120
119
|
}
|
|
@@ -134,16 +133,16 @@ class H {
|
|
|
134
133
|
* @param param - 参数
|
|
135
134
|
* @returns
|
|
136
135
|
*/
|
|
137
|
-
formatEncodeParam(t, e,
|
|
138
|
-
const o = f(
|
|
136
|
+
formatEncodeParam(t, e, r) {
|
|
137
|
+
const o = f(r);
|
|
139
138
|
if (o === "object") {
|
|
140
|
-
const s = Object.keys(
|
|
141
|
-
s.length === 0 ? t.push(`${e}={}`) : s.forEach((
|
|
142
|
-
this.formatEncodeParam(t, e === "" ? `${
|
|
139
|
+
const s = Object.keys(r).sort();
|
|
140
|
+
s.length === 0 ? t.push(`${e}={}`) : s.forEach((i) => {
|
|
141
|
+
this.formatEncodeParam(t, e === "" ? `${i}` : `${e}[${i}]`, r[i]);
|
|
143
142
|
});
|
|
144
|
-
} else o === "array" ?
|
|
143
|
+
} else o === "array" ? r.length === 0 ? t.push(`${e}=[]`) : r.forEach((s) => {
|
|
145
144
|
this.formatEncodeParam(t, `${e}[]`, s);
|
|
146
|
-
}) : t.push(`${e}=${this.formatEncodeValue(
|
|
145
|
+
}) : t.push(`${e}=${this.formatEncodeValue(r)}`);
|
|
147
146
|
}
|
|
148
147
|
/**
|
|
149
148
|
* 参数排序
|
|
@@ -160,7 +159,7 @@ class H {
|
|
|
160
159
|
* @returns
|
|
161
160
|
*/
|
|
162
161
|
cryptoHash(t) {
|
|
163
|
-
return
|
|
162
|
+
return A.HmacSHA1(t, this.appIdCode.code).toString(A.enc.Hex).toUpperCase();
|
|
164
163
|
}
|
|
165
164
|
/**
|
|
166
165
|
* 获取 url 参数
|
|
@@ -168,7 +167,7 @@ class H {
|
|
|
168
167
|
* @returns
|
|
169
168
|
*/
|
|
170
169
|
urlSearchParams(t) {
|
|
171
|
-
return t && t.indexOf("?") > -1 ?
|
|
170
|
+
return t && t.indexOf("?") > -1 ? I.parse(t.split("?").pop() ?? "") : {};
|
|
172
171
|
}
|
|
173
172
|
/**
|
|
174
173
|
* 获取签名 url
|
|
@@ -178,10 +177,10 @@ class H {
|
|
|
178
177
|
*/
|
|
179
178
|
signatureHref(t) {
|
|
180
179
|
try {
|
|
181
|
-
const { pathname: e, origin:
|
|
182
|
-
|
|
183
|
-
const
|
|
184
|
-
t = `${
|
|
180
|
+
const { pathname: e, origin: r } = new URL(t, window.location.origin), o = this.urlSearchParams(t), s = this.generateSignatureOption();
|
|
181
|
+
u(o, s);
|
|
182
|
+
const i = this.sortParamByKey(o), c = `${E.cleanUrl(`/${e}`)}?${i}`, g = this.cryptoHash(c);
|
|
183
|
+
t = `${r}${c}&signature=${g}`;
|
|
185
184
|
} catch {
|
|
186
185
|
console.error("签名失败,请使用有效的链接", t);
|
|
187
186
|
}
|
|
@@ -194,38 +193,38 @@ class H {
|
|
|
194
193
|
* @public
|
|
195
194
|
*/
|
|
196
195
|
signatureConfig(t) {
|
|
197
|
-
var e,
|
|
196
|
+
var e, r, o, s;
|
|
198
197
|
try {
|
|
199
|
-
const
|
|
200
|
-
let
|
|
201
|
-
!
|
|
202
|
-
const y = {},
|
|
203
|
-
if (
|
|
204
|
-
const p =
|
|
205
|
-
this.removeNilValue(p), t.params = p,
|
|
198
|
+
const a = ((e = t.method) == null ? void 0 : e.toUpperCase()) === "GET", c = t.data, g = c !== null && typeof c == "object", b = ((o = (r = t.headers) == null ? void 0 : r["Content-Type"]) == null ? void 0 : o.toString()) || "", O = b.includes("multipart/form-data");
|
|
199
|
+
let S = b.includes("application/json");
|
|
200
|
+
!a && !b && g && (S = !0), u(t, { headers: { "App-Id": this.appIdCode.id } });
|
|
201
|
+
const y = {}, R = this.urlSearchParams(t.url);
|
|
202
|
+
if (u(y, R), !m(t.params)) {
|
|
203
|
+
const p = t.params;
|
|
204
|
+
this.removeNilValue(p), t.params = p, u(y, I.parse(I.stringify(p)));
|
|
206
205
|
}
|
|
207
|
-
!m(
|
|
208
|
-
const
|
|
209
|
-
|
|
210
|
-
let
|
|
211
|
-
if (
|
|
212
|
-
const p = JSON.stringify(
|
|
213
|
-
this.isStringOverKB(p, 128) || (
|
|
206
|
+
!m(c) && g && !O && !S && u(y, c);
|
|
207
|
+
const w = this.generateSignatureOption();
|
|
208
|
+
u(y, w);
|
|
209
|
+
let $ = this.sortParamByKey(y);
|
|
210
|
+
if (S) {
|
|
211
|
+
const p = JSON.stringify(c);
|
|
212
|
+
this.isStringOverKB(p, 128) || (g ? $ += this.formatEncodeValue(p) : $ += this.formatEncodeValue(c));
|
|
214
213
|
}
|
|
215
|
-
let
|
|
216
|
-
(s = t.url) != null && s.startsWith("http") ?
|
|
217
|
-
const { pathname:
|
|
218
|
-
|
|
219
|
-
} catch (
|
|
220
|
-
console.error("签名失败",
|
|
214
|
+
let x = "";
|
|
215
|
+
(s = t.url) != null && s.startsWith("http") ? x = t.url : x = `${t.baseURL}/${t.url || ""}`;
|
|
216
|
+
const { pathname: j } = new URL(x, window.location.origin), T = `${E.cleanUrl(`/${j}`)}?${$}`;
|
|
217
|
+
w.signature = this.cryptoHash(T), t.params = u({}, t.params, w);
|
|
218
|
+
} catch (i) {
|
|
219
|
+
console.error("签名失败", i);
|
|
221
220
|
}
|
|
222
221
|
}
|
|
223
222
|
}
|
|
224
|
-
const
|
|
223
|
+
const H = {
|
|
225
224
|
id: "mis",
|
|
226
225
|
code: "c9d8e36df18ef01ff0da74e0bb13151c"
|
|
227
|
-
},
|
|
228
|
-
class
|
|
226
|
+
}, z = new D(H);
|
|
227
|
+
class F {
|
|
229
228
|
constructor() {
|
|
230
229
|
d(this, "axiosInstance");
|
|
231
230
|
d(this, "egovaAdminToken");
|
|
@@ -236,7 +235,7 @@ class M {
|
|
|
236
235
|
* @param token 统一用户中心的token
|
|
237
236
|
*/
|
|
238
237
|
init(t, e) {
|
|
239
|
-
this.egovaAdminToken = e, this.axiosInstance =
|
|
238
|
+
this.egovaAdminToken = e, this.axiosInstance = K.create({
|
|
240
239
|
baseURL: t,
|
|
241
240
|
timeout: 6e4
|
|
242
241
|
}), this.configAxios();
|
|
@@ -258,21 +257,21 @@ class M {
|
|
|
258
257
|
*/
|
|
259
258
|
configToken(t) {
|
|
260
259
|
const e = /^\/?(free)\//;
|
|
261
|
-
t.url && !e.test(t.url) && this.egovaAdminToken &&
|
|
260
|
+
t.url && !e.test(t.url) && this.egovaAdminToken && u(t, { headers: { "X-Authorization": `bearer ${this.egovaAdminToken}` } });
|
|
262
261
|
}
|
|
263
262
|
/**
|
|
264
263
|
* 接口签名
|
|
265
264
|
* @param config
|
|
266
265
|
*/
|
|
267
266
|
configSignature(t) {
|
|
268
|
-
|
|
267
|
+
z.signatureConfig(t);
|
|
269
268
|
}
|
|
270
269
|
}
|
|
271
|
-
const
|
|
270
|
+
const l = new F(), h = {
|
|
272
271
|
type: "sm2WithSalt",
|
|
273
272
|
publicKey: ""
|
|
274
|
-
},
|
|
275
|
-
class
|
|
273
|
+
}, M = "0123456789abcdeffedcba9876543210";
|
|
274
|
+
class J {
|
|
276
275
|
constructor(t) {
|
|
277
276
|
d(this, "key");
|
|
278
277
|
this.key = t;
|
|
@@ -284,7 +283,7 @@ class Q {
|
|
|
284
283
|
* @returns 加密结果
|
|
285
284
|
*/
|
|
286
285
|
encrypt(t, e) {
|
|
287
|
-
return
|
|
286
|
+
return C.encrypt(t, this.key, e);
|
|
288
287
|
}
|
|
289
288
|
/**
|
|
290
289
|
* 解密数据
|
|
@@ -293,7 +292,7 @@ class Q {
|
|
|
293
292
|
* @returns 解密结果
|
|
294
293
|
*/
|
|
295
294
|
decrypt(t, e) {
|
|
296
|
-
return
|
|
295
|
+
return C.decrypt(t, this.key, e);
|
|
297
296
|
}
|
|
298
297
|
/**
|
|
299
298
|
* sm2 加密数据 (登录时对密码的加密)
|
|
@@ -305,53 +304,63 @@ class Q {
|
|
|
305
304
|
try {
|
|
306
305
|
if (!e)
|
|
307
306
|
return Promise.reject(new Error("无法获取加密密钥"));
|
|
308
|
-
const
|
|
309
|
-
return Promise.resolve(
|
|
310
|
-
} catch (
|
|
311
|
-
return Promise.reject(
|
|
307
|
+
const r = L.doEncrypt(t, e, 1);
|
|
308
|
+
return Promise.resolve(r);
|
|
309
|
+
} catch (r) {
|
|
310
|
+
return Promise.reject(r);
|
|
312
311
|
}
|
|
313
312
|
}
|
|
314
313
|
}
|
|
315
|
-
const
|
|
316
|
-
function
|
|
314
|
+
const P = new J(M);
|
|
315
|
+
function et(n, t) {
|
|
316
|
+
var e;
|
|
317
|
+
return (e = l.getAxiosInstance()) == null ? void 0 : e.get(n, t);
|
|
318
|
+
}
|
|
319
|
+
function nt(n, t, e) {
|
|
320
|
+
var r;
|
|
321
|
+
return (r = l.getAxiosInstance()) == null ? void 0 : r.post(n, t, e);
|
|
322
|
+
}
|
|
323
|
+
function rt(n) {
|
|
317
324
|
var t;
|
|
318
|
-
return (t =
|
|
325
|
+
return (t = l.getAxiosInstance()) == null ? void 0 : t.get("/unity/org/human/gethumanlist", { params: n });
|
|
319
326
|
}
|
|
320
|
-
function ot(
|
|
327
|
+
function ot(n) {
|
|
321
328
|
var t;
|
|
322
|
-
return (t =
|
|
329
|
+
return (t = l.getAxiosInstance()) == null ? void 0 : t.get("/unity/builder/org/gettenantunittree", { params: n });
|
|
323
330
|
}
|
|
324
|
-
function st(
|
|
331
|
+
function st(n) {
|
|
325
332
|
var o;
|
|
326
333
|
const t = "/unity/org/unit/countunithumannumber", e = [];
|
|
327
|
-
m(
|
|
328
|
-
const
|
|
329
|
-
return (o =
|
|
334
|
+
m(n.tenantId) || e.push(`tenantId=${n.tenantId}`), m(n.roleId) || e.push(`roleId=${n.roleId}`), m(n.onlyQueryUnbound) || e.push(`onlyQueryUnbound=${n.onlyQueryUnbound}`), m(n.permissionId) || e.push(`permissionId=${n.permissionId}`);
|
|
335
|
+
const r = e.length ? `${t}?${e.join("&")}` : t;
|
|
336
|
+
return (o = l.getAxiosInstance()) == null ? void 0 : o.post(r, n.ids);
|
|
330
337
|
}
|
|
331
|
-
function
|
|
332
|
-
var
|
|
333
|
-
return (
|
|
338
|
+
function Q() {
|
|
339
|
+
var n;
|
|
340
|
+
return (n = l.getAxiosInstance()) == null ? void 0 : n.get("/free/oauth/getalgandpublickey");
|
|
334
341
|
}
|
|
335
|
-
async function it(
|
|
342
|
+
async function it(n, t) {
|
|
336
343
|
var o, s;
|
|
337
|
-
if (!
|
|
338
|
-
const i =
|
|
344
|
+
if (!h.publicKey) {
|
|
345
|
+
const i = await Q();
|
|
339
346
|
if (i && !i.hasError) {
|
|
340
|
-
|
|
341
|
-
a.length === 2 && (
|
|
347
|
+
const a = ((o = i.result) == null ? void 0 : o.data) || [];
|
|
348
|
+
a.length === 2 && (h.type = a[0], h.publicKey = a[1]);
|
|
342
349
|
}
|
|
343
350
|
}
|
|
344
|
-
let e =
|
|
345
|
-
return
|
|
346
|
-
cryptogram:
|
|
351
|
+
let e = n, r = t;
|
|
352
|
+
return h.publicKey && (e = await P.sm2Encrypt(n, h.publicKey), r = await P.sm2Encrypt(t, h.publicKey)), (s = l.getAxiosInstance()) == null ? void 0 : s.post("/unity/org/human/changeuserowncryptogram", {
|
|
353
|
+
cryptogram: r,
|
|
347
354
|
cryptogramOld: e
|
|
348
355
|
});
|
|
349
356
|
}
|
|
350
357
|
export {
|
|
351
|
-
|
|
358
|
+
l as adminAxios,
|
|
352
359
|
it as changeUserCryptogram,
|
|
353
360
|
st as countUnitHuman,
|
|
354
|
-
|
|
361
|
+
Q as getPublicKey,
|
|
355
362
|
ot as getUnitTree,
|
|
356
|
-
|
|
363
|
+
et as getUsercenterData,
|
|
364
|
+
rt as gethumanlist,
|
|
365
|
+
nt as postUsercenterData
|
|
357
366
|
};
|
package/package.json
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "egova-admin-jssdk",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"private": false,
|
|
5
|
-
"scripts": {
|
|
6
|
-
"build": "run-p type-check build-lib build-type",
|
|
7
|
-
"build-lib": "vite build",
|
|
8
|
-
"build-type": "vue-tsc --declaration --emitDeclarationOnly",
|
|
9
|
-
"type-check": "vue-tsc --build"
|
|
10
|
-
},
|
|
11
|
-
"peerDependencies": {
|
|
12
|
-
"axios": ">=0.29.0",
|
|
13
|
-
"crypto-js": ">=4.1.1",
|
|
14
|
-
"lodash-es": ">=4.17.21",
|
|
15
|
-
"qs": ">=6.13.1",
|
|
16
|
-
"sm-crypto": ">=0.3.12"
|
|
17
|
-
},
|
|
18
|
-
"dependencies": {
|
|
19
|
-
"axios": "^1.7.9",
|
|
20
|
-
"crypto-js": "^4.2.0",
|
|
21
|
-
"lodash-es": "^4.17.21",
|
|
22
|
-
"qs": "^6.13.1",
|
|
23
|
-
"sm-crypto": "^0.3.13",
|
|
24
|
-
"vue": "^3.5.13"
|
|
25
|
-
},
|
|
26
|
-
"devDependencies": {
|
|
27
|
-
"@tsconfig/node22": "^22.0.0",
|
|
28
|
-
"@types/crypto-js": "^4.2.2",
|
|
29
|
-
"@types/lodash-es": "^4.17.12",
|
|
30
|
-
"@types/node": "^22.10.2",
|
|
31
|
-
"@types/qs": "^6.9.17",
|
|
32
|
-
"@types/sm-crypto": "^0.3.4",
|
|
33
|
-
"@vitejs/plugin-vue": "^5.2.1",
|
|
34
|
-
"@vue/eslint-config-prettier": "^10.1.0",
|
|
35
|
-
"@vue/eslint-config-typescript": "^14.1.3",
|
|
36
|
-
"@vue/tsconfig": "^0.7.0",
|
|
37
|
-
"eslint": "^9.14.0",
|
|
38
|
-
"eslint-plugin-vue": "^9.30.0",
|
|
39
|
-
"npm-run-all2": "^7.0.2",
|
|
40
|
-
"prettier": "^3.3.3",
|
|
41
|
-
"typescript": "~5.6.3",
|
|
42
|
-
"vite": "^6.0.5",
|
|
43
|
-
"vite-plugin-vue-devtools": "^7.6.8",
|
|
44
|
-
"vue-tsc": "^2.1.10"
|
|
45
|
-
},
|
|
46
|
-
"files": [
|
|
47
|
-
"lib",
|
|
48
|
-
"dist"
|
|
49
|
-
],
|
|
50
|
-
"main": "lib/egova-admin-jssdk.mjs",
|
|
51
|
-
"types": "dist/index.d.ts",
|
|
52
|
-
"publishConfig": {
|
|
53
|
-
"access": "public"
|
|
54
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "egova-admin-jssdk",
|
|
3
|
+
"version": "0.0.11",
|
|
4
|
+
"private": false,
|
|
5
|
+
"scripts": {
|
|
6
|
+
"build": "run-p type-check build-lib build-type",
|
|
7
|
+
"build-lib": "vite build",
|
|
8
|
+
"build-type": "vue-tsc --declaration --emitDeclarationOnly",
|
|
9
|
+
"type-check": "vue-tsc --build"
|
|
10
|
+
},
|
|
11
|
+
"peerDependencies": {
|
|
12
|
+
"axios": ">=0.29.0",
|
|
13
|
+
"crypto-js": ">=4.1.1",
|
|
14
|
+
"lodash-es": ">=4.17.21",
|
|
15
|
+
"qs": ">=6.13.1",
|
|
16
|
+
"sm-crypto": ">=0.3.12"
|
|
17
|
+
},
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"axios": "^1.7.9",
|
|
20
|
+
"crypto-js": "^4.2.0",
|
|
21
|
+
"lodash-es": "^4.17.21",
|
|
22
|
+
"qs": "^6.13.1",
|
|
23
|
+
"sm-crypto": "^0.3.13",
|
|
24
|
+
"vue": "^3.5.13"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@tsconfig/node22": "^22.0.0",
|
|
28
|
+
"@types/crypto-js": "^4.2.2",
|
|
29
|
+
"@types/lodash-es": "^4.17.12",
|
|
30
|
+
"@types/node": "^22.10.2",
|
|
31
|
+
"@types/qs": "^6.9.17",
|
|
32
|
+
"@types/sm-crypto": "^0.3.4",
|
|
33
|
+
"@vitejs/plugin-vue": "^5.2.1",
|
|
34
|
+
"@vue/eslint-config-prettier": "^10.1.0",
|
|
35
|
+
"@vue/eslint-config-typescript": "^14.1.3",
|
|
36
|
+
"@vue/tsconfig": "^0.7.0",
|
|
37
|
+
"eslint": "^9.14.0",
|
|
38
|
+
"eslint-plugin-vue": "^9.30.0",
|
|
39
|
+
"npm-run-all2": "^7.0.2",
|
|
40
|
+
"prettier": "^3.3.3",
|
|
41
|
+
"typescript": "~5.6.3",
|
|
42
|
+
"vite": "^6.0.5",
|
|
43
|
+
"vite-plugin-vue-devtools": "^7.6.8",
|
|
44
|
+
"vue-tsc": "^2.1.10"
|
|
45
|
+
},
|
|
46
|
+
"files": [
|
|
47
|
+
"lib",
|
|
48
|
+
"dist"
|
|
49
|
+
],
|
|
50
|
+
"main": "lib/egova-admin-jssdk.mjs",
|
|
51
|
+
"types": "dist/index.d.ts",
|
|
52
|
+
"publishConfig": {
|
|
53
|
+
"access": "public"
|
|
54
|
+
}
|
|
55
55
|
}
|