@titaui/pc 1.7.101 → 1.8.3
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/lib/components/dialog/index.css +7 -1
- package/lib/components/dialog/index.js +7 -6
- package/lib/components/form/form-fields/input/index.css +22 -7
- package/lib/components/form/form-fields/input/index.js +11 -8
- package/lib/components/form/form-fields/input-verification-code/index.css +117 -0
- package/lib/components/form/form-fields/input-verification-code/index.js +230 -0
- package/lib/components/form/form-fields/password/index.css +2 -2
- package/lib/components/form/form-fields/radios/index.js +1 -1
- package/lib/components/form/index.js +4 -1
- package/lib/components/nav-top/components/user-message/components/empty/index.js +4 -2
- package/lib/components/nav-top/components/user-message/msg/index.js +1 -1
- package/lib/components/table/index.css +4 -0
- package/lib/components/table/index.js +3 -0
- package/lib/components/upload/index.js +2 -2
- package/lib/components/upload-photo-modal/constant.js +29 -0
- package/lib/components/upload-photo-modal/img/browser-preview-bgc.png +0 -0
- package/lib/components/upload-photo-modal/index.css +288 -0
- package/lib/components/upload-photo-modal/index.js +439 -0
- package/lib/components/upload-photo-modal/request-api.js +62 -0
- package/lib/components/user-selector/request-apis.js +1 -1
- package/lib/index.js +8 -0
- package/lib/pages/personal-info/components/base-info/index.css +36 -1
- package/lib/pages/personal-info/components/base-info/index.js +22 -90
- package/lib/pages/personal-info/components/edit-info/index.css +19 -0
- package/lib/pages/personal-info/components/edit-info/index.js +209 -0
- package/lib/pages/personal-info/components/edit-info/input/index.css +89 -0
- package/lib/pages/personal-info/components/edit-info/input/index.js +199 -0
- package/lib/pages/personal-info/components/person-photo/index.css +88 -0
- package/lib/pages/personal-info/components/person-photo/index.js +86 -0
- package/lib/pages/personal-info/index.js +3 -1
- package/package.json +3 -1
- package/src/components/dialog/index.js +2 -1
- package/src/components/dialog/index.scss +6 -1
- package/src/components/form/form-fields/input/index.scss +19 -7
- package/src/components/form/form-fields/input/index.tsx +9 -4
- package/src/components/form/form-fields/input-verification-code/index.scss +108 -0
- package/src/components/form/form-fields/input-verification-code/index.tsx +171 -0
- package/src/components/form/form-fields/password/index.scss +2 -2
- package/src/components/form/form-fields/radios/index.tsx +2 -2
- package/src/components/form/index.tsx +2 -0
- package/src/components/nav-top/components/user-message/components/empty/index.tsx +3 -2
- package/src/components/nav-top/components/user-message/msg/index.tsx +1 -1
- package/src/components/table/index.js +1 -0
- package/src/components/table/index.scss +5 -0
- package/src/components/upload/index.tsx +4 -4
- package/src/components/upload-photo-modal/constant.ts +27 -0
- package/src/components/upload-photo-modal/img/browser-preview-bgc.png +0 -0
- package/src/components/upload-photo-modal/index.scss +258 -0
- package/src/components/upload-photo-modal/index.tsx +331 -0
- package/src/components/upload-photo-modal/request-api.ts +33 -0
- package/src/components/user-selector/request-apis.js +1 -1
- package/src/index.js +1 -0
- package/src/pages/personal-info/components/base-info/index.scss +30 -1
- package/src/pages/personal-info/components/base-info/index.tsx +26 -97
- package/src/pages/personal-info/components/edit-info/index.scss +20 -0
- package/src/pages/personal-info/components/edit-info/index.tsx +166 -0
- package/src/pages/personal-info/components/edit-info/input/index.scss +82 -0
- package/src/pages/personal-info/components/edit-info/input/index.tsx +145 -0
- package/src/pages/personal-info/components/person-photo/index.scss +80 -0
- package/src/pages/personal-info/components/person-photo/index.tsx +49 -0
- package/src/pages/personal-info/index.tsx +2 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
@charset "UTF-8";
|
|
2
|
+
|
|
3
|
+
.titaui-personal-info-person-photo {
|
|
4
|
+
background: #ffffff;
|
|
5
|
+
box-shadow: 0px 0px 8px 0px rgba(127, 145, 180, 0.1);
|
|
6
|
+
border-radius: 12px;
|
|
7
|
+
padding: 20px 32px;
|
|
8
|
+
margin-top: 10px;
|
|
9
|
+
font-family: -apple-system, Arial, Verdana, Helvetica Neue, Helvetica, sans-serif, PingFang SC, Microsoft YaHei;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.titaui-personal-info-person-photo__header {
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
justify-content: space-between;
|
|
16
|
+
margin-bottom: 12px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.titaui-personal-info-person-photo__header-title {
|
|
20
|
+
font-size: 16px;
|
|
21
|
+
font-weight: 600;
|
|
22
|
+
color: #141c28;
|
|
23
|
+
line-height: 24px;
|
|
24
|
+
position: relative;
|
|
25
|
+
display: inline-flex;
|
|
26
|
+
align-items: center;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.titaui-personal-info-person-photo__header-title::before {
|
|
30
|
+
content: "";
|
|
31
|
+
width: 4px;
|
|
32
|
+
height: 16px;
|
|
33
|
+
background: linear-gradient(90deg, #4e90ff 0%, #2879ff 100%);
|
|
34
|
+
border-radius: 2px;
|
|
35
|
+
display: inline-block;
|
|
36
|
+
position: absolute;
|
|
37
|
+
left: -8px;
|
|
38
|
+
top: 3px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.titaui-personal-info-person-photo__main {
|
|
42
|
+
display: flex;
|
|
43
|
+
align-items: center;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.titaui-personal-info-person-photo__main-mask {
|
|
47
|
+
position: absolute;
|
|
48
|
+
width: 160px;
|
|
49
|
+
height: 32px;
|
|
50
|
+
box-sizing: border-box;
|
|
51
|
+
padding: 7px 52px;
|
|
52
|
+
background: rgba(20, 28, 40, 0.5);
|
|
53
|
+
font-size: 12px;
|
|
54
|
+
color: #FFFFFF;
|
|
55
|
+
line-height: 18px;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.titaui-personal-info-person-photo__main > span {
|
|
59
|
+
margin-left: 24px;
|
|
60
|
+
font-size: 12px;
|
|
61
|
+
color: #A4ACB9;
|
|
62
|
+
line-height: 20px;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.titaui-personal-info-person-photo .titaui-pc-avator-container {
|
|
66
|
+
cursor: pointer;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.titaui-personal-info-person-photo .titaui-pc-avator-wrapper::before {
|
|
70
|
+
position: absolute;
|
|
71
|
+
bottom: 0;
|
|
72
|
+
display: block;
|
|
73
|
+
content: "点击修改";
|
|
74
|
+
width: 160px;
|
|
75
|
+
height: 32px;
|
|
76
|
+
background: rgba(20, 28, 40, 0.5);
|
|
77
|
+
color: #FFFFFF;
|
|
78
|
+
font-size: 12px;
|
|
79
|
+
line-height: 18px;
|
|
80
|
+
text-align: center;
|
|
81
|
+
box-sizing: border-box;
|
|
82
|
+
padding: 7px 0;
|
|
83
|
+
backdrop-filter: blur(4px);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.titaui-personal-info-person-photo .titaui-pc-avator-wrapper:hover::before {
|
|
87
|
+
background: rgba(20, 28, 40, 0.4);
|
|
88
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
var _bsGlobal = require("../../../../utils/bs-global");
|
|
13
|
+
|
|
14
|
+
var _avatar = _interopRequireDefault(require("../../../../components/avatar"));
|
|
15
|
+
|
|
16
|
+
var _uploadPhotoModal = _interopRequireDefault(require("../../../../components/upload-photo-modal"));
|
|
17
|
+
|
|
18
|
+
require("./index.css");
|
|
19
|
+
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
21
|
+
|
|
22
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
|
+
|
|
24
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
|
+
|
|
26
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
27
|
+
|
|
28
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
29
|
+
|
|
30
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
31
|
+
|
|
32
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
33
|
+
|
|
34
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
35
|
+
|
|
36
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
37
|
+
|
|
38
|
+
var prefix = 'titaui-personal-info-person-photo';
|
|
39
|
+
|
|
40
|
+
var _getUserInfo = (0, _bsGlobal.getUserInfo)(),
|
|
41
|
+
Id = _getUserInfo.Id,
|
|
42
|
+
Name = _getUserInfo.Name,
|
|
43
|
+
UserAvatar = _getUserInfo.UserAvatar;
|
|
44
|
+
|
|
45
|
+
var PersonPhoto = function PersonPhoto() {
|
|
46
|
+
var _useState = (0, _react.useState)(false),
|
|
47
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
48
|
+
visible = _useState2[0],
|
|
49
|
+
setVisible = _useState2[1];
|
|
50
|
+
|
|
51
|
+
var handleChangePhoto = function handleChangePhoto() {
|
|
52
|
+
setVisible(true);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
var handleCancel = function handleCancel() {
|
|
56
|
+
setVisible(false);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
60
|
+
className: prefix
|
|
61
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
62
|
+
className: "".concat(prefix, "__header")
|
|
63
|
+
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
64
|
+
className: "".concat(prefix, "__header-title")
|
|
65
|
+
}, "\u4E0A\u4F20\u5934\u50CF")), /*#__PURE__*/_react["default"].createElement("div", {
|
|
66
|
+
className: "".concat(prefix, "__main")
|
|
67
|
+
}, /*#__PURE__*/_react["default"].createElement(_avatar["default"], {
|
|
68
|
+
userId: Id,
|
|
69
|
+
name: Name,
|
|
70
|
+
color: UserAvatar.Color,
|
|
71
|
+
src: UserAvatar.Large,
|
|
72
|
+
size: {
|
|
73
|
+
width: 160,
|
|
74
|
+
textNum: 1,
|
|
75
|
+
fontSize: 24
|
|
76
|
+
},
|
|
77
|
+
onClick: handleChangePhoto
|
|
78
|
+
}), /*#__PURE__*/_react["default"].createElement("span", null, "\xB7 \u5EFA\u8BAE\u56FE\u7247\u6700\u5C0F\u5C3A\u5BF8 150*150px")), /*#__PURE__*/_react["default"].createElement(_uploadPhotoModal["default"], {
|
|
79
|
+
visible: visible,
|
|
80
|
+
onCancel: handleCancel,
|
|
81
|
+
type: "person"
|
|
82
|
+
}));
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
var _default = PersonPhoto;
|
|
86
|
+
exports["default"] = _default;
|
|
@@ -9,6 +9,8 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
9
9
|
|
|
10
10
|
var _baseInfo = _interopRequireDefault(require("./components/base-info"));
|
|
11
11
|
|
|
12
|
+
var _personPhoto = _interopRequireDefault(require("./components/person-photo"));
|
|
13
|
+
|
|
12
14
|
var _aha = _interopRequireDefault(require("../aha2021"));
|
|
13
15
|
|
|
14
16
|
require("./index.css");
|
|
@@ -20,7 +22,7 @@ var prefix = "titaui-personal-info";
|
|
|
20
22
|
var PersonalInfo = function PersonalInfo() {
|
|
21
23
|
return /*#__PURE__*/_react["default"].createElement(_aha["default"].ContentTemplate, null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
22
24
|
className: prefix
|
|
23
|
-
}, /*#__PURE__*/_react["default"].createElement(_baseInfo["default"], null)));
|
|
25
|
+
}, /*#__PURE__*/_react["default"].createElement(_baseInfo["default"], null), /*#__PURE__*/_react["default"].createElement(_personPhoto["default"], null)));
|
|
24
26
|
};
|
|
25
27
|
|
|
26
28
|
var _default = PersonalInfo;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@titaui/pc",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.3",
|
|
4
4
|
"nameCN": "",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -81,6 +81,7 @@
|
|
|
81
81
|
"rc-cascader": "^2.2.0",
|
|
82
82
|
"rc-checkbox": "^2.3.2",
|
|
83
83
|
"rc-color-picker": "^1.2.6",
|
|
84
|
+
"rc-cropper": "^1.3.1",
|
|
84
85
|
"rc-dialog": "8.5.2",
|
|
85
86
|
"rc-drawer": "^4.3.1",
|
|
86
87
|
"rc-input-number": "^5.0.0",
|
|
@@ -97,6 +98,7 @@
|
|
|
97
98
|
"rc-util": "^5.13.1",
|
|
98
99
|
"react-collapse": "^5.1.0",
|
|
99
100
|
"react-content-loader": "^6.0.3",
|
|
101
|
+
"react-cropper": "^2.1.8",
|
|
100
102
|
"react-custom-scrollbars": "^4.2.1",
|
|
101
103
|
"react-grid-layout": "^1.2.5",
|
|
102
104
|
"react-sizeme": "^3.0.1",
|
|
@@ -22,6 +22,7 @@ export default props => {
|
|
|
22
22
|
visible,
|
|
23
23
|
extraClass=[],
|
|
24
24
|
extendFooterBtn,
|
|
25
|
+
disabled,
|
|
25
26
|
...restProps
|
|
26
27
|
} = props;
|
|
27
28
|
|
|
@@ -30,7 +31,7 @@ export default props => {
|
|
|
30
31
|
<span key="cancel" className={classNames(`${preCls}__btn`, `${preCls}__btn-cancel`)} onClick={onCancel}>
|
|
31
32
|
<span className={classNames(`${preCls}__btn-cancel-text`)}>{cancelText}</span>
|
|
32
33
|
</span>,
|
|
33
|
-
<span key="ok" className={classNames(`${preCls}__btn`, `${preCls}__btn-ok`)} onClick={onOk}>
|
|
34
|
+
<span key="ok" className={classNames(`${preCls}__btn`, `${preCls}__btn-ok`, {[`${preCls}__btn-ok-not-allowed`]:disabled})} onClick={onOk}>
|
|
34
35
|
<span className={classNames(`${preCls}__btn-ok-text`)}>{okText}</span>
|
|
35
36
|
</span>
|
|
36
37
|
];
|
|
@@ -48,6 +48,7 @@ $font-family: -apple-system, Arial, Verdana, Helvetica Neue, Helvetica, sans-ser
|
|
|
48
48
|
|
|
49
49
|
.rc-dialog-header {
|
|
50
50
|
padding: 18px 32px;
|
|
51
|
+
margin-bottom: 10px;
|
|
51
52
|
}
|
|
52
53
|
.rc-dialog-body {
|
|
53
54
|
// padding: 0 32px 0 32px;
|
|
@@ -55,6 +56,7 @@ $font-family: -apple-system, Arial, Verdana, Helvetica Neue, Helvetica, sans-ser
|
|
|
55
56
|
}
|
|
56
57
|
.rc-dialog-footer {
|
|
57
58
|
padding: 20px 32px;
|
|
59
|
+
margin-top: 8px;
|
|
58
60
|
display: flex;
|
|
59
61
|
justify-content: flex-end;
|
|
60
62
|
}
|
|
@@ -92,10 +94,13 @@ $font-family: -apple-system, Arial, Verdana, Helvetica Neue, Helvetica, sans-ser
|
|
|
92
94
|
background: #5c8eff;
|
|
93
95
|
color: #ffffff;
|
|
94
96
|
}
|
|
97
|
+
&-not-allowed {
|
|
98
|
+
cursor: not-allowed;
|
|
99
|
+
}
|
|
95
100
|
}
|
|
96
101
|
|
|
97
102
|
&__btn-cancel {
|
|
98
|
-
border: 1px solid #
|
|
103
|
+
border: 1px solid #DFE3EA;
|
|
99
104
|
color: #6f7886;
|
|
100
105
|
transition: 0.2s all;
|
|
101
106
|
&:hover {
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
.form-field-input {
|
|
2
|
+
&-row{
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
.form-field-input__label{
|
|
6
|
+
margin-bottom: unset;
|
|
7
|
+
}
|
|
8
|
+
.form-field-input__border{
|
|
9
|
+
margin-left: 16px;
|
|
10
|
+
flex: 1;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
2
13
|
&__label {
|
|
3
14
|
height: 22px;
|
|
4
15
|
font-size: 14px;
|
|
@@ -12,15 +23,16 @@
|
|
|
12
23
|
}
|
|
13
24
|
|
|
14
25
|
&-require {
|
|
15
|
-
color:
|
|
26
|
+
color: #F05E5E;
|
|
27
|
+
margin-left: 2px;
|
|
16
28
|
}
|
|
17
29
|
}
|
|
18
30
|
|
|
19
31
|
&__border {
|
|
20
32
|
padding: 6px 12px;
|
|
21
|
-
border-radius:
|
|
33
|
+
border-radius: 8px;
|
|
22
34
|
transition: all 0.2s;
|
|
23
|
-
border: 1px solid #
|
|
35
|
+
border: 1px solid #DFE3EA;
|
|
24
36
|
box-sizing: border-box;
|
|
25
37
|
|
|
26
38
|
&--disabled {
|
|
@@ -34,12 +46,12 @@
|
|
|
34
46
|
}
|
|
35
47
|
}
|
|
36
48
|
&__border--error {
|
|
37
|
-
box-shadow: inset 0px 0px 4px 0px rgba(240, 94, 94, 0.3)
|
|
38
|
-
border: 1px solid #f05e5e
|
|
49
|
+
box-shadow: inset 0px 0px 4px 0px rgba(240, 94, 94, 0.3) ;
|
|
50
|
+
border: 1px solid #f05e5e ;
|
|
39
51
|
}
|
|
40
52
|
&__border--active {
|
|
41
|
-
box-shadow: inset 0px 0px 4px 0px rgba(40, 121, 255, 0.3);
|
|
42
|
-
border: 1px solid #2879ff;
|
|
53
|
+
box-shadow: inset 0px 0px 4px 0px rgba(40, 121, 255, 0.3) !important;
|
|
54
|
+
border: 1px solid #2879ff !important;
|
|
43
55
|
}
|
|
44
56
|
|
|
45
57
|
&__input {
|
|
@@ -19,7 +19,9 @@ interface Props {
|
|
|
19
19
|
type?: string;
|
|
20
20
|
name: string;
|
|
21
21
|
getContainer?: Function;
|
|
22
|
-
disabled?: boolean
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
layout?: 'clomn'|'row';
|
|
24
|
+
className?:string;
|
|
23
25
|
}
|
|
24
26
|
interface Error {
|
|
25
27
|
name: string;
|
|
@@ -27,8 +29,9 @@ interface Error {
|
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
const OverlayInner = ({ hasError, hasActive, tip }) => {
|
|
30
|
-
if (hasError) return <span style={{ 'color': '#F05E5E' }}>{tip}</span>;
|
|
31
32
|
if (hasActive) return <span style={{ 'color': '#3F4755' }}>{tip}</span>;
|
|
33
|
+
if (hasError) return <span style={{ 'color': '#F05E5E' }}>{tip}</span>;
|
|
34
|
+
|
|
32
35
|
return <span />;
|
|
33
36
|
}
|
|
34
37
|
|
|
@@ -42,7 +45,9 @@ export default forwardRef((props: Props, ref) => {
|
|
|
42
45
|
type,
|
|
43
46
|
name,
|
|
44
47
|
disabled,
|
|
45
|
-
getContainer
|
|
48
|
+
getContainer,
|
|
49
|
+
layout,
|
|
50
|
+
className="",
|
|
46
51
|
} = props;
|
|
47
52
|
|
|
48
53
|
const inputRef = useRef<any>();
|
|
@@ -104,7 +109,7 @@ export default forwardRef((props: Props, ref) => {
|
|
|
104
109
|
}
|
|
105
110
|
}))
|
|
106
111
|
|
|
107
|
-
return <div className={classNames(preCls)}>
|
|
112
|
+
return <div className={classNames(preCls,{[`${preCls}-row`]:layout==='row'},className)}>
|
|
108
113
|
<div className={classNames(`${preCls}__label`)}>
|
|
109
114
|
<span className={classNames(`${preCls}__label-text`)}>{label}</span>
|
|
110
115
|
{require && <span className={classNames(`${preCls}__label-require`)}>*</span>}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
.verification-code-input {
|
|
2
|
+
&-row{
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
.verification-code-input__label{
|
|
6
|
+
margin-bottom: unset;
|
|
7
|
+
}
|
|
8
|
+
.verification-code-input__border{
|
|
9
|
+
margin-left: 16px;
|
|
10
|
+
flex: 1;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
&__label {
|
|
14
|
+
height: 22px;
|
|
15
|
+
font-size: 14px;
|
|
16
|
+
margin-bottom: 5px;
|
|
17
|
+
font-family: -apple-system, Arial, Verdana, Helvetica Neue, Helvetica, sans-serif, PingFang SC, Microsoft YaHei;
|
|
18
|
+
font-weight: 400;
|
|
19
|
+
line-height: 22px;
|
|
20
|
+
|
|
21
|
+
&-text {
|
|
22
|
+
color: #3f4755;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&-require {
|
|
26
|
+
color: red;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&__border {
|
|
31
|
+
padding: 6px 12px;
|
|
32
|
+
border-radius: 8px;
|
|
33
|
+
transition: all 0.2s;
|
|
34
|
+
border: 1px solid #e9ecf0;
|
|
35
|
+
box-sizing: border-box;
|
|
36
|
+
position: relative;
|
|
37
|
+
|
|
38
|
+
&--disabled {
|
|
39
|
+
background-color: #fafafa;
|
|
40
|
+
cursor: not-allowed;
|
|
41
|
+
input:disabled {
|
|
42
|
+
background-color: #fafafa;
|
|
43
|
+
cursor: not-allowed;
|
|
44
|
+
color: #3f475594;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
&__border--error {
|
|
49
|
+
box-shadow: inset 0px 0px 4px 0px rgba(240, 94, 94, 0.3) ;
|
|
50
|
+
border: 1px solid #f05e5e ;
|
|
51
|
+
}
|
|
52
|
+
&__border--active {
|
|
53
|
+
box-shadow: inset 0px 0px 4px 0px rgba(40, 121, 255, 0.3) !important;
|
|
54
|
+
border: 1px solid #2879ff !important;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&__input {
|
|
58
|
+
display: inline-block;
|
|
59
|
+
padding: 0;
|
|
60
|
+
width: calc(100% - 102px);
|
|
61
|
+
font-size: 14px;
|
|
62
|
+
font-family: -apple-system, Arial, Verdana, Helvetica Neue, Helvetica, sans-serif, PingFang SC, Microsoft YaHei;
|
|
63
|
+
font-weight: 400;
|
|
64
|
+
color: #3f4755;
|
|
65
|
+
height: 22px;
|
|
66
|
+
line-height: inherit;
|
|
67
|
+
border: none;
|
|
68
|
+
flex: 1;
|
|
69
|
+
|
|
70
|
+
&::-webkit-input-placeholder {
|
|
71
|
+
color: #bfc7d5;
|
|
72
|
+
font-weight: unset;
|
|
73
|
+
}
|
|
74
|
+
&::-moz-placeholder {
|
|
75
|
+
color: #bfc7d5;
|
|
76
|
+
font-weight: unset;
|
|
77
|
+
}
|
|
78
|
+
&:-moz-placeholder {
|
|
79
|
+
color: #bfc7d5;
|
|
80
|
+
font-weight: unset;
|
|
81
|
+
}
|
|
82
|
+
&:-ms-input-placeholder {
|
|
83
|
+
color: #bfc7d5;
|
|
84
|
+
font-weight: unset;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
&__btn{
|
|
88
|
+
width: 100px;
|
|
89
|
+
height: 34px;
|
|
90
|
+
background: #D4E4FF;
|
|
91
|
+
border-radius: 0px 8px 8px 0px;
|
|
92
|
+
border-left: 1px solid #DFE3EA;
|
|
93
|
+
font-size: 14px;
|
|
94
|
+
font-weight: 400;
|
|
95
|
+
color: #2879FF;
|
|
96
|
+
cursor: pointer;
|
|
97
|
+
line-height: 34px;
|
|
98
|
+
text-align: center;
|
|
99
|
+
position: absolute;
|
|
100
|
+
top: 0px;
|
|
101
|
+
right: 0;
|
|
102
|
+
&--not{
|
|
103
|
+
font-weight: 400;
|
|
104
|
+
color: #A4ACB9;
|
|
105
|
+
background: #F7F8FA;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import React, { useState, useRef, useEffect, forwardRef, useImperativeHandle } from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import ToolTip from '../../../tooltip/error-tip';
|
|
4
|
+
import './index.scss';
|
|
5
|
+
|
|
6
|
+
const preCls = 'verification-code-input';
|
|
7
|
+
|
|
8
|
+
interface verify {
|
|
9
|
+
tip: string;
|
|
10
|
+
test: RegExp;
|
|
11
|
+
}
|
|
12
|
+
interface Props {
|
|
13
|
+
label: string;
|
|
14
|
+
verifies?: verify[];
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
onChange?: Function;
|
|
17
|
+
value?: any;
|
|
18
|
+
require?: boolean;
|
|
19
|
+
type?: string;
|
|
20
|
+
name: string;
|
|
21
|
+
getContainer?: Function;
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
layout?: 'clomn'|'row';
|
|
24
|
+
btnClick?: Function;
|
|
25
|
+
className?: string;
|
|
26
|
+
}
|
|
27
|
+
interface Error {
|
|
28
|
+
name: string;
|
|
29
|
+
tip: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const OverlayInner = ({ hasError, hasActive, tip }) => {
|
|
33
|
+
if (hasActive) return <span style={{ 'color': '#3F4755' }}>{tip}</span>;
|
|
34
|
+
if (hasError) return <span style={{ 'color': '#F05E5E' }}>{tip}</span>;
|
|
35
|
+
|
|
36
|
+
return <span />;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export default forwardRef((props: Props, ref) => {
|
|
40
|
+
const {
|
|
41
|
+
label,
|
|
42
|
+
verifies,
|
|
43
|
+
placeholder,
|
|
44
|
+
onChange,
|
|
45
|
+
require,
|
|
46
|
+
type,
|
|
47
|
+
name,
|
|
48
|
+
disabled,
|
|
49
|
+
getContainer,
|
|
50
|
+
layout,
|
|
51
|
+
className="",
|
|
52
|
+
btnClick=()=>{},
|
|
53
|
+
} = props;
|
|
54
|
+
|
|
55
|
+
const inputRef = useRef<any>();
|
|
56
|
+
const [hasError, setHasError] = useState<boolean>(false);
|
|
57
|
+
const [hasActive, setHasActive] = useState<boolean>(false);
|
|
58
|
+
const [btn_info, setBtn_info] = useState<any>('获取验证码')
|
|
59
|
+
const [btnCanClick, setBtnCanClick] = useState<any>(true)
|
|
60
|
+
const [tip, setTip] = useState<string>('');
|
|
61
|
+
const [value, setValue] = useState<string>(props.value || '');
|
|
62
|
+
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
setValue(props.value);
|
|
65
|
+
}, [props.value])
|
|
66
|
+
|
|
67
|
+
const verifing = (): Error[] => {
|
|
68
|
+
const value = inputRef.current && inputRef.current.value;
|
|
69
|
+
if (!verifies || !verifies.length) return [];
|
|
70
|
+
if (!require && !value) return [];
|
|
71
|
+
const errors: Error[] = [];
|
|
72
|
+
for (let i = 0; i < verifies.length; i++) {
|
|
73
|
+
let { test, tip } = verifies[i];
|
|
74
|
+
if (!value.match(test)) {
|
|
75
|
+
errors.push({ name, tip });
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return errors;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const onInputFocusHandler = () => {
|
|
82
|
+
setHasActive(true);
|
|
83
|
+
inputRef.current.setSelectionRange(9999999, 9999999);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const onBlurHandler = () => {
|
|
87
|
+
setHasActive(false);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const onChangeHandler = () => {
|
|
91
|
+
const value = inputRef.current && inputRef.current.value;
|
|
92
|
+
onChange && onChange(value);
|
|
93
|
+
setValue(value);
|
|
94
|
+
const errors = verifing();
|
|
95
|
+
if (errors.length) {
|
|
96
|
+
setHasError(true);
|
|
97
|
+
setTip(errors[0].tip);
|
|
98
|
+
} else {
|
|
99
|
+
setHasError(false);
|
|
100
|
+
setTip('');
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const HandlerCode = () =>{
|
|
105
|
+
const errors = verifing();
|
|
106
|
+
if (errors.length) return
|
|
107
|
+
if(!btnCanClick || hasError) return
|
|
108
|
+
btnClick&&btnClick()
|
|
109
|
+
let time = 60
|
|
110
|
+
setBtn_info(`${time}s重新发送`)
|
|
111
|
+
setBtnCanClick(false)
|
|
112
|
+
let timer = setInterval(() => {
|
|
113
|
+
if (time === 0) {
|
|
114
|
+
clearInterval(timer)
|
|
115
|
+
setBtn_info('获取验证码')
|
|
116
|
+
setBtnCanClick(true)
|
|
117
|
+
} else {
|
|
118
|
+
setBtn_info(`${time}s重新发送`)
|
|
119
|
+
time--;
|
|
120
|
+
}
|
|
121
|
+
}, 1000);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
useImperativeHandle(ref, () => ({
|
|
125
|
+
'verifing': (): Error[] => {
|
|
126
|
+
const errors = verifing();
|
|
127
|
+
if (errors.length) {
|
|
128
|
+
setHasError(true);
|
|
129
|
+
setTip(errors[0].tip);
|
|
130
|
+
inputRef.current.focus();
|
|
131
|
+
}
|
|
132
|
+
return errors;
|
|
133
|
+
}
|
|
134
|
+
}))
|
|
135
|
+
|
|
136
|
+
return <div className={classNames(preCls,{[`${preCls}-row`]:layout==='row'},className)}>
|
|
137
|
+
<div className={classNames(`${preCls}__label`)}>
|
|
138
|
+
<span className={classNames(`${preCls}__label-text`)}>{label}</span>
|
|
139
|
+
{require && <span className={classNames(`${preCls}__label-require`)}>*</span>}
|
|
140
|
+
</div>
|
|
141
|
+
<div className={classNames(`${preCls}__border`, {
|
|
142
|
+
[`${preCls}__border--error`]: hasError,
|
|
143
|
+
[`${preCls}__border--active`]: hasActive,
|
|
144
|
+
[`${preCls}__border--disabled`]: disabled
|
|
145
|
+
})}>
|
|
146
|
+
<ToolTip
|
|
147
|
+
placement={'topLeft'}
|
|
148
|
+
destroyTooltipOnHide={true}
|
|
149
|
+
visible={(hasActive || hasError) && tip}
|
|
150
|
+
overlay={<OverlayInner hasActive={hasActive} hasError={hasError} tip={tip} />}
|
|
151
|
+
getTooltipContainer={getContainer}
|
|
152
|
+
>
|
|
153
|
+
<input
|
|
154
|
+
ref={inputRef}
|
|
155
|
+
type={type}
|
|
156
|
+
disabled={disabled}
|
|
157
|
+
className={classNames(`${preCls}__input`)}
|
|
158
|
+
value={value}
|
|
159
|
+
placeholder={placeholder}
|
|
160
|
+
onFocus={onInputFocusHandler}
|
|
161
|
+
onBlur={onBlurHandler}
|
|
162
|
+
onChange={onChangeHandler}
|
|
163
|
+
autoComplete='off'
|
|
164
|
+
/>
|
|
165
|
+
</ToolTip>
|
|
166
|
+
<div className={classNames(`${preCls}__btn`,{[`${preCls}__btn--not`]:!btnCanClick})} onClick={HandlerCode}>
|
|
167
|
+
{btn_info}
|
|
168
|
+
</div>
|
|
169
|
+
</div>
|
|
170
|
+
</div>
|
|
171
|
+
})
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
box-sizing: border-box;
|
|
25
25
|
}
|
|
26
26
|
&__border--error {
|
|
27
|
-
box-shadow: inset 0px 0px 4px 0px rgba(240, 94, 94, 0.3)
|
|
28
|
-
border: 1px solid #f05e5e
|
|
27
|
+
box-shadow: inset 0px 0px 4px 0px rgba(240, 94, 94, 0.3) ;
|
|
28
|
+
border: 1px solid #f05e5e ;
|
|
29
29
|
}
|
|
30
30
|
&__border--active {
|
|
31
31
|
box-shadow: inset 0px 0px 4px 0px rgba(40, 121, 255, 0.3);
|
|
@@ -50,10 +50,10 @@ export default forwardRef((props: Props, ref) => {
|
|
|
50
50
|
|
|
51
51
|
return (
|
|
52
52
|
<div className={`${prefixCls} ${className}`}>
|
|
53
|
-
|
|
53
|
+
{!!label&&<div className={`${prefixCls}__label`}>
|
|
54
54
|
<span className={`${prefixCls}__label-text`}>{label}</span>
|
|
55
55
|
{require && <span className={`${prefixCls}__label-symbol`}>*</span>}
|
|
56
|
-
</div>
|
|
56
|
+
</div>}
|
|
57
57
|
<div className={`${prefixCls}__radios`}>
|
|
58
58
|
{radios.map((radio) => (
|
|
59
59
|
<div className={`${prefixCls}__radios-item ${radioClass}`}>
|
|
@@ -8,6 +8,7 @@ import _FormFieldTextarea from "./form-fields/textarea";
|
|
|
8
8
|
import _FormFieldRadios from "./form-fields/radios";
|
|
9
9
|
import _FormFieldDropDown from "./form-fields/dropdown";
|
|
10
10
|
import _FormFieldGroup from "./form-fields/group";
|
|
11
|
+
import _FormFieldVerificationCode from "./form-fields/input-verification-code"
|
|
11
12
|
import { SingleLayout } from "./layout";
|
|
12
13
|
import "./index.scss";
|
|
13
14
|
|
|
@@ -100,6 +101,7 @@ const FormFields = {
|
|
|
100
101
|
Radios: _FormFieldRadios,
|
|
101
102
|
DropDown:_FormFieldDropDown,
|
|
102
103
|
GroupFields:_FormFieldGroup,
|
|
104
|
+
VerificationInput:_FormFieldVerificationCode,
|
|
103
105
|
};
|
|
104
106
|
//@ts-ignore
|
|
105
107
|
Form.Fields = FormFields
|