From 757f661a222954a8a4456e53c04a22af2a0fb830 Mon Sep 17 00:00:00 2001 From: joylink_zhaoerwei Date: Tue, 20 Feb 2024 18:16:50 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AB=9E=E8=B5=9B=E4=BB=BB=E5=8A=A1api?= =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/contest.js | 72 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/src/api/contest.js b/src/api/contest.js index e69de29bb..cb33ac55e 100644 --- a/src/api/contest.js +++ b/src/api/contest.js @@ -0,0 +1,72 @@ +import request from '@/utils/request'; + +/** 查看所有任务数据 */ +export function getTaskTreeDatas() { + return request({ + url: '/api/exercise/race/task/tree', + method: 'GET' + }); +} + +/** + * 创建任务 + * @param {Object} data + * @param {String} data.name 任务名称 + * @param {String} data.desc 基础描述 + * @param {String} data.content 考核内容 + * @param {String} data.standards 评价标准 + * @param {Number} data.parentId 如果是子任务,需要父任务的id + */ +export function createTask(data) { + return request({ + url: '/api/exercise/race/task', + method: 'POST', + data + }); +} + +/** 修改指定任务 + * @param {Object} data 同创建任务 + * @param {Number} data.id 任务id + */ +export function editTask(data) { + return request({ + url: `/api/exercise/race/task/${data.id}`, + method: 'POST', + data + }); +} + +/** 删除指定任务 + * @param {Number} id 任务id + */ +export function deleteTask(id) { + return request({ + url: `/api/exercise/race/task/${id}`, + method: 'DELETE' + }); +} + +/** 查看指定子任务 + * @param {Number} id 任务id + */ +export function getchildrenTaskDatas(id) { + return request({ + url: `/api/exercise/race/task/${id}/children`, + method: 'GET' + }); +} + +/** 任务绑定 + * @param {Object} data + * @param {Number} data.taskId 任务名称 + * @param {Number} data.bindId 绑定id,根据bindtype来区分对应的id + * @param {String} data.bindType rule =评分规则;scene=场景 + */ +export function bindTask(data) { + return request({ + url: '/api/exercise/race/task/bind', + method: 'POST', + data + }); +}