-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsleep_begin.html
232 lines (211 loc) · 6.48 KB
/
sleep_begin.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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<link href="css/mui.css" rel="stylesheet" />
<link rel="stylesheet" type="text/css" href="css/mui.min.css"/>
<link rel="stylesheet" type="text/css" href="css/sleep/beginsleep.css"/>
<link rel="stylesheet" type="text/css" href="css/sleep/stylebegin.css">
<link rel="stylesheet" type="text/css" href="css/sleep/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/sleep/default.css">
<link rel="stylesheet" type="text/css" href="css/common.css"/>
<link href="https://fonts.googleapis.com/css?family=Nixie+One" rel="stylesheet" type="text/css">
<style type="text/css">
body{background: #F0F0F0;}
</style>
<script type="text/javascript">
if(window.localStorage){
var un = localStorage.getItem("username");
var pas = localStorage.getItem("password");
//alert(un+pas);
}else{alert("浏览不支持localStorage")}
</script>
<script type="text/javascript">
if(window.localStorage){
var un = localStorage.getItem("username");
var pas = localStorage.getItem("password");
//alert(un+pas);
var defaT = localStorage.getItem("defatime");
var naoxing = localStorage.getItem("nx");
var naozhong = localStorage.getItem("nz");
}else{alert("浏览不支持localStorage")};
</script>
<script src="svg/iconfont.js" type="text/javascript" charset="utf-8"></script>
<style>
.icon {
width: 35px;
height: 35px;
vertical-align: -0.15em;
fill: currentColor;
overflow: hidden;
}
</style>
</head>
<body>
<script src="js/mui.js"></script>
<script type="text/javascript">
mui.init()
</script>
<!-- <button type="button" class="noiseBtn" onclick="openNoise()"><h3>白噪音</h3></button> -->
<div class="noiseBtn" onclick="openNoise()">
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-bzy"></use>
</svg>
<h3 class="word1" style="line-height: 0px;">白噪音</h3>
</div>
<header class="mui-bar mui-bar-nav">
<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left" href="index.html" onclick="openSleep()"></a>
<h1 class="mui-title">开始睡眠</h1>
<audio src='http://hao.haolingsheng.com/ring/000/995/3e3966097062ba7638a0aba60d898b48.mp3' preload='auto' id='music1'>
</audio>
<audio src='http://hao.haolingsheng.com/ring/000/995/f1b408f77bc8d27a6f5665c1be02df5d.mp3' preload='auto' id='music2'>
</audio>
<audio src='http://hao.haolingsheng.com/ring/000/995/899004608491de178a7234ab5538feb9.mp3' preload='auto' id='music3'>
</audio>
<audio src='http://hao.haolingsheng.com/ring/000/995/3428620bff41797ca0fde66a1a47b0fc.mp3' preload='auto' id='music4'>
</audio>
<audio src='http://hao.haolingsheng.com/ring/000/995/bde5a74a2520d82b8ed6d51c227f383c.mp3' preload='auto' id='music5'>
</audio>
</header>
<article class="htmleaf-container">
<div class="container-fluid">
<div class="col-xs-12 fill">
<span id="runner"></span><br><br>
<div class="col-sm-10 col-sm-offset-2">
<div class="col-xs-4 col-sm-3 centered"><button id="stopBtn" onclick="recordtime2()"></button></div>
<div class="col-xs-4 col-sm-3 centered"><button id="startBtn" onclick="recordtime1();start_score()"></button></div>
<div class="col-xs-4 col-sm-3 centered"><button id="resetBtn"></button></div>
</div>
</div>
</div>
</article>
<script src="js/jquery-2.1.1.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/jquery.runner-min.js"></script>
<script src="js/app.js"></script>
<button type="button" class="returnreport" onclick="openReport()">返回报告</button>
<script>
var arr = defaT.split(":");
var sethour = arr[0];
var setmin = arr[1];
if(setmin<naoxing*5){
sethour = sethour-1;
setmin = 60 - (5*naoxing - setmin);
}
else{
setmin = setmin-5*naoxing;
}
var stop = document.getElementById("stopBtn");
window.onload=function(){
function showTime(){
var time=new Date();
var minute=time.getMinutes();
var hou=time.getHours();
var d1=hou>=sethour&&minute>=setmin;
var d2=hou>=sethour;
var dt = 1;
//此处设定dt=1为浅睡
if((d1||d2)&dt==1){
if(naozhong==1){
if(!music1.play()){music1.play();}//响铃
// alert("成功1");
//改变字体颜色为红色
}
if(naozhong==2){
if(!music2.play()){music2.play();}//响铃
// alert("成功2");
// //改变字体颜色为红色
}
if(naozhong==3){
if(!music3.play()){music3.play();}//响铃
// alert("成功3");
// //改变字体颜色为红色
}
if(naozhong==4){
if(!music4.play()){music4.play();}//响铃
// alert("成功4");
// //改变字体颜色为红色
}
if(naozhong==5){
if(!music5.play()){music5.play();}//响铃
//改变字体颜色为红色
// alert("成功5");
//
}
}
else{music1.pause();
music2.pause();
music3.pause();
music4.pause();
music5.pause();}//同理
}
showTime();
var timer=setInterval(showTime,1000);
stop.onclick=function(){
sethour=24;
}}
</script>
</body>
<script>
var dt1=1;
var dt2=2;
var dt3=1;
var dt4=1;
var dt5=1;
var dt6=1;
</script>
<script type="text/javascript">
function openReport(){
mui.openWindow({
url : 'sleep_report.html',
extras :
{}
});
}
function openNoise(){
mui.openWindow({
url : 'sleep_noise.html',
extras :
{}
});
}
function openSleep(){
mui.openWindow({
url : 'index.html',
extras :
{}
});
}
function recordtime1(){
var time = new Date();
var checktime = 5;
$.ajax({
url:"http://203.195.148.111:8080/index/index/begin",
withCredentials:true,
data: {username:un },
});
}
function recordtime2(){
var time = new Date();
var checktime = 5;
$.ajax({
url:"http://203.195.148.111:8080/index/index/end",
withCredentials:true,
data: {username:un },
});
}
function sleepstate(){
$.ajax({url:"http://203.195.148.111:8080/index/index/aiclock",
data: {dt1:dt1,dt2:dt2,dt3:dt3,dt4:dt4,dt5:dt5,dt6:dt6},
success:function(data) {
// alert(data);
}
})
}
function start_score(){
dt=setInterval(sleepstate,2000);
}
</script>
</html>