edit.htm 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <link rel="stylesheet" href="/admin/assets/css/bootstrap.min.css" />
  2. <link rel="stylesheet" href="/admin/assets/css/font-awesome.min.css" />
  3. <link rel="stylesheet" href="/admin/assets/css/ace.min.css" />
  4. <link rel="stylesheet" href="/admin/assets/css/ace-rtl.min.css" />
  5. <link rel="stylesheet" href="/admin/assets/css/ace-skins.min.css" />
  6. <link rel="stylesheet" href="/admin/css/style.css" />
  7. <script src="/admin/script/jquery.min.js"></script>
  8. <script src="/admin/script/jquery.form.js"></script>
  9. <!-- 文件上传所需要css和js -->
  10. <link rel="stylesheet" href="/admin/script/FileUpload/css/jquery.fileupload.css">
  11. <script type="text/javascript" src="/admin/script/FileUpload/jquery.iframe-transport.js"></script>
  12. <script type="text/javascript" src="/admin/script/FileUpload/vendor/jquery.ui.widget.js"></script>
  13. <script type="text/javascript" src="/admin/script/FileUpload/jquery.fileupload.js"></script>
  14. <div class="page-content" style="height:450px;overflow:scroll;">
  15. <div class="page-header">
  16. <h1>编辑瓶子</h1>
  17. </div>
  18. <div class="row">
  19. <div class="col-xs-12">
  20. <form class="form-horizontal" action="/admin/bottle/update" method="post" id="submit_form">
  21. <div class="form-group">
  22. <label class="col-sm-3 control-label"><span style="color: #f00">*</span>名称</label>
  23. <div class="col-sm-9">
  24. <input type="text" name="title" value="${bottle.title!}" class="col-xs-10 col-sm-5" style="border: 1px solid #ccc" />
  25. </div>
  26. </div>
  27. <div class="space-4"></div>
  28. <div class="form-group">
  29. <label class="col-sm-3 control-label"><span style="color: #f00">*</span>重量/g</label>
  30. <div class="col-sm-9">
  31. <input type="text" name="weight" value="${bottle.weight!}" class="col-xs-10 col-sm-5" style="border: 1px solid #ccc" />
  32. </div>
  33. </div>
  34. <div class="space-4"></div>
  35. <div class="form-group">
  36. <label class="col-sm-3 control-label"><span style="color: #f00">*</span>标签宽度/mm</label>
  37. <div class="col-sm-9">
  38. <input type="text" name="diy_width" value="${bottle.diy_width!}" class="col-xs-10 col-sm-5" style="border: 1px solid #ccc" />
  39. </div>
  40. </div>
  41. <div class="space-4"></div>
  42. <div class="form-group">
  43. <label class="col-sm-3 control-label"><span style="color: #f00">*</span>标签高度/mm</label>
  44. <div class="col-sm-9">
  45. <input type="text" name="diy_height" value="${bottle.diy_height!}" class="col-xs-10 col-sm-5" style="border: 1px solid #ccc" />
  46. </div>
  47. </div>
  48. <div class="space-4"></div>
  49. <div class="form-group">
  50. <label class="col-sm-2 control-label"><span style="color: #f00">*</span>图片</label>
  51. <div class="col-sm-10">
  52. <a href="javascript:void(0);" class="file">选择图片
  53. <input type="file" class="autosize-transition form-control" name="image" id="uploadImg" style="overflow: hidden; word-wrap: break-word; resize: horizontal;border: 1px #ccc solid;" />
  54. </a>
  55. <div style="margin-top:10px;">
  56. <img style="height:100px;" id="img_url" src="${bottle.img_url!}" />
  57. </div>
  58. </div>
  59. </div>
  60. <input type="hidden" name="img_url" value="${bottle.img_url!}" />
  61. <input type="hidden" name="id" value="${bottle.id!}" />
  62. </form>
  63. </div>
  64. </div>
  65. </div>
  66. <div style="width:100%;text-align: center;">
  67. <button type="button" class="btn btn-info" onclick="return submitForm()" style="padding:0px 5px;margin-top:5px;">
  68. <i class="icon-ok bigger-110"></i>确定
  69. </button>
  70. &nbsp;&nbsp;
  71. <button type="reset" class="btn" onclick="parent.hideAlert()" style="padding:0px 5px;margin-top:5px;">
  72. <i class="icon-undo bigger-110"></i>取消
  73. </button>
  74. </div>
  75. <script>
  76. $('#uploadImg').fileupload({
  77. url: '/admin/uploadImg',
  78. dataType: 'json',
  79. done: function (e,data) {
  80. var json = $.parseJSON(data.jqXHR.responseText);
  81. if(json.success){
  82. $("#img_url").attr("src", json.img_url);
  83. $("#img_url").show();
  84. $("input[name='img_url']").val(json.img_url);
  85. }else{
  86. alert(json.msg);
  87. }
  88. }
  89. });
  90. function submitForm(){
  91. $('#submit_form').ajaxSubmit({
  92. success: function(data){
  93. alert(data.msg);
  94. if(data.success){
  95. parent.location.reload();
  96. }
  97. }
  98. });
  99. }
  100. </script>