| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- <!DOCTYPE html>
- <html lang="zh" xmlns:th="http://www.thymeleaf.org" >
- <head>
- <th:block th:include="include :: header('修改设计师')" />
- </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>
- <div class="col-sm-8">
- <img id="designerAvatarImg" th:src="*{designerAvatar}" width="30%" height="30%">
- <input type="file" class="form-control" name="designerAvatarUrl" id="designerAvatarUrl" accept="image/*"/>
- <input type="hidden" th:field="*{designerAvatar}" class="form-control" name="designerAvatar" id="designerAvatar" />
- </div>
- </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" />
- <script th:inline="javascript">
- var prefix = ctx + "master/designer";
- $('#designerAvatarUrl').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) {
- $('#designerAvatarImg').attr('src', result.imageUrl);
- $('#designerAvatar').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>
|