@titaui/pc 1.7.100 → 1.8.2
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 +4 -0
- package/lib/components/dialog/index.js +7 -6
- package/lib/components/form/form-fields/input/index.css +19 -5
- 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/grid-layout/near-visitors/index.js +4 -2
- package/lib/components/grid-layout/okr-align/index.js +4 -4
- package/lib/components/grid-layout/okr-progress/index.js +6 -6
- package/lib/components/grid-layout/okr-target/index.js +2 -2
- package/lib/components/grid-layout/over-view/index.js +1 -1
- package/lib/components/grid-layout/personal-info/index.js +5 -3
- package/lib/components/grid-layout/sub-employee-okr/index.js +1 -1
- package/lib/components/grid-layout/week-task/index.js +4 -4
- package/lib/components/grid-layout/words-cloud/index.js +5 -3
- package/lib/components/grid-page/personal-info/index.js +5 -3
- package/lib/components/img-viewer/index.js +1 -1
- package/lib/components/mblog/style.js +4 -4
- 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/okr-detail/base-info/base-info.js +4 -3
- package/lib/components/okr-detail/base-info/o-desc/index.js +2 -8
- package/lib/components/point-demo/constant.js +1 -3
- package/lib/components/point-demo/drop-down-box/index.js +1 -3
- package/lib/components/point-demo/index.js +8 -10
- package/lib/components/publish-dynamic-modal/publish-dynamic-modal.css +1 -1
- package/lib/components/publish-dynamic-modal/publish-dynamic-modal.js +2 -1
- package/lib/components/table/index.css +4 -0
- package/lib/components/table/index.js +3 -0
- package/lib/components/upload-photo-modal/constant.js +99 -0
- package/lib/components/upload-photo-modal/img/browser-preview-bgc.png +0 -0
- package/lib/components/upload-photo-modal/index.css +276 -0
- package/lib/components/upload-photo-modal/index.js +332 -0
- package/lib/components/upload-photo-modal/request-api.js +44 -0
- package/lib/components/user-selector/category-selector-panel/depart-tree.js +3 -0
- package/lib/components/user-selector/export-modules/field-tree-selector/index.css +1 -1
- package/lib/components/user-selector/export-modules/field-tree-selector/index.js +2 -0
- package/lib/components/user-selector/request-apis.js +1 -1
- package/lib/components/word-cloud/index.js +1 -1
- package/lib/components-v1/userSelector/components/MultiMode/CommonList.js +1 -1
- package/lib/components-v1/userSelector/components/MultiMode/DepartmentList.js +1 -1
- package/lib/components-v1/userSelector/components/MultiMode/SubsList.js +1 -1
- package/lib/components-v1/userSelector/components/SingleMode.js +1 -1
- package/lib/index.js +8 -0
- package/lib/pages/home/components/data-list/index.js +2 -2
- package/lib/pages/home/components/data-list/nav-selector/index.js +2 -2
- package/lib/pages/home/components/data-list/table/columns/index.js +1 -1
- package/lib/pages/home/components/guide/index.js +14 -12
- package/lib/pages/home/components/header/index.js +3 -1
- package/lib/pages/home-page-data-list/index.js +2 -2
- 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.js +192 -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 +3 -0
- package/src/components/form/form-fields/input/index.scss +16 -5
- 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/grid-layout/near-visitors/index.tsx +3 -2
- package/src/components/grid-layout/okr-align/index.tsx +4 -4
- package/src/components/grid-layout/okr-progress/index.tsx +6 -6
- package/src/components/grid-layout/okr-target/index.tsx +2 -2
- package/src/components/grid-layout/over-view/index.tsx +1 -1
- package/src/components/grid-layout/personal-info/index.tsx +4 -3
- package/src/components/grid-layout/sub-employee-okr/index.tsx +1 -1
- package/src/components/grid-layout/week-task/index.tsx +3 -3
- package/src/components/grid-layout/words-cloud/index.tsx +4 -3
- package/src/components/grid-page/personal-info/index.tsx +4 -3
- package/src/components/img-viewer/index.tsx +1 -1
- package/src/components/mblog/style.ts +5 -5
- 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/okr-detail/base-info/base-info.tsx +2 -4
- package/src/components/okr-detail/base-info/o-desc/index.tsx +0 -7
- package/src/components/point-demo/constant.ts +1 -3
- package/src/components/point-demo/drop-down-box/index.js +1 -2
- package/src/components/point-demo/index.js +8 -9
- package/src/components/publish-dynamic-modal/publish-dynamic-modal.scss +1 -1
- package/src/components/publish-dynamic-modal/publish-dynamic-modal.tsx +1 -0
- package/src/components/table/index.js +1 -0
- package/src/components/table/index.scss +5 -0
- package/src/components/upload-photo-modal/constant.ts +71 -0
- package/src/components/upload-photo-modal/img/browser-preview-bgc.png +0 -0
- package/src/components/upload-photo-modal/index.scss +248 -0
- package/src/components/upload-photo-modal/index.tsx +236 -0
- package/src/components/upload-photo-modal/request-api.ts +23 -0
- package/src/components/user-selector/category-selector-panel/depart-tree.tsx +3 -2
- package/src/components/user-selector/export-modules/field-tree-selector/index.scss +1 -1
- package/src/components/user-selector/export-modules/field-tree-selector/index.tsx +3 -0
- package/src/components/user-selector/request-apis.js +1 -1
- package/src/components/word-cloud/index.js +1 -1
- package/src/components-v1/userSelector/components/MultiMode/CommonList.tsx +1 -1
- package/src/components-v1/userSelector/components/MultiMode/DepartmentList.tsx +1 -1
- package/src/components-v1/userSelector/components/MultiMode/SubsList.tsx +1 -1
- package/src/components-v1/userSelector/components/SingleMode.tsx +1 -1
- package/src/index.js +1 -0
- package/src/pages/home/components/data-list/index.tsx +2 -2
- package/src/pages/home/components/data-list/nav-selector/index.tsx +2 -2
- package/src/pages/home/components/data-list/table/columns/index.tsx +1 -1
- package/src/pages/home/components/guide/index.tsx +13 -12
- package/src/pages/home/components/header/index.tsx +2 -1
- package/src/pages/home-page-data-list/index.tsx +2 -2
- 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.tsx +152 -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
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React, { FC, useState, useRef, useEffect } from "react";
|
|
2
|
-
import { RectBtn } from "../../../../components/button";
|
|
3
2
|
import Form from "../../../../components/form";
|
|
4
|
-
import { getUserInfoFun
|
|
3
|
+
import { getUserInfoFun } from "../../request-api";
|
|
5
4
|
import { getLocale } from "../../../../utils/getLocale";
|
|
6
|
-
import
|
|
5
|
+
import EditModle from '../edit-info'
|
|
7
6
|
import "./index.scss";
|
|
8
7
|
|
|
9
8
|
const {Fields} = Form
|
|
@@ -12,129 +11,59 @@ const prefix = "titaui-personal-info-base-info";
|
|
|
12
11
|
const BaseInfo: FC = () => {
|
|
13
12
|
const formRef = useRef<any>();
|
|
14
13
|
const [userInfo, setUserInfo] = useState({ name: "", email: "", mobile: "" });
|
|
15
|
-
const [
|
|
16
|
-
const [isEdit, setIsEdit] = useState(false);
|
|
14
|
+
const [visible, setVisible] = useState(false);
|
|
17
15
|
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
if (err.length > 0) {
|
|
22
|
-
return;
|
|
23
|
-
} else {
|
|
24
|
-
saveUserInfo({ data: userInfo }).then((resp) => {
|
|
25
|
-
if (resp.Code === 1) {
|
|
26
|
-
Toast.Success(getLocale('Per_Ma_form_Updatesuc'), { canClose: false });
|
|
27
|
-
} else {
|
|
28
|
-
Toast.Error(resp.Message, { canClose: false });
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
};
|
|
16
|
+
const handleClickEdit = () => {
|
|
17
|
+
setVisible(true);
|
|
18
|
+
}
|
|
33
19
|
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
name: value || "",
|
|
38
|
-
});
|
|
39
|
-
setIsEdit(true);
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
const handlePhoneChange = (value) => {
|
|
43
|
-
setUserInfo({
|
|
44
|
-
...userInfo,
|
|
45
|
-
mobile: value || "",
|
|
46
|
-
});
|
|
47
|
-
setIsEdit(true);
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const handleEmailChange = (value) => {
|
|
51
|
-
setUserInfo({
|
|
52
|
-
...userInfo,
|
|
53
|
-
email: value || "",
|
|
54
|
-
});
|
|
55
|
-
setIsEdit(true);
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
useEffect(() => {
|
|
59
|
-
getUserInfoFun().then((resp) => {
|
|
60
|
-
if (resp.Code === 1 && resp.Data) {
|
|
61
|
-
setUserInfo({...resp.Data, position: resp.Data.positionCode});
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
}, []);
|
|
20
|
+
const handleCancelEdit = () => {
|
|
21
|
+
setVisible(false);
|
|
22
|
+
}
|
|
65
23
|
|
|
66
24
|
useEffect(() => {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
25
|
+
getUserInfoFun().then((resp) => {
|
|
26
|
+
if (resp.Code === 1 && resp.Data) {
|
|
27
|
+
setUserInfo({ ...resp.Data, position: resp.Data.positionCode });
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}, []);
|
|
73
31
|
|
|
74
32
|
return (
|
|
75
33
|
<div className={prefix}>
|
|
76
34
|
<div className={`${prefix}__header`}>
|
|
77
35
|
<span className={`${prefix}__header-title`}>{getLocale('Per_Ass_New_title_text_BasicIn')}</span>
|
|
78
|
-
<
|
|
79
|
-
|
|
80
|
-
text={getLocale('Mod_Save')}
|
|
81
|
-
disabled={isDisable}
|
|
82
|
-
onClick={handleSaveInfo}
|
|
83
|
-
/>
|
|
36
|
+
<span className={`${prefix}__header-btn`} onClick={handleClickEdit}>{getLocale('Mod_Editor')}</span>
|
|
37
|
+
<EditModle visible={visible} onCancel={handleCancelEdit}/>
|
|
84
38
|
</div>
|
|
85
39
|
<div className={`${prefix}__form`}>
|
|
86
40
|
<Form ref={formRef}>
|
|
87
41
|
<Fields.Input
|
|
88
42
|
name="name"
|
|
89
43
|
label={getLocale('Mod_UserName')}
|
|
90
|
-
placeholder={"
|
|
44
|
+
placeholder={"未设置"}
|
|
91
45
|
type="text"
|
|
92
|
-
|
|
93
|
-
verifies={[
|
|
94
|
-
{
|
|
95
|
-
"tip": "姓名不能为空",
|
|
96
|
-
"test": /\S/,
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
"tip": "姓名只能为中文,英文字母和数字及下划线的组合",
|
|
100
|
-
"test": /^((?!(\uff08|\uff09)).)*$/g,
|
|
101
|
-
},
|
|
102
|
-
]}
|
|
46
|
+
verifies={[]}
|
|
103
47
|
value={userInfo.name}
|
|
104
|
-
|
|
48
|
+
disabled
|
|
105
49
|
/>
|
|
106
50
|
<Fields.Input
|
|
107
51
|
name="phone"
|
|
108
52
|
type="text"
|
|
109
53
|
label={"手机号码"}
|
|
110
|
-
placeholder={"
|
|
111
|
-
require
|
|
54
|
+
placeholder={"未设置"}
|
|
112
55
|
value={userInfo.mobile}
|
|
113
|
-
verifies={[
|
|
114
|
-
|
|
115
|
-
"tip": "手机号不能为空",
|
|
116
|
-
"test": /^[\s\S]+$/,
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
"tip": "请输入11位手机号",
|
|
120
|
-
"test": /^1[3456789]\d{9}$/,
|
|
121
|
-
},
|
|
122
|
-
]}
|
|
123
|
-
onChange={handlePhoneChange}
|
|
56
|
+
verifies={[]}
|
|
57
|
+
disabled
|
|
124
58
|
/>
|
|
125
59
|
<Fields.Input
|
|
126
60
|
name="email"
|
|
127
61
|
type="text"
|
|
128
62
|
label={"电子邮箱"}
|
|
129
63
|
value={userInfo.email}
|
|
130
|
-
placeholder={"
|
|
131
|
-
verifies={[
|
|
132
|
-
|
|
133
|
-
"tip": "邮箱格式错误",
|
|
134
|
-
"test": /^([a-zA-Z0-9_-]|\.)+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/,
|
|
135
|
-
},
|
|
136
|
-
]}
|
|
137
|
-
onChange={handleEmailChange}
|
|
64
|
+
placeholder={"未设置"}
|
|
65
|
+
verifies={[]}
|
|
66
|
+
disabled
|
|
138
67
|
/>
|
|
139
68
|
</Form>
|
|
140
69
|
</div>
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import React, { useState, useRef, useEffect } from 'react';
|
|
2
|
+
import { getUserInfoFun, saveUserInfo } from '../../request-api';
|
|
3
|
+
import Toast from '../../../../components/toast';
|
|
4
|
+
import Input from './input';
|
|
5
|
+
import Dialog from '../../../../components/dialog';
|
|
6
|
+
|
|
7
|
+
const EditBaseInfo = (props) => {
|
|
8
|
+
const { visible, onCancel } = props;
|
|
9
|
+
|
|
10
|
+
const modalRef = useRef<any>();
|
|
11
|
+
|
|
12
|
+
const [ isDisable, setIsDisable ] = useState(false);
|
|
13
|
+
const [ isEdit, setIsEdit ] = useState(false);
|
|
14
|
+
const [ userInfo, setUserInfo ] = useState({ name: '', email: '', mobile: '' });
|
|
15
|
+
|
|
16
|
+
const handleNameChange = (value) => {
|
|
17
|
+
setUserInfo({
|
|
18
|
+
...userInfo,
|
|
19
|
+
name: value || ''
|
|
20
|
+
});
|
|
21
|
+
setIsEdit(true);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const handlePhoneChange = (value) => {
|
|
25
|
+
setUserInfo({
|
|
26
|
+
...userInfo,
|
|
27
|
+
mobile: value || ''
|
|
28
|
+
});
|
|
29
|
+
setIsEdit(true);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const handleEmailChange = (value) => {
|
|
33
|
+
setUserInfo({
|
|
34
|
+
...userInfo,
|
|
35
|
+
email: value || ''
|
|
36
|
+
});
|
|
37
|
+
setIsEdit(true);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const handleSaveUserInfo = () => {
|
|
41
|
+
if (!userInfo.email || !userInfo.mobile || !userInfo.name || isDisable) {
|
|
42
|
+
setIsDisable(true);
|
|
43
|
+
return;
|
|
44
|
+
} else {
|
|
45
|
+
saveUserInfo({ data: userInfo }).then((resp) => {
|
|
46
|
+
if (resp.Code === 1) {
|
|
47
|
+
Toast.Success('更新成功', { canClose: false });
|
|
48
|
+
onCancel();
|
|
49
|
+
setTimeout(() => {
|
|
50
|
+
window.location.reload();
|
|
51
|
+
}, 2000)
|
|
52
|
+
} else {
|
|
53
|
+
Toast.Error(resp.Message, { canClose: false });
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
getUserInfoFun().then((resp) => {
|
|
61
|
+
if (resp.Code === 1 && resp.Data) {
|
|
62
|
+
setUserInfo({ ...resp.Data, position: resp.Data.positionCode });
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}, []);
|
|
66
|
+
|
|
67
|
+
useEffect(
|
|
68
|
+
() => {
|
|
69
|
+
if (userInfo.name && userInfo.mobile && isEdit) {
|
|
70
|
+
setIsDisable(false);
|
|
71
|
+
} else {
|
|
72
|
+
setIsDisable(true);
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
[ userInfo, isEdit ]
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<Dialog
|
|
80
|
+
visible={visible}
|
|
81
|
+
ref={modalRef}
|
|
82
|
+
width={480}
|
|
83
|
+
mask
|
|
84
|
+
centered
|
|
85
|
+
title={'基本信息设置'}
|
|
86
|
+
noHeadLine
|
|
87
|
+
maskClosable={false}
|
|
88
|
+
onClose={onCancel}
|
|
89
|
+
onCancel={onCancel}
|
|
90
|
+
okText="确定"
|
|
91
|
+
noFooterLine
|
|
92
|
+
onOk={handleSaveUserInfo}
|
|
93
|
+
disabled={isDisable}
|
|
94
|
+
>
|
|
95
|
+
<Input
|
|
96
|
+
name="name"
|
|
97
|
+
label={'姓名'}
|
|
98
|
+
placeholder={'请输入姓名'}
|
|
99
|
+
type="text"
|
|
100
|
+
require
|
|
101
|
+
verifies={[
|
|
102
|
+
{
|
|
103
|
+
tip: '姓名不能为空',
|
|
104
|
+
test: /\S/
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
tip: '姓名只能为中文,英文字母和数字及下划线的组合',
|
|
108
|
+
test: /^((?!(\uff08|\uff09)).)*$/g
|
|
109
|
+
}
|
|
110
|
+
]}
|
|
111
|
+
value={userInfo.name}
|
|
112
|
+
onChange={handleNameChange}
|
|
113
|
+
/>
|
|
114
|
+
<Input
|
|
115
|
+
name="phone"
|
|
116
|
+
type="text"
|
|
117
|
+
label={'手机号码'}
|
|
118
|
+
placeholder={'请输入手机号'}
|
|
119
|
+
require
|
|
120
|
+
value={userInfo.mobile}
|
|
121
|
+
verifies={[
|
|
122
|
+
{
|
|
123
|
+
tip: '手机号不能为空',
|
|
124
|
+
test: /^[\s\S]+$/
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
tip: '请输入11位手机号',
|
|
128
|
+
test: /^1[3456789]\d{9}$/
|
|
129
|
+
}
|
|
130
|
+
]}
|
|
131
|
+
onChange={handlePhoneChange}
|
|
132
|
+
/>
|
|
133
|
+
<Input
|
|
134
|
+
name="email"
|
|
135
|
+
type="text"
|
|
136
|
+
label={'邮箱'}
|
|
137
|
+
value={userInfo.email}
|
|
138
|
+
require
|
|
139
|
+
placeholder={'请输入邮箱'}
|
|
140
|
+
verifies={[
|
|
141
|
+
{
|
|
142
|
+
tip: '邮箱格式错误',
|
|
143
|
+
test: /^([a-zA-Z0-9_-]|\.)+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/
|
|
144
|
+
}
|
|
145
|
+
]}
|
|
146
|
+
onChange={handleEmailChange}
|
|
147
|
+
/>
|
|
148
|
+
</Dialog>
|
|
149
|
+
);
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
export default EditBaseInfo;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
.edit-base-info-input {
|
|
2
|
+
display: flex;
|
|
3
|
+
box-sizing: border-box;
|
|
4
|
+
padding: 0 32px;
|
|
5
|
+
align-items: center;
|
|
6
|
+
margin-bottom: 16px;
|
|
7
|
+
&__label {
|
|
8
|
+
width: 56px;
|
|
9
|
+
height: 22px;
|
|
10
|
+
font-size: 14px;
|
|
11
|
+
margin-bottom: 5px;
|
|
12
|
+
margin-right: 20px;
|
|
13
|
+
font-family: -apple-system, Arial, Verdana, Helvetica Neue, Helvetica, sans-serif, PingFang SC, Microsoft YaHei;
|
|
14
|
+
font-weight: 400;
|
|
15
|
+
line-height: 22px;
|
|
16
|
+
|
|
17
|
+
&-text {
|
|
18
|
+
color: #89919F;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&-require {
|
|
22
|
+
color: red;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&__border {
|
|
27
|
+
flex:1;
|
|
28
|
+
padding: 6px 12px;
|
|
29
|
+
transition: all 0.2s;
|
|
30
|
+
border: 1px solid #e9ecf0;
|
|
31
|
+
box-sizing: border-box;
|
|
32
|
+
border-radius: 8px;
|
|
33
|
+
|
|
34
|
+
&--disabled {
|
|
35
|
+
background-color: #fafafa;
|
|
36
|
+
cursor: not-allowed;
|
|
37
|
+
input:disabled {
|
|
38
|
+
background-color: #fafafa;
|
|
39
|
+
cursor: not-allowed;
|
|
40
|
+
color: #3f475594;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
&__border--error {
|
|
45
|
+
box-shadow: inset 0px 0px 4px 0px rgba(240, 94, 94, 0.3) !important;
|
|
46
|
+
border: 1px solid #f05e5e !important;
|
|
47
|
+
}
|
|
48
|
+
&__border--active {
|
|
49
|
+
box-shadow: inset 0px 0px 4px 0px rgba(40, 121, 255, 0.3);
|
|
50
|
+
border: 1px solid #2879ff;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&__input {
|
|
54
|
+
display: inline-block;
|
|
55
|
+
padding: 0;
|
|
56
|
+
width: calc(100% - 12px);
|
|
57
|
+
font-size: 14px;
|
|
58
|
+
font-family: -apple-system, Arial, Verdana, Helvetica Neue, Helvetica, sans-serif, PingFang SC, Microsoft YaHei;
|
|
59
|
+
font-weight: 400;
|
|
60
|
+
color: #3f4755;
|
|
61
|
+
height: 22px;
|
|
62
|
+
line-height: inherit;
|
|
63
|
+
border: none;
|
|
64
|
+
|
|
65
|
+
&::-webkit-input-placeholder {
|
|
66
|
+
color: #bfc7d5;
|
|
67
|
+
font-weight: unset;
|
|
68
|
+
}
|
|
69
|
+
&::-moz-placeholder {
|
|
70
|
+
color: #bfc7d5;
|
|
71
|
+
font-weight: unset;
|
|
72
|
+
}
|
|
73
|
+
&:-moz-placeholder {
|
|
74
|
+
color: #bfc7d5;
|
|
75
|
+
font-weight: unset;
|
|
76
|
+
}
|
|
77
|
+
&:-ms-input-placeholder {
|
|
78
|
+
color: #bfc7d5;
|
|
79
|
+
font-weight: unset;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import React, { useState, useRef, useEffect, forwardRef, useImperativeHandle } from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import ToolTip from '../../../../../components/tooltip/error-tip';
|
|
4
|
+
import './index.scss'
|
|
5
|
+
|
|
6
|
+
const preCls = 'edit-base-info-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
|
+
}
|
|
24
|
+
interface Error {
|
|
25
|
+
name: string;
|
|
26
|
+
tip: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const OverlayInner = ({ hasError, hasActive, tip }) => {
|
|
30
|
+
if (hasError) return <span style={{ 'color': '#F05E5E' }}>{tip}</span>;
|
|
31
|
+
if (hasActive) return <span style={{ 'color': '#3F4755' }}>{tip}</span>;
|
|
32
|
+
return <span />;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const popupAlign = {
|
|
36
|
+
offset: [-12, -4],
|
|
37
|
+
overflow: { adjustX: true, adjustY: true },
|
|
38
|
+
targetOffset: [0, 0],
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export default forwardRef((props: Props, ref) => {
|
|
42
|
+
const {
|
|
43
|
+
label,
|
|
44
|
+
verifies,
|
|
45
|
+
placeholder,
|
|
46
|
+
onChange,
|
|
47
|
+
require,
|
|
48
|
+
type,
|
|
49
|
+
name,
|
|
50
|
+
disabled,
|
|
51
|
+
getContainer
|
|
52
|
+
} = props;
|
|
53
|
+
|
|
54
|
+
const inputRef = useRef<any>();
|
|
55
|
+
const [hasError, setHasError] = useState<boolean>(false);
|
|
56
|
+
const [hasActive, setHasActive] = useState<boolean>(false);
|
|
57
|
+
const [tip, setTip] = useState<string>('');
|
|
58
|
+
const [value, setValue] = useState<string>(props.value || '');
|
|
59
|
+
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
setValue(props.value);
|
|
62
|
+
}, [props.value])
|
|
63
|
+
|
|
64
|
+
const verifing = (): Error[] => {
|
|
65
|
+
const value = inputRef.current && inputRef.current.value;
|
|
66
|
+
if (!verifies || !verifies.length) return [];
|
|
67
|
+
if (!require && !value) return [];
|
|
68
|
+
const errors: Error[] = [];
|
|
69
|
+
for (let i = 0; i < verifies.length; i++) {
|
|
70
|
+
let { test, tip } = verifies[i];
|
|
71
|
+
if (!value.match(test)) {
|
|
72
|
+
errors.push({ name, tip });
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return errors;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const onInputFocusHandler = () => {
|
|
79
|
+
setHasActive(true);
|
|
80
|
+
inputRef.current.setSelectionRange(9999999, 9999999);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const onBlurHandler = () => {
|
|
84
|
+
setHasActive(false);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const onChangeHandler = () => {
|
|
88
|
+
const value = inputRef.current && inputRef.current.value;
|
|
89
|
+
onChange && onChange(value);
|
|
90
|
+
setValue(value);
|
|
91
|
+
const errors = verifing();
|
|
92
|
+
if (errors.length) {
|
|
93
|
+
setHasError(true);
|
|
94
|
+
setTip(errors[0].tip);
|
|
95
|
+
} else {
|
|
96
|
+
setHasError(false);
|
|
97
|
+
setTip('');
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
useImperativeHandle(ref, () => ({
|
|
102
|
+
'verifing': (): Error[] => {
|
|
103
|
+
const errors = verifing();
|
|
104
|
+
if (errors.length) {
|
|
105
|
+
setHasError(true);
|
|
106
|
+
setTip(errors[0].tip);
|
|
107
|
+
inputRef.current.focus();
|
|
108
|
+
}
|
|
109
|
+
return errors;
|
|
110
|
+
}
|
|
111
|
+
}))
|
|
112
|
+
|
|
113
|
+
return <div className={classNames(preCls)}>
|
|
114
|
+
<div className={classNames(`${preCls}__label`)}>
|
|
115
|
+
<span className={classNames(`${preCls}__label-text`)}>{label}</span>
|
|
116
|
+
</div>
|
|
117
|
+
<div className={classNames(`${preCls}__border`, {
|
|
118
|
+
[`${preCls}__border--error`]: hasError,
|
|
119
|
+
[`${preCls}__border--active`]: hasActive,
|
|
120
|
+
[`${preCls}__border--disabled`]: disabled
|
|
121
|
+
})}>
|
|
122
|
+
<ToolTip
|
|
123
|
+
placement={'topLeft'}
|
|
124
|
+
popupAlign={popupAlign}
|
|
125
|
+
destroyTooltipOnHide={true}
|
|
126
|
+
visible={(hasActive || hasError) && tip}
|
|
127
|
+
overlay={<OverlayInner hasActive={hasActive} hasError={hasError} tip={tip} />}
|
|
128
|
+
getTooltipContainer={getContainer}
|
|
129
|
+
>
|
|
130
|
+
<input
|
|
131
|
+
ref={inputRef}
|
|
132
|
+
type={type}
|
|
133
|
+
disabled={disabled}
|
|
134
|
+
className={classNames(`${preCls}__input`)}
|
|
135
|
+
value={value}
|
|
136
|
+
placeholder={placeholder}
|
|
137
|
+
onFocus={onInputFocusHandler}
|
|
138
|
+
onBlur={onBlurHandler}
|
|
139
|
+
onChange={onChangeHandler}
|
|
140
|
+
autoComplete='off'
|
|
141
|
+
/>
|
|
142
|
+
</ToolTip>
|
|
143
|
+
</div>
|
|
144
|
+
</div>
|
|
145
|
+
})
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
.titaui-personal-info-person-photo {
|
|
2
|
+
background: #ffffff;
|
|
3
|
+
box-shadow: 0px 0px 8px 0px rgba(127, 145, 180, 0.1);
|
|
4
|
+
border-radius: 12px;
|
|
5
|
+
padding: 20px 32px;
|
|
6
|
+
margin-top: 10px;
|
|
7
|
+
font-family: -apple-system, Arial, Verdana, Helvetica Neue, Helvetica, sans-serif, PingFang SC, Microsoft YaHei;
|
|
8
|
+
&__header {
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
justify-content: space-between;
|
|
12
|
+
margin-bottom: 12px;
|
|
13
|
+
&-title {
|
|
14
|
+
font-size: 16px;
|
|
15
|
+
font-weight: 600;
|
|
16
|
+
color: #141c28;
|
|
17
|
+
line-height: 24px;
|
|
18
|
+
position: relative;
|
|
19
|
+
display: inline-flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
&::before {
|
|
22
|
+
content: "";
|
|
23
|
+
width: 4px;
|
|
24
|
+
height: 16px;
|
|
25
|
+
background: linear-gradient(90deg, #4e90ff 0%, #2879ff 100%);
|
|
26
|
+
border-radius: 2px;
|
|
27
|
+
display: inline-block;
|
|
28
|
+
position: absolute;
|
|
29
|
+
left: -8px;
|
|
30
|
+
top: 3px;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
&__main {
|
|
35
|
+
display: flex;
|
|
36
|
+
align-items: center;
|
|
37
|
+
&-mask {
|
|
38
|
+
position: absolute;
|
|
39
|
+
width: 160px;
|
|
40
|
+
height: 32px;
|
|
41
|
+
box-sizing: border-box;
|
|
42
|
+
padding: 7px 52px;
|
|
43
|
+
background: rgba(20, 28, 40, 0.5);
|
|
44
|
+
// filter: blur(4px);
|
|
45
|
+
font-size: 12px;
|
|
46
|
+
color: #FFFFFF;
|
|
47
|
+
line-height: 18px;
|
|
48
|
+
}
|
|
49
|
+
& > span {
|
|
50
|
+
margin-left: 24px;
|
|
51
|
+
font-size: 12px;
|
|
52
|
+
color: #A4ACB9;
|
|
53
|
+
line-height: 20px;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
.titaui-pc-avator-container {
|
|
57
|
+
cursor: pointer;
|
|
58
|
+
}
|
|
59
|
+
.titaui-pc-avator-wrapper {
|
|
60
|
+
&::before {
|
|
61
|
+
position: absolute;
|
|
62
|
+
bottom:0;
|
|
63
|
+
display: block;
|
|
64
|
+
content: "点击修改";
|
|
65
|
+
width: 160px;
|
|
66
|
+
height: 32px;
|
|
67
|
+
background: rgba(20, 28, 40, 0.5);
|
|
68
|
+
color: #FFFFFF;
|
|
69
|
+
font-size: 12px;
|
|
70
|
+
line-height: 18px;
|
|
71
|
+
text-align: center;
|
|
72
|
+
box-sizing: border-box;
|
|
73
|
+
padding: 7px 0;
|
|
74
|
+
backdrop-filter: blur(4px);
|
|
75
|
+
}
|
|
76
|
+
&:hover::before {
|
|
77
|
+
background: rgba(20, 28, 40, 0.4);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import { getUserInfo } from '../../../../utils/bs-global';
|
|
4
|
+
import Avatar from '../../../../components/avatar';
|
|
5
|
+
import ChangePhotoModal from '../../../../components/upload-photo-modal';
|
|
6
|
+
import './index.scss';
|
|
7
|
+
|
|
8
|
+
const prefix = 'titaui-personal-info-person-photo';
|
|
9
|
+
|
|
10
|
+
const { Id, Name, UserAvatar } = getUserInfo();
|
|
11
|
+
|
|
12
|
+
const PersonPhoto = () => {
|
|
13
|
+
|
|
14
|
+
const [visible, setVisible] = useState(false);
|
|
15
|
+
|
|
16
|
+
const handleChangePhoto = () => {
|
|
17
|
+
setVisible(true);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const handleCancel = () => {
|
|
21
|
+
setVisible(false);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<div className={prefix}>
|
|
26
|
+
<div className={`${prefix}__header`}>
|
|
27
|
+
<span className={`${prefix}__header-title`}>上传头像</span>
|
|
28
|
+
</div>
|
|
29
|
+
<div className={`${prefix}__main`}>
|
|
30
|
+
<Avatar
|
|
31
|
+
userId={Id}
|
|
32
|
+
name={Name}
|
|
33
|
+
color={UserAvatar.Color}
|
|
34
|
+
src={UserAvatar.Large}
|
|
35
|
+
size={{
|
|
36
|
+
width: 160,
|
|
37
|
+
textNum: 1,
|
|
38
|
+
fontSize: 24
|
|
39
|
+
}}
|
|
40
|
+
onClick={handleChangePhoto}
|
|
41
|
+
/>
|
|
42
|
+
<span>· 建议图片最小尺寸 150*150px</span>
|
|
43
|
+
</div>
|
|
44
|
+
<ChangePhotoModal visible={visible} onCancel={handleCancel} type="person"/>
|
|
45
|
+
</div>
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export default PersonPhoto;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import BaseInfo from "./components/base-info";
|
|
3
|
+
import PersonPhoto from './components/person-photo'
|
|
3
4
|
import Aha2021Page from '../aha2021';
|
|
4
5
|
import "./index.scss";
|
|
5
6
|
|
|
@@ -10,6 +11,7 @@ const PersonalInfo = () => {
|
|
|
10
11
|
<Aha2021Page.ContentTemplate>
|
|
11
12
|
<div className={prefix}>
|
|
12
13
|
<BaseInfo />
|
|
14
|
+
<PersonPhoto />
|
|
13
15
|
</div>
|
|
14
16
|
</Aha2021Page.ContentTemplate>
|
|
15
17
|
);
|