mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-07 13:41:42 +08:00
init project
This commit is contained in:
45
public/react/src/services/commentService.js
Normal file
45
public/react/src/services/commentService.js
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* @Description: 评论 service
|
||||
* @Author: tangjiang
|
||||
* @Github:
|
||||
* @Date: 2019-12-23 10:43:27
|
||||
* @LastEditors : tangjiang
|
||||
* @LastEditTime : 2019-12-25 10:50:24
|
||||
*/
|
||||
import axios from 'axios';
|
||||
|
||||
// 添加评论
|
||||
export async function fetchAddComment (identifier, params) {
|
||||
const url = `/problems/${identifier}/comments.json`;
|
||||
return axios.post(url, params);
|
||||
}
|
||||
|
||||
// 获取评论列表
|
||||
export async function fetchCommentLists (identifier, params) {
|
||||
const url = `/problems/${identifier}/comments.json`;
|
||||
return axios.get(url, {params});
|
||||
}
|
||||
|
||||
// 添加子评论
|
||||
export async function fetchAddChildComment (identifier, params) {
|
||||
const url = `/problems/${identifier}/comments/reply.json`;
|
||||
return axios.post(url, params);
|
||||
}
|
||||
|
||||
// 删除评论
|
||||
export async function fetchDeleteComment (identifier, id) {
|
||||
const url = `/problems/${identifier}/comments/${id}.json`;
|
||||
return axios.delete(url);
|
||||
}
|
||||
|
||||
// 点赞
|
||||
export async function fetchLikeComment (id, params) {
|
||||
const url = `/discusses/${id}/plus.json`;
|
||||
return axios.post(url, params);
|
||||
}
|
||||
|
||||
// 显示或隐藏
|
||||
export async function fetchShowOrHideComment (identifier, id, params) {
|
||||
const url = `/problems/${identifier}/comments/${id}/hidden.json`;
|
||||
return axios.post(url, params);
|
||||
}
|
||||
54
public/react/src/services/jupyterServer.js
Normal file
54
public/react/src/services/jupyterServer.js
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* @Description: jupyter相关接口
|
||||
* @Author: tangjiang
|
||||
* @Github:
|
||||
* @Date: 2019-12-12 09:07:07
|
||||
* @LastEditors: tangjiang
|
||||
* @LastEditTime: 2019-12-13 16:00:45
|
||||
*/
|
||||
import axios from 'axios';
|
||||
|
||||
// 获取 jupyter实训相关的内容
|
||||
export async function fetchJupyterInfo (identifier) {
|
||||
const url = `/tasks/${identifier}/jupyter.json`;
|
||||
return axios.get(url);
|
||||
}
|
||||
// 获取数据集
|
||||
export async function fetchJupyterTpiDataSet (identifier, params) {
|
||||
const url = `/shixuns/${identifier}/get_data_sets.json`;
|
||||
return axios.get(url, { params });
|
||||
}
|
||||
// 获取 tpi url
|
||||
export async function fetchJupyterTpiUrl (params) {
|
||||
const url = `/jupyters/get_info_with_tpi.json`;
|
||||
return axios.get(url, { params });
|
||||
}
|
||||
// 同步代码功能
|
||||
export async function fetchSyncJupyterCode (identifier) {
|
||||
const url = `/myshixuns/${identifier}/sync_code.json`;
|
||||
return axios.post(url);
|
||||
}
|
||||
// jupyter 保存
|
||||
export async function fetchSaveJupyterTpi (params) {
|
||||
const url = `/jupyters/save_with_tpi.json`;
|
||||
return axios.get(url, { params });
|
||||
}
|
||||
|
||||
//重置jupyter 环境
|
||||
export async function fetchreset_with_tpi (params) {
|
||||
const url = `/jupyters/reset_with_tpi.json`;
|
||||
return axios.get(url, { params });
|
||||
}
|
||||
|
||||
//延时jupyter
|
||||
export async function fetactive_with_tpi(params) {
|
||||
const url = `/jupyters/active_with_tpi.json`;
|
||||
return axios.get(url, { params });
|
||||
}
|
||||
|
||||
|
||||
//获取tpi重置实训的time
|
||||
export async function timeinfo_with_tpis(params){
|
||||
const url = `/jupyters/timeinfo_with_tpi.json`;
|
||||
return axios.get(url, { params });
|
||||
}
|
||||
157
public/react/src/services/ojService.js
Normal file
157
public/react/src/services/ojService.js
Normal file
@@ -0,0 +1,157 @@
|
||||
/*
|
||||
* @Description: 开发者社区接口
|
||||
* @Author: tangjiang
|
||||
* @Github:
|
||||
* @Date: 2019-11-20 10:55:38
|
||||
* @LastEditors : tangjiang
|
||||
* @LastEditTime : 2020-01-07 15:23:19
|
||||
*/
|
||||
|
||||
import axios from 'axios';
|
||||
|
||||
export async function fetchOJList (params) {
|
||||
// console.log('传递的参数: ', params);
|
||||
const obj = {};
|
||||
Object.keys(params).forEach(key => {
|
||||
if (params[key]) {
|
||||
obj[key] = params[key];
|
||||
}
|
||||
});
|
||||
return axios.get('/problems.json', { params: obj });
|
||||
}
|
||||
|
||||
// 删除OJ列表
|
||||
export async function fetchDeleteOJItem (identifier) {
|
||||
const url = `/problems/${identifier}.json`;
|
||||
return axios.delete(url);
|
||||
}
|
||||
|
||||
// 提交
|
||||
export async function fetchPostOjForm (paramsObj) {
|
||||
const { params, submitType, identifier } = paramsObj;
|
||||
const url = submitType === 'add' ? `/problems.json` : `/problems/${identifier}.json`;
|
||||
// return axios.post(url, params);
|
||||
// if (identifier) {
|
||||
// return axios.post(url, params);
|
||||
// } else {
|
||||
// return
|
||||
// }
|
||||
return identifier ? axios.put(url, params) : axios.post(url, params);
|
||||
}
|
||||
|
||||
// 根据id号获取OJ信息
|
||||
export async function fetchGetOjById (id) {
|
||||
const url = `/problems/${id}/edit.json`;
|
||||
return axios.get(url);
|
||||
}
|
||||
|
||||
// 调试代码
|
||||
export async function fetchDebuggerCode (identifier, params) {
|
||||
const url = `/myproblems/${identifier}/code_debug.json`;
|
||||
return axios.get(url, {params});
|
||||
}
|
||||
|
||||
// 调试代码成功后,循环调用提交接口
|
||||
export async function fetchCodeSubmit (identifier, params) {
|
||||
const url = `/myproblems/${identifier}/result.json`;
|
||||
return axios.get(url, {params});
|
||||
}
|
||||
|
||||
// 开启编程题接口
|
||||
export async function fetchStartProgram (identifier) {
|
||||
const url = `/problems/${identifier}/start.json`;
|
||||
return axios.get(url);
|
||||
}
|
||||
|
||||
// 用户编程题详情
|
||||
export async function fetchUserProgramDetail (identifier) {
|
||||
const url = `/myproblems/${identifier}.json`;
|
||||
return axios.get(url);
|
||||
}
|
||||
|
||||
// 获取提交记录
|
||||
export async function fetchUserCommitRecord (identifier, params) {
|
||||
// console.log('identifier=====', identifier);
|
||||
const url = `/myproblems/${identifier}/submit_records.json`;
|
||||
return axios.get(url, { params });
|
||||
}
|
||||
|
||||
// 获取提交记录详情
|
||||
export async function fetchUserCommitRecordDetail (identifier) {
|
||||
const url = `/myproblems/record_detail.json`;
|
||||
const params = {id: identifier};
|
||||
return axios.get(url, {params});
|
||||
}
|
||||
|
||||
// 恢复初始代码
|
||||
// export async function restoreInitialCode (identifier) {
|
||||
// const url = `/myproblems/${identifier}/restore_initial_code.json`;
|
||||
// return axios.get(url);
|
||||
// }
|
||||
|
||||
// 发布任务
|
||||
export async function publishTask (identifier) {
|
||||
const url = `/problems/${identifier}/publish.json`;
|
||||
return axios.post(url);
|
||||
}
|
||||
|
||||
// 撤销发布
|
||||
export async function cancelPublicTask (identifier) {
|
||||
const url = `/problems/${identifier}/cancel_publish.json`;
|
||||
return axios.post(url);
|
||||
}
|
||||
|
||||
// 更新用户编辑代码
|
||||
export async function fetchUpdateCode (identifier, params) {
|
||||
const url = `/myproblems/${identifier}/update_code.json`;
|
||||
return axios.post(url, params);
|
||||
}
|
||||
|
||||
// 用户提交代码
|
||||
export async function fetchUserCodeSubmit (identifier) {
|
||||
const url = `/myproblems/${identifier}/code_submit.json`;
|
||||
return axios.get(url);
|
||||
}
|
||||
|
||||
// 恢复初始代码
|
||||
export async function fetchRestoreInitialCode (identifier) {
|
||||
// const url = `/myproblems/${identifier}/restore_initial_code.json`;
|
||||
const url = `/myproblems/${identifier}/sync_code.json`;
|
||||
return axios.post(url);
|
||||
}
|
||||
|
||||
// 新建时调用获取用户信息接口
|
||||
export async function fetchUserInfoForNew () {
|
||||
const url = `/problems/new.json`;
|
||||
return axios.get(url);
|
||||
}
|
||||
|
||||
// 文件上传
|
||||
export async function fetchUploadImage (file) {
|
||||
const url = `/attachments.json`;
|
||||
return axios.post(url, file)
|
||||
}
|
||||
|
||||
// 根据id号获取图片url
|
||||
export async function fetchUploadImageUrl (id) {
|
||||
const url = `/attachments/${id}`;
|
||||
return axios.get(url);
|
||||
}
|
||||
|
||||
// 添加笔记
|
||||
export async function fetchAddNotes (identifier, params) {
|
||||
const url = `/myproblems/${identifier}/add_notes.json`;
|
||||
return axios.post(url, params);
|
||||
}
|
||||
|
||||
// 获取课程体系
|
||||
export async function fetchQuestion (params) {
|
||||
const url = `/disciplines.json`;
|
||||
return axios.get(url, { params });
|
||||
}
|
||||
|
||||
// 新增选题
|
||||
export async function fetchTagDisciplines (params) {
|
||||
const url = `/tag_disciplines.json`;
|
||||
return axios.post(url, params);
|
||||
}
|
||||
14
public/react/src/services/staticService.js
Normal file
14
public/react/src/services/staticService.js
Normal file
@@ -0,0 +1,14 @@
|
||||
import axios from "axios";
|
||||
|
||||
/*
|
||||
* @Description:
|
||||
* @Author: tangjiang
|
||||
* @Github:
|
||||
* @Date: 2020-01-14 09:40:53
|
||||
* @LastEditors : tangjiang
|
||||
* @LastEditTime : 2020-01-14 10:47:19
|
||||
*/
|
||||
export async function fetchStaticList (id, params) {
|
||||
const url = `/paths/${id}/statistics_info.json`;
|
||||
return axios.get(url, { params });
|
||||
}
|
||||
75
public/react/src/services/wxcodeService.js
Normal file
75
public/react/src/services/wxcodeService.js
Normal file
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* @Description:
|
||||
* @Author: tangjiang
|
||||
* @Github:
|
||||
* @Date: 2020-01-15 15:44:36
|
||||
* @LastEditors : tangjiang
|
||||
* @LastEditTime : 2020-01-17 20:39:13
|
||||
*/
|
||||
import axios from 'axios';
|
||||
import cookie from 'react-cookies'
|
||||
// axios.defaults.withCredentials = true;
|
||||
|
||||
|
||||
const setCookier = () => {
|
||||
// const _params = window.location.search;
|
||||
// if (_params) {
|
||||
// let _search = _params.split('?')[1];
|
||||
// _search.split('&').forEach(item => {
|
||||
// // console.log(item);
|
||||
// const _arr = item.split('=');
|
||||
// cookie.remove(_arr[0], {
|
||||
// path: '/',
|
||||
// domain: '.educoder.net'
|
||||
// });
|
||||
// cookie.save(_arr[0], _arr[1], { domain: '.educoder.net', path: '/'});
|
||||
// });
|
||||
// }
|
||||
}
|
||||
|
||||
// 获取代码块
|
||||
export async function fetchWxCode (identifier, params) {
|
||||
setCookier();
|
||||
const url = `/tasks/${identifier}/rep_content.json`;
|
||||
params = Object.assign({}, params, {withCredentials: true});
|
||||
return axios.get(url, {params});
|
||||
}
|
||||
|
||||
// 获取测试值
|
||||
export async function fetchWxCodeTextCase (identifier) {
|
||||
setCookier();
|
||||
const url = `/tasks/${identifier}.json`;
|
||||
const params = Object.assign({}, {withCredentials: true});
|
||||
return axios.get(url, {params});
|
||||
}
|
||||
|
||||
// 更新代码块内容
|
||||
export async function fetchUpdateWxCode (identifier, params) {
|
||||
setCookier();
|
||||
// /myshixuns/8etu3pilsa/update_file.json
|
||||
const url = `/myshixuns/${identifier}/update_file.json`;
|
||||
params = Object.assign({}, params, {withCredentials: true});
|
||||
return axios.post(url, params);
|
||||
}
|
||||
|
||||
// 恢复初始化
|
||||
export async function fetchRestoreWxCode (identifier, params) {
|
||||
setCookier();
|
||||
const url = `/tasks/${identifier}/reset_original_code.json`;
|
||||
params = Object.assign({}, params, {withCredentials: true});
|
||||
return axios.get(url, {params});
|
||||
}
|
||||
// 评测
|
||||
export async function fetchWxCodeGameBuild (identifier, params) {
|
||||
setCookier();
|
||||
const url = `/tasks/${identifier}/game_build.json`;
|
||||
params = Object.assign({}, params, {withCredentials: true});
|
||||
return axios.get(url, {params});
|
||||
}
|
||||
|
||||
export async function fetchWxCodeGameStatus (identifier, params) {
|
||||
setCookier();
|
||||
const url = `/tasks/${identifier}/game_status.json`;
|
||||
params = Object.assign({}, params, {withCredentials: true});
|
||||
return axios.get(url, {params});
|
||||
}
|
||||
Reference in New Issue
Block a user