代码拉取完成,页面将自动刷新
同步操作将从 无敌波/ok-admin 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
<!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/okadmin.css">
<link rel="stylesheet" href="font/iconfont.css">
<link rel="stylesheet" href="lib/nprogress/nprogress.css">
</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-sm" 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">
<input class="layui-input" placeholder="请输入用户名" autocomplete="off">
<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">
<i class="iconfont icon-shangsheng"></i>批量启用
</button>
<button class="layui-btn layui-btn-warm" id="batchDisabled">
<i class="iconfont icon-web-icon-"></i>批量停用
</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">
<i class="layui-icon"></i>添加用户
</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>
<script src="lib/nprogress/nprogress.js"></script>
<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;
laydate.render({
elem: '#startTime',
type: "datetime"
});
laydate.render({
elem: '#endTime',
type: "datetime"
});
table.render({
elem: '#tableId',
url: 'data/user.json',
limit: 10,
page: true,
cols: [[
{type: 'checkbox'},
{field: 'id', title: 'ID', width: 80, sort: true},
{field: 'username', title: '用户名', width: 100},
{field: 'name', title: '姓名', width: 100},
{field: 'password', title: '密码', width: 100},
{field: 'status', title: '状态', width: 85, templet: '#statusTpl'},
{field: 'role', title: '角色', width: 100, templet: '#roleTpl'},
{field: 'email', title: '邮箱', width: 200},
{field: 'createTime', title: '创建时间', width: 200},
{field: 'logins', title: '登陆次数', width: 100},
{title: '操作', width: 200, templet: '#operationTpl', align: 'center'}
]],
done: function (res, curr, count) {
$("#countNum").text(count);
}
});
form.on('submit(search)', function () {
layer.msg('正在查询,请稍后...');
return false;
});
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%'],
content: 'user-edit.html',
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});
});
}
});
$("#batchEnabled").click(function () {
layer.confirm("确定要批量启用吗?", {skin: 'layui-layer-lan', icon: 3, title: '提示', anim: 1}, function () {
var checkStatus = table.checkStatus('tableId');
var rows = checkStatus.data.length;
if (rows > 0) {
var idsStr = "";
for (var i = 0; i < checkStatus.data.length; i++) {
idsStr += checkStatus.data[i].id + ',';
}
console.log("选择的id-->" + idsStr);
layer.msg("操作成功!", {icon: 1, time: 1000}, function () {
$(".layui-laypage-btn")[0].click();
});
} else {
layer.msg('未选择有效数据', {
offset: 't',
anim: 6
});
}
});
})
$("#batchDisabled").click(function () {
layer.confirm("确定要批量停用吗?", {skin: 'layui-layer-lan', icon: 3, title: '提示', anim: 2}, function () {
var checkStatus = table.checkStatus('tableId');
var rows = checkStatus.data.length;
if (rows > 0) {
var idsStr = "";
for (var i = 0; i < checkStatus.data.length; i++) {
idsStr += checkStatus.data[i].id + ',';
}
console.log("选择的id-->" + idsStr);
layer.msg("操作成功!", {icon: 1, time: 1000}, function () {
$(".layui-laypage-btn")[0].click();
});
} else {
layer.msg('未选择有效数据', {
offset: 't',
anim: 6
});
}
});
})
$("#batchDel").click(function () {
layer.confirm("确定要批量删除吗?", {skin: 'layui-layer-lan', icon: 2, title: '提示', anim: 6}, function () {
var checkStatus = table.checkStatus('tableId');
var rows = checkStatus.data.length;
if (rows > 0) {
var idsStr = "";
for (var i = 0; i < checkStatus.data.length; i++) {
idsStr += checkStatus.data[i].id + ',';
}
console.log("选择的id-->" + idsStr);
layer.msg("操作成功!", {icon: 1, time: 1000}, function () {
$(".layui-laypage-btn")[0].click();
});
} else {
layer.msg('未选择有效数据', {
offset: 't',
anim: 6
});
}
});
})
$("#addUser").click(function () {
layer.open({
title: '添加用户',
type: 2,
shade: false,
maxmin: true,
shade: 0.5,
anim: 4,
area: ['90%', '90%'],
content: 'user-add.html',
zIndex: layer.zIndex,
// skin: 'layui-layer-molv',
end: function () {
$(".layui-laypage-btn")[0].click();
}
});
})
})
</script>
<!--模板-->
<script type="text/html" id="statusTpl">
<input type="checkbox" name="status" value="{{d.id}}" lay-skin="switch" lay-text="启用|停用" {{ d.status== 0 ? 'checked' : ''}}>
</script>
<script type="text/html" id="roleTpl">
{{ d.role == 0 ? '管理员' : '普通用户 '}}
</script>
<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>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。