hn_cloud_web/smz-web/pages/work/publicFileViewNew.html

273 lines
8.1 KiB
HTML
Raw Normal View History

2025-11-27 16:55:35 +08:00
<!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/filePreviewNew.js"></script>
<script type="text/javascript" src="../../js/aes.js"></script>
<script type="text/javascript" src="../../js/AesCbc.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%;
display: flex;
/*float: left;*/
}
.a{
}
.b{
}
#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>
<ul id="do">
</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();
$("#do").empty();
if (filePath != null && filePath.length > 0) {
let html = "";
let htm = "";
for (let i = 0; i < filePath.length; i++) {
let type = 0;
let path = '';
let viewPath = '';
let _class = 'disPhotoLi basicPhoto';
if (filePath[i].indexOf("http") != -1) {
path = filePath[i];
} else {
path = fileUrl + "/" + filePath[i];
}
//是否包含pdf
if(~path.indexOf(".pdf")){
viewPath = "../../img/fileIcon/pdf.png";
type = 1;
_class = "disPhotoLi";
}else if(~path.indexOf(".xlsx") || ~path.indexOf(".xls")){
viewPath = "../../img/fileIcon/excel.png";
type = 2;
_class = "disPhotoLi";
}else if(~path.indexOf(".docx") || ~path.indexOf(".doc")){
viewPath = "../../img/fileIcon/docx.png";
type = 3;
_class = "disPhotoLi";
}else{
viewPath = path;
}
if(type>0){
htm += "<li class='"+_class+"'>";
htm += '<img data-original="' + viewPath + '" src="' + viewPath + '" onclick="yulan(\''+path+'\',\''+type+'\')" class="img"/>';
if (!!fileNames){
htm += '<p>文件名称:' + fileName[i] + '</p>';
}
if (!!fileTimes){
htm += '<p>时间:' + fileTime[i] + '</p>';
}
htm += " </li>";
}else{
html += "<li class='"+_class+"'>";
html += '<img data-original="' + viewPath + '" src="' + viewPath + '" onclick="yulan(\''+path+'\',\''+type+'\')" class="img"/>';
if (!!fileNames){
html += '<p>文件名称:' + getSubString(fileName[i],8,5) + '</p>';
}
if (!!fileTimes){
html += '<p>时间:' + fileTime[i] + '</p>';
}
html += " </li>";
}
}
$("#dowebok").append(html);
$("#do").append(htm);
//获取某些
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) {
//点击预览加载修预览方法
updateFileViewTime();
//图片不需要预览
if(type>0){
if(type == 1){
window.open(path);
// window.location.href = path;
}else{
filePreview(path);
}
}
}
function generateToken(){
// 获取当前时间戳(以秒为单位)
const currentTimeStamp = Math.floor(Date.now());
// 将时间戳转换为字符串
const timeStampString = currentTimeStamp.toString();
return encryptCBC(timeStampString);
}
function encryptCBC(word){
var cbc_key = CryptoJS.enc.Utf8.parse("zhgd@bonus@zhgd@bonus@1234567890");
var cbc_iv = CryptoJS.enc.Utf8.parse("1234567812345678");
var srcs = CryptoJS.enc.Utf8.parse(word)
var encrypted = CryptoJS.AES.encrypt(srcs, cbc_key, {
iv: cbc_iv,
mode: CryptoJS.mode.CBC,
padding: CryptoJS.pad.Pkcs7
});
return encrypted.toString();
}
</script>
</html>