人人商城

fans.html 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <table class="table">
  2. <thead>
  3. <th>选择</th>
  4. <th>粉丝昵称</th>
  5. <th>
  6. <div class="input-group">
  7. <input name="nickname" class="form-control" value="{$_GPC['nickname']}">
  8. <span class="input-group-btn">
  9. <button type="button" id="search" class="btn btn-default">搜索</button>
  10. </span>
  11. </div>
  12. </th>
  13. </thead>
  14. <tbody>
  15. {loop $fans $fan}
  16. {if !empty($fan['nickname'])}
  17. <tr>
  18. <td>
  19. <input name="openids" type="checkbox" value="{$fan['openid']}"{if in_array($fan['openid'], $check_fans)}checked{/if}></label>
  20. </td>
  21. <td>{$fan['nickname']}</td>
  22. <td></td>
  23. </tr>
  24. {/if}
  25. </tbody>
  26. {/loop}
  27. </table>
  28. {$pager}
  29. <script>
  30. require(['jquery'], function($) {
  31. $('[name="openids"]').click(function() {
  32. if ($(this).prop('checked')) {
  33. openids.push($(this).val());
  34. } else {
  35. delete openids[openids.indexOf($(this).val())];
  36. }
  37. var openid = new Array;
  38. var i = 0;
  39. for (var val in openids) {
  40. if (openids[val] != '') {
  41. openid[i] = openids[val];
  42. i++;
  43. }
  44. }
  45. openids = openid;
  46. document.cookie = 'fans_openids'+'{$_W['uniacid']}'+ '= '+JSON.stringify(openids);
  47. openidnum.html(openids.length);
  48. });
  49. $('.pagination a').click(function() {
  50. var page = $(this).attr('page');
  51. showFans(page, $('[name="nickname"]').val());
  52. });
  53. $('#search').click(function() {
  54. showFans(1, $('[name="nickname"]').val());
  55. });
  56. });
  57. </script>