-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuser.html
132 lines (127 loc) · 3.13 KB
/
user.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
<!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.min.css" rel="stylesheet" />
<style>
.hope-bg-container img{
width:100%;
}
.hope-user-avator{
text-align: center;
position: relative;
top: -90px;
}
.hope-user-avator img{
width:150px;
height:150px;
}
.hope-user-avator p.hope-username{
font-size:16px;
color:#007aff;
}
.logout-container{
position:fixed;
bottom:25px;
width:100%;
}
.logout-container button{
width:100%;
}
.copyright{
position:fixed;
width:100%;
bottom:0;
margin:0;
text-align: center;
font-size: 12px;
color:#bdbdc0;
}
.logout-container button{
height:45px;
line-height: 45px;
padding:0px;
border-radius: 8px;
}
</style>
</head>
<body>
<div class="mui-content">
<div class="hope-bg-container">
<img src="img/bg.jpg" alt="" />
</div>
<div class="hope-user-avator">
<img src=""/>
<p class="hope-username"></p>
</div>
<div class="logout-container">
<button type="button" class="mui-btn mui-btn-outlined">退出登录</button>
</div>
<p class="copyright">有问题请联系huruji3@foxmail.com</p>
</div>
<script src="js/mui.min.js"></script>
<script type="text/javascript">
mui.init();
mui.plusReady(function() {
var name = localStorage.getItem('name');
var avatar = localStorage.getItem('avatar');
console.log(name);
console.log(avatar);
var con = document.getElementsByClassName('hope-user-avator')[0];
con.getElementsByTagName('img')[0].src ='';
con.getElementsByClassName('hope-username')[0].innerText = '';
con.getElementsByTagName('img')[0].src=avatar;
con.getElementsByClassName('hope-username')[0].innerText = name;
var logoutBtn = document.getElementsByClassName('logout-container')[0].getElementsByTagName('button')[0];
mui.plusReady(function() {
function showLogin() {
localStorage.clear();
if(plus.webview.getWebviewById('login.html')) {
var login = plus.webview.getWebviewById('login.html');
login.reload();
login.show();
return;
}
var loginPage = mui.preload({
url: 'login.html',
id: 'login.html'
})
setTimeout(function() {
mui.openWindow({
id: 'login.html',
createNew: true
})
}, 100)
}
if(!name || !avatar) {
showLogin();
}
logoutBtn.addEventListener('tap', function() {
var views = plus.webview.all();
/*views.forEach(function(ele, i) {
if(ele!=='login.html') {
plus.webview.close(ele);
}
})*/
showLogin();
})
var backButtonPress = 0;
mui.back = function(event) {
backButtonPress++;
if (backButtonPress > 1) {
plus.runtime.quit();
} else {
plus.nativeUI.toast('再按一次退出应用');
}
setTimeout(function() {
backButtonPress = 0;
}, 1000);
return false;
};
})
})
</script>
</body>
</html>