This repository has been archived on 2022-06-28. You can view files and clone it, but cannot push or open issues or pull requests.
magic_box_server/html/admin/system/userlist.html
Yutousama 11d2c15dae 2.4发版前更新
前端分离出来
工具列表新增版本控制
2020-04-01 18:00:18 +08:00

165 lines
4.1 KiB
HTML

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>用户列表</title>
</head>
<link rel="stylesheet" href="/static/layui/css/layui.css">
<script src="/static/layui/layui.all.js"></script>
<script src="/static/layui/layui.js"></script>
<script src="/static/js/jquery-3.2.1.js"></script>
<script src="/static/js/user.js"></script>
<body>
<form class="layui-form" action="#">
<blockquote class="layui-elem-quote">用户列表</blockquote>
<div class="layui-input-inline">
<select id="searchType" lay-verify="" style="width: 20px;">
<option value="uid">UID</option>
<option value="name">账号</option>
<option value="uname">用户名</option>
</select>
</div>
<div class="layui-input-inline">
<input id='searchKey' type="text" class="layui-input" placeholder="请输入关键字" />
</div>
<div class="layui-input-inline">
<input id="searchKeyButton" type="button" data-type="reload" value="搜索" class="layui-btn" onclick="search()" />
</div>
<table id="user" lay-filter="user" >
</table>
</form>
</body>
<script type="text/html" id="bar">
<a class="layui-btn layui-btn-xs" lay-event="repw">重置密码</a>
<a class="layui-btn layui-btn-xs" lay-event="unben">解封</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="ben">封禁</a>
</script>
<script>
var table
var table_;
layui.use('table', function() {
table = layui.table;
table_ = table.render({
elem: '#user',
height: 312,
url: '/admin/user/list.do', //数据接口
height: '500' ,
page: true //开启分页
,
cols: [
[ //表头
{
field: 'uid',
title: 'UID',
width: 80,
sort: true,
fixed: 'left'
}, {
field: 'name',
title: '账号',
width: 120,
sort: true
}, {
field: 'uname',
title: '用户名',
width: 120,
}, {
field: 'benTime',
title: '封禁时间',
width: 160,
}, {
field: 'unBenTime',
title: '解封时间',
width: 160,
},
{
field: 'benIndex',
title: '封禁次数',
width: 120,
},
{
fixed: 'right',
width: 200,
align: 'center',
toolbar: '#bar'
}
]
]
});
table.on('tool(user)', function(obj) {
var data = obj.data;
if (obj.event === 'repw') {
layer.open({
title: "提示",
content: "将为该账号发送重置密码邮件",
yes: function(index, layero) {
layer.close(index);
$.post("/user/repassword.do?uid=" + data.uid, function(data) {
var json = JSON.parse(data);
layer.alert(json.msg);
})
}
})
} else if (obj.event === 'ben') {
layer.open({
title: "设置禁言时间",
content: '<input type="button" class="layui-input" id="bendata" value="设置封禁时间">',
success:function(layero,index){
var laydate = layui.laydate;
//执行一个laydate实例
laydate.render({
elem: '#bendata' ,//指定元素
type:'datetime',
value: new Date() ,
});
},
yes:function(index,obj){
layer.close(index);
$.post("/admin/user/ben.do?uid="+data.uid+"&time="+$('#bendata').val(),function(data){
var json=JSON.parse(data);
layer.msg(json.msg);
active['reload'](this)
})
}
})
} else if (obj.event === 'unben') {
$.post("/admin/user/unben.do?uid="+data.uid,function(data){
var json=JSON.parse(data);
layer.msg(json.msg);
active['reload'](this)
})
}
});
})
var $ = layui.$,
active = {
reload: function() {
//执行重载
table.reload('user', {
page: {
curr: 1 //重新从第 1 页开始
},
where: {
type: $('#searchType').val(),
key: $('#searchKey').val()
}
});
}
};
function search() {
active['reload'](this)
}
function getData(obj) {
var laydate = layui.laydate;
}
layui.use('laydate', function() {
});
</script>
</html>