NGToolsCSharp/NGTools/obj/Release/Package/PackageTmp/Pages/frmMain.aspx

200 lines
7.4 KiB
Plaintext
Raw Permalink Normal View History

2024-09-13 08:44:13 +00:00
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="frmMain.aspx.cs" Inherits="NGTools.frmMain" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="renderer" content="webkit" />
<meta http-equiv="Content-type" content="text/html;charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="renderer" content="webkit" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="keywords" content="easyui,springmvc,jquery,hibernate4" />
<meta http-equiv="description" content="springmvc hibernate4 easyui" />
<title>天然气工业计算工具集</title>
<!--2个样式表文件-->
<link rel="stylesheet" type="text/css" href="../Scripts/EASYUI/themes/default/easyui.css" />
<link href="../Scripts/EASYUI/themes/icon.css" rel="stylesheet" />
<!--2个js文件 ,要先引入jquery,然后再引入easyui-->
<script src="../Scripts/EASYUI/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../Scripts/EASYUI/jquery.easyui.min.js"></script>
<script src="../Scripts/EASYUI/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>
<script src="../MYJS/MyTools.js"></script>
</head>
<body class="easyui-layout" onbeforeunload="checkLogin('0')" onload="checkLogin('1')">
<!-- 顶部放那个主页信息什么的 -->
<div data-options="region:'north', split:true" style="height: 80px; background-image: url('../image/header_bg.png');">
<div class="easyui-panel">
<p style="position: absolute; right: 18px; top: 0px; color: #FFFFFF;">
<a id="user" style="color: red; font-size: large"></a>&nbsp&nbsp欢迎您访登录
<a id="loginout" href="javascript:void(0)" onclick="loginout()" style="color: red">退出</a>
</p>
<p id="show" style="position: absolute; right: 18px; top: 35px; color: #FFFFFF;">
<a id="strdatetime"></a> <%--服务器时间:<span></span>年<span></span>月<span></span>日<span></span>时<span></span>分<span></span>秒<span></span>--%>
</p>
</div>
</div>
<div id="westMenu" data-options="region:'west', split:true" title="导航菜单" style="width: 187px;">
<div id="layout_west_accordion" class="easyui-accordion" style="width: 180px;"></div>
</div>
<div data-options="region:'center'" style="background: #eee; overflow: hidden; height: 100%; border-width: 0px">
<div id="tts" class="easyui-tabs" style="width: 100%; height: 100%;">
</div>
</div>
<div data-options="region:'south', split:true" style="height: 30px;">
<div class="foot" style="vertical-align: middle">
Copyright © 2019 All Rights Reserved 妍杰丽云 豫ICP备 19037764 号
<label id="message" style="color: red"></label>
</div>
</div>
</body>
<script type="text/javascript">
$(document).ready(function () { //动态加载二级菜单
var url = 'frmMain.aspx?action=getSystemTree' + "&t=" + Date.parse(new Date());
getLeftTree($('#layout_west_accordion'), $('#tts'), url);
try {
var userInfo =JSON.parse( sessionStorage.getItem("userinfo"));
var regDate = userInfo.regDate;
var nowDate = new Date().toLocaleString();
var intDateDiff = GetDateDiff(nowDate, regDate, "day");
//alert(intDateDiff);
if (parseInt(intDateDiff) >= 0) {
document.getElementById("message").innerHTML = "新注册用户还有" + intDateDiff + "天到期,如有需要,请点系统设置->开通功能";
}
else {
//document.getElementById("message").innerHTML = "新注册用户试用期已过,如有需要请点系统设置->开通功能";
}
} catch (e) {
}
});
function loginout() {
$.messager.confirm('系统提示', '您确定要退出本次登录吗?', function (r) {
if (r) {
checkLogin("0");
location.href = '../default.aspx';
}
});
}
var lastTime = new Date().getTime();
var currentTime = new Date().getTime();
var timeOut = 5 * 60 * 1000; //设置超时时间: 5分
/* 鼠标移动事件 */
$(document).mouseover(function () {
//alert(11);
lastTime = new Date().getTime(); //更新操作时间
});
//判断用户多久没有进行鼠标操作,超过5分钟自动退出登录
var intNum = 0;
function testTime() {
currentTime = new Date().getTime(); //更新当前时间
intNum += 1;
if (intNum == 10) {
checkLogin("1");
intNum = 0;
}
document.getElementById("strdatetime").innerHTML = getTime();
if ('<%=Session["userName"] %>' == "") {
checkLogin("0");
top.location.href = "../default.aspx";
}
if (currentTime - lastTime > timeOut) { //判断是否超时
window.clearTimeout(inter);
checkLogin("0");
//$.messager.alert("提示","您长时间未操作,请重新登录!");
//注销当前session ....
top.location.href = "../default.aspx";
} else {
inter = setTimeout(testTime, 1000);
}
}
testTime();
var user = document.getElementById("user")
if ('<%=Session["userName"] %>' == "") {
user.innerHTML = '<%=Session["userAccount"] %>';
}
else {
user.innerHTML = '<%=Session["userName"] %>';
}
function checkLogin(loginflag) {
if ('<%=Session["userName"] %>' == "") {
top.location.href = "../default.aspx";
}
var myDate = new Date();
var strDatetime = ""; //获取日期与时间
strDatetime += myDate.getFullYear() + "_"; //获取完整的年份(4位,1970-????)
strDatetime += (myDate.getMonth() + 1) + "_"; //获取当前月份(0-11,0代表1月) // 所以获取当前月份是myDate.getMonth()+1;
strDatetime += myDate.getDate() + " "; //获取当前日(1-31)
strDatetime += myDate.getHours() + ":"; //获取当前小时数(0-23)
strDatetime += myDate.getMinutes() + ":"; //获取当前分钟数(0-59)
strDatetime += myDate.getSeconds(); //获取当前秒数(0-59)
$.ajax({
type: "post",
url: 'frmMain.aspx?action=updateLogin&' + "t=" + Date.parse(new Date()),
dataType: "json",
data: { username: '<%=Session["userName"] %>', loginflag: loginflag, datetime: strDatetime },
traditional: true,
success: function (data) {
//alert(JSON.stringify(data));
//$('#formPar').form('load', data);
$.messager.alert("提示", data);
}
})
}
//官方demo
function addTab(title, url, blClose) {
if ($('#tts').tabs('exists', title)) {
$('#tts').tabs('select', title);
} else {
var content = '<iframe scrolling="auto" frameborder="0" src="' + url + '" style="width:100%;height:100%;"></iframe>';
$('#tts').tabs('add', {
title: title,
content: content,
closable: blClose
});
}
}
</script>
</html>