From 82650e7e9a7b171b511fea9dc09f1aa88b2a0359 Mon Sep 17 00:00:00 2001 From: "@jyuhsin" <729757837@qq.com> Date: Thu, 18 Dec 2025 13:03:11 +0800 Subject: [PATCH] commit --- .../components/plugins/sysSignature/index.vue | 13 ++++++++++++- .../static/components/plugins/sysSignature/pc.vue | 5 +++-- src/main/resources/views/layouts/v4/baseLayout.html | 2 +- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/main/resources/static/components/plugins/sysSignature/index.vue b/src/main/resources/static/components/plugins/sysSignature/index.vue index 487ce2a..06a7f8a 100644 --- a/src/main/resources/static/components/plugins/sysSignature/index.vue +++ b/src/main/resources/static/components/plugins/sysSignature/index.vue @@ -48,6 +48,13 @@ module.exports = { rotate() { signature.getRotateCanvas(90) }, + isLikelyMobile() { + const isTouchDevice = 'ontouchstart' in window || navigator.maxTouchPoints > 0; + const isSmallScreen = window.screen.width <= 768; + const hasMobileUA = /Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent); + + return hasMobileUA || (isTouchDevice && isSmallScreen); + }, save() { if (signature.isEmpty()) { alert("请签字后再保存") @@ -56,7 +63,11 @@ module.exports = { // const png = signature.getPNG() //旋转一下 横过来 const rotateCanvas = signature.getRotateCanvas(-90) - this.$emit("save", rotateCanvas.toDataURL()) + if (this.isLikelyMobile()) { + this.$emit("save", rotateCanvas.toDataURL()) + } else { + this.$emit("save", signature.toDataURL()) + } } }, mounted() { diff --git a/src/main/resources/static/components/plugins/sysSignature/pc.vue b/src/main/resources/static/components/plugins/sysSignature/pc.vue index b3801c7..9f3ac94 100644 --- a/src/main/resources/static/components/plugins/sysSignature/pc.vue +++ b/src/main/resources/static/components/plugins/sysSignature/pc.vue @@ -69,8 +69,9 @@ module.exports = { // 可选:轮询或 watch ready 状态 const checkReady = () => { - if (window.webSocketPubSub.ws.readyState === 1) { - this.loading = false; // 允许签字 + if (webSocketPubSub.ws && webSocketPubSub.ws.readyState === WebSocket.OPEN) { + console.info("ws.readyState is open"); + this.loading = false; } else { setTimeout(checkReady, 100); } diff --git a/src/main/resources/views/layouts/v4/baseLayout.html b/src/main/resources/views/layouts/v4/baseLayout.html index 8bde804..3b130ad 100644 --- a/src/main/resources/views/layouts/v4/baseLayout.html +++ b/src/main/resources/views/layouts/v4/baseLayout.html @@ -202,7 +202,7 @@ // ) // 连接建立时不立即发送 join,等待订阅完成 this.ping() - console.log('websocket open success') + console.info('websocket open success') } }