TSQ 4 years ago
commit e7230f2541

@ -0,0 +1,30 @@
package cn.stylefeng.guns.modular.user;
import cn.stylefeng.roses.kernel.resource.api.annotation.ApiResource;
import cn.stylefeng.roses.kernel.resource.api.annotation.GetResource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
/**
* 线
*
* @author fengshuonan
* @date 2021/1/11 22:02
*/
@Controller
@Slf4j
@ApiResource(name = "在线用户查看界面")
public class OnlineUserViewController {
/**
* 线
*
* @author fengshuonan
* @date 2021/1/11 22:03
*/
@GetResource(name = "在线用户查看界面", path = "/view/onlineUser")
public String onlineUser() {
return "/modular/system/onlineUser/online_user.html";
}
}

@ -0,0 +1,83 @@
layui.use(['table', 'HttpRequest'], function () {
var $ = layui.$;
var table = layui.table;
var HttpRequest = layui.HttpRequest;
/**
* 参数配置管理
*/
var OnlineUser = {
tableId: "onlineUserTable"
};
/**
* 初始化表格的列
*/
OnlineUser.initColumn = function () {
return [[
{type: 'checkbox'},
{field: 'userId', hide: true, title: '主键'},
{field: 'token', hide: true, title: '用户token'},
{field: 'account', sort: true, align: "center", title: '账号'},
{field: 'nickName', sort: true, align: "center", title: '昵称'},
{field: 'realName', sort: true, align: "center", title: '姓名'},
{field: 'sex', sort: true, align: "center", title: '性别'},
{field: 'roleName', sort: true, align: "center", title: '角色名称'},
{field: 'loginTime', sort: true, align: "center", title: '登录时间'},
{align: 'center', toolbar: '#tableBar', title: '操作'}
]];
};
/**
* 点击查询按钮
*/
OnlineUser.search = function () {
var queryData = {};
queryData['account'] = $("#account").val();
table.reload(OnlineUser.tableId, {
where: queryData, page: {curr: 1}
});
};
/**
* 踢下线某个人
*
* @param data 点击按钮时候的行数据
*/
OnlineUser.removeSession = function (data) {
var httpRequest = new HttpRequest(Feng.ctxPath + '/sysUser/removeSession', 'post', function (data) {
Feng.success("踢下线成功!");
table.reload(OnlineUser.tableId);
}, function (data) {
Feng.error(data.message + "!");
});
console.log(data)
httpRequest.set('token', data.token);
httpRequest.start(true);
};
// 渲染表格
var tableResult = table.render({
elem: '#' + OnlineUser.tableId,
url: Feng.ctxPath + '/sysUser/onlineUserList',
page: false,
height: "full-158",
cellMinWidth: 100,
cols: OnlineUser.initColumn()
});
// 搜索按钮点击事件
$('#btnSearch').click(function () {
OnlineUser.search();
});
// 工具条点击事件
table.on('tool(' + OnlineUser.tableId + ')', function (obj) {
var data = obj.data;
var layEvent = obj.event;
if (layEvent === 'offline') {
OnlineUser.removeSession(data);
}
});
});

@ -0,0 +1,32 @@
@layout("/layout/_container.html",{js:["/assets/modular/system/onlineUser/online_user.js"]}){
<div class="layui-body-header">
<span class="layui-body-header-title">在线用户查看</span>
</div>
<div class="layui-fluid">
<div class="layui-row layui-col-space15">
<div class="layui-col-sm12 layui-col-md12 layui-col-lg12">
<div class="layui-card">
<div class="layui-card-body">
<div class="layui-form toolbar">
<div class="layui-form-item">
<div class="layui-inline">
<input id="account" class="layui-input" type="text" placeholder="账号"/>
</div>
<div class="layui-inline">
<button id="btnSearch" class="layui-btn icon-btn"><i class="layui-icon">&#xe615;</i>搜索</button>
</div>
</div>
</div>
<table class="layui-table" id="onlineUserTable" lay-filter="onlineUserTable"></table>
</div>
</div>
</div>
</div>
</div>
<script type="text/html" id="tableBar">
<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="offline">强制下线</a>
</script>
@}
Loading…
Cancel
Save