rt-sim-training-client/src/api/chat.js

313 lines
6.8 KiB
JavaScript
Raw Normal View History

2019-07-26 13:32:43 +08:00
import request from '@/utils/request';
export function postDataBd(data) {
2019-11-12 17:06:12 +08:00
return request({
url: `/api/audio/bd?group=${data.group}&conversationId=${data.conversationId}`,
method: 'post',
data: data.file
});
2019-07-26 13:32:43 +08:00
}
// 创建/获取会话id
export function getConversation(data) {
2019-11-12 17:06:12 +08:00
return request({
url: `/api/audio/conversation`,
method: 'get',
params: {
group: data.group,
userId: data.userId,
code: data.code
}
});
2019-07-26 13:32:43 +08:00
}
export function postDataXf(data) {
2019-11-12 17:06:12 +08:00
return request({
url: `/api/audio/xf`,
method: 'post',
data: data
});
2019-07-26 13:32:43 +08:00
}
// 获取语音历史记录
export function getHistoryVoice(code) {
2019-11-12 17:06:12 +08:00
return request({
url: `/api/audio/${code}/history`,
method: 'get'
});
2019-07-26 13:32:43 +08:00
}
// 文字聊天 发送文字
export function chatWithText(data, group) {
2019-11-12 17:06:12 +08:00
return request({
url: `/api/jointTraining/chatWithText?group=${group}`,
method: 'post',
data: {
message: data
}
});
2019-07-26 13:32:43 +08:00
}
// 文字聊天 发送文字
export function chatWithAudio(file, group) {
return request({
url: `/api/jointTraining/chatWithAudio?group=${group}`,
method: 'post',
data: file
});
}
2019-11-12 17:06:12 +08:00
// 生成分发二维码
2019-07-26 13:32:43 +08:00
export function getJoinTrainCode(data, group) {
2019-11-12 17:06:12 +08:00
return request({
url: `/api/jointTraining/qrCode?group=${group}`,
method: 'post',
data: data
});
2019-07-26 13:32:43 +08:00
}
// 创建房间
export function postCreateRoom(data) {
2019-11-12 17:06:12 +08:00
return request({
url: `/api/jointTraining/room`,
method: 'post',
data: data
});
2019-07-26 13:32:43 +08:00
}
// 检查房间存在
export function checkRoomExist(params) {
2019-11-12 17:06:12 +08:00
return request({
url: `/api/simulationRoom`,
method: 'get',
params
});
2019-07-26 13:32:43 +08:00
}
// 获取房间详情
export function postRoomDetail(group) {
2019-11-12 17:06:12 +08:00
return request({
url: `/api/jointTraining/room/${group}`,
method: 'get'
});
2019-07-26 13:32:43 +08:00
}
// 销毁房间
export function deljointTrainRoom(group) {
2019-11-12 17:06:12 +08:00
return request({
url: `/api/jointTraining/room`,
method: 'delete',
params: {
group: group
}
});
2019-07-26 13:32:43 +08:00
}
// 查询有权限房间列表
2020-01-17 14:20:31 +08:00
export function getjointTrainList(params) {
2019-11-12 17:06:12 +08:00
return request({
url: `/api/jointTraining/room/list`,
2020-01-17 14:20:31 +08:00
method: 'get',
params: params
2019-11-12 17:06:12 +08:00
});
2019-07-26 13:32:43 +08:00
}
// 加入房间
export function getjointTraining(group) {
2019-11-12 17:06:12 +08:00
return request({
url: `/api/jointTraining/room/join`,
method: 'put',
params: {
group: group
}
});
2019-07-26 13:32:43 +08:00
}
// 设置人员角色
export function putUserRoles(data, group) {
2019-11-12 17:06:12 +08:00
return request({
url: `/api/jointTraining/room/user/role?group=${group}`,
method: 'put',
data: data
});
2019-07-26 13:32:43 +08:00
}
2019-11-12 17:06:12 +08:00
// 获取房间里的用户列表
2019-07-26 13:32:43 +08:00
export function getJointTrainRoomUserList(group) {
2019-11-12 17:06:12 +08:00
return request({
url: `/api/jointTraining/room/${group}/user/list`,
method: 'get'
});
2019-07-26 13:32:43 +08:00
}
// 离开房间接口
export function putJointTrainingExit(group) {
2019-11-12 17:06:12 +08:00
return request({
url: `/api/jointTraining/room/exit`,
method: 'put',
params: {
group: group
}
});
2019-07-26 13:32:43 +08:00
}
// 开始联合演练
export function startJointTraining(group) {
2019-11-12 17:06:12 +08:00
return request({
url: `/api/jointTraining/room/simulation`,
method: 'post',
params: {
group: group
}
});
2019-07-26 13:32:43 +08:00
}
// 获取个人信息
export function getUserRoles(group) {
2019-11-12 17:06:12 +08:00
return request({
url: `/api/jointTraining/room/user/role`,
method: 'get',
params: {
group: group
}
});
2019-07-26 13:32:43 +08:00
}
// 踢出用户
export function putJointTrainingUserkicked(userId, group) {
2019-11-12 17:06:12 +08:00
return request({
url: `/api/jointTraining/room/user`,
method: 'put',
params: {
userId: userId,
group: group
}
});
2019-07-26 13:32:43 +08:00
}
// 管理员结束所有人的仿真
export function putJointTrainingSimulation(group) {
2019-11-12 17:06:12 +08:00
return request({
url: `/api/jointTraining/room/simulation/all`,
method: 'put',
params: {
group: group
}
});
2019-07-26 13:32:43 +08:00
}
// 结束仿真返回房间
export function putJointTrainingSimulationUser(group) {
2019-11-12 17:06:12 +08:00
return request({
url: `/api/jointTraining/room/simulation/user/exit`,
method: 'put',
params: {
group: group
}
});
2019-07-26 13:32:43 +08:00
}
// 进入仿真
export function putJointTrainingSimulationEntrance(group) {
2019-11-12 17:06:12 +08:00
return request({
url: `/api/jointTraining/room/simulation/user/entrance`,
method: 'put',
params: {
group: group
}
});
2019-07-26 13:32:43 +08:00
}
/**
* 权限获取(房间权限)
*/
export function getPermissionJoint(group) {
2019-11-12 17:06:12 +08:00
return request({
url: '/api/jointTraining/qrCode',
method: 'get',
params: {
group: group
}
});
2019-08-08 14:32:32 +08:00
}
2019-10-16 14:00:30 +08:00
2019-10-23 16:13:36 +08:00
// 添加或更新真实设备和仿真对象连接
2019-10-16 14:00:30 +08:00
export function setRealDevice(group, data) {
2019-11-12 17:06:12 +08:00
return request({
url: `/api/jointTraining/room/realDevice?group=${group}`,
method: 'post',
data: data
});
2019-10-16 14:00:30 +08:00
}
2019-10-23 16:13:36 +08:00
// 删除真实设备和仿真对象连接
export function delRealDevice(id, group) {
2019-11-12 17:06:12 +08:00
return request({
url: `/api/jointTraining/room/realDevice/${id}`,
method: 'delete',
params: { group: group }
});
2019-10-23 16:13:36 +08:00
}
// 获取真实设备列表
export function getRealDevices(group) {
2019-11-12 17:06:12 +08:00
return request({
url: `/api/jointTraining/room/${group}/devices`,
method: 'get'
});
2019-10-23 16:13:36 +08:00
}
2020-01-03 11:18:18 +08:00
// 获取房间真实设备连接关系
2020-03-16 15:29:26 +08:00
export function getRealDevicesInRoom(group) {
2020-01-03 11:18:18 +08:00
return request({
url: `/api/jointTraining/room/${group}/realDevice/connect`,
method: 'get'
});
}
// 更新真实设备的连接关系
2020-03-16 15:29:26 +08:00
export function updateRealDevices(group, data) {
2020-01-03 11:18:18 +08:00
return request({
url: `/api/jointTraining/room/${group}/realDevice`,
method: 'put',
data: data
});
}
2020-01-03 17:00:33 +08:00
// 真实设备是否被其他仿真使用
export function realDeviceIsUsed(group, projectCode) {
return request({
url: `/api/jointTraining/room/${group}/realDeviceUsed`,
method: 'get',
params: {
projectCode: projectCode
}
});
}
// 获取仿真成员列表(新版地图)
export function getSimulationMembersNew(group) {
return request({
url: `/simulation/${group}/members`,
method: 'get'
});
}
// 获取仿真会话列表(新版地图)
export function getSimulationConversationListNew(group) {
return request({
url: `/simulation/${group}/conversations`,
method: 'get'
});
}
// 获取/创建仿真会话(新版地图)
export function getSimulationConversationIdNew(params, group) {
return request({
url: `/simulation/${group}/wx/conversation`,
method: 'get',
params: params
});
}