forked from github/dataease
Merge pull request #3778 from dataease/pr@dev@refactor_watermark
refactor: 水印显示优化
This commit is contained in:
commit
5199aaae8f
@ -113,8 +113,6 @@ import generateID from '@/components/canvas/utils/generateID'
|
|||||||
import ButtonDialog from '@/views/panel/filter/ButtonDialog'
|
import ButtonDialog from '@/views/panel/filter/ButtonDialog'
|
||||||
import ButtonResetDialog from '@/views/panel/filter/ButtonResetDialog'
|
import ButtonResetDialog from '@/views/panel/filter/ButtonResetDialog'
|
||||||
import FilterDialog from '@/views/panel/filter/FilterDialog'
|
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'
|
import { uploadFileResult } from '@/api/staticResource/staticResource'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -237,19 +235,12 @@ export default {
|
|||||||
watch: {
|
watch: {
|
||||||
mobileLayoutStatus() {
|
mobileLayoutStatus() {
|
||||||
this.restore()
|
this.restore()
|
||||||
},
|
|
||||||
panelInfo: {
|
|
||||||
handler(newVal, oldVla) {
|
|
||||||
this.initWatermark()
|
|
||||||
},
|
|
||||||
deep: true
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
const _this = this
|
const _this = this
|
||||||
this.initWatermark()
|
|
||||||
// 监听div变动事件
|
// 监听div变动事件
|
||||||
const erd = elementResizeDetectorMaker()
|
const erd = elementResizeDetectorMaker()
|
||||||
erd.listenTo(document.getElementById(this.canvasDomId), element => {
|
erd.listenTo(document.getElementById(this.canvasDomId), element => {
|
||||||
@ -263,14 +254,6 @@ export default {
|
|||||||
bus.$off('button-dialog-edit', this.editButtonDialog)
|
bus.$off('button-dialog-edit', this.editButtonDialog)
|
||||||
},
|
},
|
||||||
methods: {
|
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() {
|
initEvents() {
|
||||||
bus.$on('component-dialog-edit', this.editDialog)
|
bus.$on('component-dialog-edit', this.editDialog)
|
||||||
bus.$on('button-dialog-edit', this.editButtonDialog)
|
bus.$on('button-dialog-edit', this.editButtonDialog)
|
||||||
|
@ -372,9 +372,8 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
initWatermark() {
|
initWatermark() {
|
||||||
if (this.panelInfo.watermarkInfo) {
|
if (this.panelInfo.watermarkInfo && this.canvasId === 'canvas-main') {
|
||||||
const method = this.userId ? proxyUserLoginInfo : userLoginInfo
|
userLoginInfo().then(res => {
|
||||||
method(this.userId).then(res => {
|
|
||||||
const userInfo = res.data
|
const userInfo = res.data
|
||||||
activeWatermark(this.panelInfo.watermarkInfo.settingContent, userInfo, 'preview-main-canvas-main', this.canvasId, this.panelInfo.watermarkOpen)
|
activeWatermark(this.panelInfo.watermarkInfo.settingContent, userInfo, 'preview-main-canvas-main', this.canvasId, this.panelInfo.watermarkOpen)
|
||||||
})
|
})
|
||||||
|
@ -524,6 +524,8 @@ import { adaptCurThemeCommonStyle } from '@/components/canvas/utils/style'
|
|||||||
import eventBus from '@/components/canvas/utils/eventBus'
|
import eventBus from '@/components/canvas/utils/eventBus'
|
||||||
import DeCanvas from '@/components/canvas/DeCanvas'
|
import DeCanvas from '@/components/canvas/DeCanvas'
|
||||||
import TextAttr from '@/components/canvas/components/TextAttr'
|
import TextAttr from '@/components/canvas/components/TextAttr'
|
||||||
|
import { userLoginInfo } from '@/api/systemInfo/userLogin'
|
||||||
|
import { activeWatermark } from '@/components/canvas/tools/watermark'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'PanelEdit',
|
name: 'PanelEdit',
|
||||||
@ -778,6 +780,12 @@ export default {
|
|||||||
},
|
},
|
||||||
previewVisible(val) {
|
previewVisible(val) {
|
||||||
this.$store.commit('setPreviewVisible', val)
|
this.$store.commit('setPreviewVisible', val)
|
||||||
|
},
|
||||||
|
panelInfo: {
|
||||||
|
handler(newVal, oldVla) {
|
||||||
|
this.initWatermark()
|
||||||
|
},
|
||||||
|
deep: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
@ -785,6 +793,7 @@ export default {
|
|||||||
listenGlobalKeyDown()
|
listenGlobalKeyDown()
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
this.initWatermark()
|
||||||
this.initEvents()
|
this.initEvents()
|
||||||
const _this = this
|
const _this = this
|
||||||
const erd = elementResizeDetectorMaker()
|
const erd = elementResizeDetectorMaker()
|
||||||
@ -811,6 +820,14 @@ export default {
|
|||||||
elx && elx.remove()
|
elx && elx.remove()
|
||||||
},
|
},
|
||||||
methods: {
|
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() {
|
componentOnDrag() {
|
||||||
this.show = false
|
this.show = false
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user