|
@@ -65,7 +65,7 @@ function initRegister (type) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// 注册101类型为面试
|
|
// 注册101类型为面试
|
|
- WKSDK.shared().register(type, () => new ObjectContent())
|
|
|
|
|
|
+ WKSDK.shared().register(type, () => new ObjectContent(''))
|
|
return {
|
|
return {
|
|
ObjectContent
|
|
ObjectContent
|
|
}
|
|
}
|
|
@@ -73,7 +73,7 @@ function initRegister (type) {
|
|
|
|
|
|
|
|
|
|
const HISTORY_QUERY = {
|
|
const HISTORY_QUERY = {
|
|
- limit: 30,
|
|
|
|
|
|
+ limit: 20,
|
|
startMessageSeq: 0,
|
|
startMessageSeq: 0,
|
|
endMessageSeq: 0,
|
|
endMessageSeq: 0,
|
|
pullMode: 1
|
|
pullMode: 1
|
|
@@ -97,7 +97,7 @@ export function useDataSource () {
|
|
const resultConversations = []
|
|
const resultConversations = []
|
|
const resp = await getConversationSync(query)
|
|
const resp = await getConversationSync(query)
|
|
// console.log(resp)
|
|
// console.log(resp)
|
|
- const conversationList = resp
|
|
|
|
|
|
+ const { data:conversationList } = resp
|
|
if (conversationList) {
|
|
if (conversationList) {
|
|
conversationList.forEach(conversation => {
|
|
conversationList.forEach(conversation => {
|
|
conversation.channel = new Channel(conversation.channel_id, conversation.channel_type)
|
|
conversation.channel = new Channel(conversation.channel_id, conversation.channel_type)
|
|
@@ -126,7 +126,8 @@ export function useDataSource () {
|
|
pull_mode,
|
|
pull_mode,
|
|
}
|
|
}
|
|
|
|
|
|
- const resp = await getMessageSync(query)
|
|
|
|
|
|
+ const { data } = await getMessageSync(query)
|
|
|
|
+ const resp = data
|
|
const messageList = resp && resp["messages"]
|
|
const messageList = resp && resp["messages"]
|
|
if (messageList) {
|
|
if (messageList) {
|
|
messageList.forEach((msg) => {
|
|
messageList.forEach((msg) => {
|
|
@@ -155,9 +156,9 @@ async function getKey () {
|
|
userId: useUserStore.accountInfo.userId
|
|
userId: useUserStore.accountInfo.userId
|
|
}
|
|
}
|
|
|
|
|
|
- const { uid, wsUrl, token } = await getChatKey(keyQuery)
|
|
|
|
|
|
+ const { data } = await getChatKey(keyQuery)
|
|
return {
|
|
return {
|
|
- uid, wsUrl, token
|
|
|
|
|
|
+ ...data
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -167,15 +168,8 @@ export const useIM = () => {
|
|
const IM = useIMStore()
|
|
const IM = useIMStore()
|
|
|
|
|
|
onMounted( async () => {
|
|
onMounted( async () => {
|
|
-
|
|
|
|
// 通过自身userId和企业id获取token和uid
|
|
// 通过自身userId和企业id获取token和uid
|
|
- const { uid, wsUrl, token } = await getKey()
|
|
|
|
- IM.setUid(uid)
|
|
|
|
- // 单机模式可以直接设置地址
|
|
|
|
- WKSDK.shared().config.addr = 'wss://' + wsUrl // 默认端口为5200
|
|
|
|
- // 认证信息
|
|
|
|
- WKSDK.shared().config.uid = uid // 用户uid(需要在悟空通讯端注册过)
|
|
|
|
- WKSDK.shared().config.token = token // 用户token (需要在悟空通讯端注册过)
|
|
|
|
|
|
+ await resetConfig()
|
|
// 连接状态监听
|
|
// 连接状态监听
|
|
WKSDK.shared().connectManager.addConnectStatusListener(connectStatusListener)
|
|
WKSDK.shared().connectManager.addConnectStatusListener(connectStatusListener)
|
|
// 常规消息监听
|
|
// 常规消息监听
|
|
@@ -216,6 +210,20 @@ export const useIM = () => {
|
|
IM.setUnreadCount(count)
|
|
IM.setUnreadCount(count)
|
|
console.log('未读消息总数', count)
|
|
console.log('未读消息总数', count)
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ async function resetConfig () {
|
|
|
|
+ const { uid, wssUrl, token } = await getKey()
|
|
|
|
+ console.log(uid, wssUrl, token)
|
|
|
|
+ IM.setUid(uid)
|
|
|
|
+ // 单机模式可以直接设置地址
|
|
|
|
+ WKSDK.shared().config.addr = 'wss://' + wssUrl// 默认端口为5200 + wsUrl
|
|
|
|
+ // 认证信息
|
|
|
|
+ WKSDK.shared().config.uid = uid // 用户uid(需要在悟空通讯端注册过)
|
|
|
|
+ WKSDK.shared().config.token = token // 用户token (需要在悟空通讯端注册过)
|
|
|
|
+ }
|
|
|
|
+ return {
|
|
|
|
+ resetConfig
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
export function initConnect (callback = () => {}) {
|
|
export function initConnect (callback = () => {}) {
|
|
@@ -320,7 +328,8 @@ export async function initChart (userId, enterpriseId) {
|
|
enterpriseId
|
|
enterpriseId
|
|
}
|
|
}
|
|
// 创建聊天频道
|
|
// 创建聊天频道
|
|
- const { uid } = await getChatKey(query)
|
|
|
|
|
|
+ const { data } = await getChatKey(query)
|
|
|
|
+ const { uid } = data
|
|
const _channel = new Channel(uid, ChannelTypePerson)
|
|
const _channel = new Channel(uid, ChannelTypePerson)
|
|
channel.value = _channel
|
|
channel.value = _channel
|
|
const conversation = WKSDK.shared().conversationManager.findConversation(_channel)
|
|
const conversation = WKSDK.shared().conversationManager.findConversation(_channel)
|