main.vm
4.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta charset="utf-8"/>
<title>一年四季后台管理系统</title>
<meta name="description" content="overview & stats"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"/>
<script type="text/javascript">
var manageDomain = "$!{webUtils.getLocalPath("")}";
</script>
#parse("layout/css.vm")
<script src="$!{webUtils.getAssetsPath("/js/jquery.js")}"></script>
<script src="$!{webUtils.getAssetsPath("/js/popup.js")}"></script>
<script src="$!{webUtils.getAssetsPath("/js/md5.js")}"></script>
<style type="text/css">
body {
overflow-y: hidden;
overflow-x: hidden;
}
</style>
<script src="/static/js/tips.js"></script>
<link href="/static/css/waitItems.css" rel="stylesheet">
</head>
<body class="no-skin">
#parse("layout/header.vm")
<div class="main-container" id="main-container">
#parse("layout/main_nav.vm")
<div class="main-content" id="main-content">
## #set($iframePath = "welcome.do")
#set($iframePath = $!{webUtils.indexPath})
#if(${returnUrl} !="null")
#set($iframePath = ${returnUrl})
#end
<iframe id="frame3d" name="frame3d" frameborder="0" width="100%" scrolling="auto"
style=""
height="100%" src="${iframePath}">
</iframe>
</div>
</div>
<!-- /.main-container -->
#parse("layout/js.vm")
<script type="text/javascript">
// window.onbeforeunload = function(){
// $.get("http://manage.nong12.com/loginControl/logout.do",
// function(data,status){ });
// return "manage后台已退出登录!!";
// }
$(function () {
$(document).keydown(function (e) {
if (e.keyCode == 116) {
//验证是否支持postMessage
if (typeof window.postMessage === "undefined") {
return true;
}
document.getElementById("frame3d").contentWindow.postMessage("refresh", "*");
return false;
}
});
//屏幕变化
$(window).resize(function (e) {
resize();
});
resize();
function resize() {
var menu = $("#menu-toggler");
var sid = $("#sidebar");
var head = $("#navbar");
var fram = $("#frame3d");
var side = $("#sidebar");
var self = $(window);
var height, width;
height = self.height() - head.height();
if (menu.css("display") == "none") {
width = self.width() - sid.width();
} else {
width = self.width();
}
fram.height(height);
fram.width(width);
side.height(height);
}
});
/**
* 监听消息
*/
window.addEventListener('message', function (event) {
/**
* 超时提醒
*/
if (event.data == "timeout") {
var html = '<div style="position: absolute;bottom: 0;right: 0;z-index: 100;"><div class="alert alert-danger alert-dismissible" role="alert">' +
'<button type="button" class="close" data-dismiss="alert">' +
' <span aria-hidden="true">×</span><span class="sr-only">Close</span>' +
'</button>' +
'<strong>警告!</strong> 两分钟内不进行操作将会跳转到登录页面.</div></div>';
$("body").append(html);
}
// if(event.data == "refresh"){
// location.reload();
// }
// // 通过origin属性判断消息来源地址
// if (event.origin == 'http://a.com') {
// alert(event.data); // 弹出"I was there!"
// alert(event.source); // 对a.com、index.html中window对象的引用
// // 但由于同源策略,这里event.source不可以访问window对象
// }
}, false);
/**
* 修正URL
*/
fixUrl();
function fixUrl() {
var url = window.location.href;
if (url.indexOf("returnUrl") > 0) {
var obj = {};
var title = "地利后台管理系统";
var newUrl = "/main.do"
history.pushState(obj, title, newUrl);
}
}
</script>
</body>
</html>