Files
workspace/code/file-preview/index.html
T
2026-04-25 17:28:57 +08:00

78 lines
2.1 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>文件预览测试</title>
<script type="text/javascript" src="./js/jquery-easyui-1.4/jquery.min.js"></script>
<script type="text/javascript" src="./js/jquery-easyui-1.4/jquery.easyui.min.js"></script>
<script type="text/javascript" src="./custom-file/index.js"></script>
<link rel="stylesheet" href="./custom-file/index.css" />
<style>
* {
margin: 0;
padding: 0;
}
#app {
width: 100%;
height: 100%;
background: #f5f7fa;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
</style>
</head>
<body>
<div id="app">
<button id="reloadBtn">重新加载文件</button>
<button id="reloadBtn2">重新加载文件2</button>
<div style="height: 600px;width: 400px;">
<div id="fileContainer"></div>
</div>
</div>
<script>
$(function () {
const file = $('#fileContainer').G3File({
language: 'zh-CN',
data: [
{ name: 'test.jar', size: 1024000, uploadDate: '2024-01-15T10:30:00', url: 'http://118.89.70.199:9000/test/XI26033384.rar' },
],
permissions: {
select: true,
upload: true,
download: true,
delete: true,
view: true
},
onUpload: function () {
console.log('Upload clicked');
alert('上传功能');
}
});
$('#reloadBtn').click(function () {
file.loadFiles([
{ name: '测试文档1.pdf', uploadDate: '2024-01-15T10:30:00', url: '' },
{ name: 'test.png', size: 1024000, uploadDate: '2024-01-15T10:30:00', url: 'http://118.89.70.199:9000/test/DC2A4692147D10C9C7B48A7EA29BCBA8.jpg' },
]);
});
$('#reloadBtn2').click(function () {
file.loadFiles([
{ name: '测试文档2.pdf', size: 1024000, uploadDate: '2024-01-15T10:30:00', url: '' },
{ name: '项目报告2.docx', size: 524288, uploadDate: '2024-02-20T14:45:00', url: '' },
]);
});
});
</script>
</body>
</html>