3.修改睡眠报告文字 正常窦性心律
This commit is contained in:
@@ -54,6 +54,9 @@ class DeviceTypeController extends GetControllerEx<DeviceTypeModel> {
|
||||
RxBool own = false.obs; //体验id
|
||||
RxString errmsg = "".obs;
|
||||
RxBool qcListLoading = true.obs;
|
||||
RxBool qcDetailLoading = true.obs; // 详情加载状态(专门用于id不为空时的加载)
|
||||
|
||||
int _requestSequence = 0;
|
||||
|
||||
Future<ApiResponse> getDeviceType() async {
|
||||
ApiResponse apiResponse = ApiResponse(code: -1, msg: "请求失败".tr);
|
||||
@@ -128,7 +131,15 @@ class DeviceTypeController extends GetControllerEx<DeviceTypeModel> {
|
||||
}
|
||||
|
||||
Future<bool> getCheckHistory({required String mac, String? id}) async {
|
||||
qcListLoading.value = true;
|
||||
// 生成新的序列号
|
||||
final currentSeq = ++_requestSequence;
|
||||
if (id == null || id.isEmpty) {
|
||||
qcListLoading.value = true;
|
||||
} else {
|
||||
qcDetailLoading.value = true;
|
||||
currentCq.value = {};
|
||||
}
|
||||
|
||||
String serviceAddress = ServiceConstant.qc_service_address;
|
||||
String serviceApi = ServiceConstant.getCheckHistory;
|
||||
String queryUrl = "$serviceAddress$serviceApi";
|
||||
@@ -155,6 +166,11 @@ class DeviceTypeController extends GetControllerEx<DeviceTypeModel> {
|
||||
method: MyHttpMethod.get,
|
||||
queryUrl: queryUrl,
|
||||
onSuccess: (res) {
|
||||
if (_requestSequence != currentSeq) {
|
||||
print('⚠️ 忽略过期请求 #$currentSeq,当前最新是 #$_requestSequence');
|
||||
return;
|
||||
}
|
||||
|
||||
flag = true;
|
||||
// 判断返回数据类型
|
||||
if (res.data is List) {
|
||||
@@ -164,16 +180,30 @@ class DeviceTypeController extends GetControllerEx<DeviceTypeModel> {
|
||||
// 如果是Map,赋值给currentCq
|
||||
currentCq.value = res.data as Map<String, dynamic>;
|
||||
}
|
||||
qcListLoading.value = false;
|
||||
if (id == null || id.isEmpty) {
|
||||
qcListLoading.value = false;
|
||||
} else {
|
||||
qcDetailLoading.value = false;
|
||||
}
|
||||
// qcListLoading.value = false;
|
||||
updateAll();
|
||||
},
|
||||
onFailure: (res) {
|
||||
if (_requestSequence != currentSeq) {
|
||||
print('⚠️ 忽略过期失败回调 #$currentSeq');
|
||||
return;
|
||||
}
|
||||
|
||||
flag = false;
|
||||
qcListLoading.value = false;
|
||||
if (id == null || id.isEmpty) {
|
||||
qcListLoading.value = false;
|
||||
} else {
|
||||
qcDetailLoading.value = false;
|
||||
}
|
||||
currentCq.value = {};
|
||||
NewTopSlideNotification.show(
|
||||
text: "数据加载失败", textColor: themeController.currentColor.sc9);
|
||||
EasyDartModule.logger.error("快检报告数据加载失败-->${res.msg??'服务器错误'}");
|
||||
EasyDartModule.logger.error("快检报告数据加载失败-->${res.msg ?? '服务器错误'}");
|
||||
},
|
||||
);
|
||||
return flag;
|
||||
|
||||
Reference in New Issue
Block a user