diff --git a/o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/im/ActionMsgCreate.java b/o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/im/ActionMsgCreate.java index 8498c7aad712e48c100a1d0b6f84f018f7d036a8..546c17197abafb619522d79798efd710ac5f92da 100644 --- a/o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/im/ActionMsgCreate.java +++ b/o2server/x_message_assemble_communicate/src/main/java/com/x/message/assemble/communicate/jaxrs/im/ActionMsgCreate.java @@ -63,7 +63,7 @@ public class ActionMsgCreate extends BaseAction { logger.error(e); } logger.info("发送im消息, person: " + persons.get(i)); - MessageConnector.send(MessageConnector.TYPE_IM_CREATE, "来自 "+ name + "的IM消息", persons.get(i), msg); + MessageConnector.send(MessageConnector.TYPE_IM_CREATE, "来自 "+ name + " 的消息", persons.get(i), msg); } ActionResult result = new ActionResult<>(); diff --git a/o2web/source/o2_core/o2/xDesktop/WebSocket.js b/o2web/source/o2_core/o2/xDesktop/WebSocket.js index 7382e77025ed02ac91ffec311fb7686eac95ce88..3f9b163087bddfb027cecb53fb7c93673fc59716 100644 --- a/o2web/source/o2_core/o2/xDesktop/WebSocket.js +++ b/o2web/source/o2_core/o2/xDesktop/WebSocket.js @@ -160,6 +160,9 @@ MWF.xDesktop.WebSocket = new Class({ break; case "custom_create": this.receiveCustomMessage(data); + case "im_create": + console.log("im 消息来了!!!"); + this.receiveIMMessage(data); break; default: } @@ -292,7 +295,7 @@ MWF.xDesktop.WebSocket = new Class({ }.bind(this)); }, receiveCustomMessage: function(data){ - var content = ""+MWF.LP.desktop.messsage.customMessage+""+data.body; + var content = ""+MWF.LP.desktop.messsage.customMessage+":"+data.body; var msg = { "subject": MWF.LP.desktop.messsage.customMessageTitle, "content": content @@ -300,6 +303,37 @@ MWF.xDesktop.WebSocket = new Class({ var messageItem = layout.desktop.message.addMessage(msg); var tooltipItem = layout.desktop.message.addTooltip(msg); }, + receiveIMMessage: function(data){ + var imBody = data.body; + var jsonBody = imBody.body; + var conversationId = imBody.conversationId; + + var body = JSON.parse(jsonBody); + var msgBody = body.body; //默认text 文本消息 + if (body.type && body.type == "emoji") { //表情 消息 + msgBody = "[表情]"; + } + var content = ""+data.title+""+msgBody; + var msg = { + "subject": MWF.LP.desktop.messsage.customMessageTitle, + "content": content + }; + var messageItem = layout.desktop.message.addMessage(msg); + var options = {"conversationId": conversationId}; + messageItem.contentNode.addEvent("click", function(e){ + layout.desktop.message.addUnread(-1); + layout.desktop.message.hide(); + layout.desktop.openApplication(e, "IMV2", options); + }.bind(this)); + + var tooltipItem = layout.desktop.message.addTooltip(msg); + tooltipItem.contentNode.addEvent("click", function(e){ + layout.desktop.message.hide(); + layout.desktop.openApplication(e, "IMV2", options); + }.bind(this)); + + + }, diff --git a/o2web/source/x_component_IMV2/$Main/default/chat.html b/o2web/source/x_component_IMV2/$Main/default/chat.html index 320659e98141e42e71224013019dfe628df5322f..8d51e22db8cf548ea096dea6f4b7d973a715050d 100644 --- a/o2web/source/x_component_IMV2/$Main/default/chat.html +++ b/o2web/source/x_component_IMV2/$Main/default/chat.html @@ -8,7 +8,7 @@
- +
diff --git a/o2web/source/x_component_IMV2/$Main/default/chattest.html b/o2web/source/x_component_IMV2/$Main/default/chattest.html index e872fef2024ab0bc0196c39d0f6483e04decec7c..ff93358cbebedb2e8cec4300fd1696b253bebbf6 100644 --- a/o2web/source/x_component_IMV2/$Main/default/chattest.html +++ b/o2web/source/x_component_IMV2/$Main/default/chattest.html @@ -46,7 +46,6 @@ bottom: 0px; background: #ffffff; width: 100%; - z-index: 100; } .chat-bottom-area-tool { @@ -325,6 +324,7 @@
+
@@ -332,6 +332,92 @@
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/o2web/source/x_component_IMV2/$Main/default/icon.png b/o2web/source/x_component_IMV2/$Main/default/icon.png index a1d5c6229be0ed889c46502caaf2e14d6e73aa33..644162c3fe8c02b49cd21ffef8e191a764b33362 100644 Binary files a/o2web/source/x_component_IMV2/$Main/default/icon.png and b/o2web/source/x_component_IMV2/$Main/default/icon.png differ diff --git a/o2web/source/x_component_IMV2/$Main/default/im.html b/o2web/source/x_component_IMV2/$Main/default/im.html index 2a944efcf6bde8d8feab487595b2abde68010274..e3bd31777c4dea6ced81a765e31ba091b877afdf 100644 --- a/o2web/source/x_component_IMV2/$Main/default/im.html +++ b/o2web/source/x_component_IMV2/$Main/default/im.html @@ -2,13 +2,15 @@
-
-
+
+ 创建单聊 +
+
diff --git a/o2web/source/x_component_IMV2/$Main/default/style.css b/o2web/source/x_component_IMV2/$Main/default/style.css index 4930aff4dcd7fccac3e3e10f8902a69ac2e364a7..d237d3facfec8cf232a07ea8d1ac98bad2c58831 100644 --- a/o2web/source/x_component_IMV2/$Main/default/style.css +++ b/o2web/source/x_component_IMV2/$Main/default/style.css @@ -18,11 +18,13 @@ border-bottom: 1px solid rgb(204, 204, 204); } .o2_im_chat_list_top .add { - background: url(/x_component_IMV2/$Main/default/icons/add.png) center center no-repeat; - width: 40px; - height: 40px; - cursor: pointer; - float: right; + background: url(/x_component_IMV2/$Main/default/icons/add.png) left center no-repeat; + height: 40px; + cursor: pointer; + margin-left: 14px; + text-align: center; + line-height: 40px; + color: #848484; } .o2_im_chat_list_top .search_out { margin-right: 40px; @@ -161,7 +163,25 @@ /* 聊天界面 */ - +.chat-emoji-box { + position: absolute; + width:630px; + height: 260px; + left: 5px; + bottom: 155px; + background-color: #ffffff; + border: 1px solid #F1F1F1; + padding-top: 8px; + border-radius: 8px; + box-shadow: 5px 5px #1d1d1d10; + z-index: 100; +} +.chat-emoji-img { + width: 32px; + height: 32px; + float: left; + margin: 5px; +} .chat-title { height: 30px; text-align: center; @@ -326,7 +346,11 @@ right: -22px; top: 3px; } - + .chat-content-emoji { + width: 32px; + height: 32px; + margin: 5px; + } .chat-notice { clear: both; font-size: 70%; diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_01.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_01.png new file mode 100755 index 0000000000000000000000000000000000000000..cfbd514de61c6f41d13f215086b87ce808de5638 Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_01.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_02.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_02.png new file mode 100755 index 0000000000000000000000000000000000000000..8896aa989a9d59d569444e47adcb7ec699bdd7a6 Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_02.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_03.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_03.png new file mode 100755 index 0000000000000000000000000000000000000000..e544874355faca598fa24e13ed340de005de1145 Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_03.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_04.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_04.png new file mode 100755 index 0000000000000000000000000000000000000000..56a4abbbb7c40db7616a20381be2381b1fea28ce Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_04.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_05.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_05.png new file mode 100755 index 0000000000000000000000000000000000000000..e054d595ce0da70c6824ab80c046e1f51b7a6f48 Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_05.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_06.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_06.png new file mode 100755 index 0000000000000000000000000000000000000000..84e00aaf51f0678707f094e31ce0bce4a7a239d3 Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_06.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_07.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_07.png new file mode 100755 index 0000000000000000000000000000000000000000..f5bbdd4493be4f39be5bb44a6fbbf8ba54ce309a Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_07.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_08.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_08.png new file mode 100755 index 0000000000000000000000000000000000000000..6fad47cb2f7b44ea8ade8133cc794f01410ff702 Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_08.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_09.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_09.png new file mode 100755 index 0000000000000000000000000000000000000000..5b6d5055f82dccb89b2f6e3f153d61d390da2227 Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_09.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_10.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_10.png new file mode 100755 index 0000000000000000000000000000000000000000..511bd11b939026d8dbb01a56680fc6a2ae46e440 Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_10.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_11.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_11.png new file mode 100755 index 0000000000000000000000000000000000000000..3dfc744b5706d5f7fe5ce523be99ef8c0c00a4ba Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_11.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_12.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_12.png new file mode 100755 index 0000000000000000000000000000000000000000..205ddf1dd0f085b48da4c3c27b9b62b6d1a00f40 Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_12.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_13.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_13.png new file mode 100755 index 0000000000000000000000000000000000000000..f62cec4f6207842c04555a0564238cf8890a7988 Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_13.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_14.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_14.png new file mode 100755 index 0000000000000000000000000000000000000000..8e6b790392dc07762b223317bbbf6f380e1e2f6a Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_14.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_15.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_15.png new file mode 100755 index 0000000000000000000000000000000000000000..0236763e6348c122e876a1610f0bbc9b7b318d34 Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_15.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_16.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_16.png new file mode 100755 index 0000000000000000000000000000000000000000..3371dbcd9920e348a7a69a0b05e7267ad4e36013 Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_16.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_17.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_17.png new file mode 100755 index 0000000000000000000000000000000000000000..aaae09c89e72fd95f29b35fd41242b3bb2ecafd8 Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_17.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_18.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_18.png new file mode 100755 index 0000000000000000000000000000000000000000..70778b1cbdd1096418767a476966989361c95c68 Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_18.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_19.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_19.png new file mode 100755 index 0000000000000000000000000000000000000000..dc2ceae4cb76b0d7934247a02190118c8db0786f Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_19.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_20.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_20.png new file mode 100755 index 0000000000000000000000000000000000000000..d6c6bde57ea6d51a1ddde81c6e16e5a7b11c2dfd Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_20.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_21.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_21.png new file mode 100755 index 0000000000000000000000000000000000000000..bacce5e59ba5f4fd13c52595354df44909502cad Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_21.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_22.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_22.png new file mode 100755 index 0000000000000000000000000000000000000000..d70498e66f1a0e5016f428c5a8a7905c7a902d59 Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_22.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_23.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_23.png new file mode 100755 index 0000000000000000000000000000000000000000..7596c31585bb7d5b5c495bb037283f4aff0f5b11 Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_23.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_24.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_24.png new file mode 100755 index 0000000000000000000000000000000000000000..7a1685cd11cb61e0d4f2213f18808a00fb471f62 Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_24.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_25.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_25.png new file mode 100755 index 0000000000000000000000000000000000000000..01f94164fdf5fe490e342060e71020eb7df43a01 Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_25.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_26.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_26.png new file mode 100755 index 0000000000000000000000000000000000000000..a6805271060e8733cd35b98f923e424955c1d0ef Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_26.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_27.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_27.png new file mode 100755 index 0000000000000000000000000000000000000000..bdef42403e98adbf009feeaf11ab3f74ff0b089e Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_27.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_28.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_28.png new file mode 100755 index 0000000000000000000000000000000000000000..27afb606afb371726d308a7322b460642b1b166f Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_28.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_29.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_29.png new file mode 100755 index 0000000000000000000000000000000000000000..711c659ecc99ce45451257296c686a25b19f8425 Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_29.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_30.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_30.png new file mode 100755 index 0000000000000000000000000000000000000000..e2d6ae5f8b135c82bf61c7ef91df359fb5b1e0ff Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_30.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_31.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_31.png new file mode 100755 index 0000000000000000000000000000000000000000..c913bc3809cbdfe4def6caccbe933e342355fefd Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_31.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_32.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_32.png new file mode 100755 index 0000000000000000000000000000000000000000..8dfa17e6bc2cd90262ed86a11e43e230e60ebabd Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_32.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_33.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_33.png new file mode 100755 index 0000000000000000000000000000000000000000..5788c56a1fed4e41058cac5d1be05a933e61b56b Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_33.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_34.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_34.png new file mode 100755 index 0000000000000000000000000000000000000000..6822de7b71d0362d20c4144a6b68a2802452a065 Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_34.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_35.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_35.png new file mode 100755 index 0000000000000000000000000000000000000000..fccb0dd10f5006fd562dafe145ffd8194a62586a Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_35.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_36.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_36.png new file mode 100755 index 0000000000000000000000000000000000000000..60e7f6feef30cbd0bfc6714c1c2ee114d24ed195 Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_36.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_37.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_37.png new file mode 100755 index 0000000000000000000000000000000000000000..943a7f37532613fca83ad3abcb169b757c4715a7 Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_37.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_38.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_38.png new file mode 100755 index 0000000000000000000000000000000000000000..4ee5dcf5edfb02484550cf9b680727f433488e05 Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_38.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_39.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_39.png new file mode 100755 index 0000000000000000000000000000000000000000..16fe12f9fcac1ae1bdbf709578b06613c0f8a10a Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_39.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_40.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_40.png new file mode 100755 index 0000000000000000000000000000000000000000..0748d3c7ae7bcc039a1d4f6a1b3acb5f581c31cc Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_40.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_41.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_41.png new file mode 100755 index 0000000000000000000000000000000000000000..b8dc01b6c3de693ab2ffe39d3ed4c60d714966e8 Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_41.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_42.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_42.png new file mode 100755 index 0000000000000000000000000000000000000000..895653f13fac7b688a71d17c7516b456762c85dc Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_42.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_43.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_43.png new file mode 100755 index 0000000000000000000000000000000000000000..de5ac9d89f50b76a672e84402305877bb715202b Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_43.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_44.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_44.png new file mode 100755 index 0000000000000000000000000000000000000000..29695070f4e4b1758b1fbb91f7418eb6209e763d Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_44.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_45.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_45.png new file mode 100755 index 0000000000000000000000000000000000000000..e8c6a540b550b4acad56f779ee9390ae5f9d5e68 Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_45.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_46.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_46.png new file mode 100755 index 0000000000000000000000000000000000000000..3ba2ea2372ef6f4ef6902d6ac40c4250c6ccb265 Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_46.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_47.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_47.png new file mode 100755 index 0000000000000000000000000000000000000000..30c7d86c767362970c6fb1a53754e21883f5efff Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_47.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_48.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_48.png new file mode 100755 index 0000000000000000000000000000000000000000..154803f9201a4c1028eae68adf3044946df60077 Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_48.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_49.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_49.png new file mode 100755 index 0000000000000000000000000000000000000000..c03f0c8d6ec2b0eda8c894da65cea7990ae828f9 Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_49.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_50.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_50.png new file mode 100755 index 0000000000000000000000000000000000000000..5563b80fc8239fb66c70f7fd45308ddc1fc3d3b6 Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_50.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_51.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_51.png new file mode 100755 index 0000000000000000000000000000000000000000..2e77078083c95ec7b1d5d5752adde0c711624566 Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_51.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_52.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_52.png new file mode 100755 index 0000000000000000000000000000000000000000..bd9f49d32dff11b3879b20ac6a053b38dde7773d Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_52.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_53.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_53.png new file mode 100755 index 0000000000000000000000000000000000000000..454fe8af8ff7c8a18a3f01fd53151d7593cbc30e Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_53.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_54.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_54.png new file mode 100755 index 0000000000000000000000000000000000000000..0e298dfae07d0f0e9d3cf94e8ac76733cca59869 Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_54.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_55.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_55.png new file mode 100755 index 0000000000000000000000000000000000000000..757fc64b3e126b83b7a0c849eb3d549b94906532 Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_55.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_56.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_56.png new file mode 100755 index 0000000000000000000000000000000000000000..cbc0c90229cd43358b4fa23c8761f27b18e3243f Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_56.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_57.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_57.png new file mode 100755 index 0000000000000000000000000000000000000000..9c90e1c9e9b522ace28d9111ba71980ce82a08fa Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_57.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_58.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_58.png new file mode 100755 index 0000000000000000000000000000000000000000..cb69d1897917b3b397dc3aaa98a84a16d72df018 Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_58.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_59.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_59.png new file mode 100755 index 0000000000000000000000000000000000000000..a518c7ec129833badc1dd89aad8080d5fbb945b5 Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_59.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_60.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_60.png new file mode 100755 index 0000000000000000000000000000000000000000..0a871e9b9dc857d6f98431f716f847e7d5e2a3bb Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_60.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_61.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_61.png new file mode 100755 index 0000000000000000000000000000000000000000..78816996ea5ba4b9226a5c56e8f13d1fec6bfbc6 Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_61.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_62.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_62.png new file mode 100755 index 0000000000000000000000000000000000000000..76384fe0fb9a06fb0fa9750aa3cc1c293f0485fb Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_62.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_63.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_63.png new file mode 100755 index 0000000000000000000000000000000000000000..237d17e84635d77e460bb0b889de8ec978059587 Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_63.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_64.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_64.png new file mode 100755 index 0000000000000000000000000000000000000000..dc89a87ffba93f2358c0460d650f7f02ce9ef858 Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_64.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_65.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_65.png new file mode 100755 index 0000000000000000000000000000000000000000..ce146c5d6d1a9b24f6a1796805c2918e127b3a0a Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_65.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_66.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_66.png new file mode 100755 index 0000000000000000000000000000000000000000..1ce3019f556e0508b38fab104e279fd404ae29eb Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_66.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_67.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_67.png new file mode 100755 index 0000000000000000000000000000000000000000..e20f8e8a29bf3eb612eba1b428653b2b1207508f Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_67.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_68.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_68.png new file mode 100755 index 0000000000000000000000000000000000000000..1d439e8268cc2dab83bdca216c262cd49f195320 Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_68.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_69.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_69.png new file mode 100755 index 0000000000000000000000000000000000000000..e64b8860266aa4d0928cd2ed6de91368230ee318 Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_69.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_70.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_70.png new file mode 100755 index 0000000000000000000000000000000000000000..60697ec3fa53b801df752f5fd1ffc86cfec2e35e Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_70.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_71.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_71.png new file mode 100755 index 0000000000000000000000000000000000000000..0a46fbad0af4ec7cb732d4bcfbbf7bb9fd5b2162 Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_71.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_72.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_72.png new file mode 100755 index 0000000000000000000000000000000000000000..7808470f1b441ef2b7a5214d87219aa2cf2f9d87 Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_72.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_73.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_73.png new file mode 100755 index 0000000000000000000000000000000000000000..f6392493ac814791e146ee13d6e6d696bcff418b Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_73.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_74.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_74.png new file mode 100755 index 0000000000000000000000000000000000000000..8237055e7fb96759271901d1fc592f5ae117acfc Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_74.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_75.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_75.png new file mode 100755 index 0000000000000000000000000000000000000000..a9e358099038a470315f169876ac29e279b8ed99 Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_75.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_76.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_76.png new file mode 100755 index 0000000000000000000000000000000000000000..0fbf0002abb99874c3f3d93269a88e76e73b36ea Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_76.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_77.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_77.png new file mode 100755 index 0000000000000000000000000000000000000000..0442e9a13c2353443b9b1f86e5e4af6f3848ada9 Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_77.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_78.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_78.png new file mode 100755 index 0000000000000000000000000000000000000000..aabc008d164bbf0002dce23ed9d24282a8576920 Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_78.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_79.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_79.png new file mode 100755 index 0000000000000000000000000000000000000000..e31fc30e31ac699452150e309af5f6d2ccbe999e Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_79.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_80.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_80.png new file mode 100755 index 0000000000000000000000000000000000000000..be360e9507e1f79c1ac858beb50c9fda156da079 Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_80.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_81.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_81.png new file mode 100755 index 0000000000000000000000000000000000000000..ebd39d6939ad8b9a1ba646b278077c78622d2a5f Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_81.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_82.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_82.png new file mode 100755 index 0000000000000000000000000000000000000000..f9db5dabba3d38a2432fbd5626a86ad6f82f18ca Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_82.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_83.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_83.png new file mode 100755 index 0000000000000000000000000000000000000000..877d04080437c1077f997cf401b5f0368b1ad398 Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_83.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_84.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_84.png new file mode 100755 index 0000000000000000000000000000000000000000..3d66657644d2f4cbd02fe7eb81e40f541fdc4c4c Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_84.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_85.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_85.png new file mode 100755 index 0000000000000000000000000000000000000000..64d31483fdf16e01ec7fc59f5f5aec60b6043d1b Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_85.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_86.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_86.png new file mode 100755 index 0000000000000000000000000000000000000000..c094046d625fb495b7b26b61c5731dbd60987cf3 Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_86.png differ diff --git a/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_87.png b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_87.png new file mode 100755 index 0000000000000000000000000000000000000000..047b23323aa2c33966838e572c5541d667c3274f Binary files /dev/null and b/o2web/source/x_component_IMV2/$Main/emotions/im_emotion_87.png differ diff --git a/o2web/source/x_component_IMV2/Main.js b/o2web/source/x_component_IMV2/Main.js index 68963df4162b0058c3884bdd523314e72ef4468c..baa08054c5c8cda1155c7cd203e9af6e440fa9c4 100644 --- a/o2web/source/x_component_IMV2/Main.js +++ b/o2web/source/x_component_IMV2/Main.js @@ -1,7 +1,6 @@ MWF.require("MWF.widget.UUID", null, false); MWF.xDesktop.requireApp("Template", "MForm", null, false); MWF.xDesktop.requireApp("Template", "MPopupForm", null, false); -MWF.xApplication.IMV2.options.multitask = true; MWF.xApplication.IMV2.Main = new Class({ Extends: MWF.xApplication.Common.Main, Implements: [Options, Events], @@ -15,42 +14,78 @@ MWF.xApplication.IMV2.Main = new Class({ "height": "768", "isResize": true, "isMax": true, - "title": MWF.xApplication.IMV2.LP.title + "title": MWF.xApplication.IMV2.LP.title, + "conversationId":"" }, onQueryLoad: function () { this.lp = MWF.xApplication.IMV2.LP; this.app = this; - this.conversationList = []; this.conversationNodeItemList = []; - this.conversationId = ""; + this.conversationId = this.options.conversationId || ""; + this.messageList = []; + this.emojiList = []; + //添加87个表情 + for (var i=1; i < 88; i++) { + var emoji = { + "key" : i > 9 ? "["+i+"]" : "[0"+i+"]", + "path" : i > 9 ? "/x_component_IMV2/$Main/emotions/im_emotion_"+i+".png" : "/x_component_IMV2/$Main/emotions/im_emotion_0"+i+".png", + }; + this.emojiList.push(emoji); + } + }, + onQueryClose: function(){ + this.closeListening() }, loadApplication: function (callback) { var url = this.path + this.options.style + "/im.html"; this.content.loadHtml(url, { "bind": { "lp": this.lp, "data": {} }, "module": this }, function () { + //设置content this.app.content = this.o2ImMainNode; + //启动监听 + this.startListening(); //获取会话列表 this.conversationNodeItemList = []; o2.Actions.load("x_message_assemble_communicate").ImAction.myConversationList(function (json) { if (json.data && json.data instanceof Array) { - this.conversationList = json.data; this.loadConversationList(json.data); } }.bind(this)); }.bind(this)); }, + startListening:function(){ + this.messageNumber = layout.desktop.message.items.length; + //查询ws消息 如果增加 + if (this.listener) { + clearInterval(this.listener); + } + this.listener = setInterval(function(){ + var newNumber = layout.desktop.message.items.length; + //判断是否有新的ws消息 + if(newNumber > this.messageNumber) { + //查询会话数据 + this._checkConversationMessage(); + //查询聊天数据 + this._checkNewMessage(); + this.messageNumber = newNumber; + } + }.bind(this), 1000); + }, + closeListening: function() { + if (this.listener) { + clearInterval(this.listener); + } + }, //加载会话列表 loadConversationList: function (list) { for (var i = 0; i < list.length; i++) { var chat = list[i]; var itemNode = this._createConvItemNode(chat); this.conversationNodeItemList.push(itemNode); + if(this.conversationId && this.conversationId == chat.id) { + this.tapConv(chat); + } } - if (list.length > 0) { - this.tapConv(list[0]); - } - - console.log("结束"); }, //分页获取会话的消息列表数据 loadMsgListByConvId: function (page, size, convId) { @@ -58,16 +93,15 @@ MWF.xApplication.IMV2.Main = new Class({ o2.Actions.load("x_message_assemble_communicate").ImAction.msgListByPaging(page, size, data, function (json) { var list = json.data; for (var i = 0; i < list.length; i++) { - this._buildMsgNode(list[i]); + this.messageList.push(list[i]); + this._buildMsgNode(list[i], true); } - console.log("聊天信息添加结束!"); }.bind(this), function (error) { console.log(error); }.bind(this), false); }, - //点击 + //点击会话 tapConv: function (conv) { - console.log("clickConversationvvvvvv"); this._setCheckNode(conv); var url = this.path + this.options.style + "/chat.html"; var data = { "convName": conv.title }; @@ -75,33 +109,58 @@ MWF.xApplication.IMV2.Main = new Class({ this.chatNode.empty(); this.chatNode.loadHtml(url, { "bind": data, "module": this }, function () { //获取聊天信息 + this.messageList = []; this.loadMsgListByConvId(1, 20, conv.id); - console.log("开始滚动!!!"); var scrollFx = new Fx.Scroll(this.chatContentNode); scrollFx.toBottom(); }.bind(this)); }, //点击发送消息 sendMsg: function () { - console.log("click send Msg btn................"); var text = this.chatBottomAreaTextareaNode.value; - console.log(text); if (text) { + console.log("发送文本消息"); this.chatBottomAreaTextareaNode.value = ""; - this._newAndSendTextMsg(text); - var scrollFx = new Fx.Scroll(this.chatContentNode); - scrollFx.toBottom(); + this._newAndSendTextMsg(text, "text"); } else { console.log("没有消息内容!"); } }, + //点击表情按钮 + showEmojiBox: function() { + if(!this.emojiBoxNode) { + this.emojiBoxNode = new Element("div", { "class": "chat-emoji-box" }).inject(this.chatNode); + var _self = this; + for(var i=0; i 0) { + var msg = list[0]; + //检查聊天框是否有变化 + if (this.conversationId == msg.conversationId) { + for (var i = 0; i < list.length; i++) { + var isnew = true; + var m = list[i]; + for (var j = 0; j < this.messageList.length; j++) { + if(this.messageList[j].id == m.id) { + isnew = false; + } + } + if(isnew) { + this.messageList.push(m); + this._buildMsgNode(m, false); + // this._refreshConvMessage(m); + } + } + } + } + + }.bind(this), function (error) { + console.log(error); + }.bind(this), false); + } + }, //创建消息html节点 - _buildMsgNode: function (msg) { + _buildMsgNode: function (msg, isTop) { var createPerson = msg.createPerson; var jsonbody = msg.body; var body = JSON.parse(jsonbody);//todo 目前只有一种text类型 var distinguishedName = layout.session.user.distinguishedName; if (createPerson != distinguishedName) { - this._buildReceiver(body, createPerson, true); + this._buildReceiver(body, createPerson, isTop); } else { - this._buildSender(body, createPerson, true); + this._buildSender(body, createPerson, isTop); } }, /** @@ -209,7 +331,22 @@ MWF.xApplication.IMV2.Main = new Class({ var lastNode = new Element("div").inject(receiverBodyNode); var lastFirstNode = new Element("div", { "class": "chat-left_triangle" }).inject(lastNode); //text - var lastSecNode = new Element("span", { "text": msgBody.body }).inject(lastNode); + if (msgBody.type == "emoji") { // 表情 + var img = ""; + for (var i=0; i< this.emojiList.length; i++) { + if (msgBody.body == this.emojiList[i].key) { + img = this.emojiList[i].path; + } + } + new Element("img", {"src": img, "class": "chat-content-emoji"}).inject(lastNode); + }else {//text + new Element("span", { "text": msgBody.body }).inject(lastNode); + } + + if(!isTop) { + var scrollFx = new Fx.Scroll(this.chatContentNode); + scrollFx.toBottom(); + } }, /** * 消息接收体 @@ -229,8 +366,23 @@ MWF.xApplication.IMV2.Main = new Class({ var nameNode = new Element("div", { "text": name }).inject(receiverBodyNode); var lastNode = new Element("div").inject(receiverBodyNode); var lastFirstNode = new Element("div", { "class": "chat-right_triangle" }).inject(lastNode); - //text - var lastSecNode = new Element("span", { "text": msgBody.body }).inject(lastNode); + + if (msgBody.type == "emoji") { // 表情 + var img = ""; + for (var i=0; i< this.emojiList.length; i++) { + if (msgBody.body == this.emojiList[i].key) { + img = this.emojiList[i].path; + } + } + new Element("img", {"src": img, "class": "chat-content-emoji"}).inject(lastNode); + }else {//text + new Element("span", { "text": msgBody.body }).inject(lastNode); + } + + if(!isTop) { + var scrollFx = new Fx.Scroll(this.chatContentNode); + scrollFx.toBottom(); + } }, //用户头像 _getIcon: function (id) { @@ -297,6 +449,7 @@ MWF.xApplication.IMV2.Main = new Class({ day = (day.toString().length == 1) ? ("0" + day) : day; return date.getFullYear() + '-' + month + '-' + day; }, + //当前时间 yyyy-MM-dd HH:mm:ss _currentTime: function () { var today = new Date(); var year = today.getFullYear(); //得到年份 @@ -333,7 +486,8 @@ MWF.xApplication.IMV2.ConversationItem = new Class({ "avatarUrl": avatarDefault, "title": this.data.title, "time": "", - "lastMessage": "" + "lastMessage": "", + "lastMessageType": "text" }; var distinguishedName = layout.session.user.distinguishedName; if (this.data.type && this.data.type === "single") { @@ -361,6 +515,9 @@ MWF.xApplication.IMV2.ConversationItem = new Class({ var time = this.main._friendlyTime(o2.common.toDate(this.data.lastMessage.createTime)); convData.time = time; } + if (mBody.type) { + convData.lastMessageType = mBody.type; + } } this.node = new Element("div", { "class": "item" }).inject(this.container); this.nodeBaseItem = new Element("div", { "class": "base" }).inject(this.node); @@ -370,7 +527,20 @@ MWF.xApplication.IMV2.ConversationItem = new Class({ var bodyUpNode = new Element("div", { "class": "body_up" }).inject(bodyNode); new Element("div", { "class": "body_title", "text": convData.title }).inject(bodyUpNode); this.messageTimeNode = new Element("div", { "class": "body_time", "text": convData.time }).inject(bodyUpNode); - this.lastMessageNode = new Element("div", { "class": "body_down", "text": convData.lastMessage }).inject(bodyNode); + if (convData.lastMessageType == "emoji") { + this.lastMessageNode = new Element("div", { "class": "body_down"}).inject(bodyNode); + var imgPath = ""; + for(var i = 0; i < this.main.emojiList.length ; i++) { + var emoji = this.main.emojiList[i]; + if (emoji.key == convData.lastMessage) { + imgPath = emoji.path; + } + } + new Element("img", {"src": imgPath, "style":"width: 16px;height: 16px;"}).inject(this.lastMessageNode); + }else { + this.lastMessageNode = new Element("div", { "class": "body_down", "text": convData.lastMessage }).inject(bodyNode); + } + var _self = this; this.node.addEvents({ "click": function () { @@ -393,9 +563,23 @@ MWF.xApplication.IMV2.ConversationItem = new Class({ refreshLastMsg: function(lastMessage) { //目前是text 类型的消息 var jsonbody = lastMessage.body; - var body = JSON.parse(jsonbody);//todo 目前只有一种text类型 + var body = JSON.parse(jsonbody); + if(this.lastMessageNode) { - this.lastMessageNode.set('text', body.body); + if (body.type == "emoji") { //表情 消息 + var imgPath = ""; + for(var i = 0; i < this.main.emojiList.length ; i++) { + var emoji = this.main.emojiList[i]; + if (emoji.key == body.body) { + imgPath = emoji.path; + } + } + this.lastMessageNode.empty(); + new Element("img", {"src": imgPath, "style":"width: 16px;height: 16px;"}).inject(this.lastMessageNode); + }else { //文本消息 + this.lastMessageNode.empty(); + this.lastMessageNode.set('text', body.body); + } } var time = this.main._friendlyTime(o2.common.toDate(lastMessage.createTime)); if(this.messageTimeNode) { @@ -477,7 +661,6 @@ MWF.xApplication.IMV2.SingleForm = new Class({ save: function () { var data = this.form.getResult(true, null, true, false, true); if (data) { - console.log(data); this.app.newConversation(data.person, "single"); this.close(); }