567e4aabdb
- 新增 updateSelfUser 方法,用于修改当前登录用户的个人资料 - 个人中心调用接口由原 updateUser 切换为 updateSelfUser,避免学生账号权限不足导致的保存失败 - 更新了头像保存、个人信息保存等相关调用代码,添加异常捕获和提示 - 修正环境变量 .env.development 中 API URL 配置为生产地址 - 优化审核记录排序逻辑,新增获取最新审核记录和编辑入口显示判断函数 - 调整审核状态标签使用统一排序规则,防止显示和编辑状态不一致 - 新增社团活动、社团编辑、志愿时长录入、学分记录编辑、社会实践学分申报、青马学员编辑等多个新增组件及表单功能 - 各新增功能支持表单验证、操作反馈和数据加载优化
133 lines
3.6 KiB
TypeScript
133 lines
3.6 KiB
TypeScript
import type { PageParam, PageResult } from '@/api';
|
|
import request from '@/utils/request';
|
|
import type { ApiResult } from '@/api';
|
|
import { MODULES_API_URL } from '@/config/setting';
|
|
|
|
/** 社会实践学分申报 */
|
|
export interface PracticeCreditApply {
|
|
id?: number;
|
|
userId?: number;
|
|
studentNo?: string;
|
|
studentName?: string;
|
|
collegeId?: number;
|
|
classId?: number;
|
|
schoolYear?: string;
|
|
activityName?: string;
|
|
activityType?: string;
|
|
startDate?: string;
|
|
endDate?: string;
|
|
roleName?: string;
|
|
content?: string;
|
|
score?: number;
|
|
approvedScore?: number;
|
|
attachments?: string;
|
|
status?: number;
|
|
remark?: string;
|
|
createTime?: string;
|
|
updateTime?: string;
|
|
}
|
|
|
|
export interface PracticeCreditParam extends PageParam {
|
|
userId?: number;
|
|
studentNo?: string;
|
|
studentName?: string;
|
|
collegeId?: number;
|
|
classId?: number;
|
|
schoolYear?: string;
|
|
activityType?: string;
|
|
status?: number;
|
|
backendAccess?: boolean;
|
|
}
|
|
|
|
export const PRACTICE_STATUS_OPTIONS = [
|
|
{ label: '草稿', value: 0 },
|
|
{ label: '待审核', value: 1 },
|
|
{ label: '通过', value: 2 },
|
|
{ label: '驳回', value: 3 },
|
|
{ label: '作废', value: 4 }
|
|
];
|
|
|
|
export const PRACTICE_TYPE_OPTIONS = [
|
|
{ label: '寒暑假社会实践', value: '寒暑假社会实践' },
|
|
{ label: '志愿服务', value: '志愿服务' },
|
|
{ label: '社会调研', value: '社会调研' },
|
|
{ label: '实习实训', value: '实习实训' },
|
|
{ label: '其他', value: '其他' }
|
|
];
|
|
|
|
export async function pagePracticeCredits(params: PracticeCreditParam) {
|
|
const res = await request.get<ApiResult<PageResult<PracticeCreditApply>>>(
|
|
MODULES_API_URL + '/gxmu/practice-credit/page',
|
|
{ params }
|
|
);
|
|
if (res.data.code === 0) {
|
|
return res.data.data;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
|
|
export async function submitPracticeCredit(data: PracticeCreditApply) {
|
|
const res = await request.post<ApiResult<unknown>>(
|
|
MODULES_API_URL + '/gxmu/practice-credit/my',
|
|
data
|
|
);
|
|
if (res.data.code === 0) {
|
|
return res.data.message;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
|
|
export async function withdrawPracticeCredit(id: number) {
|
|
const res = await request.put<ApiResult<unknown>>(
|
|
MODULES_API_URL + `/gxmu/practice-credit/${id}/withdraw`
|
|
);
|
|
if (res.data.code === 0) {
|
|
return res.data.message;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
|
|
export async function voidPracticeCredit(id: number, reason?: string) {
|
|
const res = await request.put<ApiResult<unknown>>(
|
|
MODULES_API_URL + `/gxmu/practice-credit/${id}/void`,
|
|
null,
|
|
{ params: { reason } }
|
|
);
|
|
if (res.data.code === 0) {
|
|
return res.data.message;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
|
|
export async function removePracticeCredit(id: number) {
|
|
const res = await request.delete<ApiResult<unknown>>(
|
|
MODULES_API_URL + '/gxmu/practice-credit/' + id
|
|
);
|
|
if (res.data.code === 0) {
|
|
return res.data.message;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
|
|
export async function getMyPracticeSummary() {
|
|
const res = await request.get<ApiResult<Record<string, any>>>(
|
|
MODULES_API_URL + '/gxmu/practice-credit/my/summary'
|
|
);
|
|
if (res.data.code === 0 && res.data.data) {
|
|
return res.data.data;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
|
|
/** 导出教务处模板数据表 */
|
|
export async function exportPracticeCredit(params: PracticeCreditParam) {
|
|
const res = await request.post<ApiResult<Record<string, any>>>(
|
|
MODULES_API_URL + '/gxmu/practice-credit/export',
|
|
params
|
|
);
|
|
if (res.data.code === 0 && res.data.data) {
|
|
return res.data.data;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|