E10鸿蒙App

打印 上一主题 下一主题

主题 1023|帖子 1023|积分 3069

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

x
入口:EntryAbility -> onWindowStageCreate  windowStage.loadContent
jsApi:JSNameConstants
App主页面:MainPage
消息主页面:MessageCenterPage
会话列表:SessionListView+IMHeaderView+AppImageKnifeComponent
会话详情:SessionPage
消息列表Item:SessionMessageListView->MessageListItemView
消息组件:
MsgReplyView
MsgRefView
TextMessageView
ImageMessageView
LocationMessageView
FileMessageView
EntityMessageView
GroupShareMessageView
UserCardMessageView
LinkMessageView
UserCardMessageView
NoticeMessageView
ExpressionMessageView
InnerMsgView
GroupSolitaireMessageView
MessageRecordView
AddOneMessageView
RevokeMessageView
ImageAndTxtView
MsgRichTxtView
VideoMessageView
VoiceMessageView
NotSupportMessageView
表情回复:MsgEmojiReplyView
消息长按操作菜单:menuContentBuilder
消息长按菜单点击:menuItemClick

群设置:GroupChatInfoPage
群成员:GroupMemberListPage
群管理:GroupManageNewPage

http接口请求:
  1. 接口在ImHttpFunctions中添加如:
  2.   getSessionGroup(callBack:imHttpCallBack){
  3.     let getHttpPo: ImHttpPO = new ImHttpPO()
  4.     getHttpPo.url = ImHttpAPIConstants.getSessionGroup
  5.     getHttpPo.method = 'get'
  6.     interface params {
  7.       'version':string
  8.     }
  9.     let par: params = {
  10.       'version': '1'
  11.     }
  12.     getHttpPo.params = par
  13.     ImHttpManager.getInstance().imSdkHttpGet(getHttpPo, {
  14.       onSuccess(data: string) {
  15.         let dataObj: ImHttpResponsePO = JSON.parse(data) as ImHttpResponsePO
  16.         if(dataObj.data){
  17.           callBack.onSuccess(dataObj.data)
  18.         }
  19.       },
  20.       onError(error: string) {
  21.         callBack.onError(error)
  22.       }
  23.     })
  24.   }
复制代码
sdk请求
sdk相关码ImOpcode
通知code:IMSdkNotice   sdk操作码:IMSdkOpcode
  1. //只需回调成功、失败
  2. ImSdkFunctions.getInstance().setSessionRemind(sessionVo, optType,{
  3.           onSuccess(jsonKey,JsonValue){
  4.           }
  5.         })
  6. //ImSdkFunctions下
  7.   setSessionRemind(sessionVo:SessionListVO,optType:string,callBack: ImOnResponse){
  8.     let pStr = JSON.stringify({
  9.       'group_id': 'xxx',
  10.       'flag': 'xxx'
  11.     })
  12.     getDataAndSetCallback(IMSdkOpcode.kOPSetGroupAdmin, pStr, callBack)
  13.   }
  14. //2.需要回调数据
  15. ImSdkFunctions.getInstance().getGroupInfo(this.groupId, {
  16.         onSuccess(jsonKey: string, jsonStr: string) {
  17.           let data: GroupListData = JSON.parse(jsonStr);
  18.           if (data != null && data.datas != null && data.datas.length > 0) {
  19.             let itemData: GroupItemData = data.datas[0];
  20.             if (itemData != null && itemData.groupinfo != null) {
  21.                 //...
  22.             }
  23.           }
  24.         }
  25.       })
  26. //ImSdkFunctions下
  27.   getGroupInfo(groupId:string,callBack: ImOnResponse): boolean{
  28.     let pStr = JSON.stringify({
  29.       'group_ids': [groupId],
  30.       'api_get_type':"1",
  31.     })
  32.     return getDataAndSetCallback(IMSdkOpcode.kOPGetGroupInfo, pStr, callBack)
  33.   }
复制代码
请求人员
  1. PersonManager.getPerson(checkUtil.checkStr(messageVO.suid), checkUtil.checkStr(messageVO.scid), person => {
  2.           try {
  3.             if (person) {
  4. //            messageParser.parseAvatarInfo(messageVO, person)
  5.             }
  6.             resolve(messageVO)
  7.           } catch (e) {
  8.             reject(e)
  9.           }
  10.         })
复制代码
消息开关:MsgInfoSettingUtils

界面路由
  1. //ImPageOpenUtils
  2.   openGroupManagePage(session: SessionListVO | undefined) {
  3.     router.pushNamedRoute({
  4.       name: 'groupManageNewPage',
  5.       params: {
  6.         session: session ?? new SessionListVO()
  7.       }
  8.     })
  9.   }
  10. @Entry({ routeName: 'groupManageNewPage' })
  11. @Component
  12. export struct GroupManageNewPage {
  13. }
  14. //main_pages下
  15. {
  16.   "src": [
  17.     //...
  18.     "session/pages/GroupManageNewPage"
  19.   ]
  20. }
  21. //imStaticLibrary/index下
  22. export { GroupManageNewPage } from "./src/main/ets/session/pages/GroupManageNewPage"
复制代码
多语言:
  1. 1、本地code多语言
  2. LanguageUtils.getData(LanguageUtils.LABEL_TOPIC_SETTING, "话题设置");
  3. 2、网络code多语言
  4. let moduleLabel: object  = ImCacheFunctions.getInstance().moudleLabelPO_ALl.label as object let str = moduleLabel[txt.id18n] ? moduleLabel[txt.id18n] : ''
复制代码


免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

科技颠覆者

论坛元老
这个人很懒什么都没写!
快速回复 返回顶部 返回列表