jk_imageList.js 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. $(document).ready(function () {
  2. $('.popup-gallery').magnificPopup({
  3. delegate: '.popupA',
  4. type: 'image',
  5. tLoading: 'Loading image ......',
  6. mainClass: 'mfp-img-mobile',
  7. gallery: {
  8. enabled: true,
  9. navigateByImgClick: true,
  10. preload: [0, 1], // Will preload 0 - before current, and 1 after the current image
  11. arrowMarkup: '<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>', // markup of an arrow button
  12. tPrev: 'Previous (Left arrow key)', // title for left button
  13. tNext: 'Next (Right arrow key)', // title for right button
  14. tCounter: '<span class="mfp-counter">%curr% of %total%</span>' // 标记的计数器
  15. },
  16. image: {
  17. tError: '<a href="%url%">The image #%curr%</a> could not be loaded.',
  18. titleSrc: function (item) {
  19. return item.el.attr('title') + '<small></small>';
  20. }
  21. }
  22. });
  23. })
  24. //删除
  25. function del(obj) {
  26. console.log(obj)
  27. layer.confirm('是否删除?', {
  28. btn: ['确定', '取消'] //可以无限个按钮
  29. , btn3: function (index, layero) {
  30. //按钮【按钮三】的回调
  31. }
  32. }, function (index, layero) {
  33. var array = [];
  34. var addr = obj.parent().find('img').attr('src');
  35. array.push(addr);
  36. var imei = obj.prev().prev().val();
  37. layer.close(index)
  38. $.ajax({
  39. url: 'jkimage_del',
  40. type: 'post',
  41. data: {
  42. addr: addr,
  43. // addr: array,
  44. imei: imei
  45. },
  46. success: function (data) {
  47. if (data) {
  48. $.ajax({
  49. url: 'jk_image',
  50. type: 'post',
  51. data:{
  52. imei:$('#imei').val(),
  53. page:$('.layui-laypage-curr em').eq(1).html()
  54. },
  55. success: function (data) {
  56. $('#imgList').html('');
  57. $('#imgList').html(data);
  58. if ($('.content').height() > 750) {
  59. $('#iframe-main', parent.document).css('height', $('.content').height() + 20)
  60. } else {
  61. $('#iframe-main', parent.document).css('height', '750px')
  62. }
  63. }
  64. })
  65. } else {
  66. alert('删除失败')
  67. }
  68. }
  69. })
  70. }, function (index) {
  71. //按钮【按钮二】的回调
  72. });
  73. }