更新 attendance.html
parent
d7a82f6780
commit
fca154ee23
|
|
@ -67,31 +67,10 @@
|
|||
|
||||
<script src="static/jquery.min.js"></script> <!-- 确保已经引入jQuery -->
|
||||
<script src="static/layui.js"></script>
|
||||
<script src="/static/js/menu.js"></script>
|
||||
<script src="/static/js/logout.js"></script>
|
||||
<script>
|
||||
// 请求后端获取菜单数据
|
||||
$.get('/api/menu', function (menuItems) {
|
||||
var menuList = $('.layui-nav.layui-nav-tree');
|
||||
menuList.empty();
|
||||
|
||||
menuItems.forEach(function (item) {
|
||||
var href = item.path || 'javascript:void(0);'; // 提供一个默认值
|
||||
menuList.append('<li class="layui-nav-item"><a href="' + href + '">' + item.name + '</a></li>');
|
||||
});
|
||||
|
||||
layui.element.render('nav', 'test');
|
||||
});
|
||||
|
||||
layui.use(['jquery'], function () {
|
||||
var $ = layui.jquery; // 获取Layui的jQuery对象
|
||||
|
||||
$('#logoutLink').on('click', function () {
|
||||
// 向后端发送登出请求
|
||||
$.get('/logout', function (data) {
|
||||
// 重定向到登录页面,或根据后端响应做其他处理
|
||||
window.location.href = '/login';
|
||||
});
|
||||
});
|
||||
});
|
||||
// 请求后端获取菜单数
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
Reference in New Issue