-
Notifications
You must be signed in to change notification settings - Fork 0
/
searchFriends.html
82 lines (64 loc) · 2.29 KB
/
searchFriends.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
<!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" />
<link rel="stylesheet" type="text/css" href="css/header.css" />
</head>
<body>
<header class="mui-bar mui-bar-nav title">
<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left" style="color: white;"></a>
<a id="link_submit_search" class="mui-icon mui-icon-right-nav mui-pull-right"
style="color: white;font-size: 14px;line-height: 25px;">搜索</a>
<h1 class="mui-title title-color">添加朋友</h1>
</header>
<div class="mui-content">
<div class="mui-input-row">
<input id="txt_your_friend_username"
type="text" class="mui-input-speech mui-input-clear"
placeholder="搜索朋友">
</div>
</div>
<script src="js/mui.min.js"></script>
<script src="js/app.js"></script>
<script type="text/javascript">
mui.init()
mui.plusReady(function() {
var user = app.getUserGlobalInfo();
var txt_your_friend_username = document.getElementById("txt_your_friend_username");
// 提交事件,搜索朋友
var link_submit_search = document.getElementById("link_submit_search");
link_submit_search.addEventListener("tap", function() {
var yourFriendUsername = txt_your_friend_username.value;
plus.nativeUI.showWaiting("请稍后...");
mui.ajax(app.serverUrl + "/user/search?myUserId=" + user.id +
"&friendUsername=" + yourFriendUsername, {
data:{},
dataType:'json',//服务器返回json格式数据
type:'post',//HTTP请求类型
timeout:10000,//超时时间设置为10秒;
headers:{'Content-Type':'application/json'},
success:function(data){
//服务器返回响应
plus.nativeUI.closeWaiting();
if (data.code == 0) {
mui.openWindow({
url: "searchFriendsResult.html",
id: "searchFriendsResult.html",
styles: {},
extras: {
willBeFriend: data.data
}
});
} else {
app.showToast(data.msg, "error");
}
}
});
});
});
</script>
</body>
</html>