|
|
var _config = require("../config");
|
|
|
//console.log(_config);
|
|
|
export const baseUrl = _config.apiRoot;
|
|
|
export const query = {randomcode:null, client_key:null};
|
|
|
export const config = {method:"POST"};
|
|
|
//undefined: optional, null: required, other values: default
|
|
|
//we use
|
|
|
|
|
|
const apiConfig = {
|
|
|
demo:{url:"{demo}", query:{}, form:{},config:{method:"GET",header:{}},data:"",disp:"", struct:""},
|
|
|
|
|
|
accounts:{
|
|
|
login:{query, form:{autologin:1,login:null, password:null}, config},
|
|
|
logout:{query},
|
|
|
get_verification_code:{query, form:{login:null, type:null, smscode:null},data:{type:["1|注册","2|重置密码"]}},
|
|
|
register: { query,form: {login: null, password: null, code: null }, config},
|
|
|
reset_password: {query,form: {login: null, new_password: null, new_password_confirmation: null, code:null }, config },
|
|
|
valid_email_and_phone: { query,form: {login: null, type: 1 } },
|
|
|
},
|
|
|
|
|
|
attachments:{url:{_:1,DELETE:'*/{attachment_id}',uploadFile:"*"},query,form:{_:1,uploadFile:{file:null},DELETE:{}},config:{method:"uploadFile", name:"file"}},
|
|
|
|
|
|
courses:{query, form:{_:1,GET:{search:"",limit:20, page:1, order:"all"}, POST:{course_list_name:null,name:null,school: null,end_date: null,class_period:null,credit:null,course_module_types:["shixun_homework","common_homework","group_homework","exercise","attachment","course_group"],authentication:null,professional_certification:null}},
|
|
|
apply_to_join_course:{query,form:{invite_code:null, professor:void 0,assistant_professor:void 0,student:void 0}, config},
|
|
|
exercises:{url:"{course_id}/*", query, form:{_:1, GET:{page:1,exercise_status:"",limit:15},POST:{exercise_name:null, exercise_description:""}},
|
|
|
publish:{url:"../{course_id}/exercises/*",query,form:{check_ids: null, end_time:null},config},
|
|
|
},
|
|
|
exit_course:{url:"{course_id}/*",query,config},
|
|
|
homework_commons:{url:"{course_id}/*",query, form:{type:null, page:1, order:""}, disp:"普通作业|实训作业", data:{order:"无:全部,0:未发布,1:提交中,2:补交中, 3:匿评,4:申诉,5:已截止"}},
|
|
|
left_banner:{url:"{course_id}/*",query},
|
|
|
top_banner:{url:"{course_id}/*", query},
|
|
|
set_invite_code_halt:{url:"{course_id}/*", query, config, disp:"停用或启用邀请码"},
|
|
|
students:{url:"{course_id}/*",query, form:{order:1,sort:"asc",page:1, limit:20, course_group_id:""}},
|
|
|
search_slim:{},
|
|
|
switch_to_assistant: { url: "{course_id}/*", query ,config},
|
|
|
switch_to_student:{url:"{course_id}/*",query, config},
|
|
|
switch_to_teacher:{url:"{course_id}/*",query, config}
|
|
|
},
|
|
|
|
|
|
course_modules:{
|
|
|
sticky_module:{url:"{module_id}/*", query}
|
|
|
},
|
|
|
|
|
|
exercises:{url:"{exercise_id}",query,form:{exercise_name:null, exercise_description:""},config:{method:"PUT"},
|
|
|
common_header:{url:"{exercise_id}/*", query},
|
|
|
commit_exercise:{url:"{exercise_id}/*",query,form:{commit_method:1},config},
|
|
|
begin_commit:{url:"{exercise_id}/*",query},
|
|
|
edit:{url:"{exercise_id}/*", query},
|
|
|
exercise_setting:{url:"{exercise_id}/*", query},
|
|
|
exercise_lists:{url:"{exercise_id}/*",query, form:{order:"end_at", search:""}},
|
|
|
exercise_result:{url:"{exercise_id}/*", query, form:{sort:"asc", page:1, limit:50}},
|
|
|
exercise_questions: { url: "{exercise_bank_id}/*", query, form: { exercise_bank_id: null, question_title: null, question_type: null, question_score: null, question_choices: null, standard_answers:null},config,disp:"新建题目"},
|
|
|
publish_groups:{url:"{exercise_id}/*", query, disp:"??"},
|
|
|
start_answer:{url:"{exercise_id}/*", query},
|
|
|
},
|
|
|
|
|
|
exercise_questions: {
|
|
|
url: "{question_id}", query, form: { exercise_bank_id: null, question_title: null, question_type: null, question_score: null, question_choices: null, standard_answers: null},config:{method:"PUT"},disp:"更改题目",
|
|
|
exercise_answers: { url: "{question_id}/*", query, form: { exercise_choice_id: void 0, answer_text: void 0}, config, disp: "答题"}
|
|
|
},
|
|
|
|
|
|
disciplines:{
|
|
|
|
|
|
},
|
|
|
|
|
|
files:{query, form:{course_id:null, page_size:15, page:1,search:"",sort:0, sort_type:"created_on"},
|
|
|
upload:{query, form:{course_id:null,course_second_category_id:null,attachment_ids:null,is_public:false,delay_publish:0} ,config},
|
|
|
},
|
|
|
|
|
|
helps:{
|
|
|
aboud:{query},
|
|
|
},
|
|
|
|
|
|
home:{
|
|
|
index:{query},
|
|
|
},
|
|
|
|
|
|
homework_commons:{
|
|
|
student_works:{url:"{homework_id}/*",query,form:{description:null,attachment_ids:null},config,disp:"POST:提交普通作业",
|
|
|
new:{query, disp:"??提交作业的信息详情??"}
|
|
|
},
|
|
|
work_list:{url:"{homework_id}/*",query,form:{page:1, search:"",work_status:[],course_group:[],teacher_comment:"",order:"update_time",limit:20,b_order:"desc",group_id:[]},config}
|
|
|
},
|
|
|
|
|
|
main:{
|
|
|
first_stamp:{}
|
|
|
},
|
|
|
|
|
|
myshixuns:{
|
|
|
challenges:{},
|
|
|
repository: {url:"{identifier}/*",query,form:{path:null},config},
|
|
|
update_file:{url:"{identifier}/*",query,form:{path:null, content: null, evaluate:null, game_id:null},config}
|
|
|
},
|
|
|
paths:{url:""},
|
|
|
schools:{
|
|
|
school_list:{query, form:{search:null}}
|
|
|
},
|
|
|
|
|
|
search:{query,form:{type:null, keyword:null, page:1, per_page:20}, data:{type:"subject, course, shixun, memo"}},
|
|
|
shixun_lists: { query, form:{type:"all", status:"published",keyword:"",diff:0,order:"desc",page:1,limit:10,sort:"wechat_myshixuns_count", no_jupyter:1}},
|
|
|
|
|
|
shixuns:{url:"*/{identifier}", query, res:{tpm_modified:"代码库是否有更新"},
|
|
|
challenges:{url:"{identifier}/*", query},
|
|
|
show_right:{url:""},
|
|
|
shixun_exec:{url:"{identifier}/*", query},
|
|
|
},
|
|
|
stages:{},
|
|
|
|
|
|
student_works:{url:"*/{work_id}", query, form:{_:1, PUT:{description:null,attachment_ids:null},GET:{}},config:{method:"PUT"},disp:"提交作业",
|
|
|
comment_list:{url:"{work_id}/*",query},
|
|
|
supply_attachments:{url:"{work_id}/*",query},
|
|
|
edit:{url:"{work_id}/*", query, disp:"编辑已提交作业"},
|
|
|
},
|
|
|
|
|
|
|
|
|
tasks:{url:"*/{identifier}",query,
|
|
|
game_build:{url:"{identifier}/*",query,form:{first:1, resubmit:"", content_modified:null,sec_key:null}},
|
|
|
game_status:{url:"{identifier}/*",query,form:{port:-1, resubmit:"", time_out:false, sec_key:null}},
|
|
|
rep_content:{url:"{identifier}/*",query, form:{path:null, status:0, retry:0}},
|
|
|
reset_original_code:{url:"{identifier}/*", query, form:{path:null}, disp:"恢复初始代码", res:"{content}"},
|
|
|
sync_codes:{url:"{identifier}/*",query, res:{path:"newpath"}},
|
|
|
},
|
|
|
|
|
|
|
|
|
users:{
|
|
|
accounts: { url: "*/{login}", query, form:{school:1},
|
|
|
avatar:{url:"{login}/*",query, form:{image:null} ,config:{method:"PUT"}},
|
|
|
password: { url: "{login}/*", query, form:{old_password:null, password:null} ,config:{method:"PUT"}},
|
|
|
},
|
|
|
attendance: {query, config},
|
|
|
courses:{url:"{login}/*", query, form:{page:1, sort_by:"updated_at",sort_direction:"desc", per_page:10, category:void 0, status:void 0},category:["study","manage"],status:["processing","end"]},
|
|
|
get_user_info:{query,form:{school:1}},
|
|
|
homepage_info:{url:"{login}/*",query},
|
|
|
shixuns: { url: "{login}/*", query, form: {sort_by:"updated_at" ,page:1, sort_direction:"desc",per_page:16}},
|
|
|
system_update:{query:query},
|
|
|
tidings: {query, form:{type:"",page:1,per_page:10}, data:"type:course,project,interaction,apply,notice"},
|
|
|
unread_message_info:{url:"{login}/*", query}
|
|
|
},
|
|
|
|
|
|
weapps:{
|
|
|
check_account: { query,form: {login: null, type: "login" }, config, data: { type: ["login"] } },
|
|
|
courses:{
|
|
|
basic_info:{url:"{course_id}/*",query,disp:"课堂基本信息"}
|
|
|
},
|
|
|
challenges: {
|
|
|
is_play: {}
|
|
|
},
|
|
|
code_session: { query, form: {code: null, encrypted_data: null, iv: null }, config },
|
|
|
home: { query,form: { page: 1, limit: 15, category: "study"} },
|
|
|
paths: {},
|
|
|
register:{query,form:{login:null,password:null, code:null}, config},
|
|
|
session: {query,form:{login:null, password:null},config},
|
|
|
course_stickies:{query, form:{course_id:null, category:null},config,
|
|
|
cancel_sticky: { query,form:{course_id:null,category:null}, config}
|
|
|
},
|
|
|
unbind_accounts: {query,config: { mothod: "GET"}},
|
|
|
verification_code:{query,form:{login:null, type:null, smscode:null},config},
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
export default apiConfig;
|
|
|
|
|
|
export function setApi(obj){
|
|
|
for(var kstr in obj){
|
|
|
var value = obj[kstr];
|
|
|
var ref = apiConfig
|
|
|
for(var k of kstr.split(".")){
|
|
|
if(!(k in ref))
|
|
|
ref[k]={}
|
|
|
ref = ref[k];
|
|
|
}
|
|
|
Object.assign(ref, value);
|
|
|
}
|
|
|
}
|
|
|
global.setApi = setApi;
|
|
|
global.apiConfig = apiConfig; |