|
|
@@ -9,29 +9,71 @@
|
|
9
|
9
|
<title>通讯录</title>
|
|
10
|
10
|
<link href="css/mui.min.css" rel="stylesheet" />
|
|
11
|
11
|
<link rel="stylesheet" href="css/iconfont.css" />
|
|
|
12
|
+ <style>
|
|
|
13
|
+ .mui-bar {
|
|
|
14
|
+ -webkit-box-shadow: none;
|
|
|
15
|
+ box-shadow: none;
|
|
|
16
|
+ }
|
|
|
17
|
+
|
|
|
18
|
+ .mui-bar-nav {
|
|
|
19
|
+ background-color: #00a1cb;
|
|
|
20
|
+ }
|
|
|
21
|
+
|
|
|
22
|
+ .oa-contact-cell.mui-table .mui-table-cell {
|
|
|
23
|
+ padding: 11px 0;
|
|
|
24
|
+ vertical-align: middle;
|
|
|
25
|
+ }
|
|
|
26
|
+
|
|
|
27
|
+ .oa-contact-cell {
|
|
|
28
|
+ position: relative;
|
|
|
29
|
+ margin: -11px 0;
|
|
|
30
|
+ }
|
|
|
31
|
+
|
|
|
32
|
+ .oa-contact-avatar {
|
|
|
33
|
+ width: 50px;
|
|
|
34
|
+ }
|
|
|
35
|
+
|
|
|
36
|
+ .oa-contact-avatar img {
|
|
|
37
|
+ border-radius: 50%;
|
|
|
38
|
+ width: 30px;
|
|
|
39
|
+ height: 30px;
|
|
|
40
|
+ }
|
|
|
41
|
+
|
|
|
42
|
+ .oa-contact-content {
|
|
|
43
|
+ width: 100%;
|
|
|
44
|
+ }
|
|
|
45
|
+
|
|
|
46
|
+ .oa-contact-name {
|
|
|
47
|
+ margin-right: 10px;
|
|
|
48
|
+ }
|
|
|
49
|
+
|
|
|
50
|
+ .go_search {
|
|
|
51
|
+ background: #fff!important;
|
|
|
52
|
+ border: 1px solid #ccc!important;
|
|
|
53
|
+ border-radius: 17px!important;
|
|
|
54
|
+ }
|
|
|
55
|
+
|
|
|
56
|
+ a {
|
|
|
57
|
+ color: #000;
|
|
|
58
|
+ }
|
|
|
59
|
+
|
|
|
60
|
+ .mui-search.mui-active:before {
|
|
|
61
|
+ top: 25px;
|
|
|
62
|
+ }
|
|
|
63
|
+ </style>
|
|
12
|
64
|
</head>
|
|
13
|
65
|
|
|
14
|
66
|
<body>
|
|
15
|
|
- <header class="mui-bar mui-bar-nav">
|
|
16
|
|
- <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
|
|
17
|
|
- <h1 class="mui-title">联系人</h1>
|
|
18
|
|
- </header>
|
|
19
|
|
- <div class="mui-content">
|
|
20
|
|
- <ul class="mui-table-view" id="listArea">
|
|
21
|
|
- <li class="mui-table-view-cell" id="mode">
|
|
22
|
|
- #
|
|
23
|
|
- </li>
|
|
24
|
|
- </ul>
|
|
25
|
|
- </div>
|
|
26
|
|
-
|
|
|
67
|
+ <div class="">
|
|
27
|
68
|
<div class="mui-content mui-scroll-wrapper" id="pullrefresh">
|
|
28
|
69
|
<div class="mui-scroll">
|
|
29
|
70
|
<ul class="mui-table-view mui-table-view-striped mui-table-view-condensed" id="">
|
|
30
|
|
-
|
|
|
71
|
+
|
|
31
|
72
|
<li class="mui-table-view-cell">
|
|
32
|
73
|
<div class="mui-input-row mui-search">
|
|
33
|
74
|
<input type="search" class="mui-input-clear go_search" placeholder="请输入关键字" style="margin-bottom: 0;">
|
|
34
|
75
|
</div>
|
|
|
76
|
+
|
|
35
|
77
|
</li>
|
|
36
|
78
|
|
|
37
|
79
|
</ul>
|
|
|
@@ -49,26 +91,80 @@
|
|
49
|
91
|
<script src="js/huayi.config.js"></script>
|
|
50
|
92
|
|
|
51
|
93
|
<script type="text/javascript" charset="utf-8">
|
|
52
|
|
- mui.init();
|
|
53
|
|
- mui.plusReady(function() {
|
|
54
|
|
- // 扩展API加载完毕,现在可以正常调用扩展API
|
|
55
|
|
- plus.contacts.getAddressBook(plus.contacts.ADDRESSBOOK_PHONE, function(addressbook) {
|
|
56
|
|
- addressbook.find(["displayName", "phoneNumbers"], function(contacts) {
|
|
57
|
|
- for(var i = 0, len = contacts.length; i < len; i++) {
|
|
58
|
|
- var li = document.getElementById("mode").cloneNode(true);
|
|
59
|
|
- li.innerHTML = contacts[i].displayName + "<br/>手机:" + (contacts[i].phoneNumbers.length == 0 ? "" : contacts[i].phoneNumbers[0].value);
|
|
60
|
|
- document.getElementById("listArea").appendChild(li);
|
|
61
|
|
- }
|
|
62
|
|
- }, function() {
|
|
63
|
|
- mui.toast("获取电话簿失败");
|
|
64
|
|
- }, {
|
|
65
|
|
- multiple: true
|
|
66
|
|
- });
|
|
67
|
|
- }, function(e) {
|
|
68
|
|
- mui.toast("获取电话簿失败 " + e.message);
|
|
69
|
|
- });
|
|
70
|
|
- });
|
|
|
94
|
+ mui.init();
|
|
|
95
|
+ mui.ready(function() {
|
|
|
96
|
+ var keyw = '';
|
|
|
97
|
+ mui('.mui-scroll-wrapper').scroll({
|
|
|
98
|
+ deceleration: 0.0005
|
|
|
99
|
+ }); //设置减速系数,系数越大,滚动速度越慢,滚动距离越小,默认值0.0006
|
|
|
100
|
+ var a = localStorage.getItem("token");
|
|
|
101
|
+
|
|
|
102
|
+ Ajax();
|
|
|
103
|
+ $('.go_search').on('input focus', function() {
|
|
|
104
|
+ keyw = $(this).val();
|
|
|
105
|
+ console.log(keyw);
|
|
|
106
|
+ Ajax(keyw);
|
|
|
107
|
+ })
|
|
|
108
|
+
|
|
|
109
|
+ function Ajax() {
|
|
|
110
|
+ console.log(keyw);
|
|
|
111
|
+ $(".TX").empty();
|
|
|
112
|
+ mui.ajax(huayi.config.callcenter_url + 'AddressBook/GetAppList?', {
|
|
|
113
|
+ data: {
|
|
|
114
|
+ token: localStorage.getItem('token'),
|
|
|
115
|
+ keyWord:keyw
|
|
|
116
|
+ },
|
|
|
117
|
+ dataType: 'json', //服务器返回json格式数据
|
|
|
118
|
+ type: 'get', //HTTP请求类型
|
|
|
119
|
+ timeout: 10000, //超时时间设置为10秒;
|
|
|
120
|
+ headers: {
|
|
|
121
|
+ 'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8'
|
|
|
122
|
+ },
|
|
|
123
|
+ success: function(data) {
|
|
|
124
|
+ if(data.state = "success") {
|
|
|
125
|
+ console.log(data);
|
|
|
126
|
+ var html;
|
|
|
127
|
+ $(data.rows).each(function(i, n) {
|
|
|
128
|
+ html = '<li data-group="'+n.NameOneCode+'" class="mui-table-view-divider mui-indexed-list-group">'+n.NameOneCode+'</li>';
|
|
|
129
|
+ $(n.AddressBooklist).each(function(j, m) {
|
|
|
130
|
+ html += '<li data-value="'+m.NameOneCode+'" data-tags="'+m.NameOneCode+'" class="mui-table-view-cell mui-indexed-list-item">'+
|
|
|
131
|
+ '<div class="mui-slider-cell">'+
|
|
|
132
|
+ '<a href="tel:'+m.F_Mobile+'">'+
|
|
|
133
|
+ '<div class="oa-contact-cell mui-table">'+
|
|
|
134
|
+ '<div class="oa-contact-avatar mui-table-cell">'+
|
|
|
135
|
+ '<img src="img/2.png"/>'+
|
|
|
136
|
+ '</div>'+
|
|
|
137
|
+ '<div class="oa-contact-content mui-table-cell">'+
|
|
|
138
|
+ '<h4 class="oa-contact-name size-14">'+m.F_Name+'</h4>'+
|
|
|
139
|
+ '<span class="oa-contact-position mui-h6">'+m.F_Company+'</span>'+
|
|
|
140
|
+ '<h4 class="oa-contact-email mui-h6">'+m.F_Mobile+'</h4>'+
|
|
|
141
|
+ '</div>'+
|
|
|
142
|
+ '</div>'+
|
|
|
143
|
+ '</a>'+
|
|
|
144
|
+ '</div>'+
|
|
|
145
|
+ '</li>';
|
|
|
146
|
+ })
|
|
|
147
|
+ html += '</li>';
|
|
|
148
|
+ $(html).appendTo($(".TX"));
|
|
|
149
|
+ })
|
|
|
150
|
+ }
|
|
|
151
|
+ },
|
|
|
152
|
+ error: function(xhr, type, errorThrown) {
|
|
|
153
|
+ //异常处理;
|
|
|
154
|
+ mui.alert("");
|
|
|
155
|
+
|
|
|
156
|
+ }
|
|
|
157
|
+ });
|
|
|
158
|
+
|
|
|
159
|
+
|
|
|
160
|
+ }
|
|
|
161
|
+
|
|
|
162
|
+ });
|
|
|
163
|
+
|
|
|
164
|
+
|
|
|
165
|
+ //点击两次就退出软件
|
|
71
|
166
|
|
|
|
167
|
+
|
|
72
|
168
|
</script>
|
|
73
|
169
|
</body>
|
|
74
|
170
|
|