feat: 新增过渡页面路由、上传组件及完善跳转逻辑
- 为conquerPackage模块添加过渡页面路由并实现页面跳转逻辑 - 新增通用多图上传组件Upload,支持多种模式与图片操作功能 - 新增任务相关的API及Model基础文件 - 注释课前课中页面的测试试题内容
This commit is contained in:
@@ -22,6 +22,10 @@ import 'package:new_learn/core/network/dio_client.dart';
|
||||
/// —— 获取攻克报告(view 模式数据源)
|
||||
/// GET /api/v1/StudyPack/GetReport/{recordId}
|
||||
///
|
||||
/// getRecord
|
||||
/// —— 获取攻克记录信息(过渡页使用)
|
||||
/// GET /api/v1/StudyPack/GetRecord/{recordId}
|
||||
///
|
||||
/// 注意:
|
||||
/// - 页面只调这里,不直接碰 Dio;
|
||||
/// - 异常不在 catch,交页面统一处理;
|
||||
@@ -77,4 +81,17 @@ class BeforeDuringClassApi {
|
||||
}
|
||||
return const HandoutListResponse();
|
||||
}
|
||||
|
||||
/// 获取攻克记录信息 → GET /api/v1/StudyPack/GetRecord/{recordId}
|
||||
///
|
||||
/// 过渡页使用:获取攻克包名称、攻克标准、是否有题目等。
|
||||
Future<OvercomeRecordInfo> getRecord(String recordId) async {
|
||||
final data = await DioClient.instance.get(
|
||||
'/api/v1/StudyPack/GetRecord/$recordId',
|
||||
);
|
||||
if (data is Map<String, dynamic>) {
|
||||
return OvercomeRecordInfo.fromJson(data);
|
||||
}
|
||||
return const OvercomeRecordInfo();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,6 +154,34 @@ class HandoutItem {
|
||||
}
|
||||
}
|
||||
|
||||
/// 攻克记录信息(过渡页使用,对标 Vue GetRecordData 返回值)
|
||||
///
|
||||
/// 接口:GET /api/v1/StudyPack/GetRecord/{recordId}
|
||||
/// 用于过渡页(课前/课中/课后)展示攻克包名称、攻克标准、是否有题目等。
|
||||
class OvercomeRecordInfo {
|
||||
const OvercomeRecordInfo({
|
||||
this.id = '',
|
||||
this.name = '',
|
||||
this.overcomeStandard = 0,
|
||||
this.hasQuestion = false,
|
||||
});
|
||||
|
||||
final String id; // 记录 id
|
||||
final String name; // 攻克包名称
|
||||
final int overcomeStandard; // 攻克标准(百分比 0-100)
|
||||
final bool hasQuestion; // 是否有题目
|
||||
|
||||
factory OvercomeRecordInfo.fromJson(Map<String, dynamic> json) {
|
||||
final payload = (json['data'] as Map<String, dynamic>?) ?? json;
|
||||
return OvercomeRecordInfo(
|
||||
id: payload['id']?.toString() ?? '',
|
||||
name: payload['name'] as String? ?? '',
|
||||
overcomeStandard: _parseInt(payload['overcomeStandard']),
|
||||
hasQuestion: payload['hasQuestion'] as bool? ?? false,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// 讲义列表响应(Handout 接口返回的列表)
|
||||
class HandoutListResponse {
|
||||
const HandoutListResponse({this.items = const []});
|
||||
|
||||
Reference in New Issue
Block a user