联调修改结构
This commit is contained in:
@@ -16,7 +16,6 @@ class MineController extends GetxController with BaseControllerMixin {
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
renderData();
|
||||
renderViolation();
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -51,9 +50,8 @@ class MineController extends GetxController with BaseControllerMixin {
|
||||
plateNumber = bean.plateNumber;
|
||||
}
|
||||
|
||||
showLoading("加载中");
|
||||
|
||||
try {
|
||||
showLoading("加载中");
|
||||
await Future.wait([
|
||||
_fetchCompletionRate(), // 请求1:完成率
|
||||
_fetchAccidentCount(), // 请求2:事故数
|
||||
@@ -61,6 +59,8 @@ class MineController extends GetxController with BaseControllerMixin {
|
||||
_rating(), // 司机评分
|
||||
_msgNotice(), // 红点消息
|
||||
]);
|
||||
|
||||
await renderViolation();
|
||||
} catch (e, stackTrace) {
|
||||
showErrorToast("加载数据失败,请稍后重试 $e");
|
||||
} finally {
|
||||
@@ -83,8 +83,8 @@ class MineController extends GetxController with BaseControllerMixin {
|
||||
if (response != null) {
|
||||
final result = BaseModel.fromJson(response.data);
|
||||
if (result.code == 0 && result.data != null) {
|
||||
int total = result.data["total"] ?? 0;
|
||||
isNotice = total > 0;
|
||||
String total = result.data["total"].toString();
|
||||
isNotice = int.parse(total) > 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -139,15 +139,11 @@ class MineController extends GetxController with BaseControllerMixin {
|
||||
}
|
||||
}
|
||||
|
||||
void renderViolation() async {
|
||||
Future<void> renderViolation() async {
|
||||
// 违章信息查询
|
||||
final originalHeaders = Map<String, dynamic>.from(HttpService.to.dio.options.headers);
|
||||
try {
|
||||
HttpService.to.setBaseUrl(AppTheme.jiaqing_service_url);
|
||||
HttpService.to.dio.options.headers['appId'] = '97ad10eeb6b346f79e0d6ffd81e4d3c3';
|
||||
|
||||
var responseData = await HttpService.to.get(
|
||||
"vehicleService/violation/queryViolationInfo_V2?plateNum=${plateNumber}",
|
||||
"appointment/truck/queryViolationInfo_V2?plateNum=${plateNumber}",
|
||||
);
|
||||
|
||||
if (responseData == null || responseData.data == null) {
|
||||
@@ -174,8 +170,6 @@ class MineController extends GetxController with BaseControllerMixin {
|
||||
}
|
||||
} catch (e) {
|
||||
} finally {
|
||||
HttpService.to.setBaseUrl(AppTheme.test_service_url);
|
||||
HttpService.to.dio.options.headers = originalHeaders;
|
||||
updateUi();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user