From 74e6cdba16d11329dc453db1df9c5ce090a33987 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E9=9C=84?= Date: Tue, 2 Jan 2024 14:50:02 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E6=B0=B4=E5=8D=B0=E9=A2=9C=E8=89=B2?= =?UTF-8?q?=E3=80=81=E5=AD=97=E4=BD=93=E6=8F=90=E5=87=BA=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/api_address_config.js | 5 +++++ src/App.vue | 5 ++++- src/utils/warterMark.js | 3 ++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/public/api_address_config.js b/public/api_address_config.js index 159a102d..b07c0db7 100644 --- a/public/api_address_config.js +++ b/public/api_address_config.js @@ -16,3 +16,8 @@ window._CONFIG.onlyOfficeUrl = 'http://127.0.0.1:8080' window._CONFIG.onlyOfficeDownloadFileUrl = 'http://localhost:8184/sys/common/download' // 管理员角色code,英文逗号拼接 window._CONFIG.adminRoleCode = 'admin' +// 水印配置 +window._CONFIG.watermarkConfig = { + color: 'rgba(180, 180, 180, 0.2)', + font: '13px Microsoft Yahei' +} diff --git a/src/App.vue b/src/App.vue index 2686ee24..498f90d4 100644 --- a/src/App.vue +++ b/src/App.vue @@ -2,7 +2,7 @@
-
+
@@ -37,6 +37,9 @@ export default { return this.$store.getters.userInfo.username + this.$store.getters.userInfo.realname } return null + }, + watermarkConfig () { + return window._CONFIG.watermarkConfig } }, watch: { diff --git a/src/utils/warterMark.js b/src/utils/warterMark.js index e5b882ef..113b82b0 100644 --- a/src/utils/warterMark.js +++ b/src/utils/warterMark.js @@ -16,7 +16,7 @@ Vue.directive('watermark', { can.style.display = 'none' const cans = can.getContext('2d') cans.rotate(-20 * Math.PI / 180) - cans.font = font || '13px Microsoft Yahei' + cans.font = font || window._CONFIG.watermarkConfig.font cans.fillStyle = textColor || '#DDDDDD' cans.textAlign = 'left' cans.textBaseline = 'Middle' @@ -38,6 +38,7 @@ Vue.directive('watermark', { parentNode.appendChild(div) } } + if (binding.value.text) { addWaterMarker(binding.value.text, el, binding.value.width, binding.value.height, binding.value.font, binding.value.textColor, binding.value.fillTextX) }