userlist.php 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Administrator
  5. * Date: 2017/5/23 0023
  6. * Time: 下午 8:24
  7. */
  8. use yii\helpers\Url;
  9. use yii\widgets\LinkPager;
  10. ?>
  11. <div class="row">
  12. <div class="col-sm-12">
  13. <div class="ibox float-e-margins">
  14. <div class="ibox-content">
  15. <div class="row">
  16. <div class="col-sm-5 m-b-xs">
  17. <div class="col-sm-9">
  18. </div>
  19. </div>
  20. </div>
  21. <div class="table-responsive">
  22. <table class="table table-striped">
  23. <thead>
  24. <tr>
  25. <th>id</th>
  26. <th>用户名</th>
  27. <th>昵称</th>
  28. <th>头像</th>
  29. <th>电话</th>
  30. <th>注册时间</th>
  31. <th>操作</th>
  32. </tr>
  33. </thead>
  34. <tbody>
  35. <?php if(!empty($datas)):?>
  36. <?php foreach($datas as $data):?>
  37. <tr>
  38. <td><?=$data->id?></td>
  39. <td><?=$data->username?></td>
  40. <?php $userinfo = isset($data->userinfo)?$data->userinfo:''?>
  41. <td><?=isset($userinfo->nickname)?$userinfo->nickname:''?></td>
  42. <td> <img src="<?=empty($userinfo->portrait)?\common\models\User::DEFAULT_FACE:\common\models\UserInfo::imagesUrl($userinfo->portrait)?>" style=" width: 50px;"></td>
  43. <td><?=isset($data->tel)?$data->tel:''?></td>
  44. <?unset($userinfo)?>
  45. <td><?=date('Y-m-d H:i',$data->created_at)?></td>
  46. <td>
  47. <!-- <a href="--><?//=Url::toRoute(['webconfig/addadvert','id'=>$data->id])?><!--" class="btn btn-sm btn-primary edit_advert">修改</a>-->
  48. <a class="btn btn-sm btn-danger del"data="<?= $data->id?>">删除</a>
  49. </td>
  50. </tr>
  51. <?php endforeach;?>
  52. <?php endif?>
  53. </tbody>
  54. </table>
  55. </div>
  56. </div>
  57. </div>
  58. <?= LinkPager::widget(['pagination' => $pages]); ?>
  59. </div>
  60. </div>
  61. <script>
  62. $('.table-responsive').on('click','.del',function(){
  63. var id = $(this).attr('data');
  64. var text = $(this);
  65. swal({
  66. title: "确定删除该用户?",
  67. type: "warning",
  68. showCancelButton: true,
  69. confirmButtonColor: "#DD6B55",
  70. confirmButtonText: "确定",
  71. cancelButtonText: "取消",
  72. closeOnConfirm: true,
  73. closeOnCancel: true },
  74. function(isConfirm){
  75. if (isConfirm) {
  76. $.ajax({
  77. url:'<?=Url::toRoute(['user/del_company']);?>',
  78. type:'POST',
  79. dataType:'json',
  80. data:{id:id,'_csrf-backend':'<?=Yii::$app->request->csrfToken;?>'},
  81. success:function(data){
  82. if(data.sign==1){
  83. text.parents('tr').remove();
  84. }else{
  85. swal("", data.msg, "error");
  86. }
  87. }
  88. })
  89. }
  90. });
  91. })
  92. $('.user-conduct').click(function(){
  93. var ele = $(this);
  94. var id = ele.parent().attr('data');
  95. var conduct = $(this).attr('date');
  96. if(conduct=='agree'){
  97. var text = "确定审核通过?";
  98. }else{
  99. var text = "确定审核驳回?";
  100. }
  101. swal({
  102. title: "提醒",
  103. text: text,
  104. type: "warning",
  105. showCancelButton: true,
  106. confirmButtonColor: "#DD6B55",
  107. confirmButtonText: "确定",
  108. cancelButtonText: "取消",
  109. closeOnConfirm: false
  110. }, function () {
  111. $.ajax({
  112. url:'<?=Url::toRoute(['user/useraudit']);?>',
  113. type:'POST',
  114. dataType:'json',
  115. data:{'id':id,'conduct':conduct,'_csrf-backend':'<?=Yii::$app->request->csrfToken;?>'},
  116. success:function(data){
  117. if(data.sign==1){
  118. swal("", data.msg, "success");
  119. ele.parent().parent().remove();
  120. }else{
  121. swal("", data.msg, "error");
  122. }
  123. }
  124. });
  125. });
  126. })
  127. </script>