home.html
4.58 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
<!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>home</title>
<link rel="stylesheet" type="text/css" href="../../css/api.css"/>
<link rel="stylesheet" type="text/css" href="../../css/aui.css"/>
<link rel="stylesheet" type="text/css" href="../../css/home/home.css"/>
<style>
html,
body{
background: #f4f6f9;
height: 100%;
width: 100%;
}
</style>
</head>
<body>
<div id="status"></div>
<header class="aui-header-bar title-home" style="width:'auto';height:44px;">
<div class="aui-header-left">
<span class="header-title" style="margin-left:15px;">智能灭弧器</span>
<div id="header_title_hide1" class="aui-hide" style="width:1px;height:10px;background:rgba(255,255,255,0.5);margin-left:8px;"></div>
<div id="header_title_hide2" class="header-title-more aui-hide" style="margin-left:8.5px;"></div>
</div>
<div class="aui-header-right" tapmode onclick="openDeviceListWin();">
<img src="../../image/change-device.png" style="width:24px;height:24px;margin-top:0rem;"/>
<span class="change-device">切换设备</span>
</div>
</header>
<footer></footer>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/vue.min.js"></script>
<script type="text/javascript">
var vueData = {}
var vm;
apiready = function(){
var footer = $api.dom('footer'); // 获取 footer 标签元素
var footerH = $api.fixTabBar(footer);
api.parseTapmode();
var statusH = $api.getStorage('SAFEAREATOP');
document.body.style.background= '#f4f6f9';
api.addEventListener({
name: 'changeHeader'
}, function(ret, err){
// id="header_title_hide1"
var obj1 = $api.byId("header_title_hide1");
var obj2 = $api.byId("header_title_hide2");
var hasCls1 = $api.hasCls(obj1, 'aui-hide');
var hasCls2 = $api.hasCls(obj2, 'aui-hide');
if( ret.value.hide == false ){
if (hasCls1) {
$api.removeCls(obj1, 'aui-hide');
}
if (hasCls2) {
$api.removeCls(obj2, 'aui-hide');
}
// console.log(ret.value.deviceName);
if (ret.value.deviceName) {
$api.html(obj2, ret.value.deviceName);
}
}else {
if (!hasCls1) {
$api.addCls(obj1, 'aui-hide');
}
if (!hasCls2) {
$api.addCls(obj2, 'aui-hide');
}
}
});
//------设置状态栏
document.getElementById("status").style.cssText = "height:"+ statusH +"px;width:'auto';background:linear-gradient(90deg,rgba(91,127,248,1) 0%,rgba(75,175,239,1) 100%);"
api.setStatusBarStyle({
style: 'light'
});
//------
//---------初始化vue
vm = new Vue({
el: '#app',
data: vueData,
methods: {
// changeText: function(text) {
// }
}
})
//---------
//打开home_frm
api.openFrame({
name: 'homeFrm',
url: './home_frm.html',
rect: {
x: 0,
y: 44+Number(statusH),
w: api.winWidth,
h: api.winHeight-49-footerH-44-statusH
},
pageParam: {
// name: 'test'
},
reload: true,
bounces: true,
// bgColor: ''
});
// api.addEventListener({
// name: 'home_frm_loading_over'
// }, function(ret, err){
// if( ret ){
// document.body.style.background= 'linear-gradient(90deg,rgba(91,127,248,1) 0%,rgba(75,175,239,1) 100%)';
// }
// });
setTimeout("resetBg()",2000);
};
function resetBg() {
document.body.style.background= 'linear-gradient(90deg,rgba(91,127,248,1) 0%,rgba(75,175,239,1) 100%)';
}
function openDeviceListWin() {
api.openWin({
name: 'deviceList_win',
url: '../utils/deviceList_win.html',
slidBackEnabled: false,
// pageParam: {
// name: 'test'
// }
});
}
</script>
</html>