Merge pull request #3778 from dataease/pr@dev@refactor_watermark

refactor: 水印显示优化
This commit is contained in:
xuwei-fit2cloud 2022-11-17 16:26:52 +08:00 committed by GitHub
commit 5199aaae8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 20 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

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

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