blacklist.html 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. {extend name="public/layout"}
  2. {block name="body"}
  3. <style>
  4. .layui-table thead tr,
  5. .layui-table-header {
  6. background-color: #D8E6F1 !important;
  7. }
  8. .layui-tab-title .layui-this {
  9. background-color: #249EFB;
  10. color: #fff;
  11. }
  12. .layui-tab-title .layui-this:after {
  13. border-bottom: none;
  14. border: none;
  15. }
  16. .layui-tab-title li {
  17. background-color: #F2F2F2;
  18. margin: 0px 5px;
  19. }
  20. .layui-btn-xs,.layui-btn-xs:hover {
  21. border: 1px solid #249EFB;
  22. background-color: #fff;
  23. color: #249EFB;
  24. padding: 0px 10px;
  25. }
  26. .layui-btn-danger,.layui-btn-danger:hover{
  27. color: #FF5722;
  28. background-color: #fff;
  29. border: 1px solid #FF5722;
  30. padding: 0px 10px;
  31. }
  32. </style>
  33. <body>
  34. <div class="layui-fluid">
  35. <div class="layui-row layui-col-space15">
  36. <div class="layui-col-md12" style="background-color:#ffffff">
  37. <div class="tplay-body-div">
  38. <div class="layui-tab">
  39. <ul class="layui-tab-title">
  40. <li style="margin-left: 0px;">
  41. <a href="{:url('broad/chat')}">聊天记录</a>
  42. </li>
  43. <li class="layui-this">
  44. 黑名单
  45. </li>
  46. {if condition="$marketing_account eq 1"}
  47. <li>
  48. <a href="{:url('broad/waistcoat')}">系统客服</a>
  49. </li>
  50. {/if}
  51. </ul>
  52. </div>
  53. <div class="layui-card-body">
  54. <table class="layui-hide" id="user" lay-filter="user"></table>
  55. </div>
  56. </div>
  57. </div>
  58. </div>
  59. </div>
  60. {/block}
  61. {block name="js"}
  62. <script type="text/html" id="bt">
  63. <a class="layui-btn layui-btn-primary layui-btn-xs edit" title="删除" lay-event="del">删除</a>
  64. </script>
  65. <script>
  66. var indexurl = '{:url("broad/blacklist")}';
  67. var delurl= '{:url("live/blacklist_del")}';
  68. var t;
  69. layui.use(['table', 'form'], function () {
  70. var form = layui.form
  71. , table = layui.table
  72. , $ = layui.jquery
  73. , active = {
  74. reload: function () {
  75. var title = $('#title');
  76. //执行重载
  77. table.reload('userTable', {
  78. page: {
  79. curr: 1 //重新从第 1 页开始
  80. }
  81. , where: {
  82. title: title.val()
  83. }
  84. });
  85. }
  86. , del: function(){
  87. var that = this;
  88. var uid = this.data.uid;
  89. layer.confirm('确定要将该用户从黑名单中删除么?',{title: ['信息', 'color:#333333;background-color:#D8E6F1;']},function(index){
  90. $.post(delurl,{uid:uid}, function(res){
  91. var resp = JSON.parse(res);
  92. if (resp.code == 0) {
  93. layer.msg(resp.msg,{anim: 0},function(){
  94. location.reload();
  95. });
  96. } else {
  97. layer.msg(resp.msg,{anim: 6});
  98. }
  99. });
  100. layer.close(index);
  101. });
  102. }
  103. };
  104. //展示已知数据
  105. t = table.render({
  106. elem: '#user'
  107. , url: indexurl
  108. , page: true
  109. , autoSort: true
  110. , cols: [[ //标题栏
  111. {type: 'numbers', title: '序号', fixed: 'left', width: 50}
  112. , {templet: function(d){
  113. return d.user.nickname;
  114. }, title: '昵称'}
  115. , {field: 'addtime',title: '拉黑时间', width: 200, align:'center'}
  116. , {fixed: 'right', title: '操作', toolbar: '#bt', width: 100, align:'right'}
  117. ]]
  118. , id: 'userTable'
  119. });
  120. $('.layui-form>.layui-btn').on('click', function () {
  121. var type = $(this).data('type');
  122. active[type] ? active[type].call(this) : '';
  123. });
  124. table.on('sort(user)', function (obj) {
  125. table.reload('userTable', {
  126. initSort: obj
  127. , where: obj
  128. });
  129. });
  130. table.on('toolbar(user)', function (obj) {
  131. var type = obj.event;
  132. active[type] ? active[type].call(this) : '';
  133. });
  134. table.on('tool(user)', function (obj) {
  135. var type = obj.event;
  136. active[type] ? active[type].call(obj) : '';
  137. });
  138. });
  139. </script>
  140. {/block}