hd_real_name/target/classes/static/pages/work/publicFileView.html

215 lines
6.1 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>公共照片查看</title>
<link rel="stylesheet" type="text/css" media="screen" href="../../layui/css/layui.css">
<link rel="stylesheet" type="text/css" media="screen" href="../../css/viewer.min.css">
<script type="text/javascript" src="../../js/libs/jquery-3.6.0.js"></script>
<script type="text/javascript" src="../../layui/layui.js"></script>
<script type="text/javascript" src="../../js/publicJs.js"></script>
<script type="text/javascript" src="../../js/jq.js"></script>
<script type="text/javascript" src="../../js/filePreview.js"></script>
<script type="text/javascript" src="../../js/viewer/viewer.min.js"></script>
<style>
body, html {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
float: left;
background-repeat: no-repeat;
background-size: 100%;
}
#dataDiv {
width: 100%;
height: 95%;
float: left;
}
#ulDiv {
width: 98%;
height: 84%;
position: absolute;
top: 50px;
left: 22px;
overflow-x: hidden;
overflow-y: scroll;
}
#dowebok {
width: 100%;
height: 99%;
}
.disPhotoLi {
/*width: 17.6%;*/
/*height: 30.6% !important;*/
width: 165px;
height: 200px;
float: left;
margin: 1%;
border: 1px solid #e8eceb;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.img {
/*width: 100%;*/
/*height: 100%;*/
width: 160px;
height: 160px;
}
.disPhotoP1 {
color: #fff;
font-size: 13px;
margin-top: 4%;
}
.disPhotoP2 {
color: #fff;
font-size: 13px;
margin-top: 4%;
}
.disPhotoP3 {
color: #fff;
font-size: 13px;
margin-top: 2%;
}
.disPhotoP4 {
color: #fff;
font-size: 13px;
margin-top: 4%;
}
/* chrome下的滚动条样式 */
::-webkit-scrollbar {
width: 15px;
height: 15px;
}
/* 滚动槽 */
::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 5px white;
border-radius: 5px;
}
/* 滚动条滑块 */
::-webkit-scrollbar-thumb {
border-radius: 10px;
background: white;
-webkit-box-shadow: inset 0 0 6px white;
}
::-webkit-scrollbar-thumb:window-inactive {
background: white;
}
::-webkit-scrollbar-corner {
background-color: white;
/ /
}
.layui-laydate-content thead tr {
background: white;
}
</style>
</head>
<body>
<div id="dataDiv">
<div id="ulDiv">
<ul id="dowebok">
</ul>
</div>
</div>
</body>
<script type="text/javascript">
let filePaths = localStorage.getItem("filePaths");
let fileNames = localStorage.getItem("fileNames");
let fileTimes = localStorage.getItem("fileTimes");
$(function () {
let filePath,fileName,fileTime;
if (!!filePaths) {
filePath = filePaths.split(","); //字符分割
if (!!fileNames){
fileName = fileNames.split(","); //字符分割
}
if (!!fileTimes){
fileTime = fileTimes.split(","); //字符分割
}
}
getDisPhotoList(filePath, fileName, fileTime);
});
// 加载图片
function getDisPhotoList(filePath, fileName, fileTime) {
$("#dowebok").empty();
if (filePath != null && filePath.length > 0) {
let html = "";
let type = 0;
for (let i = 0; i < filePath.length; i++) {
let path = '';
let viewPath = '';
if (filePath[i].indexOf("http") != -1) {
path = filePath[i];
} else {
path = dataPath + "/" + filePath[i];
}
//是否包含pdf
if(~path.indexOf(".pdf") || ~path.indexOf(".PDF")){
viewPath = "../../img/fileIcon/pdf.png";
type = 1;
}else if(~path.indexOf(".xlsx") || ~path.indexOf(".xls")){
viewPath = "../../img/fileIcon/excel.png";
type = 2;
}else if(~path.indexOf(".docx") || ~path.indexOf(".doc")){
viewPath = "../../img/fileIcon/docx.png";
type = 3;
}else{
viewPath = path;
}
html += "<li class='disPhotoLi'>";
html += '<img data-original="' + viewPath + '" src="' + viewPath + '" onclick="yulan(\''+path+'\',\''+type+'\')" class="img" />';
if (!!fileNames){
html += '<p>照片名称:' + fileName[i] + '</p>';
}
if (!!fileTimes){
html += '<p>时间:' + fileTime[i] + '</p>';
}
html += " </li>";
}
$("#dowebok").append(html);
let viewer = new Viewer(document.getElementById('dowebok'), {
url: 'data-original',
show: function () {
viewer.update();
}
});
} else {
let html = "<li style='color:black;float: left;border: none; font-size: 20px;height: 20%;position: absolute;\n" + "left: 315px;\n" + "top: 170px;'>没有相关数据</li>";
$("#dowebok").append(html);
}
}
//文件预览
function yulan(path,type) {
//图片不需要预览
if(type>0){
filePreview(path);
}
}
</script>
</html>