新增人工设置晋级/淘汰功能,更新相关数据模型和API接口;重构比赛页面以支持新逻辑,优化用户交互体验。
This commit is contained in:
@@ -3,7 +3,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:recording_tool/app/config/app_config.dart';
|
||||
import 'package:recording_tool/app/router/app_navigator.dart';
|
||||
import 'package:recording_tool/features/competition_teams/model/model_competition_team.dart';
|
||||
import 'package:recording_tool/features/competition_teams/model/model_competition_team_detail.dart';
|
||||
import 'package:recording_tool/features/competition_teams/pages/page_event_team_match.dart';
|
||||
import 'package:recording_tool/features/competition_teams/server/server_competition_teams.dart';
|
||||
import 'package:recording_tool/features/events/model/model_event_info.dart';
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
class SetTeamStatusReq {
|
||||
final String scheduleId;
|
||||
final String opponentId;
|
||||
final List<TeamScore> teamScore;
|
||||
|
||||
SetTeamStatusReq({
|
||||
required this.scheduleId,
|
||||
required this.opponentId,
|
||||
required this.teamScore,
|
||||
});
|
||||
|
||||
factory SetTeamStatusReq.fromJson(Map<String, dynamic> json) =>
|
||||
SetTeamStatusReq(
|
||||
scheduleId: json['scheduleId'],
|
||||
opponentId: json['opponentId'],
|
||||
teamScore: List<TeamScore>.from(
|
||||
json['teamScore'].map((x) => TeamScore.fromJson(x)),
|
||||
),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'scheduleId': scheduleId,
|
||||
'opponentId': opponentId,
|
||||
'teamScore': List<dynamic>.from(teamScore.map((x) => x.toJson())),
|
||||
};
|
||||
}
|
||||
|
||||
class TeamScore {
|
||||
final String userId;
|
||||
final int firstHalfScore;
|
||||
final int secondHalfScore;
|
||||
final int decisiveScore;
|
||||
final bool ifWithdraw;
|
||||
|
||||
TeamScore({
|
||||
required this.userId,
|
||||
required this.firstHalfScore,
|
||||
required this.secondHalfScore,
|
||||
required this.decisiveScore,
|
||||
required this.ifWithdraw,
|
||||
});
|
||||
|
||||
factory TeamScore.fromJson(Map<String, dynamic> json) => TeamScore(
|
||||
userId: json['userId'],
|
||||
firstHalfScore: json['firstHalfScore'],
|
||||
secondHalfScore: json['secondHalfScore'],
|
||||
decisiveScore: json['decisiveScore'],
|
||||
ifWithdraw: json['ifWithdraw'],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'userId': userId,
|
||||
'firstHalfScore': firstHalfScore,
|
||||
'secondHalfScore': secondHalfScore,
|
||||
'decisiveScore': decisiveScore,
|
||||
'ifWithdraw': ifWithdraw,
|
||||
};
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import 'package:recording_tool/core/network/api_client.dart';
|
||||
import 'package:recording_tool/core/network/http_method.dart';
|
||||
import 'package:recording_tool/core/network/providers/dio_providers.dart';
|
||||
import 'package:recording_tool/features/events/model/model_event_info.dart';
|
||||
import 'package:recording_tool/features/events/request_model/request_model_event.dart';
|
||||
|
||||
final eventsServerProvider = Provider<EventsServer>((ref) {
|
||||
return EventsServer(ref.watch(apiClientProvider));
|
||||
@@ -34,4 +35,14 @@ class EventsServer {
|
||||
parser: StreamKeyResponse.fromJson,
|
||||
);
|
||||
}
|
||||
|
||||
/// 人工设置晋级/淘汰
|
||||
Future<void> setTeamStatus({required SetTeamStatusReq req}) {
|
||||
print('req: ${req.toJson()}');
|
||||
return _apiClient.post(
|
||||
AuthApi.setTeamStatus.path,
|
||||
data: req.toJson(),
|
||||
parser: (json) => json,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user