Commit 119f1481 by qlintonger xeno

眼镜端修复+2

parent e63942da
...@@ -333,15 +333,24 @@ export class AgoraHandle { ...@@ -333,15 +333,24 @@ export class AgoraHandle {
case 'Image': case 'Image':
case 'File': case 'File':
{ {
console.log('收到ws眼镜端消息点', msgData) console.log('收到ws眼镜端消息点', msgData);
if (msgData.msgData.msgId) {
break
}
const msgType = msgData.msgData.tip.endsWith('.mp4') ? 'ChatVideo' : const msgType = msgData.msgData.tip.endsWith('.mp4') ? 'ChatVideo' :
['.jpg', '.png', '.jpeg'].some(a=>msgData.msgData.tip.endsWith(a)) ? 'ChatImage' : ['.jpg', '.png', '.jpeg'].some(a=>msgData.msgData.tip.endsWith(a)) ? 'ChatImage' :
'ChatFile' 'ChatFile'
const msgDataWhich = { const msgDataWhich = {
tip: {
fileSize: 0, fileSize: 0,
fileType: msgType === 'ChatVideo' ? 'video' : msgType === 'ChatImage' ? 'image' : 'file', fileType: msgType === 'ChatVideo' ? 'video' : msgType === 'ChatImage' ? 'image' : 'file',
fileUrl: msgData.msgData.tip, fileUrl: msgData.msgData.tip,
fileName: msgData.msgData.tip.slice(msgData.msgData.tip.lastIndexOf('/') + 1) fileName: msgData.msgData.tip.slice(msgData.msgData.tip.lastIndexOf('/') + 1)
},
msgId: generateMessageId(),
quoteId: '',
fromName,
channelID: chatChannelState.value.chatChannelId
} }
this.AnyRemote.sendRaw( this.AnyRemote.sendRaw(
fromID, fromName, msgType, msgDataWhich, chatChannelState.value.chatChannelId, '-2' fromID, fromName, msgType, msgDataWhich, chatChannelState.value.chatChannelId, '-2'
...@@ -421,6 +430,7 @@ export class AgoraHandle { ...@@ -421,6 +430,7 @@ export class AgoraHandle {
} }
sendTextInChatRoom(text) { sendTextInChatRoom(text) {
const msgId = generateMessageId()
this.AnyRemote.sendWSFromCall( this.AnyRemote.sendWSFromCall(
'-2', '-2',
'ChatTxt', 'ChatTxt',
...@@ -429,14 +439,16 @@ export class AgoraHandle { ...@@ -429,14 +439,16 @@ export class AgoraHandle {
quoteId: '', quoteId: '',
channelID: chatChannelState.value.chatChannelId, channelID: chatChannelState.value.chatChannelId,
fromName: userStates.value.currentUserName, fromName: userStates.value.currentUserName,
msgId: generateMessageId() msgId
} }
) )
this.AnyRemote.sendWSFromCall( this.AnyRemote.sendWSFromCall(
'-2', '-2',
'Txt',
{ {
tip: text, tip: text,
channelID: chatChannelState.value.chatChannelId, channelID: chatChannelState.value.chatChannelId,
msgId
} }
) )
} }
...@@ -444,10 +456,11 @@ export class AgoraHandle { ...@@ -444,10 +456,11 @@ export class AgoraHandle {
sendImage(data) { sendImage(data) {
const channelID = chatChannelState.value.chatChannelId; const channelID = chatChannelState.value.chatChannelId;
const fromName = userStates.value.currentUserName const fromName = userStates.value.currentUserName
const msgId = generateMessageId()
this.AnyRemote.sendWSFromCall( this.AnyRemote.sendWSFromCall(
'-2', '-2',
'ChatImage', { 'ChatImage', {
msgId: generateMessageId(), msgId,
quoteId: "", quoteId: "",
channelID, channelID,
fromName, fromName,
...@@ -464,7 +477,8 @@ export class AgoraHandle { ...@@ -464,7 +477,8 @@ export class AgoraHandle {
'Image', 'Image',
{ {
tip: data.fileUrl, tip: data.fileUrl,
channelID channelID,
msgId
} }
) )
} }
...@@ -472,10 +486,11 @@ export class AgoraHandle { ...@@ -472,10 +486,11 @@ export class AgoraHandle {
sendFile(data) { sendFile(data) {
const channelID = chatChannelState.value.chatChannelId; const channelID = chatChannelState.value.chatChannelId;
const fromName = userStates.value.currentUserName const fromName = userStates.value.currentUserName
const msgId = generateMessageId()
this.AnyRemote.sendWSFromCall( this.AnyRemote.sendWSFromCall(
'-2', '-2',
'ChatFile', { 'ChatFile', {
msgId: generateMessageId(), msgId,
quoteId: "", quoteId: "",
channelID, channelID,
fromName, fromName,
...@@ -492,7 +507,8 @@ export class AgoraHandle { ...@@ -492,7 +507,8 @@ export class AgoraHandle {
'File', 'File',
{ {
tip: data.fileUrl, tip: data.fileUrl,
channelID channelID,
msgId
} }
) )
} }
...@@ -500,8 +516,9 @@ export class AgoraHandle { ...@@ -500,8 +516,9 @@ export class AgoraHandle {
sendVideo(data, fileType = 'video') { sendVideo(data, fileType = 'video') {
const channelID = chatChannelState.value.chatChannelId; const channelID = chatChannelState.value.chatChannelId;
const fromName = userStates.value.currentUserName const fromName = userStates.value.currentUserName
const msgId = generateMessageId()
const md = { const md = {
msgId: generateMessageId(), msgId,
quoteId: "", quoteId: "",
channelID, channelID,
fromName, fromName,
...@@ -521,7 +538,8 @@ export class AgoraHandle { ...@@ -521,7 +538,8 @@ export class AgoraHandle {
'File', 'File',
{ {
tip: data.fileUrl, tip: data.fileUrl,
channelID channelID,
msgId
} }
) )
} }
......
...@@ -106,7 +106,7 @@ const uploadMuFile = (option: any, type: string) => { ...@@ -106,7 +106,7 @@ const uploadMuFile = (option: any, type: string) => {
if (res.code == 200) { if (res.code == 200) {
console.log('发送内容', res) console.log('发送内容', res)
const dataFormed = { const dataFormed = {
fileUrl: res.data.url, fileUrl: res.data.oURL,
fileName: res.data.name, fileName: res.data.name,
fileSize: Number.parseInt(res.data.size), fileSize: Number.parseInt(res.data.size),
fileType: type fileType: type
...@@ -136,6 +136,7 @@ function convertURL(string: string) { ...@@ -136,6 +136,7 @@ function convertURL(string: string) {
} }
const mapChatMessageQueue = computed(function () { const mapChatMessageQueue = computed(function () {
console.log('mq here', chatChannelState.value.messageQueue)
return chatChannelState.value.messageQueue.map(function (a: any) { return chatChannelState.value.messageQueue.map(function (a: any) {
return { return {
isSelf: a.uid === userStates.value.currentUserId, isSelf: a.uid === userStates.value.currentUserId,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment