Merge pull request #8144 from dataease/pr@dev@fix_water-init

fix(仪表板): 修复社区板仪表板因不支持水印设置导致的控制台报错问题
This commit is contained in:
王嘉豪 2024-02-23 16:55:17 +08:00 committed by GitHub
commit 5904fbf0a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 38 additions and 18 deletions

View File

@ -1,6 +1,8 @@
package io.dataease.substitute.permissions.user; package io.dataease.substitute.permissions.user;
import io.dataease.api.permissions.user.vo.UserFormVO;
import io.dataease.utils.IPUtils;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -25,4 +27,15 @@ public class SubstituteUserServer {
result.put("language", "zh-CN"); result.put("language", "zh-CN");
return result; return result;
} }
@GetMapping("/personInfo")
public UserFormVO personInfo() {
UserFormVO userFormVO = new UserFormVO();
userFormVO.setId(1L);
userFormVO.setAccount("admin");
userFormVO.setName("管理员");
userFormVO.setIp(IPUtils.get());
// 当前模式为无XPack
userFormVO.setModel("lose");
return userFormVO;
}
} }

View File

@ -222,7 +222,7 @@ const initWatermark = (waterDomId = 'editor-canvas-main') => {
isMainCanvas(canvasId.value) isMainCanvas(canvasId.value)
) { ) {
const scale = dashboardActive.value ? 1 : curScale.value const scale = dashboardActive.value ? 1 : curScale.value
if (userInfo.value) { if (userInfo.value && userInfo.value.model !== 'lose') {
activeWatermark( activeWatermark(
dvInfo.value.watermarkInfo.settingContent, dvInfo.value.watermarkInfo.settingContent,
userInfo.value, userInfo.value,
@ -235,14 +235,16 @@ const initWatermark = (waterDomId = 'editor-canvas-main') => {
const method = personInfoApi const method = personInfoApi
method().then(res => { method().then(res => {
userInfo.value = res.data userInfo.value = res.data
activeWatermark( if (userInfo.value && userInfo.value.model !== 'lose') {
dvInfo.value.watermarkInfo.settingContent, activeWatermark(
userInfo.value, dvInfo.value.watermarkInfo.settingContent,
waterDomId, userInfo.value,
canvasId.value, waterDomId,
dvInfo.value.selfWatermarkStatus, canvasId.value,
scale dvInfo.value.selfWatermarkStatus,
) scale
)
}
}) })
} }
} }

View File

@ -190,7 +190,7 @@ const initRefreshTimer = () => {
const initWatermark = (waterDomId = 'preview-canvas-main') => { const initWatermark = (waterDomId = 'preview-canvas-main') => {
if (dvInfo.value.watermarkInfo && isMainCanvas(canvasId.value)) { if (dvInfo.value.watermarkInfo && isMainCanvas(canvasId.value)) {
if (userInfo.value) { if (userInfo.value && userInfo.value.model !== 'lose') {
activeWatermark( activeWatermark(
dvInfo.value.watermarkInfo.settingContent, dvInfo.value.watermarkInfo.settingContent,
userInfo.value, userInfo.value,
@ -203,14 +203,16 @@ const initWatermark = (waterDomId = 'preview-canvas-main') => {
const method = personInfoApi const method = personInfoApi
method().then(res => { method().then(res => {
userInfo.value = res.data userInfo.value = res.data
activeWatermark( if (userInfo.value && userInfo.value.model !== 'lose') {
dvInfo.value.watermarkInfo.settingContent, activeWatermark(
userInfo.value, dvInfo.value.watermarkInfo.settingContent,
waterDomId, userInfo.value,
canvasId.value, waterDomId,
dvInfo.value.selfWatermarkStatus, canvasId.value,
scaleWidth.value / 100 dvInfo.value.selfWatermarkStatus,
) scaleWidth.value / 100
)
}
}) })
} }
} }

View File

@ -39,4 +39,7 @@ public class UserFormVO implements Serializable {
@Schema(description = "IP") @Schema(description = "IP")
private String ip; private String ip;
@Schema(description = "模式")
private String model;
} }