Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
浙江兰德纵横网络技术股份有限公司
o2oa
提交
a77d9c26
o2oa
项目概览
浙江兰德纵横网络技术股份有限公司
/
o2oa
通知
339
Star
10
Fork
6
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
o2oa
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a77d9c26
编写于
3月 05, 2021
作者:
F
fancy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
聊天的tab标题根据组件名称
上级
1647a4ee
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
67 addition
and
51 deletion
+67
-51
o2web/source/x_component_IMV2/Main.js
o2web/source/x_component_IMV2/Main.js
+67
-51
未找到文件。
o2web/source/x_component_IMV2/Main.js
浏览文件 @
a77d9c26
...
...
@@ -32,10 +32,23 @@ MWF.xApplication.IMV2.Main = new Class({
};
this
.
emojiList
.
push
(
emoji
);
}
},
onQueryClose
:
function
()
{
this
.
closeListening
()
this
.
closeListening
();
},
// 获取组件名称
loadComponentName
:
function
()
{
o2
.
Actions
.
load
(
"
x_component_assemble_control
"
).
ComponentAction
.
get
(
"
IMV2
"
,
function
(
json
)
{
var
imComponent
=
json
.
data
;
if
(
imComponent
&&
imComponent
.
title
)
{
this
.
setTitle
(
imComponent
.
title
);
}
}.
bind
(
this
),
function
(
err
)
{
console
.
log
(
err
);
})
},
// 加载应用
loadApplication
:
function
(
callback
)
{
var
url
=
this
.
path
+
this
.
options
.
style
+
"
/im.html
"
;
this
.
content
.
loadHtml
(
url
,
{
"
bind
"
:
{
"
lp
"
:
this
.
lp
,
"
data
"
:
{}
},
"
module
"
:
this
},
function
()
{
...
...
@@ -52,7 +65,9 @@ MWF.xApplication.IMV2.Main = new Class({
}.
bind
(
this
));
}.
bind
(
this
));
this
.
loadComponentName
();
},
// 监听ws消息
startListening
:
function
()
{
if
(
layout
.
desktop
&&
layout
.
desktop
.
message
)
{
this
.
messageNumber
=
layout
.
desktop
.
message
.
items
.
length
;
...
...
@@ -70,13 +85,14 @@ MWF.xApplication.IMV2.Main = new Class({
}.
bind
(
this
),
1000
);
}
},
// 关闭监听
closeListening
:
function
()
{
if
(
this
.
listener
)
{
clearInterval
(
this
.
listener
);
}
},
// 接收新的消息 会话列表更新 或者 聊天窗口更新
reciveNewMessage
:
function
()
{
reciveNewMessage
:
function
()
{
//查询会话数据
this
.
_checkConversationMessage
();
//查询聊天数据
...
...
@@ -138,13 +154,13 @@ MWF.xApplication.IMV2.Main = new Class({
}.
bind
(
this
));
},
//修改群名
tapUpdateConvTitle
:
function
()
{
tapUpdateConvTitle
:
function
()
{
this
.
chatTitleMoreMenuNode
.
setStyle
(
"
display
"
,
"
none
"
);
var
form
=
new
MWF
.
xApplication
.
IMV2
.
UpdateConvTitleForm
(
this
,
{},
{},
{
app
:
this
.
app
});
form
.
create
();
},
//修改群成员
tapUpdateConvMembers
:
function
()
{
tapUpdateConvMembers
:
function
()
{
this
.
chatTitleMoreMenuNode
.
setStyle
(
"
display
"
,
"
none
"
);
var
members
=
[];
for
(
var
i
=
0
;
i
<
this
.
conversationNodeItemList
.
length
;
i
++
)
{
...
...
@@ -187,46 +203,46 @@ MWF.xApplication.IMV2.Main = new Class({
document
.
body
.
addEvent
(
"
mousedown
"
,
this
.
hideFun
);
},
// 点击发送文件消息
showChooseFile
:
function
()
{
if
(
!
this
.
uploadFileAreaNode
){
showChooseFile
:
function
()
{
if
(
!
this
.
uploadFileAreaNode
)
{
this
.
createUploadFileNode
();
}
this
.
fileUploadNode
.
click
();
},
//创建文件选择框
createUploadFileNode
:
function
()
{
createUploadFileNode
:
function
()
{
this
.
uploadFileAreaNode
=
new
Element
(
"
div
"
);
var
html
=
"
<input name=
\"
file
\"
type=
\"
file
\"
multiple/>
"
;
this
.
uploadFileAreaNode
.
set
(
"
html
"
,
html
);
this
.
fileUploadNode
=
this
.
uploadFileAreaNode
.
getFirst
();
this
.
fileUploadNode
.
addEvent
(
"
change
"
,
function
(){
var
files
=
this
.
fileUploadNode
.
files
;
if
(
files
.
length
)
{
var
file
=
files
.
item
(
0
);
var
formData
=
new
FormData
();
formData
.
append
(
'
file
'
,
file
);
formData
.
append
(
'
fileName
'
,
file
.
name
);
var
fileExt
=
file
.
name
.
substring
(
file
.
name
.
lastIndexOf
(
"
.
"
));
// 图片消息
var
type
=
"
file
"
if
(
fileExt
.
toLowerCase
()
==
"
.bmp
"
||
fileExt
.
toLowerCase
()
==
"
.jpeg
"
||
fileExt
.
toLowerCase
()
==
"
.png
"
||
fileExt
.
toLowerCase
()
==
"
.jpg
"
)
{
type
=
"
image
"
}
else
{
// 文件消息
type
=
"
file
"
}
//上传文件
o2
.
Actions
.
load
(
"
x_message_assemble_communicate
"
).
ImAction
.
uploadFile
(
this
.
conversationId
,
type
,
formData
,
"
{}
"
,
function
(
json
)
{
if
(
json
.
data
)
{
var
fileId
=
json
.
data
.
id
var
fileExtension
=
json
.
data
.
fileExtension
var
fileName
=
json
.
data
.
fileName
this
.
_newImageOrFileMsgAndSend
(
type
,
fileId
,
fileName
,
fileExtension
)
}
}.
bind
(
this
),
function
(
error
)
{
console
.
log
(
error
);
}.
bind
(
this
))
this
.
fileUploadNode
.
addEvent
(
"
change
"
,
function
()
{
var
files
=
this
.
fileUploadNode
.
files
;
if
(
files
.
length
)
{
var
file
=
files
.
item
(
0
);
var
formData
=
new
FormData
();
formData
.
append
(
'
file
'
,
file
);
formData
.
append
(
'
fileName
'
,
file
.
name
);
var
fileExt
=
file
.
name
.
substring
(
file
.
name
.
lastIndexOf
(
"
.
"
));
// 图片消息
var
type
=
"
file
"
if
(
fileExt
.
toLowerCase
()
==
"
.bmp
"
||
fileExt
.
toLowerCase
()
==
"
.jpeg
"
||
fileExt
.
toLowerCase
()
==
"
.png
"
||
fileExt
.
toLowerCase
()
==
"
.jpg
"
)
{
type
=
"
image
"
}
else
{
// 文件消息
type
=
"
file
"
}
//上传文件
o2
.
Actions
.
load
(
"
x_message_assemble_communicate
"
).
ImAction
.
uploadFile
(
this
.
conversationId
,
type
,
formData
,
"
{}
"
,
function
(
json
)
{
if
(
json
.
data
)
{
var
fileId
=
json
.
data
.
id
var
fileExtension
=
json
.
data
.
fileExtension
var
fileName
=
json
.
data
.
fileName
this
.
_newImageOrFileMsgAndSend
(
type
,
fileId
,
fileName
,
fileExtension
)
}
}.
bind
(
this
),
function
(
error
)
{
console
.
log
(
error
);
}.
bind
(
this
))
}
}.
bind
(
this
));
},
hideEmojiBox
:
function
()
{
...
...
@@ -251,7 +267,7 @@ MWF.xApplication.IMV2.Main = new Class({
form
.
create
()
},
//更新群名
updateConversationTitle
:
function
(
title
,
convId
)
{
updateConversationTitle
:
function
(
title
,
convId
)
{
var
conv
=
{
id
:
convId
,
title
:
title
,
...
...
@@ -275,7 +291,7 @@ MWF.xApplication.IMV2.Main = new Class({
}.
bind
(
this
))
},
//更新群成员
updateConversationMembers
:
function
(
members
,
convId
)
{
updateConversationMembers
:
function
(
members
,
convId
)
{
var
conv
=
{
id
:
convId
,
personList
:
members
,
...
...
@@ -334,14 +350,14 @@ MWF.xApplication.IMV2.Main = new Class({
}
},
//创建图片或文件消息
_newImageOrFileMsgAndSend
:
function
(
type
,
fileId
,
fileName
,
fileExt
)
{
_newImageOrFileMsgAndSend
:
function
(
type
,
fileId
,
fileName
,
fileExt
)
{
var
distinguishedName
=
layout
.
session
.
user
.
distinguishedName
;
var
time
=
this
.
_currentTime
();
var
body
=
{
"
body
"
:
"
[文件]
"
,
"
type
"
:
type
,
"
fileId
"
:
fileId
,
"
fileExtension
"
:
fileExt
,
"
body
"
:
"
[文件]
"
,
"
type
"
:
type
,
"
fileId
"
:
fileId
,
"
fileExtension
"
:
fileExt
,
"
fileName
"
:
fileName
};
var
bodyJson
=
JSON
.
stringify
(
body
);
...
...
@@ -519,7 +535,7 @@ MWF.xApplication.IMV2.Main = new Class({
}
else
if
(
msgBody
.
type
==
"
file
"
)
{
//文件
var
mapBox
=
new
Element
(
"
span
"
).
inject
(
lastNode
);
var
fileIcon
=
this
.
_getFileIcon
(
msgBody
.
fileExtension
);
new
Element
(
"
img
"
,
{
"
src
"
:
"
../x_component_IMV2/$Main/file_icons/
"
+
fileIcon
,
"
width
"
:
48
,
"
height
"
:
48
}).
inject
(
mapBox
);
new
Element
(
"
img
"
,
{
"
src
"
:
"
../x_component_IMV2/$Main/file_icons/
"
+
fileIcon
,
"
width
"
:
48
,
"
height
"
:
48
}).
inject
(
mapBox
);
var
downloadUrl
=
this
.
_getFileDownloadUrl
(
msgBody
.
fileId
);
new
Element
(
"
a
"
,
{
"
href
"
:
downloadUrl
,
"
target
"
:
"
_blank
"
,
"
text
"
:
msgBody
.
fileName
}).
inject
(
mapBox
);
}
else
{
//text
...
...
@@ -579,7 +595,7 @@ MWF.xApplication.IMV2.Main = new Class({
}
else
if
(
msgBody
.
type
==
"
file
"
)
{
//文件
var
mapBox
=
new
Element
(
"
span
"
).
inject
(
lastNode
);
var
fileIcon
=
this
.
_getFileIcon
(
msgBody
.
fileExtension
);
new
Element
(
"
img
"
,
{
"
src
"
:
"
../x_component_IMV2/$Main/file_icons/
"
+
fileIcon
,
"
width
"
:
48
,
"
height
"
:
48
}).
inject
(
mapBox
);
new
Element
(
"
img
"
,
{
"
src
"
:
"
../x_component_IMV2/$Main/file_icons/
"
+
fileIcon
,
"
width
"
:
48
,
"
height
"
:
48
}).
inject
(
mapBox
);
var
downloadUrl
=
this
.
_getFileDownloadUrl
(
msgBody
.
fileId
);
new
Element
(
"
a
"
,
{
"
href
"
:
downloadUrl
,
"
target
"
:
"
_blank
"
,
"
text
"
:
msgBody
.
fileName
}).
inject
(
mapBox
);
}
else
{
//text
...
...
@@ -681,10 +697,10 @@ MWF.xApplication.IMV2.Main = new Class({
return
"
icon_file_psd.png
"
;
}
else
if
(
ext
===
"
tmp
"
)
{
return
"
icon_file_tmp.png
"
;
}
else
{
}
else
{
return
"
icon_file_unkown.png
"
;
}
}
else
{
}
else
{
return
"
icon_file_unkown.png
"
;
}
},
...
...
@@ -877,7 +893,7 @@ MWF.xApplication.IMV2.ConversationItem = new Class({
this
.
messageTimeNode
.
set
(
"
text
"
,
time
);
}
},
refreshConvTitle
:
function
(
title
)
{
refreshConvTitle
:
function
(
title
)
{
this
.
titleNode
.
set
(
"
text
"
,
title
);
},
addCheckClass
:
function
()
{
...
...
@@ -1024,10 +1040,10 @@ MWF.xApplication.IMV2.CreateConversationForm = new Class({
if
(
data
)
{
if
(
this
.
options
[
"
isUpdateMember
"
]
===
true
)
{
this
.
app
.
updateConversationMembers
(
data
.
person
,
this
.
app
.
conversationId
);
}
else
{
this
.
app
.
newConversation
(
data
.
person
,
this
.
options
[
"
personCount
"
]
===
1
?
"
single
"
:
"
group
"
);
}
else
{
this
.
app
.
newConversation
(
data
.
person
,
this
.
options
[
"
personCount
"
]
===
1
?
"
single
"
:
"
group
"
);
}
this
.
close
();
}
}
...
...
@@ -1054,13 +1070,13 @@ MWF.xApplication.IMV2.UpdateConvTitleForm = new Class({
"
<td styles='formTableValue14' item='title' colspan='3'></td></tr>
"
+
"
</table>
"
;
this
.
formTableArea
.
set
(
"
html
"
,
html
);
this
.
form
=
new
MForm
(
this
.
formTableArea
,
this
.
data
||
{},
{
isEdited
:
true
,
style
:
"
minder
"
,
hasColon
:
true
,
itemTemplate
:
{
title
:
{
text
:
"
群名
"
,
type
:
"
text
"
,
notEmpty
:
true
},
title
:
{
text
:
"
群名
"
,
type
:
"
text
"
,
notEmpty
:
true
},
}
},
this
.
app
);
this
.
form
.
load
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录