| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- <!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-add">
- <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" 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" width="30%" height="30%">
- <input type="file" class="form-control" name="designerAvatarUrl" id="designerAvatarUrl" accept="image/*"/>
- <input type="hidden" lass="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"></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 = 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/designerAvatar",
- 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-add").validate({
- focusCleanup: true
- });
- function submitHandler() {
- if ($.validate.form()) {
- $.operate.save(prefix + "/add", $('#form-designer-add').serialize());
- }
- }
- </script>
- </body>
- </html>
|