diff --git a/src/api/newChat.js b/src/api/newChat.js new file mode 100644 index 000000000..3e7f3ca06 --- /dev/null +++ b/src/api/newChat.js @@ -0,0 +1,174 @@ + +import request from '@/utils/request'; + +/** + * 获取群列表 + * @param {String} groupId 房间号 + * @returns + */ +export function getGroupList(groupId) { + return request({ + url: `/api/simulation/${groupId}/conversation/group/list`, + method: 'get' + }); +} + +/** + * 创建群 + * @param {String} groupId 房间号 + * @param {String} data + * @param {String} data.name 群组名称 + * @param {String} data.imageUrl 群组头像 + * @param {Array} data.memberIds 角色id列表 + * @returns + */ +export function createGroup(groupId, data) { + return request({ + url: `/simulation/${groupId}/operate/Conversation_Group_Create`, + method: 'post', + data + }); +} + +/** + * 修改群组名称 + * @param {String} groupId 房间号 + * @param {Object} data + * @param {String} data.id 群组id + * @param {String} data.name 群组名称 + * @returns + */ +export function updateGroupName(groupId, data) { + return request({ + url: `/simulation/${groupId}/operate/Conversation_Group_Update_Name`, + method: 'post', + data + }); +} + +/** + * 修改群组群主 + * @param {String} groupId 房间号 + * @param {Object} data + * @param {Number} data.id 群组id + * @param {String} data.memberId 角色id + * @returns + */ +export function updateGroupLeader(groupId, data) { + return request({ + url: `/simulation/${groupId}/operate/Conversation_Group_Update_Leader`, + method: 'post', + data + }); +} + +/** + * 邀请人员入群 + * @param {String} groupId 房间号 + * @param {Object} data + * @param {Number} data.id 群组id + * @param {Array} data.memberIds 角色id列表 + * @returns + */ +export function inviteMemberToGroup(groupId, data) { + return request({ + url: `/simulation/${groupId}/operate/Conversation_Group_Invite_Member`, + method: 'post', + data + }); +} + +/** + * 移除群内人员 + * @param {String} groupId 房间号 + * @param {Object} data + * @param {Number} data.id 群组id + * @param {Array} data.memberIds 角色id列表 + * @returns + */ +export function removeMemberFromGroup(groupId, data) { + return request({ + url: `/simulation/${groupId}/operate/Conversation_Group_Remove_Member`, + method: 'post', + data + }); +} + +/** + * 退出群组 + * @param {String} groupId 房间号 + * @param {Object} data + * @param {Number} data.id 群组id + * @returns + */ +export function exitGroup(groupId, data) { + return request({ + url: `/simulation/${groupId}/operate/Conversation_Group_Exit`, + method: 'post', + data + }); +} + +/** + * 解散群组 + * @param {String} groupId 房间号 + * @param {Object} data + * @param {Number} data.id 群组id + * @returns + */ +export function dissolveGroup(groupId, data) { + return request({ + url: `/simulation/${groupId}/operate/Conversation_Group_Dissolve`, + method: 'post', + data + }); +} + +/** + * 发送语音信息 + * @param {String} groupId 房间号 + * @param {Object} data + * @param {Number} data.id 群组id + * @param {String} data.audioPath 文件地址 + * @param {String} data.content 语音内容 + * @returns + */ +export function sendAudio(groupId, data) { + return request({ + url: `/simulation/${groupId}/operate/Conversation_Group_Audio_Chat`, + method: 'post', + data + }); +} + +/** + * 发送文字信息 + * @param {String} groupId 房间号 + * @param {Object} data + * @param {Number} data.id 群组id + * @param {String} data.content 文字内容 + * @returns + */ +export function sendText(groupId, data) { + return request({ + url: `/simulation/${groupId}/operate/Conversation_Group_Text_Chat`, + method: 'post', + data + }); +} + +/** + * 发送BASE64信息 + * @param {String} groupId 房间号 + * @param {Object} data + * @param {Number} data.id 群组id + * @param {String} data.fileBase64Str 文件base64码 + * @returns + */ +export function sendBase64(groupId, data) { + return request({ + url: `/simulation/${groupId}/operate/Conversation_Group_Audio_Base64`, + method: 'post', + data + }); +} diff --git a/src/scripts/cmdPlugin/CommandEnum.js b/src/scripts/cmdPlugin/CommandEnum.js index 25858ea20..f3a89f7b7 100644 --- a/src/scripts/cmdPlugin/CommandEnum.js +++ b/src/scripts/cmdPlugin/CommandEnum.js @@ -512,7 +512,9 @@ export default { }, Conversation: { CMD_Conversation_Chat_Text: {value: 'Conversation_Chat_Text', label: '发送文本消息'}, - CMD_Conversation_Chat_Audio_Base64: {value: 'Conversation_Chat_Audio_Base64', label: '发送语音消息'} + CMD_Conversation_Chat_Audio_Base64: {value: 'Conversation_Chat_Audio_Base64', label: '发送语音消息'}, + CMD_Conversation_Group_Text_Chat: {value: 'Conversation_Group_Text_Chat', label: '发送会话群文字消息'}, + CMD_Conversation_Group_Audio_Base64: {value: 'Conversation_Group_Audio_Base64', label: '发送会话群语音消息'} }, PSL: { CMD_PSL_PRESS_BUTTON: {value: 'PSL_PRESS_BUTTON', label: 'PSL按钮操作'} diff --git a/src/store/modules/socket.js b/src/store/modules/socket.js index cb0d1c3e7..6b47d4722 100644 --- a/src/store/modules/socket.js +++ b/src/store/modules/socket.js @@ -120,6 +120,14 @@ const socket = { conversationMessage: {}, controlTransfer: {}, operationModeApplyList: [], // 模式转换消息列表 + conversationGroup: { // 群组 + JOIN: {}, // 创建或加入群组 + UPDATE_NAME: {}, // 更新名称 + UPDATE_MEMBER: {}, // 更新群成员 + EXIT: {}, // 退群 + MESSAGE: {}, // 消息 + MESSAGE_STATUS: {} // 消息状态 + }, nccRunData: [] // ncc运行数据 }, getters: { @@ -408,6 +416,17 @@ const socket = { } }); }, + setConversationGroup: (state, message) => { + if (state.conversationGroup[message.messageType] !== undefined) { + state.conversationGroup[message.messageType] = message; + } + }, + resetConversationGroup: (state) => { + const arr = ['JOIN', 'UPDATE_NAME', 'UPDATE_MEMBER', 'EXIT', 'MESSAGE', 'MESSAGE_STATUS']; + arr.forEach(key => { + state.conversationGroup[key] = {}; + }); + }, handleNccRun: (state, list) => { state.nccRunData = list; } @@ -649,6 +668,12 @@ const socket = { operationModeApply: ({ commit }, message) => { commit('operationModeApply', message); }, + setConversationGroup: ({ commit }, message) => { + commit('setConversationGroup', message); + }, + resetConversationGroup: ({ commit }) => { + commit('resetConversationGroup'); + }, handleNccRun: ({ commit }, message) => { commit('handleNccRun', message); } diff --git a/src/utils/subscribeCallback.js b/src/utils/subscribeCallback.js index 087ba063a..d7b3254fa 100644 --- a/src/utils/subscribeCallback.js +++ b/src/utils/subscribeCallback.js @@ -106,6 +106,9 @@ function handle(data) { case 'Simulation_Member': store.dispatch('socket/memberChangeCountIncrease'); break; + case 'Simulation_Conversation_Group': + store.dispatch('socket/setConversationGroup', msg); + break; case 'Simulation_Time_Sync': store.dispatch('socket/setSimulationTimeSync', msg); break; diff --git a/src/views/newMap/display/newChat/index.vue b/src/views/newMap/display/newChat/index.vue new file mode 100644 index 000000000..5f8c99c71 --- /dev/null +++ b/src/views/newMap/display/newChat/index.vue @@ -0,0 +1,64 @@ + + + + + +