Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Laurel Lee
O2OA
Commits
655aa6cd
Commit
655aa6cd
authored
3 years ago
by
fancy
Browse files
Options
Download
Email Patches
Plain Diff
聊聊修改聊天人员左右换位,web端回车发送消息等问题
parent
e9714fd3
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
o2web/source/x_component_IMV2/$Main/default/chat.html
+1
-0
o2web/source/x_component_IMV2/$Main/default/chat.html
o2web/source/x_component_IMV2/$Main/default/style.css
+9
-0
o2web/source/x_component_IMV2/$Main/default/style.css
o2web/source/x_component_IMV2/Main.js
+25
-5
o2web/source/x_component_IMV2/Main.js
o2web/source/x_component_IMV2/lp/en.js
+1
-0
o2web/source/x_component_IMV2/lp/en.js
o2web/source/x_component_IMV2/lp/zh-cn.js
+1
-0
o2web/source/x_component_IMV2/lp/zh-cn.js
with
37 additions
and
5 deletions
+37
-5
o2web/source/x_component_IMV2/$Main/default/chat.html
+
1
-
0
View file @
655aa6cd
...
...
@@ -21,6 +21,7 @@
<textarea
data-o2-element=
"chatBottomAreaTextareaNode"
placeholder=
"{{$.lp.enterMessage}}"
></textarea>
</div>
<div
class=
"chat-bottom-area-send-space"
>
<div
class=
"chat-bottom-area-key-tips"
>
Ctrl + Enter 换行
</div>
<div
class=
"chat-bottom-area-send"
data-o2-element=
"chatBottomAreaSendAreaNode"
>
<span
class=
"chat-bottom-area-send-btn"
data-o2-element=
"chatBottomAreaSendBtnNode"
data-o2-events=
"click:sendMsg"
>
{{$.lp.send}}
</span>
</div>
...
...
This diff is collapsed.
Click to expand it.
o2web/source/x_component_IMV2/$Main/default/style.css
+
9
-
0
View file @
655aa6cd
...
...
@@ -296,6 +296,15 @@
height
:
46px
;
}
.chat-bottom-area-key-tips
{
position
:
absolute
;
right
:
105px
;
top
:
3px
;
height
:
32px
;
line-height
:
32px
;
color
:
#848484
;
}
.chat-bottom-area-send
{
position
:
absolute
;
right
:
15px
;
...
...
This diff is collapsed.
Click to expand it.
o2web/source/x_component_IMV2/Main.js
+
25
-
5
View file @
655aa6cd
...
...
@@ -50,6 +50,11 @@ MWF.xApplication.IMV2.Main = new Class({
},
// 加载应用
loadApplication
:
function
(
callback
)
{
// 判断xadmin 打开聊天功能
if
(
layout
.
session
.
user
&&
layout
.
session
.
user
.
name
==
"
xadmin
"
)
{
console
.
log
(
"
xadmin can not open IMV2
"
);
return
;
}
var
url
=
this
.
path
+
this
.
options
.
style
+
"
/im.html
"
;
this
.
content
.
loadHtml
(
url
,
{
"
bind
"
:
{
"
lp
"
:
this
.
lp
,
"
data
"
:
{}
},
"
module
"
:
this
},
function
()
{
//设置content
...
...
@@ -151,6 +156,21 @@ MWF.xApplication.IMV2.Main = new Class({
this
.
loadMsgListByConvId
(
1
,
20
,
conv
.
id
);
var
scrollFx
=
new
Fx
.
Scroll
(
this
.
chatContentNode
);
scrollFx
.
toBottom
();
// 绑定事件
this
.
chatBottomAreaTextareaNode
.
addEvents
({
"
keyup
"
:
function
(
e
)
{
// debugger;
if
(
e
.
code
===
13
)
{
if
(
e
.
control
===
true
)
{
var
text
=
this
.
chatBottomAreaTextareaNode
.
value
;
this
.
chatBottomAreaTextareaNode
.
value
=
text
+
"
\n
"
;
}
else
{
this
.
sendMsg
();
}
e
.
stopPropagation
();
}
}.
bind
(
this
)
});
}.
bind
(
this
));
},
//修改群名
...
...
@@ -389,7 +409,7 @@ MWF.xApplication.IMV2.Main = new Class({
console
.
log
(
error
);
}.
bind
(
this
));
this
.
messageList
.
push
(
message
);
this
.
_build
Send
er
(
body
,
distinguishedName
,
false
);
this
.
_build
Receiv
er
(
body
,
distinguishedName
,
false
);
this
.
_refreshConvMessage
(
message
);
},
//创建文本消息 并发送
...
...
@@ -416,7 +436,7 @@ MWF.xApplication.IMV2.Main = new Class({
console
.
log
(
error
);
}.
bind
(
this
));
this
.
messageList
.
push
(
textMessage
);
this
.
_build
Send
er
(
body
,
distinguishedName
,
false
);
this
.
_build
Receiv
er
(
body
,
distinguishedName
,
false
);
this
.
_refreshConvMessage
(
textMessage
);
},
//刷新会话Item里面的最后消息内容
...
...
@@ -497,9 +517,9 @@ MWF.xApplication.IMV2.Main = new Class({
var
body
=
JSON
.
parse
(
jsonbody
);
//todo 目前只有一种text类型
var
distinguishedName
=
layout
.
session
.
user
.
distinguishedName
;
if
(
createPerson
!=
distinguishedName
)
{
this
.
_buildReceiver
(
body
,
createPerson
,
isTop
);
}
else
{
this
.
_buildSender
(
body
,
createPerson
,
isTop
);
}
else
{
this
.
_buildReceiver
(
body
,
createPerson
,
isTop
);
}
},
/**
...
...
@@ -508,7 +528,7 @@ MWF.xApplication.IMV2.Main = new Class({
* @param createPerson 消息人员
* @param isTop 是否放在顶部
*/
_buildSender
:
function
(
msgBody
,
createPerson
,
isTop
)
{
_buildSender
:
function
(
msgBody
,
createPerson
,
isTop
)
{
var
receiverBodyNode
=
new
Element
(
"
div
"
,
{
"
class
"
:
"
chat-sender
"
}).
inject
(
this
.
chatContentNode
,
isTop
?
"
top
"
:
"
bottom
"
);
var
avatarNode
=
new
Element
(
"
div
"
).
inject
(
receiverBodyNode
);
var
avatarUrl
=
this
.
_getIcon
(
createPerson
);
...
...
This diff is collapsed.
Click to expand it.
o2web/source/x_component_IMV2/lp/en.js
+
1
-
0
View file @
655aa6cd
...
...
@@ -26,5 +26,6 @@ MWF.xApplication.IMV2.LP = {
"
enterMessage
"
:
"
Enter message content
"
,
"
send
"
:
"
Send
"
,
"
sendKeyTips
"
:
"
Ctrl + Enter Line feed
"
,
"
file
"
:
"
[File]
"
};
This diff is collapsed.
Click to expand it.
o2web/source/x_component_IMV2/lp/zh-cn.js
+
1
-
0
View file @
655aa6cd
...
...
@@ -26,5 +26,6 @@ MWF.xApplication.IMV2.LP = {
"
enterMessage
"
:
"
输入消息内容
"
,
"
send
"
:
"
发送
"
,
"
sendKeyTips
"
:
"
Ctrl + Enter 换行
"
,
"
file
"
:
"
[文件]
"
};
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help