NEZ-3038 feat:web terminal支持个性化设置

This commit is contained in:
zhangyu
2023-08-09 16:48:09 +08:00
parent b8915bb47b
commit 527d206af8
12 changed files with 301 additions and 26 deletions

View File

@@ -1127,25 +1127,27 @@ export const watermark = {
bind (el, binding) {
const text = binding.value.text
const text1 = binding.value.text1
const show = binding.value.show
const font = binding.value.font || '24px Roboto-Regular'
const textColor = binding.value.textColor || 'rgba(215, 215, 215, 0.5)'
const width = binding.value.width || 400
const height = binding.value.height || 200
const textRotate = binding.value.textRotate || -30
addWaterMarker(el, text, font, textColor, width, height, textRotate, text1)
addWaterMarker(el, text, font, textColor, width, height, textRotate, show, text1)
},
update (el, binding) {
const text = binding.value.text
const text1 = binding.value.text1
const show = binding.value.show
const font = binding.value.font || '16px Roboto-Regular'
const textColor = binding.value.textColor || 'rgba(215, 215, 215, 0.5)'
const width = binding.value.width || 400
const height = binding.value.height || 200
const textRotate = binding.value.textRotate || -20
addWaterMarker(el, text, font, textColor, width, height, textRotate, text1)
addWaterMarker(el, text, font, textColor, width, height, textRotate, show, text1)
},
}
function addWaterMarker (parentNode, text, font, textColor, width, height, textRotate, text1) {
function addWaterMarker (parentNode, text, font, textColor, width, height, textRotate, show, text1) {
const can = document.createElement('canvas')
parentNode.appendChild(can)
can.width = width
@@ -1160,5 +1162,9 @@ function addWaterMarker (parentNode, text, font, textColor, width, height, textR
cans.textBaseline = 'middle'
cans.fillText(text, 200, 150)
cans.fillText(text1, 200, 170)
parentNode.style.backgroundImage = 'url(' + can.toDataURL('image/png') + ')'
if (show) {
parentNode.style.backgroundImage = 'url(' + can.toDataURL('image/png') + ')'
} else {
parentNode.style.backgroundImage = ''
}
}