dir.html 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>文件管理</title>
  6. <link href="{#_link("static/css/style.css")#}" rel="stylesheet" type="text/css" />
  7. <link href="{#_link("static/css/select.css")#}" rel="stylesheet" type="text/css" />
  8. <link href="{#_link("static/css/jquery.multiSelect.css")#}" rel="stylesheet" type="text/css" />
  9. <script type="text/javascript" src="{#_link("static/js/jquery.min.js")#}"></script>
  10. <script type="text/javascript" src="{#_link("static/js/jquery.idTabs.min.js")#}"></script>
  11. <script type="text/javascript" src="{#_link("static/js/select-ui.min.js")#}"></script>
  12. <script type="text/javascript" src="{#_link("static/js/jquery.bgiframe.min.js")#}"></script>
  13. <script type="text/javascript" src="{#_link("static/js/jquery.multiSelect.js")#}"></script>
  14. <script type="text/javascript" src="{#_link("static/js/tips.js")#}"></script>
  15. <script type="text/javascript" src="{#_link("static/js/notify-custom.min.js")#}"></script>
  16. <script type="text/javascript" src="{#_link("static/layer/layer.js")#}"></script>
  17. </head>
  18. <body>
  19. <div class="place">
  20. <span>位置:</span>
  21. <ul class="placeul">
  22. <li><a href="{#$pathes.index#}">首页</a></li>
  23. <li><a href="{#_link('/dirs')#}?path={#$defaultPath#}">文件管理</a></li>
  24. {#foreach item=item from=$visitPathes#}
  25. <li><a href="{#$item.url#}">{#$item.name#}</a></li>
  26. {#/foreach#}
  27. </ul>
  28. </div>
  29. <table class="filetable">
  30. <thead>
  31. <tr>
  32. <th width="25%">名称</th>
  33. <th width="21%">修改日期</th>
  34. <th width="10%">类型</th>
  35. <th width="6%">大小</th>
  36. <th width="38%">操作</th>
  37. </tr>
  38. </thead>
  39. <tbody>
  40. {#foreach item=item from=$files#}
  41. <tr data-js="link" data-url="{#$item.url#}">
  42. <td><img src="{#$item.icon#}" />{#if $item.isImage#}<img src="{#$item.path#}" height="20" style="vertical-align:middle;" />{#/if#}<a href="{#$item.url#}">{#$item.name#}</a></td>
  43. <td>{#$item.updateAt|date_format:'Y-m-d H:i:s'#}</td>
  44. <td>{#if $item.type == 'folder'#}文件夹{#else#}文件{#/if#}</td>
  45. <td class="tdlast">{#$item.size#}</td>
  46. <td><a href="{#$item.url#}">查看</a> <a data-js="remove" data-ref="{#$item.remove#}">删除</a></td>
  47. </tr>
  48. {#foreachelse#}
  49. <tr>
  50. <td colspan="5">此文件夹下没有文件</td>
  51. </tr>
  52. {#/foreach#}
  53. </tbody>
  54. </table>
  55. <script>
  56. $('[data-js=link]').on('click', function(event){
  57. if($(event.target).attr('data-js') == 'remove') return;
  58. window.location.href =$(this).attr('data-url');
  59. });
  60. $('[data-js=remove]').on('click', function(event){
  61. var _this = $(this);
  62. layer.confirm('确定要删除此文件?', {
  63. btn: ['确认','取消'] //按钮
  64. }, function(){
  65. $.ajax({
  66. url : _this.attr('data-ref'),
  67. method : 'GET',
  68. dataType : 'json',
  69. success: function(data){
  70. if(typeof data.code != 'undefined'){
  71. data.code == 0 ? layer.msg('删除成功') : layer.msg(data.msg);
  72. setTimeout(function(){window.location.href=window.location.href;}, 2000);
  73. }else{
  74. layer.msg(data);
  75. }
  76. },
  77. error : function(){
  78. layer.msg('系统错误');
  79. }
  80. });0
  81. });
  82. });
  83. </script>
  84. </body>
  85. </html>