From 861bdceaa2fbc6102781d35fd1bfec26e7ddd24f Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Wed, 6 Nov 2024 11:10:14 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E4=BB=AA=E8=A1=A8=E6=9D=BF):=20=E5=88=86?= =?UTF-8?q?=E4=BA=AB=E9=93=BE=E6=8E=A5=E5=8F=AF=E4=BB=A5=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E5=88=B0=E5=88=86=E4=BA=AB=E8=80=85=E6=95=8F=E6=84=9F=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=20#13135?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/core-frontend/src/api/user.ts | 2 ++ .../src/components/watermark/watermark.ts | 4 ++-- .../views/dashboard/DashboardPreviewShow.vue | 19 +++++++----------- .../views/data-visualization/PreviewShow.vue | 20 +++++++------------ de-xpack | 2 +- .../api/permissions/user/api/UserApi.java | 4 ++++ .../api/permissions/user/vo/CurIpVO.java | 18 +++++++++++++++++ 7 files changed, 41 insertions(+), 28 deletions(-) create mode 100644 sdk/api/api-permissions/src/main/java/io/dataease/api/permissions/user/vo/CurIpVO.java diff --git a/core/core-frontend/src/api/user.ts b/core/core-frontend/src/api/user.ts index d02e0a227a..19a23e94bc 100644 --- a/core/core-frontend/src/api/user.ts +++ b/core/core-frontend/src/api/user.ts @@ -32,6 +32,8 @@ export const queryFormApi = uid => request.get({ url: `/user/queryById/${uid}` } export const personInfoApi = () => request.get({ url: `/user/personInfo` }) +export const ipInfoApi = () => request.get({ url: `/user/ipInfo` }) + export const roleCreateApi = data => request.post({ url: '/role/create', data }) export const roleEditApi = data => request.post({ url: '/role/edit', data }) diff --git a/core/core-frontend/src/components/watermark/watermark.ts b/core/core-frontend/src/components/watermark/watermark.ts index 79cc065718..384145eeea 100644 --- a/core/core-frontend/src/components/watermark/watermark.ts +++ b/core/core-frontend/src/components/watermark/watermark.ts @@ -2,7 +2,7 @@ import { storeToRefs } from 'pinia' import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain' import { ref } from 'vue' -import { personInfoApi } from '@/api/user' +import { ipInfoApi } from '@/api/user' const dvMainStore = dvMainStoreWithOut() const { dvInfo } = storeToRefs(dvMainStore) @@ -163,7 +163,7 @@ export function activeWatermarkCheckUser(domId, canvasId, scale = 1) { scale ) } else { - personInfoApi().then(res => { + ipInfoApi().then(res => { userInfo.value = res.data if (userInfo.value && userInfo.value.model !== 'lose') { activeWatermark( diff --git a/core/core-frontend/src/views/dashboard/DashboardPreviewShow.vue b/core/core-frontend/src/views/dashboard/DashboardPreviewShow.vue index 11aa23b3ad..b366921486 100644 --- a/core/core-frontend/src/views/dashboard/DashboardPreviewShow.vue +++ b/core/core-frontend/src/views/dashboard/DashboardPreviewShow.vue @@ -16,9 +16,12 @@ import { Icon } from '@/components/icon-custom' import { download2AppTemplate, downloadCanvas2 } from '@/utils/imgUtils' import { storeToRefs } from 'pinia' import { ElMessage } from 'element-plus-secondary' -import { personInfoApi } from '@/api/user' import AppExportForm from '@/components/de-app/AppExportForm.vue' import { useEmitt } from '@/hooks/web/useEmitt' +import { useUserStoreWithOut } from '@/store/modules/user' +const userStore = useUserStoreWithOut() + +const userName = computed(() => userStore.getName) const appExportFormRef = ref(null) const dvMainStore = dvMainStoreWithOut() @@ -35,8 +38,7 @@ const state = reactive({ canvasStylePreview: null, canvasViewInfoPreview: null, dvInfo: null, - curPreviewGap: 0, - userLoginInfo: {} + curPreviewGap: 0 }) const { fullscreenFlag, canvasViewDataInfo } = storeToRefs(dvMainStore) @@ -141,7 +143,7 @@ const downLoadToAppPre = () => { appName: state.dvInfo.name, icon: null, version: '2.0', - creator: state.userLoginInfo?.name, + creator: userName.value, required: '2.9.0', description: null }) @@ -189,18 +191,11 @@ const resourceNodeClick = data => { } const previewShowFlag = computed(() => !!dvMainStore.dvInfo?.name) -const findUserData = callback => { - personInfoApi().then(rsp => { - callback(rsp) - }) -} + onBeforeMount(() => { if (showPosition.value === 'preview') { dvMainStore.canvasDataInit() } - findUserData(res => { - state.userLoginInfo = res.data - }) }) const sideTreeStatus = ref(true) const changeSideTreeStatus = val => { diff --git a/core/core-frontend/src/views/data-visualization/PreviewShow.vue b/core/core-frontend/src/views/data-visualization/PreviewShow.vue index 9e1b156b9d..bb6de66ba2 100644 --- a/core/core-frontend/src/views/data-visualization/PreviewShow.vue +++ b/core/core-frontend/src/views/data-visualization/PreviewShow.vue @@ -17,10 +17,14 @@ import { download2AppTemplate, downloadCanvas2 } from '@/utils/imgUtils' import MultiplexPreviewShow from '@/views/data-visualization/MultiplexPreviewShow.vue' import DvPreview from '@/views/data-visualization/DvPreview.vue' import AppExportForm from '@/components/de-app/AppExportForm.vue' -import { personInfoApi } from '@/api/user' import { ElMessage } from 'element-plus-secondary' import { useEmitt } from '@/hooks/web/useEmitt' +import { useUserStoreWithOut } from '@/store/modules/user' +const userStore = useUserStoreWithOut() + +const userName = computed(() => userStore.getName) + const dvMainStore = dvMainStoreWithOut() const { dvInfo, canvasViewDataInfo } = storeToRefs(dvMainStore) const previewCanvasContainer = ref(null) @@ -136,7 +140,7 @@ const downLoadToAppPre = () => { appName: state.dvInfo.name, icon: null, version: '2.0', - creator: state.userLoginInfo?.name, + creator: userName.value, required: '2.9.0', description: null }) @@ -170,8 +174,7 @@ const state = reactive({ canvasStylePreview: null, canvasViewInfoPreview: null, dvInfo: null, - curPreviewGap: 0, - userLoginInfo: {} + curPreviewGap: 0 }) const sideTreeStatus = ref(true) @@ -195,12 +198,6 @@ const downLoadApp = appAttachInfo => { fileDownload('app', appAttachInfo) } -const findUserData = callback => { - personInfoApi().then(rsp => { - callback(rsp) - }) -} - onMounted(() => { useEmitt({ name: 'canvasDownload', @@ -218,9 +215,6 @@ onBeforeMount(() => { if (props.showPosition === 'preview') { dvMainStore.canvasDataInit() } - findUserData(res => { - state.userLoginInfo = res.data - }) }) diff --git a/de-xpack b/de-xpack index 7d763d1a73..5f7b10e1f0 160000 --- a/de-xpack +++ b/de-xpack @@ -1 +1 @@ -Subproject commit 7d763d1a73750889a5a6abc6faf658aab3c48099 +Subproject commit 5f7b10e1f05d5819cffb0633b2b9b76d20d005d5 diff --git a/sdk/api/api-permissions/src/main/java/io/dataease/api/permissions/user/api/UserApi.java b/sdk/api/api-permissions/src/main/java/io/dataease/api/permissions/user/api/UserApi.java index 98160872bc..613b0f6384 100644 --- a/sdk/api/api-permissions/src/main/java/io/dataease/api/permissions/user/api/UserApi.java +++ b/sdk/api/api-permissions/src/main/java/io/dataease/api/permissions/user/api/UserApi.java @@ -51,6 +51,10 @@ public interface UserApi { @GetMapping("/personInfo") UserFormVO personInfo(); + @Operation(summary = "查询客户端IP信息") + @GetMapping("/ipInfo") + CurIpVO ipInfo(); + @Operation(summary = "创建") @DePermit("m:read") @PostMapping("/create") diff --git a/sdk/api/api-permissions/src/main/java/io/dataease/api/permissions/user/vo/CurIpVO.java b/sdk/api/api-permissions/src/main/java/io/dataease/api/permissions/user/vo/CurIpVO.java new file mode 100644 index 0000000000..e135bd107d --- /dev/null +++ b/sdk/api/api-permissions/src/main/java/io/dataease/api/permissions/user/vo/CurIpVO.java @@ -0,0 +1,18 @@ +package io.dataease.api.permissions.user.vo; + +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; + +@Data +public class CurIpVO implements Serializable { + @Serial + private static final long serialVersionUID = -3025566841330382707L; + + private String account; + + private String name; + + private String ip; +}