my_sugar.html
9.1 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
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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
<!doctype html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<!--<link rel="stylesheet" href="../../assets/css/jeDate-test.css">-->
<!--<link rel="stylesheet" href="../../assets/css/jedate.css">-->
<link rel="stylesheet" href="../../assets/css/weui.min.css">
<link rel="stylesheet" href="../../assets/css/base.css">
<link rel="stylesheet" href="../../assets/css/style1.css">
<link rel="stylesheet" href="../../assets/css/common1.css">
<link rel="stylesheet" href="../../assets/icon/iconfont.css">
<title></title>
<style type="text/css">
body {
background-color: #f5f5f5;
margin: 0;
}
.sugar_type {
display: flex;
align-items: center;
flex-wrap: wrap;
font-size: 16px;
padding: 25px 0 20px 15px;
background-color: #fff;
}
#background {
box-sizing: border-box;
background-color: #d8b25f;
color: #FFF;
border-radius: 50%;
display: inline-block;
padding: 10px 10px 6px 10px;
}
.sugar_type span {
width: 30%;
background-color: #e9e9e9;
color: #424242;
padding: 5px 0;
text-align: center;
border-radius: 5px;
margin: 0 10px 10px 0;
}
.sugar_type .spanactive {
color: #fff;
background-color: #dbb25f;
}
.date_box {
position:relative;
display: flex;
align-items: center;
justify-content: space-between;
padding: 10px 13px;
margin: 20px 0 0 0;
background-color: #fff;
/*overflow: hidden;*/
}
.date_item {
font-size: 14px;
color: #999;
}
.date_box .iconfont {
color: #c0c0c0;
position:absolute;
right:0.9rem;
top:0.4rem;
}
.save_btn {
text-align: center;
font-size: 18px;
color: #fff;
padding: 0.15rem 0;
width: 100%;
position: fixed;
bottom: 0;
left: 0;
z-index: 100;
background-color: #dbb25f;
}
#loadStart {
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
/*background: #bbb;*/
z-index: 100000;
transition: 1s;
background: #fff url("../../assets/image/loading.gif") center center no-repeat;
background-size: 12%;
}
#chosetime{
outline:none;
height:0.68rem;
border:none;
}
.jebody{
width: 100%;
overflow: hidden;
}
body .weui-toast{
min-height: 40px;
line-height: 40px;
top: 50%;
}
</style>
</head>
<body class="jebody">
<div id="loadStart"></div>
<div class="perpart1 center">
<div style="position: relative;color: #fff;top: 2.5rem;">mmol/L</div>
<div id="background">
<input type="number" step="0.1" name="test" class="knob" data-width="140" data-height='140' data-fgColor="#fff"
data-skin="tron"
data-thickness=".1" value="0.0" placeholder="" id="circle_value">
</div>
</div>
<div class="sugar_type" data-type="">
<span data-id="1">空腹</span>
<span data-id="2">早餐后</span>
<span data-id="3">午餐前</span>
<span data-id="4">午餐后</span>
<span data-id="5">晚餐前</span>
<span data-id="6">晚餐后</span>
<span data-id="7">睡前</span>
<span data-id="8">凌晨</span>
</div>
<!--<div class="date_box">-->
<!--<div class="date_item">请选择测量时间</div>-->
<!--<div class="iconfont icon-xiangyou"></div>-->
<!--</div>-->
<div class="jeitem">
<div class="date_box" id="choose_times">
<input type="text" readonly id="chosetime" placeholder="请选择测量时间">
</div>
</div>
<div class="save_btn">保存</div>
</body>
</html>
<script type="text/javascript" src="../../assets/js/api.js"></script>
<script type="text/javascript" src="../../assets/js/weui.min.js"></script>
<script type="text/javascript" src="../../assets/js/public.js"></script>
<script type="text/javascript" src="../../assets/js/fastclick.js"></script>
<script>
new FastClick(document.body);
</script>
<script src="../../assets/js/jquery.js" type="text/javascript"></script>
<script src="../../assets/js/jquery.knob.js" type="text/javascript"></script>
<script type="text/javascript" src="../../assets/js/axios.min.js"></script>
<script type="text/javascript" src="../../assets/icon/iconfont.js"></script>
<script type="text/javascript" src="../../assets/js/datePicker.js"></script>
<script type="text/javascript" src="../../assets/js/jedate.js"></script>
<script type="text/javascript">
$(document).ready(function () {
var type=1;
$(".knob").knob();
loadEnd();
var rid=localStorage.getItem("rid");
function getSugar() {
var header = {
"XX-Device-Type": getDevice(),
'XX-Token': getToken()
};
var post = {
rid: rid,
type: 1
};
getRequest('post', 'user/index/getLastBoolData', post, header).then(function (res) {
if (res.data.code == 1) {
$('.knob').val(res.data.data.data);
$('#chosetime').val(res.data.data.time);
$('.date_item').text(res.data.data.time);
$('.sugar_type span').removeClass('spanactive').eq(res.data.data.time_type-1).addClass('spanactive');
} else {
toastMsg(res.data.msg)
}
})
}
getSugar();
$('.sugar_type span').click(function () {
$(this).addClass('spanactive').siblings().removeClass('spanactive');
if ($(this).hasClass('spanactive')) {
$('.sugar_type').attr('data-type', $(this).attr('data-id'))
} else {
$('.sugar_type').removeAttribute('data-type')
}
});
$('.date_box').click(function () {
});
//时间选择
$('#choose_times').click(function(){
var calendar = new datePicker();
calendar.init({
'trigger': '#choose_times', /*按钮选择器,用于触发弹出插件*/
'type': 'datetime', /*模式:date日期;datetime日期时间;time时间;ym年月;*/
// 'minDate':getTimeDetil(3), /*最小日期*/
'minDate': '', /*最小日期*/
'maxDate': '', /*最大日期*/
'onSubmit': function () {/*确认时触发事件*/
if (calendar.value) {
$('#chosetime').val(calendar.value);
calendar.onClose()
}
},
'onClose': function () {/*取消时触发事件*/
// api.closeWin();
}
});
})
$('.save_btn').click(function () {
var rid=localStorage.getItem("rid");
var value = $('.knob').val();
var date = $('#chosetime').val();
type = $('.spanactive').attr('data-id')
// console.log(type)
var post = {
rid: rid,
time_type: type,
time: date,
data: value,
type:1
};
var header = {
"XX-Device-Type": getDevice(),
'XX-Token': getToken()
};
if (value == '') {
toastMsg('请记录血糖值');
return false
} else if (type == '') {
toastMsg('请选择选择测量节点');
return false
}
else if (date == '') {
toastMsg('请选择测量时间');
return false
} else {
getRequest('post', 'user/index/setBoolData', post, header).then(function (res) {
// alert(JSON.stringify(res))
if (res.data.code == 1) {
toastMsg('记录成功');
} else {
toastMsg(res.data.msg)
}
console.log($('.weui-toast').html())
})
}
});
})
</script>