From d3150a80d35603d2d493be0df543930eb06d249a Mon Sep 17 00:00:00 2001
From: Tevin <tingquanren@163.com>
Date: Wed, 13 Mar 2024 11:02:11 +0800
Subject: [PATCH] 修复签名组件的问题

---
 forms/userSignature/CSignatureLayer.vue |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/forms/userSignature/CSignatureLayer.vue b/forms/userSignature/CSignatureLayer.vue
index 1deac9d..740fce9 100644
--- a/forms/userSignature/CSignatureLayer.vue
+++ b/forms/userSignature/CSignatureLayer.vue
@@ -8,7 +8,7 @@
         class="c-signature-layer"
         title="手写板 / 请书写签名"
         :isOpened="layerOpened"
-        :onClose="evt => null"
+        :onClose="evt => handleClose()"
     >
         <view class="c-signature-layer-draw">
             <view class="size-box-top"></view>
@@ -85,14 +85,21 @@
             this._initDraw();
             this.layerOpened = true;
             this._callback = callback;
-            this.handleRestDraw();
+            setTimeout(() => {
+                this.handleRestDraw();
+            }, 10);
         },
         handleRestDraw() {
             this.firstTouch = true;
             this.curLine = [];
             this.chirography = [];
             this.canvasContext.clearRect(0, 0, this.cavWidth, this.cavHeight);
+            this.canvasContext.setFillStyle('#ffffff');
+            this.canvasContext.fillRect(0, 0, this.cavWidth, this.cavHeight);
             this.canvasContext.draw();
+        },
+        handleClose() {
+            this.layerOpened = false;
         },
         handleWriteStart(evt) {
             if (evt.type != 'touchstart') {
@@ -291,7 +298,7 @@
                         point[1].r,
                         point[2].x,
                         point[2].y,
-                        point[2].r
+                        point[2].r,
                     );
                     this._bethelDraw(a, true);
                     point = [{ x: x, y: y, r: r }];
@@ -388,7 +395,7 @@
                     point[i].c2x,
                     point[i].c2y,
                     point[i].ex,
-                    point[i].ey
+                    point[i].ey,
                 );
             }
             ctx.stroke();

--
Gitblit v1.9.1