index.html
5.09 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
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
<title>罗电物联网APP</title>
<link rel="stylesheet" type="text/css" href="../css/api.css" />
</head>
<body>
<footer>
</footer>
</body>
</html>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/common.js"></script>
<script type="text/javascript" src="../script/jquery-3.3.1.min.js"></script>
<script type="text/javascript">
var NVTabBar;
apiready = function() {
initHeaderH();
var footer = $api.dom('footer'); // 获取 footer 标签元素
var footerH = $api.fixTabBar(footer);
// $api.clearStorage();
if (!check()) {
return false;
}
api.addEventListener({
name:'keyback'
},function(ret,err){
api.confirm({
title:'提示',
msg:'是否退出罗电?',
buttons:['确定','取消']
},function(ret,err){
if(ret.buttonIndex==1){
api.closeWidget({
silent: true
});
}
});
});
initPush();//推送相关
NVTabBar = api.require('NVTabBar');
initTabBar(footerH); //底部导航
$api.setStorage('curIndex', 0); //默认显示首页
}
function initTabBar(footerH) {
NVTabBar.open({
styles: {
bg: '#FFFFFF',
h: 49,
dividingLine: { //(可选项)JSON对象;模块顶部的分割线配置
width: 0.5, //(可选项)数字类型;分割线粗细;默认:0.5
color: '#000' //(可选项)字符串类型;分割线颜色;默认:#000
},
badge: {
bgColor: '#E55741',
numColor: '#FFFFFF',
size: 6,
}
},
items: [{
w: api.winWidth / 3.0,
bg: {
marginB: 0,
image: '#FFFFFF'
},
iconRect: {
w: 21.5,
h: 21,
},
icon: {
normal: 'widget://image/tabar-home-normal.png',
highlight: 'widget://image/tabar-home-actived.png',
selected: 'widget://image/tabar-home-actived.png'
},
title: {
text: '首页',
size: 11.0,
normal: '#9EA9B6',
selected: '#1D2229',
marginB: 3.0
}
}, {
w: api.winWidth / 3.0,
bg: {
marginB: 0,
image: '#FFFFFF'
},
iconRect: {
w: 21.5,
h: 21,
},
icon: {
normal: 'widget://image/tabar-alarm-normal.png',
highlight: 'widget://image/tabar-alarm-actived.png',
selected: 'widget://image/tabar-alarm-actived.png'
},
title: {
text: '所有报警',
size: 11.0,
normal: '#9EA9B6',
selected: '#1D2229',
marginB: 3.0
}
}, {
w: api.winWidth / 3.0,
bg: {
marginB: 0,
image: '#FFFFFF'
},
iconRect: {
w: 21.5,
h: 21,
},
icon: {
normal: 'widget://image/tabar-mine-normal.png',
highlight: 'widget://image/tabar-mine-actived.png',
selected: 'widget://image/tabar-mine-actived.png'
},
title: {
text: '我的',
size: 11.0,
normal: '#9EA9B6',
selected: '#1D2229',
marginB: 3
}
}],
selectedIndex: 0
}, function(ret, err) {
var goIndex = '';
var currentIndex = $api.getStorage('curIndex');
if (ret.index == currentIndex) {
return;
}
switch (ret.index) {
case 0:
goIndex = 'home';
break;
case 1:
goIndex = 'alarm';
break;
case 2:
goIndex = 'mine';
break;
default:
goIndex = 'home';
}
$api.setStorage('curIndex', ret.index);
api.openFrame({
name: goIndex + 'Index',
url: './' + goIndex + '/' + goIndex + '.html',
reload: true,
rect: {
x: 0,
y: 0,
w: api.winWidth,
h: api.winHeight-49-footerH
},
bgColor: '#f4f6f9',
reload: true
});
});
}
</script>