@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.
Files changed (61) hide show
  1. package/lib/components/dialog/index.css +7 -1
  2. package/lib/components/dialog/index.js +7 -6
  3. package/lib/components/form/form-fields/input/index.css +22 -7
  4. package/lib/components/form/form-fields/input/index.js +11 -8
  5. package/lib/components/form/form-fields/input-verification-code/index.css +117 -0
  6. package/lib/components/form/form-fields/input-verification-code/index.js +230 -0
  7. package/lib/components/form/form-fields/password/index.css +2 -2
  8. package/lib/components/form/form-fields/radios/index.js +1 -1
  9. package/lib/components/form/index.js +4 -1
  10. package/lib/components/nav-top/components/user-message/components/empty/index.js +4 -2
  11. package/lib/components/nav-top/components/user-message/msg/index.js +1 -1
  12. package/lib/components/table/index.css +4 -0
  13. package/lib/components/table/index.js +3 -0
  14. package/lib/components/upload/index.js +2 -2
  15. package/lib/components/upload-photo-modal/constant.js +29 -0
  16. package/lib/components/upload-photo-modal/img/browser-preview-bgc.png +0 -0
  17. package/lib/components/upload-photo-modal/index.css +288 -0
  18. package/lib/components/upload-photo-modal/index.js +439 -0
  19. package/lib/components/upload-photo-modal/request-api.js +62 -0
  20. package/lib/components/user-selector/request-apis.js +1 -1
  21. package/lib/index.js +8 -0
  22. package/lib/pages/personal-info/components/base-info/index.css +36 -1
  23. package/lib/pages/personal-info/components/base-info/index.js +22 -90
  24. package/lib/pages/personal-info/components/edit-info/index.css +19 -0
  25. package/lib/pages/personal-info/components/edit-info/index.js +209 -0
  26. package/lib/pages/personal-info/components/edit-info/input/index.css +89 -0
  27. package/lib/pages/personal-info/components/edit-info/input/index.js +199 -0
  28. package/lib/pages/personal-info/components/person-photo/index.css +88 -0
  29. package/lib/pages/personal-info/components/person-photo/index.js +86 -0
  30. package/lib/pages/personal-info/index.js +3 -1
  31. package/package.json +3 -1
  32. package/src/components/dialog/index.js +2 -1
  33. package/src/components/dialog/index.scss +6 -1
  34. package/src/components/form/form-fields/input/index.scss +19 -7
  35. package/src/components/form/form-fields/input/index.tsx +9 -4
  36. package/src/components/form/form-fields/input-verification-code/index.scss +108 -0
  37. package/src/components/form/form-fields/input-verification-code/index.tsx +171 -0
  38. package/src/components/form/form-fields/password/index.scss +2 -2
  39. package/src/components/form/form-fields/radios/index.tsx +2 -2
  40. package/src/components/form/index.tsx +2 -0
  41. package/src/components/nav-top/components/user-message/components/empty/index.tsx +3 -2
  42. package/src/components/nav-top/components/user-message/msg/index.tsx +1 -1
  43. package/src/components/table/index.js +1 -0
  44. package/src/components/table/index.scss +5 -0
  45. package/src/components/upload/index.tsx +4 -4
  46. package/src/components/upload-photo-modal/constant.ts +27 -0
  47. package/src/components/upload-photo-modal/img/browser-preview-bgc.png +0 -0
  48. package/src/components/upload-photo-modal/index.scss +258 -0
  49. package/src/components/upload-photo-modal/index.tsx +331 -0
  50. package/src/components/upload-photo-modal/request-api.ts +33 -0
  51. package/src/components/user-selector/request-apis.js +1 -1
  52. package/src/index.js +1 -0
  53. package/src/pages/personal-info/components/base-info/index.scss +30 -1
  54. package/src/pages/personal-info/components/base-info/index.tsx +26 -97
  55. package/src/pages/personal-info/components/edit-info/index.scss +20 -0
  56. package/src/pages/personal-info/components/edit-info/index.tsx +166 -0
  57. package/src/pages/personal-info/components/edit-info/input/index.scss +82 -0
  58. package/src/pages/personal-info/components/edit-info/input/index.tsx +145 -0
  59. package/src/pages/personal-info/components/person-photo/index.scss +80 -0
  60. package/src/pages/personal-info/components/person-photo/index.tsx +49 -0
  61. package/src/pages/personal-info/index.tsx +2 -0
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import classNames from 'classnames';
3
3
  import empty from '../../images/empty-img.svg';
