Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
foreign
/
customer-service
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
38c4ddaf
authored
Jul 17, 2021
by
panjiangyi
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
创建会话通过所属详情获取chatid
parent
15024190
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
55 deletions
chat-list.vue
chat-room.vue
store/index.ts
utils/chat-info.ts
chat-list.vue
View file @
38c4ddaf
...
...
@@ -116,9 +116,6 @@ export default class ChatList extends Vue {
@
chatStore
.
State
(
ChatStore
.
STATE_CHAT_CURRENT_CHAT_ID
)
private
readonly
chatId
!
:
ChatStore
.
STATE_CHAT_CURRENT_CHAT_ID
;
@
chatStore
.
State
(
ChatStore
.
STATE_CHAT_CURRENT_CHAT_VERSION
)
private
readonly
uniplatVersion
!
:
ChatStore
.
STATE_CHAT_CURRENT_CHAT_VERSION
;
@
chatStore
.
State
(
ChatStore
.
STATE_MY_CHAT_ROOM_LIST
)
private
readonly
chatList
!
:
ChatStore
.
STATE_MY_CHAT_ROOM_LIST
;
...
...
@@ -221,17 +218,16 @@ export default class ChatList extends Vue {
wantedChatRoom
.
business_data
.
model_name
,
wantedChatRoom
.
business_data
.
obj_id
);
console
.
log
(
"testing getChatInfo"
,
info
);
this
.
saveChatId
({
chatId
:
wantedChatRoom
.
chat_id
,
v
:
data
.
uniplat_version
,
uniplatId
:
data
.
uniplatId
,
v
:
info
.
uniplat_version
,
uniplatId
:
info
.
uniplatId
,
}).
finally
(
this
.
raiseChatIdChanged
);
this
.
showChat
();
this
.
$emit
(
"close"
);
this
.
saveChatTitle
(
data
.
uniplatId
);
this
.
saveChatTitle
(
info
.
uniplatId
);
}
private
raiseChatIdChanged
()
{
...
...
chat-room.vue
View file @
38c4ddaf
<
template
>
<div
class=
"chat-room-con h-100 pos-rel"
>
{{
chatId
}}
-
{{
uniplatId
}}
{{
chatId
}}
<div
class=
"chat-panel"
>
<div
class=
"chat-area h-100"
>
<template
v-if=
"notOnlyCheck"
>
...
...
@@ -43,9 +43,6 @@ export default class ChatRoom extends Vue {
@
chatStore
.
State
(
ChatStore
.
STATE_CHAT_CURRENT_CHAT_ID
)
private
readonly
chatId
!
:
ChatStore
.
STATE_CHAT_CURRENT_CHAT_ID
;
@
chatStore
.
State
(
ChatStore
.
STATE_CHAT_CURRENT_CHAT_VERSION
)
private
readonly
uniplatId
!
:
ChatStore
.
STATE_CHAT_CURRENT_CHAT_VERSION
;
@
chatStore
.
Getter
(
ChatStore
.
GETTER_CURRENT_CHAT_PRESENT_MEMBERS
)
private
readonly
chatMembers
!
:
ChatStore
.
GETTER_CURRENT_CHAT_PRESENT_MEMBERS
;
...
...
@@ -86,11 +83,9 @@ export default class ChatRoom extends Vue {
}
private
get
currentChat
()
{
const
chatId
=
this
.
c
urrentChatUnipl
atId
;
const
chatId
=
this
.
c
h
atId
;
if
(
this
.
myChatList
==
null
)
return
;
const
result
=
this
.
myChatList
.
list
.
find
((
k
)
=>
k
.
uniplatId
===
chatId
);
// if (result) return result;
// result = this.allChatList.list.find((k) => k.uniplatId === chatId);
const
result
=
this
.
myChatList
.
list
.
find
((
k
)
=>
k
.
chat_id
===
chatId
);
return
result
??
{};
}
...
...
store/index.ts
View file @
38c4ddaf
...
...
@@ -4,6 +4,7 @@ import { Module } from "vuex";
import
{
ChatMember
}
from
"../model"
;
import
{
isAccessibleUrl
}
from
"../service/tools"
;
import
{
unique
}
from
"../utils"
;
import
{
getChatModelInfo
}
from
"../utils/chat-info"
;
import
{
decode
}
from
"../utils/jwt"
;
import
{
getUserInfo
}
from
"../utils/user-info"
;
import
Chat
from
"../xim"
;
...
...
@@ -362,14 +363,13 @@ export default {
)
{
const
uniplatId
=
state
[
ChatStore
.
STATE_CHAT_CURRENT_CHAT_UNIPLAT_ID
];
const
version
=
state
[
ChatStore
.
STATE_CHAT_CURRENT_CHAT_VERSION
];
if
(
uniplatId
==
null
)
return
;
try
{
const
data
=
await
model
()
.
action
(
"sendMsg"
)
.
updateInitialParams
({
selected_list
:
[
{
v
:
Number
(
version
)
,
id
:
Number
(
uniplatId
)
},
{
v
:
0
,
id
:
Number
(
uniplatId
)
},
],
})
.
addInputs_parameter
({
...
...
@@ -408,49 +408,23 @@ export default {
params
:
Parameters
<
ChatStore
.
ACTION_CREATE_NEW_CHAT_BY_SERVICE_MAN
>
[
0
]
)
{
const
myId
=
(
await
getMyinfo
()).
id
;
const
action
=
sdk
().
model
(
UniplatChatModelName
).
action
(
"insert"
);
action
.
addInputs_parameter
({
OrgId
:
orgId
(),
ModelName
:
params
.
modelName
,
ObjId
:
+
params
.
selectedListId
,
Creator
:
myId
,
Status
:
ChatStatus
.
opening
,
const
{
id
}
=
await
sdk
().
model
(
params
.
modelName
).
createChat
({
orgId
:
orgId
(),
uid
:
myId
,
detailId
:
+
params
.
selectedListId
});
const
detailManager
=
await
action
.
getDetailParametersManagerByName
(
"UniplatChatMember"
);
detailManager
.
add
({
OrgId
:
orgId
(),
Uid
:
myId
,
type
:
ChatMemberType
.
member
,
});
params
.
uids
.
forEach
((
id
)
=>
{
detailManager
.
add
({
OrgId
:
orgId
(),
Uid
:
id
,
type
:
ChatMemberType
.
member
,
});
});
detailManager
.
done
();
const
{
id
}
=
await
action
.
dryExecute
();
// 无法得到chat id
await
sdk
()
.
model
(
UniplatChatModelName
)
.
action
(
"createXimChat"
)
.
updateInitialParams
({
selected_list
:
[{
v
:
0
,
id
}],
})
.
dryExecute
();
await
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
500
));
await
dispatch
(
ChatStore
.
ACTION_GET_MY_CHAT_LIST
);
const
newChatInfo
=
await
getChatModelInfo
(
params
.
modelName
,
params
.
selectedListId
);
const
roomList
=
state
[
ChatStore
.
STATE_MY_CHAT_ROOM_LIST
];
if
(
roomList
==
null
)
return
;
const
newChat
=
roomList
.
list
.
find
((
k
)
=>
k
.
uniplatId
===
id
);
const
newChat
=
roomList
.
list
.
find
((
k
)
=>
k
.
chat_id
===
newChatInfo
.
chat_
id
);
if
(
newChat
==
null
)
return
;
commit
(
ChatStore
.
MUTATION_SHOW_CHAT
);
await
dispatch
(
ChatStore
.
ACTION_SAVE_CURRENT_CHAT_ID_VERSION
,
{
chatId
:
newChat
.
chat_id
,
v
:
newChat
.
uniplat_version
,
uniplatId
:
newChat
.
uniplatI
d
,
v
:
newChat
Info
.
uniplat_version
,
uniplatId
:
i
d
,
});
},
// async [ChatStore.ACTION_CREATE_NEW_CHAT_BY_CLIENT_SIDE](
...
...
@@ -584,10 +558,11 @@ export default {
.
execute
();
await
dispatch
(
ChatStore
.
ACTION_GET_MY_CHAT_LIST
);
const
firstChat
=
state
[
ChatStore
.
STATE_MY_CHAT_ROOM_LIST
]?.
list
[
0
];
const
chatInfo
=
await
getChatModelInfo
(
firstChat
.
business_data
.
model_name
,
firstChat
.
business_data
.
obj_id
);
await
dispatch
(
ChatStore
.
ACTION_SAVE_CURRENT_CHAT_ID_VERSION
,
{
chatId
:
firstChat
.
chat_id
,
v
:
firstChat
.
uniplat_version
,
uniplatId
:
firstChat
.
uniplatId
,
v
:
chatInfo
.
uniplat_version
,
uniplatId
:
chatInfo
.
uniplatId
,
});
},
async
[
ChatStore
.
ACTION_CHAT_ADD_MEMBERS
](
...
...
utils/chat-info.ts
View file @
38c4ddaf
...
...
@@ -12,5 +12,9 @@ export async function getChatModelInfo(modelName: string, id: string) {
const
info
=
await
Chat
.
getSdk
().
model
(
modelName
).
detail
(
id
).
query
();
const
data
=
info
;
chatInfo
[
id
]
=
data
;
return
data
;
return
{
uniplatId
:
info
.
row
.
UniplatChatId
.
value
,
chat_id
:
info
.
row
.
UniplatImBizId
.
value
,
uniplat_version
:
0
};
}
Write
Preview
Markdown
is supported
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