fix: fix profile type
This commit is contained in:
parent
6232330f2e
commit
42eae6cba2
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
import React, { FC, useEffect, useState } from 'react';
|
import React, { FC, useEffect, useState } from 'react';
|
||||||
import { Form, Upload, Button } from 'antd';
|
import { Form, Upload, Button } from 'antd';
|
||||||
import type { UploadFile, UploadProps, GetProp } from 'antd';
|
import type { UploadFile, UploadProps } from 'antd';
|
||||||
import ImgCrop from 'antd-img-crop';
|
import ImgCrop from 'antd-img-crop';
|
||||||
import { CameraOutlined } from '@ant-design/icons';
|
import { CameraOutlined } from '@ant-design/icons';
|
||||||
import { Link } from '../../navigation';
|
import { Link } from '../../navigation';
|
||||||
|
@ -21,7 +21,7 @@ type ProfileSettingsProps = {
|
||||||
saveButton?: string;
|
saveButton?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
type FileType = Parameters<GetProp<UploadProps, 'beforeUpload'>>[0];
|
// type FileType = Parameters<GetProp<UploadProps, 'beforeUpload'>>[0];
|
||||||
|
|
||||||
export const ProfileSettings: FC<ProfileSettingsProps> = ({
|
export const ProfileSettings: FC<ProfileSettingsProps> = ({
|
||||||
locale,
|
locale,
|
||||||
|
@ -49,18 +49,18 @@ export const ProfileSettings: FC<ProfileSettingsProps> = ({
|
||||||
};
|
};
|
||||||
|
|
||||||
const onPreview = async (file: UploadFile) => {
|
const onPreview = async (file: UploadFile) => {
|
||||||
let src = file.url as string;
|
// let src = file.url as string;
|
||||||
if (!src) {
|
// if (!src) {
|
||||||
src = await new Promise((resolve) => {
|
// src = await new Promise((resolve) => {
|
||||||
const reader = new FileReader();
|
// const reader = new FileReader();
|
||||||
reader.readAsDataURL(file.originFileObj as FileType);
|
// reader.readAsDataURL(file.originFileObj as FileType);
|
||||||
reader.onload = () => resolve(reader.result as string);
|
// reader.onload = () => resolve(reader.result as string);
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
const image = new Image();
|
// const image = new Image();
|
||||||
image.src = src;
|
// image.src = src;
|
||||||
const imgWindow = window.open(src);
|
// const imgWindow = window.open(src);
|
||||||
imgWindow?.document.write(image.outerHTML);
|
// imgWindow?.document.write(image.outerHTML);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
Loading…
Reference in New Issue