4
4
  import ConditionRender from '../../../../../condition-render';
5
+ import { getLocale } from '../../../../../../utils/getLocale';
5
6
  import './index.scss';
6
7
 
7
8
  const preCls = 'titaui-user-message-msg-empty';
@@ -12,10 +13,10 @@ const Empty = (props) => {
12
13
  return (
13
14
  <div className={classNames(`${preCls}__empty`)}>
14
15
  <img src={empty} />
15
- <div className={classNames(`${preCls}__empty-text`)}>暂时没有需要处理的消息哦~</div>
16
+ <div className={classNames(`${preCls}__empty-text`)}>{getLocale('Menu_Title_NoNews')}</div>
16
17
  <ConditionRender condition={tabPath !== null}>
17
18
  <a target="_blank" href={tabPath} className={classNames(`${preCls}__empty-all`)}>
18
- 查看全部消息
19
+ {getLocale('Menu_Title_ViewNews')}
19
20
  </a>
20
21
  </ConditionRender>
21
22
  </div>
@@ -73,7 +73,7 @@ const UserMessage = (props) => {
73
73
  tab={
74
74
  <TabTitle
75
75
  data={(getData("messageIndicator"))-(getData("mLeaveandComment"))}
76
- title="通知"
76
+ title={getLocale('Menu_Title_Notice')}
77
77
  tab={"informs"}
78
78
  />
79
79
  }
@@ -183,6 +183,7 @@ export default props => {
183
183
  }
184
184
  </div>
185
185
  {!!total&&<Pagination
186
+ className={classNames({[`${preCls}__pagination-only-one`]:pageSize>total})}
186
187
  pageSize={pageSize}
187
188
  total={total}
188
189
  current={pageNum}
@@ -104,4 +104,9 @@
104
104
  font-size: 12px;
105
105
  }
106
106
  }
107
+ &__pagination-only-one{
108
+ .titaui-pagination__select-selector{
109
+ margin-right: 26px;
110
+ }
111
+ }
107
112
  }
@@ -170,8 +170,8 @@ export default class Upload extends PureComponent<Props, State> {
170
170
  return;
171
171
  };
172
172
  uploadStartFiles.push(uploadStartFile);
173
- this._dealUploadStart(uploadStartFiles); // 处理开始上传的文件
174
- formData.append('file', element);
173
+ this._dealUploadStart(uploadStartFiles); // 处理开始上传的文件
174
+ formData.append('file', element);
175
175
  let url = action || getApiUrl(`Upload/PostFiles?format=json&timestamp=${timestamp}`);
176
176
  this._dealUploadXHRRequest(formData, url, uploadStartFile);
177
177
  });
@@ -196,7 +196,7 @@ export default class Upload extends PureComponent<Props, State> {
196
196
  let xhr = uploadStartFile.requestXHR;
197
197
  xhr.onreadystatechange = () => {
198
198
  if (xhr.readyState == 4 && xhr.status == 200) {
199
- let result = Object.assign({}, { ...JSON.parse(xhr.responseText).Result[0] }); // 上传成功接口返回数据
199
+ let result = Object.assign({}, { ...JSON.parse(xhr.responseText).Result[0] }); // 上传成功接口返回数据
200
200
  result.percentComplete = 100;
201
201
  result.IsSuccess = !!result.IsSuccess;
202
202
  result.uploadStatus = result.IsSuccess ? 3 : 4; // 3上传成功;4上传失败
@@ -226,7 +226,7 @@ export default class Upload extends PureComponent<Props, State> {
226
226
  }
227
227
  });
228
228
  this.setState({ uploadSuccessFiles });
229
- };
229
+ };
230
230
  xhr.open('POST', url, true);
