forgeplus-react/src/service/user.ts

260 lines
6.4 KiB
TypeScript
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import Fetch from '@/utils/fetch';
import ENV from '@/utils/env';
export async function ForgeLogin(params: any) {
return Fetch(`${ENV.FORGE_SERVER}/api/accounts/login.json`, {
method: 'post',
body: { ...params },
});
}
export async function ForgeLoginOut(params: any) {
return Fetch(`${ENV.FORGE_SERVER}/api/accounts/logout.json`, {
method: 'get',
// body: { ...params },
});
}
export async function ForgeCheckName(params: any) {
return Fetch(`${ENV.FORGE_SERVER}/api/accounts/check.json`, {
method: 'post',
body: { ...params },
});
}
export async function ForgeCheckEmail(params: any) {
return Fetch(`${ENV.FORGE_SERVER}/api/users/email_search.json`, {
method: 'get',
params: {...params}
});
}
export async function ForgeSaveUserInfo(params: any) {
return Fetch(`${ENV.FORGE_SERVER}/api/accounts/simple_update.json`, {
method: 'post',
body: { ...params },
});
}
export async function LoginIn(params: any) {
return Fetch('/api/accounts/login.json', {
method: 'post',
body: { ...params },
});
}
export async function LoginOut(params: any) {
return Fetch('/api/accounts/logout.json', {
method: 'get',
// body: { ...params },
});
}
export async function getUserInfo(params: any) {
return Fetch(`${ENV.FORGE_SERVER}/api/users/get_user_info.json`, {
method: 'get',
params: {...params,}
});
}
export async function getEducoderUserInfo(params: any) {
return Fetch(`/api/users/get_user_info.json`, {
method: 'get',
params: {...params}
});
}
export async function getNavigationInfo(params: any) {
return Fetch('/api/users/get_navigation_info.json', {
method: 'get',
params: { ...params }
});
}
export async function getSystemUpdate() {
return Fetch('/api/users/system_update.json', {
method: 'get',
});
}
export async function getHomepageInfo(params: any) {
return Fetch(`/api/users/${params.username}/homepage_info.json`, {
method: 'get',
});
}
export async function signed(params: any) {
return Fetch(`/api/users/attendance.json`, {
method: 'post',
});
}
export async function getCourses(params: any) {
return Fetch(`/api/users/${params.username}/courses.json`, {
method: 'get',
params,
});
}
export async function getShixuns(params: any) {
return Fetch(`/api/users/${params.username}/shixuns.json`, {
method: 'get',
params,
});
}
export async function getPaths(params: any) {
return Fetch(`/api/users/${params.username}/subjects.json`, {
method: 'get',
params,
});
}
export async function getProjects(params: any) {
return Fetch(`/api/users/${params.username}/projects.json`, {
method: 'get',
params,
});
}
export async function getVideos(params: any) {
return Fetch(`/api/users/${params.username}/videos.json`, {
method: 'get',
params,
});
}
export async function getReviewVideos(params: any) {
return Fetch(`/api/users/${params.username}/videos/review.json`, {
method: 'get',
params,
});
}
export async function deleteVideo(params: any) {
return Fetch(`/api/users/${params.username}/videos/${params.id}.json`, {
method: 'delete',
});
}
export async function logWatchHistory(params: any) {
return Fetch('/api/watch_video_histories.json', {
method: 'post',
body: params
});
}
export async function getQuestionBanks(params: any) {
return Fetch(`/api/users/question_banks.json`, {
method: 'get',
params,
});
}
export async function topicsSetPublic(params: any) {
return Fetch('/api/question_banks/multi_public.json', {
method: 'post',
body: params
});
}
export async function topicsDelete(params: any) {
return Fetch('/api/question_banks/multi_delete.json', {
method: 'delete',
body: params
});
}
export async function topicGetCourseList(params: any) {
return Fetch(`/api/question_banks/my_courses.json`, {
method: 'get',
params,
});
}
export async function topicSendToClass(params: any) {
return Fetch('/api/question_banks/send_to_course.json', {
method: 'post',
body: params
});
}
export async function getHomeworkBanksDetail(params: any) {
return Fetch(`/api/homework_banks/${params.topicId}.json`, {
method: 'get',
params,
});
}
export async function deleteQuestionBanks(params: any) {
return Fetch(`/api/question_banks/multi_delete.json`, {
method: 'delete',
body: { ...params },
});
}
export async function batchPublish(params: any) {
return Fetch(`/api/users/${params.username}/videos/batch_publish.json`, {
method: 'post',
body: params
});
}
export async function cancelShixun(params: any) {
return Fetch(`/api/myshixuns/${params.identifier}/cancel.json`, {
method: 'delete',
body: { ...params },
});
}
export async function getEngineerUrl() {
return Fetch(`/api/users/get_engineer_url.json`, {
method: 'get',
});
}
export async function postUserChoiceLearnPath(params:any) {
return Fetch(`/api/intelligent_recommendations/user_choice_learn_path.json`, {
method: 'post',
body:{...params}
});
}
export async function getUserPersona() {
return Fetch(`/api/intelligent_recommendations/persona.json`, {
method: 'get',
});
}
export async function getUserLearnPath() {
return Fetch(`/api/intelligent_recommendations/user_learn_path.json`, {
method: 'get',
});
}
//type 1 表示用户注册 2 忘记密码 3 绑定手机/邮箱
export function validateName(params: any) {
return Fetch('/api/accounts/valid_email_and_phone.json', {
method:"get",
params
})
}
//type 1用户注册注册 2忘记密码 3绑定手机 4: 绑定邮箱5: 验收手机号有效
export function getValidateCode(params: any) {
return Fetch('/api/accounts/get_verification_code.json', {
method:"get",
params
})
}
export function register(params: any) {
return Fetch('/api/accounts/register.json', {
method:"post",
body:{...params}
})
}
export function wechatRegister(params: any) {
return Fetch('/api/weapps/register.json', {
method:"post",
body:{...params}
})
}
export function changPassword(params: any) {
return Fetch(`/api/users/accounts/${params.login}/password.json`, {
method:"put",
body:{...params}
})
}
export function resetPassword(params: any) {
return Fetch('/api/accounts/reset_password.json', {
method:"post",
body:{...params}
})
}
export function LoginForPhone(params: any) {
return Fetch('/api/accounts/login_for_phone.json', {
method:"get",
params:{...params}
})
}