query_head_user.html 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <div style='max-height:500px;overflow:auto;min-width:850px;'>
  2. <table class="table supplyquery table-hover" style="min-width:850px;">
  3. <div class="input-group layui-row" style="margin:10px;">
  4. <input type="text" placeholder="请输入昵称进行搜索" id="select-url-kw" value="" class="form-control">
  5. <span class="input-group-addon btn btn-default select-btn" data-type="url" id="sarchBtn">搜索</span>
  6. </div>
  7. <tbody>
  8. <?php foreach( $ds as $row ){ ?>
  9. <tr>
  10. <td><img src='{php echo $row['avatar']}' style='width:30px;height:30px;padding1px;border:1px solid #ccc' /> {$row['nickname']}</td>
  11. <td>{$row['mobile']}</td>
  12. <td style="width:80px;"><a href="javascript:;" class="choose_dan_link" data-json='{:json_encode($row);}'>选择</a></td>
  13. </tr>
  14. <?php } ?>
  15. <?php if( count($ds)<=0){ ?>
  16. <tr>
  17. <td colspan='4' align='center'>未找到团长</td>
  18. </tr>
  19. <?php } ?>
  20. </tbody>
  21. <?php if( count($ds) > 0){ ?>
  22. <tfoot>
  23. <tr>
  24. <td colspan='4' align='center' id="pager_ajax">{$pager}</td>
  25. </tr>
  26. </tfoot>
  27. <?php } ?>
  28. </table>
  29. </div>
  30. <script>
  31. var query_kwd = '{$kwd}';
  32. var query_url = "{:U('communityhead/query_head_user')}";
  33. var can_next = true;
  34. $(document).delegate(".choose_dan_link","click",function(){
  35. //data-json
  36. var json_obj = JSON.parse($(this).attr('data-json'));
  37. var p_html = '';
  38. p_html+= '<div class="input-group " style="margin: 0;">';
  39. p_html+= ' <div class="layadmin-text-center choose_user">';
  40. p_html+= ' <img style="" src="'+json_obj.avatar+'">';
  41. p_html+= ' <div class="layadmin-maillist-img" style="">'+json_obj.username+'</div>';
  42. p_html+= ' <button type="button" class="layui-btn layui-btn-sm" onclick="cancle_bind(this)"><i class="layui-icon">&#xe640;</i></button>';
  43. p_html+= ' </div>';
  44. p_html+= '</div>';
  45. $(cur_open_div).parent().siblings().remove();
  46. $(cur_open_div).parent().after(p_html);
  47. $(cur_open_div).val( json_obj.member_id );
  48. layer.close(layer.index);
  49. });
  50. $("body").delegate(".pagination a","click",function(){
  51. var s_page = $(this).attr('page');
  52. if(!can_next)
  53. {
  54. return false;
  55. }
  56. can_next = false;
  57. $.ajax({
  58. url:query_url,
  59. type:'post',
  60. dataType:'json',
  61. data:{keyword:query_kwd, page:s_page,is_ajax:1},
  62. success:function(ret){
  63. if(ret.code == 0)
  64. {
  65. $('.supplyquery tbody').html(ret.html);
  66. $('#pager_ajax').html(ret.pager);
  67. }
  68. can_next = true;
  69. }
  70. })
  71. })
  72. $("body").delegate("#sarchBtn","click",function(){
  73. var keyword = $('#select-url-kw').val();
  74. $.ajax({
  75. url:query_url,
  76. type:'post',
  77. dataType:'json',
  78. data:{keyword:keyword,page:1,is_ajax:1},
  79. success:function(ret){
  80. if(ret.code == 0)
  81. {
  82. $('.supplyquery tbody').html(ret.html);
  83. $('#pager_ajax').html(ret.pager);
  84. }
  85. }
  86. })
  87. })
  88. </script>