You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
2.8 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<script>
var ctx = '${ pageContext.request.contextPath}';
console.log("ctx:"+ctx)
let userid = '${ sessionScope.user.id}'
if(!userid){
location.href = ctx + '/login.jsp'
}
</script>
<!--头部信息-->
<header class="lyear-layout-header">
<nav class="navbar navbar-default" onLoad="getLangDate()">
<div class="topbar">
<div class="topbar-left">
<div class="lyear-aside-toggler">
<span class="lyear-toggler-bar"></span>
<span class="lyear-toggler-bar"></span>
<span class="lyear-toggler-bar"></span>
</div>
</div>
<ul class="topbar-right">
<li> <a href="${ pageContext.request.contextPath}/logout"><i class="mdi mdi-logout-variant"></i> 退出登录</a> </li>
<li> <a href="${ pageContext.request.contextPath}/${ sessionScope.user.role}/edit?id=${ sessionScope.user.id}"><i class="mdi mdi-account"></i> 个人信息</a> </li>
<li><span id="dateStr"></span></li>
</ul>
</div>
</nav>
</header>
<script type="text/javascript">
/**
*实时显示系统时间
*/
function getLangDate(){
var dateObj = new Date(); //表示当前系统时间的Date对象
var year = dateObj.getFullYear(); //当前系统时间的完整年份值
var month = dateObj.getMonth()+1; //当前系统时间的月份值
var date = dateObj.getDate(); //当前系统时间的月份中的日
var day = dateObj.getDay(); //当前系统时间中的星期值
var weeks = ["周日","周一","周二","周三","周四","周五","周六"];
var week = weeks[day]; //根据星期值,从数组中获取对应的星期字符串
var hour = dateObj.getHours(); //当前系统时间的小时值
var minute = dateObj.getMinutes(); //当前系统时间的分钟值
var second = dateObj.getSeconds(); //当前系统时间的秒钟值
//如果月、日、小时、分、秒的值小于10在前面补0
if(month<10){
month = "0"+month;
}
if(date<10){
date = "0"+date;
}
if(hour<10){
hour = "0"+hour;
}
if(minute<10){
minute = "0"+minute;
}
if(second<10){
second = "0"+second;
}
var newDate = year+"-"+month+"-"+date+" "+hour+":"+minute+":"+second+" "+week;
document.getElementById("dateStr").innerHTML = "[ "+newDate+" ]";
//setTimeout("getLangDate()",1000);//每隔1秒重新调用一次
window.setInterval("getLangDate()", 1000);
}
</script>
<!--End 头部信息-->