-
Notifications
You must be signed in to change notification settings - Fork 0
/
me.html
148 lines (126 loc) · 4.77 KB
/
me.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<!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" />
</head>
<body>
<!--http://dev.dcloud.net.cn/mui/ui/#listview-->
<div class="mui-content">
<ul class="mui-table-view">
<li class="mui-table-view-cell mui-media">
<a id="link_myface" href="javascript:;">
<span class="mui-pull-right mui-icon mui-icon-arrowright"
style="line-height: 42px;color: lightgray;margin-left: 3px;"></span>
<img id="img_my_face" class="mui-media-object mui-pull-right" src="image/face-default-cat.png">
<div class="mui-media-body" style="line-height: 42px;font-size: 16px;"><!--箭头往下-->
头像
</div>
</a>
</li>
<li class="mui-table-view-cell mui-media">
<a id="link_nickname" href="javascript:;">
<span class="mui-pull-right mui-icon mui-icon-arrowright"
style="color: lightgray;margin-left: 3px;"></span>
<span id="span_nickname" class="mui-pull-right"
style="color: gray;font-size: 14px;"></span>
<div class="mui-media-body">
昵称
</div>
</a>
</li>
<li class="mui-table-view-cell mui-media">
<a href="javascript:;">
<span id="span_username" class="mui-pull-right"
style="color: gray;font-size: 14px;"></span>
<div class="mui-media-body">
账号
</div>
</a>
</li>
<li class="mui-table-view-cell mui-media">
<a id="link_my_qrcode" href="javascript:;">
<span class="mui-pull-right mui-icon mui-icon-arrowright"
style="color: lightgray;margin-left: 3px;"></span>
<img class="mui-media-object mui-pull-right"
src="image/qrcode.png" style="max-width: 20px;height: 20px;">
<div class="mui-media-body">
我的二维码
</div>
</a>
</li>
</ul>
<br />
<ul class="mui-table-view">
<li class="mui-table-view-cell mui-media"
style="text-align: center;">
<a id="link_logout" href="javascript:;">
<div class="mui-media-body">
退出登录
</div>
</a>
</li>
</ul>
</div>
<script src="js/mui.min.js"></script>
<script src="js/app.js"></script>
<script type="text/javascript">
mui.init()
mui.plusReady(function(){
// 获得当前的webview,刷新当前用户信息
var meWebview = plus.webview.currentWebview();
meWebview.addEventListener("show", function() {
refreshUserInfo();
});
// 页面跳转,我的头像
var link_myface = document.getElementById("link_myface");
link_myface.addEventListener("tap", function() {
mui.openWindow("myface.html", "myface.html");
});
// 页面跳转,修改昵称
var link_nickname = document.getElementById("link_nickname");
link_nickname.addEventListener("tap", function() {
mui.openWindow("mynickname.html", "mynickname.html");
});
// 添加自定义事件,刷新头像
window.addEventListener("refresh", function(){
refreshUserInfo();
});
// 查看我的二维码
var link_my_qrcode = document.getElementById("link_my_qrcode");
link_my_qrcode.addEventListener("tap", function(){
mui.openWindow({
url: "myQRCode.html",
id: "myQRCode.html",
styles: {}
})
});
// 用户退出
var link_logout = document.getElementById("link_logout");
link_logout.addEventListener("tap", function(){
app.userLogout();
mui.openWindow("login.html", "login.html");
});
});
function refreshUserInfo() {
var user = app.getUserGlobalInfo();
console.log(JSON.stringify(user))
if (user != null) {
var faceImage = user.faceImage;
var nickname = user.nickname;
var username = user.username;
var span_nickname = document.getElementById("span_nickname");
var span_username = document.getElementById("span_username");
span_nickname.innerHTML = nickname;
span_username.innerHTML = username;
if (app.isNotNull(faceImage)) {
var img_my_face = document.getElementById("img_my_face");
img_my_face.src = app.imgServerUrl + faceImage;
}
}
}
</script>
</body>
</html>