Browse Source

fix 17830: 【健康档案】线上环境点击居民列表下的信息,进入健康档案详情,左上角的基本信息模块会显示固定的显示为空的信息,然后再加载当前居民信息

Melon 1 year ago
parent
commit
eb12b85d20
2 changed files with 29 additions and 15 deletions
  1. 1 3
      lib/pages/patient/detail/state.dart
  2. 28 12
      lib/pages/patient/detail/widgets/base_info.dart

+ 1 - 3
lib/pages/patient/detail/state.dart

@@ -12,7 +12,7 @@ class PatientDetailState {
     PatientDTO(
       patientName: "",
       patientGender: GenderEnum.Unknown,
-      phone: "",
+      phone: "UNLOAD", // TODO: 先复用此字段判断加载状态
       birthday: DateTime(1900, 1, 1),
       patientAddress: "",
       crowdLabels: null,
@@ -94,8 +94,6 @@ class PatientDetailState {
     }
   }
 
-  String? get phoneNo => _dto.value.phone;
-
   String? get nation => _dto.value.nationality;
 
   DateTime? get birthday => _dto.value.birthday;

+ 28 - 12
lib/pages/patient/detail/widgets/base_info.dart

@@ -21,18 +21,31 @@ class BaseInfoCard extends GetView<PatientDetailController> {
           Padding(
             padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 12),
             child: Obx(
-              () => Column(
-                children: [
-                  const SizedBox(height: 18),
-                  _buildItem("姓名", state.name),
-                  _buildItem("性别", state.genderDesc),
-                  _buildItem("年龄", state.age.toString()),
-                  _buildItem("电话", state.phoneNo, placeholder: "未填写"),
-                  _buildItem("身份证", state.cardNo),
-                  // const SizedBox(height: 8),
-                  _buildItem("地址", state.address, enableTooltip: true),
-                ],
-              ),
+              () {
+                if (state.phone == "UNLOAD") {
+                  return Container(
+                    height: 30 * 6 + 18,
+                    alignment: Alignment.center,
+                    child: SizedBox(
+                      width: 20,
+                      height: 20,
+                      child: CircularProgressIndicator(),
+                    ),
+                  );
+                }
+                return Column(
+                  children: [
+                    const SizedBox(height: 18),
+                    _buildItem("姓名", state.name),
+                    _buildItem("性别", state.genderDesc),
+                    _buildItem("年龄", state.age.toString()),
+                    _buildItem("电话", state.phone, placeholder: "未填写"),
+                    _buildItem("身份证", state.cardNo),
+                    // const SizedBox(height: 8),
+                    _buildItem("地址", state.address, enableTooltip: true),
+                  ],
+                );
+              },
             ),
           ),
           Positioned(
@@ -93,6 +106,9 @@ class BaseInfoCard extends GetView<PatientDetailController> {
 
   Widget _buildAvatar() {
     return Obx(() {
+      if (controller.state.phone == "UNLOAD") {
+        return SizedBox(width: 100, height: 150);
+      }
       final url = controller.state.avatarUrl;
       Widget image;
       if (url != null && url.isNotEmpty) {