@titaui/pc 1.8.4 → 1.8.61

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.
Files changed (42) hide show
  1. package/lib/components/dialog/index.css +1 -1
  2. package/lib/components/form/form-fields/duties/index.js +2 -1
  3. package/lib/components/form/form-fields/input/index.js +1 -1
  4. package/lib/components/form/form-fields/input-verification-code/index.js +18 -15
  5. package/lib/components/form/form-fields/password/index.css +18 -0
  6. package/lib/components/form/form-fields/password/index.js +33 -20
  7. package/lib/components/form/index.js +4 -1
  8. package/lib/components/table/index.css +1 -0
  9. package/lib/components/upload-photo-modal/constant.js +10 -4
  10. package/lib/components/upload-photo-modal/index.css +1 -2
  11. package/lib/components/upload-photo-modal/index.js +58 -186
  12. package/lib/components/user-selector/request-apis.js +1 -1
  13. package/lib/pages/personal-info/components/base-info/index.css +31 -3
  14. package/lib/pages/personal-info/components/base-info/index.js +13 -5
  15. package/lib/pages/personal-info/components/{edit-info → edit-base-info}/index.css +1 -1
  16. package/lib/pages/personal-info/components/{edit-info → edit-base-info}/index.js +3 -4
  17. package/lib/pages/personal-info/components/person-photo/index.css +18 -5
  18. package/lib/pages/personal-info/components/person-photo/index.js +18 -3
  19. package/package.json +1 -1
  20. package/src/components/dialog/index.scss +1 -1
  21. package/src/components/form/form-fields/duties/index.tsx +1 -1
  22. package/src/components/form/form-fields/input/index.tsx +2 -2
  23. package/src/components/form/form-fields/input-verification-code/index.tsx +100 -70
  24. package/src/components/form/form-fields/password/index.scss +20 -4
  25. package/src/components/form/form-fields/password/index.tsx +73 -51
  26. package/src/components/form/index.tsx +3 -1
  27. package/src/components/table/index.scss +1 -0
  28. package/src/components/upload-photo-modal/constant.ts +7 -1
  29. package/src/components/upload-photo-modal/index.scss +1 -2
  30. package/src/components/upload-photo-modal/index.tsx +53 -156
  31. package/src/components/user-selector/export-modules/duties-selector/index.tsx +1 -1
  32. package/src/components/user-selector/request-apis.js +1 -1
  33. package/src/pages/personal-info/components/base-info/index.scss +26 -3
  34. package/src/pages/personal-info/components/base-info/index.tsx +12 -3
  35. package/src/pages/personal-info/components/{edit-info → edit-base-info}/index.scss +1 -1
  36. package/src/pages/personal-info/components/{edit-info → edit-base-info}/index.tsx +2 -4
  37. package/src/pages/personal-info/components/person-photo/index.scss +17 -5
  38. package/src/pages/personal-info/components/person-photo/index.tsx +12 -4
  39. package/lib/pages/personal-info/components/edit-info/input/index.css +0 -89
  40. package/lib/pages/personal-info/components/edit-info/input/index.js +0 -199
  41. package/src/pages/personal-info/components/edit-info/input/index.scss +0 -82
  42. package/src/pages/personal-info/components/edit-info/input/index.tsx +0 -145
@@ -1,57 +1,47 @@
1
1
  import React, { useState, useRef } from 'react';
2
2
  import classNames from 'classnames';
3
3
  import Cropper from 'react-cropper';
4
- import 'cropperjs/dist/cropper.css';
5
4
  import Toast from '../../components/toast';
6
5
  import ConditionRender from '../condition-render';
7
- import { saveUserInfo, saveTenantLogo, saveBrowserIcon, saveUserPhoto } from './request-api';
6
+ import { saveTenantLogo, saveBrowserIcon, saveUserPhoto } from './request-api';
8
7
  import Dialog from '../../components/dialog';
9
- import { List } from './constant'
8
+ import { List } from './constant';
9
+ import 'cropperjs/dist/cropper.css';
10
10
  import './index.scss';
11
- import uuid from 'uuid';
12
- import { rput, rpost } from "../../utils/request";
13
- import axios from 'axios';
14
- import { getBSGlobal, getUserInfo, getTenantInfo } from '../../utils/bs-global';
15
- const apiServer = getBSGlobal("apiPath")
16
- const userid = getUserInfo().Id;
17
- const tenantId = getTenantInfo().Id
18
-
19
11
 
