优化页面
This commit is contained in:
@@ -1,72 +0,0 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../common/vendor.js");
|
||||
const TUIKit_components_TUIChat_config = require("./config.js");
|
||||
class TUIChatServer {
|
||||
constructor() {
|
||||
this.currentConversationID = "";
|
||||
this.currentMessageList = [];
|
||||
common_vendor.R.registerService(common_vendor.E.TUIChat.SERVICE.NAME, this);
|
||||
common_vendor.R.registerEvent(common_vendor.E.TUITheme.EVENT.THEME_CHANGED, common_vendor.E.TUITheme.EVENT_SUB_KEY.CHANGE_SUCCESS, this);
|
||||
common_vendor.R.registerEvent(common_vendor.E.TUIChat.EVENT.CHAT_TYPE_CHANGED, common_vendor.E.TUIChat.EVENT_SUB_KEY.CHANGE_SUCCESS, this);
|
||||
common_vendor.Jt.watch(common_vendor.o.CONV, {
|
||||
currentConversationID: (id) => {
|
||||
this.currentConversationID = id;
|
||||
}
|
||||
});
|
||||
}
|
||||
onCall(method, params, callback) {
|
||||
let message;
|
||||
switch (method) {
|
||||
case common_vendor.E.TUIChat.SERVICE.METHOD.UPDATE_MESSAGE_LIST:
|
||||
message = params.message;
|
||||
if ((message == null ? void 0 : message.conversationID) === this.currentConversationID) {
|
||||
common_vendor.Qt.updateMessageList([message], "push");
|
||||
}
|
||||
break;
|
||||
case common_vendor.E.TUIChat.SERVICE.METHOD.SEND_CUSTOM_MESSAGE:
|
||||
common_vendor.Qt.sendCustomMessage(params).then((res) => {
|
||||
callback && callback(res);
|
||||
});
|
||||
break;
|
||||
case common_vendor.E.TUIChat.SERVICE.METHOD.SEND_TEXT_MESSAGE:
|
||||
common_vendor.Qt.sendTextMessage(params).then((res) => {
|
||||
callback && callback(res);
|
||||
});
|
||||
break;
|
||||
case common_vendor.E.TUIChat.SERVICE.METHOD.SET_CHAT_TYPE:
|
||||
TUIKit_components_TUIChat_config.ChatConfig.setChatType(params == null ? void 0 : params.chatType);
|
||||
break;
|
||||
case common_vendor.E.TUIChat.SERVICE.METHOD.CLOSE_MESSAGE_POP_MENU:
|
||||
common_vendor.Jt.update(common_vendor.o.CUSTOM, "isShowMessagePopMenu", false);
|
||||
break;
|
||||
case common_vendor.E.TUIChat.SERVICE.METHOD.UPDATE_MESSAGE_INFO:
|
||||
common_vendor.Qt.updateMessageInfo(params == null ? void 0 : params.userInfo);
|
||||
break;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Listen for the success notification.
|
||||
*/
|
||||
onNotifyEvent(eventName, subKey, params) {
|
||||
if (eventName === common_vendor.E.TUITheme.EVENT.THEME_CHANGED) {
|
||||
switch (subKey) {
|
||||
case common_vendor.E.TUITheme.EVENT_SUB_KEY.CHANGE_SUCCESS:
|
||||
if (params == null ? void 0 : params.theme) {
|
||||
TUIKit_components_TUIChat_config.ChatConfig.setTheme(params.theme.toLowerCase());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (eventName === common_vendor.E.TUIChat.EVENT.CHAT_TYPE_CHANGED) {
|
||||
switch (subKey) {
|
||||
case common_vendor.E.TUIChat.EVENT_SUB_KEY.CHANGE_SUCCESS:
|
||||
if (params == null ? void 0 : params.chatType) {
|
||||
TUIKit_components_TUIChat_config.ChatConfig.setChatType(params == null ? void 0 : params.chatType);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.TUIChatServer = TUIChatServer;
|
||||
//# sourceMappingURL=../../../../.sourcemap/mp-weixin/TUIKit/components/TUIChat/server.js.map
|
||||
Reference in New Issue
Block a user