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) }