Revert "Revert "Squashed commit of the following:""

This reverts commit b6edc491
This commit is contained in:
fan 2023-05-22 11:16:27 +08:00
parent 3fc6f13c6a
commit 67ea7ef5ae
5 changed files with 269 additions and 1 deletions

174
src/api/newChat.js Normal file
View File

@ -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
});
}

View File

@ -512,7 +512,9 @@ export default {
}, },
Conversation: { Conversation: {
CMD_Conversation_Chat_Text: {value: 'Conversation_Chat_Text', label: '发送文本消息'}, 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: { PSL: {
CMD_PSL_PRESS_BUTTON: {value: 'PSL_PRESS_BUTTON', label: 'PSL按钮操作'} CMD_PSL_PRESS_BUTTON: {value: 'PSL_PRESS_BUTTON', label: 'PSL按钮操作'}

View File

@ -120,6 +120,14 @@ const socket = {
conversationMessage: {}, conversationMessage: {},
controlTransfer: {}, controlTransfer: {},
operationModeApplyList: [], // 模式转换消息列表 operationModeApplyList: [], // 模式转换消息列表
conversationGroup: { // 群组
JOIN: {}, // 创建或加入群组
UPDATE_NAME: {}, // 更新名称
UPDATE_MEMBER: {}, // 更新群成员
EXIT: {}, // 退群
MESSAGE: {}, // 消息
MESSAGE_STATUS: {} // 消息状态
},
nccRunData: [] // ncc运行数据 nccRunData: [] // ncc运行数据
}, },
getters: { 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) => { handleNccRun: (state, list) => {
state.nccRunData = list; state.nccRunData = list;
} }
@ -649,6 +668,12 @@ const socket = {
operationModeApply: ({ commit }, message) => { operationModeApply: ({ commit }, message) => {
commit('operationModeApply', message); commit('operationModeApply', message);
}, },
setConversationGroup: ({ commit }, message) => {
commit('setConversationGroup', message);
},
resetConversationGroup: ({ commit }) => {
commit('resetConversationGroup');
},
handleNccRun: ({ commit }, message) => { handleNccRun: ({ commit }, message) => {
commit('handleNccRun', message); commit('handleNccRun', message);
} }

View File

@ -106,6 +106,9 @@ function handle(data) {
case 'Simulation_Member': case 'Simulation_Member':
store.dispatch('socket/memberChangeCountIncrease'); store.dispatch('socket/memberChangeCountIncrease');
break; break;
case 'Simulation_Conversation_Group':
store.dispatch('socket/setConversationGroup', msg);
break;
case 'Simulation_Time_Sync': case 'Simulation_Time_Sync':
store.dispatch('socket/setSimulationTimeSync', msg); store.dispatch('socket/setSimulationTimeSync', msg);
break; break;

View File

@ -0,0 +1,64 @@
<template>
<div v-quickMenuDrag class="voice-chat-box">
<div v-if="chatBoxMin" :id="sideButtonDom.domId" @click="clickBtn">
<el-button circle style="color: #0C161A;" icon="el-icon-mic" />
</div>
<chatDialog ref="chatDialog" />
</div>
</template>
<script>
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import {UserOperationType} from '@/scripts/ConstDic';
import chatDialog from './chatDialog';
export default {
name: 'ChatBox',
components: {
chatDialog
},
data() {
return {
};
},
computed:{
chatBoxMin() {
return this.$store.state.training.chatBoxMin;
},
sideButtonDom() {
return OperationEvent.Conversation.Chat.sideButton;
}
},
watch: {
},
mounted() {
},
methods: {
clickBtn() {
const operate = {
operation: this.sideButtonDom.operation,
param: { chatBoxMin: this.chatBoxMin },
userOperationType: UserOperationType.LEFTCLICK
};
this.$store.dispatch('training/setChatBoxMin', false);
this.$refs.chatDialog.dialogVisible = true;
if (this.$store.state.trainingNew.trainingSwitch) {
this.$nextTick(() => {
this.$store.dispatch('trainingNew/next', operate);
});
}
}
}
};
</script>
<style lang="scss" scoped>
.voice-chat-box {
position: absolute;
left: 20px;
bottom: 50%;
height: 1px;
width: 1px;
z-index: 2000;
}
</style>