231
231
  xhr.send(formData); //开始上传,发送form数据
232
232
  };
@@ -0,0 +1,27 @@
1
+
2
+ export const List = [
3
+ {
4
+ id: 'person',
5
+ accept: '.jpg,.jpeg,.gif,.png',
6
+ autoCropArea: 0.5,
7
+ initialAspectRatio: 1,
8
+ tips: '仅支持 jpg、jpeg、gif、png 格式 建议图片最小尺寸 150*150px',
9
+ previewTitle: '预览',
10
+ },
11
+ {
12
+ id: 'enterprise',
13
+ accept: '.jpg,.jpeg,.gif,.png',
14
+ autoCropArea: 1,
15
+ initialAspectRatio: 5,
16
+ tips: '建议 logo 尺寸 400*80 logo 最佳适配颜色为白色 仅支持 jpg、jpeg、gif、png 格式',
17
+ previewTitle: 'logo 预览',
18
+ },
19
+ {
20
+ id: 'browser',
21
+ accept: '',
22
+ autoCropArea: 0.5,
23
+ initialAspectRatio: 1,
24
+ tips: '图标尺寸 18*18,超过将被浏览器压缩',
25
+ previewTitle: '浏览器图标预览',
26
+ }
27
+ ];
@@ -0,0 +1,258 @@
1
+ .tita-ui-change-person-photo {
2
+ &__img {
3
+ display: flex;
4
+ justify-content: space-between;
5
+ box-sizing: border-box;
6
+ padding: 0 32px;
7
+ .cropper-wrap-box {
8
+ border-radius: 12px;
9
+ }
10
+ .cropper-canvas {
11
+ border-radius: 12px;
12
+ }
13
+ .cropper-crop {
14
+ border-radius: 12px;
15
+ }
16
+ }
17
+ &__upload {
18
+ display: flex;
19
+ justify-content: space-between;
20
+ box-sizing: border-box;
21
+ padding: 0 32px;
22
+
23
+ &-preview {
24
+ display: flex;
25
+ flex-direction: column;
26
+ align-items: center;
27
+ }
28
+ &-right {
29
+ position: relative;
30
+ width: 240px;
31
+ height: 240px;
32
+ background: #f0f2f5;
33
+ border-radius: 12px;
34
+ box-sizing: border-box;
35
+ padding: 30px;
36
+ display: flex;
37
+ flex-direction: column;
38
+ align-items: center;
39
+ &-input {
40
+ position: absolute;
41
+ top: 76px;
42
+ width: 240px;
43
+ height: 60px;
44
+ opacity: 0;
45
+ cursor: pointer;
46
+ }
47
+ &-icon {
48
+ cursor: pointer;
49
+ margin-top: 46px;
50
+ font-size: 32px;
51
+ color: #2879ff;
52
+ }
53
+ &-title {
54
+ margin-top: 4px;
55
+ font-size: 12px;
56
+ font-weight: 400;
57
+ color: #2879ff;
58
+ line-height: 18px;
59
+ cursor: pointer;
60
+ }
61
+ &-tips {
62
+ margin-top: 8px;
63
+ font-size: 12px;
64
+ font-weight: 400;
65
+ color: #a4acb9;
66
+ line-height: 18px;
67
+ text-align: center;
68
+ }
69
+ }
70
+ &-left {
71
+ display: flex;
72
+ flex-direction: column;
73
+ align-items: center;
74
+ margin-left: 36px;
75
+ width: 136px;
76
+ height: 100%;
77
+ &-box1 {
78
+ width: 136px;
79
+ height: 136px;
80
+ background: #f0f2f5;
81
+ border-radius: 50%;
82
+ }
83
+ &-box2 {
84
+ width: 48px;
85
+ height: 48px;
86
+ background: #f0f2f5;
87
+ border-radius: 50%;
88
+ margin-top: 14px;
89
+ }
90
+ &-box3 {
91
+ width: 28px;
92
+ height: 28px;
93
+ background: #f0f2f5;
94
+ border-radius: 50%;
95
+ margin-top: 14px;
96
+ }
97
+ &-box {
98
+ width: 160px;
99
+ height: 32px;
100
+ background: #F0F2F5;
101
+ border-radius: 2px;
102
+ border: 1px solid #E9ECF0;
103
+ }
104
+ &-preview {
105
+ margin-top: 8px;
106
+ font-size: 14px;
107
+ font-weight: 400;
108
+ color: #3F4755;
109
+ line-height: 22px;
110
+ }
111
+ }
112
+ }
113
+ &__preview {
114
+ display: flex;
115
+ align-items: center;
116
+ flex-direction: column;
117
+ overflow: hidden;
118
+ &-box {
119
+ position: relative;
120
+ display: flex;
121
+ align-items: center;
122
+ flex-direction: column;
123
+ &-bgc {
124
+ width: 160px;
125
+ height: 32px;
126
+ background: #2879FF;
127
+ border-radius: 2px;
128
+ border: 1px solid #E9ECF0;
129
+ }
130
+ &-browser {
131
+ margin-left: 16px;
132
+ width: 176px;
133
+ height: 48px;
134
+ background: #F0F2F5;
135
+ border-radius: 2px;
136
+ border: 1px solid #E9ECF0;
137
+ background-image: url('./img/browser-preview-bgc.png');
138
+ background-size: 170px 28px;
139
+ background-position: center center;
140
+ background-repeat: no-repeat;
141
+ }
142
+ }
143
+ &-box1 {
144
+ width: 136px;
145
+ height: 136px;
146
+ border-radius: 50%;
147
+ }
148
+ &-box2 {
149
+ margin-top: 14px;
150
+ width: 48px;
151
+ height: 48px;
152
+ border-radius: 50%;
153
+ }
154
+ &-box3 {
155
+ margin-top: 14px;
156
+ width: 28px;
157
+ height: 28px;
158
+ border-radius: 50%;
159
+ }
160
+ &-enterprise {
161
+ &-img {
162
+ position: absolute;
163
+ top: 1px;
164
+ right: 45px;
165
+ width: 70px;
166
+ height: 28px;
167
+ }
168
+ &-title {
169
+ margin-top: 36px;
170
+ font-size: 14px;
171
+ font-weight: 400;
172
+ color: #3F4755;
173
+ line-height: 22px;
174
+ }
175
+ }
176
+ &-browser {
177
+ &-img {
178
+ position: absolute;
179
+ top: 15px;
180
+ left: 16px;
181
+ width: 18px;
182
+ height: 18px;
183
+ }
184
+ &-name {
185
+ position: absolute;
186
+ top: 15px;
187
+ right:10px;
188
+ font-size: 12px;
189
+ font-weight: 400;
190
+ color: #3F4755;
191
+ line-height: 18px;
192
+ }
193
+ &-title {
194
+ margin-top: 58px;
195
+ font-size: 14px;
196
+ font-weight: 400;
197
+ color: #3F4755;
198
+ line-height: 22px;
199
+ }
200
+ }
201
+ &-title {
202
+ margin-top: 8px;
203
+ font-size: 14px;
204
+ font-weight: 400;
205
+ color: #6f7886;
206
+ line-height: 22px;
207
+ }
208
+ }
209
+ &__title {
210
+ position: relative;
211
+ display: flex;
212
+ align-items: center;
213
+ justify-content: space-between;
214
+ box-sizing: border-box;
215
+ padding: 8px 32px 0 32px;
216
+ &-input {
217
+ display: none;
218
+ position: absolute;
219
+ width: 240px;
220
+ height: 30px;
221
+ &--show {
222
+ display: block;
223
+ opacity: 0;
224
+ cursor: pointer;
225
+ width: 56px;
226
+ height: 22px;
227
+ position: absolute;
228
+ left: 124px;
229
+ }
230
+ }
231
+ &-again {
232
+ margin-left: 92px;
233
+ margin-top: 8px;
234
+ font-size: 14px;
235
+ font-weight: 400;
236
+ color: #bfc7d5;
237
+ line-height: 22px;
238
+ &--show {
239
+ cursor: pointer;
240
+ color: #2879ff;
241
+ &:hover {
242
+ color: #DFE3EA;
243
+ }
244
+ }
245
+ &--hover {
246
+ color: #DFE3EA;
247
+ }
248
+ }
249
+ &-preview {
250
+ margin-right: 54px;
251
+ margin-top: 8px;
252
+ font-size: 14px;
253
+ font-weight: 400;
254
+ color: #6f7886;
255
+ line-height: 22px;
256
+ }
257
+ }
258
+ }
@@ -0,0 +1,331 @@
1
+ import React, { useState, useRef } from 'react';
2
+ import classNames from 'classnames';
3
+ import Cropper from 'react-cropper';
4
+ import 'cropperjs/dist/cropper.css';
5
+ import Toast from '../../components/toast';
6
+ import ConditionRender from '../condition-render';
7
+ import { saveUserInfo, saveTenantLogo, saveBrowserIcon, saveUserPhoto } from './request-api';
8
+ import Dialog from '../../components/dialog';
9
+ import { List } from './constant'
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
+
20
+ const preCls = 'tita-ui-change-person-photo';
21
+
22
+ interface Props {
23
+ visible: boolean;
24
+ type: string; // person enterprise browser
25
+ onCancel: Function;
26
+ }
27
+
28
+ const ChangePhoto = (props: Props) => {
29
+ const { visible, onCancel, type = 'browser' } = props;
30
+
31
+ const modalRef = useRef<any>();
32
+
33
+ const [ image, setImage ] = useState('');
34
+ const [ cropper, setCropper ] = useState<any>();
35
+ 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('')
40
+
41
+ const cropperRef = useRef<HTMLImageElement>(null);
42
+
43
+ const onChange = (e: any) => {
44
+ e.preventDefault();
45
+ let files;
46
+ if (e.dataTransfer) {
47
+ files = e.dataTransfer.files;
48
+ } else if (e.target) {
49
+ files = e.target.files;
50
+ }
51
+ setFileName(files[0].name)
52
+ const reader = new FileReader();
53
+ reader.onload = () => {
54
+ setImage(reader.result as any);
55
+ };
56
+ reader.readAsDataURL(files[0]);
57
+ };
58
+
59
+
60
+ const dataURLtoFile = (dataurl, filename) => {
61
+ var arr = dataurl.split(','), mime = arr[0].match(/:(.*?);/)[1],
62
+ bstr = atob(arr[1]), n = bstr.length, u8arr = new Uint8Array(n);
63
+ while(n--){
64
+ u8arr[n] = bstr.charCodeAt(n);
65
+ }
66
+ return new File([u8arr], filename, {type:mime});
67
+ }
68
+
69
+
70
+ const onCrop = () => {
71
+
72
+ const imageElement: any = cropperRef.current;
73
+ const cropper: any = imageElement.cropper;
74
+
75
+ 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
+
83
+
84
+ let formData = new FormData();
85
+
86
+ formData.append('file', newFile);
87
+
88
+ console.log(formData);
89
+ setCropper(formData);
90
+ };
91
+
92
+ const handleSaveInfo = () => {
93
+ let timestamp = new Date().getTime(); // 给每个文件加一个时间戳
94
+ if (!image) {
95
+ return;
96
+ } else {
97
+ if(type === "person") {
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
+ }
105
+ });
106
+ } else if(type === "enterprise") {
107
+ // console.log(cropper);
108
+ 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
+ }
115
+ });
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
+ } else {
124
+ 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
+ }
131
+ });
132
+ }
133
+ }
134
+ };
135
+
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
+ const handleEnterAgain = () => {
205
+ setIsEnter(true);
206
+ }
207
+
208
+ const handleLeaveAgain = () => {
209
+ setIsEnter(false);
210
+ }
211
+
212
+ return (
213
+ <Dialog
214
+ visible={visible}
215
+ ref={modalRef}
216
+ width={480}
217
+ mask
218
+ centered
219
+ title={'上传头像'}
220
+ noHeadLine
221
+ maskClosable={false}
222
+ onClose={onCancel}
223
+ onCancel={onCancel}
224
+ okText="保存"
225
+ noFooterLine
226
+ onOk={handleSaveInfo}
227
+ >
228
+ <div className={preCls}>
229
+ {!image ?
230
+ <div className={`${preCls}__upload`}>
231
+ <div className={`${preCls}__upload-preview`}>
232
+ <div className={`${preCls}__upload-right`}>
233
+ <i className={classNames(`${preCls}__upload-right-icon`, 'tu-icon-upload')} />
234
+ <input
235
+ type="file"
236
+ onChange={onChange}
237
+ className={`${preCls}__upload-right-input`}
238
+ accept={item?.accept}
239
+ />
240
+ <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>
254
+ </div>
255
+ </div>
256
+ <div className={`${preCls}__upload-left`}>
257
+ <ConditionRender condition={type === 'person'}>
258
+ <div className={`${preCls}__upload-left-box1`} />
259
+ <div className={`${preCls}__upload-left-box2`} />
260
+ <div className={`${preCls}__upload-left-box3`} />
261
+ </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'}>
267
+ <div className={`${preCls}__upload-left-box`} />
268
+ <span className={`${preCls}__upload-left-preview`}>{item?.previewTitle}</span>
269
+ </ConditionRender>
270
+ </div>
271
+ </div>
272
+ :
273
+ <div className={`${preCls}__img`}>
274
+ <Cropper
275
+ src={image}
276
+ style={{ height: 240, width: 240 }}
277
+ background={false}
278
+ responsive={true}
279
+ autoCropArea={item?.autoCropArea}
280
+ checkOrientation={true}
281
+ minCropBoxHeight={10}
282
+ minCropBoxWidth={10}
283
+ initialAspectRatio={item?.initialAspectRatio}
284
+ guides={true}
285
+ preview=".img-preview"
286
+ ref={cropperRef}
287
+ // onInitialized={(instance) => {
288
+ // setCropper(instance);
289
+ // }}
290
+ crop={onCrop}
291
+ />
292
+ <div className={classNames(`${preCls}__preview-box`, {[`${preCls}__preview-box-bgc`]:type === "enterprise"}, {[`${preCls}__preview-box-browser`]:type === "browser"})}>
293
+ <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`} />
297
+ </ConditionRender>
298
+ <ConditionRender condition={type === "enterprise"}>
299
+ <img src={cropData} className={`${preCls}__preview-enterprise-img`}/>
300
+ <span className={`${preCls}__preview-enterprise-title`}>{item?.previewTitle}</span>
301
+ </ConditionRender>
302
+ <ConditionRender condition={type === "browser"}>
303
+ <img src={cropData} className={`${preCls}__preview-browser-img`}/>
304
+ <span className={`${preCls}__preview-browser-name`}>一体化人才管理云平台</span>
305
+ <span className={`${preCls}__preview-browser-title`}>{item?.previewTitle}</span>
306
+ </ConditionRender>
307
+ </div>
308
+ </div>
309
+ }
310
+ <div className={`${preCls}__title`}>
311
+ <input
312
+ accept={item?.accept}
313
+ type="file"
314
+ onChange={onChange}
315
+ className={classNames(`${preCls}__title-input`, { [`${preCls}__title-input--show`]: image })}
316
+ onMouseEnter={handleEnterAgain}
317
+ onMouseLeave={handleLeaveAgain}
318
+ />
319
+ <span className={classNames(`${preCls}__title-again`, { [`${preCls}__title-again--show`]: image },{ [`${preCls}__title-again--hover`]: isEnter })}>
320
+ 重新上传
321
+ </span>
322
+ <ConditionRender condition={type === 'person'}>
323
+ <span className={`${preCls}__title-preview`}>{item?.previewTitle}</span>
324
+ </ConditionRender>
325
+ </div>
326
+ </div>
327
+ </Dialog>
328
+ );
329
+ };
330
+
331
+ export default ChangePhoto;