活动招募页面调整

This commit is contained in:
xuhubin 2020-11-03 16:02:13 +08:00
parent 376789f8ac
commit 668d5db6a9
4 changed files with 106 additions and 17 deletions

View File

@ -27,15 +27,15 @@
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="front:carousel:add"> <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="front:carousel:add">
<i class="fa fa-plus"></i> 添加 <i class="fa fa-plus"></i> 添加
</a> </a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="front:carousel:edit"> <!--<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="front:carousel:edit">
<i class="fa fa-edit"></i> 修改 <i class="fa fa-edit"></i> 修改
</a> </a>-->
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="front:carousel:remove"> <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="front:carousel:remove">
<i class="fa fa-remove"></i> 删除 <i class="fa fa-remove"></i> 删除
</a> </a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="front:carousel:export"> <!--<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="front:carousel:export">
<i class="fa fa-download"></i> 导出 <i class="fa fa-download"></i> 导出
</a> </a>-->
</div> </div>
<div class="col-sm-12 select-table table-striped"> <div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table> <table id="bootstrap-table"></table>

View File

@ -2,6 +2,7 @@
<html lang="zh" xmlns:th="http://www.thymeleaf.org" > <html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head> <head>
<th:block th:include="include :: header('新增活动招募')" /> <th:block th:include="include :: header('新增活动招募')" />
<th:block th:include="include :: summernote-css" />
</head> </head>
<body class="white-bg"> <body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> <div class="wrapper wrapper-content animated fadeInRight ibox-content">
@ -37,20 +38,22 @@
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label is-required">图片地址</label> <label class="col-sm-3 control-label is-required">图片:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="pictureUrl" class="form-control" type="text" required> <input id="filePath" name="filePath" class="form-control" type="file">
<input id="pictureUrl" name="pictureUrl" type="text" hidden>
</div> </div>
</div> </div>
<div class="form-group"> <!--<div class="form-group">
<label class="col-sm-3 control-label">删除标志:</label> <label class="col-sm-3 control-label">删除标志:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="delFlag" class="form-control" type="text"> <input name="delFlag" class="form-control" type="text">
</div> </div>
</div> </div>-->
</form> </form>
</div> </div>
<th:block th:include="include :: footer" /> <th:block th:include="include :: footer" />
<th:block th:include="include :: summernote-js" />
<script th:inline="javascript"> <script th:inline="javascript">
var prefix = ctx + "front/recruitment" var prefix = ctx + "front/recruitment"
$("#form-recruitment-add").validate({ $("#form-recruitment-add").validate({
@ -59,9 +62,44 @@
function submitHandler() { function submitHandler() {
if ($.validate.form()) { if ($.validate.form()) {
uploadFile(false, "pictureUrl");
$.operate.save(prefix + "/add", $('#form-recruitment-add').serialize()); $.operate.save(prefix + "/add", $('#form-recruitment-add').serialize());
} }
} }
$(function() {
$('.summernote').summernote({
lang: 'zh-CN',
callbacks: {
onChange: function(contents, $edittable) {
$("input[name='" + this.id + "']").val(contents);
},
onImageUpload: function(files) {
var obj = this;
var data = new FormData();
data.append("file", files[0]);
$.ajax({
type: "post",
url: ctx + "common/upload",
data: data,
cache: false,
contentType: false,
processData: false,
dataType: 'json',
success: function(result) {
if (result.code == web_status.SUCCESS) {
$('#' + obj.id).summernote('insertImage', result.url);
} else {
$.modal.alertError(result.msg);
}
},
error: function(error) {
$.modal.alertWarning("图片上传失败。");
}
});
}
}
});
});
</script> </script>
</body> </body>
</html> </html>

View File

@ -2,6 +2,7 @@
<html lang="zh" xmlns:th="http://www.thymeleaf.org" > <html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head> <head>
<th:block th:include="include :: header('修改活动招募')" /> <th:block th:include="include :: header('修改活动招募')" />
<th:block th:include="include :: summernote-css" />
</head> </head>
<body class="white-bg"> <body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> <div class="wrapper wrapper-content animated fadeInRight ibox-content">
@ -37,15 +38,23 @@
<input name="organizer" th:field="*{organizer}" class="form-control" type="text" required> <input name="organizer" th:field="*{organizer}" class="form-control" type="text" required>
</div> </div>
</div> </div>
<div class="form-group"> <!--<div class="form-group">
<label class="col-sm-3 control-label is-required">图片地址:</label> <label class="col-sm-3 control-label is-required">图片地址:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="pictureUrl" th:field="*{pictureUrl}" class="form-control" type="text" required> <input name="pictureUrl" th:field="*{pictureUrl}" class="form-control" type="text" required>
</div> </div>
</div>-->
<div class="form-group">
<label class="col-sm-3 control-label is-required">图片:</label>
<div class="col-sm-8">
<input id="filePath" name="filePath" class="form-control" type="file">
<input id="pictureUrl" name="pictureUrl" th:field="*{pictureUrl}" type="text" hidden>
</div>
</div> </div>
</form> </form>
</div> </div>
<th:block th:include="include :: footer" /> <th:block th:include="include :: footer" />
<th:block th:include="include :: summernote-js" />
<script th:inline="javascript"> <script th:inline="javascript">
var prefix = ctx + "front/recruitment"; var prefix = ctx + "front/recruitment";
$("#form-recruitment-edit").validate({ $("#form-recruitment-edit").validate({
@ -54,9 +63,48 @@
function submitHandler() { function submitHandler() {
if ($.validate.form()) { if ($.validate.form()) {
uploadFile(false, "pictureUrl");
$.operate.save(prefix + "/edit", $('#form-recruitment-edit').serialize()); $.operate.save(prefix + "/edit", $('#form-recruitment-edit').serialize());
} }
} }
$(function() {
$('.summernote').each(function(i) {
$('#' + this.id).summernote({
lang: 'zh-CN',
callbacks: {
onChange: function(contents, $edittable) {
$("input[name='" + this.id + "']").val(contents);
},
onImageUpload: function(files) {
var obj = this;
var data = new FormData();
data.append("file", files[0]);
$.ajax({
type: "post",
url: ctx + "common/upload",
data: data,
cache: false,
contentType: false,
processData: false,
dataType: 'json',
success: function(result) {
if (result.code == web_status.SUCCESS) {
$('#' + obj.id).summernote('insertImage', result.url);
} else {
$.modal.alertError(result.msg);
}
},
error: function(error) {
$.modal.alertWarning("图片上传失败。");
}
});
}
}
});
var content = $("input[name='" + this.id + "']").val();
$('#' + this.id).summernote('code', content);
})
});
</script> </script>
</body> </body>
</html> </html>

View File

@ -30,10 +30,10 @@
<label>主办单位:</label> <label>主办单位:</label>
<input type="text" name="organizer"/> <input type="text" name="organizer"/>
</li> </li>
<li> <!--<li>
<label>图片地址:</label> <label>图片地址:</label>
<input type="text" name="pictureUrl"/> <input type="text" name="pictureUrl"/>
</li> </li>-->
<li> <li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a> <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a> <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
@ -47,15 +47,15 @@
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="front:recruitment:add"> <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="front:recruitment:add">
<i class="fa fa-plus"></i> 添加 <i class="fa fa-plus"></i> 添加
</a> </a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="front:recruitment:edit"> <!--<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="front:recruitment:edit">
<i class="fa fa-edit"></i> 修改 <i class="fa fa-edit"></i> 修改
</a> </a>-->
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="front:recruitment:remove"> <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="front:recruitment:remove">
<i class="fa fa-remove"></i> 删除 <i class="fa fa-remove"></i> 删除
</a> </a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="front:recruitment:export"> <!--<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="front:recruitment:export">
<i class="fa fa-download"></i> 导出 <i class="fa fa-download"></i> 导出
</a> </a>-->
</div> </div>
<div class="col-sm-12 select-table table-striped"> <div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table> <table id="bootstrap-table"></table>
@ -106,7 +106,10 @@
}, },
{ {
field: 'pictureUrl', field: 'pictureUrl',
title: '图片地址' title: '图片地址',
formatter: function(value, row, index) {
return $.table.imageView(value);
}
}, },
{ {
title: '操作', title: '操作',