From 8534025c45b4736975730678b9ccf23570a75f95 Mon Sep 17 00:00:00 2001
From: liuyu <yu.liu@cqgbkj.com>
Date: 星期二, 22 九月 2026 09:25:48 +0800
Subject: [PATCH] feat(tms): 新增试卷、培训任务、个人任务页面
---
apps/jnpf-web-apps-main/src/api/x/tms/trainArchive.ts | 24 ++++++++++++------------
1 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/apps/jnpf-web-apps-main/src/api/x/tms/trainArchive.ts b/apps/jnpf-web-apps-main/src/api/x/tms/trainArchive.ts
index b946e5f..47a28f7 100644
--- a/apps/jnpf-web-apps-main/src/api/x/tms/trainArchive.ts
+++ b/apps/jnpf-web-apps-main/src/api/x/tms/trainArchive.ts
@@ -1,19 +1,19 @@
import type { TrainArchiveDetail } from '#/views/x/tms/trainArchive/types';
import { defHttp } from '#/api/request';
-import { mockGetMyTrainArchive } from '#/views/x/tms/trainArchive/mock';
-/** 鍚庣鏈氨缁墠璧� mock锛涜仈璋冨悗鏀逛负 false */
-const USE_MOCK = true;
+/** 姝e紡璺緞锛�/api/tms/train-archive/** */
const prefix = '/api/tms/train-archive';
-export function getMyTrainArchive(user?: {
- userId?: string;
- userName?: string;
- userAccount?: string;
- organizeName?: string;
- positionName?: string;
-}) {
- if (USE_MOCK) return mockGetMyTrainArchive(user);
- return defHttp.get<TrainArchiveDetail>({ url: `${prefix}/mine` });
+async function unwrapData<T>(promise: Promise<any>): Promise<T> {
+ const res = await promise;
+ if (res && typeof res === 'object' && 'data' in res && ('code' in res || 'msg' in res)) {
+ return res.data as T;
+ }
+ return res as T;
+}
+
+/** 褰撳墠鐧诲綍鐢ㄦ埛鐨勪釜浜哄煿璁。妗� */
+export function getMyTrainArchive() {
+ return unwrapData<TrainArchiveDetail>(defHttp.get({ url: `${prefix}/mine` }));
}
--
Gitblit v1.8.0