refactor: 水印显示优化

This commit is contained in:
wangjiahao 2022-11-17 15:50:43 +08:00
parent 954d24186f
commit c8159b4031
3 changed files with 18 additions and 18 deletions

View File

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

View File

@ -319,7 +319,7 @@ export default {
},
methods: {
initWatermark() {
if (this.panelInfo.watermarkInfo) {
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)

View File

@ -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
},