| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222 |
- <!DOCTYPE html>
- <html lang="zh" xmlns:th="http://www.thymeleaf.org" >
- <head>
- <th:block th:include="include :: header('修改设计师')" />
- <th:block th:include="include :: cropper-css" />
- <style type='text/css'>
- /* avator css start */
- .container {
- margin: 10px 5px 5px 5px;
- }
- .action {
- padding: 5px 0px;
- }
- .cropped {
- width: 200px;
- border: 1px #ddd solid;
- box-shadow: 0px 0px 12px #ddd;
- }
- .img-preview {
- border-radius: 50%;
- box-shadow: 0px 0px 12px #7e7e7e;
- display: inline-block;
- }
- .preview-box {
- text-align: center;
- margin: 0px auto;
- margin-top: 10px;
- color: #bbb;
- }
- .preview-md {
- width: 128px;
- height: 128px;
- }
- .preview-sm {
- width: 96px;
- height: 96px;
- }
- .preview-xs {
- width: 64px;
- height: 64px;
- }
- .imageBox {
- border: 1px solid #aaa;
- overflow: hidden;
- cursor: move;
- box-shadow: 4px 4px 12px #B0B0B0;
- margin: 0px auto;
- }
- .btn-custom {
- float: right;
- width: 46px;
- display: inline-block;
- margin-bottom: 10px;
- height: 37px;
- line-height: 37px;
- font-size: 14px;
- color: #FFFFFF;
- margin: 0px 2px;
- background-color: #f38e81;
- border-radius: 3px;
- text-decoration: none;
- cursor: pointer;
- box-shadow: 0px 0px 5px #B0B0B0;
- border: 0px #fff solid;
- }
- /*选择文件上传*/
- .new-contentarea {
- width: 165px;
- overflow: hidden;
- margin: 0 auto;
- position: relative;
- float: left;
- }
- .new-contentarea label {
- width: 100%;
- height: 100%;
- display: block;
- }
- .new-contentarea input[type=file] {
- width: 188px;
- height: 60px;
- background: #333;
- margin: 0 auto;
- position: absolute;
- right: 50%;
- margin-right: -94px;
- top: 0;
- right/*\**/: 0px\9;
- margin-right/*\**/: 0px\9;
- width/*\**/: 10px\9;
- opacity: 0;
- filter: alpha(opacity=0);
- z-index: 2;
- }
- a.upload-img {
- width: 165px;
- display: inline-block;
- margin-bottom: 10px;
- height: 37px;
- line-height: 37px;
- font-size: 14px;
- color: #FFFFFF;
- background-color: #f38e81;
- border-radius: 3px;
- text-decoration: none;
- cursor: pointer;
- border: 0px #fff solid;
- box-shadow: 0px 0px 5px #B0B0B0;
- }
- a.upload-img:hover {
- background-color: #ec7e70;
- }
- .tc {
- text-align: center;
- }
- /* avator css end */
- </style>
- </head>
- <body class="white-bg">
- <div class="wrapper wrapper-content animated fadeInRight ibox-content">
- <form class="form-horizontal m" id="form-designer-edit" th:object="${designer}">
- <input name="id" th:field="*{id}" type="hidden">
- <div class="col-xs-12">
- <div class="form-group">
- <label class="col-sm-3 control-label">昵称:</label>
- <div class="col-sm-8">
- <input name="designerName" th:field="*{designerName}" class="form-control" type="text">
- </div>
- </div>
- </div>
- <div class="col-xs-12">
- <div class="form-group">
- <label class="col-sm-3 control-label">设计师头像:</label>
- <input type="file" class="form-control" name="imgFile" id="bannerImg" accept="image/*"/>
- <input type="hidden" th:field="*{designerAvatar}" class="form-control" name="imgUrl" id="designerAvatar" />
- </div>
- </div>
- <div class="col-xs-12">
- <div class="form-group">
- <label class="col-sm-3 control-label">设计师描述:</label>
- <div class="col-sm-8">
- <textarea name="description" class="form-control">[[*{description}]]</textarea>
- </div>
- </div>
- </div>
- </form>
- </div>
- <th:block th:include="include :: footer" />
- <th:block th:include="include :: cropper-js" />
- <script th:inline="javascript">
- var prefix = ctx + "master/designer";
- $('#designerAvatar').change(function () {
- var fileSize = 0;
- fileSize = this. files[0].size;
- fileSize=Math. round( fileSize/1024*100)/100;
- if(fileSize>2048){
- layer.msg('上传文件不得大于2M,请重新上传。', {time: 3000, icon:6});
- return false;
- }
- if (!/image\/\w+/.test(this.files[0].type)) {
- layer.msg('上传的不是图片文件,请重新上传。', {time: 3000, icon:6});
- return false;
- }
- if ($(this).val()) {
- var formdata = new FormData();
- formdata.append("imageFile", this.files[0]);
- $.ajax({
- url: ctx + "common/upload/file/image",
- data: formdata,
- type: "post",
- processData: false,
- contentType: false,
- beforeSend: function () {
- $.modal.loading("正在处理中,请稍后...");
- $.modal.disable();
- },
- success: function (result) {
- if (result.code == web_status.SUCCESS) {
- $('#viewImage').attr('src', result.imageUrl);
- $('#bannerImgUrl').val(result.imageUrl);
- $.modal.alertSuccess(result.msg)
- } else if (result.code == web_status.WARNING) {
- $.modal.alertWarning(result.msg)
- } else {
- $.modal.alertError(result.msg);
- }
- $.modal.closeLoading();
- $.modal.enable();
- }
- })
- }
- });
- $("#form-designer-edit").validate({
- focusCleanup: true
- });
- function submitHandler() {
- if ($.validate.form()) {
- $.operate.save(prefix + "/edit", $('#form-designer-edit').serialize());
- }
- }
- </script>
- </body>
- </html>
|