選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 
 

199 行
8.6 KiB

  1. <title>评论列表</title>
  2. <div class="layui-card layadmin-header">
  3. <div class="layui-breadcrumb" lay-filter="breadcrumb">
  4. <a lay-href="">主页</a>
  5. <a><cite>运营管理</cite></a>
  6. <a><cite>评论管理</cite></a>
  7. <a><cite>评论列表</cite></a>
  8. </div>
  9. </div>
  10. <div class="layui-fluid">
  11. <div class="layui-card">
  12. <div id="layui-search" class="layui-form layui-form layui-card-header layuiadmin-card-header-auto"
  13. style="display: none">
  14. <div class="layui-form-item">
  15. <div id="layui-search-fields" class="layui-search-fields" style="display: inline-block">
  16. </div>
  17. <div id="layui-search-button" class="layui-inline">
  18. <button class="layui-btn layuiadmin-btn" lay-submit lay-filter="LAY-front-search">
  19. <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
  20. </button>
  21. </div>
  22. </div>
  23. </div>
  24. <div class="layui-card-body">
  25. <div style="padding-bottom: 10px;" id="layui-top-button">
  26. </div>
  27. <table id="LAY-curd-table" lay-filter="LAY-curd-table"></table>
  28. <script type="text/html" id="table-curd-list">
  29. </script>
  30. </div>
  31. </div>
  32. </div>
  33. <script type="text/html" id="ratingTpl">
  34. <span style="color: #5FB878;">{{d.good_num}}</span> / <span style="color: #FF5722;">{{d.bad_num}}</span>
  35. </script>
  36. <script>
  37. var config = {
  38. api: {
  39. batch: '/manage/content/comment/batch.json',
  40. list: '/manage/content/comment/list.json',
  41. del: '/manage/content/comment/del.json',
  42. change: '/manage/content/comment/change.json',
  43. setting: '/manage/setting/comment.json',
  44. },
  45. search: {
  46. user: {type: 'text', text: '用户名'},
  47. status: {type: 'select', text: '审核状态',data:{0:'未审核',1:'已审核'}},
  48. },
  49. topButton: {
  50. accept: {
  51. text: '通过',
  52. action: function () {
  53. var checkStatus = layui.table.checkStatus('LAY-curd-table'),
  54. checkData = checkStatus.data;
  55. if (checkData.length === 0) {
  56. return layer.msg('请选择数据');
  57. }
  58. var items = [], values = [];
  59. layui.each(checkData, function (k, v) {
  60. items.push(v.id);
  61. values.push(1)
  62. });
  63. layui.admin.req({
  64. url: config.api.batch,
  65. data: {type: 'change', items: items, field: 'status', values: values},
  66. method: 'POST',
  67. success: function (res) {
  68. if (res.code) {
  69. layer.msg(res.msg, function () {
  70. });
  71. } else {
  72. layer.msg('审核成功');
  73. layui.table.reload('LAY-curd-table');
  74. }
  75. }
  76. })
  77. }
  78. },
  79. reject: {
  80. style: 'layui-btn-danger',
  81. text: '拒绝',
  82. action: function () {
  83. var checkStatus = layui.table.checkStatus('LAY-curd-table'),
  84. checkData = checkStatus.data;
  85. if (checkData.length === 0) {
  86. return layer.msg('请选择数据');
  87. }
  88. var items = [], values = [];
  89. layui.each(checkData, function (k, v) {
  90. items.push(v.id);
  91. values.push(0)
  92. });
  93. layui.admin.req({
  94. url: config.api.batch,
  95. data: {type: 'change', items: items, field: 'status', values: values},
  96. method: 'POST',
  97. success: function (res) {
  98. if (res.code) {
  99. layer.msg(res.msg, function () {
  100. });
  101. } else {
  102. layer.msg('审核成功');
  103. layui.table.reload('LAY-curd-table');
  104. }
  105. }
  106. })
  107. }
  108. },
  109. del: {},
  110. setting: {
  111. text: '评论设置',
  112. action: function () {
  113. layui.admin.req({
  114. url: config.api.setting,
  115. data: {'comment#audit': '1'},
  116. method: 'GET',
  117. success: function (res) {
  118. if (res.code) {
  119. layer.msg(res.msg, function () {
  120. });
  121. } else {
  122. layui.layer.msg('用户发表评论是否需要审核?' + (parseInt(res.data.values['comment#audit'])?'(当前:不需要)':'(当前:需要)'), {
  123. time: 0,
  124. btn: ['需要', '不需要'],
  125. yes: function (index) {
  126. layui.admin.req({
  127. url: config.api.setting,
  128. data: {'comment#audit': '0'},
  129. method: 'POST',
  130. success: function (res) {
  131. if (res.code) {
  132. layer.msg(res.msg, function () {
  133. });
  134. } else {
  135. layer.msg('修改成功');
  136. }
  137. }
  138. });
  139. layui.layer.close(index);
  140. },
  141. btn2: function () {
  142. layui.admin.req({
  143. url: config.api.setting,
  144. data: {'comment#audit': '1'},
  145. method: 'POST',
  146. success: function (res) {
  147. if (res.code) {
  148. layer.msg(res.msg, function () {
  149. });
  150. } else {
  151. layer.msg('修改成功');
  152. }
  153. }
  154. });
  155. },
  156. });
  157. }
  158. }
  159. });
  160. }
  161. },
  162. },
  163. actionButton: {
  164. edit: {},
  165. del: {},
  166. },
  167. table: {
  168. page: true,
  169. limit: 30,
  170. cols: [[
  171. {type: 'checkbox', fixed: 'left'},
  172. {field: 'id', title: 'ID', align: 'center', width: 60},
  173. {field: 'type', title: '类型', align: 'center'},
  174. {field: 'title', title: '所属内容名称', maxWidth: 100},
  175. {field: 'user.name', title: '用户名', width: 100},
  176. {field: 'content', title: '内容'},
  177. {field: 'post_num', title: '回复', edit: 'text', align: 'center', width: 60},
  178. {field: 'view_num', title: '阅读', align: 'center', width: 60},
  179. {field: 'rating', title: '评分', templet: '#ratingTpl', align: 'center', width: 60},
  180. {field: 'datetime', title: '评论时间'},
  181. {
  182. field: 'status',
  183. title: '状态',
  184. templet: '#table-switch',
  185. align: 'center',
  186. width: 100,
  187. data: {text: '正常|隐藏'}
  188. },
  189. {title: '操作', width: 140, align: 'center', fixed: 'right', toolbar: '#table-curd-list'}
  190. ]]
  191. }
  192. };
  193. layui.use('curd/list', layui.factory('curd/list'));
  194. </script>