mine.html
7.5 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
<!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>我的</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/style.css" />
</head>
<body class="mine-view">
<div class="aui-content aui-margin-b-15">
<header id="header" class="title-bg-progress-blue">
<h3 class="app-title">罗电物联网用电安全</h3>
<div class="equipment-switch">
<p class="aui-pull-left" id="currentDevice">暂无设备</p>
<p class="aui-pull-right" onclick="choseDevice();"><img style="height:16px;" src="../image/qiehuan-s.png" /><span>切换设备</span></p>
<div class="aui-clearfix" style="padding-bottom:90px;"></div>
</div>
</header>
<div class="mine-view-other">
<div class="mine-view-user">
<img src="../image/touxiang.png" />
<p style="bottom: 25px;"><span id="userName">未登录</span></p>
<p><abbr id="userPhone"></abbr></p>
<i></i>
</div>
<div class="aui-padded-10">
<ul>
<li tapmode onclick="openRepair( this );">
<img src="../image/guzhang.png" /><label>故障报修</label><span class="aui-pull-right"></span>
</li>
<li tapmode onclick="openRepairList( this );">
<img src="../image/liebiao.png" /><label>报障列表</label><span class="aui-pull-right"></span>
</li>
<li tapmode onclick="openEquipment( this );">
<img src="../image/guanli.png" /><label>管理设备</label><span class="aui-pull-right"></span>
</li>
<li tapmode onclick="openForgetPassword( this );">
<img src="../image/chongzhimima.png" style="width:13px;margin:0.8rem 0.575rem;" /><label>重设密码</label><span class="aui-pull-right"></span>
</li>
<li tapmode onclick="openSafeUser( this );">
<img src="../image/dianhua.png" /><label>安全联系人及电话</label><span class="aui-pull-right"></span>
</li>
<li tapmode onclick="openVersion( this );">
<img src="../image/dianliu-s.png" /><label>关于罗电</label><span class="aui-pull-right"></span>
</li>
</ul>
<div class="aui-padded-10"><a href="javascript:;" onclick="clearLogin();" class="win-submit-btn">退出登录</a></div>
</div>
</div>
</div>
<div class="bar-shadow"></div>
</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 header = $api.byId('header');
var imei = '';
fixStatusBar_API(header);
apiready = function() {
api.parseTapmode();
api.addEventListener({
name: 'login_user'
}, function(ret, err){
//重新加载用户数据
var token = $api.getStorage('userToken');
if(token && token != ''){
api.showProgress({
style: 'default',
animationType: 'fade',
title: '加载用户信息...',
text: '',
modal: true
});
$.ajax({
url: HOST + '/iot_api/v1/app/user',
type: 'GET',
dataType: 'json',
headers: {
'Content-Type': 'application/json;charset=utf-8',
'token': token
},
complete:function(){
api.hideProgress();
},
success: function(ret) {
if (ret) {
if (ret.code == 0 && ret.data.user) {
var user = ret.data.user;
$api.setStorage('userName', user.name);
$api.setStorage('userPhone', user.user);
$api.setStorage('userID', user.id);
$api.html($api.byId("userName"), user.name);
$api.html($api.byId("userPhone"), user.user);
}
}
},
error: function() {
}
});
}
});
//注册事件
api.addEventListener({
name: 'change_device'
}, function(ret, err){
if( ret && ret.value.imei ){
imei = ret.value.imei;
$api.html($api.byId("currentDevice"), "设备编号:"+imei);
}
});
var userName = $api.getStorage('userName');
var userPhone = $api.getStorage('userPhone');
imei = $api.getStorage('defaultDevice');
if(imei){
$api.html($api.byId("currentDevice"), "设备编号:"+imei);
}
if(userName && userPhone){
$api.html($api.byId("userName"), userName);
$api.html($api.byId("userPhone"), userPhone);
}else{
api.sendEvent({
name: 'login_user'
});
}
}
function openRepair() {
api.openWin({ slidBackEnabled:false,
name: 'repair',
url: 'repair.html',
pageParam: {}
});
}
function clearLogin(){
api.confirm({
title: '退出确认',
msg: '确认退出?',
buttons: ['确定', '取消']
}, function(ret, err){
if( ret && ret.buttonIndex==1){
var ajpush = api.require("ajpush");
api.showProgress({
style: 'default',
animationType: 'fade',
title: '正在退出...',
text: '',
modal: true
});
clearPush(ajpush, function(){
$api.clearStorage();
//补充基础的缓存数据
initHeaderH();
check();
api.hideProgress();
})
}
});
}
function openRepairList() {
api.openWin({ slidBackEnabled:false,
name: 'repairList',
url: 'repairList.html',
pageParam: {}
});
}
function openForgetPassword() {
api.openWin({ slidBackEnabled:false,
name: 'changePassword',
url: 'changePassword.html',
pageParam: {}
});
}
function openEquipment() {
api.openWin({ slidBackEnabled:false,
name: 'equipment',
url: 'equipment.html',
pageParam: {}
});
}
function openSafeUser() {
api.openWin({ slidBackEnabled:false,
name: 'safeUser',
url: 'safeUser.html',
pageParam: {}
});
}
function openVersion() {
api.openWin({ slidBackEnabled:false,
name: 'version',
url: 'version.html',
pageParam: {}
});
}
</script>