compress.ftl 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8"/>
  5. <title>压缩包预览</title>
  6. <script src="js/jquery-3.6.1.min.js"></script>
  7. <#include "*/commonHeader.ftl">
  8. <script src="js/base64.min.js" type="text/javascript"></script>
  9. <link href="css/zTreeStyle.css" rel="stylesheet" type="text/css">
  10. <script type="text/javascript" src="js/jquery.ztree.core.js"></script>
  11. <style type="text/css">
  12. body {
  13. background-color: #404040;
  14. }
  15. h1 {font-size: 24px;line-height: 34px;text-align: center;}
  16. a {color:#3C6E31;text-decoration: underline;}
  17. a:hover {background-color:#3C6E31;color:white;}
  18. code {color: #2f332a;}
  19. div.zTreeDemoBackground {
  20. max-width: 880px;
  21. text-align:center;
  22. margin:0 auto;
  23. border-radius:3px;
  24. box-shadow:rgba(0,0,0,0.15) 0 0 8px;
  25. background:#FBFBFB;
  26. border:1px solid #ddd;
  27. margin:1px auto;
  28. padding:5px;
  29. }
  30. </style>
  31. </head>
  32. <body>
  33. <div class="zTreeDemoBackground left">
  34. <h1>kkFileView</h1>
  35. <ul id="treeDemo" class="ztree"></ul>
  36. </div>
  37. <script>
  38. var settings = {
  39. data: {
  40. simpleData: {
  41. enable: true, //true 、 false 分别表示 使用 、 不使用 简单数据模式
  42. idKey: "id", //节点数据中保存唯一标识的属性名称
  43. pIdKey: "pid", //节点数据中保存其父节点唯一标识的属性名称
  44. rootPId: ""
  45. }
  46. },
  47. callback: {
  48. onClick: chooseNode,
  49. }
  50. };
  51. function chooseNode(event, treeId, treeNode) {
  52. if (!treeNode.isParent) {
  53. var path = '${baseUrl}' + treeNode.id + "?fileKey=" + '${fileName}';
  54. location.href = "${baseUrl}onlinePreview?url=" + encodeURIComponent(Base64.encode(path));
  55. }
  56. }
  57. $(document).ready(function () {
  58. var url = '${fileTree}';
  59. $.ajax({
  60. type: "get",
  61. url: "${baseUrl}directory?urls="+encodeURIComponent(Base64.encode(url)),
  62. success: function (res) {
  63. zTreeObj = $.fn.zTree.init($("#treeDemo"), settings, res); //初始化树
  64. zTreeObj.expandAll(true); //true 节点全部展开、false节点收缩
  65. }
  66. });
  67. });
  68. </script>
  69. </body>
  70. </html>