edit.htm 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. ##tlayout("admin/layout.htm"){
  2. <!-- 文件上传所需要css和js -->
  3. <link rel="stylesheet" href="/admin/script/FileUpload/css/jquery.fileupload.css">
  4. <script type="text/javascript" src="/admin/script/FileUpload/jquery.iframe-transport.js"></script>
  5. <script type="text/javascript" src="/admin/script/FileUpload/vendor/jquery.ui.widget.js"></script>
  6. <script type="text/javascript" src="/admin/script/FileUpload/jquery.fileupload.js"></script>
  7. <div class="breadcrumbs" style="height: 50px;">
  8. <div class="breadcrumbs_title">编辑轮播图</div>
  9. </div>
  10. <div class="page-content">
  11. <div class="row" style="margin-top: 30px;">
  12. <div class="col-xs-12">
  13. <form class="form-horizontal" action="/admin/carousel/update" method="post" id="submit_form">
  14. <div class="form-group">
  15. <label class="col-sm-2 control-label"><span style="color: #f00">*</span>标题</label>
  16. <div class="col-sm-10">
  17. <input type="text" value="${carousel.title!}" name="title" class="col-xs-10 col-sm-5" style="border: 1px solid #ccc" />
  18. </div>
  19. </div>
  20. <div class="space-4"></div>
  21. <div class="form-group">
  22. <label class="col-sm-2 control-label"><span style="color: #f00">*</span>链接</label>
  23. <div class="col-sm-10">
  24. <input type="text" value="${carousel.url!}" name="url" 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-2 control-label"><span style="color: #f00">*</span>顺序</label>
  30. <div class="col-sm-10">
  31. <input type="text" value="${carousel.idx!}" name="idx" 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-2 control-label"><span style="color: #f00">*</span>图片</label>
  37. <div class="col-sm-10">
  38. <a href="javascript:void(0);" class="file">选择图片
  39. <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;" />
  40. </a>
  41. <div style="margin-top:10px;">
  42. <img src="${carousel.img_url!}" style="height:100px;" id="img_url" />
  43. </div>
  44. </div>
  45. </div>
  46. <div class="space-4"></div>
  47. <div class="form-group">
  48. <label class="col-sm-2 control-label"></label>
  49. <div class="col-sm-10">
  50. <button class="btn btn-info" type="button" onclick="submitForm()"><i class="icon-ok bigger-110"></i>确定</button>
  51. &nbsp; &nbsp; &nbsp;
  52. <button class="btn" type="button" onclick="javascript:history.back(-1)"><i class="icon-undo bigger-110"></i>取消</button>
  53. </div>
  54. </div>
  55. <input type="hidden" name="img_url" value="${carousel.img_url!}" />
  56. <input type="hidden" name="id" value="${carousel.id!}" />
  57. </form>
  58. </div>
  59. </div>
  60. </div>
  61. <script>
  62. $('#uploadImg').fileupload({
  63. url: '/admin/uploadImg',
  64. dataType: 'json',
  65. done: function (e,data) {
  66. var json = $.parseJSON(data.jqXHR.responseText);
  67. if(json.success){
  68. $("#img_url").attr("src", json.img_url);
  69. $("input[name='img_url']").val(json.img_url);
  70. }else{
  71. alert(json.msg);
  72. }
  73. }
  74. });
  75. function submitForm(){
  76. $('#submit_form').ajaxSubmit({
  77. success: function(data){
  78. alert(data.msg);
  79. if(data.success){
  80. parent.location.href="/admin/carousel";
  81. }
  82. }
  83. });
  84. }
  85. </script>
  86. ##}