add.htm 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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/save" 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" />
  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 style="height:100px;display: none;" id="img_url" />
  47. </div>
  48. </div>
  49. </div>
  50. <input type="hidden" name="img_url" />
  51. </form>
  52. </div>
  53. </div>
  54. </div>
  55. <div style="width:100%;text-align: center;">
  56. <button type="button" class="btn btn-info" onclick="return submitForm()" style="padding:0px 5px;margin-top:5px;">
  57. <i class="icon-ok bigger-110"></i>确定
  58. </button>
  59. &nbsp;&nbsp;
  60. <button type="reset" class="btn" onclick="parent.hideAlert()" style="padding:0px 5px;margin-top:5px;">
  61. <i class="icon-undo bigger-110"></i>取消
  62. </button>
  63. </div>
  64. <script>
  65. $('#uploadImg').fileupload({
  66. url: '/admin/uploadImg',
  67. dataType: 'json',
  68. done: function (e,data) {
  69. var json = $.parseJSON(data.jqXHR.responseText);
  70. if(json.success){
  71. $("#img_url").attr("src", json.img_url);
  72. $("#img_url").show();
  73. $("input[name='img_url']").val(json.img_url);
  74. }else{
  75. alert(json.msg);
  76. }
  77. }
  78. });
  79. function submitForm(){
  80. $('#submit_form').ajaxSubmit({
  81. success: function(data){
  82. alert(data.msg);
  83. if(data.success){
  84. parent.location.reload();
  85. }
  86. }
  87. });
  88. }
  89. </script>