15 changed files with 821 additions and 22 deletions
@ -0,0 +1,199 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" xmlns:th="http://www.thymeleaf.org"> |
|||
<head> |
|||
<meta charset="utf-8"> |
|||
<title>layui</title> |
|||
<meta name="renderer" content="webkit"> |
|||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> |
|||
<link rel="stylesheet" href="/static/lib/layui-v2.6.3/css/layui.css" media="all"> |
|||
<link rel="stylesheet" href="/static/css/public.css" media="all"> |
|||
<link rel="stylesheet" href="/static/lib/font-awesome-4.7.0/css/font-awesome.min.css" media="all"> |
|||
|
|||
</head> |
|||
<body> |
|||
<div class="layuimini-container"> |
|||
<div class="layuimini-main"> |
|||
|
|||
<div class="layui-collapse"> |
|||
<div class="layui-colla-item"> |
|||
<h2 class="layui-colla-title">搜索</h2> |
|||
<div class="layui-colla-content"> |
|||
<div style="margin: 10px 10px 10px 10px"> |
|||
<form class="layui-form layui-form-pane" action=""> |
|||
<div class="layui-form-item"> |
|||
<div class="layui-inline"> |
|||
<label class="layui-form-label">标题</label> |
|||
<div class="layui-input-inline"> |
|||
<input type="text" class="layui-input" id="title" name="title" |
|||
autocomplete="off"/> |
|||
</div> |
|||
</div> |
|||
<div class="layui-inline"> |
|||
<label class="layui-form-label">发布日期</label> |
|||
<div class="layui-input-inline"> |
|||
<input type="text" name="startDate" id="startDate" placeholder="请选择开始日期" |
|||
autocomplete="off" class="layui-input"> |
|||
</div> |
|||
<div class="layui-form-mid">-</div> |
|||
<div class="layui-input-inline"> |
|||
<input type="text" name="endDate" id="endDate" placeholder="请选择开始日期" |
|||
autocomplete="off" |
|||
class="layui-input"> |
|||
</div> |
|||
</div> |
|||
<div class="layui-inline"> |
|||
<label class="layui-form-label">状态</label> |
|||
<div class="layui-input-inline"> |
|||
<select name="state"> |
|||
<option value="">请选择状态</option> |
|||
<option value="1">启用</option> |
|||
<option value="2">禁用</option> |
|||
</select> |
|||
</div> |
|||
</div> |
|||
<div class="layui-inline"> |
|||
<button type="submit" class="layui-btn layui-btn-primary" lay-submit |
|||
lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索 |
|||
</button> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<ul class="flow-default" id="LAY_notice"></ul> |
|||
|
|||
</div> |
|||
</div> |
|||
<script src="/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script> |
|||
<script> |
|||
layui.use(['form', 'flow', 'laydate'], function () { |
|||
var $ = layui.jquery, |
|||
form = layui.form, |
|||
laydate = layui.laydate, |
|||
flow = layui.flow; |
|||
|
|||
let takingPre = 0; |
|||
let size = 8; |
|||
|
|||
laydate.render({ |
|||
elem: '#startDate' |
|||
}); |
|||
|
|||
laydate.render({ |
|||
elem: '#endDate' |
|||
}); |
|||
|
|||
flow.load({ |
|||
elem: '#LAY_notice' //流加载容器 |
|||
, done: function (page, next) { //执行下一页的回调 |
|||
let result; |
|||
let lis = []; |
|||
$.get('/notice/findAllNotices?page=' + page + '&size=' + size, function (res) { |
|||
result = res.data; |
|||
lis.push("<div class='clearfix'>"); |
|||
for (let i = 0; i < result.length; i++) { |
|||
lis.push('<li style="width:100%;margin-top: 10px;float:left;border: 1px solid #9999996e;"><div class="layui-card my-shadow my-card flow1" onclick="showDetail(' |
|||
+ result[i].id + ')"><div class="layui-card-header"><h2>' + "标题:"+result[i].title + '</h2></div>'); |
|||
lis.push('<div class="layui-col-md4 my-info" style="margin-left: 15px; color: #999;font-size: 15px;">' |
|||
+ '<p>' + "内容:"+result[i].content + '</p>' |
|||
+ '<p>' +"发布人:"+ result[i].userName + '</p>' |
|||
+ '</div></div></li>'); |
|||
} |
|||
lis.push('</div>'); |
|||
takingPre += result.length; |
|||
//执行下一页渲染,第二参数为:满足“加载更多”的条件,即后面仍有分页 |
|||
//pages为Ajax返回的总页数,只有当前页小于总页数的情况下,才会继续出现加载更多 |
|||
next(lis.join(''), takingPre < res.count); |
|||
}); |
|||
} |
|||
}); |
|||
|
|||
updateFlow = function (req) { |
|||
$("#LAY_material").empty(); |
|||
takingPre = 0; |
|||
flow.load({ |
|||
elem: '#LAY_material' //流加载容器 |
|||
, done: function (page, next) { //执行下一页的回调 |
|||
let result; |
|||
let lis = []; |
|||
req.page = page; |
|||
req.size = size; |
|||
$.ajax({ |
|||
url: "/material/material", |
|||
type: "get", |
|||
data: req, |
|||
dataType: "json", |
|||
contentType: "application/json;charset=utf-8", |
|||
success: function (res) { |
|||
result = res.data; |
|||
lis.push("<div class='clearfix'>"); |
|||
for (let i = 0; i < result.length; i++) { |
|||
lis.push('<li style="width:100%;margin-top: 10px;float:left;border: 1px solid #9999996e;"><div class="layui-card my-shadow my-card flow1" onclick="showDetail(' |
|||
+ result[i].id + ')"><div class="layui-card-header"><h2>' + "标题:"+result[i].title + '</h2></div>'); |
|||
lis.push('<div class="layui-col-md4 my-info" style="margin-left: 15px; color: #999;font-size: 15px;">' |
|||
+ '<p>' + "内容:"+result[i].content + '</p>' |
|||
+ '<p>' +"发布人:"+ result[i].userName + '</p>' |
|||
+ '</div></div></li>'); |
|||
} |
|||
lis.push('</div>'); |
|||
takingPre += result.length; |
|||
//执行下一页渲染,第二参数为:满足“加载更多”的条件,即后面仍有分页 |
|||
//pages为Ajax返回的总页数,只有当前页小于总页数的情况下,才会继续出现加载更多 |
|||
next(lis.join(''), takingPre < res.count); |
|||
} |
|||
}); |
|||
} |
|||
}); |
|||
}; |
|||
|
|||
|
|||
// 监听搜索操作 |
|||
form.on('submit(data-search-btn)', function (data) { |
|||
var req = {}; |
|||
data = data.field; |
|||
req.type = 1; |
|||
if (data.title !== '') { |
|||
req.title = data.title; |
|||
} |
|||
if (data.state !== '') { |
|||
req.state = data.state; |
|||
} |
|||
if (data.startDate !== '') { |
|||
req.startDate = data.startDate; |
|||
} |
|||
if (data.endDate !== '') { |
|||
req.endDate = data.endDate; |
|||
} |
|||
//执行搜索重载 |
|||
updateFlow(req); |
|||
return false; |
|||
}); |
|||
|
|||
|
|||
showDetail = function(data){ |
|||
let req = {}; |
|||
var index = layer.open({ |
|||
title: '公告详情', |
|||
type: 2, |
|||
shade: 0.2, |
|||
maxmin: true, |
|||
shadeClose: true, |
|||
area: ['100%', '100%'], |
|||
content: '/noticeView?id=' + data, |
|||
}); |
|||
$(window).on("resize", function () { |
|||
layer.full(index); |
|||
}); |
|||
return false; |
|||
} |
|||
|
|||
|
|||
}) |
|||
</script> |
|||
|
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,197 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" xmlns:th="http://www.thymeleaf.org"> |
|||
<head> |
|||
<meta charset="utf-8"> |
|||
<title>layui</title> |
|||
<meta name="renderer" content="webkit"> |
|||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> |
|||
<link rel="stylesheet" href="/static/lib/layui-v2.6.3/css/layui.css" media="all"> |
|||
<link rel="stylesheet" href="/static/css/public.css" media="all"> |
|||
<link rel="stylesheet" href="/static/lib/font-awesome-4.7.0/css/font-awesome.min.css" media="all"> |
|||
|
|||
</head> |
|||
<body> |
|||
<div class="layuimini-container"> |
|||
<div class="layuimini-main"> |
|||
|
|||
|
|||
<div class="layui-collapse"> |
|||
<div class="layui-colla-item"> |
|||
<h2 class="layui-colla-title">搜索</h2> |
|||
<div class="layui-colla-content"> |
|||
<div style="margin: 10px 10px 10px 10px"> |
|||
<form class="layui-form layui-form-pane" action=""> |
|||
<div class="layui-form-item"> |
|||
<div class="layui-inline"> |
|||
<label class="layui-form-label">标题</label> |
|||
<div class="layui-input-inline"> |
|||
<input type="text" class="layui-input" id="title" name="title" |
|||
autocomplete="off"/> |
|||
</div> |
|||
</div> |
|||
<div class="layui-inline"> |
|||
<label class="layui-form-label">发布日期</label> |
|||
<div class="layui-input-inline"> |
|||
<input type="text" name="startDate" id="startDate" placeholder="请选择开始日期" |
|||
autocomplete="off" class="layui-input"> |
|||
</div> |
|||
<div class="layui-form-mid">-</div> |
|||
<div class="layui-input-inline"> |
|||
<input type="text" name="endDate" id="endDate" placeholder="请选择开始日期" |
|||
autocomplete="off" |
|||
class="layui-input"> |
|||
</div> |
|||
</div> |
|||
<div class="layui-inline"> |
|||
<label class="layui-form-label">状态</label> |
|||
<div class="layui-input-inline"> |
|||
<select name="state"> |
|||
<option value="">请选择状态</option> |
|||
<option value="1">启用</option> |
|||
<option value="2">禁用</option> |
|||
</select> |
|||
</div> |
|||
</div> |
|||
<div class="layui-inline"> |
|||
<button type="submit" class="layui-btn layui-btn-primary" lay-submit |
|||
lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索 |
|||
</button> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<ul class="flow-default" id="LAY_notice"></ul> |
|||
|
|||
</div> |
|||
</div> |
|||
<script src="/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script> |
|||
<script> |
|||
layui.use(['form', 'flow', 'laydate'], function () { |
|||
var $ = layui.jquery, |
|||
form = layui.form, |
|||
laydate = layui.laydate, |
|||
flow = layui.flow; |
|||
|
|||
let takingPre = 0; |
|||
let size = 8; |
|||
|
|||
|
|||
laydate.render({ |
|||
elem: '#startDate' |
|||
}); |
|||
|
|||
laydate.render({ |
|||
elem: '#endDate' |
|||
}); |
|||
|
|||
flow.load({ |
|||
elem: '#LAY_notice' //流加载容器 |
|||
, done: function (page, next) { //执行下一页的回调 |
|||
let result; |
|||
let lis = []; |
|||
$.get('/notice/findAllNotices?page=' + page + '&size=' + size, function (res) { |
|||
result = res.data; |
|||
lis.push("<div class='clearfix'>"); |
|||
for (let i = 0; i < result.length; i++) { |
|||
lis.push('<li style="width:100%;margin-top: 10px;float:left;border: 1px solid #9999996e;"><div class="layui-card my-shadow my-card flow1" onclick="showDetail(' |
|||
+ result[i].id + ')"><div class="layui-card-header"><h2>' + "标题:"+result[i].title + '</h2></div>'); |
|||
lis.push('<div class="layui-col-md4 my-info" style="margin-left: 15px; color: #999;font-size: 15px;">' |
|||
+ '<p>' + "内容:"+result[i].content + '</p>' |
|||
+ '<p>' +"发布人:"+ result[i].userName + '</p>' |
|||
+ '</div></div></li>'); |
|||
} |
|||
lis.push('</div>'); |
|||
takingPre += result.length; |
|||
//执行下一页渲染,第二参数为:满足“加载更多”的条件,即后面仍有分页 |
|||
//pages为Ajax返回的总页数,只有当前页小于总页数的情况下,才会继续出现加载更多 |
|||
next(lis.join(''), takingPre < res.count); |
|||
}); |
|||
} |
|||
}); |
|||
|
|||
|
|||
// 监听搜索操作 |
|||
form.on('submit(data-search-btn)', function (data) { |
|||
var req = {}; |
|||
data = data.field; |
|||
req.type = 1; |
|||
if (data.title !== '') { |
|||
req.title = data.title; |
|||
} |
|||
if (data.state !== '') { |
|||
req.state = data.state; |
|||
} |
|||
if (data.startDate !== '') { |
|||
req.startDate = data.startDate; |
|||
} |
|||
if (data.endDate !== '') { |
|||
req.endDate = data.endDate; |
|||
} |
|||
updateFlow(); |
|||
return false; |
|||
}); |
|||
|
|||
updateFlow = function (req) { |
|||
$("#LAY_material").empty(); |
|||
takingPre = 0; |
|||
flow.load({ |
|||
elem: '#LAY_material' //流加载容器 |
|||
, done: function (page, next) { //执行下一页的回调 |
|||
let result; |
|||
let lis = []; |
|||
req.page = page; |
|||
req.size = size; |
|||
$.ajax({ |
|||
url: "/material/material", |
|||
type: "get", |
|||
data: req, |
|||
dataType: "json", |
|||
contentType: "application/json;charset=utf-8", |
|||
success: function (res) { |
|||
result = res.data; |
|||
lis.push("<div class='clearfix'>"); |
|||
for (let i = 0; i < result.length; i++) { |
|||
lis.push('<li style="width:100%;margin-top: 10px;float:left;border: 1px solid #9999996e;"><div class="layui-card my-shadow my-card flow1" onclick="showDetail(' |
|||
+ result[i].id + ')"><div class="layui-card-header"><h2>' + "标题:"+result[i].title + '</h2></div>'); |
|||
lis.push('<div class="layui-col-md4 my-info" style="margin-left: 15px; color: #999;font-size: 15px;">' |
|||
+ '<p>' + "内容:"+result[i].content + '</p>' |
|||
+ '<p>' +"发布人:"+ result[i].userName + '</p>' |
|||
+ '</div></div></li>'); |
|||
} |
|||
lis.push('</div>'); |
|||
takingPre += result.length; |
|||
//执行下一页渲染,第二参数为:满足“加载更多”的条件,即后面仍有分页 |
|||
//pages为Ajax返回的总页数,只有当前页小于总页数的情况下,才会继续出现加载更多 |
|||
next(lis.join(''), takingPre < res.count); |
|||
} |
|||
}); |
|||
} |
|||
}); |
|||
}; |
|||
|
|||
showDetail = function(data){ |
|||
let req = {}; |
|||
var index = layer.open({ |
|||
title: '公告详情', |
|||
type: 2, |
|||
shade: 0.2, |
|||
maxmin: true, |
|||
shadeClose: true, |
|||
area: ['100%', '100%'], |
|||
content: '/noticeView?id=' + data, |
|||
}); |
|||
$(window).on("resize", function () { |
|||
layer.full(index); |
|||
}); |
|||
return false; |
|||
} |
|||
}); |
|||
</script> |
|||
|
|||
</body> |
|||
</html> |
|||
Loading…
Reference in new issue