135 lines
5.0 KiB
Java
135 lines
5.0 KiB
Java
<!DOCTYPE html>
|
||
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="utf-8"/>
|
||
<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1.0"/>
|
||
<title>kkFileView演示首页</title>
|
||
<link rel="stylesheet" href="css/viewer.min.css"/>
|
||
<link rel="stylesheet" href="css/loading.css"/>
|
||
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css"/>
|
||
<link rel="stylesheet" href="bootstrap-table/bootstrap-table.min.css"/>
|
||
<link rel="stylesheet" href="gitalk/gitalk.css"/>
|
||
<script type="text/javascript" src="js/jquery-3.0.0.min.js"></script>
|
||
<script type="text/javascript" src="js/jquery.form.min.js"></script>
|
||
<script type="text/javascript" src="bootstrap/js/bootstrap.min.js"></script>
|
||
<script type="text/javascript" src="bootstrap-table/bootstrap-table.min.js"></script>
|
||
<script type="text/javascript" src="gitalk/gitalk.min.js"></script>
|
||
<script type="text/javascript" src="js/base64.min.js"></script>
|
||
</head>
|
||
|
||
<body>
|
||
<div class="panel-group container" id="accordion">
|
||
|
||
<div class="panel panel-default">
|
||
<div class="panel-heading">
|
||
<h4 class="panel-title">
|
||
<a data-toggle="collapse" data-parent="#accordion"
|
||
href="#collapseTwo">
|
||
上传合同模板
|
||
</a>
|
||
</h4>
|
||
</div>
|
||
<span style="">请修改成以下相关文件名:销售合同: sellContract.docx; 销售框架合同: frameContract.docx</span>
|
||
<div class="panel-body">
|
||
<#if fileUploadDisable == false>
|
||
<div style="padding: 10px">
|
||
<form enctype="multipart/form-data" id="fileUpload">
|
||
<input type="file" name="file" id="file"/>
|
||
<input type="button" id="btnSubmit" value=" 上 传 "/>
|
||
</form>
|
||
</div>
|
||
</#if>
|
||
<div>
|
||
<table id="table" data-pagination="true"></table>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<script>
|
||
function deleteFile(fileName) {
|
||
$.ajax({
|
||
url: '${baseUrl}deleteFile?fileName=' + encodeURIComponent(fileName),
|
||
success: function (data) {
|
||
// 删除完成,刷新table
|
||
if (1 === data.code) {
|
||
alert(data.msg);
|
||
} else {
|
||
$('#table').bootstrapTable('refresh', {});
|
||
}
|
||
},
|
||
error: function (data) {
|
||
console.log(data);
|
||
}
|
||
})
|
||
}
|
||
|
||
$(function () {
|
||
$('#table').bootstrapTable({
|
||
url: 'listFiles',
|
||
columns: [{
|
||
field: 'fileName',
|
||
title: '文件名'
|
||
}, {
|
||
field: 'action',
|
||
title: '操作'
|
||
},]
|
||
}).on('pre-body.bs.table', function (e, data) {
|
||
// 每个data添加一列用来操作
|
||
$(data).each(function (index, item) {
|
||
item.action = "<a class='btn btn-default' target='_blank' href='${baseUrl}onlinePreview?url=" + encodeURIComponent(Base64.encode('${baseUrl}' + item.fileName)) + "'>预览</a>" +
|
||
"<a class='btn btn-default' href='javascript:void(0);' onclick='deleteFile(\"" + item.fileName + "\")'>删除</a>";
|
||
});
|
||
return data;
|
||
}).on('post-body.bs.table', function (e, data) {
|
||
return data;
|
||
});
|
||
|
||
$('#preview_by_url').submit(function() {
|
||
var _url = $("#_url").val();
|
||
var urlField = $(this).find('[name=url]');
|
||
var b64Encoded = Base64.encode(_url);
|
||
urlField.val(b64Encoded);
|
||
});
|
||
|
||
|
||
function showLoadingDiv() {
|
||
var height = window.document.documentElement.clientHeight - 1;
|
||
$(".loading_container").css("height", height).show();
|
||
}
|
||
$("#btnSubmit").click(function () {
|
||
showLoadingDiv();
|
||
$("#fileUpload").ajaxSubmit({
|
||
success: function (data) {
|
||
// 上传完成,刷新table
|
||
console.log(data)
|
||
if (200 === data.resultCode) {
|
||
alert(data.resultMsg);
|
||
}
|
||
},
|
||
error: function () {
|
||
alert('上传失败,请联系管理员');
|
||
$(".loading_container").hide();
|
||
},
|
||
url: 'contract/upload', /*设置post提交到的页面*/
|
||
type: "post", /*设置表单以post方法提交*/
|
||
dataType: "json" /*设置返回值类型为文本*/
|
||
});
|
||
});
|
||
var gitalk = new Gitalk({
|
||
clientID: '525d7f16e17aab08cef5',
|
||
clientSecret: 'd1154e3aee5c8f1cbdc918b5c97a4f4157e0bfd9',
|
||
repo: 'kkFileView',
|
||
owner: 'kekingcn',
|
||
admin: ['kekingcn,klboke,gitchenjh'],
|
||
language: 'zh-CN',
|
||
id: location.pathname,
|
||
distractionFreeMode: false
|
||
})
|
||
gitalk.render((document.getElementById('comments')))
|
||
});
|
||
</script>
|
||
</body>
|
||
</html> |