edit.html 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <!DOCTYPE html>
  2. <html lang="zh" xmlns:th="http://www.thymeleaf.org" >
  3. <head>
  4. <th:block th:include="include :: header('修改企业荣誉')" />
  5. <th:block th:include="include :: jasny-bootstrap-css" />
  6. </head>
  7. <body class="white-bg">
  8. <div class="wrapper wrapper-content animated fadeInRight ibox-content">
  9. <form class="form-horizontal m" id="form-company_honour-edit" th:object="${companyHonour}">
  10. <input name="honourId" th:field="*{honourId}" type="hidden">
  11. <div class="form-group">
  12. <label class="col-sm-3 control-label">荣誉描述:</label>
  13. <div class="col-sm-8">
  14. <textarea name="des" class="form-control">[[*{des}]]</textarea>
  15. </div>
  16. </div>
  17. <div class="form-group">
  18. <label class="col-sm-3 control-label">荣誉图片:</label>
  19. <div class="col-sm-8">
  20. <input id="input-img" name="img" type="hidden" th:field="*{img}">
  21. <img th:src="*{img}" id="img-img" style="max-width: 200px;max-height: 200px">
  22. <div>
  23. <span class="btn btn-white btn-file">
  24. <span class="fileinput-exists">更改</span>
  25. <input id="input-fileinput" type="file">
  26. </span>
  27. </div>
  28. </div>
  29. </div>
  30. </form>
  31. </div>
  32. <th:block th:include="include :: footer" />
  33. <script type="text/javascript">
  34. var prefix = ctx + "company/honour";
  35. $("#form-company_honour-edit").validate({
  36. focusCleanup: true
  37. });
  38. function submitHandler() {
  39. if($("#input-img").val()==undefined||$("#input-img").val()==""){
  40. $.modal.msgError("请选择荣誉图片")
  41. }
  42. if ($.validate.form()) {
  43. $.operate.save(prefix + "/edit", $('#form-company_honour-edit').serialize());
  44. }
  45. }
  46. $('#input-fileinput').on('change.bs.fileinput ', function (e) {
  47. if ($("#input-fileinput").val() == '') {
  48. return;
  49. }var data = new FormData();
  50. data.append('file', document.getElementById('input-fileinput').files[0]);
  51. $.ajax({
  52. url:ctx+"common/upload",
  53. type:"post",
  54. data: data,
  55. cache: false,
  56. contentType: false,
  57. processData: false,
  58. dataType: 'json',
  59. success: function(result) {
  60. if (result.code == web_status.SUCCESS) {
  61. $("#input-img").val(result.data.fileName);
  62. $("#img-img").attr('src',result.data.fileName);
  63. } else {
  64. $.modal.alertError(result.msg);
  65. }
  66. },
  67. error:function(result) {
  68. alert("上传失败")
  69. }
  70. });
  71. })
  72. </script>
  73. </body>
  74. </html>