2018-07-25 15:06:06 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<html>
|
|
|
|
|
<head>
|
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
|
<title>文章列表</title>
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
|
|
|
|
<link rel="stylesheet" href="lib/layui/css/layui.css">
|
|
|
|
|
<link rel="stylesheet" href="css/scroll-bar.css">
|
|
|
|
|
<link rel="stylesheet" href="css/sub-page.css">
|
|
|
|
|
<link rel="stylesheet" href="//at.alicdn.com/t/font_693759_wytlyqhtdtj1nhfr.css">
|
2018-07-27 14:48:30 +00:00
|
|
|
<link rel="stylesheet" href="lib/nprogress/nprogress.css">
|
2018-07-25 15:06:06 +00:00
|
|
|
</head>
|
|
|
|
|
<body>
|
|
|
|
|
<div class="ok-body">
|
|
|
|
|
<!--面包屑导航区域-->
|
|
|
|
|
<div class="ok-body-breadcrumb">
|
|
|
|
|
<span class="layui-breadcrumb">
|
|
|
|
|
<a><cite>首页</cite></a>
|
|
|
|
|
<a><cite>常用页面</cite></a>
|
|
|
|
|
<a><cite>文章列表</cite></a>
|
|
|
|
|
</span>
|
|
|
|
|
<a class="layui-btn layui-btn-small" href="javascript:location.replace(location.href);" title="刷新">
|
|
|
|
|
<i class="layui-icon layui-icon-refresh"></i>
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
<!--模糊搜索区域-->
|
|
|
|
|
<div class="layui-row">
|
|
|
|
|
<form class="layui-form layui-col-md12 ok-search">
|
|
|
|
|
<input class="layui-input" placeholder="开始日期" autocomplete="off" id="startTime">
|
|
|
|
|
<input class="layui-input" placeholder="截止日期" autocomplete="off" id="endTime">
|
2018-08-03 01:31:41 +00:00
|
|
|
<input class="layui-input" placeholder="请输入标题" autocomplete="off">
|
2018-07-25 15:06:06 +00:00
|
|
|
<button class="layui-btn" lay-submit="" lay-filter="search">
|
|
|
|
|
<i class="layui-icon layui-icon-search"></i>
|
|
|
|
|
</button>
|
|
|
|
|
</form>
|
|
|
|
|
</div>
|
|
|
|
|
<!--工具栏-->
|
|
|
|
|
<okToolbar>
|
|
|
|
|
<button class="layui-btn layui-btn-normal" id="batchEnabled">
|
2018-08-03 01:31:41 +00:00
|
|
|
<i class="iconfont icon-shangsheng"></i>批量上架
|
2018-07-25 15:06:06 +00:00
|
|
|
</button>
|
|
|
|
|
<button class="layui-btn layui-btn-warm" id="batchDisabled">
|
2018-08-03 01:31:41 +00:00
|
|
|
<i class="iconfont icon-web-icon-"></i>批量下架
|
2018-07-25 15:06:06 +00:00
|
|
|
</button>
|
|
|
|
|
<button class="layui-btn layui-btn-danger" id="batchDel">
|
|
|
|
|
<i class="layui-icon layui-icon-delete"></i>批量删除
|
|
|
|
|
</button>
|
|
|
|
|
<button class="layui-btn" id="addUser">
|
2018-08-03 01:31:41 +00:00
|
|
|
<i class="layui-icon"></i>添加文章
|
2018-07-25 15:06:06 +00:00
|
|
|
</button>
|
|
|
|
|
<span>共有数据:<i id="countNum"></i> 条</span>
|
|
|
|
|
</okToolbar>
|
|
|
|
|
<!--数据表格-->
|
|
|
|
|
<table class="layui-hide" id="tableId" lay-filter="tableFilter"></table>
|
|
|
|
|
</div>
|
|
|
|
|
<!--js逻辑-->
|
|
|
|
|
<script src="lib/layui/layui.js"></script>
|
2018-07-27 14:48:30 +00:00
|
|
|
<script src="lib/nprogress/nprogress.js"></script>
|
2018-07-25 15:06:06 +00:00
|
|
|
<script>
|
|
|
|
|
NProgress.start();
|
|
|
|
|
window.onload = function() {
|
|
|
|
|
NProgress.done();
|
|
|
|
|
}
|
|
|
|
|
layui.use(['element', 'table', 'form', 'jquery', 'laydate'], function () {
|
|
|
|
|
var element = layui.element;
|
|
|
|
|
var table = layui.table;
|
|
|
|
|
var form = layui.form;
|
|
|
|
|
var $ = layui.jquery;
|
|
|
|
|
var laydate = layui.laydate;
|
2018-08-03 01:31:41 +00:00
|
|
|
|
2018-07-25 15:06:06 +00:00
|
|
|
laydate.render({
|
|
|
|
|
elem: '#startTime',
|
|
|
|
|
type: "datetime"
|
|
|
|
|
});
|
2018-08-03 01:31:41 +00:00
|
|
|
|
2018-07-25 15:06:06 +00:00
|
|
|
laydate.render({
|
|
|
|
|
elem: '#endTime',
|
|
|
|
|
type: "datetime"
|
|
|
|
|
});
|
2018-08-03 01:31:41 +00:00
|
|
|
|
2018-07-25 15:06:06 +00:00
|
|
|
table.render({
|
|
|
|
|
elem: '#tableId',
|
2018-08-03 01:31:41 +00:00
|
|
|
url:'data/article.json',
|
2018-07-25 15:06:06 +00:00
|
|
|
limit: 10,
|
|
|
|
|
page: true,
|
2018-08-03 01:31:41 +00:00
|
|
|
even: true,
|
2018-07-25 15:06:06 +00:00
|
|
|
cols: [[
|
|
|
|
|
{type: 'checkbox'},
|
|
|
|
|
{field:'id', title:'ID', width:80, sort: true},
|
2018-08-03 01:31:41 +00:00
|
|
|
{field:'title', title:'标题', width:350},
|
|
|
|
|
{field:'url', title:'链接', width:250, templet: '#urlTpl'},
|
|
|
|
|
{field:'readSize', title:'阅读量', width:80},
|
|
|
|
|
{field:'publisher', title:'发布者', width:100},
|
|
|
|
|
{field:'isTop', title:'置顶', width:100, templet: '#topTpl'},
|
|
|
|
|
{field:'status', title:'状态', width:100, templet: '#statusTpl'},
|
2018-07-25 15:06:06 +00:00
|
|
|
{title:'操作', width:200, templet: '#operationTpl', align:'center'}
|
|
|
|
|
]],
|
|
|
|
|
done: function(res, curr, count){
|
|
|
|
|
$("#countNum").text(count);
|
|
|
|
|
}
|
|
|
|
|
});
|
2018-08-03 01:31:41 +00:00
|
|
|
|
2018-07-25 15:06:06 +00:00
|
|
|
form.on('submit(search)', function () {
|
|
|
|
|
layer.msg('正在查询,请稍后...');
|
|
|
|
|
return false;
|
|
|
|
|
});
|
2018-08-03 01:31:41 +00:00
|
|
|
|
2018-07-25 15:06:06 +00:00
|
|
|
table.on('tool(tableFilter)', function(obj){
|
|
|
|
|
var data = obj.data;
|
|
|
|
|
var layEvent = obj.event;
|
|
|
|
|
if(layEvent === 'edit'){
|
|
|
|
|
layer.open({
|
|
|
|
|
title: '编辑用户',
|
|
|
|
|
type: 2,
|
|
|
|
|
shade: false,
|
|
|
|
|
maxmin: true,
|
|
|
|
|
shade: 0.5,
|
|
|
|
|
area: ['90%', '90%'],
|
2018-08-03 01:31:41 +00:00
|
|
|
content: 'article-edit.html',
|
2018-07-25 15:06:06 +00:00
|
|
|
zIndex: layer.zIndex,
|
|
|
|
|
end: function () {
|
|
|
|
|
// $(".layui-laypage-btn")[0].click();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}else if(layEvent === 'del'){
|
|
|
|
|
layer.confirm("确定要删除吗?", {skin: 'layui-layer-lan', icon: 2, title:'提示', anim: 6}, function () {
|
|
|
|
|
layer.msg("操作成功!", {icon: 1, time: 1000});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
2018-08-03 01:31:41 +00:00
|
|
|
|
2018-07-25 15:06:06 +00:00
|
|
|
$("#batchEnabled").click(function(){
|
2018-08-03 01:31:41 +00:00
|
|
|
layer.confirm("确定要批量上架吗?", {skin: 'layui-layer-lan', icon: 3, title:'提示', anim: 1}, function () {
|
2018-07-25 15:06:06 +00:00
|
|
|
layer.msg("操作成功!", {icon: 1, time: 1000});
|
|
|
|
|
});
|
|
|
|
|
})
|
2018-08-03 01:31:41 +00:00
|
|
|
|
2018-07-25 15:06:06 +00:00
|
|
|
$("#batchDisabled").click(function(){
|
2018-08-03 01:31:41 +00:00
|
|
|
layer.confirm("确定要批量下架吗?", {skin: 'layui-layer-lan', icon: 3, title:'提示', anim: 2}, function () {
|
2018-07-25 15:06:06 +00:00
|
|
|
layer.msg("操作成功!", {icon: 1, time: 1000});
|
|
|
|
|
});
|
|
|
|
|
})
|
2018-08-03 01:31:41 +00:00
|
|
|
|
2018-07-25 15:06:06 +00:00
|
|
|
$("#batchDel").click(function(){
|
|
|
|
|
layer.confirm("确定要批量删除吗?", {skin: 'layui-layer-lan', icon: 2, title:'提示', anim: 6}, function () {
|
|
|
|
|
layer.msg("操作成功!", {icon: 1, time: 1000});
|
|
|
|
|
});
|
|
|
|
|
})
|
2018-08-03 01:31:41 +00:00
|
|
|
|
2018-07-25 15:06:06 +00:00
|
|
|
$("#addUser").click(function(){
|
|
|
|
|
layer.open({
|
2018-08-03 01:31:41 +00:00
|
|
|
title: '添加文章',
|
2018-07-25 15:06:06 +00:00
|
|
|
type: 2,
|
|
|
|
|
shade: false,
|
|
|
|
|
maxmin: true,
|
|
|
|
|
shade: 0.5,
|
|
|
|
|
anim: 4,
|
|
|
|
|
area: ['90%', '90%'],
|
2018-08-03 01:31:41 +00:00
|
|
|
content: 'article-add.html',
|
2018-07-25 15:06:06 +00:00
|
|
|
zIndex: layer.zIndex,
|
|
|
|
|
// skin: 'layui-layer-molv', // 皮肤
|
|
|
|
|
end: function () {
|
|
|
|
|
// $(".layui-laypage-btn")[0].click();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
</script>
|
|
|
|
|
<!--模板-->
|
2018-08-03 01:31:41 +00:00
|
|
|
<script type="text/html" id="urlTpl">
|
|
|
|
|
<a href="{{d.url}}" target="_blank">{{d.url}}</a>
|
2018-07-25 15:06:06 +00:00
|
|
|
</script>
|
2018-08-03 01:31:41 +00:00
|
|
|
<script type="text/html" id="topTpl">
|
|
|
|
|
<input type="checkbox" name="isTop" value="{{d.isTop}}" lay-skin="switch" lay-text="是|否" {{ d.isTop == true ? 'checked' : ''}}>
|
|
|
|
|
</script>
|
|
|
|
|
<script type="text/html" id="statusTpl">
|
|
|
|
|
<input type="checkbox" name="top" value="{{d.status}}" lay-skin="switch" lay-text="上架|下架" {{ d.status == true ? 'checked' : ''}}>
|
|
|
|
|
</script>
|
2018-07-25 15:06:06 +00:00
|
|
|
<script type="text/html" id="operationTpl">
|
|
|
|
|
<a href="javascript:;" title="编辑" lay-event="edit"><i class="layui-icon"></i></a>
|
|
|
|
|
<a href="javascript:;" title="删除" lay-event="del"><i class="layui-icon"></i></a>
|
|
|
|
|
</script>
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|