index.php 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. {extend name="public/container"}
  2. {block name="head_top"}
  3. <link href="{__MODULE_PATH}wechat/news/css/index.css" type="text/css" rel="stylesheet">
  4. {/block}
  5. {block name="content"}
  6. <style>
  7. tr td img{height: 50px;}
  8. </style>
  9. <div class="row"
  10. <div class="col-sm-9 m-l-n-md">
  11. <div class="ibox">
  12. <div class="ibox-title">
  13. <!--<button type="button" class="btn btn-w-m btn-primary" onclick="$eb.createModalFrame(this.innerText,'{:Url('create')}',{w:1100,h:760})">添加问答</button>-->
  14. <div style="margin-top: 2rem"></div>
  15. <div class="row">
  16. <div class="m-b m-l">
  17. <form action="" class="form-inline">
  18. <div class="input-group">
  19. <input type="text" name="title" value="{$where.title}" placeholder="请输入关键词" class="input-sm form-control"> <span class="input-group-btn"><button type="submit" class="btn btn-sm btn-primary"> <i class="fa fa-search" ></i>搜索</button> </span>
  20. </div>
  21. </form>
  22. <div class="layui-card-header">
  23. <button style="margin-left: 20px" type="button" class="layui-btn layui-btn-primary layui-btn-xs"
  24. id="lb">返回列表
  25. </button>
  26. </div>
  27. </div>
  28. </div>
  29. </div>
  30. <div class="ibox-content">
  31. <table class="footable table table-striped table-bordered " data-page-size="20">
  32. <thead>
  33. <tr>
  34. <th class="text-center" width="5%">id</th>
  35. <th class="text-center"width="40%">内容</th>
  36. <th class="text-left" >发布者</th>
  37. <th class="text-left">审核状态</th>
  38. <th class="text-center">添加时间</th>
  39. <th class="text-center" width="20%">操作</th>
  40. </tr>
  41. </thead>
  42. <tbody>
  43. {volist name="list" id="vo"}
  44. <tr>
  45. <td>{$vo.id}</td>
  46. <td>{$vo.content}</td>
  47. <td>{$vo.nickname}</td>
  48. <td class="text-center">
  49. {if condition="$vo['status'] eq 1"}
  50. 审核通过<br/>
  51. {elseif condition="$vo['status'] eq 2"/}
  52. 审核未通过
  53. {else/}
  54. 未审核<br/>
  55. <button data-url="{:url('fail',['id'=>$vo['id']])}" class="j-fail btn btn-danger btn-xs"
  56. type="button"><i class="fa fa-close"></i> 无效
  57. </button>
  58. <button data-url="{:url('succ',['id'=>$vo['id']])}" class="j-success btn btn-primary btn-xs"
  59. type="button"><i class="fa fa-check"></i> 通过
  60. </button>
  61. {/if}
  62. </td>
  63. <td>{$vo.add_time|date="Y-m-d H:i:s"}</td>
  64. <td class="text-center">
  65. <button style="margin-top: 5px;" class="btn btn-danger btn-xs del_news_one" data-id="{$vo.id}" type="button" data-url="{:Url('delete',array('id'=>$vo['id']))}" ><i class="fa fa-times"></i> 删除</button>
  66. </td>
  67. </tr>
  68. {/volist}
  69. </tbody>
  70. </table>
  71. </div>
  72. <div style="margin-left: 10px">
  73. {include file="public/inner_page"}
  74. </div>
  75. </div>
  76. </div>
  77. </div>
  78. {/block}
  79. {block name="script"}
  80. <script>
  81. $('.del_news_one').on('click',function(){
  82. window.t = $(this);
  83. var _this = $(this),url =_this.data('url');
  84. $eb.$swal('delete',function(){
  85. $eb.axios.get(url).then(function(res){
  86. console.log(res);
  87. if(res.status == 200 && res.data.code == 200) {
  88. $eb.$swal('success',res.data.msg);
  89. _this.parents('tr').remove();
  90. }else
  91. return Promise.reject(res.data.msg || '删除失败')
  92. }).catch(function(err){
  93. $eb.$swal('error',err);
  94. });
  95. })
  96. });
  97. $('#lb').on('click',function(){
  98. location.href = "{:Url('qa.Questions/index')}";
  99. })
  100. $('.j-fail').on('click', function () {
  101. var url = $(this).data('url');
  102. $eb.$swal('delete', function () {
  103. $eb.axios.post(url).then(function (res) {
  104. if (res.data.code == 200) {
  105. setTimeout(function () {
  106. window.location.reload();
  107. }, 1000);
  108. $eb.$swal('success', res.data.msg);
  109. } else
  110. $eb.$swal('error', res.data.msg || '操作失败!');
  111. });
  112. }, {
  113. title: '确定审核拒绝?',
  114. text: '拒绝后无法撤销,请谨慎操作!',
  115. confirm: '审核拒绝'
  116. });
  117. });
  118. $('.j-success').on('click', function () {
  119. var url = $(this).data('url');
  120. $eb.$swal('delete', function () {
  121. $eb.axios.post(url).then(function (res) {
  122. if (res.data.code == 200) {
  123. setTimeout(function () {
  124. window.location.reload();
  125. }, 1000);
  126. $eb.$swal('success', res.data.msg);
  127. } else
  128. $eb.$swal('error', res.data.msg || '操作失败!');
  129. });
  130. }, {
  131. title: '确定审核通过?',
  132. text: '通过后无法撤销,请谨慎操作!',
  133. confirm: '审核通过'
  134. });
  135. });
  136. </script>
  137. {/block}