-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathimg.php
2460 lines (2252 loc) · 80.7 KB
/
img.php
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
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
require_once('config.inc.php');
require_once('lib/mesages.class.php');
$chat_uid = $_SESSION['staffid'];
$oms_id = $_SESSION['oms_id'];
$chat_uid = 5;
$oms_id = 3;
$pageload = 10;//消息显示的条数
$session_no = 0;//会话id
$mesNum = 0;
$messageSessionList = [];
//消息类型
// $mes_type = 'message';
//实例化消息
$mes = new messageList($chat_uid, $oms_id);
//最近联系人
if (isset($chat_uid)) {
$recentContact = $mes->recentContact();
}
//最近联系人session_no集合;
$ContactManSession = [];
foreach ($recentContact as $key => $value) {
$ContactManSession[] = $value['session_no'];
}
// 加入管理员 群 的 session
$ContactManSession[] = 'ca';
//自己的信息
$userinfo = $mes->userinfo();
$chat_name = $userinfo['name'];//自己名字
$card_image = $userinfo['card_image'];//头像的url
$isAdmin = $userinfo['general_admin'];
//提示消息列表
if (isset($chat_uid)) {
$arrMes = $mes->mesAlertList($isAdmin);
if (!empty($arrMes)) {
foreach ($arrMes as $key => $value) {
$mesNum += $value['mes_num'];
$messageSessionList[] = $value['session_no'];
}
}
}
//群聊列表
$arrGroup = $mes->groupChatList();
//管理员的所有信息
// $chatAdminList = $mes->getAdmin();
?><?php
require_once('config.inc.php');
require_once('lib/mesages.class.php');
$chat_uid = $_SESSION['staffid'];
$oms_id = $_SESSION['oms_id'];
$chat_uid = 5;
$oms_id = 3;
$pageload = 10;//消息显示的条数
$session_no = 0;//会话id
$mesNum = 0;
$messageSessionList = [];
//消息类型
// $mes_type = 'message';
//实例化消息
$mes = new messageList($chat_uid, $oms_id);
//最近联系人
if (isset($chat_uid)) {
$recentContact = $mes->recentContact();
}
//最近联系人session_no集合;
$ContactManSession = [];
foreach ($recentContact as $key => $value) {
$ContactManSession[] = $value['session_no'];
}
// 加入管理员 群 的 session
$ContactManSession[] = 'ca';
//自己的信息
$userinfo = $mes->userinfo();
$chat_name = $userinfo['name'];//自己名字
$card_image = $userinfo['card_image'];//头像的url
$isAdmin = $userinfo['general_admin'];
//提示消息列表
if (isset($chat_uid)) {
$arrMes = $mes->mesAlertList($isAdmin);
if (!empty($arrMes)) {
foreach ($arrMes as $key => $value) {
$mesNum += $value['mes_num'];
$messageSessionList[] = $value['session_no'];
}
}
}
//群聊列表
$arrGroup = $mes->groupChatList();
//管理员的所有信息
// $chatAdminList = $mes->getAdmin();
?><?php
require_once('config.inc.php');
require_once('lib/mesages.class.php');
$chat_uid = $_SESSION['staffid'];
$oms_id = $_SESSION['oms_id'];
$chat_uid = 5;
$oms_id = 3;
$pageload = 10;//消息显示的条数
$session_no = 0;//会话id
$mesNum = 0;
$messageSessionList = [];
//消息类型
// $mes_type = 'message';
//实例化消息
$mes = new messageList($chat_uid, $oms_id);
//最近联系人
if (isset($chat_uid)) {
$recentContact = $mes->recentContact();
}
//最近联系人session_no集合;
$ContactManSession = [];
foreach ($recentContact as $key => $value) {
$ContactManSession[] = $value['session_no'];
}
// 加入管理员 群 的 session
$ContactManSession[] = 'ca';
//自己的信息
$userinfo = $mes->userinfo();
$chat_name = $userinfo['name'];//自己名字
$card_image = $userinfo['card_image'];//头像的url
$isAdmin = $userinfo['general_admin'];
//提示消息列表
if (isset($chat_uid)) {
$arrMes = $mes->mesAlertList($isAdmin);
if (!empty($arrMes)) {
foreach ($arrMes as $key => $value) {
$mesNum += $value['mes_num'];
$messageSessionList[] = $value['session_no'];
}
}
}
//群聊列表
$arrGroup = $mes->groupChatList();
//管理员的所有信息
// $chatAdminList = $mes->getAdmin();
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script type="text/javascript" src="js/swfobject.js"></script>
<script type="text/javascript" src="js/web_socket.js"></script>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/touchSwipe.js?"></script>
<script src="js/jquery-ui.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/photoswipe.min.js"></script>
<script src="js/viewer.min.js"></script>
<script src="js/photoswipe-ui-default.min.js"></script>
<script type="text/javascript" src="js/web_message.js?v=1.0.0"></script>
<link rel="stylesheet" href="css/jquery-ui.css">
<link rel="stylesheet" href="css/default-skin.css">
<link rel="stylesheet" href="css/photoswipe.css">
<link rel="stylesheet" href="css/viewer.min.css">
<link rel="stylesheet" href="css/webRight.css" type="text/css"/>
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<link rel="stylesheet" href="css/font-awesome.min.css" type="text/css"/>
<link rel="stylesheet" href="css/app.css" type="text/css"/>
<style type="text/css">
*{font-family: 'Microsoft YaHei', SimSun, sans-serif !important;}
.online_man{ text-align: center;margin: 0 auto;box-shadow: 0 0 5px #999;}
.online_man ul{margin-left: auto;margin-right: auto;padding: 0;}
#name_box{ position:fixed;background:#fff;display:none;width: 100%;margin-top:0px; z-index:9999;}
.mes_chakan_close{ line-height: 20px; cursor: pointer; }
.mes_dclose{ cursor: pointer; position: absolute; top: 3px; font-size: 33px; color: #fff; right: 0;}
.tab-content{min-height: 300px;height: 80% !important; max-height: 600px; overflow: auto;position: relative;}
#submit{height: 50px;}
</style>
</head>
<div class="">
<ul class="loadImg">
<li><img src="http://7xq4o9.com1.z0.glb.clouddn.com/file/5/4/1465310817490/group.jpg" alt=""></li>
<li><img src="http://7xq4o9.com1.z0.glb.clouddn.com/file/5/4/1465310817490/group.jpg" alt=""></li>
<li><img src="http://7xq4o9.com1.z0.glb.clouddn.com/file/5/4/1465801024900/2016-06-13_133824引导页.png" alt=""></li>
</ul>
</div>
<div class="chat_voice_box" voice_url="">
<audio src="" preload></audio>
</div>
<div class="chat_alert alert-success" role="alert">
<button class="close" data-dismiss="alert" type="button" >×</button>
<p>恭喜您操作成功!</p>
</div>
<!-- 消息通知 -->
<div class="chat_message_notice">
<i class= "chat_close">×</i>
<div class="chat_message_notice_con"></div>
</div>
<!-- 消息提示 -->
<div class="mesNoticeContainer"></div>
<!-- end -->
<div class="chat_notice_container">
<div class="chat_notice_close close">×</div>
<div class="chat_notice_list_box">
<div class="chat_notice_list">
<div class="chat_notice_img">
<img src="/chat/images/chatNotice.png" alt="">
</div>
<div class="chat_notice_con">
<span></span>
<span></span>
</div>
<div class="chat_notice_agree chat_notice_sel"></div>
<div class="chat_notice_unagree chat_notice_sel"></div>
</div>
</div>
</div>
<div id="name_box">
<?php
include('fenlei2/OS.php');
?>
<div style="width:100%;"><button style="width:157px;height:30px" id="b_no" class="btn btn-sm btn-info" >取 消</button><button style="margin-top:17px;width:157px;height:30px;" id="b_is" class="btn btn-sm btn-info">确 定</button></div>
</div>
<div class="bagimg">
<img src="images/2.jpg" alt="">
</div>
<div class="container-box">
<div class="details-list">
<div class="container-title">
<div class="container-header">
<img src="<?php echo $card_image;?>" width="50px" height="50px" alt="<?php echo $chat_name;?>">
<h3><?php echo $chat_name;?></h3>
</div>
<div class="dropdown">
<i id="chatNoticeList" data-target="#" href="#" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
<i class="icon-list"></i>
<span class="caret"></span>
</i>
<ul class="dropdown-menu chat-set-user" aria-labelledby="chatNoticeList">
<li set-switch = '1' set-data = "VoiceState" class="dropdown-menu-man dissolve-group VoiceState close-voice">关闭声音</li>
<li set-switch = '1' set-data = "desktopState" class="dropdown-menu-man dissolve-group desktopState close-voice">关闭桌面通知</li>
</ul>
</div>
<!-- <span class="chat_mes_notice"><img src="/chat/images/chat_notice.png" alt=""></span> -->
</div>
<div class="container-tab">
<ul>
<li class="tab-title" ind= '0' title="最近联系人"><img src="images/mesage.png" alt="最近联系人"></li>
<li title="选择人聊天"><img id="s_man" src="images/rens1.png" alt="选择人聊天"></li>
<li class="tab-title" ind= '1' title="选择群聊"><img src="images/rens.png" alt="选择群聊"></li>
<a href="new_groupChat.php" target="_blank" title="新建群聊"><li title="新建群聊"><img src="images/addMan.png" alt="新建群聊"></li></a>
<i class="sanjiao"></i>
</ul>
</div>
<!-- 最近联系人 -->
<div class="tab-content con-tab-content">
<!-- 最近联系人的搜索结果 -->
<ul class="search-ren-res list-group"></ul>
<ul class="list-group">
<li class="search-ren"><i></i><input type="text" id="search-ren" placeholder="搜索联系人"></li>
<li class="recent-contact chat_people recent-hover" style="display:none" group-name="客服" session_no="customer" mes_id="1" mestype ="message" session_no="<?php echo $oms_id.'c';?>"></li>
<?php if ( $isAdmin == 1 ):?>
<li class="chat_admin session_no" data-placement="right" group-name="管理员联系群" session_no="ca" mes_id="" mestype ="adminMessage" ><span class="header-img"><img src="/chat/images/chat_admin.png" alt=""></span><i>管理员联系群</i></li>
<?php endif;?>
<li class="chat_system_notice" data-placement="right" onclick="chatSystemNotice()" group-name=""><span class="header-img"><img src="/chat/images/chatNotice.png" alt=""></span><i>系统通知</i></li>
<!-- <li class="companyGroup recent-hover" data-placement="right" group-name="公司群"></li> -->
<?php if (!empty($recentContact)): foreach ($recentContact as $key => $value) :?>
<?php
$herder_img = $value['card_image'];
$contacts_name = $value['contacts_name'];
if ($value['mestype'] !== "message") {
$contacts_name = $value['accept_name'];
$herder_img = '/chat/images/rens.png';
}
$cont_id = $value['mes_id'];
?>
<?php if ($value['mestype'] !== "message") :?>
<li class="session_no recent-hover" data-placement="right" group-name="<?php echo $value['accept_name']; ?>" delConId = <?php echo $value['id'];?> session_no="<?php echo $value['session_no'];?>" mes_id="<?php echo $cont_id;?>" mestype ="<?php echo $value['mestype'];?>" ><span class="header-img"><img src="<?php echo $herder_img?>" alt=""></span><i><?php echo $contacts_name;?></i><span title = "从列表中删除" mestype="<?php echo $value['mestype'];?>" delConId = <?php echo $value['id'];?> session="<?php echo $value['session_no'];?>" class="recent-close">×</span></li>
<?php else: ?>
<li class="recent-contact content-staff-info chat_people recent-hover" data-placement="right" group-name="<?php echo $contacts_name;?>" delConId = <?php echo $value['id'];?> session_no="<?php echo $value['session_no'];?>" mes_id="<?php echo $cont_id;?>" mestype ="<?php echo $value['mestype'];?>" ><span class="header-img"><img src="<?php echo $herder_img;?>" alt=""></span><i><?php echo $contacts_name;?></i><span title = "删除聊天记录" mestype="<?php echo $value['mestype'];?>" delConId = <?php echo $value['id'];?> session="<?php echo $value['session_no'];?>" class="recent-close">×</span></li>
<?php endif; ?>
<?php endforeach; ?>
<?php endif; ?>
</ul>
</div>
<div class="tab-content group-content" style="border-top: 1px solid #ccc;">
<!-- 群列表 -->
<div class="panel-group" id="accordion">
<?php if (!empty($arrGroup)): foreach ($arrGroup as $key => $value): ?>
<div class="panel panel-default">
<div class="panel-heading session_no db_session_no" group-name="<?php echo $value['group_name']?>" groupId="<?php echo $value['id'];?>" group-all="<?php echo $value['all_staffid']?>" session_no='<?php echo $value['pid']?>'>
<h4 class="panel-title"><a groupid = "<?php echo $value['pid']?>" data-toggle="collapse" class="group-man-show" data-parent="#accordion" href="#collapse<?php echo $key;?>"><?php echo $value['group_name']?></a></h4>
</div>
<div id="collapse<?php echo $key;?>" class="panel-collapse collapse">
<div class="panel-body">
<ul class="list-group">
<!-- 群聊参加人 -->
</ul>
</div>
</div>
<div class="dropdown">
<i id="dLabel<?php echo $key;?>" data-target="#" href="http://example.com" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
<i class="icon-list"></i>
<span class="caret"></span>
</i>
<ul class="dropdown-menu" aria-labelledby="dLabel<?php echo $key;?>">
<?php if ($chat_uid == $value['group_founder']):?>
<li groupId="<?php echo $value['pid'];?>" class="dropdown-menu-man dissolve-group">解散该群</li>
<?php else:?>
<li groupId="<?php echo $value['pid'];?>" class="dropdown-menu-man esc-group">退出该群</li>
<?php endif;?>
</ul>
</div>
</div>
<?php endforeach;?>
<?php endif;?>
</div>
<!-- end群 -->
</div>
</div>
<div class="chat-container">
<div class="mes_title">
<h2 class="mes_title_con">请选择人<i title="群聊添加人" class="add-groupMan"></i></h2><span aria-hidden="true" class="mes_dclose">×</span>
</div>
<div class="mes_con_box">
<div class="">
<div class="he-ov-box mes-scroll pc_he-ov-box chat_initial">
<div class="">
<div class="loader">
<div id="mes_load" style="display:none;"><?php echo $pageload;?></div>
<div class="loading-3">
<i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i>
</div>
</div>
<ul class="he_ov session-box" >
</ul>
</div>
</div>
<div class="pc_mes_input_box">
<div class="pc_emoji_box">
</div>
<div class="pc_mes_tool">
<ul>
<li class="pc_mes_tool_emoji pc_mes_tool_list"></li>
<!-- <li class="pc_mes_tool_img pc_mes_tool_list"></li> -->
<li class="pc_mes_tool_file pc_mes_tool_list"></li>
<!-- <li class="pc_mes_tool_audio pc_mes_tool_list keydown_voice"></li> -->
</ul>
</div>
<div class="pc_mes_input" id="pc_mes_input" contenteditable="true"></div>
<div class="pc_mes_send">
<span style = "color: #aaa">按Shift + Enter 换行, Enter提交</span>
<div class="chat_btn">发送</div>
</div>
</div>
<div class="mes_footer mb_mes_footer mb_mes_footer">
<div class="plus_menu_box">
<div class="plus_menu">
<span class="header_icon plus-list"><img src="/chat/images/header_icon.png" alt=""></span>
<input style="display:none" type="file" multiple id="send-upimg"><span id="cli-upFile"><img src="images/uploadfile.png" alt=""></span>
</div>
<i class="icon-caret-down"></i>
</div>
<!-- <form onsubmit="onSubmit(); return false;"> -->
<div class="mes_input">
<i class="plus_icon"></i>
<div class="mes_inout textarea chat_text_voice" id="mes_textarea" style="height:auto;" contenteditable="true"></div>
<textarea style="display:none" class="mes_inout" ></textarea>
<input type="submit" class="btn btn-primary chat_text_voice" id="submit" value="发送" />
<div class="keydown_voice chat_voice_input">按下开始说话</div>
<div class="chat_input_key chat_voice_input"></div>
<div style="clear:both"></div>
</div>
<div class="emoticons"></div>
<!-- </form> -->
<div>
</div>
</div>
</div>
</div>
</div>
<!-- 右边人数 和 消息数 -->
<div class="mes_fixed_big">
<div class="mes_abs">
<div class="mes_fixed">
<div class="mes_ico_box" cata-box='ren'>
<div class="mes_ico mes_hide" style="background-position:-6px -50px"></div>
<div class="mes_ico mes_hide" style="background-position:-100px -100px;text-align: center;color:#fff;">
<span class="mes_hide" style='line-height: 50px;'><span class='online_ren'>0</span>人</span>
</div>
</div>
<div class="mes_ico_box" cata-box='mes'>
<div class="mes_ico mes_hide" style="background-position:-6px 0"></div>
<div class="mes_ico mes_hide" style="background-position:-100px -100px">
<div class="mes_radio mes_hide"><?= $mesNum;?></div>
</div>
</div>
<div class="kefu-icon">
<div class="kefu" mes_id="customer" group-name ="客服">联系客服</div>
</div>
<!-- <div class="mes_move"><i class="icon-sort"></i></div> -->
</div>
<div class="online_man" >
<div class="man_tittle">
<span>人员列表</span>
<span class ="close" style='cursor: pointer; margin-right: 5px;background: #000;color: #fff; position:absolute;width:20px;height:20px;border-radius: 50%;right: 0; top: 7px; '>×</span>
</div>
<div class="onlinesSroll-box">
<div class="onlinesSroll"></div>
</div>
<!-- 人员列表 -->
<!-- 搜索框 -->
<div class="search_box">
<input type="text" class= "search_in" id="search_in" placeholder= "搜索">
<span class="search_staff"></span>
<ul class="staff-list-group search_result">
</ul>
</div>
<ul class="list-group oms_onlineNum">
</ul>
</div>
<div class="mes_con" style="display: none;">
<div class="mes_tittle">
<span>消息列表</span>
<span class ="close" style='cursor: pointer; margin-right: 5px;background: #000;color: #fff; position:absolute;width:20px;height:20px;border-radius: 50%;right: 0; top: 7px; '>×</span>
</div>
<!-- 消息列表 -->
<?php if (!empty($arrMes)):?>
<?php foreach ($arrMes as $key => $value) :?>
<?php
$messageTypes = $value['mesages_types'];
if ( $value['message_type'] == 'message') {
$sender_name = $value['sender_name'];
$addClass = "chat_people";
$chat_header_img = $value['chat_header_img'];
} else if ( $value['message_type'] == 'groupMessage' ){
$sender_name = $value['accept_name'];
$addClass = "session_no";
$chat_header_img = '/chat/images/rens.png';
} elseif ( $value['message_type'] == 'adminMessage' ) {
$sender_name = $value['accept_name'];
$addClass = "session_no";
$chat_header_img = '/chat/images/chat_admin.png';
}
switch ( $messageTypes ) {
case 'text':
$par = ['/%6b/', '/%5C/', '/\{\|/U', '/\|\}/U'];
$repStr = ['<br/>', '\\', '<img width="24px" class="cli_em" src="/chat/emoticons/images/', '.gif">'];
$content =preg_replace($par, $repStr,$value['message_content']);
break;
case 'image':
case 'images':
$content = '【图片】';
break;
case 'file':
$content = '【文件】';
break;
case 'voice':
$content = '【语音】';
break;
case 'notice':
$sender_name = $sender_name.'【申请对话】';
$content = $value['message_content'];
$chat_header_img = "/chat/images/chatNotice.png";
$addClass = 'chat_notice';
break;
case 'notice_respond':
$sender_name = $sender_name;
$content = '已同意可以会话了';
$chat_header_img = "/chat/images/chatNotice.png";
$addClass = 'chat_people';
break;
case 'sysNotice':
$content = $sender_name.$value['message_content'];
$sender_name = '系统通知';
$chat_header_img = "/chat/images/chatNotice.png";
$addClass = 'chat_customer_notice';
break;
default:
$content = '出错了';
break;
}
?>
<div class="mes_box mes_chakan_close <?php echo $addClass;?>" chat_mes_num= "<?php echo $value['mes_num'];?>" mes_id="<?php echo $value['sender_id'];?>" session_no='<?php echo $value['session_no'];?>' mesid="<?php echo $value['id'];?>" mestype="<?php echo $value['message_type'];?>" group-name="<?php echo $sender_name;?>" group-all = "<?php echo $value['accept_id'];?>" session_no='<?php echo $value['session_no'];?>'>
<div class="mes_header">
<img src="<?php echo $chat_header_img;?>" alt="">
</div>
<span class='mex_con'><?php echo $sender_name;?></span>
<div class="mes_content_list" style=''>
<span class="chat_mes_content">
<?php echo $content;?>
</span>
</div>
<span class="mes_num"><?php echo $value['mes_num'];?></span>
<span class='mes_close' mestype='<?php echo $value['message_type'];?>' mes_id='<?php echo $value['sender_id'];?>' session_no='<?php echo $value['session_no'];?>'>X</span>
</div>
<?php $mesNum += $value['mes_num'];?>
<?php endforeach;?>
<?php endif;?>
<!-- end -->
</div>
</div>
</div>
</div>
<!-- img放大 -->
<div id="gallery" class="pswp" tabindex="-1" role="dialog" aria-hidden="true">
<div class="pswp__bg"></div>
<div class="pswp__scroll-wrap">
<div class="pswp__container">
<div class="pswp__item"></div>
<div class="pswp__item"></div>
<div class="pswp__item"></div>
</div>
<div class="pswp__ui pswp__ui--hidden">
<div class="pswp__top-bar">
<div class="pswp__counter"></div>
<button class="pswp__button pswp__button--close" title="Close (Esc)"></button>
<button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>
<button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>
<div class="pswp__preloader">
<div class="pswp__preloader__icn">
<div class="pswp__preloader__cut">
<div class="pswp__preloader__donut"></div>
</div>
</div>
</div>
</div>
<div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
<div class="pswp__share-tooltip">
</div>
</div>
<button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)"></button>
<button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)"></button>
<div class="pswp__caption">
<div class="pswp__caption__center">
</div>
</div>
</div>
</div>
</div>
</div>
<div class="send-img-box">
<span class="send-img-close com-close">×</span>
<!-- <canvas id="canvas"></canvas> -->
</div>
<!-- 弹出框 -->
<div class="cd-popup" role="alert">
<div class="cd-popup-container">
<p class="mes_alert_con">请选择聊天对象</p>
<ul class="cd-buttons">
<li><a href="#" class="clo_alert alertvalue">确定</a></li>
<!-- <li><a href="#">否</a></li> -->
</ul>
<a href="#" class="cd-popup-close img-replace alertvalue">关闭</a>
</div> <!-- cd-popup-chat-container -->
</div> <!-- cd-popup -->
<!-- Resource jQuery -->
<div class="img-box">
<div class="img-box-title"><span>发送的图片</span><span style="color: #000;" class="com-close com-close-act">×</span></div>
<div class="sending-img-box"></div>
<div class="img-box-act"><span class="btn btn-success com-close-act">取消</span><span class="btn btn-info send-clipboard-img">发送</span></div>
</div>
<div class="file-main">
<ul>
<li>
<input id="token" name="token" class="ipt" value="">
</li>
<li>
<input id="key" name="key" class="ipt" value="">
</li>
<li>
<input id="file" name="file" class="ipt" type="file" />
</li>
<li>
<input id="filename" type="text" value="">
</li>
</ul>
</div>
<!-- 上传进度 -->
<div id="progressbar"><div class="progress-label"></div><div id="formatSpeed"></div></div>
<script type="text/javascript" src="js/webChataAudio.js"></script>
<script>
$('.loadImg').viewer();
/********************** 业务处理 *************************/
// 管理员联系群的点击
// var chatAdmin = function (obj) {
// $('.con-tab-content li').css('background', 'none');
// $(obj).css('background', '#BEB7C7');
// session_no = 'ca';
// mes_type = "adminMessage";
// $('.mes_title_con').html( $(obj).attr('group-name') );
// $('#mes_load').html(10);
// ws.send('{"type": "chatAdmin", "mes_type": "'+mes_type+'", "session_no": "ca"}');
// //消息向上滚动
// $('.he-ov-box').unbind('scroll');
// $('.he-ov-box').bind("scroll", function (){
// mesScroll();
// })
// }
//文件的分享
var chatShare = function ( obj ) {
window.event? window.event.cancelBubble = true : evt.stopPropagation();
$('.chat-shareing').removeClass('chat-shareing');
obj.className += ' chat-shareing';
$('#b_is').attr( 'val', 'share' );
$('#name_box').show();
}
//系统 通知消息
var chatSystemNotice = function () {
var json = '{"type":"sysNotice"}';
chatController(json);
}
var chatController = function ( json ){
ws.send(json);
}
/*************** pc输入框 ********************/
//文件发送
$('.pc_mes_tool_file').click( function () {
getQiniuToken();
trig($('#file'));
})
//图片发送
// $('.pc_mes_tool_img').click( function () {
// trig($('#file'));
// })
/**************** end *******************/
//pc 提交
$('#pc_mes_input, #mes_textarea').on('input', function () {
var val = $(this).html();
inputSave = val;
})
$('.chat_btn').click(function () {
var inputValue = $('.pc_mes_input').html();
$('#mes_textarea').html('');
$('#mes_textarea').html(inputValue);
$("#submit").trigger("click");
$('.pc_mes_input').html('');
$('.pc_mes_input').focus();
})
//最近联系人增加与更新
var addContact = {};
addContact.is = function (session_id) {
for (var i in nearestContact) {
if ( nearestContact[i] == session_id) {
return true;
};
}
return false;
}
//通知消息同意不同意
$(document).on('click', '.chat_notice_sel', function () {
var dataParm = $(this).attr('data-parm');
var senderId = $(this).attr('sender-id');
var noticeHtml = $(this).html();
$('.chat_notice_container').hide();
ws.send('{"type": "chat_notice_sel", "dataParm": "'+dataParm+'", "senderId": "'+senderId+'", "oms_id": "'+ChainOmsId+'"}');
})
//增加最近联系人
addContact.Dom = function () {
var data = {
"type": "addContact",
"mestype": mes_type,
"session_no" : session_no,
"sender_name": chat_name,
"accept_name": $('.mes_title_con').text(),
"mes_id": to_uid,
"to_uid_header_img": to_uid_header_img,
"timeStamp": new Date().getTime(),
};
if (mes_type == "message") {
$('.con-tab-content .list-group').prepend('<li class="recent-contact staff-info chat_people recent-hover" data-placement="right" group-name="'+data.accept_name+'" session_no="'+data.session_no+'" mes_id="'+data.mes_id+'" mestype ="'+data.mestype+'" ><span class="header-img"><img src="'+data.to_uid_header_img+'" alt=""></span><i>'+data.accept_name+'</i><span title = "删除聊天记录" mestype="'+data.mestype+'" session="'+data.session_no+'" class="recent-close">×</span></div></li>')
} else {
$('.con-tab-content .list-group').prepend('<li class="session_no staff-info recent-hover" data-placement="right" group-name="'+data.accept_name+'" session_no="'+data.session_no+'" mes_id="'+data.mes_id+'" mestype ="'+data.mestype+'" ><div><span class="header-img"><img src="/chat/images/rens.png" alt=""></span><i>'+data.accept_name+'</i><span title = "删除聊天记录" mestype="'+data.mestype+'" session="'+data.session_no+'" class="recent-close">×</span></div></li>')
}
nearestContact.push(session_no);
ws.send(JSON.stringify(data));
};
//最近联系人更新
addContact.upd = function ( to_uid ) {
if ( $('.recent-contact[session_no="'+session_no+'"]').index() != 1 ) {
$('.con-tab-content .list-group').prepend($('.recent-contact[session_no="'+session_no+'"]'));
ws.send('{"type": "updContact", "to_uid": "'+to_uid+'", "session_no": "'+session_no+'", "message_type": "'+mes_type+'"}');
};
}
/******************* 消息列表session集合 *********************/
var arrMessageList = new Array();
arrMessageList = <?php echo !empty($messageSessionList) ? json_encode($messageSessionList) : json_encode([]);?>;
//通知消息点击
//外来的oms_id
var ChainOmsId = '' ;
$(document).on('click', '.chat_notice', function () {
var session_id = $(this).attr('session_no');
var sender_id = $(this).attr('mes_id');
ChainOmsId = $(this).attr('oms_id');
$('.chat_notice_container').show();
// ws.send('{"type": "chat_notice", "sender_id": '+session_id+'}');
var con_mes_num = parseInt($(".mes_chakan_close[session_no='"+session_id+"']").attr('chat_mes_num'));
mes_notice_close('message', sender_id, con_mes_num);
nearestContact.push(session_id);
})
//群聊人显示
var gpManSh = function (groupid){
ws.send('{"type": "groupManShow", "session_id":"'+groupid+'"}');
}
//群聊名字点击
$('.group-man-show').click(function (e){
var obj = $(this);
var showMansessionNo = obj.attr('groupid');
if (!$(e.target).is('.groupSign')) {
gpManSh(showMansessionNo);
};
$('.group-man-show').removeClass('groupAct');
obj.addClass('groupAct');
obj.addClass('groupSign');
})
//上传图片点击
//触发文件点击
var trig = function (obj){
obj.trigger('click');
}
$('#upclick').click( function(){
trig($('#file'));
});
$('#cli-upFile img').click(function(){
trig($('#file'));
return;
});
// 选择图片的改变
$('#send-upimg').on('change', function(){
//检验是否为图像文件
var obj = $(this) ;
var file = $(this)[0].files[0];
$.each( $(this)[0].files, function (i, file){
if(!/image\/\w+/.test(file.type)){
alert("只能发送图片");
return false;
}
var reader = new FileReader();
//将文件以Data URL形式读入页面
reader.readAsDataURL(file);
reader.onload=function(e){
var img = new Image();
img.src = this.result;
img.className = "send-img";
$('.sending-img-box').html('');
$('.sending-img-box').append( img );
$('.send-clipboard-img').trigger('click');
$('.plus_menu_box').hide();
//显示文件
}
});
});
//粘贴发送的图片取消
$('.com-close-act').click(function(){
$('.img-box').hide();
})
//群聊删除人
$(document).on('click', '.delgroupman', function(){
var obj = $(this);
var groupid = obj.attr("groupid");
var id = obj.attr("id");
$('.alertvalue').attr('groupid', groupid);
$('.alertvalue').attr('atype', 'del');
$('.alertvalue').attr('id', id);
$(this).parent().addClass('mandel');
$('.mes_alert_con').html('你确定要删除他吗?');
$('.cd-popup').addClass('is-visible'); return false;
});
//退出群
$(document).on('click', '.esc-group', function (){
alert('还没有开放!');
return;
})
//群聊解散
$(document).on('click', '.dissolve-group', function (){
var groupId = $(this).attr('groupId');
ws.send('{"type": "dissolve_group", "groupId": "'+groupId+'"}');
$(this).parents('.panel').remove();
})
$('.alertvalue').on('click', function (){
var obj = $(this);
if (obj.attr('atype') == "del") {
$('.mandel').remove();
var groupid = obj.attr("groupid");
var id = obj.attr("id");
ws.send('{"type":"delgroupman", "groupid": "'+groupid+'", "id":"'+id+'"}');
};
})
//删除最近联系人
var delContactFun = function( id, mestype, session_id){
nearestContact.remove(session_no);
$('.recent-action').parent('li').remove()
ws.send('{"type": "delContact", "session_no":"'+session_id+'", "mestype":"'+mestype+'", "id": "'+id+'"}');
}
// 选择人聊天
$(document).on('click', '.chat_people', function( e ){
$('.pc_he-ov-box').removeClass('chat_initial');
to_uid = $(this).attr('mes_id');
to_uid_header_img = $(this).find('img').attr('src');
//会话id的改变
session_no = parseInt( to_uid ) < parseInt( chat_uid ) ? to_uid+"-"+chat_uid : chat_uid+"-"+to_uid;
mes_type = "message";
if ($(window).width() < 700) {
$('.chat-container').show();
$('.details-list').hide();
};
// 最近联系人的背景改变
$('.con-tab-content li').css('background', 'none');
$('.con-tab-content li[mes_id='+to_uid+']').css('background', '#BEB7C7');
//end
// groupId = $(this).attr('groupId');
// if (!$(e.target).is('.mes_chakan_close')) {
$('.mes_title_con').html( $(this).attr('group-name') );
if ($.inArray(session_no, arrMessageList) != -1) {
var con_mes_num = parseInt($(".mes_chakan_close[session_no='"+session_no+"']").attr('chat_mes_num'));
mes_chakan_close('message', to_uid, con_mes_num);
};
// };
ws.send('{"type":"mes_chat", "to_uid":"'+to_uid+'"}');
$('#mes_load').html(10);
//消息向上滚动
$('.he-ov-box').unbind('scroll');
$('.he-ov-box').bind("scroll", function (){
mesScroll();
})
})
//选择群列表显示对话内容
$(document).on('click', '.session_no', function ( event ){
var groupJson = '';
$('.pc_he-ov-box').removeClass('chat_initial');
session_no = $(this).attr('session_no')//会话id
mes_type = $(this).attr('mestype')//会话id
// if (session_no == $(this).attr('session_no')) { return ; };
//在手机上交替显示
if ($(window).width() < 700) {
$('.chat-container').show();
$('.details-list').hide();
};
//end
var valName = $(this).attr('group-name');//会话名字
// groupId = $(this).attr('groupId');
//消息向上滚动
$('.he-ov-box').unbind('scroll');
$('.he-ov-box').bind("scroll", function (){
mesScroll();
})
//背景颜色的改变
$('.con-tab-content li').css('background', 'none');
$('.con-tab-content li[session_no='+session_no+']').css('background', '#BEB7C7');
$('.mes_title_con').html(valName);
if ( mes_type == 'groupMessage' ) {
$('.mes_title_con').append('<i title="群聊添加人" class="add-groupMan"></i>');
$('.add-groupMan').show();
groupJson = '{"type":"mes_groupChat", "session_no":"'+session_no+'" }';
} else if ( mes_type == 'adminMessage' ) {
groupJson = '{"type":"chatAdmin", "session_no":"ca" }';
};
// if (!$(event.target).is('.mes_chakan_close')) {
if ($(".mes_chakan_close[session_no='"+session_no+"']").length > 0) {
var con_mes_num = parseInt($(".mes_chakan_close[session_no='"+session_no+"']").find('.mes_num').html());
mes_chakan_close(mes_type, session_no, con_mes_num);
};
// };
ws.send(groupJson);
$('#mes_load').html(10);
})
//删除最近联系人
$(document).on('click', '.recent-action',function (e){
e.stopPropagation();
var delconid = ($(this).attr('delconid'));
var session_id = ($(this).attr('session_no'));
delContactFun( delconid, mes_type, session_id );
})
//enter 提交
$(".mes_footer, .pc_mes_input").keydown(function(e){
var e = e || event,
keycode = e.which || e.keyCode;
if(e.shiftKey && (e.keyCode==13)){
} else if (keycode==13) {
e.preventDefault();
var inputValue = $('.pc_mes_input').html();
$('#mes_textarea').html(inputValue);
$('.pc_mes_input').html('');
$("#submit").trigger("click");
}
});
//消息提交
var mesParam = {
mes_obj: function (){
if (to_uid == 0 && session_no == 0) {
$('.mes_alert_con').html('请选择聊天对象!')
$('.cd-popup').addClass('is-visible'); return false;
} else { return true; }
},
mes_empty: function (){
if ($('#mes_textarea').html() =='') {
$('.mes_alert_con').html('消息不能为空!')
$('.cd-popup').addClass('is-visible'); return false;
} else { return true; }
},
};
/*********** 文件发送 ******************/
//发送文件
//请求 token
function xmlhttp() {
var $xmlhttp;
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
$xmlhttp = new XMLHttpRequest();
} else {
// code for IE6, IE5
$xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
return $xmlhttp;
}
window.onload = function() {
};
// 请求token
var getQiniuToken = function () {
$xmlhttp = xmlhttp();
$xmlhttp.onreadystatechange = function() {
if ($xmlhttp.readyState == 4) {
if($xmlhttp.status == 200){
document.getElementById('token').value = $xmlhttp.responseText;
} else {
alert('get uptoken other than 200 code was returned')
}
}
}
$upTokenUrl = '/chat/uptoken.php';
$xmlhttp.open('GET', $upTokenUrl, true);
$xmlhttp.send();