Merge pull request #4077 from dataease/pr@dev@fix_panel-watermark-link

fix(仪表板): 修复公共链接中水印导致的控制台异常 #4060
This commit is contained in:
王嘉豪 2022-12-12 17:44:42 +08:00 committed by GitHub
commit 4512094cd8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 14 deletions

View File

@ -156,7 +156,7 @@ import bus from '@/utils/bus'
import { buildFilterMap, buildViewKeyMap, formatCondition, valueValid, viewIdMatch } from '@/utils/conditionUtil'
import { hasDataPermission } from '@/utils/permission'
import { activeWatermark } from '@/components/canvas/tools/watermark'
import { userLoginInfo } from '@/api/systemInfo/userLogin'
import { proxyUserLoginInfo, userLoginInfo } from '@/api/systemInfo/userLogin'
import html2canvas from 'html2canvasde'
import { queryAll } from '@/api/panel/pdfTemplate'
import PDFPreExport from '@/views/panel/export/PDFPreExport'
@ -457,7 +457,8 @@ export default {
if (this.userInfo) {
activeWatermark(this.panelInfo.watermarkInfo.settingContent, this.userInfo, waterDomId, this.canvasId, this.panelInfo.watermarkOpen)
} else {
userLoginInfo().then(res => {
const method = this.userId ? proxyUserLoginInfo : userLoginInfo
method(this.userId).then(res => {
this.userInfo = res.data
activeWatermark(this.panelInfo.watermarkInfo.settingContent, this.userInfo, waterDomId, this.canvasId, this.panelInfo.watermarkOpen)
})

View File

@ -165,12 +165,12 @@
v-show=" show &&showIndex===1"
:canvas-id="canvasId"
/>
<subject-setting v-show=" show &&showIndex===2" />
<assist-component v-show=" show &&showIndex===3" />
<subject-setting v-show=" show &&showIndex===2"/>
<assist-component v-show=" show &&showIndex===3"/>
</div>
</el-drawer>
<!--PC端画布区域-->
<canvas-opt-bar v-if="!previewVisible&&!mobileLayoutStatus" />
<canvas-opt-bar v-if="!previewVisible&&!mobileLayoutStatus"/>
<de-canvas
v-if="!previewVisible&&!mobileLayoutStatus"
ref="canvasMainRef"
@ -196,7 +196,7 @@
:style="customCanvasMobileStyle"
class="this_mobile_canvas"
>
<el-row class="this_mobile_canvas_top" />
<el-row class="this_mobile_canvas_top"/>
<el-row class="this_mobile_canvas_inner_top">
{{ panelInfo.name }}
</el-row>
@ -205,7 +205,7 @@
class="this_mobile_canvas_main"
:style="mobileCanvasStyle"
>
<canvas-opt-bar v-if="!previewVisible&&mobileLayoutStatus" />
<canvas-opt-bar v-if="!previewVisible&&mobileLayoutStatus"/>
<de-canvas
v-if="!previewVisible&&mobileLayoutStatus"
ref="canvasMainRef"
@ -243,14 +243,14 @@
/>
</el-col>
</el-row>
<el-row class="this_mobile_canvas_bottom" />
<el-row class="this_mobile_canvas_bottom"/>
</div>
</el-col>
<el-col
:span="16"
class="this_mobile_canvas_cell this_mobile_canvas_wait_cell"
>
<component-wait />
<component-wait/>
</el-col>
</el-row>
</de-main-container>
@ -268,7 +268,7 @@
/>
</div>
<div v-if="showBatchViewToolsAside">
<chart-style-batch-set />
<chart-style-batch-set/>
</div>
<div v-if="!showViewToolsAside&&!showBatchViewToolsAside">
<el-row style="height: 40px">
@ -287,7 +287,7 @@
>{{ $t('panel.position_adjust') }}</span>
</el-row>
<el-row>
<position-adjust v-if="curComponent&&!curComponent.auxiliaryMatrix" />
<position-adjust v-if="curComponent&&!curComponent.auxiliaryMatrix"/>
<div
v-else
class="view-selected-message-class"
@ -565,6 +565,7 @@ export default {
},
data() {
return {
userInfo: null,
canvasId: 'canvas-main',
panelCacheExist: false,
viewData: [],
@ -798,6 +799,18 @@ export default {
this.initWatermark()
},
deep: true
},
rightDrawOpen: {
handler(newVal, oldVla) {
this.initWatermark()
},
deep: true
},
outStyle: {
handler(newVal, oldVla) {
this.initWatermark()
},
deep: true
}
},
created() {
@ -831,9 +844,15 @@ export default {
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)
this.$nextTick(() => {
if (this.userInfo) {
activeWatermark(this.panelInfo.watermarkInfo.settingContent, this.userInfo, 'canvasInfo-main', this.canvasId, this.panelInfo.watermarkOpen)
} else {
userLoginInfo().then(res => {
this.userInfo = res.data
activeWatermark(this.panelInfo.watermarkInfo.settingContent, this.userInfo, 'canvasInfo-main', this.canvasId, this.panelInfo.watermarkOpen)
})
}
})
}
},