edit.html 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  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 :: cropper-css" />
  6. <style type='text/css'>
  7. /* avator css start */
  8. .container {
  9. margin: 10px 5px 5px 5px;
  10. }
  11. .action {
  12. padding: 5px 0px;
  13. }
  14. .cropped {
  15. width: 200px;
  16. border: 1px #ddd solid;
  17. box-shadow: 0px 0px 12px #ddd;
  18. }
  19. .img-preview {
  20. border-radius: 50%;
  21. box-shadow: 0px 0px 12px #7e7e7e;
  22. display: inline-block;
  23. }
  24. .preview-box {
  25. text-align: center;
  26. margin: 0px auto;
  27. margin-top: 10px;
  28. color: #bbb;
  29. }
  30. .preview-md {
  31. width: 128px;
  32. height: 128px;
  33. }
  34. .preview-sm {
  35. width: 96px;
  36. height: 96px;
  37. }
  38. .preview-xs {
  39. width: 64px;
  40. height: 64px;
  41. }
  42. .imageBox {
  43. border: 1px solid #aaa;
  44. overflow: hidden;
  45. cursor: move;
  46. box-shadow: 4px 4px 12px #B0B0B0;
  47. margin: 0px auto;
  48. }
  49. .btn-custom {
  50. float: right;
  51. width: 46px;
  52. display: inline-block;
  53. margin-bottom: 10px;
  54. height: 37px;
  55. line-height: 37px;
  56. font-size: 14px;
  57. color: #FFFFFF;
  58. margin: 0px 2px;
  59. background-color: #f38e81;
  60. border-radius: 3px;
  61. text-decoration: none;
  62. cursor: pointer;
  63. box-shadow: 0px 0px 5px #B0B0B0;
  64. border: 0px #fff solid;
  65. }
  66. /*选择文件上传*/
  67. .new-contentarea {
  68. width: 165px;
  69. overflow: hidden;
  70. margin: 0 auto;
  71. position: relative;
  72. float: left;
  73. }
  74. .new-contentarea label {
  75. width: 100%;
  76. height: 100%;
  77. display: block;
  78. }
  79. .new-contentarea input[type=file] {
  80. width: 188px;
  81. height: 60px;
  82. background: #333;
  83. margin: 0 auto;
  84. position: absolute;
  85. right: 50%;
  86. margin-right: -94px;
  87. top: 0;
  88. right/*\**/: 0px\9;
  89. margin-right/*\**/: 0px\9;
  90. width/*\**/: 10px\9;
  91. opacity: 0;
  92. filter: alpha(opacity=0);
  93. z-index: 2;
  94. }
  95. a.upload-img {
  96. width: 165px;
  97. display: inline-block;
  98. margin-bottom: 10px;
  99. height: 37px;
  100. line-height: 37px;
  101. font-size: 14px;
  102. color: #FFFFFF;
  103. background-color: #f38e81;
  104. border-radius: 3px;
  105. text-decoration: none;
  106. cursor: pointer;
  107. border: 0px #fff solid;
  108. box-shadow: 0px 0px 5px #B0B0B0;
  109. }
  110. a.upload-img:hover {
  111. background-color: #ec7e70;
  112. }
  113. .tc {
  114. text-align: center;
  115. }
  116. /* avator css end */
  117. </style>
  118. </head>
  119. <body class="white-bg">
  120. <div class="wrapper wrapper-content animated fadeInRight ibox-content">
  121. <form class="form-horizontal m" id="form-designer-edit" th:object="${designer}">
  122. <input name="id" th:field="*{id}" type="hidden">
  123. <div class="col-xs-12">
  124. <div class="form-group">
  125. <label class="col-sm-3 control-label">昵称:</label>
  126. <div class="col-sm-8">
  127. <input name="designerName" th:field="*{designerName}" class="form-control" type="text">
  128. </div>
  129. </div>
  130. </div>
  131. <div class="col-xs-12">
  132. <div class="form-group">
  133. <label class="col-sm-3 control-label">设计师头像:</label>
  134. <input type="file" class="form-control" name="imgFile" id="bannerImg" accept="image/*"/>
  135. <input type="hidden" th:field="*{designerAvatar}" class="form-control" name="imgUrl" id="designerAvatar" />
  136. </div>
  137. </div>
  138. <div class="col-xs-12">
  139. <div class="form-group">
  140. <label class="col-sm-3 control-label">设计师描述:</label>
  141. <div class="col-sm-8">
  142. <textarea name="description" class="form-control">[[*{description}]]</textarea>
  143. </div>
  144. </div>
  145. </div>
  146. </form>
  147. </div>
  148. <th:block th:include="include :: footer" />
  149. <th:block th:include="include :: cropper-js" />
  150. <script th:inline="javascript">
  151. var prefix = ctx + "master/designer";
  152. $('#designerAvatar').change(function () {
  153. var fileSize = 0;
  154. fileSize = this. files[0].size;
  155. fileSize=Math. round( fileSize/1024*100)/100;
  156. if(fileSize>2048){
  157. layer.msg('上传文件不得大于2M,请重新上传。', {time: 3000, icon:6});
  158. return false;
  159. }
  160. if (!/image\/\w+/.test(this.files[0].type)) {
  161. layer.msg('上传的不是图片文件,请重新上传。', {time: 3000, icon:6});
  162. return false;
  163. }
  164. if ($(this).val()) {
  165. var formdata = new FormData();
  166. formdata.append("imageFile", this.files[0]);
  167. $.ajax({
  168. url: ctx + "common/upload/file/image",
  169. data: formdata,
  170. type: "post",
  171. processData: false,
  172. contentType: false,
  173. beforeSend: function () {
  174. $.modal.loading("正在处理中,请稍后...");
  175. $.modal.disable();
  176. },
  177. success: function (result) {
  178. if (result.code == web_status.SUCCESS) {
  179. $('#viewImage').attr('src', result.imageUrl);
  180. $('#bannerImgUrl').val(result.imageUrl);
  181. $.modal.alertSuccess(result.msg)
  182. } else if (result.code == web_status.WARNING) {
  183. $.modal.alertWarning(result.msg)
  184. } else {
  185. $.modal.alertError(result.msg);
  186. }
  187. $.modal.closeLoading();
  188. $.modal.enable();
  189. }
  190. })
  191. }
  192. });
  193. $("#form-designer-edit").validate({
  194. focusCleanup: true
  195. });
  196. function submitHandler() {
  197. if ($.validate.form()) {
  198. $.operate.save(prefix + "/edit", $('#form-designer-edit').serialize());
  199. }
  200. }
  201. </script>
  202. </body>
  203. </html>