帖子
帖子
用户
博客
课程
显示全部楼层
1682
帖子
10
勋章
Y币

easeChat模块(环信-即时通讯)demo示例

  [复制链接]
发表于 2017-8-1 14:53:38
easeChat 模块封装了环信即时通讯云的开放SDK,封装的接口都是纯功能类接口,
主要分三大类:
1,注册、登录、退出、监听
2,创建群组、添加/删除好友、获取好友列表
3,消息、会话、聊天 功能详情参考模块接口。


完整模块源码和资源文件:https://**.**/apicloudcom/APICloud-Module-Examples/tree/master/easeChat-Example

描述:本DEMO演示了环信easeChat模块各命令函数的使用方法,并提供了命令调用界面供开发者参考测试。

注意: 1.在使用本模块前,需在调用的APP控制台添加对应的easeChat模块; 2.开发者在使用本Demo前,需自行在环信官网注册获取对应的appKey,并复制写入原config.xml文件中的对应位置,否则DEMO将无法正确运行;

index.html

  1. <!doctype html>
  2. <html>
  3.         <head>
  4.                 <meta charset="utf-8">
  5.                 <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
  6.                 <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
  7.                 <title>Hello APP</title>
  8.                 <link rel="stylesheet" type="text/css" href="./css/api.css" />
  9.                 <style type="text/css">
  10.                         html, body {
  11.                                 height: 100%;
  12.                         }
  13.                         #wrap {
  14.                                 height: 100%;
  15.                                 display: -webkit-box;
  16.                                 display: -webkit-flex;
  17.                                 display: flex;
  18.                                 -webkit-box-orient: vertical;
  19.                                 -webkit-flex-flow: column;
  20.                                 flex-flow: column;
  21.                         }
  22.                         #header {
  23.                                 text-align: center;
  24.                                 background-color: #81a9c3;
  25.                                 color: #fff;
  26.                                 width: 100%;
  27.                         }
  28.                         #header h1 {
  29.                                 font-size: 20px;
  30.                                 height: 44px;
  31.                                 line-height: 44px;
  32.                                 margin: 0em;
  33.                                 color: #fff;
  34.                         }
  35.                         #main {
  36.                                 -webkit-box-flex: 1;
  37.                                 -webkit-flex: 1;
  38.                                 flex: 1;
  39.                         }
  40.                         #footer {
  41.                                 height: 30px;
  42.                                 line-height: 30px;
  43.                                 background-color: #81a9c3;
  44.                                 width: 100%;
  45.                                 text-align: center;
  46.                         }
  47.                         #footer h5 {
  48.                                 color: white;
  49.                         }
  50.                         .con {
  51.                                 font-size: 28px;
  52.                                 text-align: center;
  53.                         }
  54.                 </style>
  55.         </head>
  56.         <body>
  57.                 <div id="wrap">
  58.                         <div id="header">
  59.                                 <h1>APICloud easeChat DEMO</h1>
  60.                         </div>
  61.                         <div id="main"></div>
  62.                         <div id="footer">
  63.                                 <h5>Copyright ©<span id="year"></span></h5>
  64.                         </div>
  65.                 </div>
  66.         </body>
  67.         <script type="text/javascript" src="./script/api.js"></script>
  68.         <script type="text/javascript">
  69.                 apiready = function() {
  70.                         console.log("Hello APICloud");
  71.                         //                api.setScreenOrientation({
  72.                         //                orientation:'landscape_left'
  73.                         //      });
  74.                         var header = $api.byId('header');
  75.                         //适配iOS 7+,Android 4.4+状态栏
  76.                         $api.fixStatusBar(header);
  77.                         var headerPos = $api.offset(header);
  78.                         var main = $api.byId('main');
  79.                         var mainPos = $api.offset(main);
  80.                         api.openFrame({
  81.                                 name : 'main',
  82.                                 url : 'html/easeChat.html',
  83.                                 bounces : false,
  84.                                 rect : {
  85.                                         x : 0,
  86.                                         y : headerPos.h,
  87.                                         w : 'auto',
  88.                                         h : mainPos.h
  89.                                 }
  90.                         });
  91.                 };
  92.         </script>
  93. </html>
复制代码



5
帖子
0
勋章
417
Y币
回帖拿金币,支持支持

回帖拿金币,支持支持
99
帖子
1
勋章
314
Y币
帖拿金币,支持支持
75
帖子
0
勋章
822
Y币
帖拿金币,支持支持
75
帖子
0
勋章
822
Y币
支持一下,拿云币
136
帖子
1
勋章
853
Y币
捡个云币
258
帖子
4
勋章
1024
Y币

回帖拿金币,支持支持
5
帖子
0
勋章
199
Y币
感谢分享,学习了!!!
86
帖子
0
勋章
533
Y币
我就是来拿云币的
12345678910... 19下一页
您需要登录后才可以回帖 登录

本版积分规则