index.blade.php 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. @extends('layouts.admin.app')
  2. @section('plug-css')
  3. <link href="{{ asset('js/bootstrap-table/dist/bootstrap-table.css') }}" rel="stylesheet">
  4. @endsection
  5. @section('crumbs')
  6. <ol class="breadcrumb crumbs">
  7. <li><a href="{{ route('admin.index') }}#">后台导航</a></li>
  8. <li><a href="{{ route('admin.message.index') }}">后台留言首页</a></li>
  9. <li class="active">留言列表</li>
  10. </ol>
  11. @endsection
  12. @section('content')
  13. <form id="searchForm" class="form-inline">
  14. <div class="">
  15. <div class="form-group">
  16. <label for="name" class="label-css"> ID:</label>
  17. <input class="form-control" type="text" name="id">
  18. </div>
  19. <div class="form-group">
  20. <label for="username" class="label-css"> 会员账号:</label>
  21. <input class="form-control" type="text" name="username">
  22. </div>
  23. <div class="form-group">
  24. <label for="content" class="label-css"> 内容:</label>
  25. <input class="form-control" type="text" name="content">
  26. </div>
  27. <div class="form-group">
  28. <label for="reply" class="label-css"> 回复内容:</label>
  29. <input class="form-control" type="text" name="reply">
  30. </div>
  31. &ensp;&ensp;<div class="form-group">
  32. <label for="start" class="label-css"> 开始时间:</label>
  33. <input class="form-control" type="date" placeholder="" name="start" value="">
  34. </div>
  35. <div class="form-group">
  36. <label for="end" class="label-css"> 结束时间:</label>
  37. <input class="form-control" type="date" placeholder="" name="end" value="">
  38. </div>
  39. <button type="button" class="btn btn-primary">查询</button>
  40. </div>
  41. </form>
  42. <hr class="hr-css">
  43. <div>
  44. <table id="ContentTable"></table>
  45. </div>
  46. @endsection
  47. @section('plug-js')
  48. <script src="{{ asset('js/bootstrap-table/dist/bootstrap-table.js') }}"></script>
  49. <script src="{{ asset('js/bootstrap-table/dist/locale/bootstrap-table-zh-CN.js') }}"></script>
  50. <script src="{{ asset('js/jquery-validation1.16/dist/jquery.validate.min.js') }}"></script>
  51. <script src="{{ asset('js/jquery-validation1.16/dist/additional-methods.min.js') }}"></script>
  52. <script src="{{ asset('js/jquery-validation1.16/src/localization/messages_zh.js') }}"></script>
  53. @endsection
  54. @section('scripts')
  55. <script>
  56. $(function(){
  57. console.log('-------------------------');
  58. BootStrapInit.init('tableMessage','ContentTable',{
  59. searchForm: 'searchForm', // 表单搜索id 省略默认 'searchForm'
  60. url: "{{ route('admin.message.ajax.index') }}",
  61. method: 'post',
  62. toolbar: '#toolbar',
  63. idField: '', // 指定主键列
  64. uniqueId: "id", // 这里需要指定当前查询表唯一主键字段
  65. columns: [
  66. {
  67. checkbox: true,
  68. align: 'center',
  69. valign: 'middle'
  70. },
  71. {
  72. field: 'id',
  73. title: 'ID',
  74. align: 'center',
  75. valign: 'middle'
  76. },
  77. {
  78. field: 'username',
  79. title: '留言账号',
  80. align: 'center',
  81. valign: 'middle'
  82. },
  83. {
  84. field: 'content',
  85. title: '内容',
  86. align: 'center',
  87. valign: 'middle',
  88. formatter:qString
  89. },
  90. // {
  91. // field: 'msg_img',
  92. // title: '留言图片',
  93. // align: 'center',
  94. // valign: 'middle',
  95. // formatter:cthumbFormatter
  96. // },
  97. {
  98. field: 'reply',
  99. title: '回复内容',
  100. align: 'center',
  101. valign: 'middle',
  102. formatter:qStringOrTrim
  103. },
  104. {
  105. field: 'show',
  106. title: '显示',
  107. align: 'center',
  108. valign: 'middle',
  109. sortable: true,
  110. formatter:yesOrNo,
  111. bool_data:{
  112. 'class' : 'cursor',
  113. // 'url' : 'javascript:;',
  114. 'table' : 'messages'
  115. // 'pk' : 'id' // 主键名称不写默认id主键
  116. }
  117. },
  118. {
  119. field: 'created_at',
  120. title: '创建时间',
  121. align: 'center',
  122. valign: 'middle',
  123. sortable: true
  124. },
  125. {
  126. field: 'updated_at',
  127. title: '更新时间/回复时间',
  128. align: 'center',
  129. valign: 'middle',
  130. sortable: true
  131. },
  132. {
  133. pkId: 'id', // 当前主键id 兼容排序 field='id' 默认值id
  134. title: '操作',
  135. align: 'center',
  136. valign: 'middle',
  137. width: '185px',
  138. formatter:operateFormatter,
  139. btn_group:[
  140. {
  141. 'name' : '删除',
  142. 'class' : 'btn-danger deleteBtn', // class标签 deleteBtn删除 layer弹出框
  143. 'url' : 'javascript:;',
  144. 'confirm_url': '{{ route('admin.message.destroy', ['id'=>'-val-'])}}' // 选择按钮
  145. },
  146. {
  147. 'name' : '回复',
  148. 'class' : 'btn-primary createForm',
  149. 'url' : 'javascript:;',
  150. 'confirm_url': '{{ route('admin.message.edit', ['id'=>'-val-'])}}'
  151. },
  152. ]
  153. }
  154. ]
  155. });
  156. });
  157. </script>
  158. @endsection