handle.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. $(function(){
  2. var ApiHOST = "http://api.say365.xin/ss-admin";
  3. $(".handle_btn_save").click(function(){
  4. var load = layer.load();
  5. var imglist = [];
  6. var paperno = $("h3").attr("data-paperno");
  7. var paperid = $("h3").attr("data-paperid");
  8. $(".cut_imgview").each(function(index){
  9. var cutimg = {};
  10. var id = $(this).attr("data-id");
  11. console.log(id);
  12. if(id==undefined){
  13. id = 0;
  14. }
  15. cutimg.id = id;
  16. cutimg.imgtype = $(this).attr("data-image-type");
  17. cutimg.point = $(this).attr("data-point");
  18. cutimg.page = parseInt($(this).attr("data-page"))-1;
  19. if($(this).find(".subqueinput").length){
  20. cutimg.squeno = $(this).find(".subqueinput").val();
  21. }else{
  22. cutimg.squeno = 0;
  23. }
  24. cutimg.queno = $(this).parents(".cut_img_box_li").find(".quenoinput").val();
  25. imglist.push(cutimg);
  26. });
  27. console.log(imglist);
  28. //保存切片
  29. var url = ApiHOST+"/ss-admin/savestdpieces/";
  30. var params = {
  31. paper_id:paperid,
  32. paper_no:paperno,
  33. cut_paper_imgs_info:imglist,
  34. };
  35. $.ajax({
  36. type:"post",
  37. url:url,
  38. data:JSON.stringify(params),
  39. //dataType:'json',
  40. success:function(data){
  41. console.log(data);
  42. if(data.code==1){
  43. layer.alert("保存成功",{
  44. icon:1
  45. });
  46. window.location.reload();
  47. }
  48. layer.close(load);
  49. }
  50. });
  51. });
  52. });