@ant-design/icons#CloudUploadOutlined JavaScript Examples
The following examples show how to use
@ant-design/icons#CloudUploadOutlined.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: router.js From credit with Apache License 2.0 | 6 votes |
userRoutes = [
{
path: "/admin/userdashboard",
component: UserDashboard,
isShow: true,
title: "个人信息",
icon: AreaChartOutlined
},
{
path: "/admin/dataUpload",
component: dataUpload,
isShow: true,
title: "信息录入",
icon: CloudUploadOutlined
},
{
path: "/admin/creditgrant",
component: creditGrant,
isShow: true,
title: "信用数据授权",
icon: AuditOutlined
},
{
path: "/admin/certificateDownload",
component: certificateDownload,
isShow: true,
title: "证书下载",
icon: DownloadOutlined
},
{
path: "/admin/bingli",
component: bingli,
isShow: true,
title: "病例",
icon: DownloadOutlined
}
]
Example #2
Source File: FileSystem.js From next-terminal with GNU Affero General Public License v3.0 | 4 votes |
render() {
const columns = [
{
title: '名称',
dataIndex: 'name',
key: 'name',
render: (value, item) => {
let icon;
if (item['isDir']) {
icon = <FolderTwoTone/>;
} else {
if (item['isLink']) {
icon = <LinkOutlined/>;
} else {
const fileExtension = item['name'].split('.').pop().toLowerCase();
switch (fileExtension) {
case "doc":
case "docx":
icon = <FileWordOutlined/>;
break;
case "xls":
case "xlsx":
icon = <FileExcelOutlined/>;
break;
case "bmp":
case "jpg":
case "jpeg":
case "png":
case "tif":
case "gif":
case "pcx":
case "tga":
case "exif":
case "svg":
case "psd":
case "ai":
case "webp":
icon = <FileImageOutlined/>;
break;
case "md":
icon = <FileMarkdownOutlined/>;
break;
case "pdf":
icon = <FilePdfOutlined/>;
break;
case "txt":
icon = <FileTextOutlined/>;
break;
case "zip":
case "gz":
case "tar":
case "tgz":
icon = <FileZipOutlined/>;
break;
default:
icon = <FileOutlined/>;
break;
}
}
}
return <span className={'dode'}>{icon} {item['name']}</span>;
},
sorter: (a, b) => {
if (a['key'] === '..') {
return 0;
}
if (b['key'] === '..') {
return 0;
}
return a.name.localeCompare(b.name);
},
sortDirections: ['descend', 'ascend'],
},
{
title: '大小',
dataIndex: 'size',
key: 'size',
render: (value, item) => {
if (!item['isDir'] && !item['isLink']) {
return <span className={'dode'}>{renderSize(value)}</span>;
}
return <span className={'dode'}/>;
},
sorter: (a, b) => {
if (a['key'] === '..') {
return 0;
}
if (b['key'] === '..') {
return 0;
}
return a.size - b.size;
},
}, {
title: '修改日期',
dataIndex: 'modTime',
key: 'modTime',
sorter: (a, b) => {
if (a['key'] === '..') {
return 0;
}
if (b['key'] === '..') {
return 0;
}
return a.modTime.localeCompare(b.modTime);
},
sortDirections: ['descend', 'ascend'],
render: (value, item) => {
return <span className={'dode'}>{value}</span>;
},
}, {
title: '属性',
dataIndex: 'mode',
key: 'mode',
render: (value, item) => {
return <span className={'dode'}>{value}</span>;
},
}, {
title: '操作',
dataIndex: 'action',
key: 'action',
width: 210,
render: (value, item) => {
if (item['key'] === '..') {
return undefined;
}
let disableDownload = !this.state.download;
let disableEdit = !this.state.edit;
if (item['isDir'] || item['isLink']) {
disableDownload = true;
disableEdit = true
}
return (
<>
<Button type="link" size='small' disabled={disableEdit}
onClick={() => this.showEditor(item['name'], item['key'])}>
编辑
</Button>
<Button type="link" size='small' disabled={disableDownload} onClick={async () => {
download(`${server}/${this.state.storageType}/${this.state.storageId}/download?file=${window.encodeURIComponent(item['key'])}&X-Auth-Token=${getToken()}&t=${new Date().getTime()}`);
}}>
下载
</Button>
<Button type={'link'} size={'small'} disabled={!this.state.rename} onClick={() => {
this.setState({
renameVisible: true,
currentFileKey: item['key']
})
}}>重命名</Button>
<Popconfirm
title="您确认要删除此文件吗?"
onConfirm={async () => {
await this.delete(item['key']);
await this.refresh();
}}
okText="是"
cancelText="否"
>
<Button type={'link'} size={'small'} disabled={!this.state.delete} danger>删除</Button>
</Popconfirm>
</>
);
},
}
];
const {selectedRowKeys} = this.state;
const rowSelection = {
selectedRowKeys,
onChange: (selectedRowKeys) => {
this.setState({selectedRowKeys});
},
getCheckboxProps: (record) => ({
disabled: record['disabled'],
}),
};
let hasSelected = selectedRowKeys.length > 0;
if (hasSelected) {
if (!this.state.delete) {
hasSelected = false;
}
}
const title = (
<div className='fs-header'>
<div className='fs-header-left'>
<Input value={this.state.currentDirectoryInput} onChange={this.handleCurrentDirectoryInputChange}
onPressEnter={this.handleCurrentDirectoryInputPressEnter}/>
</div>
<div className='fs-header-right'>
<Space>
<div className='fs-header-right-item'>
<Tooltip title="创建文件夹">
<Button type="primary" size="small"
disabled={!this.state.upload}
icon={<FolderAddOutlined/>}
onClick={() => {
this.setState({
mkdirVisible: true
})
}} ghost/>
</Tooltip>
</div>
<div className='fs-header-right-item'>
<Tooltip title="上传文件">
<Button type="primary" size="small"
icon={<CloudUploadOutlined/>}
disabled={!this.state.upload}
onClick={() => {
window.document.getElementById('file-upload').click();
}} ghost/>
<input type="file" id="file-upload" style={{display: 'none'}}
onChange={this.handleUploadFile} multiple/>
</Tooltip>
</div>
<div className='fs-header-right-item'>
<Tooltip title="上传文件夹">
<Button type="primary" size="small"
icon={<UploadOutlined/>}
disabled={!this.state.upload}
onClick={() => {
window.document.getElementById('dir-upload').click();
}} ghost/>
<input type="file" id="dir-upload" style={{display: 'none'}}
onChange={this.handleUploadDir} webkitdirectory='' multiple/>
</Tooltip>
</div>
<div className='fs-header-right-item'>
<Tooltip title="刷新">
<Button type="primary" size="small"
icon={<ReloadOutlined/>}
onClick={this.refresh}
ghost/>
</Tooltip>
</div>
<div className='fs-header-right-item'>
<Tooltip title="批量删除">
<Button type="primary" size="small" ghost danger disabled={!hasSelected}
icon={<DeleteOutlined/>}
loading={this.state.delBtnLoading}
onClick={() => {
let rowKeys = this.state.selectedRowKeys;
const content = <div>
您确定要删除选中的<Text style={{color: '#1890FF'}}
strong>{rowKeys.length}</Text>条记录吗?
</div>;
confirm({
icon: <ExclamationCircleOutlined/>,
content: content,
onOk: async () => {
for (let i = 0; i < rowKeys.length; i++) {
if (rowKeys[i] === '..') {
continue;
}
await this.delete(rowKeys[i]);
}
this.refresh();
},
onCancel() {
},
});
}}>
</Button>
</Tooltip>
</div>
</Space>
</div>
</div>
);
return (
<div>
<Card title={title} bordered={true} size="small" style={{minHeight: this.state.minHeight}}>
<Table columns={columns}
rowSelection={rowSelection}
dataSource={this.state.files}
size={'small'}
pagination={false}
loading={this.state.loading}
onRow={record => {
return {
onDoubleClick: event => {
if (record['isDir'] || record['isLink']) {
if (record['path'] === '..') {
// 获取当前目录的上级目录
let currentDirectory = this.state.currentDirectory;
let parentDirectory = currentDirectory.substring(0, currentDirectory.lastIndexOf('/'));
this.loadFiles(parentDirectory);
} else {
this.loadFiles(record['path']);
}
} else {
}
},
};
}}
/>
</Card>
{
this.state.mkdirVisible ?
<Modal
title="创建文件夹"
visible={this.state.mkdirVisible}
okButtonProps={{form: 'mkdir-form', key: 'submit', htmlType: 'submit'}}
onOk={() => {
this.mkdirFormRef.current
.validateFields()
.then(async values => {
this.mkdirFormRef.current.resetFields();
let params = {
'dir': this.state.currentDirectory + '/' + values['dir']
}
let paramStr = qs.stringify(params);
this.setState({
confirmLoading: true
})
let result = await request.post(`/${this.state.storageType}/${this.state.storageId}/mkdir?${paramStr}`);
if (result.code === 1) {
message.success('创建成功');
this.loadFiles(this.state.currentDirectory);
} else {
message.error(result.message);
}
this.setState({
confirmLoading: false,
mkdirVisible: false
})
})
.catch(info => {
});
}}
confirmLoading={this.state.confirmLoading}
onCancel={() => {
this.setState({
mkdirVisible: false
})
}}
>
<Form ref={this.mkdirFormRef} id={'mkdir-form'}>
<Form.Item name='dir' rules={[{required: true, message: '请输入文件夹名称'}]}>
<Input autoComplete="off" placeholder="请输入文件夹名称"/>
</Form.Item>
</Form>
</Modal> : undefined
}
{
this.state.renameVisible ?
<Modal
title="重命名"
visible={this.state.renameVisible}
okButtonProps={{form: 'rename-form', key: 'submit', htmlType: 'submit'}}
onOk={() => {
this.renameFormRef.current
.validateFields()
.then(async values => {
this.renameFormRef.current.resetFields();
try {
let currentDirectory = this.state.currentDirectory;
if (!currentDirectory.endsWith("/")) {
currentDirectory += '/';
}
let params = {
'oldName': this.state.currentFileKey,
'newName': currentDirectory + values['newName'],
}
if (params['oldName'] === params['newName']) {
message.success('重命名成功');
return;
}
let paramStr = qs.stringify(params);
this.setState({
confirmLoading: true
})
let result = await request.post(`/${this.state.storageType}/${this.state.storageId}/rename?${paramStr}`);
if (result['code'] === 1) {
message.success('重命名成功');
this.refresh();
} else {
message.error(result.message);
}
} finally {
this.setState({
confirmLoading: false,
renameVisible: false
})
}
})
.catch(info => {
});
}}
confirmLoading={this.state.confirmLoading}
onCancel={() => {
this.setState({
renameVisible: false
})
}}
>
<Form id={'rename-form'}
ref={this.renameFormRef}
initialValues={{newName: getFileName(this.state.currentFileKey)}}>
<Form.Item name='newName' rules={[{required: true, message: '请输入新的名称'}]}>
<Input autoComplete="off" placeholder="新的名称"/>
</Form.Item>
</Form>
</Modal> : undefined
}
<Modal
title={"编辑 " + this.state.fileName}
className='modal-no-padding'
visible={this.state.editorVisible}
destroyOnClose={true}
width={window.innerWidth * 0.8}
centered={true}
okButtonProps={{form: 'rename-form', key: 'submit', htmlType: 'submit'}}
onOk={this.edit}
confirmLoading={this.state.confirmLoading}
onCancel={this.hideEditor}
>
<MonacoEditor
language="javascript"
height={window.innerHeight * 0.8}
theme="vs-dark"
value={this.state.fileContent}
options={{
selectOnLineNumbers: true
}}
editorDidMount={(editor, monaco) => {
console.log('editorDidMount', editor);
editor.focus();
}}
onChange={(newValue, e) => {
console.log('onChange', newValue, e);
this.setState(
{
fileContent: newValue
}
)
}}
/>
</Modal>
</div>
);
}
Example #3
Source File: Relation.js From OpenRichpedia with MIT License | 4 votes |
getUpload() {
return (
<div
style={{
height: '450px',
width: '900px',
borderRadius: '5px',
border: '1px solid black',
}}
>
{/* <h2
style={{
margin: '10px 20px',
fontSize: '24px',
fontWeight: '700',
color: '#77628c',
}}
>
Caption
</h2>
<TextArea
id="textArea"
style={{ display: 'block', width: '800px', margin: '10px 20px' }}
value={this.state.value}
onChange={this.onChange}
placeholder="Please enter the caption"
autoSize={{ minRows: 3, maxRows: 9 }}
/> */}
<h2
style={{
margin: '10px 20px',
fontSize: '24px',
fontWeight: '700',
color: '#77628c',
}}
>
Image
</h2>
{/* <Image
style={{
display:"block",
margin:'10px 20px',
marginLeft:'20px',
maxHeight: '300px',
}}
width={250}
src={this.state.src}
fallback={this.state.fall}
/> */}
<div
style={{
margin: '10px 20px',
display: 'block',
height: '300px',
width: '800px',
borderRadius: '5px',
border: '1px solid #e8e8e8',
background: '#ddddff',
}}
onClick={this.handlePreview}
>
<a href="javascript:void(0);">
<div
style={{
justifyContent: 'center',
display: 'flex',
alignItems: 'center',
height: '100%',
fontSize: '50px',
color: '#9393ff',
}}
>
<MdPhotoSizeSelectActual />
<span style={{ marginLeft: '15px' }}>Image</span>
</div>
</a>
</div>
<div>
<Button
type="primary"
shape="round"
icon={<CloudUploadOutlined />}
style={{ margin: '10px 10px 0 20px', display: 'inline-flex' }}
onClick={this.handleUpdate}
>
Upload
</Button>
<Button
type="primary"
shape="round"
icon={<TagFilled />}
style={{ margin: '10px 20px 0 0', display: 'inline-flex' }}
onClick={this.handleEx}
>
Example
</Button>
{this.getProcess()}
<p
style={{
marginLeft: '20px',
fontSize: '5px',
marginTop: '0px',
display: 'block',
color: '#9393ff',
}}
>
{this.state.filename}
</p>
</div>
<input
type="file"
id="file"
style={{ opacity: '0' }}
onChange={this.handleFile}
/>
</div>
);
}
Example #4
Source File: Uploader.js From OpenRichpedia with MIT License | 4 votes |
getUpload() {
return (
<div
style={{
height: '580px',
width: '900px',
borderRadius: '5px',
border: '1px solid black',
}}
>
<h2
style={{
margin: '10px 20px',
fontSize: '24px',
fontWeight: '700',
color: '#77628c',
}}
>
Caption
</h2>
<TextArea
id="textArea"
style={{ display: 'block', width: '800px', margin: '10px 20px' }}
value={this.state.value}
onChange={this.onChange}
placeholder="Please enter the caption"
autoSize={{ minRows: 3, maxRows: 9 }}
/>
<h2
style={{
margin: '10px 20px',
fontSize: '24px',
fontWeight: '700',
color: '#77628c',
}}
>
Image
</h2>
{/* <Image
style={{
display:"block",
margin:'10px 20px',
marginLeft:'20px',
maxHeight: '300px',
}}
width={250}
src={this.state.src}
fallback={this.state.fall}
/> */}
<div
style={{
margin: '10px 20px',
display: 'block',
height: '300px',
width: '800px',
borderRadius: '5px',
border: '1px solid #e8e8e8',
background: '#ddddff',
}}
onClick={this.handlePreview}
>
<a href="javascript:void(0);">
<div
style={{
justifyContent: 'center',
display: 'flex',
alignItems: 'center',
height: '100%',
fontSize: '50px',
color: '#9393ff',
}}
>
<MdPhotoSizeSelectActual />
<span style={{ marginLeft: '15px' }}>Image</span>
</div>
</a>
</div>
<div>
<Button
type="primary"
shape="round"
icon={<CloudUploadOutlined />}
style={{ margin: '10px 10px 0 20px', display: 'inline-flex' }}
onClick={this.handleUpdate}
>
Upload
</Button>
<Button
type="primary"
shape="round"
icon={<TagFilled />}
style={{ margin: '10px 20px 0 0', display: 'inline-flex' }}
onClick={this.handleEx}
>
Example
</Button>
{this.getProcess()}
<p
style={{
marginLeft: '20px',
fontSize: '5px',
marginTop: '0px',
display: 'block',
color: '#9393ff',
}}
>
{this.state.filename}
</p>
</div>
<input
type="file"
id="file"
style={{ opacity: '0' }}
onChange={this.handleFile}
/>
</div>
);
}