index.html 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>layui</title>
  6. <meta name="renderer" content="webkit">
  7. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  8. <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  9. <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css" media="all">
  10. <link rel="stylesheet" href="__PUBLIC__/font-awesome/css/font-awesome.min.css" media="all"/>
  11. <link rel="stylesheet" href="__CSS__/admin.css" media="all">
  12. <style type="text/css">
  13. #tooltip {
  14. position: absolute;
  15. border: 1px solid #ccc;
  16. background: #333;
  17. padding: 2px;
  18. display: none;
  19. color: #fff;
  20. }
  21. table{
  22. width:100px;
  23. table-layout:fixed;/* 只有定义了表格的布局算法为fixed,下面td的定义才能起作用。 */
  24. }
  25. td{
  26. width:100%;
  27. word-break:keep-all;/* 不换行 */
  28. white-space:nowrap;/* 不换行 */
  29. overflow:hidden;/* 内容超出宽度时隐藏超出部分的内容 */
  30. text-overflow:ellipsis;/* 当对象内文本溢出时显示省略标记(...) ;需与overflow:hidden;一起使用*/
  31. }
  32. </style>
  33. </head>
  34. <body style="padding:10px;">
  35. <div class="tplay-body-div">
  36. <div class="layui-tab">
  37. <ul class="layui-tab-title">
  38. <li class="layui-this">URL美化管理</li>
  39. <li><a href="{:url('admin/urlsconfig/publish')}" class="a_menu">新增美化</a></li>
  40. </ul>
  41. </div>
  42. <table class="layui-table" lay-size="sm">
  43. <colgroup>
  44. <col width="50">
  45. <col width="150">
  46. <col width="200">
  47. <col width="200">
  48. <col width="150">
  49. <col width="100">
  50. <col width="100">
  51. </colgroup>
  52. <thead>
  53. <tr>
  54. <th>ID</th>
  55. <th>美化前</th>
  56. <th>美化后</th>
  57. <th>备注</th>
  58. <th>创建时间</th>
  59. <th>状态</th>
  60. <th>操作</th>
  61. </tr>
  62. </thead>
  63. <tbody>
  64. {volist name="urlconfig" id="vo"}
  65. <tr>
  66. <td>{$vo.id}</td>
  67. <td>{$vo.url}</td>
  68. <td>{$vo.aliases}</td>
  69. <td>{$vo.desc}</td>
  70. <td>{$vo.create_time}</td>
  71. <td>{if condition="$vo.status eq 1"}<span class="layui-badge">启用</span>{else /}<span
  72. class="layui-badge layui-bg-gray">禁用</span>{/if}
  73. </td>
  74. <td class="operation-menu">
  75. <div class="layui-btn-group">
  76. <a class="layui-btn layui-btn-xs a_menu layui-btn-primary"
  77. href="{:url('admin/urlsconfig/publish',['id'=>$vo.id])}" style="margin-right: 0;font-size:12px;">
  78. <i class="layui-icon"></i></a>
  79. <a class="layui-btn layui-btn-xs layui-btn-primary status"
  80. {if condition="$vo.status eq 1" }data-id="0" {else/}data-id="1"{/if} id="{$vo.id}"
  81. style="margin-right: 0;font-size:12px;">
  82. <i class="fa {if condition=" $vo.status eq 1"}fa-toggle-on{else /}fa-toggle-off{/if}"></i></a>
  83. <a class="layui-btn layui-btn-xs delete layui-btn-primary" id="{$vo.id}"
  84. style="margin-right: 0;font-size:12px;"><i class="layui-icon"></i></a>
  85. </div>
  86. </td>
  87. </tr>
  88. {/volist}
  89. </tbody>
  90. </table>
  91. <div style="padding:0 20px;">{$urlconfig->render()}</div>
  92. {include file="public/foot"}
  93. <script type="text/javascript">
  94. $('.delete').click(function () {
  95. var id = $(this).attr('id');
  96. layer.confirm('确定要删除?', function (index) {
  97. $.ajax({
  98. url: "{:url('admin/urlsconfig/delete')}",
  99. data: {id: id},
  100. type: 'post',
  101. dataType: 'json',
  102. success: function (res) {
  103. layer.msg(res.msg);
  104. if (res.code == 1) {
  105. setTimeout(function () {
  106. location.href = res.url;
  107. }, 1500)
  108. }
  109. }
  110. })
  111. })
  112. })
  113. layui.use('layer', function () {
  114. var layer = layui.layer;
  115. $('.status').click(function () {
  116. var id = $(this).attr('id');
  117. var status = $(this).attr('data-id');
  118. layer.confirm('确定要设置?', function (index) {
  119. $.ajax({
  120. url: "{:url('admin/urlsconfig/status')}",
  121. type: 'post',
  122. dataType: 'json',
  123. data: {id: id, status: status},
  124. success: function (res) {
  125. layer.msg(res.msg);
  126. if (res.code == 1) {
  127. setTimeout(function () {
  128. location.href = res.url;
  129. }, 1500)
  130. }
  131. }
  132. })
  133. })
  134. })
  135. });
  136. </script>
  137. </div>
  138. </body>
  139. </html>