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