20
12
  const preCls = 'tita-ui-change-person-photo';
21
-
22
13
  interface Props {
23
14
  visible: boolean;
24
15
  type: string; // person enterprise browser
25
16
  onCancel: Function;
17
+ handleSuccessUploadPhoto: Function;
26
18
  }
27
19
 
28
20
  const ChangePhoto = (props: Props) => {
29
- const { visible, onCancel, type = 'browser' } = props;
21
+ const { visible, onCancel, type = 'person', handleSuccessUploadPhoto } = props;
30
22
 
31
23
  const modalRef = useRef<any>();
24
+ const cropperRef = useRef<HTMLImageElement>(null);
32
25
 
33
26
  const [ image, setImage ] = useState('');
34
27
  const [ cropper, setCropper ] = useState<any>();
35
28
  const [ cropData, setCropData ] = useState('#');
36
- const [ userInfo, setUserInfo ] = useState({ Avatar: '' });
37
- const [item] = useState(List.find(item => item.id === type));
38
- const [isEnter, setIsEnter] = useState(false);
39
- const [fileName, setFileName] = useState('')
29
+ const [ isEnter, setIsEnter ] = useState(false);
30
+ const [ fileName, setFileName ] = useState('')
40
31
 
41
- const cropperRef = useRef<HTMLImageElement>(null);
42
-
43
- const onChange = (e: any) => {
44
- e.preventDefault();
32
+ const item = List.find(item => item.id === type)
33
+
34
+ const onChange = (e: any) => {
45
35
  let files;
46
36
  if (e.dataTransfer) {
47
37
  files = e.dataTransfer.files;
48
38
  } else if (e.target) {
49
39
  files = e.target.files;
50
- }
40
+ }
51
41
  setFileName(files[0].name)
52
42
  const reader = new FileReader();
53
43
  reader.onload = () => {
54
- setImage(reader.result as any);
44
+ setImage(reader.result as any);
55
45
  };
56
46
  reader.readAsDataURL(files[0]);
57
47
  };
@@ -67,140 +57,59 @@ const ChangePhoto = (props: Props) => {
67
57
  }
68
58
 
69
59
 
70
- const onCrop = () => {
71
-
60
+ const onCrop = () => {
72
61
  const imageElement: any = cropperRef.current;
73
- const cropper: any = imageElement.cropper;
62
+ const cropper: any = imageElement.cropper;
74
63
 
75
64
  setCropData(cropper.getCroppedCanvas().toDataURL());
76
- setUserInfo(cropper.getCroppedCanvas().toDataURL());
77
-
78
- let base64Url = cropper.getCroppedCanvas().toDataURL();
79
-
80
- const newFile = dataURLtoFile(base64Url, fileName);
81
- console.log(newFile);
82
65
 
66
+ let base64Url = cropper.getCroppedCanvas().toDataURL();
67
+
68
+ const newFile = dataURLtoFile(base64Url, fileName);
83
69
 
84
70
  let formData = new FormData();
85
71
 
86
72
  formData.append('file', newFile);
87
73
 
88
- console.log(formData);
89
74
  setCropper(formData);
90
75
  };
91
76
 
77
+ const handleSuccessSave = (resp) => {
78
+ if (resp.Code === 1) {
79
+ Toast.Success('保存成功', {
80
+ style: { position: "fixed", top: " 36px", left: "50%" },
81
+ });
82
+ onCancel();
83
+ setImage('');
84
+ handleSuccessUploadPhoto(cropData);
85
+ } else {
86
+ Toast.Error(resp.Message, {
87
+ style: { position: "fixed", top: " 36px", left: "50%" },
88
+ });
89
+ setImage('');
90
+ }
91
+ }
92
+
92
93
  const handleSaveInfo = () => {
93
- let timestamp = new Date().getTime(); // 给每个文件加一个时间戳
94
94
  if (!image) {
95
95
  return;
96
96
  } else {
97
97
  if(type === "person") {
98
98
  saveUserPhoto(cropper).then((resp) => {
99
- if (resp.Code === 1) {
100
- Toast.Success('保存成功', { canClose: false });
101
- onCancel();
102
- } else {
103
- Toast.Error(resp.Message, { canClose: false });
104
- }
99
+ handleSuccessSave(resp);
105
100
  });
106
101
  } else if(type === "enterprise") {
107
- // console.log(cropper);
108
102
  saveTenantLogo( cropper ).then((resp) => {
109
- if (resp.Code === 1) {
110
- Toast.Success('保存成功', { canClose: false });
111
- onCancel();
112
- } else {
113
- Toast.Error(resp.Message, { canClose: false });
114
- }
103
+ handleSuccessSave(resp);
115
104
  });
116
- // axios({headers: {
117
- // 'Content-Type': 'multipart/form-data',
118
- // },
119
- // method: 'post',
120
- // data: cropper,
121
- // url: `${apiServer}/api/v1/${tenantId}/${userid}/tenant/update/logo?format=json&timestamp=${timestamp}`})
122
- // dealSelectFiles(image)
123
105
  } else {
124
106
  saveBrowserIcon( cropper ).then((resp) => {
125
- if (resp.Code === 1) {
126
- Toast.Success('保存成功', { canClose: false });
127
- onCancel();
128
- } else {
129
- Toast.Error(resp.Message, { canClose: false });
130
- }
107
+ handleSuccessSave(resp);
131
108
  });
132
109
  }
133
110
  }
134
111
  };
135
112
 
136
- const [uploadSuccessFile, setUploadSuccessFile] = useState();
137
-
138
-
139
- const dealSelectFiles = (uploadSelectFile) => {
140
-
141
- let uploadStartFiles = []; // 开始上传的文件
142
- let formData = new FormData(); // FormData 对象
143
- let uploadStartFile;
144
- let timestamp = new Date().getTime(); // 给每个文件加一个时间戳
145
- // let uploadFileType = uploadSelectFile.name.substring(uploadSelectFile.name.lastIndexOf('.') + 1);
146
-
147
- uploadStartFile = {
148
- FileName: uploadSelectFile.name,
149
- // FileType: _dealAttachmentType(uploadFileType).FileType,
150
- FileSize: uploadSelectFile.size,
151
- FileLastModified: uploadSelectFile.lastModified,
152
- // IsImage: _dealAttachmentType(uploadFileType).IsImage,
153
- percentComplete: 0,
154
- uploadStatus: 1, // 开始上传
155
- IsSuccess: false,
156
- uid: uuid(),
157
- _smallImageUrl: '',
158
- _bigImageUrl: '',
159
- MediaType: '',
160
- UserId: 0,
161
- MaxDocCount: 0,
162
- DfsPath: '',
163
- ClientUrl: '',
164
- SmallImageUrl: '',
165
- BigImageUrl: '',
166
- DownloadUrl: '',
167
- Msg: '',
168
- AllowUploadAttachmentSize: 50,
169
- Deleteable: true,
170
- requestXHR: new XMLHttpRequest(), //在这创建是为了取消用
171
- };
172
-
173
- // uploadStartFiles.push(uploadStartFile);
174
- // _dealUploadStart(uploadStartFiles); // 处理开始上传的文件
175
- formData.append('file', uploadSelectFile);
176
- let url = `${apiServer}/api/v1/${tenantId}/${userid}/tenant/update/logo`;
177
- _dealUploadXHRRequest(formData, url, uploadStartFile);
178
- };
179
-
180
- /**
181
- * 处理文件上传请求
182
- *
183
- * @formData
184
- * @url 上传文件请求地址
185
- * @uploadStartFile 上传的文件
186
- *
187
- * @memberof Upload
188
- */
189
- const _dealUploadXHRRequest = (formData: any, url: string, uploadStartFile) => {
190
- let xhr = uploadStartFile.requestXHR;
191
- xhr.onreadystatechange = () => {
192
- if (xhr.readyState == 4 && xhr.status == 200) {
193
- let result = Object.assign({}, { ...JSON.parse(xhr.responseText).Result[0] }); // 上传成功接口返回数据
194
- result.percentComplete = 100;
195
- result.IsSuccess = !!result.IsSuccess;
196
- result.uploadStatus = result.IsSuccess ? 3 : 4; // 3上传成功;4上传失败
197
- // _dealUploadSuccess({ ...uploadStartFile, ...result });
198
- }
199
- };
200
- xhr.open('POST', url, true);
201
- xhr.send(formData); //开始上传,发送form数据
202
- };
203
-
204
113
  const handleEnterAgain = () => {
205
114
  setIsEnter(true);
206
115
  }
@@ -209,6 +118,11 @@ const ChangePhoto = (props: Props) => {
209
118
  setIsEnter(false);
210
119
  }
211
120
 
121
+ const handleCancel = () => {
122
+ onCancel();
123
+ setImage('');
124
+ }
125
+
212
126
  return (
213
127
  <Dialog
214
128
  visible={visible}
@@ -219,8 +133,8 @@ const ChangePhoto = (props: Props) => {
219
133
  title={'上传头像'}
220
134
  noHeadLine
221
135
  maskClosable={false}
222
- onClose={onCancel}
223
- onCancel={onCancel}
136
+ onClose={handleCancel}
137
+ onCancel={handleCancel}
224
138
  okText="保存"
225
139
  noFooterLine
226
140
  onOk={handleSaveInfo}
@@ -238,19 +152,9 @@ const ChangePhoto = (props: Props) => {
238
152
  accept={item?.accept}
239
153
  />
240
154
  <span className={`${preCls}__upload-right-title`}>点击上传</span>
241
- <ConditionRender condition={type === 'person'}>
242
- <span className={`${preCls}__upload-right-tips`}>
243
- {item?.tips}
244
- </span>
245
- </ConditionRender>
246
- <ConditionRender condition={type === 'enterprise'}>
247
- <span className={`${preCls}__upload-right-tips`}>
248
- {item?.tips}
249
- </span>
250
- </ConditionRender>
251
- <ConditionRender condition={type === 'browser'}>
252
- <span className={`${preCls}__upload-right-tips`}>{item?.tips}</span>
253
- </ConditionRender>
155
+ <span className={`${preCls}__upload-right-tips`}>
156
+ {item?.tips}
157
+ </span>
254
158
  </div>
255
159
  </div>
256
160
  <div className={`${preCls}__upload-left`}>
@@ -259,11 +163,7 @@ const ChangePhoto = (props: Props) => {
259
163
  <div className={`${preCls}__upload-left-box2`} />
260
164
  <div className={`${preCls}__upload-left-box3`} />
261
165
  </ConditionRender>
262
- <ConditionRender condition={type === 'enterprise'}>
263
- <div className={`${preCls}__upload-left-box`} />
264
- <span className={`${preCls}__upload-left-preview`}>{item?.previewTitle}</span>
265
- </ConditionRender>
266
- <ConditionRender condition={type === 'browser'}>
166
+ <ConditionRender condition={type === 'enterprise' || type === 'browser'}>
267
167
  <div className={`${preCls}__upload-left-box`} />
268
168
  <span className={`${preCls}__upload-left-preview`}>{item?.previewTitle}</span>
269
169
  </ConditionRender>
@@ -278,22 +178,19 @@ const ChangePhoto = (props: Props) => {
278
178
  responsive={true}
279
179
  autoCropArea={item?.autoCropArea}
280
180
  checkOrientation={true}
281
- minCropBoxHeight={10}
282
- minCropBoxWidth={10}
181
+ minCropBoxHeight={item?.minCropBoxHeight}
182
+ minCropBoxWidth={item?.minCropBoxWidth}
283
183
  initialAspectRatio={item?.initialAspectRatio}
284
184
  guides={true}
285
185
  preview=".img-preview"
286
186
  ref={cropperRef}
287
- // onInitialized={(instance) => {
288
- // setCropper(instance);
289
- // }}
290
187
  crop={onCrop}
291
188
  />
292
189
  <div className={classNames(`${preCls}__preview-box`, {[`${preCls}__preview-box-bgc`]:type === "enterprise"}, {[`${preCls}__preview-box-browser`]:type === "browser"})}>
293
190
  <ConditionRender condition={type === "person"}>
294
- <img src={cropData} className={`${preCls}__preview-box1`} />
295
- <img src={cropData} className={`${preCls}__preview-box2`} />
296
- <img src={cropData} className={`${preCls}__preview-box3`} />
191
+ <img src={cropData} className={`${preCls}__preview-box1`} />
192
+ <img src={cropData} className={`${preCls}__preview-box2`} />
193
+ <img src={cropData} className={`${preCls}__preview-box3`} />
297
194
  </ConditionRender>
298
195
  <ConditionRender condition={type === "enterprise"}>
299
196
  <img src={cropData} className={`${preCls}__preview-enterprise-img`}/>
@@ -20,7 +20,7 @@ interface Props {
20
20
  forceRender?: boolean;
21
21
  destroyPopupOnHide?: boolean;
22
22
  onPopupVisibleChange?: Function;
23
- children?: JSX.Element[];
23
+ children?: any;
24
24
  }
25
25
 
26
26
  export default forwardRef((props: Props, ref) => {
@@ -120,7 +120,7 @@ export const searchGroups = ({ searchKey }) => {
120
120
  }
121
121
 
122
122
  export const getDuties = () => {
123
- return axios.get(`${requestDomain()}/api/v1/${tenantId}/${userId}/position/get?status=1&pageNum=1&pageSize=100`)
123
+ return axios.get(`${requestDomain()}/api/v1/${tenantId}/${userId}/position/get?status=1&pageNum=1&pageSize=1000`)
124
124
  .then(res => {
125
125
  return res.data;
126
126
  })
@@ -2,14 +2,14 @@
2
2
  background: #ffffff;
3
3
  box-shadow: 0px 0px 8px 0px rgba(127, 145, 180, 0.1);
4
4
  border-radius: 12px;
5
- padding: 20px 32px;
5
+ padding: 20px 32px 30px 36px;
6
6
  font-family: -apple-system, Arial, Verdana, Helvetica Neue, Helvetica,
7
7
  sans-serif, PingFang SC, Microsoft YaHei;
8
8
  &__header {
9
9
  display: flex;
10
10
  align-items: center;
11
11
  justify-content: space-between;
12
- margin-bottom: 12px;
12
+ margin-bottom: 20px;
13
13
  &-title {
14
14
  font-size: 16px;
15
15
  font-weight: 600;
@@ -26,10 +26,25 @@
26
26
  border-radius: 2px;
27
27
  display: inline-block;
28
28
  position: absolute;
29
- left: -8px;
29
+ left: -12px;
30
30
  top: 3px;
31
31
  }
32
32
  }
33
+ .titaui-rect-btn--primary {
34
+ font-size: 14px;
35
+ font-weight: normal;
36
+ color: #2879FF;
37
+ line-height: 26px;
38
+ background: rgba(40, 121, 255, 0.2);
39
+ &:hover {
40
+ color: #fff;
41
+ background-color: #2879ff;
42
+ }
43
+ }
44
+ .titaui-rect-btn--normal {
45
+ height: 28px;
46
+ min-width: 64px;
47
+ }
33
48
  &-btn {
34
49
  width: 64px;
35
50
  height: 28px;
@@ -49,6 +64,12 @@
49
64
  }
50
65
  &__form {
51
66
  width: 342px;
67
+ .form-field-input__border--disabled input:disabled {
68
+ color: #6F7886;
69
+ }
70
+ }
71
+ .form-field-input__label {
72
+ margin-bottom: 4px;
52
73
  }
53
74
  .form-field-input__border {
54
75
  padding: 0;
@@ -59,6 +80,8 @@
59
80
  font-weight: 600;
60
81
  }
61
82
  .form-field-input__input {
83
+ font-size: 12px;
84
+ line-height: 18px;
62
85
  background-color: #fff;
63
86
  }
64
87
  .form-field-input__border--disabled input:disabled {
@@ -1,7 +1,8 @@
1
1
  import React, { FC, useState, useRef, useEffect } from "react";
2
2
  import { getUserInfoFun } from '../../request-api';
3
+ import { RectBtn } from "../../../../components/button";
3
4
  import Form from "../../../../components/form";
4
- import EditModle from '../edit-info'
5
+ import EditModle from '../edit-base-info'
5
6
  import "./index.scss";
6
7
 
7
8
  const {Fields} = Form
@@ -20,6 +21,10 @@ const BaseInfo: FC = () => {
20
21
  setVisible(false);
21
22
  }
22
23
 
24
+ const handleSuccessEditBaseInfo = (userInfo) => {
25
+ setUserInfo({...userInfo});
26
+ }
27
+
23
28
  useEffect(() => {
24
29
  getUserInfoFun().then((resp) => {
25
30
  if (resp.Code === 1 && resp.Data) {
@@ -32,8 +37,12 @@ const BaseInfo: FC = () => {
32
37
  <div className={prefix}>
33
38
  <div className={`${prefix}__header`}>
34
39
  <span className={`${prefix}__header-title`}>基本信息</span>
35
- <span className={`${prefix}__header-btn`} onClick={handleClickEdit}>编辑</span>
36
- <EditModle visible={visible} onCancel={handleCancelEdit}/>
40
+ <RectBtn
41
+ type={"primary"}
42
+ text={"编辑"}
43
+ onClick={handleClickEdit}
44
+ />
45
+ <EditModle visible={visible} onCancel={handleCancelEdit} handleSuccessEditBaseInfo={handleSuccessEditBaseInfo}/>
37
46
  </div>
38
47
  <div className={`${prefix}__form`}>
39
48
  <Form ref={formRef}>
@@ -5,7 +5,7 @@
5
5
  padding: 0 32px;
6
6
  }
7
7
  .form-field-input__label {
8
- width: 62px;
8
+ min-width: 64px;
9
9
  }
10
10
  .form-field-input__label-text {
11
11
  font-size: 14px;
@@ -11,7 +11,7 @@ const { Fields } = Form;
11
11
  const prefix = "titaui-edit-personal-info"
12
12
 
13
13
  const EditBaseInfo = (props) => {
14
- const { visible, onCancel } = props;
14
+ const { visible, onCancel, handleSuccessEditBaseInfo } = props;
15
15
 
16
16
  const modalRef = useRef<any>();
17
17
  const formContainerRef = useRef<any>();
@@ -53,10 +53,8 @@ const EditBaseInfo = (props) => {
53
53
  saveUserInfo({ data: userInfo }).then((resp) => {
54
54
  if (resp.Code === 1) {
55
55
  Toast.Success('更新成功', { canClose: false });
56
+ handleSuccessEditBaseInfo(userInfo);
56
57
  onCancel();
57
- setTimeout(() => {
58
- window.location.reload();
59
- }, 2000)
60
58
  } else {
61
59
  Toast.Error(resp.Message, { canClose: false });
62
60
  }
@@ -2,14 +2,14 @@
2
2
  background: #ffffff;
3
3
  box-shadow: 0px 0px 8px 0px rgba(127, 145, 180, 0.1);
4
4
  border-radius: 12px;
5
- padding: 20px 32px;
5
+ padding: 20px 32px 30px 36px;
6
6
  margin-top: 10px;
7
7
  font-family: -apple-system, Arial, Verdana, Helvetica Neue, Helvetica, sans-serif, PingFang SC, Microsoft YaHei;
8
8
  &__header {
9
9
  display: flex;
10
10
  align-items: center;
11
11
  justify-content: space-between;
12
- margin-bottom: 12px;
12
+ margin-bottom: 20px;
13
13
  &-title {
14
14
  font-size: 16px;
15
15
  font-weight: 600;
@@ -26,7 +26,7 @@
26
26
  border-radius: 2px;
27
27
  display: inline-block;
28
28
  position: absolute;
29
- left: -8px;
29
+ left: -12px;
30
30
  top: 3px;
31
31
  }
32
32
  }
@@ -46,11 +46,23 @@
46
46
  color: #FFFFFF;
47
47
  line-height: 18px;
48
48
  }
49
- & > span {
50
- margin-left: 24px;
49
+ &-tip {
50
+ margin-left: 32px;
51
51
  font-size: 12px;
52
52
  color: #A4ACB9;
53
53
  line-height: 20px;
54
+ position: relative;
55
+ &::before {
56
+ display: block;
57
+ content: '';
58
+ width: 4px;
59
+ height: 4px;
60
+ background: #A4ACB9;
61
+ position: absolute;
62
+ top: 7px;
63
+ left: -12px;
64
+ border-radius: 50%;
65
+ }
54
66
  }
55
67
  }
56
68
  .titaui-pc-avator-container {
@@ -1,5 +1,4 @@
1
1
  import React, { useState, useEffect } from 'react';
2
- import classNames from 'classnames';
3
2
  import { getUserInfo } from '../../../../utils/bs-global';
4
3
  import Avatar from '../../../../components/avatar';
5
4
  import ChangePhotoModal from '../../../../components/upload-photo-modal';
@@ -12,6 +11,7 @@ const { Id, Name, UserAvatar } = getUserInfo();
12
11
  const PersonPhoto = () => {
13
12
 
14
13
  const [visible, setVisible] = useState(false);
14
+ const [avatar, setAvatar] = useState('');
15
15
 
16
16
  const handleChangePhoto = () => {
17
17
  setVisible(true);
@@ -21,6 +21,14 @@ const PersonPhoto = () => {
21
21
  setVisible(false);
22
22
  }
23
23
 
24
+ const handleSuccessUploadPhoto = (image) => {
25
+ setAvatar(image);
26
+ }
27
+
28
+ useEffect(() => {
29
+ setAvatar(UserAvatar.Large)
30
+ }, [])
31
+
24
32
  return (
25
33
  <div className={prefix}>
26
34
  <div className={`${prefix}__header`}>
@@ -31,7 +39,7 @@ const PersonPhoto = () => {
31
39
  userId={Id}
32
40
  name={Name}
33
41
  color={UserAvatar.Color}
34
- src={UserAvatar.Large}
42
+ src={avatar}
35
43
  size={{
36
44
  width: 160,
37
45
  textNum: 1,
@@ -39,9 +47,9 @@ const PersonPhoto = () => {
39
47
  }}
40
48
  onClick={handleChangePhoto}
41
49
  />
42
- <span 建议图片最小尺寸 150*150px</span>
50
+ <span className={`${prefix}__main-tip`}>建议图片最小尺寸 150*150px</span>
43
51
  </div>
44
- <ChangePhotoModal visible={visible} onCancel={handleCancel} type="person"/>
52
+ <ChangePhotoModal visible={visible} onCancel={handleCancel} type="person" handleSuccessUploadPhoto={handleSuccessUploadPhoto}/>
45
53
  </div>
46
54
  );
47
55
  };
@@ -1,89 +0,0 @@
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
- }
8
-
9
- .edit-base-info-input__label {
10
- width: 56px;
11
- height: 22px;
12
- font-size: 14px;
13
- margin-bottom: 5px;
14
- margin-right: 20px;
15
- font-family: -apple-system, Arial, Verdana, Helvetica Neue, Helvetica, sans-serif, PingFang SC, Microsoft YaHei;
16
- font-weight: 400;
17
- line-height: 22px;
18
- }
19
-
20
- .edit-base-info-input__label-text {
21
- color: #89919F;
22
- }
23
-
24
- .edit-base-info-input__label-require {
25
- color: red;
26
- }
27
-
28
- .edit-base-info-input__border {
29
- flex: 1;
30
- padding: 6px 12px;
31
- transition: all 0.2s;
32
- border: 1px solid #e9ecf0;
33
- box-sizing: border-box;
34
- border-radius: 8px;
35
- }
36
-
37
- .edit-base-info-input__border--disabled {
38
- background-color: #fafafa;
39
- cursor: not-allowed;
40
- }
41
-
42
- .edit-base-info-input__border--disabled input:disabled {
43
- background-color: #fafafa;
44
- cursor: not-allowed;
45
- color: #3f475594;
46
- }
47
-
48
- .edit-base-info-input__border--error {
49
- box-shadow: inset 0px 0px 4px 0px rgba(240, 94, 94, 0.3) !important;
50
- border: 1px solid #f05e5e !important;
51
- }
52
-
53
- .edit-base-info-input__border--active {
54
- box-shadow: inset 0px 0px 4px 0px rgba(40, 121, 255, 0.3);
55
- border: 1px solid #2879ff;
56
- }
57
-
58
- .edit-base-info-input__input {
59
- display: inline-block;
60
- padding: 0;
61
- width: calc(100% - 12px);
62
- font-size: 14px;
63
- font-family: -apple-system, Arial, Verdana, Helvetica Neue, Helvetica, sans-serif, PingFang SC, Microsoft YaHei;
64
- font-weight: 400;
65
- color: #3f4755;
66
- height: 22px;
67
- line-height: inherit;
68
- border: none;
69
- }
70
-
71
- .edit-base-info-input__input::-webkit-input-placeholder {
72
- color: #bfc7d5;
73
- font-weight: unset;
74
- }
75
-
76
- .edit-base-info-input__input::-moz-placeholder {
77
- color: #bfc7d5;
78
- font-weight: unset;
79
- }
80
-
81
- .edit-base-info-input__input:-moz-placeholder {
82
- color: #bfc7d5;
83
- font-weight: unset;
84
- }
85
-
86
- .edit-base-info-input__input:-ms-input-placeholder {
87
- color: #bfc7d5;
88
- font-weight: unset;
89
- }