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

196 lines
3.6 KiB
JavaScript
Raw Normal View History

2019-07-25 10:30:30 +08:00
import request from '@/utils/request';
/** 清除实训数据*/
export function clearTraining(args) {
return request({
url: `/api/training/${args.id}`,
method: 'delete'
});
}
/** 开始实训*/
export function startTraining(args, group) {
return request({
url: `/api/training/${args.id}/start`,
method: 'get',
params: {
group
}
});
}
/** 实训结束*/
export function endTraining(args, group) {
return request({
url: `/api/training/${args.lessonId}/${args.id}/end`,
method: 'get',
params: {
mode: args.mode,
usedTime: args.usedTime,
group
}
});
}
/** 发送步骤数据*/
export function sendTrainingNextStep(data, group) {
return request({
url: `/api/training/${data.trainingId}/nextStep`,
method: 'post',
data: data.operate,
params: {
group
}
});
}
/** 获取实训树*/
export function getTrainingTree() {
return request({
url: `/api/training/tree`,
method: 'get'
});
}
/** 获取章节基本信息*/
2019-08-29 17:16:33 +08:00
export function getTrainingDetail(trainingId) {
2019-07-25 10:30:30 +08:00
return request({
2019-08-29 17:16:33 +08:00
url: `/api/training/${trainingId}`,
2019-07-25 10:30:30 +08:00
method: 'get'
});
}
/** 添加实训*/
export function addTraining(data) {
return request({
url: '/api/training',
method: 'post',
data: data
});
}
/** 更新实训*/
export function updateTraining(data) {
return request({
url: `/api/training/${data.id}`,
method: 'put',
data: data
});
}
/** 保存实训初始状态*/
export function saveTrainingInitStatus(data, group) {
return request({
url: `/api/training/${data.id}/detailSave?group=${group}`,
method: 'post',
data: data
});
}
/** 保存实训步骤数据*/
export function saveTrainingStepsData(data) {
return request({
url: `/api/training/${data.id}/stepsSave`,
method: 'post',
data: data
});
}
/** 获取实训步骤数据*/
export function getTrainingStepsDetail(trainingId, params) {
return request({
url: `/api/training/${trainingId}/detail`,
method: 'get',
params: params
});
}
/** 查询实训列表*/
export function pageQueryTraining(params) {
return request({
url: `/api/training/pagedQuery`,
method: 'get',
params: params
});
}
/** 自动生成实训操作*/
export function addAutoTraining(data) {
return request({
url: `/api/training/generate`,
method: 'post',
data: data
});
}
/** 修改自动删除实训操作*/
export function updateAutoTraining(data) {
return request({
url: `/api/training/batchUpdateGenerate`,
method: 'put',
data: data
});
}
/** 删除自动生成实训*/
export function deleteAutoTraining(params) {
return request({
url: `/api/training/generate`,
method: 'delete',
params: params
});
}
2019-08-08 14:32:32 +08:00
/** 获取用户实训列表*/
2019-07-25 10:30:30 +08:00
export function getTrainingList(data) {
return request({
url: `/api/training/list`,
method: 'get',
params: data
});
}
export function sendCommand(group, command) {
return request({
url: `/api/training/deviceChange?group=${group}`,
method: 'put',
data: {
param: command.val,
type: command.type,
code: command.code,
operation: command.operation
}
});
}
export function updateLesson(data) {
return request({
url: `/api/training/userTraining/${data.id}`,
method: 'put',
data: data
});
}
// 添加用户实训数据
export function addUserTraining(data) {
return request({
url: `/api/training/userTraining`,
method: 'post',
data: data
});
}
// 更新用户实训数据
export function putUserTraining(data) {
return request({
url: `/api/training/userTraining/${data.id}`,
method: 'put',
data: data
});
}
// 清除实训数据
export function deleteUserTraining(statsId) {
return request({
url: `/api/training/userTraining/${statsId}`,
2019-08-08 14:32:32 +08:00
method: 'delete'
2019-07-25 10:30:30 +08:00
});
2019-08-08 14:32:32 +08:00
}