-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
158 lines (134 loc) · 4.81 KB
/
index.html
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<html>
<head>
<title>coolpeng</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
#root {
opacity: 0;
margin: 0 auto;
}
#root.rootShow{
display: block;
opacity: 1;
transition: opacity 1s linear;
}
#rootLoading {
position: absolute;
top: 35%;
left: 45%;
font-size: 13px;
line-height: 30px;
color: #666;
margin-left: -120px;
width: 300px;
font-family: SimSun,Microsoft YaHei, Arial, sans-serif;
}
#rootLoadingText{
font-size: 12px;
text-align: center;
width: 300px;
display: block;
}
#rootLoadingWrapper{
position: relative;
width: 300px;
height: 10px;
display: block;
border: 1px solid #ffbdd2;
}
#rootLoadingPercent{
background-color: #ff7844;
width: 0%;
height: 10px;
display: block;
transition: width 0.1s;
}
</style>
</head>
<body>
<div id="root"></div>
<div id="rootLoading">
<span id="rootLoadingText">加载中... <span id="rootLoadingTextNum">0 %</span> </span>
<span id="rootLoadingWrapper">
<span id="rootLoadingPercent"></span>
</span>
</div>
<script>
window.COOPENG_REQUEST_PREFIX = "http://www.coolpeng.cn";
window.COOPENG_REQUEST_PREFIX = 'http://127.0.0.1:10086';
// window.COOPENG_USE_HASH_HISTORY = true;
(function (exports) {
var console = window.console || {log:function(){}};
var isErrored = false;
function onLoadingStateChange(num, start) {
document.getElementById("rootLoadingTextNum").innerHTML = (num + "%");
document.getElementById('rootLoadingPercent').style.width = (num + "%");
}
function onLoadingCompleted() {
document.getElementById("rootLoading").style.display = 'none';
document.getElementById("root").className = 'rootShow';
}
function onLoadingTimeout(){
isErrored = true;
document.getElementById("rootLoadingText").innerHTML = '系统加载失败,请刷新浏览器重试';
}
var timeoutLimit = 1000*60*1; //1分钟
var currentDateTime = new Date().getTime();
var beginDateTime = currentDateTime;
var loadingTimeInterval = null;
function setLoadingPercent(startNum, num2,checkObjectName) {
if (isErrored){
return;
}
if(checkObjectName && !window[checkObjectName]){
onLoadingTimeout();
return;
}
var displayNum = startNum;
var d2 = new Date().getTime();
console.log(displayNum + "%", d2 - currentDateTime, d2 - beginDateTime, d2);
currentDateTime = d2;
onLoadingStateChange(displayNum, startNum);
if (loadingTimeInterval) {
window.clearInterval(loadingTimeInterval);
}
loadingTimeInterval = window.setInterval(function () {
var d3 = new Date().getTime();
if (displayNum < num2) {
console.log(displayNum + "%", d3 - currentDateTime, d3 - beginDateTime, d3);
onLoadingStateChange(displayNum, startNum);
displayNum++;
}
if(d3-beginDateTime > timeoutLimit){
//等待时间超时
onLoadingTimeout();
}
}, 100);
if (displayNum === 100) {
window.clearInterval(loadingTimeInterval);
setTimeout(function () {
onLoadingCompleted();
}, 10);
}
}
exports.setLoadingPercent = setLoadingPercent;
})(window);
</script>
<script>setLoadingPercent(10, 20); </script>
<script src="/static/lib/jquery.min.js"></script>
<script>setLoadingPercent(20, 30,'jQuery'); </script>
<script src="/static/lib/react.min.js"></script>
<script>setLoadingPercent(30, 40,'React'); </script>
<script src="/static/lib/combo/router-redux-history.min.js"></script>
<script>setLoadingPercent(40, 50,'History');</script>
<script src="/static/lib/immutable.min.js"></script>
<script>setLoadingPercent(50, 60,'Immutable');</script>
<link type="text/css" rel="stylesheet" href="/static/lib/antd/antd-cp.css"/>
<script>setLoadingPercent(60, 80);</script>
<script src="/static/lib/antd/antd.min.js"></script>
<script>setLoadingPercent(80, 100,'antd');</script>
</body>
</html>
<script>setLoadingPercent(100, 100);</script>