index.php 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. {extend name="public/container"}
  2. {block name="content"}
  3. <div class="row">
  4. <div class="col-sm-12">
  5. <div class="ibox">
  6. <div class="ibox-title">
  7. <button type="button" class="btn btn-w-m btn-primary" onclick="$eb.createModalFrame(this.innerText,'{:Url('create')}')">添加通知</button>
  8. </div>
  9. <div class="ibox-content">
  10. <div class="table-responsive">
  11. <table class="table table-striped table-bordered">
  12. <thead>
  13. <tr>
  14. <th class="text-center">编号</th>
  15. <th class="text-center">发送人</th>
  16. <th class="text-center">通知标题</th>
  17. <th class="text-center" width="700">通知内容</th>
  18. <th class="text-center">消息类型</th>
  19. <th class="text-center">是否发送</th>
  20. <th class="text-center">操作</th>
  21. </tr>
  22. </thead>
  23. <tbody class="">
  24. {volist name="list" id="vo"}
  25. <tr>
  26. <td class="text-center">{$vo.id}</td>
  27. <td class="text-center">{$vo.user}</td>
  28. <td class="text-center">{$vo.title}</td>
  29. <td class="text-center">{$vo.content}</td>
  30. <td class="text-center">
  31. {if condition="$vo['type'] eq 1"}
  32. 系统消息
  33. {elseif condition="$vo['type'] eq 2" /}
  34. 用户通知
  35. {/if}
  36. </td>
  37. <td class="text-center">
  38. {if condition="$vo['is_send'] eq 1"}
  39. 状态:<span style="color:green;">已发送</span><br />
  40. 时间:{$vo.send_time|date='Y-m-d H:i:s',###}
  41. {else /}
  42. 状态:<span style="color:red;">未发送</span> <a class="btn-send" data-url="{:Url('send',array('id'=>$vo['id']))}">立即发送</a>
  43. {/if}
  44. </td>
  45. <td class="text-center">
  46. <button class="btn btn-info btn-xs" type="button" onclick="window.location.href='{:Url('user',array('id'=>$vo['id']))}'"><i class="fa fa-user"></i> 用户信息</button>
  47. {if condition="$vo['is_send'] eq 0"}
  48. <button class="btn btn-info btn-xs" type="button" onclick="$eb.createModalFrame('编辑','{:Url('edit',array('id'=>$vo['id']))}')"><i class="fa fa-paste"></i> 编辑</button>
  49. {/if}
  50. <button class="btn btn-warning btn-xs" data-url="{:Url('delete',array('id'=>$vo['id']))}" type="button"><i class="fa fa-warning"></i> 删除</button>
  51. </td>
  52. </tr>
  53. {/volist}
  54. </tbody>
  55. </table>
  56. </div>
  57. {include file="public/inner_page"}
  58. </div>
  59. </div>
  60. </div>
  61. </div>
  62. {/block}
  63. {block name="script"}
  64. <script>
  65. $('.btn-warning').on('click',function(){
  66. window.t = $(this);
  67. var _this = $(this),url =_this.data('url');
  68. $eb.$swal('delete',function(){
  69. $eb.axios.get(url).then(function(res){
  70. if(res.status == 200 && res.data.code == 200) {
  71. $eb.$swal('success',res.data.msg);
  72. _this.parents('tr').remove();
  73. }else
  74. return Promise.reject(res.data.msg || '删除失败')
  75. }).catch(function(err){
  76. $eb.$swal('error',err);
  77. });
  78. })
  79. });
  80. $('.btn-send').on('click',function(){
  81. var _this = $(this),url =_this.data('url');
  82. $eb.$swal('delete',function(){
  83. $eb.axios.get(url).then(function(res){
  84. if(res.status == 200 && res.data.code == 200) {
  85. $eb.$swal('success',res.data.msg);
  86. window.location.reload();
  87. }else
  88. return Promise.reject(res.data.msg || '发送失败')
  89. }).catch(function(err){
  90. $eb.$swal('error',err);
  91. });
  92. },{
  93. title:"您确定要发送这条信息吗",
  94. text:"发送后将无法修改通知信息,请谨慎操作!",
  95. confirm:"是的,我要发送!",
  96. cancel:"让我再考虑一下"
  97. })
  98. });
  99. $('.head_image').on('click',function (e) {
  100. var image = $(this).data('image');
  101. $eb.openImage(image);
  102. })
  103. </script>
  104. {/block}