@deepinnet-components/pc 0.0.25 → 0.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/UserCenter/AccountPage/components/CreateAccount/index.js +35 -31
- package/dist/UserCenter/AccountPage/index.js +20 -1
- package/dist/UserCenter/ConfigProvider/index.d.ts +1 -0
- package/dist/UserCenter/ConfigProvider/index.js +3 -0
- package/dist/UserCenter/utils.d.ts +4 -0
- package/dist/UserCenter/utils.js +22 -0
- package/package.json +2 -1
|
@@ -18,12 +18,12 @@ import { createForm, onFieldValueChange } from '@formily/core';
|
|
|
18
18
|
import { createSchemaField } from '@formily/react';
|
|
19
19
|
import { Button, Spin, message } from 'antd';
|
|
20
20
|
import React, { useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
21
|
-
import
|
|
21
|
+
import MemberSelect from "../../../MemberSelect";
|
|
22
22
|
import OrgSelect from "../../../OrgSelect";
|
|
23
|
+
import OrgTreeSelect from "../../../OrgTreeSelect";
|
|
23
24
|
import RoleSelect from "../../../RoleSelect";
|
|
24
|
-
import MemberSelect from "../../../MemberSelect";
|
|
25
25
|
import ValueContext from "../../../context";
|
|
26
|
-
import { hashWithCryptoJS } from "../../../utils";
|
|
26
|
+
import { hashWithCryptoJS, sm4Encrypt } from "../../../utils";
|
|
27
27
|
var SchemaField = createSchemaField({
|
|
28
28
|
components: {
|
|
29
29
|
FormItem: FormItem,
|
|
@@ -109,16 +109,14 @@ var schema = {
|
|
|
109
109
|
'x-validator': [{
|
|
110
110
|
required: true,
|
|
111
111
|
message: '请输入密码'
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
// },
|
|
121
|
-
],
|
|
112
|
+
}, {
|
|
113
|
+
validator: function validator(val) {
|
|
114
|
+
var regex = /^(?=(?:.*[a-z]))(?=(?:.*[A-Z]))(?=(?:.*\d)).{8,}$|^(?=(?:.*[a-z]))(?=(?:.*[A-Z]))(?=(?:.*[^A-Za-z0-9])).{8,}$|^(?=(?:.*[a-z]))(?=(?:.*\d))(?=(?:.*[^A-Za-z0-9])).{8,}$|^(?=(?:.*[A-Z]))(?=(?:.*\d))(?=(?:.*[^A-Za-z0-9])).{8,}$/;
|
|
115
|
+
if (val && !regex.test(val)) {
|
|
116
|
+
return '密码需至少包含大、小写字母、数字以及特殊符号3种,且不少于8位';
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}],
|
|
122
120
|
'x-reactions': [{
|
|
123
121
|
when: '{{addOrEdit === "add"}}',
|
|
124
122
|
fulfill: {
|
|
@@ -165,7 +163,8 @@ var CreateAccount = function CreateAccount(props) {
|
|
|
165
163
|
Components = contextValue.Components,
|
|
166
164
|
userType = contextValue.userType,
|
|
167
165
|
isMultiRole = contextValue.isMultiRole,
|
|
168
|
-
passwordEncryption = contextValue.passwordEncryption
|
|
166
|
+
passwordEncryption = contextValue.passwordEncryption,
|
|
167
|
+
passwordEncryptionNeedSalt = contextValue.passwordEncryptionNeedSalt;
|
|
169
168
|
var getAccountDetail = /*#__PURE__*/function () {
|
|
170
169
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
171
170
|
var params, _yield$ApiService$get, data, _data$departmentFlatD, _data$userMemberBindD;
|
|
@@ -253,7 +252,7 @@ var CreateAccount = function CreateAccount(props) {
|
|
|
253
252
|
var canSubmit = useRef(true);
|
|
254
253
|
var handleSubmit = /*#__PURE__*/function () {
|
|
255
254
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
256
|
-
var values, params, _yield$ApiService$sav, success, _params, _yield$ApiService$sav2, _success;
|
|
255
|
+
var values, params, _sm4Encrypt, key, encryptedData, _yield$ApiService$sav, success, _params, _yield$ApiService$sav2, _success;
|
|
257
256
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
258
257
|
while (1) switch (_context2.prev = _context2.next) {
|
|
259
258
|
case 0:
|
|
@@ -268,7 +267,7 @@ var CreateAccount = function CreateAccount(props) {
|
|
|
268
267
|
case 4:
|
|
269
268
|
values = _context2.sent;
|
|
270
269
|
if (!(addOrEdit === 'add')) {
|
|
271
|
-
_context2.next =
|
|
270
|
+
_context2.next = 19;
|
|
272
271
|
break;
|
|
273
272
|
}
|
|
274
273
|
_context2.prev = 6;
|
|
@@ -281,10 +280,15 @@ var CreateAccount = function CreateAccount(props) {
|
|
|
281
280
|
userType: userType,
|
|
282
281
|
bindMemberId: values.bindMemberId
|
|
283
282
|
};
|
|
283
|
+
if (passwordEncryptionNeedSalt) {
|
|
284
|
+
_sm4Encrypt = sm4Encrypt(params.password), key = _sm4Encrypt.key, encryptedData = _sm4Encrypt.encryptedData;
|
|
285
|
+
params.password = encryptedData;
|
|
286
|
+
params.key = key;
|
|
287
|
+
}
|
|
284
288
|
setLoading(true);
|
|
285
|
-
_context2.next =
|
|
289
|
+
_context2.next = 12;
|
|
286
290
|
return ApiService.saveAccount(params);
|
|
287
|
-
case
|
|
291
|
+
case 12:
|
|
288
292
|
_yield$ApiService$sav = _context2.sent;
|
|
289
293
|
success = _yield$ApiService$sav.success;
|
|
290
294
|
if (success) {
|
|
@@ -292,17 +296,17 @@ var CreateAccount = function CreateAccount(props) {
|
|
|
292
296
|
onClose === null || onClose === void 0 || onClose();
|
|
293
297
|
onSuccess === null || onSuccess === void 0 || onSuccess();
|
|
294
298
|
}
|
|
295
|
-
case
|
|
296
|
-
_context2.prev =
|
|
299
|
+
case 15:
|
|
300
|
+
_context2.prev = 15;
|
|
297
301
|
setLoading(false);
|
|
298
302
|
canSubmit.current = true;
|
|
299
|
-
return _context2.finish(
|
|
300
|
-
case
|
|
303
|
+
return _context2.finish(15);
|
|
304
|
+
case 19:
|
|
301
305
|
if (!(addOrEdit === 'edit')) {
|
|
302
|
-
_context2.next =
|
|
306
|
+
_context2.next = 32;
|
|
303
307
|
break;
|
|
304
308
|
}
|
|
305
|
-
_context2.prev =
|
|
309
|
+
_context2.prev = 20;
|
|
306
310
|
_params = {
|
|
307
311
|
accountNo: actionRow.accountNo,
|
|
308
312
|
roleCodeList: Array.isArray(values.roleCodeList) ? values.roleCodeList : [values.roleCodeList],
|
|
@@ -312,9 +316,9 @@ var CreateAccount = function CreateAccount(props) {
|
|
|
312
316
|
bindMemberId: values.bindMemberId
|
|
313
317
|
};
|
|
314
318
|
setLoading(true);
|
|
315
|
-
_context2.next =
|
|
319
|
+
_context2.next = 25;
|
|
316
320
|
return ApiService.saveAccount(_params);
|
|
317
|
-
case
|
|
321
|
+
case 25:
|
|
318
322
|
_yield$ApiService$sav2 = _context2.sent;
|
|
319
323
|
_success = _yield$ApiService$sav2.success;
|
|
320
324
|
if (_success) {
|
|
@@ -322,16 +326,16 @@ var CreateAccount = function CreateAccount(props) {
|
|
|
322
326
|
onClose === null || onClose === void 0 || onClose();
|
|
323
327
|
onSuccess === null || onSuccess === void 0 || onSuccess();
|
|
324
328
|
}
|
|
325
|
-
case
|
|
326
|
-
_context2.prev =
|
|
329
|
+
case 28:
|
|
330
|
+
_context2.prev = 28;
|
|
327
331
|
setLoading(false);
|
|
328
332
|
canSubmit.current = true;
|
|
329
|
-
return _context2.finish(
|
|
330
|
-
case
|
|
333
|
+
return _context2.finish(28);
|
|
334
|
+
case 32:
|
|
331
335
|
case "end":
|
|
332
336
|
return _context2.stop();
|
|
333
337
|
}
|
|
334
|
-
}, _callee2, null, [[6,,
|
|
338
|
+
}, _callee2, null, [[6,, 15, 19], [20,, 28, 32]]);
|
|
335
339
|
}));
|
|
336
340
|
return function handleSubmit() {
|
|
337
341
|
return _ref2.apply(this, arguments);
|
|
@@ -17,7 +17,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
17
17
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
18
18
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
19
19
|
import { ShenduTable } from "../..";
|
|
20
|
-
import { Button, message } from 'antd';
|
|
20
|
+
import { Button, message, Tooltip } from 'antd';
|
|
21
21
|
import dayjs from 'dayjs';
|
|
22
22
|
import React, { useContext, useRef, useState } from 'react';
|
|
23
23
|
import CreateAccount from "./components/CreateAccount";
|
|
@@ -109,6 +109,25 @@ var AccountList = function AccountList() {
|
|
|
109
109
|
}, item.name), !isLast && /*#__PURE__*/React.createElement("div", null, "/"));
|
|
110
110
|
}));
|
|
111
111
|
}
|
|
112
|
+
}, {
|
|
113
|
+
title: '角色',
|
|
114
|
+
dataIndex: 'roles',
|
|
115
|
+
width: 150,
|
|
116
|
+
render: function render(_) {
|
|
117
|
+
var arr = _ === null || _ === void 0 ? void 0 : _[0];
|
|
118
|
+
if (!(_ !== null && _ !== void 0 && _.length)) return '-';
|
|
119
|
+
var text = '';
|
|
120
|
+
_.forEach(function (item, index) {
|
|
121
|
+
text += item.roleName;
|
|
122
|
+
if (index !== _.length - 1) text += '/';
|
|
123
|
+
});
|
|
124
|
+
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
125
|
+
placement: "top",
|
|
126
|
+
title: text
|
|
127
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
128
|
+
className: "truncate"
|
|
129
|
+
}, text));
|
|
130
|
+
}
|
|
112
131
|
}, {
|
|
113
132
|
title: '创建人',
|
|
114
133
|
dataIndex: 'creatorName',
|
|
@@ -60,6 +60,8 @@ var Index = function Index(props) {
|
|
|
60
60
|
isMultiRole = _props$isMultiRole === void 0 ? true : _props$isMultiRole,
|
|
61
61
|
_props$passwordEncryp = props.passwordEncryption,
|
|
62
62
|
passwordEncryption = _props$passwordEncryp === void 0 ? 'md5' : _props$passwordEncryp,
|
|
63
|
+
_props$passwordEncryp2 = props.passwordEncryptionNeedSalt,
|
|
64
|
+
passwordEncryptionNeedSalt = _props$passwordEncryp2 === void 0 ? false : _props$passwordEncryp2,
|
|
63
65
|
_props$hideDeleteAcco = props.hideDeleteAccountBtn,
|
|
64
66
|
hideDeleteAccountBtn = _props$hideDeleteAcco === void 0 ? false : _props$hideDeleteAcco,
|
|
65
67
|
_props$hideMemberType = props.hideMemberType,
|
|
@@ -212,6 +214,7 @@ var Index = function Index(props) {
|
|
|
212
214
|
showDataAuth: showDataAuth,
|
|
213
215
|
isMultiRole: isMultiRole,
|
|
214
216
|
passwordEncryption: passwordEncryption,
|
|
217
|
+
passwordEncryptionNeedSalt: passwordEncryptionNeedSalt,
|
|
215
218
|
hideDeleteAccountBtn: hideDeleteAccountBtn,
|
|
216
219
|
hideMemberType: hideMemberType,
|
|
217
220
|
showMemberPilot: showMemberPilot
|
package/dist/UserCenter/utils.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import CryptoJS from 'crypto-js';
|
|
2
|
+
import { SM4 } from 'gm-crypto';
|
|
2
3
|
|
|
3
4
|
// 获取url参数
|
|
4
5
|
export function getUrlQuery() {
|
|
@@ -29,4 +30,25 @@ export function hashWithCryptoJS(message) {
|
|
|
29
30
|
default:
|
|
30
31
|
throw new Error("Unsupported algorithm: ".concat(algorithm));
|
|
31
32
|
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// 生成32位的16进制数
|
|
36
|
+
function generate32HexDigits() {
|
|
37
|
+
var result = '';
|
|
38
|
+
for (var i = 0; i < 32; i++) {
|
|
39
|
+
result += Math.floor(Math.random() * 16).toString(16);
|
|
40
|
+
}
|
|
41
|
+
return result;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// SM4 国标对称加密
|
|
45
|
+
export function sm4Encrypt(data) {
|
|
46
|
+
var key = generate32HexDigits();
|
|
47
|
+
return {
|
|
48
|
+
key: key,
|
|
49
|
+
encryptedData: SM4.encrypt(data, key, {
|
|
50
|
+
inputEncoding: 'utf8',
|
|
51
|
+
outputEncoding: 'base64'
|
|
52
|
+
})
|
|
53
|
+
};
|
|
32
54
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepinnet-components/pc",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.27",
|
|
4
4
|
"description": "A react library developed with dumi",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
"axios": "^1.5.1",
|
|
57
57
|
"crypto-js": "^4.2.0",
|
|
58
58
|
"dayjs": "^1.11.13",
|
|
59
|
+
"gm-crypto": "^0.1.12",
|
|
59
60
|
"lodash-es": "^4.17.21",
|
|
60
61
|
"md5": "^2.3.0",
|
|
61
62
|
"react-router-dom": "^7.6.2",
|