Some checks failed
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Lint (ubuntu-latest) (push) Has been cancelled
CI / Lint (windows-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
Deploy Website on push / Deploy Push Playground Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Docs Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Antd Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Element Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Naive Ftp (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
CI / CI OK (push) Has been cancelled
Deploy Website on push / Rerun on failure (push) Has been cancelled
Lock Threads / action (push) Has been cancelled
Issue Close Require / close-issues (push) Has been cancelled
Close stale issues / stale (push) Has been cancelled
155 lines
3.5 KiB
TypeScript
155 lines
3.5 KiB
TypeScript
import { requestClient } from '#/api/request';
|
|
|
|
export namespace StudentApi {
|
|
/** 学生列表查询参数 */
|
|
export interface ListParams {
|
|
page?: number;
|
|
limit?: number;
|
|
student_id?: string;
|
|
name?: string;
|
|
phone?: string;
|
|
class_id?: number;
|
|
school_id?: number;
|
|
bind_status?: string;
|
|
}
|
|
|
|
/** 学生信息 */
|
|
export interface StudentInfo {
|
|
id?: number;
|
|
student_id?: string | null;
|
|
name?: string;
|
|
gender?: string;
|
|
class_id?: number;
|
|
phone?: string;
|
|
email?: string;
|
|
avatar?: string | null;
|
|
remark?: string;
|
|
status?: number;
|
|
user_id?: number | null;
|
|
create_time?: string;
|
|
update_time?: string | null;
|
|
class_name?: string;
|
|
bind_status?: string;
|
|
school_name?: string;
|
|
[key: string]: any;
|
|
}
|
|
|
|
/** 学生详情参数 */
|
|
export interface DetailParams {
|
|
id: number;
|
|
}
|
|
|
|
/** 保存学生参数 */
|
|
export interface SaveParams extends StudentInfo {
|
|
id?: number;
|
|
}
|
|
|
|
/** 删除学生参数 */
|
|
export interface DeleteParams {
|
|
id: number;
|
|
}
|
|
|
|
/** 更新学生状态参数 */
|
|
export interface StatusParams {
|
|
id: number;
|
|
status: number;
|
|
}
|
|
|
|
/** 解绑学生参数 */
|
|
export interface UnbindParams {
|
|
id: number;
|
|
}
|
|
|
|
/** 上传学生导入文件参数 */
|
|
export interface UploadParams {
|
|
file: File;
|
|
}
|
|
|
|
/** 导入学生数据参数 */
|
|
export interface ImportParams {
|
|
class_id: number;
|
|
file: string;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 获取学生列表
|
|
* GET /api/admin/student/list
|
|
*/
|
|
export async function getStudentListApi(params?: StudentApi.ListParams) {
|
|
// 使用 responseReturn: 'body' 获取完整响应体
|
|
return requestClient.get<any>('/api/admin/student/list', {
|
|
params,
|
|
responseReturn: 'body',
|
|
});
|
|
}
|
|
|
|
/**
|
|
* 获取学生详情
|
|
* GET /api/admin/student/detail
|
|
*/
|
|
export async function getStudentDetailApi(params: StudentApi.DetailParams) {
|
|
// 使用 responseReturn: 'body' 获取完整响应体
|
|
return requestClient.get<any>('/api/admin/student/detail', {
|
|
params,
|
|
responseReturn: 'body',
|
|
});
|
|
}
|
|
|
|
/**
|
|
* 保存学生(新增/编辑)
|
|
* POST /api/admin/student/save
|
|
*/
|
|
export async function saveStudentApi(data: StudentApi.SaveParams) {
|
|
return requestClient.post<StudentApi.StudentInfo>('/api/admin/student/save', data);
|
|
}
|
|
|
|
/**
|
|
* 删除学生
|
|
* POST /api/admin/student/delete
|
|
*/
|
|
export async function deleteStudentApi(data: StudentApi.DeleteParams) {
|
|
return requestClient.post('/api/admin/student/delete', data);
|
|
}
|
|
|
|
/**
|
|
* 更新学生状态
|
|
* POST /api/admin/student/status
|
|
*/
|
|
export async function updateStudentStatusApi(data: StudentApi.StatusParams) {
|
|
return requestClient.post('/api/admin/student/status', data);
|
|
}
|
|
|
|
/**
|
|
* 解绑学生
|
|
* POST /api/admin/student/unbind
|
|
*/
|
|
export async function unbindStudentApi(data: StudentApi.UnbindParams) {
|
|
return requestClient.post('/api/admin/student/unbind', data);
|
|
}
|
|
|
|
/**
|
|
* 上传学生导入文件
|
|
* POST /api/admin/student/upload
|
|
*/
|
|
export async function uploadStudentFileApi(file: File) {
|
|
const formData = new FormData();
|
|
formData.append('file', file);
|
|
// 使用 responseReturn: 'body' 获取完整响应体
|
|
return requestClient.post<any>('/api/admin/student/upload', formData, {
|
|
headers: {
|
|
'Content-Type': 'multipart/form-data',
|
|
},
|
|
responseReturn: 'body',
|
|
});
|
|
}
|
|
|
|
/**
|
|
* 导入学生数据
|
|
* POST /api/admin/student/import
|
|
*/
|
|
export async function importStudentDataApi(data: StudentApi.ImportParams) {
|
|
return requestClient.post('/api/admin/student/import', data);
|
|
}
|
|
|