567e4aabdb
- 新增 updateSelfUser 方法,用于修改当前登录用户的个人资料 - 个人中心调用接口由原 updateUser 切换为 updateSelfUser,避免学生账号权限不足导致的保存失败 - 更新了头像保存、个人信息保存等相关调用代码,添加异常捕获和提示 - 修正环境变量 .env.development 中 API URL 配置为生产地址 - 优化审核记录排序逻辑,新增获取最新审核记录和编辑入口显示判断函数 - 调整审核状态标签使用统一排序规则,防止显示和编辑状态不一致 - 新增社团活动、社团编辑、志愿时长录入、学分记录编辑、社会实践学分申报、青马学员编辑等多个新增组件及表单功能 - 各新增功能支持表单验证、操作反馈和数据加载优化
103 lines
2.7 KiB
TypeScript
103 lines
2.7 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 ThematicCourse {
|
|
id?: number;
|
|
title?: string;
|
|
type?: string;
|
|
sourceSite?: string;
|
|
sourceUrl?: string;
|
|
sourceKey?: string;
|
|
cover?: string;
|
|
summary?: string;
|
|
content?: string;
|
|
fileId?: number;
|
|
fileUrl?: string;
|
|
tags?: string;
|
|
heat?: number;
|
|
publishTime?: string;
|
|
status?: number;
|
|
lastSyncTime?: string;
|
|
createTime?: string;
|
|
}
|
|
|
|
export interface ThematicCourseParam extends PageParam {
|
|
type?: string;
|
|
tags?: string;
|
|
status?: number;
|
|
}
|
|
|
|
export const THEMATIC_TYPE_OPTIONS = [
|
|
{ label: '课件', value: 'courseware' },
|
|
{ label: '讲稿', value: 'script' },
|
|
{ label: '视频', value: 'video' },
|
|
{ label: '案例', value: 'case' },
|
|
{ label: '活动方案', value: 'activity' }
|
|
];
|
|
|
|
export async function pageThematicCourses(params: ThematicCourseParam) {
|
|
const res = await request.get<ApiResult<PageResult<ThematicCourse>>>(
|
|
MODULES_API_URL + '/gxmu/thematic-course/page',
|
|
{ params }
|
|
);
|
|
if (res.data.code === 0) {
|
|
return res.data.data;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
|
|
export async function getThematicCourse(id: number) {
|
|
const res = await request.get<ApiResult<ThematicCourse>>(
|
|
MODULES_API_URL + '/gxmu/thematic-course/' + id
|
|
);
|
|
if (res.data.code === 0 && res.data.data) {
|
|
return res.data.data;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
|
|
export async function addThematicCourse(data: ThematicCourse) {
|
|
const res = await request.post<ApiResult<unknown>>(
|
|
MODULES_API_URL + '/gxmu/thematic-course',
|
|
data
|
|
);
|
|
if (res.data.code === 0) {
|
|
return res.data.message;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
|
|
export async function updateThematicCourse(data: ThematicCourse) {
|
|
const res = await request.put<ApiResult<unknown>>(
|
|
MODULES_API_URL + '/gxmu/thematic-course',
|
|
data
|
|
);
|
|
if (res.data.code === 0) {
|
|
return res.data.message;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
|
|
export async function removeThematicCourse(id: number) {
|
|
const res = await request.delete<ApiResult<unknown>>(
|
|
MODULES_API_URL + '/gxmu/thematic-course/' + id
|
|
);
|
|
if (res.data.code === 0) {
|
|
return res.data.message;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
|
|
export async function syncThematicCourses() {
|
|
const res = await request.post<ApiResult<unknown>>(
|
|
MODULES_API_URL + '/gxmu/thematic-course/sync'
|
|
);
|
|
if (res.data.code === 0) {
|
|
return res.data.message;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|