瀏覽代碼

fix(ui): 修正签约签名不显示的问题 #0018031

gavin.chen 1 年之前
父節點
當前提交
932cfdafd1

+ 6 - 0
lib/pages/contract/contract_records/controller.dart

@@ -56,6 +56,12 @@ class ContractRecordsController extends FControllerBase {
 
   /// 前往签约页
   void gotoNewContact() async {
+    // 如果当前用户没有电子签名,就提示先完善个人签名,再进行签约
+    if (Store.user.signature.isEmpty ||
+        !Store.user.signature.contains("http")) {
+      PromptBox.toast('请先设置签名:个人中心 > 签名设置');
+      return;
+    }
     await Get.toNamed(
       "/contract/package_list",
       parameters: {"patientCode": patientCode},

+ 7 - 2
lib/pages/contract/contract_template/controller.dart

@@ -127,12 +127,17 @@ class ContractTemplateController extends FControllerBase {
     } else if (key == 'servicesPackageContent') {
       return servicePackageNames;
     } else if (key == 'signaturePartyA') {
-      return '<img src=${Store.user.signature}  style="width: 110px; height: 30px;" alt="图片">';
+      if (Store.user.signature.isEmpty ||
+          !Store.user.signature.contains("http")) {
+        return '';
+      } else {
+        return '<img src=${Store.user.signature}  style="width: 110px; height: 60px; object-fit:contain" alt="图片">';
+      }
     } else if (key == 'signaturePartyB') {
       if (state.userSignature.isEmpty) {
         return '';
       } else {
-        return '<img src=${state.userSignature}  style="width: 110px; height: 30px;" alt="图片">';
+        return '<img src=${state.userSignature}  style="width: 110px; height: 60px; object-fit:contain" alt="图片">';
       }
     } else if (key == 'signatureDate') {
       final now = DateTime.now();

+ 3 - 2
lib/pages/home/personal_center/widgets/signature.dart

@@ -28,7 +28,7 @@ class SignaturePage extends GetView<PersonalCenterController> {
   Widget _buildPreview() {
     return Obx(() {
       final imageWidget = controller.state.signaturUrl != null
-          ? _buildBase64Preview()
+          ? _buildNetworkImagePreview()
           : _buildEmptyPreview();
       return Container(
         decoration: BoxDecoration(
@@ -42,11 +42,12 @@ class SignaturePage extends GetView<PersonalCenterController> {
     });
   }
 
-  Widget _buildBase64Preview() {
+  Widget _buildNetworkImagePreview() {
     final url = controller.state.signaturUrl!;
     return Image.network(
       url,
       fit: BoxFit.contain,
+      errorBuilder: (context, error, stackTrace) => _buildEmptyPreview(),
     );
   }