活动招募页面调整

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">
<i class="fa fa-plus"></i> 添加
</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> 修改
</a>
</a>-->
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="front:carousel:remove">
<i class="fa fa-remove"></i> 删除
</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> 导出
</a>
</a>-->
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>

View File

@ -2,6 +2,7 @@
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增活动招募')" />
<th:block th:include="include :: summernote-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
@ -36,21 +37,23 @@
<input name="organizer" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">图片地址</label>
<div class="form-group">
<label class="col-sm-3 control-label is-required">图片:</label>
<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 class="form-group">
<!--<div class="form-group">
<label class="col-sm-3 control-label">删除标志:</label>
<div class="col-sm-8">
<input name="delFlag" class="form-control" type="text">
</div>
</div>
</div>-->
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: summernote-js" />
<script th:inline="javascript">
var prefix = ctx + "front/recruitment"
$("#form-recruitment-add").validate({
@ -59,9 +62,44 @@
function submitHandler() {
if ($.validate.form()) {
uploadFile(false, "pictureUrl");
$.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>
</body>
</html>

View File

@ -2,6 +2,7 @@
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改活动招募')" />
<th:block th:include="include :: summernote-css" />
</head>
<body class="white-bg">
<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>
</div>
</div>
<div class="form-group">
<!--<div class="form-group">
<label class="col-sm-3 control-label is-required">图片地址:</label>
<div class="col-sm-8">
<input name="pictureUrl" th:field="*{pictureUrl}" class="form-control" type="text" required>
</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>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: summernote-js" />
<script th:inline="javascript">
var prefix = ctx + "front/recruitment";
$("#form-recruitment-edit").validate({
@ -54,9 +63,48 @@
function submitHandler() {
if ($.validate.form()) {
uploadFile(false, "pictureUrl");
$.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>
</body>
</html>

View File

@ -30,10 +30,10 @@
<label>主办单位:</label>
<input type="text" name="organizer"/>
</li>
<li>
<!--<li>
<label>图片地址:</label>
<input type="text" name="pictureUrl"/>
</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-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">
<i class="fa fa-plus"></i> 添加
</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> 修改
</a>
</a>-->
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="front:recruitment:remove">
<i class="fa fa-remove"></i> 删除
</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> 导出
</a>
</a>-->
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
@ -106,7 +106,10 @@
},
{
field: 'pictureUrl',
title: '图片地址'
title: '图片地址',
formatter: function(value, row, index) {
return $.table.imageView(value);
}
},
{
title: '操作',