edit.htm 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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/material/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" class="col-xs-10 col-sm-5" style="border: 1px solid #ccc" value="${material.title!}" />
  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>素材分类</label>
  30. <div class="col-sm-9" id="area_list">
  31. <select name="type_id" class="col-xs-10 col-sm-5">
  32. ##for(_type in type_list!){
  33. <option value="${_type.id!}">${_type.title!}</option>
  34. ##}
  35. </select>
  36. </div>
  37. </div>
  38. <div class="space-4"></div>
  39. <div class="form-group">
  40. <label class="col-sm-2 control-label"><span style="color: #f00">*</span>图片</label>
  41. <div class="col-sm-10">
  42. <a href="javascript:void(0);" class="file">选择图片
  43. <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;" />
  44. </a>
  45. <div style="margin-top:10px;">
  46. <img src="${material.img_url!}" style="height:100px;" id="img_url" />
  47. </div>
  48. </div>
  49. </div>
  50. <input type="hidden" name="img_url" value="${material.img_url!}" />
  51. <input type="hidden" name="id" value="${material.id!}" />
  52. </form>
  53. </div>
  54. </div>
  55. </div>
  56. <div style="width:100%;text-align: center;">
  57. <button type="button" class="btn btn-info" onclick="return submitForm()" style="padding:0px 5px;margin-top:5px;">
  58. <i class="icon-ok bigger-110"></i>确定
  59. </button>
  60. &nbsp;&nbsp;
  61. <button type="reset" class="btn" onclick="parent.hideAlert()" style="padding:0px 5px;margin-top:5px;">
  62. <i class="icon-undo bigger-110"></i>取消
  63. </button>
  64. </div>
  65. <script>
  66. $(document).ready(function(){
  67. $("select[name='type_id']").val("${material.material_type_id!}");
  68. });
  69. $('#uploadImg').fileupload({
  70. url: '/admin/uploadImg',
  71. dataType: 'json',
  72. done: function (e,data) {
  73. var json = $.parseJSON(data.jqXHR.responseText);
  74. if(json.success){
  75. $("#img_url").attr("src", json.img_url);
  76. $("#img_url").show();
  77. $("input[name='img_url']").val(json.img_url);
  78. }else{
  79. alert(json.msg);
  80. }
  81. }
  82. });
  83. function submitForm(){
  84. $('#submit_form').ajaxSubmit({
  85. success: function(data){
  86. alert(data.msg);
  87. if(data.success){
  88. parent.location.reload();
  89. }
  90. }
  91. });
  92. }
  93. </script>