This commit is contained in:
parent
c8273c14b3
commit
bd9ed38430
|
|
@ -26,6 +26,7 @@ const SharedFilesModel = forwardRef((props: any, ref: any) => {
|
||||||
const { state } = useLocation();
|
const { state } = useLocation();
|
||||||
const [selectedRowKeys, setSelectedRowKeys] = useState<React.Key[]>([]);
|
const [selectedRowKeys, setSelectedRowKeys] = useState<React.Key[]>([]);
|
||||||
const [showRowSelection, setShowRowSelection] = useState(false);
|
const [showRowSelection, setShowRowSelection] = useState(false);
|
||||||
|
const [isUpFile, setIsUpFile] = useState(false);
|
||||||
const [isSharedFilesModel, setIsSharedFilesModel] = useState(false);
|
const [isSharedFilesModel, setIsSharedFilesModel] = useState(false);
|
||||||
const [user, setUser] = useState<any>({});
|
const [user, setUser] = useState<any>({});
|
||||||
const [fileList, setFileList] = useState({
|
const [fileList, setFileList] = useState({
|
||||||
|
|
@ -80,13 +81,13 @@ const SharedFilesModel = forwardRef((props: any, ref: any) => {
|
||||||
<span>
|
<span>
|
||||||
共{fileList.total}个文件
|
共{fileList.total}个文件
|
||||||
</span>
|
</span>
|
||||||
<div>
|
{isUpFile ? <div>
|
||||||
<span>上传进度:</span>
|
<span>上传进度:</span>
|
||||||
{/* <span>{uploadProgress === 100 ? '上传完成' : '上传中'} </span> */}
|
{/* <span>{uploadProgress === 100 ? '上传完成' : '上传中'} </span> */}
|
||||||
<Progress percent={uploadProgress} trailColor={'#e8e8e8'}
|
<Progress percent={uploadProgress} trailColor={'#e8e8e8'}
|
||||||
percentPosition={{ align: 'center', type: 'inner' }}
|
percentPosition={{ align: 'center', type: 'inner' }}
|
||||||
size={{ width: 100, height: 20 }} />
|
size={{ width: 100, height: 20 }} />
|
||||||
</div>
|
</div> : null}
|
||||||
</div>
|
</div>
|
||||||
<div style={{ color: 'white' }}>
|
<div style={{ color: 'white' }}>
|
||||||
<Input
|
<Input
|
||||||
|
|
@ -148,12 +149,10 @@ const SharedFilesModel = forwardRef((props: any, ref: any) => {
|
||||||
<Button type="primary" style={{ backgroundColor: '#31353A' }}
|
<Button type="primary" style={{ backgroundColor: '#31353A' }}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
const file = document.createElement("input") as any;
|
const file = document.createElement("input") as any;
|
||||||
file.accept = "image/*,.doc,.docx,.ppt,.pptx,.xls,.xlsx,application/pdf";
|
|
||||||
file.type = "file";
|
file.type = "file";
|
||||||
file.onchange = async () => {
|
file.onchange = async () => {
|
||||||
const fileInfo = file.files[0];
|
const fileInfo = file.files[0];
|
||||||
const maxSize = 100 * 1024 * 1024; // 100MB in bytes
|
const maxSize = 100 * 1024 * 1024; // 100MB in bytes
|
||||||
|
|
||||||
if (fileInfo.size > maxSize) {
|
if (fileInfo.size > maxSize) {
|
||||||
message.error('文件太大!请上传小于100MB的文件。')
|
message.error('文件太大!请上传小于100MB的文件。')
|
||||||
// 清除文件输入框的值,以便用户可以选择其他文件
|
// 清除文件输入框的值,以便用户可以选择其他文件
|
||||||
|
|
@ -161,6 +160,8 @@ const SharedFilesModel = forwardRef((props: any, ref: any) => {
|
||||||
}
|
}
|
||||||
const fileType = fileInfo.name.split('.');
|
const fileType = fileInfo.name.split('.');
|
||||||
const fileTypeName = fileType[fileType.length - 1];
|
const fileTypeName = fileType[fileType.length - 1];
|
||||||
|
setIsUpFile(true)
|
||||||
|
setUploadProgress(0)
|
||||||
await GetRoomUpFileurl(state.channelId, fileTypeName).then(async res => {
|
await GetRoomUpFileurl(state.channelId, fileTypeName).then(async res => {
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append("name", fileInfo.name);
|
formData.append("name", fileInfo.name);
|
||||||
|
|
@ -182,7 +183,14 @@ const SharedFilesModel = forwardRef((props: any, ref: any) => {
|
||||||
const progress = Math.round((loaded * 100) / total);
|
const progress = Math.round((loaded * 100) / total);
|
||||||
setUploadProgress(progress)
|
setUploadProgress(progress)
|
||||||
}
|
}
|
||||||
})
|
}).then(_response => {
|
||||||
|
setIsUpFile(false)
|
||||||
|
setUploadProgress(100)
|
||||||
|
message.success('上传成功')
|
||||||
|
}).catch(error => {
|
||||||
|
setIsUpFile(false)
|
||||||
|
message.error('上传失败')
|
||||||
|
});
|
||||||
await PostRoomFile({
|
await PostRoomFile({
|
||||||
fileUrl: res.data.key,
|
fileUrl: res.data.key,
|
||||||
size: fileInfo.size,
|
size: fileInfo.size,
|
||||||
|
|
@ -214,7 +222,7 @@ const SharedFilesModel = forwardRef((props: any, ref: any) => {
|
||||||
<Column title="文件" width={140}
|
<Column title="文件" width={140}
|
||||||
render={(item) => (
|
render={(item) => (
|
||||||
<>
|
<>
|
||||||
<div style={{ display: 'flex', alignItems: 'center', flexWrap: 'wrap' }}>
|
<div>
|
||||||
<span>{item.fileName}</span>
|
<span>{item.fileName}</span>
|
||||||
<span>
|
<span>
|
||||||
{item.showPercentComplete ? <Progress percent={item.percentComplete} trailColor={'#e8e8e8'}
|
{item.showPercentComplete ? <Progress percent={item.percentComplete} trailColor={'#e8e8e8'}
|
||||||
|
|
@ -269,7 +277,7 @@ const SharedFilesModel = forwardRef((props: any, ref: any) => {
|
||||||
fileItem[fileIndex].percentComplete = 100
|
fileItem[fileIndex].percentComplete = 100
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
fileItem[fileIndex].showPercentComplete = false
|
fileItem[fileIndex].showPercentComplete = false
|
||||||
}, 3000)
|
}, 1000)
|
||||||
setFileList({
|
setFileList({
|
||||||
...fileList,
|
...fileList,
|
||||||
data: fileItem,
|
data: fileItem,
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import Operation from '@/components/Operation';
|
||||||
import { Button, Input, Modal, Pagination, Empty, message } from "antd";
|
import { Button, Input, Modal, Pagination, Empty, message } from "antd";
|
||||||
import { GetRoom, PostRomm, GetCheckoutRoomNum } from '@/api/Home/Index';
|
import { GetRoom, PostRomm, GetCheckoutRoomNum } from '@/api/Home/Index';
|
||||||
import ImageUrl from '@/utils/package/ImageUrl'
|
import ImageUrl from '@/utils/package/ImageUrl'
|
||||||
import { RedoOutlined } from '@ant-design/icons';
|
import { ReloadOutlined } from '@ant-design/icons';
|
||||||
import JoinSetting from '@/components/JoinSetting';
|
import JoinSetting from '@/components/JoinSetting';
|
||||||
const Index: React.FC = () => {
|
const Index: React.FC = () => {
|
||||||
const [list, setList] = useState({
|
const [list, setList] = useState({
|
||||||
|
|
@ -92,11 +92,10 @@ const Index: React.FC = () => {
|
||||||
<div className={styles.indexContent}>
|
<div className={styles.indexContent}>
|
||||||
<div className={`drag ${styles.indexContentTitle}`}>
|
<div className={`drag ${styles.indexContentTitle}`}>
|
||||||
<span>会议室列表</span>
|
<span>会议室列表</span>
|
||||||
<RedoOutlined
|
<ReloadOutlined
|
||||||
title='刷新'
|
title='刷新'
|
||||||
style={{
|
style={{
|
||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
transform: 'rotate(-60deg)'
|
|
||||||
}}
|
}}
|
||||||
onClick={() => getRoomList()}
|
onClick={() => getRoomList()}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue