Template.html 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. <!DOCTYPE html>
  2. <html class="x-admin-sm">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="renderer" content="webkit">
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  7. <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
  8. <link rel="shortcut icon" href="https://osscold.baozhida.cn/favicon.ico">
  9. <link rel="bookmark" href="https://osscold.baozhida.cn/favicon.ico">
  10. <link rel="stylesheet" href="https://osscold.baozhida.cn/css/font.css">
  11. <link rel="stylesheet" href="https://osscold.baozhida.cn/css/xadmin.css">
  12. <script src="https://osscold.baozhida.cn/lib/layui/layui.js" charset="utf-8"></script>
  13. <script type="text/javascript" src="https://osscold.baozhida.cn/js/xadmin.js"></script>
  14. </head>
  15. <body>
  16. <div class="x-nav">
  17. <span class="layui-breadcrumb">
  18. <a href="">首页</a>
  19. <a><cite>宝智达</cite></a>
  20. </span>
  21. <a class="layui-btn layui-btn-normal" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
  22. <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i>
  23. </a>
  24. </div>
  25. <div class="layui-fluid">
  26. <div class="layui-row layui-col-space15">
  27. <div class="layui-col-md12">
  28. <div class="layui-card">
  29. <div class="layui-card-body ">
  30. <form class="layui-form layui-col-space5">
  31. <div class="layui-input-inline layui-show-xs-block">
  32. <select name="Class_1">
  33. <option value="">所有分类</option>
  34. {{range $index, $elem := .Class_List}}
  35. <option {{if eq $elem.Id $.Class_1 }}
  36. selected
  37. {{end}} value="{{$elem.Id}}">{{$elem.T_name}}</option>
  38. {{end}}
  39. </select>
  40. </div>
  41. <div class="layui-input-inline layui-show-xs-block">
  42. <input value="{{.Name}}" type="text" name="Name" placeholder="请输入 名称" autocomplete="off" class="layui-input"></div>
  43. <div class="layui-input-inline layui-show-xs-block">
  44. <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="sreach">
  45. <i class="layui-icon">&#xe615;</i></button>
  46. </div>
  47. </form>
  48. </div>
  49. <div class="layui-card-header">
  50. <!-- <button class="layui-btn layui-btn-danger" onclick="delAll()">-->
  51. <!-- <i class="layui-icon"></i>批量删除</button>-->
  52. <button class="layui-btn layui-btn-normal" onclick="xadmin.open('添加','List_',800,600,true);">
  53. <i class="layui-icon"></i>添加</button></div>
  54. <div class="layui-card-body ">
  55. <table class="layui-table layui-form">
  56. <thead>
  57. <tr>
  58. <th>编号</th>
  59. <th>图片</th>
  60. <th>名称</th>
  61. <th>分类</th>
  62. <th>数量</th>
  63. <th>操作</th></tr>
  64. </thead>
  65. <tbody>
  66. {{range $index, $elem := .List}}
  67. <tr>
  68. <td>{{$elem.Id}}</td>
  69. <td><img src="{{$elem.T_img}}"></td>
  70. <td>{{$elem.T_name}}</td>
  71. <td>
  72. {{range $index, $elemx := $.Class_List}}
  73. {{if eq $elem.T_class $elemx.Id }}
  74. {{$elemx.T_name}}
  75. {{end}}
  76. {{end}}
  77. </td>
  78. <td>{{$elem.T_int}}</td>
  79. <td class="td-manage">
  80. <a title="编辑" onclick="xadmin.open('编辑','List_?id={{$elem.Id}}');" href="javascript:;">
  81. <i class="layui-icon">&#xe63c;</i></a>
  82. <a title="删除" onclick="member_del(this,'{{$elem.Id}}')" href="javascript:;">
  83. <i class="layui-icon">&#xe640;</i></a>
  84. </td>
  85. </tr>
  86. {{end}}
  87. </tbody>
  88. </table>
  89. </div>
  90. <div class="layui-card-body ">
  91. <div class="page">
  92. <div>
  93. {{range $index, $elem := .Pages}}
  94. {{if eq $elem.A 1}}
  95. <a class="prev" href="?page={{$elem.V}}&Name={{$.Name}}&Class_1={{$.Class_1}}">&lt;&lt;</a>
  96. {{end}}
  97. {{if eq $elem.A 2}}
  98. <a class="num" href="?page={{$elem.V}}&Name={{$.Name}}&Class_1={{$.Class_1}}">{{$elem.V}}</a>
  99. {{end}}
  100. {{if eq $elem.A 3}}
  101. <span class="current">{{$elem.V}}</span>
  102. {{end}}
  103. {{if eq $elem.A 4}}
  104. <a class="num" href="?page={{$elem.V}}&Name={{$.Name}}&Class_1={{$.Class_1}}">{{$elem.V}}</a>
  105. {{end}}
  106. {{if eq $elem.A 5}}
  107. <a class="next" href="?page={{$elem.V}}&Name={{$.Name}}&Class_1={{$.Class_1}}">&gt;&gt;</a>
  108. {{end}}
  109. {{end}}
  110. </div>
  111. Page:{{.Page}}-
  112. Page_size:{{.Page_size}}-
  113. cnt:{{.cnt}}
  114. </div>
  115. </div>
  116. </div>
  117. </div>
  118. </div>
  119. </div>
  120. </body>
  121. <script>
  122. layui.use(['laydate', 'form'],
  123. function() {
  124. var laydate = layui.laydate;
  125. //执行一个laydate实例
  126. laydate.render({
  127. elem: '#start' //指定元素
  128. });
  129. //执行一个laydate实例
  130. laydate.render({
  131. elem: '#end' //指定元素
  132. });
  133. });
  134. /*用户-删除*/
  135. function member_del(obj, id) {
  136. layer.confirm('确认要删除吗?',
  137. function(index) {
  138. //发异步删除数据
  139. $(obj).parents("tr").remove();
  140. $.ajax({
  141. type: 'POST',
  142. url: 'List_Del',//发送请求
  143. data: {Id:id},
  144. success: function(result) {
  145. console.log(result)
  146. if (result.Code == 200 ){
  147. layer.msg('已删除!', {
  148. icon: 1,
  149. time: 2000
  150. });
  151. window.location.reload();
  152. }else {
  153. layer.msg('删除失败!', {
  154. time: 2000
  155. });
  156. }
  157. }
  158. });
  159. });
  160. }
  161. </script>
  162. </html>