<!DOCTYPE html>
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
|
<head>
|
<th:block th:include="include :: header('配置广告素材')" />
|
</head>
|
<body class="gray-bg">
|
<div class="container-div">
|
<div class="row">
|
<div class="col-sm-12 search-collapse">
|
<form id="role-form">
|
<input type="hidden" id="adId" name="adId" th:value="${adId}">
|
<div class="select-list">
|
<ul>
|
<li>
|
素材名称:<input type="text" name="materialName"/>
|
</li>
|
<li>
|
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i> 搜索</a>
|
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i> 重置</a>
|
</li>
|
</ul>
|
</div>
|
</form>
|
</div>
|
|
<div class="btn-group-sm" id="toolbar" role="group">
|
<a class="btn btn-success" onclick="addAdMaterial()">
|
<i class="fa fa-plus"></i> 添加广告素材
|
</a>
|
<a class="btn btn-danger multiple disabled" onclick="deleteMaterialBatch()">
|
<i class="fa fa-remove"></i> 删除广告素材
|
</a>
|
<a class="btn btn-warning" onclick="closeItem()">
|
<i class="fa fa-reply-all"></i> 关闭
|
</a>
|
</div>
|
|
<div class="col-sm-12 select-table table-striped">
|
<table id="bootstrap-table"></table>
|
</div>
|
</div>
|
</div>
|
<th:block th:include="include :: footer" />
|
<script th:inline="javascript">
|
var imageReg = /.+\.(gif|jpg|jpeg|png|webp|bmp)/i;
|
|
var statusDatas = [[${@dict.getType('sys_normal_disable')}]];
|
var materialTypeDatas = [[${@dict.getType('material_type')}]];
|
|
var prefix = ctx + "cms/ad/";
|
|
$(function() {
|
var options = {
|
url: prefix + "/adMaterialList",
|
createUrl: prefix + "/addAdMaterial/{id}",
|
updateUrl: prefix + "/editAdMaterial/{id}",
|
pagination: false,
|
queryParams: queryParams,
|
modalName: "广告素材",
|
columns: [{
|
checkbox: true
|
},
|
{field : 'id',title : 'ID',visible: false},
|
{field : 'materialId',title : 'ID',visible: false},
|
|
{field : 'materialName',title : '素材名称'},
|
{field : '图片',title : '图片',formatter: function(value, row, index) {
|
if(imageReg.test(row.materialName)){
|
var url="";
|
if(ctx=='/'){
|
url=row.savePath;
|
}else{
|
url=ctx+row.savePath;
|
}
|
return $.table.imageView(url);
|
}else{
|
return "-";
|
}
|
}
|
},
|
{field : 'materialType',title : '素材类型',visible: false,formatter: function(value, row, index) {
|
return $.table.selectDictLabel(materialTypeDatas, value);
|
}
|
},
|
{field : 'link',title : '链接'},
|
{field : 'sort',title : '排序'},
|
{field : 'hit',title : '点击数'},
|
{field : 'startTime',title : '开始时间'},
|
{field : 'endTime',title : '结束时间'},
|
{field : 'width',title : '宽',visible: false},
|
{field : 'height',title : '高',visible: false},
|
{field : 'status',title : '状态',formatter: function(value, row, index) {
|
return $.table.selectDictLabel(statusDatas, value);
|
}
|
},
|
{title: '操作', align: 'center', formatter: function(value, row, index) {
|
var actions = [];
|
actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="$.operate.editFull(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
|
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="deleteMaterial(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
|
return actions.join('');
|
}
|
}
|
]
|
};
|
$.table.init(options);
|
});
|
|
function queryParams(params) {
|
var search = $.table.queryParams(params);
|
search.adId = $("#adId").val();
|
return search;
|
}
|
|
/* 新增广告素材 */
|
function addAdMaterial() {
|
var id= $("#adId").val();
|
$.operate.addFull(id);
|
}
|
|
/* 分配用户-批量取消 */
|
function deleteMaterialBatch() {
|
var rows = $.table.selectFirstColumns();
|
if (rows.length == 0) {
|
$.modal.alertWarning("请至少选择一条记录");
|
return;
|
}
|
$.modal.confirm("确认要删除选中的" + rows.length + "条数据吗?", function() {
|
var data = { "ids": rows.join() };
|
$.operate.submit(prefix + "/removeAdMaterial", "post", "json", data);
|
});
|
}
|
|
/* 分配用户-取消授权 */
|
function deleteMaterial(id) {
|
$.modal.confirm("确认要取消关联该素材吗?", function() {
|
$.operate.post(prefix + "/removeAdMaterial", { "ids": id });
|
})
|
}
|
</script>
|
</body>
|
</html>
|