attach_list.tpl 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1">
  7. <title>附件管理 - Powered by MinDoc</title>
  8. <!-- Bootstrap -->
  9. <link href="{{cdncss "/static/bootstrap/css/bootstrap.min.css"}}" rel="stylesheet" type="text/css">
  10. <link href="{{cdncss "/static/font-awesome/css/font-awesome.min.css"}}" rel="stylesheet" type="text/css">
  11. <link href="{{cdncss "/static/css/main.css"}}" rel="stylesheet">
  12. <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
  13. <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
  14. <!--[if lt IE 9]>
  15. <script src="{{cdnjs "/static/html5shiv/3.7.3/html5shiv.min.js"}}"></script>
  16. <script src="{{cdnjs "/static/respond.js/1.4.2/respond.min.js" }}"></script>
  17. <![endif]-->
  18. </head>
  19. <body>
  20. <div class="manual-reader">
  21. {{template "widgets/header.tpl" .}}
  22. <div class="container manual-body">
  23. <div class="row">
  24. <div class="page-left">
  25. <ul class="menu">
  26. <li><a href="{{urlfor "ManagerController.Index"}}" class="item"><i class="fa fa-dashboard" aria-hidden="true"></i> 仪表盘</a> </li>
  27. <li><a href="{{urlfor "ManagerController.Users" }}" class="item"><i class="fa fa-users" aria-hidden="true"></i> 用户管理</a> </li>
  28. <li><a href="{{urlfor "ManagerController.Books" }}" class="item"><i class="fa fa-book" aria-hidden="true"></i> 项目管理</a> </li>
  29. {{/*<li><a href="{{urlfor "ManagerController.Comments" }}" class="item"><i class="fa fa-comments-o" aria-hidden="true"></i> 评论管理</a> </li>*/}}
  30. <li><a href="{{urlfor "ManagerController.Setting" }}" class="item"><i class="fa fa-cogs" aria-hidden="true"></i> 配置管理</a> </li>
  31. <li class="active"><a href="{{urlfor "ManagerController.AttachList" }}" class="item"><i class="fa fa-cloud-upload" aria-hidden="true"></i> 附件管理</a> </li>
  32. </ul>
  33. </div>
  34. <div class="page-right">
  35. <div class="m-box">
  36. <div class="box-head">
  37. <strong class="box-title">附件管理</strong>
  38. </div>
  39. </div>
  40. <div class="box-body">
  41. <div class="attach-list" id="attachList">
  42. <table class="table">
  43. <thead>
  44. <tr>
  45. <th>#</th>
  46. <th>附件名称</th>
  47. <th>项目名称</th>
  48. <th>文件大小</th>
  49. <th>是否存在</th>
  50. <th>操作</th>
  51. </tr>
  52. </thead>
  53. <tbody>
  54. {{range $index,$item := .Lists}}
  55. <tr>
  56. <td>{{$item.AttachmentId}}</td>
  57. <td>{{$item.FileName}}</td>
  58. <td>{{$item.BookName}}</td>
  59. <td>{{$item.FileShortSize}}</td>
  60. <td>{{ if $item.IsExist }} 是{{else}}否{{end}}</td>
  61. <td>
  62. <button type="button" data-method="delete" class="btn btn-danger btn-sm" data-id="{{$item.AttachmentId}}" data-loading-text="删除中...">删除</button>
  63. <a href="{{urlfor "ManagerController.AttachDetailed" ":id" $item.AttachmentId}}" class="btn btn-success btn-sm">详情</a>
  64. </td>
  65. </tr>
  66. {{else}}
  67. <tr><td class="text-center" colspan="6">暂无数据</td></tr>
  68. {{end}}
  69. </tbody>
  70. </table>
  71. <nav class="pagination-container">
  72. {{.PageHtml}}
  73. </nav>
  74. </div>
  75. </div>
  76. </div>
  77. </div>
  78. </div>
  79. {{template "widgets/footer.tpl" .}}
  80. </div>
  81. <script src="{{cdnjs "/static/jquery/1.12.4/jquery.min.js"}}"></script>
  82. <script src="{{cdnjs "/static/bootstrap/js/bootstrap.min.js"}}"></script>
  83. <script src="{{cdnjs "/static/js/jquery.form.js"}}" type="text/javascript"></script>
  84. <script src="{{cdnjs "/static/layer/layer.js" }}" type="text/javascript"></script>
  85. <script type="text/javascript">
  86. $(function () {
  87. $("#attachList").on("click","button[data-method='delete']",function () {
  88. var id = $(this).attr("data-id");
  89. var $this = $(this);
  90. $(this).button("loading");
  91. $.ajax({
  92. url : "{{urlfor "ManagerController.AttachDelete"}}",
  93. data : { "attach_id" : id },
  94. type : "post",
  95. dataType : "json",
  96. success : function (res) {
  97. if(res.errcode === 0){
  98. $this.closest("tr").remove().empty();
  99. }else {
  100. layer.msg(res.message);
  101. }
  102. },
  103. error : function () {
  104. layer.msg("服务器异常");
  105. },
  106. complete : function () {
  107. $this.button("reset");
  108. }
  109. });
  110. });
  111. });
  112. </script>
  113. </body>
  114. </html>