no message

im/api
jscyl 1 month ago
parent 6036fea0e7
commit e72717afe1

@ -1,11 +1,8 @@
<script lang="ts">
// import RootStore from "@xkit-yx/im-store-v2";
// import V2NIM, { V2NIMConst } from "nim-web-sdk-ng/dist/v2/NIM_UNIAPP_SDK";
// import { getMsgContentTipByType, setTabUnread } from "./pages/NEUIKit/utils/msg";
// import { STORAGE_KEY } from "./pages/NEUIKit/utils/constants";
// import { isWxApp } from "./pages/NEUIKit/utils";
// import { V2NIMMessage, V2NIMMessagePushConfig, V2NIMConversation } from "nim-web-sdk-ng/dist/v2/NIM_UNIAPP_SDK/V2NIMMessageService";
import { V2NIMMessage, V2NIMMessagePushConfig, V2NIMConversation } from "nim-web-sdk-ng/dist/v2/NIM_UNIAPP_SDK/V2NIMMessageService";
import { unix } from "dayjs";
import { V2NIMConst, NIM } from "./utils/nim";
let isWxApp = uni.getAppBaseInfo().uniPlatform == "mp-weixin";
export default {
globalData: {
@ -176,7 +173,7 @@ export default {
}
} else if (uni.getStorageSync("apply-token") ) {
// console.log("IM SDK...");
// that.initWyyx();
that.initWyyx();
}
}, 1000);
},
@ -217,11 +214,11 @@ export default {
});
} else {
// console.log("IM");
// that.initWyyx();
that.initWyyx();
}
} else {
console.log("SDK未初始化重新初始化IM");
// that.initWyyx();
that.initWyyx();
}
};
@ -251,7 +248,7 @@ export default {
userId: uni.getStorageSync("apply-uid"),
},
(res) => {
console.log("wyyx_getConfig", res);
// console.log("wyyx_getConfig", res);
//
if (!res || !res.appKey || !res.accid || !res.token) {
@ -265,7 +262,7 @@ export default {
token: res.token,
};
// IM
// IM
uni.setStorageSync("im-appkey", resData.appkey);
uni.setStorageSync("im-accid", resData.accid);
uni.setStorageSync("im-token", resData.token);
@ -276,190 +273,200 @@ export default {
token: resData.token,
};
// this.initNim(imOptions);
}
this.initNim(imOptions);
},
);
},
async initNim(opts) {
let that = this;
// nim sdk
const nim = (uni.$UIKitNIM = V2NIM.getInstance(
{
appkey: opts.appkey,
needReconnect: true,
reconnectionAttempts: 10, //
reconnectionDelay: 3000, // 3
heartbeatInterval: 20000, // 20
debugLevel: "warn", // 便
const account = opts.account;
const token = opts.token;
const appkey = opts.appkey;
const params1 = {
appkey: appkey,
debugLevel: "warning",
apiVersion: "v2",
readReceiptEnabled: true,
enableV2CloudConversation: true,
},
{
};
console.log("ems NIM", NIM);
const nim = NIM.getInstance(params1, {
V2NIMLoginServiceConfig: {
lbsUrls: isWxApp ? ["https://lbs.netease.im/lbs/wxwebconf.jsp"] : ["https://lbs.netease.im/lbs/webconf.jsp"],
linkUrl: isWxApp ? "wlnimsc0.netease.im" : "weblink.netease.im",
isFixedDeviceId: true, // 使ID
autoLogin: true, //
isFixedDeviceId: true,
autoLogin: true,
},
}
));
});
this.offWatchIM(nim);
this.watchIMLoginStatus(nim);
this.watchIMFriendChange(nim);
this.watchIMMessageChange(nim);
try {
await nim.V2NIMLoginService.login(account, token, {
forceMode: false,
timeout: 60000,
retryCount: 3,
authType: 0,
});
that.globalData.nim = nim;
// store
const store = (uni.$UIKitStore = new RootStore(
nim,
{
addFriendNeedVerify: false,
p2pMsgReceiptVisible: true,
teamMsgReceiptVisible: true,
teamAgreeMode: V2NIMConst.V2NIMTeamAgreeMode.V2NIM_TEAM_AGREE_MODE_NO_AUTH,
sendMsgBefore: async (options: { msg: V2NIMMessage; conversationId: string; serverExtension?: Record<string, unknown> }) => {
const pushContent = getMsgContentTipByType({
text: options.msg.text,
messageType: options.msg.messageType,
});
const yxAitMsg = options.serverExtension ? options.serverExtension.yxAitMsg : { forcePushIDsList: "[]", needForcePush: false };
const { forcePushIDsList, needForcePush } = yxAitMsg
? // @ts-ignore
store.msgStore._formatExtAitToPushInfo(yxAitMsg, options.msg.text)
: { forcePushIDsList: "[]", needForcePush: false };
console.log("forcePushIDsList: ", forcePushIDsList);
const { conversationId } = options;
const conversationType = nim.V2NIMConversationIdUtil.parseConversationType(conversationId);
const targetId = nim.V2NIMConversationIdUtil.parseConversationTargetId(conversationId);
const pushPayload = JSON.stringify({
oppoField: {
click_action_type: 4,
click_action_activity: "",
action_parameters: {
sessionId: targetId,
sessionType: conversationType,
},
},
vivoField: {
pushMode: 0,
},
hwField: {
click_action: {
type: 1,
action: "",
},
androidConfig: {
category: "IM",
data: JSON.stringify({
sessionId: targetId,
sessionType: conversationType,
}),
},
},
sessionId: targetId,
sessionType: conversationType,
});
const pushConfig: V2NIMMessagePushConfig = {
pushEnabled: true,
pushNickEnabled: true,
forcePush: needForcePush,
forcePushContent: pushContent,
forcePushAccountIds: forcePushIDsList,
pushPayload: "{}",
pushContent,
};
return { ...options, pushConfig };
},
},
"UniApp"
));
//
nim.V2NIMLoginService.on("onConnectStatusChanged", (status) => {
console.log("IM连接状态变化:", status);
// 1
if (status === 1) {
console.log("检测到连接断开,触发重连");
that.reconnectIM();
that.G.nim = nim;
} catch (err) {
console.error("error", err);
}
});
// #ifdef APP-PLUS
const nimPushPlugin = uni.requireNativePlugin("NIMUniPlugin-PluginModule");
nim.V2NIMSettingService.setOfflinePushConfig(nimPushPlugin, {
miPush: {
appId: "2882303761520397320",
appKey: "5102039734320",
certificateName: "xiaomiCertificateName",
},
vivoPush: {
certificateName: "vivoCertificateName",
},
oppoPush: {
appId: "32967155",
appKey: "b98618cb272944dea324af6421d42a79",
secret: "0b7ce705a2304a17b78f20011c18890c",
certificateName: "opopCertificateName",
},
honorPush: {
certificateName: "rongyaoCertificateName",
},
apns: {
certificateName: "AuthKey_98P8URRXUD",
},
/**
* IM信息更新监听回调
*/
watchIMMessageChange(nim) {
let that = this;
//
nim.V2NIMMessageService.on("onReceiveMessages", function (messages) {
console.log("收到 V2NIMMessageService 模块的 onReceiveMessages 事件", messages);
let message = messages[0];
uni.$emit("updateMessageList", { ...message, messageFrom: "yunxin" });
});
console.log("推送配置已设置");
// #endif
// IM
nim.V2NIMLoginService.login(opts.account, opts.token)
.then(() => {
// console.log("IM");
//
if (that.globalData.reconnectTimer) {
clearInterval(that.globalData.reconnectTimer);
that.globalData.reconnectTimer = null;
}
})
.catch((error) => {
// console.error("IM", error);
//
that.reconnectIM();
//
nim.V2NIMMessageService.on("onSendMessage", function (messages) {
console.log("收到 V2NIMMessageService 模块的 onSendMessage 事件", messages);
});
//
//
nim.V2NIMMessageService.on("onReceiveP2PMessageReadReceipts", function (readReceipts) {
console.log("收到 V2NIMMessageService 模块的 onReceiveP2PMessageReadReceipts 事件", readReceipts);
uni.$emit("updateMessageReadInfo", readReceipts[0]);
});
//
nim.V2NIMMessageService.on("onMessageRevokeNotifications", function (messages) {
console.log("收到 V2NIMMessageService 模块的 onMessageRevokeNotifications 事件", messages);
});
//
nim.V2NIMMessageService.on("onReceiveMessagesModified", function (messages) {
console.log("收到 V2NIMMessageService 模块的 onReceiveMessagesModified 事件", messages);
uni.$emit("updateMessage", messages);
});
//
nim.V2NIMConversationService.on("onConversationChanged", function (conversationList: V2NIMConversation[]) {
// console.log(":", conversationList);
console.log("初始化监听会话:", conversationList);
uni.$emit("updateConversationList");
let unreadConversations = conversationList.filter((item) => {
return Number(item.unreadCount) > 0;
});
// console.log(":", unreadConversations.length);
console.log("未读会话数量:", unreadConversations);
if (unreadConversations.length > 0) {
that.playAudio();
}
});
setTabUnread();
//
nim.V2NIMConversationService.on("onTotalUnreadCountChanged", function (messages) {
console.log("收到 V2NIMMessageService 模块的 onTotalUnreadCountChanged 事件", messages);
uni.$emit("newMessage", { count: messages, type: "message" });
uni.setStorageSync("chat_info", { count: messages, type: "message" });
});
//
nim.V2NIMConversationService.on("onConversationDeleted", function (conversationIds) {
uni.$emit("deleteConversationList", conversationIds);
console.log("conversationIds", conversationIds);
});
},
offWatchIM(nim) {
//
nim.V2NIMMessageService.off("onReceiveMessages");
nim.V2NIMMessageService.off("onMessageRevokeNotifications");
nim.V2NIMMessageService.off("onReceiveMessagesModified");
nim.V2NIMConversationService.off("onConversationChanged");
nim.V2NIMConversationService.off("onConversationDeleted");
nim.V2NIMConversationService.off("onReceiveP2PMessageReadReceipts");
//
nim.V2NIMFriendService.off("onFriendAdded");
nim.V2NIMFriendService.off("onFriendDeleted");
nim.V2NIMFriendService.off("onFriendAddApplication");
nim.V2NIMFriendService.off("onFriendAddRejected");
nim.V2NIMFriendService.off("onFriendInfoChanged");
},
/**
* IM好友信息更新监听回调
*/
watchIMFriendChange(nim) {
//
nim.V2NIMFriendService.on("onFriendAdded", function (friend) {
console.log("watchIMFriend", friend);
});
//
nim.V2NIMFriendService.on("onFriendDeleted", function (accountId, deletionType) {
console.log("watchIMFriend", accountId);
console.log("watchIMFriend", deletionType);
});
//
nim.V2NIMFriendService.on("onFriendAddApplication", function (application) {
console.log("watchIMFriend", application);
});
//
nim.V2NIMFriendService.on("onFriendAddRejected", function (rejection) {
console.log("watchIMFriend", rejection);
});
//
nim.V2NIMFriendService.on("onFriendInfoChanged", function (friend) {
console.log("watchIMFriend", friend);
});
},
/**
* IM登录状态监听回调
*/
watchIMLoginStatus(nim) {
/**
* 登录瞬时状态监听
*/
//
nim.V2NIMLoginService.on("onLoginStatus", function (arg1) {
console.log("收到 V2NIMLoginService 模块的 onLoginStatus 事件", arg1);
});
//
nim.V2NIMLoginService.on("onLoginFailed", function (arg1) {
console.log("收到 V2NIMLoginService 模块的 onLoginFailed 事件", arg1);
});
// 线
nim.V2NIMLoginService.on("onKickedOffline", function (arg1) {
console.log("收到 V2NIMLoginService 模块的 onKickedOffline 事件", arg1);
});
//
nim.V2NIMLoginService.on("onLoginClientChanged", function (arg1) {
console.log("收到 V2NIMLoginService 模块的 onLoginClientChanged 事件", arg1);
});
/**
* 登录持续性状态监听
*/
//
nim.V2NIMLoginService.on("onConnectStatus", function (arg1) {
console.log("收到 V2NIMLoginService 模块的 onConnectStatus 事件", arg1);
});
//
nim.V2NIMLoginService.on("onDisconnected", function (arg1) {
console.log("收到 V2NIMLoginService 模块的 onDisconnected 事件", arg1);
});
//
nim.V2NIMLoginService.on("onConnectFailed", function (arg1) {
console.log("收到 V2NIMLoginService 模块的 onConnectFailed 事件", arg1);
});
//
nim.V2NIMLoginService.on("onDataSync", function (arg1) {
console.log("收到 V2NIMLoginService 模块的 onDataSync 事件", arg1);
});
},
playAudio() {
let that = this;
const innerAudioContext = uni.createInnerAudioContext();
innerAudioContext.autoplay = true;
innerAudioContext.src = "https://bocai-cms.oss-cn-beijing.aliyuncs.com/web-resource/ibocai/tip.mp3";
innerAudioContext.onPlay(() => {
console.log("开始播放提示音");
// console.log("");
});
uni.vibrateShort();
innerAudioContext.onError((res) => {
console.log("提示音播放错误:", res.errMsg, res.errCode);
// console.log(":", res.errMsg, res.errCode);
});
},
checkNum() {
let that = this;
if (uni.getStorageSync("apply-token")) {

@ -0,0 +1,347 @@
<template>
<view class="g_pb_24">
<div v-for="(item, index) in machineList" :key="index" class="customitem g_bg_f">
<Tooltip ref="tooltipRef" color="white" :isSelf="true" :top="150">
<div class="g_flex_row_start" hover-class="thover" style="padding: 12px 16px" @click="goChatPage(item)" :style="{ backgroundColor: item.stickTop ? '#f5f5f5' : '#fff' }">
<div
class="g_flex_none"
style="border-radius: 50%; width: 48px; height: 48px; background-size: cover; background-repeat: no-repeat; position: relative"
:style="{
'background-image': item.userinfo && item.userinfo[0].avatar ? 'url(' + item.userinfo[0].avatar + ')' : 'none',
}"
>
<div v-if="item.waitcount" style="position: absolute; right: -6px; top: -6px; background-color: #f5222d; width: 20px; height: 20px; border-radius: 50%; text-align: center; line-height: 20px; font-size: 12px; color: #fff">
{{ item.waitcount > 99 ? "99+" : item.waitcount }}
</div>
</div>
<div class="bottom-line g_flex_column_center g_flex_1" style="padding-left: 10px">
<div class="g_fs_17 g_flex_row_between" v-if="item.userinfo && item.userinfo[0].name">
<div class="g_ell_1 g_flex_1" style="color: #333">
{{ item.userinfo[0].name }} <span v-if="item.subtitle" style="color: orange">@{{ item.subtitle }}</span>
</div>
<div class="g_flex_none g_fs_12 g_ml_10" style="color: #999">
{{ item.time }}
</div>
</div>
<!-- 普通文本 -->
<div class="g_fs_14 g_ell_1" style="color: #999; font-size: 12px" v-if="item.lastMessage && item.lastMessage.messageType == 0">
{{ item.lastMessage.text }}
</div>
<!-- tip通知 -->
<div class="g_fs_14 g_ell_1" style="color: #999; font-size: 12px" v-if="item.lastMessage && item.lastMessage.messageType == 10">
{{ item.lastMessage.text }}
</div>
<!-- 图片消息 -->
<div class="g_fs_14 g_ell_1" style="color: #999; font-size: 12px" v-if="item.lastMessage && item.lastMessage.messageType == 1 && item.lastMessage.attachment && item.lastMessage.attachment.raw">[]</div>
<!-- 图片消息 -->
<div class="g_fs_14 g_ell_1" style="color: #999; font-size: 12px" v-if="item.lastMessage && item.lastMessage.messageType == 3 && item.lastMessage.attachment && item.lastMessage.attachment.raw">[]</div>
<!-- 自定义消息 -->
<div class="g_fs_14 g_ell_1" style="color: #999; font-size: 12px" v-if="item.lastMessage && item.lastMessage.messageType == 100 && item.lastMessage.attachment && item.lastMessage.attachment.raw">
<!-- 100001 商家后台 职位卡片 -->
<div v-if="JSON.parse(item.lastMessage.attachment.raw).type == 100001">
{{ JSON.parse(item.lastMessage.attachment.raw).obj.jobName }}
</div>
<!-- 1000011 职位列表 -->
<div v-if="JSON.parse(item.lastMessage.attachment.raw).type == 100011">[]</div>
<!-- 200001 系统提醒 -->
<div v-if="JSON.parse(item.lastMessage.attachment.raw).type == 200001">
用户[
<span class="viewdetails">
{{ item.lastMessage && item.lastMessage.attachment && item.lastMessage.attachment.raw && JSON.parse(item.lastMessage.attachment.raw).userName }}
</span>
]询单需要人工介入请尽快回复
</div>
<!-- 200002 系统通知 -->
<div v-if="JSON.parse(item.lastMessage.attachment.raw).type == 200002">
<span class="">
{{ item.lastMessage && item.lastMessage.text }}
</span>
</div>
<!-- 未知 -->
<div v-if="JSON.parse(item.lastMessage.attachment.raw).name">
{{ JSON.parse(item.lastMessage.attachment.raw).name }}
</div>
<!-- 未知 -->
<div v-if="JSON.parse(item.lastMessage.attachment.raw).type == 100002">
{{ "工单" }}
</div>
<!-- 常用回复 -->
<div v-if="JSON.parse(item.lastMessage.attachment.raw).typs == 'msg'">
{{ item.lastMessage.text }}
</div>
<!-- 100000 移动端职位卡片 -->
<div v-else>
{{ JSON.parse(item.lastMessage.attachment.raw).title }}
</div>
</div>
<!-- 暂无新消息 -->
<div class="g_fs_14 g_ell_1" style="color: #999; font-size: 12px" v-if="!item.lastMessage"></div>
</div>
</div>
<template #content>
<view class="g_fs_16" style="">
<view class="g_flex_column_center g_h_32" @click="topMessage(item, index)">
<view>{{ item.stickTop ? "取消置顶" : "置顶消息" }} </view>
</view>
<view class="g_flex_column_center g_h_32" @click="deleteMessage(item, index)">
<view>不显示</view>
</view>
</view>
</template>
</Tooltip>
</div>
</view>
<view v-show="firstLoad" style="position: fixed; width: 100%; height: 100vh; left: 0px; top: 0px; z-index: 9" class="u-skeleton">
<view v-for="i in 10" :key="i" style="width: 100%; height: 72px; padding: 16px 12px" class="g_flex_row_between">
<view class="u-skeleton-fillet g_w_48 g_h_48 g_mr_8"> </view>
<view class="g_flex_1">
<view class="u-skeleton-fillet g_w_all g_h_20"></view>
<view class="u-skeleton-fillet g_w_all g_h_20 g_mt_4"></view>
</view>
</view>
<!-- </template> -->
</view>
<u-skeleton :loading="firstLoad" :animation="true" el-color="#ededed" bg-color="#fff"></u-skeleton>
</template>
<script setup>
import { ref, onMounted, onUnmounted, getCurrentInstance, watch, defineEmits, defineProps } from "vue";
const props = defineProps({});
const G = getCurrentInstance().appContext.app.config.globalProperties.G;
import Tooltip from "./Tooltip.vue";
const tooltipRef = ref(null);
let firstLoad = ref(false);
const machineList = ref([]);
onMounted(async () => {
uni.$on("updateConversationList", () => {
console.log("监听到事件");
getConversationListAndHideLoading();
});
uni.$on("deleteConversationList", (conversationIds) => {
console.log("监听到事件");
machineList.value.splice(
machineList.value.findIndex((item) => item.conversationId === conversationIds[0]),
1,
);
});
if (uni.getStorageSync("apply-token")) {
await checkLoginStatusAndGetConversations();
}
});
//
const getConversationListAndHideLoading = async () => {
try {
const result = await G.nim.V2NIMConversationService.getConversationList(0, 100);
console.log("会话列表获取成功", JSON.parse(JSON.stringify(result)));
if (result.conversationList && result.conversationList.length > 0) {
await Promise.all(
result.conversationList.map(async (item, index) => {
item.userinfo = await G.nim.V2NIMUserService.getUserListFromCloud([item.conversationId.split("|")[2]]);
console.log("debg item.conversationId", item.conversationId);
item.waitcount = await G.nim.V2NIMConversationService.getUnreadCountByIds([item.conversationId]);
if (item.userinfo[0].serverExtension) {
item.subtitle = JSON.parse(item.userinfo[0].serverExtension).fullName;
} else {
item.subtitle = "";
}
item.time = formatTime(item.lastMessage?.messageRefer.createTime || item.updateTime);
}),
);
}
//
let stickTopList = result?.conversationList
.filter((item) => {
return item.stickTop == true;
})
.sort((a, b) => {
if (a.lastMessage?.messageRefer.createTime && b.lastMessage?.messageRefer.createTime) {
return b.lastMessage?.messageRefer.createTime - a.lastMessage?.messageRefer.createTime;
} else if (a.lastMessage?.messageRefer.createTime || b.lastMessage?.messageRefer.createTime) {
if (a.lastMessage?.messageRefer.createTime) {
return a.lastMessage?.messageRefer.createTime - b.createTime;
} else {
return a.createTime - b.lastMessage?.messageRefer.createTime;
}
} else {
return a.updateTime - b.updateTime;
}
});
let defaultList = result?.conversationList
.filter((item) => {
return item.stickTop != true;
})
.sort((a, b) => {
if (a.lastMessage?.messageRefer.createTime && b.lastMessage?.messageRefer.createTime) {
return b.lastMessage?.messageRefer.createTime - a.lastMessage?.messageRefer.createTime;
} else if (a.lastMessage?.messageRefer.createTime || b.lastMessage?.messageRefer.createTime) {
if (a.lastMessage?.messageRefer.createTime) {
return a.lastMessage?.messageRefer.createTime - b.createTime;
} else {
return a.createTime - b.lastMessage?.messageRefer.createTime;
}
} else {
return a.updateTime - b.updateTime;
}
});
machineList.value = stickTopList.concat(defaultList) || []; //
} catch (error) {
console.error("获取会话列表失败", error);
machineList.value = []; //
} finally {
// / 2
firstLoad.value = false;
}
};
//
const checkLoginStatusAndGetConversations = async () => {
try {
// 2.
const loginStatus = G?.nim && (await G.nim.V2NIMLoginService.getLoginStatus());
console.log("当前登录状态", loginStatus);
if (loginStatus === 1) {
// 3. 1
await getConversationListAndHideLoading();
} else {
// 4. 2 /
setTimeout(async () => {
const retryLoginStatus = G?.nim && (await G.nim.V2NIMLoginService.getLoginStatus());
console.log("重试登录状态", retryLoginStatus);
if (retryLoginStatus === 1) {
await getConversationListAndHideLoading();
} else {
//
console.log("重试后仍未登录,停止获取会话列表");
firstLoad.value = false;
}
}, 2000);
}
} catch (error) {
//
console.error("检查登录状态/获取会话列表失败", error);
firstLoad.value = false;
}
};
//
const formatTime = (time, separator = "-") => {
// 1. Date/Date
let targetDate;
if (typeof time === "number") {
// /SDK
targetDate = new Date(time.toString().length === 10 ? time * 1000 : time);
} else if (time instanceof Date) {
targetDate = new Date(time); //
} else {
console.error("formatSmartTime入参格式错误需传入时间戳或Date对象");
return "";
}
// 2.
const now = new Date();
const todayStart = new Date(now.getFullYear(), now.getMonth(), now.getDate()); // 0
const todayEnd = new Date(todayStart.getTime() + 24 * 60 * 60 * 1000 - 1); // 23:59:59
const currentYear = now.getFullYear(); //
// 3. ////
const year = targetDate.getFullYear();
const month = String(targetDate.getMonth() + 1).padStart(2, "0"); // 0
const day = String(targetDate.getDate()).padStart(2, "0");
const hour = String(targetDate.getHours()).padStart(2, "0");
const minute = String(targetDate.getMinutes()).padStart(2, "0");
// 4.
if (targetDate >= todayStart && targetDate <= todayEnd) {
//
return `${hour}:${minute}`;
} else if (year === currentYear) {
//
return `${month}${separator}${day} ${hour}:${minute}`;
} else {
//
return `${year}${separator}${month}${separator}${day} ${hour}:${minute}`;
}
};
const goChatPage = async (_item) => {
console.log(_item);
try {
console.log("debg _item.conversationId", _item.conversationId);
const res = await G.nim.V2NIMConversationService.clearUnreadCountByIds([_item.conversationId]);
console.log("V2NIMConversationService.clearUnreadCountByIds", res);
} catch (error) {
console.log("error", error);
}
uni.navigateTo({
url: "/root/NEUIKit/index?item=" + _item.conversationId,
});
};
/**
* 置顶或取消置顶会话
*/
const topMessage = async (_item, _index) => {
console.log(_item);
try {
if (_item && _item.stickTop) {
G.nim.V2NIMConversationService.stickTopConversation(_item.conversationId, false);
} else {
G.nim.V2NIMConversationService.stickTopConversation(_item.conversationId, true);
}
console.log("tooltipRef.value", tooltipRef.value);
} catch (error) {
uni.showToast({
title: error,
icon: "none",
});
console.log("errorerror", error);
}
tooltipRef.value[_index].close();
// let res1 = await G.nim.V2NIMConversationService.getStickTopConversationList();
// console.log("res1res1", res1);
};
/**
* 删除会话
*/
const deleteMessage = async (_item, _index) => {
console.log(_item);
G.handleConfirm({
content: "不显示该聊天?",
confirmText: "不显示",
cancelText: "取消",
success(res) {
if (res.confirm) {
try {
G.nim.V2NIMConversationService.deleteConversation(_item.conversationId, false);
} catch (error) {
console.log("errorerror", error);
uni.showToast({
title: error,
icon: "none",
});
}
}
},
});
tooltipRef.value[_index].close();
};
onUnmounted(() => {
uni.$off("updateConversationList");
});
</script>
<style lang="less" scoped>
.bottom-line {
position: relative;
&::after {
content: "";
width: 100%;
height: 1px;
background-color: #ededed;
position: absolute;
left: 10px;
top: -12px;
}
}
</style>

@ -364,6 +364,23 @@ export function createApp () {
});
}
});
const globalObj = typeof globalThis !== 'undefined'
? globalThis
: (typeof global !== 'undefined' ? global : window);
// 安全赋值:确保全局对象存在再赋值
if (globalObj) {
globalObj.$app = app; // 挂载 Vue 实例(避免和 uni 内置的 $app 冲突)
// 若需挂载 $app需先初始化空对象再赋值
if (!globalObj.$app) {
globalObj.$app = {};
}
globalObj.$app.config = {
globalProperties: app.config.globalProperties
};
} else {
console.warn('全局对象获取失败,无法挂载 Vue 实例');
}
app.config.globalProperties.F = wyyx;
app.use(uView)
return {

309
package-lock.json generated

@ -9,9 +9,12 @@
"version": "1.0.0",
"license": "ISC",
"dependencies": {
"@xkit-yx/im-store-v2": "^0.4.0",
"@xkit-yx/utils": "^0.5.6",
"dayjs": "^1.11.7",
"fetch-event-source": "^1.0.0-alpha.2",
"mobx": "^6.6.1",
"nim-web-sdk-ng": "^10.4.0",
"pinyin": "^3.1.0",
"recorder-core": "^1.3.25011100"
},
@ -684,6 +687,47 @@
"integrity": "sha512-dISoDXWWQwUquiKsyZ4Ng+HX2KsPL7LyHKHQwgGFEA3IaKac4Obd+h2a/a6waisAoepJlBcx9paWqjA8/HVjCw==",
"optional": true
},
"node_modules/@xkit-yx/im-store-v2": {
"version": "0.4.0",
"resolved": "https://registry.npmmirror.com/@xkit-yx/im-store-v2/-/im-store-v2-0.4.0.tgz",
"integrity": "sha512-XWJfOZ3ECp6ixlck3CB+alICC4zT1oYrIl4R1saPYv0ou0g6VtlZY1NE7hMi/X/G/6aWR8VC/eBfAXjZBy8Z0g==",
"license": "MIT",
"dependencies": {
"@xkit-yx/utils": "^0.7.1",
"mobx": "^6.6.1"
},
"peerDependencies": {
"nim-web-sdk-ng": "^10.x"
}
},
"node_modules/@xkit-yx/im-store-v2/node_modules/@xkit-yx/utils": {
"version": "0.7.2",
"resolved": "https://registry.npmmirror.com/@xkit-yx/utils/-/utils-0.7.2.tgz",
"integrity": "sha512-6u/wDBcYZ+pihRyYgMzDDOSrdy6otD3t0HjxShNFleh7dfHjEcy1A1wAlxu/EP/FQ+illC5SYnfD3mvmpoo5kQ==",
"license": "MIT",
"dependencies": {
"axios": "^0.27.2",
"eventemitter3": "^4.0.7"
},
"peerDependencies": {
"axios": "^0.27.2",
"eventemitter3": "^4.0.7"
}
},
"node_modules/@xkit-yx/utils": {
"version": "0.5.6",
"resolved": "https://registry.npmmirror.com/@xkit-yx/utils/-/utils-0.5.6.tgz",
"integrity": "sha512-zozywNmLXx/UfqEFxTiAz8IlYdgkaxLWYwNtTbN3dMB0n24VRQJB898ovro1NA0kJchl1QMOVHxPd+/q0tmRmg==",
"license": "MIT",
"dependencies": {
"axios": "^0.27.2",
"eventemitter3": "^4.0.7"
},
"peerDependencies": {
"axios": "^0.27.2",
"eventemitter3": "^4.0.7"
}
},
"node_modules/abbrev": {
"version": "1.1.1",
"resolved": "https://registry.npmmirror.com/abbrev/-/abbrev-1.1.1.tgz",
@ -757,6 +801,22 @@
"node": ">=10"
}
},
"node_modules/asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmmirror.com/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
"license": "MIT"
},
"node_modules/axios": {
"version": "0.27.2",
"resolved": "https://registry.npmmirror.com/axios/-/axios-0.27.2.tgz",
"integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==",
"license": "MIT",
"dependencies": {
"follow-redirects": "^1.14.9",
"form-data": "^4.0.0"
}
},
"node_modules/babel-plugin-macros": {
"version": "2.8.0",
"resolved": "https://registry.npmmirror.com/babel-plugin-macros/-/babel-plugin-macros-2.8.0.tgz",
@ -812,6 +872,19 @@
"node": ">=8"
}
},
"node_modules/call-bind-apply-helpers": {
"version": "1.0.2",
"resolved": "https://registry.npmmirror.com/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
"integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
"license": "MIT",
"dependencies": {
"es-errors": "^1.3.0",
"function-bind": "^1.1.2"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/callsites": {
"version": "3.1.0",
"resolved": "https://registry.npmmirror.com/callsites/-/callsites-3.1.0.tgz",
@ -886,6 +959,18 @@
"color-support": "bin.js"
}
},
"node_modules/combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmmirror.com/combined-stream/-/combined-stream-1.0.8.tgz",
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
"license": "MIT",
"dependencies": {
"delayed-stream": "~1.0.0"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/commander": {
"version": "1.1.1",
"resolved": "https://registry.npmmirror.com/commander/-/commander-1.1.1.tgz",
@ -956,6 +1041,15 @@
"node": ">=8"
}
},
"node_modules/delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmmirror.com/delayed-stream/-/delayed-stream-1.0.0.tgz",
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
"license": "MIT",
"engines": {
"node": ">=0.4.0"
}
},
"node_modules/delegates": {
"version": "1.0.0",
"resolved": "https://registry.npmmirror.com/delegates/-/delegates-1.0.0.tgz",
@ -971,6 +1065,20 @@
"node": ">=8"
}
},
"node_modules/dunder-proto": {
"version": "1.0.1",
"resolved": "https://registry.npmmirror.com/dunder-proto/-/dunder-proto-1.0.1.tgz",
"integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
"license": "MIT",
"dependencies": {
"call-bind-apply-helpers": "^1.0.1",
"es-errors": "^1.3.0",
"gopd": "^1.2.0"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/emoji-regex": {
"version": "8.0.0",
"resolved": "https://registry.npmmirror.com/emoji-regex/-/emoji-regex-8.0.0.tgz",
@ -986,6 +1094,51 @@
"is-arrayish": "^0.2.1"
}
},
"node_modules/es-define-property": {
"version": "1.0.1",
"resolved": "https://registry.npmmirror.com/es-define-property/-/es-define-property-1.0.1.tgz",
"integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
"license": "MIT",
"engines": {
"node": ">= 0.4"
}
},
"node_modules/es-errors": {
"version": "1.3.0",
"resolved": "https://registry.npmmirror.com/es-errors/-/es-errors-1.3.0.tgz",
"integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
"license": "MIT",
"engines": {
"node": ">= 0.4"
}
},
"node_modules/es-object-atoms": {
"version": "1.1.1",
"resolved": "https://registry.npmmirror.com/es-object-atoms/-/es-object-atoms-1.1.1.tgz",
"integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==",
"license": "MIT",
"dependencies": {
"es-errors": "^1.3.0"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/es-set-tostringtag": {
"version": "2.1.0",
"resolved": "https://registry.npmmirror.com/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz",
"integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==",
"license": "MIT",
"dependencies": {
"es-errors": "^1.3.0",
"get-intrinsic": "^1.2.6",
"has-tostringtag": "^1.0.2",
"hasown": "^2.0.2"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/escalade": {
"version": "3.2.0",
"resolved": "https://registry.npmmirror.com/escalade/-/escalade-3.2.0.tgz",
@ -1003,6 +1156,12 @@
"node": ">=6"
}
},
"node_modules/eventemitter3": {
"version": "4.0.7",
"resolved": "https://registry.npmmirror.com/eventemitter3/-/eventemitter3-4.0.7.tgz",
"integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==",
"license": "MIT"
},
"node_modules/fetch-event-source": {
"version": "1.0.0-alpha.2",
"resolved": "https://registry.npmmirror.com/fetch-event-source/-/fetch-event-source-1.0.0-alpha.2.tgz",
@ -1034,6 +1193,42 @@
"node": ">=8"
}
},
"node_modules/follow-redirects": {
"version": "1.16.0",
"resolved": "https://registry.npmmirror.com/follow-redirects/-/follow-redirects-1.16.0.tgz",
"integrity": "sha512-y5rN/uOsadFT/JfYwhxRS5R7Qce+g3zG97+JrtFZlC9klX/W5hD7iiLzScI4nZqUS7DNUdhPgw4xI8W2LuXlUw==",
"funding": [
{
"type": "individual",
"url": "https://github.com/sponsors/RubenVerborgh"
}
],
"license": "MIT",
"engines": {
"node": ">=4.0"
},
"peerDependenciesMeta": {
"debug": {
"optional": true
}
}
},
"node_modules/form-data": {
"version": "4.0.5",
"resolved": "https://registry.npmmirror.com/form-data/-/form-data-4.0.5.tgz",
"integrity": "sha512-8RipRLol37bNs2bhoV67fiTEvdTrbMUYcFTiy3+wuuOnUog2QBHCZWXDRijWQfAkhBj2Uf5UnVaiWwA5vdd82w==",
"license": "MIT",
"dependencies": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"es-set-tostringtag": "^2.1.0",
"hasown": "^2.0.2",
"mime-types": "^2.1.12"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/fs-minipass": {
"version": "2.1.0",
"resolved": "https://registry.npmmirror.com/fs-minipass/-/fs-minipass-2.1.0.tgz",
@ -1068,7 +1263,6 @@
"version": "1.1.2",
"resolved": "https://registry.npmmirror.com/function-bind/-/function-bind-1.1.2.tgz",
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
"optional": true,
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
@ -1103,6 +1297,43 @@
"node": "6.* || 8.* || >= 10.*"
}
},
"node_modules/get-intrinsic": {
"version": "1.3.0",
"resolved": "https://registry.npmmirror.com/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
"integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
"license": "MIT",
"dependencies": {
"call-bind-apply-helpers": "^1.0.2",
"es-define-property": "^1.0.1",
"es-errors": "^1.3.0",
"es-object-atoms": "^1.1.1",
"function-bind": "^1.1.2",
"get-proto": "^1.0.1",
"gopd": "^1.2.0",
"has-symbols": "^1.1.0",
"hasown": "^2.0.2",
"math-intrinsics": "^1.1.0"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/get-proto": {
"version": "1.0.1",
"resolved": "https://registry.npmmirror.com/get-proto/-/get-proto-1.0.1.tgz",
"integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
"license": "MIT",
"dependencies": {
"dunder-proto": "^1.0.1",
"es-object-atoms": "^1.0.0"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/glob": {
"version": "7.2.3",
"resolved": "https://registry.npmmirror.com/glob/-/glob-7.2.3.tgz",
@ -1124,6 +1355,45 @@
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/gopd": {
"version": "1.2.0",
"resolved": "https://registry.npmmirror.com/gopd/-/gopd-1.2.0.tgz",
"integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
"license": "MIT",
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/has-symbols": {
"version": "1.1.0",
"resolved": "https://registry.npmmirror.com/has-symbols/-/has-symbols-1.1.0.tgz",
"integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
"license": "MIT",
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/has-tostringtag": {
"version": "1.0.2",
"resolved": "https://registry.npmmirror.com/has-tostringtag/-/has-tostringtag-1.0.2.tgz",
"integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==",
"license": "MIT",
"dependencies": {
"has-symbols": "^1.0.3"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/has-unicode": {
"version": "2.0.1",
"resolved": "https://registry.npmmirror.com/has-unicode/-/has-unicode-2.0.1.tgz",
@ -1134,7 +1404,6 @@
"version": "2.0.2",
"resolved": "https://registry.npmmirror.com/hasown/-/hasown-2.0.2.tgz",
"integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
"optional": true,
"dependencies": {
"function-bind": "^1.1.2"
},
@ -1339,6 +1608,15 @@
"semver": "bin/semver.js"
}
},
"node_modules/math-intrinsics": {
"version": "1.1.0",
"resolved": "https://registry.npmmirror.com/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
"integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
"license": "MIT",
"engines": {
"node": ">= 0.4"
}
},
"node_modules/micromatch": {
"version": "4.0.8",
"resolved": "https://registry.npmmirror.com/micromatch/-/micromatch-4.0.8.tgz",
@ -1353,6 +1631,27 @@
"node": ">=8.6"
}
},
"node_modules/mime-db": {
"version": "1.52.0",
"resolved": "https://registry.npmmirror.com/mime-db/-/mime-db-1.52.0.tgz",
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/mime-types": {
"version": "2.1.35",
"resolved": "https://registry.npmmirror.com/mime-types/-/mime-types-2.1.35.tgz",
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
"license": "MIT",
"dependencies": {
"mime-db": "1.52.0"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/minimatch": {
"version": "3.1.2",
"resolved": "https://registry.npmmirror.com/minimatch/-/minimatch-3.1.2.tgz",
@ -1432,6 +1731,12 @@
"integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==",
"dev": true
},
"node_modules/nim-web-sdk-ng": {
"version": "10.9.81",
"resolved": "https://registry.npmmirror.com/nim-web-sdk-ng/-/nim-web-sdk-ng-10.9.81.tgz",
"integrity": "sha512-tiCbYzqWoLUXv1F3dqZ9GvWNL3zbzHcUK9Iedsl10vyAXwFaL4PrPfblGg2HSn9UMM90opPAL5aIkH2yG1MzUA==",
"license": "ISC"
},
"node_modules/node-addon-api": {
"version": "3.2.1",
"resolved": "https://registry.npmmirror.com/node-addon-api/-/node-addon-api-3.2.1.tgz",

@ -14,7 +14,10 @@
"fetch-event-source": "^1.0.0-alpha.2",
"mobx": "^6.6.1",
"pinyin": "^3.1.0",
"recorder-core": "^1.3.25011100"
"recorder-core": "^1.3.25011100",
"@xkit-yx/im-store-v2": "^0.4.0",
"@xkit-yx/utils": "^0.5.6",
"nim-web-sdk-ng": "^10.4.0"
},
"devDependencies": {
"rollup-plugin-visualizer": "^5.14.0",

@ -554,6 +554,29 @@
}
}
]
},
{ //
"root": "root/NEUIKit",
"pages": [
{
"path": "index",
"style": {
"navigationBarTitleText": " ",
"backgroundColor": "#ededed",
"backgroundColorTop": "#ededed",
"backgroundColorBottom": "#ededed"
}
},
{
"path": "pages/userPage",
"style": {
"navigationBarTitleText": "名片",
"backgroundColor": "#ededed",
"backgroundColorTop": "#ededed",
"backgroundColorBottom": "#ededed"
}
}
]
}
],
"globalStyle": {
@ -577,12 +600,12 @@
"selectedIconPath": "static/image/home.png",
"text": "首页"
},
// {
// "pagePath": "pages/message/index",
// "iconPath": "static/image/message_gray.png",
// "selectedIconPath": "static/image/message.png",
// "text": "消息"
// },
{
"pagePath": "pages/message/index",
"iconPath": "static/image/message_gray.png",
"selectedIconPath": "static/image/message.png",
"text": "消息"
},
{
"pagePath": "pages/home/order",
"iconPath": "static/image/plus-square_gray.png",

@ -12,6 +12,7 @@
<view class="g_radius_6" style="margin: 0 10px; overflow: hidden">
<rh-loading paddingBottom="g_pb_120" />
<!-- <ConversationList ref="contactList" /> -->
<conversationList />
</view>
</view>
<view class="" v-if="current == 1">
@ -45,6 +46,7 @@
<script lang="ts" setup>
import { ref, onMounted, computed, getCurrentInstance } from "vue";
// import ConversationList from "../NEUIKit/pages/Conversation/conversation-list/index.vue";
import conversationList from "../../components/conversationList.vue";
// import { trackInit } from "../NEUIKit/utils/reporter.ts";
import { onShow, onLoad } from "@dcloudio/uni-app";
// import telPanel from "../NEUIKit/pages/Contact/contact-list/index.vue";

@ -0,0 +1,184 @@
// import { NIM,
// setAdapters,
// uniAppAdapters,
// V2NIMMessageService,
// V2NIMMessageLogUtil,
// V2NIMConversationService,
// V2NIMConst
// } from '../../../../dist/esm/nim'
import {
NIM,
setAdapters,
uniAppAdapters,
V2NIMMessageService,
V2NIMMessageLogUtil,
// V2NIMLocalConversationService,
V2NIMStorageService,
// V2NIMTeamService,
V2NIMUserService,
V2NIMFriendService,
V2NIMSettingService,
V2NIMConst,
V2NIMConversationService
} from 'nim-web-sdk-ng/dist/esm/nim'
// 设置 uniapp 环境
setAdapters(uniAppAdapters)
/**
* 注册了消息服务和会话服务
*
* 具体有哪些模块可以注入, 请参照 SDK 使用说明: https://doc.yunxin.163.com/messaging2/guide/DcyMjA1Njk?platform=client#%E6%96%B9%E5%BC%8F%E4%BA%8Cesm-%E5%BC%95%E5%85%A5
*/
/**
* 消息模块.
*
* 影响 API 包含 V2NIMMessageService 下全部接口.
*/
NIM.registerService(V2NIMMessageService, 'V2NIMMessageService')
/**
* 消息模块-消息记录相关工具类. 包含查询消息历史等功能.
*
* 影响 API 包含 V2NIMMessageService 的部分接口, 举例:
* getMessageList, getMessageListEx,
* getMessageListByRefers, clearHistoryMessage
*/
NIM.registerService(V2NIMMessageLogUtil, 'V2NIMMessageLogUtil')
/**
* 消息模块-扩展功能. 包含 pin 消息, 收藏消息等功能
*
* 影响 API 包含 V2NIMMessageService 的部分接口, 举例:
* pinMessage, unpinMessage, updatePinMessage, voiceToText,
* getPinnedMessageList, addQuickComment, removeQuickComment, getQuickCommentList, addCollection,
* removeCollections, updateCollectionExtension, getCollectionListByOption,
* getCollectionListExByOption, searchCloudMessages, searchCloudMessagesEx
*/
// NIM.registerService(V2NIMMessageExtendUtil, 'V2NIMMessageExtendUtil')
/**
* 消息序列化与反序列化工具
*
* 影响 API 包含 V2NIMMessageConverter 的全部接口.
*/
// NIM.registerService(V2NIMMessageConverter, 'V2NIMMessageConverter')
/**
* 云端存储模块, 包含上传文件能力
*
* 影响 API 包含 V2NIMMessageService 的部分接口, 举例:
* V2NIMMessageService.sendMessage (发图片/文件类型的消息时)
* V2NIMMessageService.cancelMessageAttachmentUpload (取消文件消息的上传)
*
* 影响 API 包含 V2NIMStorageService 的全部接口.
*/
NIM.registerService(V2NIMStorageService, 'V2NIMStorageService')
/**
* 云端会话模块.
*
* 影响 API 包含 V2NIMConversationService 的全部接口.
*/
NIM.registerService(V2NIMConversationService, 'V2NIMConversationService')
/**
* 云端会话分组模块.
*
* 影响 API 包含 V2NIMConversationGroupService 的全部接口.
*/
// NIM.registerService(V2NIMConversationGroupService, 'V2NIMConversationGroupService')
/**
* 本地会话模块.
*
* 影响 API 包含 V2NIMLocalConversationService 的全部接口.
*/
// NIM.registerService(V2NIMLocalConversationService, 'V2NIMLocalConversationService')
/**
* 群组模块.
*
* 影响 API 包含 V2NIMSettingService 的部分接口, 举例:
* setTeamMessageMuteMode, getTeamMessageMuteMode, getAllTeamMessageMuteMode
*
* 影响 API 包含 V2NIMTeamService 的全部接口.
*/
// NIM.registerService(V2NIMTeamService, 'V2NIMTeamService')
/**
* 用户模块.
*
* 影响 API 包含 V2NIMSettingService 的部分接口, 举例:
* getConversationMuteStatus, setP2PMessageMuteMode
*
* 影响 API 包含 V2NIMUserService 的全部接口.
*/
NIM.registerService(V2NIMUserService, 'V2NIMUserService') // 用户模块
/**
* 好友模块.
*
* 影响 API 包含 V2NIMFriendService 的全部接口.
*/
NIM.registerService(V2NIMFriendService, 'V2NIMFriendService')
/**
* 通知模块.
*
* 影响 API 包含 V2NIMNotificationService 的全部接口.
*/
// NIM.registerService(V2NIMNotificationService, 'V2NIMNotificationService')
/**
* 设置模块.
*
* 影响 API 包含 V2NIMSettingService 的全部接口.
* - 包含推送配置, 会话免打扰设置.
* - 与会话免打扰有关的设置需要引入群, 用户模块
*/
NIM.registerService(V2NIMSettingService, 'V2NIMSettingService')
/**
* AI 数字人模块.
*
* 影响 API 包含 V2NIMMessageService 的部分接口与事件:
* sendMessage (发送参数 aiConfig, 配置 AI 相关)
* onReceiveMessages (收消息事件, 回调的 V2NIMMessage 消息体参见属性 aiConfig streamConfig 流式输出)
* onReceiveMessagesModified (消息更新事件, 回调的 V2NIMMessage 消息体参见属性 aiConfig streamConfig 流式输出)
*
* 影响 API 包含 V2NIMAIService 的全部接口.
*/
// NIM.registerService(V2NIMAIService, 'V2NIMAIService')
/**
* 订阅模块, 如上下线状态通知订阅.
*
* 影响 API 包含 V2NIMSubscriptionService 的全部接口.
*/
// NIM.registerService(V2NIMSubscriptionService, 'V2NIMSubscriptionService')
/**
* 信令模块
*
* 影响 API 包含 V2NIMSignallingService 的全部接口.
*/
// NIM.registerService(V2NIMSignallingService, 'V2NIMSignallingService')
/**
* 服务代理相关
*
* 影响 API 包含 V2NIMPassthroughService 的全部接口.
*/
// NIM.registerService(V2NIMPassthroughService, 'V2NIMPassthroughService')
/**
* 此外某些模块包含工具类, 只需要引入对应模块服务, 就能直接使用该工具类, 关系如下
*
* V2NIMConversationIdUtil(会话 id 工具类) => V2NIMMessageService, V2NIMConversationService
* V2NIMClientAntispamUtil(客户端反垃圾工具类) => V2NIMMessageService
* V2NIMMessageCreator(消息构造工具类) => V2NIMMessageService
*/
export { NIM, V2NIMConst }
Loading…
Cancel
Save