forked from chenfeishao/console.easemob.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp_chatgroups.html
executable file
·578 lines (544 loc) · 21.8 KB
/
app_chatgroups.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
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
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>环信开发者中心</title>
<!--
<link href="//cdnjscn.b0.upaiyun.com/libs/twitter-bootstrap/2.3.2/css/bootstrap.min.css" rel="stylesheet" type="text/css" media="screen"/>
<link href="//cdnjscn.b0.upaiyun.com/libs/twitter-bootstrap/2.3.2/css/bootstrap-responsive.css" rel="stylesheet" type="text/css" media="screen"/>
-->
<link href="assets/css/bootstrap-2.3.2.min.css" rel="stylesheet" type="text/css" media="screen"/>
<link href="assets/css/bootstrap-responsive-2.3.2.min.css" rel="stylesheet" type="text/css" media="screen"/>
<link href="assets/css/font-awesome-3.1.0.min.css" rel="stylesheet" type="text/css" media="screen"/>
<!--[if IE 7]>
<link rel="stylesheet" href="assets/css/font-awesome-ie7.min.css" />
<![endif]-->
<!--fonts-->
<!-- <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:400,300" /> -->
<!--ace styles-->
<link href="assets/css/ace.min.css" rel="stylesheet" type="text/css" media="screen"/>
<link href="assets/css/ace-responsive.min.css" rel="stylesheet" type="text/css" media="screen"/>
<link href="assets/css/ace-skins.min.css" rel="stylesheet" type="text/css" media="screen"/>
<!--[if lte IE 8]>
<link rel="stylesheet" href="assets/css/ace-ie.min.css" />
<![endif]-->
<link href="assets/css/management.css" rel="stylesheet" type="text/css" media="screen"/>
<link href="assets/css/manage.css" rel="stylesheet" type="text/css" media="screen"/>
<!--
<script src="//cdnjscn.b0.upaiyun.com/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="//cdnjscn.b0.upaiyun.com/libs/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script>
<script src="//cdnjscn.b0.upaiyun.com/libs/jquery-cookie/1.4.1/jquery.cookie.min.js"></script>
<script src="//cdnjscn.b0.upaiyun.com/libs/json2/20130526/json2.min.js"></script>
-->
<script src="assets/js/jquery-1.7.2.min.js"></script>
<script src="assets/js/jquery.cookie-1.3.js"></script>
<script src="assets/js/bootstrap-2.3.2.min.js"></script>
<script src="assets/js/json2.js"></script>
<script src="assets/js/ace-elements.min.js"></script>
<script src="assets/js/ace.min.js"></script>
<script src="assets/js/jquery.form.js"></script>
<script src="assets/js/management.js"></script>
<script src="assets/js/layer/layer.min.js"></script>
<script tyep="text/javascript">
var appUuid = getQueryString('appUuid');
var Application = $.cookie('Application');
var count = 0;
$(function(){
if (!getToken() || getToken()==''){
logout();
}
count = 0;
$('#showName').text(Application);
getAppChatrooms(appUuid);
$('#searchForm').submit(function(){
searchChatgroup();
return false;
});
});
// 搜索群组
function searchChatgroup(){
var groupidV = $('#groupid').val().trim();
if(groupidV == '' || groupidV == null){
alert('请输入要查找的群组ID');
} else {
getAppChatgroups(appUuid, groupidV);
}
}
//删除选定的群组
function deleteAppChatgroupBox(){
deleteAppChatgroupsCheckBox(appUuid);
}
// 应用概述页
function toApppofile(){
window.location.href = 'app_profile.html?appUuid='+appUuid;
}
// 用户管理页
function toAppUsersPage(){
window.location.href = 'app_users.html?appUuid='+appUuid;
}
// 群组页
function toAppGroups(){
window.location.href = 'app_chatgroups.html?appUuid='+appUuid;
}
// 推送证书管理页
function toAppNotifiersPage(){
window.location.href = 'app_notifiers.html?appUuid='+appUuid;
}
// 数据统计页面
function toAppCollectionCounters(){
window.location.href = 'app_collection_counters.html?appUuid='+appUuid;
}
// 应用管理员创建页面
function toCreateAppAdmin(){
window.location.href = 'app_admin_create.html?appUuid='+appUuid;
}
// APP管理员列表页面
function toAppUserAdmin(){
window.location.href = 'app_users_admin.html?appUuid='+appUuid;
}
// 去除字符串中所有空格
function removeAllSpace(str) {
return str.replace(/\s+/g, "");
}
//发送消息
function showSendMessge(){
sendMessge(appUuid);
}
function checkAll(){
var ischeck = document.getElementById('checkAll');
var checkbox = document.getElementsByName('checkbox');
if(ischeck.checked){
for (var i=0;i<checkbox.length;i++){
checkbox[i].checked = true;
}
}else{
for (var i=0;i<checkbox.length;i++){
checkbox[i].checked = false;
}
}
}
//发送消息判断
function sendMessage(){
var uploadresspan = $('#uploadresspan').text();
var messegeContent = $('#messegeContent').val();
if(uploadresspan == '等待上传图片' && messegeContent == ''){
} else if(uploadresspan != '等待上传图片' && messegeContent == ''){
sendUserImgMessages();
} else if(uploadresspan == '等待上传图片' && messegeContent != ''){
sendUserMessages();
} else if(uploadresspan != '等待上传图片' && messegeContent != ''){
sendUserMessages();
sendUserImgMessages();
}
}
function check() {
if(count==0) {
count++;
return true;
} else {
count = 0;
return false;
}
}
//添加群组
var publics = true;
var approval=true;
function createNewChatgroupPre() {
if(check()){
var groupName = $("#groupName").val().trim();
var groupDesc = $("#groupDesc").val().trim();
var groupOwner = $("#groupOwner").val().trim();
var maxusers = $("#maxusers").val().trim();
var res = createNewChatgroups(appUuid, groupName, groupDesc, approval, publics, groupOwner);
if(!res){
count = 0;
}
}
}
//判断是否是公开群
function nums(){
publics=true;
$('#validation').show();
}
function numss(){
publics=false;
$('#validation').hide();
}
//判断是否需要验证
function approvalon(){
approval=true;
}
function approvals(){
approval=false;
}
function imgMessage(){
$('#uploadresspan').text('图片上传中...');
var img = $('#file').val().substr( $('#file').val().lastIndexOf('.')+1);
img = img.toLowerCase();
if(img == 'jpg'|| img == 'png'|| img == 'bmp'|| img =='gif' || img == 'jpeg' ){
var access_token = $.cookie('access_token');
var orgName = $.cookie('orgName');
var ajax_option = {
url:baseUrl + '/' + orgName + '/' + appUuid + '/chatfiles',
headers:{
'Accept':'application/json',
'restrict-access':true,
'Accept-Encoding':'gzip,deflate',
'Authorization':'Bearer ' + access_token,
},
success:function(respData){
$('#uploadresspan').text('图片上传成功 !');
var str = $('#file').val()+","+respData.entities[0]['share-secret'];
$('#share-secret').val(str);
$('#imgUuid').val(baseUrl + '/' + orgName + '/' + appUuid + '/chatfiles/'+respData.entities[0].uuid);
},
error:function(respData){
}
}
$('#myForm').ajaxSubmit(ajax_option);
}else{
alert('此文件不是图片!请选择图片');
}
}
function clsupSpan(){
$('#uploadresspan').text('等待上传图片');
}
window.onresize = window.onload = function(){
var w,h;
if(!!(window.attachEvent && !window.opera)) {
h = document.documentElement.clientHeight;
w = document.documentElement.clientWidth;
}else{
h = window.innerHeight;
w = window.innerWidth;
}
$("#headerlogo").width(w/6.5);
$("#headerlogo").height(h/16)
}
</script>
</head>
<body>
<div class="navbar navbar-inverse">
<div class="navbar-inner">
<div class="container-fluid">
<a class="brand" href="javascript:void(0);"><img id="headerlogo" src="assets/images/home_logo.png" alt="管理后台"/></a>
<div id="headhref" class="lianjie" style="width:40%; margin-left:20%;">
<ol>
<li style="width:20%;"><a href="http://www.easemob.com" target="_blank"><h5>主页</h5></a></li>
<li style="width:20%;"><a href="http://www.easemob.com/docs/gettingstart" target="_blank"><h5>文档</h5></a></li>
<li style="width:20%;"><a href="http://www.easemob.com/faq" target="_blank"><h5>帮助</h5></a></li>
<li style="width:20%;"><a href="http://www.imgeek.org/forum.php" target="_blank"><h5>社区</h5></a></li>
<li style="width:20%;"><a href="http://www.easemob.com/sdk" target="_blank"><h5>下载SDK</h5></a></li>
</ol>
</div>
<ul class="nav ace-nav pull-right" style="top:5px; margin-right:0">
<li class="light-blue user-profile"> <a class="user-menu dropdown-toggle" href="javascript:void(0);" data-toggle="dropdown"> <span id="user_info"></span> <i class="icon-caret-down"></i> </a>
<ul id="user_menu" class="pull-right dropdown-menu dropdown-yellow dropdown-caret dropdown-closer">
<li class="divider"></li>
<li> <a href="admin_home.html"> <i class="icon-user"></i> 账户 </a> </li>
<li> <a onClick="logout();" href="javascript:void(0);"> <i class="icon-off"></i> 退出 </a> </li>
</ul>
</li>
</ul>
</div>
</div>
</div>
<div id="main-container" class="container-fluid"> <a href="javascript:void(0);" id="menu-toggler"> <span></span> </a>
<div id="sidebar">
<div id="sidebar-shortcuts">
<div style="min-height: 40px;" id="sidebar-shortcuts-large"> </div>
<div style="min-height: 40px;" id="sidebar-shortcuts-mini"> </div>
</div>
<ul class="nav nav-list">
<li class="active"> <a href="app_list.html" target="_self"> <i class="icon-ambulance"></i> <span>我的应用</span> </a></li>
<li> <a href="admin_home.html" target="_self"> <i class="icon-user"></i> <span>个人信息</span> </a></li>
</ul>
<div id="sidebar-collapse"> <i class="icon-double-angle-left"></i> </div>
</div>
<div class="clearfix" id="main-content">
<div id="breadcrumbs">
<ul class="breadcrumb">
<li> <i class="icon-home"></i> 我的应用 <span class="divider"> <i class="icon-angle-right"></i> </span> </li>
<li> <a href="javascript:void(0);" target="_self"> <span id="showName"></span></a></li>
</ul>
</div>
<div class="clearfix" id="page-content">
<div class="row-fluid">
<div class="pagination pagination-left">
<ul>
<li> <a href="javascript:toApppofile()">应用概况</a> </li>
</ul>
<ul>
<li> <a href="javascript:toAppUsersPage()">IM用户</a> </li>
</ul>
<ul>
<li> <a href="javascript:toAppGroups()"><font color="green">群组</font></a> </li>
</ul>
<ul>
<li> <a href="javascript:toAppNotifiersPage()">推送证书</a> </li>
</ul>
<ul>
<li> <a href="javascript:toAppCollectionCounters()">统计数据</a> </li>
</ul>
<hr/>
</div>
<div class="pagination pagination-left">
<ul>
<li> <a href="#passwordMondify" data-toggle="modal" role="button">添加群组</a> </li>
</ul>
<ul>
<li> <a href="javascript:deleteAppChatgroupBox()">批量删除</a> </li>
</ul>
<ul>
<li> <a href="javascript:showSendMessge()">发送消息</a> </li>
</ul>
<ul style="display:none">
<li> <a href="#sendMessage" id="sendMessageA" data-toggle="modal" role="button" ></a> </li>
</ul>
<form id="searchForm" action="#" class="form-search pull-right">
<div class="input-append">
<input class="m-wrap" value="" id="groupid" type="text" placeholder="输入完整群组ID" />
<button class="btn green" id="searchBtn" onClick="searchChatgroup()" type="button">搜索</button>
<input value="" id="userInboxBak" type="hidden" />
</div>
</form>
</div>
<div id="paginau" class="pagination pagination-right" style="padding-top:0;margin:0 auto;">
<span id="pageInfo"></span>
</div>
<div class="row-fluid">
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th width="111px" >全选<input style="opacity:1;" type="checkbox" id="checkAll" onChange="checkAll()"/></th>
<th class="hidden-280 text-center" width="222px">群组ID</th>
<th class="hidden-480 text-center" width="666px" style="word-break:break-all">群组名称</th>
<th class="hidden-480 text-center" width="222px">操作</th>
</tr>
</thead>
<tbody id="appChatroomBody"></tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<!--添加群组-->
<div id="passwordMondify" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">添加群组</h3>
</div>
<div class="modal-body">
<div class="row-fluid">
<div class="span12">
<div class="control-group">
<label class="control-label" for="groupName">群组名称:</label>
<div class="controls">
<input type="text" id="groupName" name="groupName" value="" placeholder="请输入群组名称"/>
<input type="hidden" id="usernameMondify" name="usernameMondify" value=""/>
<input type="hidden" id="appUuidHidd" name="appUuidHidd" value=""/>
<span style="color: red;" id="groupnameSpan"></span>
</div>
</div>
</div>
</div>
<div class="row-fluid">
<div class="span12">
<div class="control-group">
<label class="control-label" for="groupDesc">群组描述:</label>
<div class="controls">
<input type="text" id="groupDesc" name="groupDesc" value="" placeholder="请输入群组描述" />
<span style="color: red;" id="groupdescSpan"></span>
</div>
</div>
</div>
</div>
<div class="row-fluid">
<div class="span12">
<div class="control-group">
<label class="control-label" for="grouppulic">是否公开:</label>
<div class="controls">
<input type="radio" id="nopublic" name="public" onclick="numss();" checked="checked" value="false" style="opacity:1;"/> 不公开
<input type="radio" id="public" name="public" onclick="nums();" value="true" style="opacity:1;"/> 公开
<span style="color: red;" id="grouppulicSpan"></span>
</div>
</div>
</div>
</div>
<div class="row-fluid" id="validation">
<div class="span12">
<div class="control-group">
<label class="control-label" for="groupapproval">加群是否验证:</label>
<div class="controls">
<input type="radio" id="approvals" name="approval" onclick="approvals();" value="false" style="opacity:1;"/> 不验证
<input type="radio" id="approval" name="approval" onclick="approvalon();" value="true" checked="checked" style="opacity:1;"/> 验证
<span style="color: red;" id="groupapprovalSpan"></span>
</div>
</div>
</div>
</div>
<div class="row-fluid">
<div class="span12">
<div class="control-group">
<label class="control-label" for="maxusers">最大成员数:</label>
<div class="controls">
<input type="text" id="maxusers" name="maxusers" value="" placeholder="请输入最大成员数" />
<span style="color: red;" id="groupmaxuserSpan"></span>
</div>
</div>
</div>
</div>
<div class="row-fluid">
<div class="span12">
<div class="control-group">
<label class="control-label" for="groupOwner">群主:</label>
<div class="controls">
<input type="text" id="groupOwner" name="groupOwner" value="" placeholder="请输入群主账号" />
<span style="color: red;" id="qunzuguanSpan"></span>
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<a class="btn" id="addNewChatgroupBtn" onclick="createNewChatgroupPre();">添加</a>
<button class="btn" data-dismiss="modal" onClick="clsSpan()" aria-hidden="true">关闭</button>
</div>
</div>
<!--添加群组end-->
<!--修改群组信息-->
<div id="groupInfoMondify" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">修改群组</h3>
</div>
<div class="modal-body">
<div class="row-fluid">
<div class="span12">
<div class="control-group">
<label class="control-label" for="groupName">群组名称:</label>
<div class="controls">
<input type="text" id="groupName" name="groupName" value="" placeholder="请输入群组名称"/>
<input type="hidden" id="usernameMondify" name="usernameMondify" value=""/>
<input type="hidden" id="appUuidHidd" name="appUuidHidd" value=""/>
<span style="color: red;" id="groupnameSpan"></span>
</div>
</div>
</div>
</div>
<div class="row-fluid">
<div class="span12">
<div class="control-group">
<label class="control-label" for="groupDesc">群组描述:</label>
<div class="controls">
<input type="text" id="groupDesc" name="groupDesc" value="" placeholder="请输入群组描述" />
<span style="color: red;" id="groupdescSpan"></span>
</div>
</div>
</div>
</div>
<div class="row-fluid">
<div class="span12">
<div class="control-group">
<label class="control-label" for="grouppulic">是否公开:</label>
<div class="controls">
<input type="radio" id="nopublic" name="public" onclick="numss();" value="false" style="opacity:1;"/> 不公开
<input type="radio" id="public" name="public" onclick="nums();" value="true" checked="checked" style="opacity:1;"/> 公开
<span style="color: red;" id="grouppulicSpan"></span>
</div>
</div>
</div>
</div>
<div class="row-fluid" id="validation">
<div class="span12">
<div class="control-group">
<label class="control-label" for="groupapproval">加群是否验证:</label>
<div class="controls">
<input type="radio" id="approvals" name="approval" onclick="approvals();" value="false" style="opacity:1;"/> 不验证
<input type="radio" id="approval" name="approval" onclick="approvalon();" value="true" checked="checked" style="opacity:1;"/> 验证
<span style="color: red;" id="groupapprovalSpan"></span>
</div>
</div>
</div>
</div>
<div class="row-fluid">
<div class="span12">
<div class="control-group">
<label class="control-label" for="maxusers">最大成员数:</label>
<div class="controls">
<input type="text" id="maxusers" name="maxusers" value="" placeholder="请输入最大成员数" />
<span style="color: red;" id="groupmaxuserSpan"></span>
</div>
</div>
</div>
</div>
<div class="row-fluid">
<div class="span12">
<div class="control-group">
<label class="control-label" for="groupOwner">群主:</label>
<div class="controls">
<input type="text" id="groupOwner" name="groupOwner" value="" placeholder="请输入群主账号" />
<span style="color: red;" id="qunzuguanSpan"></span>
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<a class="btn" id="addNewChatgroupBtn" onclick="createNewChatgroupPre();">添加</a>
<button class="btn" data-dismiss="modal" onClick="clsSpan()" aria-hidden="true">关闭</button>
</div>
</div>
<!--修改群组信息end-->
<!--发送消息-->
<div id="sendMessage" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button id="closeButn" type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">发送消息</h3>
<input type="hidden" id="imgUuid" />
</div>
<div class="modal-header">
<h3 id="msgType"><font style="font-size:13px;color:red">提醒:</font>
<font style="font-size:13px;color:red"> 可以文字和图片同时发送,也可任选其一发送</font>
</div>
<div class="modal-body">
<div class="row-fluid">
<div class="span12">
<form id="myForm" method="POST" enctype="multipart/form-data" action="">
<div class="control-group">
<label class="control-label" for="messegeContent">选择图片:</label>
<div class="controls" id="div1">
<input type="text" readonly="readonly" id="f_file"/>
<input type="button" value="选择..." class="btn btn-mini btn-primary" onClick="file.click()" />
<input type="file" name="file" id="file" onChange="f_file.value=this.value;imgMessage()" style="display:none">
<span id="uploadresspan">等待上传图片</span>
<input type="hidden" id="share-secret" />
</div>
</div>
</form>
<div class="control-group">
<label class="control-label" for="messegeContent">输入文字:</label>
<div class="controls" id="div1">
<textarea style="width:500px; height:100px;" id="messegeContent" name="messegeContent" ></textarea>
<input type="hidden" id="usernameMessage" name="usernameMessage" value=""/>
<input type="hidden" id="appUuidMessage" name="appUuidMessage" value=""/>
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<a class="btn" onClick="sendMessage();" href="javascript:void(0);">发送</a>
<button id="messageCloseBtn" class="btn" data-dismiss="modal" onClick="clsupSpan()" aria-hidden="true">关闭</button>
</div>
</div>
<!--发送消息end-->
</body>
</html>