E10鸿蒙App

入口: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接口请求:

复制代码
接口在ImHttpFunctions中添加如:
  getSessionGroup(callBack:imHttpCallBack){
    let getHttpPo: ImHttpPO = new ImHttpPO()
    getHttpPo.url = ImHttpAPIConstants.getSessionGroup
    getHttpPo.method = 'get'
    interface params {
      'version':string
    }
    let par: params = {
      'version': '1'
    }
    getHttpPo.params = par
    ImHttpManager.getInstance().imSdkHttpGet(getHttpPo, {
      onSuccess(data: string) {
        let dataObj: ImHttpResponsePO = JSON.parse(data) as ImHttpResponsePO
        if(dataObj.data){
          callBack.onSuccess(dataObj.data)
        }
      },
      onError(error: string) {
        callBack.onError(error)
      }
    })
  }

sdk请求

sdk相关码ImOpcode

通知code:IMSdkNotice sdk操作码:IMSdkOpcode

复制代码
//只需回调成功、失败
ImSdkFunctions.getInstance().setSessionRemind(sessionVo, optType,{
          onSuccess(jsonKey,JsonValue){

          }
        })

//ImSdkFunctions下
  setSessionRemind(sessionVo:SessionListVO,optType:string,callBack: ImOnResponse){
    let pStr = JSON.stringify({
      'group_id': 'xxx',
      'flag': 'xxx'
    })
    getDataAndSetCallback(IMSdkOpcode.kOPSetGroupAdmin, pStr, callBack)
  }


//2.需要回调数据
ImSdkFunctions.getInstance().getGroupInfo(this.groupId, {
        onSuccess(jsonKey: string, jsonStr: string) {
          let data: GroupListData = JSON.parse(jsonStr);
          if (data != null && data.datas != null && data.datas.length > 0) {
            let itemData: GroupItemData = data.datas[0];
            if (itemData != null && itemData.groupinfo != null) {
                //...
            }
          }

        }
      })

//ImSdkFunctions下
  getGroupInfo(groupId:string,callBack: ImOnResponse): boolean{
    let pStr = JSON.stringify({
      'group_ids': [groupId],
      'api_get_type':"1",
    })
    return getDataAndSetCallback(IMSdkOpcode.kOPGetGroupInfo, pStr, callBack)
  }

请求人员

复制代码
PersonManager.getPerson(checkUtil.checkStr(messageVO.suid), checkUtil.checkStr(messageVO.scid), person => {
          try {
            if (person) {
//            messageParser.parseAvatarInfo(messageVO, person)
            }
            resolve(messageVO)
          } catch (e) {
            reject(e)
          }
        })

消息开关:MsgInfoSettingUtils

界面路由

复制代码
//ImPageOpenUtils
  openGroupManagePage(session: SessionListVO | undefined) {
    router.pushNamedRoute({
      name: 'groupManageNewPage',
      params: {
        session: session ?? new SessionListVO()
      }
    })
  }

@Entry({ routeName: 'groupManageNewPage' })
@Component
export struct GroupManageNewPage {

}

//main_pages下
{
  "src": [
    //...
    "session/pages/GroupManageNewPage"
  ]
}

//imStaticLibrary/index下
export { GroupManageNewPage } from "./src/main/ets/session/pages/GroupManageNewPage"

多语言:

复制代码
1、本地code多语言
LanguageUtils.getData(LanguageUtils.LABEL_TOPIC_SETTING, "话题设置");

2、网络code多语言
let moduleLabel: object  = ImCacheFunctions.getInstance().moudleLabelPO_ALl.label as object let str = moduleLabel[txt.id18n] ? moduleLabel[txt.id18n] : ''
相关推荐
肥羊zzz几秒前
Vue2 vs Vue3 中 v-for 的 key 用法对比
前端·vue.js
dsyyyyy110141 分钟前
HTML总结
前端·html
橘颂TA1 小时前
【Linux】自旋锁
linux·开发语言·数据库·c++
一诺加油鸭1 小时前
若依后端系统集成 Swagger 接口文档功能
java·开发语言
ECT-OS-JiuHuaShan1 小时前
功夫不负匠心人,渡劫代谢舞沧桑
android·开发语言·人工智能·算法·机器学习·kotlin·拓扑学
knight_9___1 小时前
LLM工具调用面试篇1
开发语言·人工智能·python·面试·agent
一脸dio样7541 小时前
第5章 保护模式进阶,向内核迈进
linux·开发语言
云烟成雨TD1 小时前
Spring AI Alibaba 1.x 系列【40】多智能体核心模式 - 智能体作为工具(Agent as Tool)
java·人工智能·spring
前端那点事1 小时前
深度解析:Vue中computed的实现原理(易懂不晦涩)
前端·vue.js
小叮当⇔1 小时前
M4A 转 MP3 桌面转换器(PyQt5 + FFmpeg)
开发语言·qt·ffmpeg