diff --git a/frontend/src/components/canvas/DeCanvas.vue b/frontend/src/components/canvas/DeCanvas.vue index 38b1259fa1..4e0eab71aa 100644 --- a/frontend/src/components/canvas/DeCanvas.vue +++ b/frontend/src/components/canvas/DeCanvas.vue @@ -113,8 +113,6 @@ import generateID from '@/components/canvas/utils/generateID' import ButtonDialog from '@/views/panel/filter/ButtonDialog' import ButtonResetDialog from '@/views/panel/filter/ButtonResetDialog' import FilterDialog from '@/views/panel/filter/FilterDialog' -import { userLoginInfo } from '@/api/systemInfo/userLogin' -import { activeWatermark } from '@/components/canvas/tools/watermark' import { uploadFileResult } from '@/api/staticResource/staticResource' export default { @@ -237,19 +235,12 @@ export default { watch: { mobileLayoutStatus() { this.restore() - }, - panelInfo: { - handler(newVal, oldVla) { - this.initWatermark() - }, - deep: true } }, created() { }, mounted() { const _this = this - this.initWatermark() // 监听div变动事件 const erd = elementResizeDetectorMaker() erd.listenTo(document.getElementById(this.canvasDomId), element => { @@ -263,14 +254,6 @@ export default { bus.$off('button-dialog-edit', this.editButtonDialog) }, methods: { - initWatermark() { - if (this.panelInfo.watermarkInfo) { - userLoginInfo().then(res => { - const userInfo = res.data - activeWatermark(this.panelInfo.watermarkInfo.settingContent, userInfo, this.canvasDomId, this.canvasId, this.panelInfo.watermarkOpen) - }) - } - }, initEvents() { bus.$on('component-dialog-edit', this.editDialog) bus.$on('button-dialog-edit', this.editButtonDialog) diff --git a/frontend/src/components/canvas/components/editor/Preview.vue b/frontend/src/components/canvas/components/editor/Preview.vue index 0381b94033..a304a149cd 100644 --- a/frontend/src/components/canvas/components/editor/Preview.vue +++ b/frontend/src/components/canvas/components/editor/Preview.vue @@ -372,9 +372,8 @@ export default { }, methods: { initWatermark() { - if (this.panelInfo.watermarkInfo) { - const method = this.userId ? proxyUserLoginInfo : userLoginInfo - method(this.userId).then(res => { + if (this.panelInfo.watermarkInfo && this.canvasId === 'canvas-main') { + userLoginInfo().then(res => { const userInfo = res.data activeWatermark(this.panelInfo.watermarkInfo.settingContent, userInfo, 'preview-main-canvas-main', this.canvasId, this.panelInfo.watermarkOpen) }) diff --git a/frontend/src/views/panel/edit/index.vue b/frontend/src/views/panel/edit/index.vue index 91ac5dfb85..5d4f1914a5 100644 --- a/frontend/src/views/panel/edit/index.vue +++ b/frontend/src/views/panel/edit/index.vue @@ -524,6 +524,8 @@ import { adaptCurThemeCommonStyle } from '@/components/canvas/utils/style' import eventBus from '@/components/canvas/utils/eventBus' import DeCanvas from '@/components/canvas/DeCanvas' import TextAttr from '@/components/canvas/components/TextAttr' +import { userLoginInfo } from '@/api/systemInfo/userLogin' +import { activeWatermark } from '@/components/canvas/tools/watermark' export default { name: 'PanelEdit', @@ -778,6 +780,12 @@ export default { }, previewVisible(val) { this.$store.commit('setPreviewVisible', val) + }, + panelInfo: { + handler(newVal, oldVla) { + this.initWatermark() + }, + deep: true } }, created() { @@ -785,6 +793,7 @@ export default { listenGlobalKeyDown() }, mounted() { + this.initWatermark() this.initEvents() const _this = this const erd = elementResizeDetectorMaker() @@ -811,6 +820,14 @@ export default { elx && elx.remove() }, methods: { + initWatermark() { + if (this.panelInfo.watermarkInfo) { + userLoginInfo().then(res => { + const userInfo = res.data + activeWatermark(this.panelInfo.watermarkInfo.settingContent, userInfo, 'canvasInfo-main', this.canvasId, this.panelInfo.watermarkOpen) + }) + } + }, componentOnDrag() { this.show = false },