member.blade.php 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. {!! $grid !!}
  2. <style>
  3. p#vtip { display: none; position: absolute; padding: 10px; left: 5px; font-size: 0.8em; background-color: white; border: 1px solid #a6c9e2; -moz-border-radius: 5px; -webkit-border-radius: 5px; z-index: 9999 }
  4. p#vtip #vtipArrow { position: absolute; top: -10px; left: 5px }
  5. </style>
  6. <script>
  7. $(function () {
  8. $('.restore_person').unbind('click').click(function() {
  9. var id = $(this).data('id');
  10. swal({
  11. title: "确认还原?",
  12. type: "warning",
  13. showCancelButton: true,
  14. confirmButtonColor: "#DD6B55",
  15. confirmButtonText: "确认",
  16. showLoaderOnConfirm: true,
  17. cancelButtonText: "取消",
  18. preConfirm: function() {
  19. return new Promise(function(resolve) {
  20. $.ajax({
  21. method: 'post',
  22. url: '{{admin_base_path()}}/recycle/person/restore/' + id,
  23. data: {
  24. _method:'post',
  25. _token:LA.token,
  26. },
  27. success: function (data) {
  28. $.pjax.reload('#pjax-container');
  29. resolve(data);
  30. }
  31. });
  32. });
  33. }
  34. }).then(function(result) {
  35. var data = result.value;
  36. if (typeof data === 'object') {
  37. if (data.status) {
  38. swal(data.message, '', 'success');
  39. } else {
  40. swal(data.message, '', 'error');
  41. }
  42. }
  43. });
  44. });
  45. $('.grid-batch-restore').on('click', function() {
  46. var id_array=new Array();
  47. $('input[class="grid-row-checkbox"]:checked').each(function(){
  48. id_array.push($(this).attr('data-id'));
  49. });
  50. var id=id_array.join(',');
  51. if (id.length==0){
  52. swal('请勾选需要还原的个人会员!', '', 'error');
  53. return;
  54. }
  55. swal({
  56. title: "确认还原?",
  57. type: "warning",
  58. showCancelButton: true,
  59. confirmButtonColor: "#DD6B55",
  60. confirmButtonText: "确认",
  61. showLoaderOnConfirm: true,
  62. cancelButtonText: "取消",
  63. preConfirm: function() {
  64. return new Promise(function(resolve) {
  65. $.ajax({
  66. method: 'post',
  67. url: '{{admin_base_path()}}/recycle/person/restore/' + id,
  68. data: {
  69. _method:'post',
  70. _token:LA.token,
  71. },
  72. success: function (data) {
  73. $.pjax.reload('#pjax-container');
  74. resolve(data);
  75. }
  76. });
  77. });
  78. }
  79. }).then(function(result) {
  80. var data = result.value;
  81. if (typeof data === 'object') {
  82. if (data.status) {
  83. swal(data.message, '', 'success');
  84. } else {
  85. swal(data.message, '', 'error');
  86. }
  87. }
  88. });
  89. });
  90. vtip = function() {
  91. this.xOffset = -10;
  92. this.yOffset = 15;
  93. $(".vtip").unbind().hover(
  94. function(e) {
  95. this.t = $(this).attr("title");
  96. this.title = '';
  97. this.top = (e.pageY + yOffset);
  98. this.left = (e.pageX + xOffset);
  99. $('body').css("cursor","help");
  100. $('p#vtip').width()>450?$('p#vtip').width(450):'';
  101. $('body').append( '<p id="vtip">' + this.t + '</p>' );
  102. $('p#vtip').css("top", this.top+"px").css("left", this.left+"px").fadeIn(0);
  103. },
  104. function() {
  105. this.title = this.t;
  106. $('body').css("cursor","");
  107. $("p#vtip").fadeOut("slow").remove();
  108. }
  109. ).mousemove(
  110. function(e) {
  111. this.top = (e.pageY + yOffset);
  112. this.left = (e.pageX + xOffset);
  113. $("p#vtip").css("top", this.top+"px").css("left", this.left+"px");
  114. }
  115. );
  116. };
  117. vtip();
  118. });
  119. </script>